diff --git a/Directory.Build.props b/Directory.Build.props
index beb527a9..1c42bd02 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -3,7 +3,7 @@
Vladimir Khil
Khil-soft
7.10.0
- 5.11.2
+ 5.11.3
2.14.0
diff --git a/src/Common/SIPackages/ContentItem.cs b/src/Common/SIPackages/ContentItem.cs
index 423a16d4..da4a987b 100644
--- a/src/Common/SIPackages/ContentItem.cs
+++ b/src/Common/SIPackages/ContentItem.cs
@@ -235,6 +235,10 @@ public void WriteXml(XmlWriter writer)
{
writer.WriteAttributeString("placement", _placement);
}
+ else if (_type == ContentTypes.Audio || _type == AtomTypes.Audio) // For backward compatibility; remove later
+ {
+ writer.WriteAttributeString("placement", GetDefaultPlacement());
+ }
if (_duration != DefaultDuration)
{
diff --git a/src/SIQuester/SIQuester.ViewModel/Items/ThemeViewModel.cs b/src/SIQuester/SIQuester.ViewModel/Items/ThemeViewModel.cs
index 949c694f..57fbabee 100644
--- a/src/SIQuester/SIQuester.ViewModel/Items/ThemeViewModel.cs
+++ b/src/SIQuester/SIQuester.ViewModel/Items/ThemeViewModel.cs
@@ -183,7 +183,10 @@ private void AddQuestion_Executed(object? arg)
var questionViewModel = new QuestionViewModel(question);
Questions.Add(questionViewModel);
- QDocument.ActivatedObject = questionViewModel.Scenario.FirstOrDefault();
+ QDocument.ActivatedObject = IsUpgraded
+ ? questionViewModel.Parameters?.FirstOrDefault().Value.ContentValue?.FirstOrDefault()
+ : questionViewModel.Scenario.FirstOrDefault();
+
document.Navigate.Execute(questionViewModel);
}
catch (Exception exc)
diff --git a/src/SIQuester/SIQuester.ViewModel/Workspaces/QDocument.cs b/src/SIQuester/SIQuester.ViewModel/Workspaces/QDocument.cs
index 4fb62498..b61e8869 100644
--- a/src/SIQuester/SIQuester.ViewModel/Workspaces/QDocument.cs
+++ b/src/SIQuester/SIQuester.ViewModel/Workspaces/QDocument.cs
@@ -248,6 +248,11 @@ internal void ClearLinks(QuestionViewModel question)
{
ClearLinks(atom);
}
+
+ foreach (var content in question.Model.GetContent())
+ {
+ ClearLinks(content);
+ }
}
internal void ClearLinks(AtomViewModel atom)
@@ -1285,7 +1290,7 @@ internal QDocument(
StorageContext = storageContextViewModel;
ImportSiq = new SimpleCommand(ImportSiq_Executed);
-
+
Save = new AsyncCommand(Save_Executed);
SaveAs = new AsyncCommand(SaveAs_Executed);
SaveAsTemplate = new AsyncCommand(SaveAsTemplate_Executed);
@@ -1306,7 +1311,7 @@ internal QDocument(
ConvertToMillionaire = new SimpleCommand(ConvertToMillionaire_Executed);
ConvertToSportSI = new SimpleCommand(ConvertToSportSI_Executed);
- Wikify = new SimpleCommand(Wikify_Executed);
+ Wikify = new SimpleCommand(Wikify_Executed);
Navigate = new SimpleCommand(Navigate_Executed);
@@ -1413,7 +1418,7 @@ private ICollection FillFiles(MediaStorageViewModel mediaStorage, int ma
{
warnings.Add(new WarningViewModel(string.Format(Resources.FileIsDuplicated, name), () => NavigateToStorageItem(mediaStorage, item)));
}
-
+
if (AppSettings.Default.CheckFileSize && mediaStorage.GetLength(item.Model.Name) > maxFileSize * 1024)
{
warnings.Add(new WarningViewModel(string.Format(Resources.MediaFileTooLarge, name, maxFileSize), () => NavigateToStorageItem(mediaStorage, item)));
@@ -1436,7 +1441,7 @@ internal void NavigateToStorageItem(MediaStorageViewModel mediaStorage, MediaIte
/// Checks missing and unused files in document.
///
/// Allow external files to be used.
- internal (IEnumerable,string) CheckLinks(bool allowExternal = false)
+ internal (IEnumerable, string) CheckLinks(bool allowExternal = false)
{
var warnings = new List();
var errors = new List();
@@ -1453,7 +1458,7 @@ internal void NavigateToStorageItem(MediaStorageViewModel mediaStorage, MediaIte
foreach (var item in images.Except(usedImages))
{
warnings.Add(
- new WarningViewModel(string.Format(Resources.UnusedFile, item),
+ new WarningViewModel(string.Format(Resources.UnusedFile, item),
() => NavigateToStorageItem(Images, Images.Files.FirstOrDefault(f => f.Model.Name == item))));
}
@@ -2963,6 +2968,14 @@ private void WikifyAsync()
}
}
+ foreach (var item in quest.Model.GetContent())
+ {
+ if (item.Type == ContentTypes.Text)
+ {
+ item.Value = item.Value.Wikify();
+ }
+ }
+
for (int i = 0; i < quest.Right.Count; i++)
{
var value = quest.Right[i];
@@ -3044,7 +3057,7 @@ private void ConvertToCompTvSI_Executed(object? arg)
allthemes.Add(theme);
}
}
-
+
while (Package.Rounds.Count > 0)
{
Package.Rounds.RemoveAt(0);
@@ -3685,7 +3698,7 @@ internal void RestoreFromFolder(DirectoryInfo folder)
Package.Tags.Merge(package.Tags);
Package.Model.Language = package.Language;
- Package.Model.Publisher= package.Publisher;
+ Package.Model.Publisher = package.Publisher;
Package.Model.Date = package.Date;
Package.Model.Difficulty = package.Difficulty;
Package.Model.Name = package.Name;
diff --git a/src/SIQuester/SIQuester.ViewModel/Workspaces/Sidebar/MediaStorageViewModel.cs b/src/SIQuester/SIQuester.ViewModel/Workspaces/Sidebar/MediaStorageViewModel.cs
index aaa4b9ed..2388a13b 100644
--- a/src/SIQuester/SIQuester.ViewModel/Workspaces/Sidebar/MediaStorageViewModel.cs
+++ b/src/SIQuester/SIQuester.ViewModel/Workspaces/Sidebar/MediaStorageViewModel.cs
@@ -17,6 +17,8 @@ public sealed class MediaStorageViewModel : WorkspaceViewModel
{
private readonly QDocument _document;
+ private readonly int _internalId = Random.Shared.Next();
+
///
/// Добавленные файлы
///
@@ -619,6 +621,7 @@ internal long GetLength(string link) =>
return collection.GetFileLength(link);
});
+ // TODO: switch from IMedia to MediaInfo struct
internal IMedia Wrap(string link)
{
var pendingStream = _streams.FirstOrDefault(n => n.Key.Model.Name == link);
@@ -631,10 +634,10 @@ internal IMedia Wrap(string link)
return _document.Lock.WithLock(
() =>
{
- var collection = _document.GetInternalCollection(_name);
-
+ var collection = _document.GetInternalCollection(_name); // This value cannot be cached as internal collection link can eventually change
+
return PlatformManager.Instance.PrepareMedia(
- new Media(() => collection.GetFile(link), () => collection.GetFileLength(link), /*Uri.EscapeDataString(_document.Path) + _document.Package.Model.ID +*/ link),
+ new Media(() => collection.GetFile(link), () => collection.GetFileLength(link), _internalId + link),
collection.Name);
});
}