From 3eafaed975845af3689f27a60a860fb82a1a2c31 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Thu, 23 Mar 2023 09:39:25 +0330 Subject: [PATCH] 1.0.5 --- gsync2vid/PoemAudioListProcessor.cs | 237 --------------------------- gsync2vid/Properties/AssemblyInfo.cs | 6 +- gsync2vid/gsync2vid.csproj | 5 +- gsync2vid/packages.config | 2 +- 4 files changed, 6 insertions(+), 244 deletions(-) delete mode 100644 gsync2vid/PoemAudioListProcessor.cs diff --git a/gsync2vid/PoemAudioListProcessor.cs b/gsync2vid/PoemAudioListProcessor.cs deleted file mode 100644 index 2fe7ab5..0000000 --- a/gsync2vid/PoemAudioListProcessor.cs +++ /dev/null @@ -1,237 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Xml; -using System.Reflection; -using System.IO; - -namespace ganjoor -{ - /// - /// پردازشگر ذخیره و بارگذاری لیستهای اشعار - /// - public class PoemAudioListProcessor - { - - /// - /// ذخیره در فایل - /// - /// - /// - /// - /// - public static bool Save(string FileName, PoemAudio poemAudio, bool oldVersion) - { - List lst = new List(); - lst.Add(poemAudio); - return Save(FileName, lst, oldVersion); - } - - /// - /// ذخیره در فایل - /// - /// - /// - /// - /// - public static bool Save(string FileName, List List, bool oldVersion) - { - XmlDocument doc = new XmlDocument(); - XmlNode poemAudioRootNode = doc.CreateNode(XmlNodeType.Element, "DesktopGanjoorPoemAudioList", ""); - doc.AppendChild(poemAudioRootNode); - foreach (PoemAudio audio in List) - { - XmlNode poemAudioNode = doc.CreateNode(XmlNodeType.Element, "PoemAudio", ""); - foreach (PropertyInfo prop in typeof(PoemAudio).GetProperties()) - { - if (!prop.CanWrite) - continue; - bool ignoreProp = false; - XmlNode propNode = doc.CreateNode(XmlNodeType.Element, prop.Name, ""); - if (prop.PropertyType == typeof(string)) - { - string value = prop.GetValue(audio, null) == null ? "" : prop.GetValue(audio, null).ToString(); - if (string.IsNullOrEmpty(value)) - { - ignoreProp = true; - } - else - propNode.InnerText = value; - } - else - if (prop.PropertyType == typeof(Int32)) - { - int value = Convert.ToInt32(prop.GetValue(audio, null)); - if (value == 0) - { - ignoreProp = true; - } - else - propNode.InnerText = value.ToString(); - } - else - if (prop.PropertyType == typeof(bool)) - { - bool value = Convert.ToBoolean(prop.GetValue(audio, null)); - if (!value) - { - ignoreProp = true; - } - else - propNode.InnerText = value.ToString(); - } - else - if (prop.PropertyType == typeof(Guid)) - { - string value = prop.GetValue(audio, null).ToString(); - if (string.IsNullOrEmpty(value)) - { - ignoreProp = true; - } - else - propNode.InnerText = value; - } - else - { - ignoreProp = true; - } - - if (!ignoreProp) - poemAudioNode.AppendChild(propNode); - } - //رفع اشکال نسخه قدیمی NAudio - XmlNode bugfixNode = doc.CreateNode(XmlNodeType.Element, "OneSecondBugFix", ""); - bugfixNode.InnerText = "1000"; - poemAudioNode.AppendChild(bugfixNode); - - XmlNode syncInfoArrayNode = doc.CreateNode(XmlNodeType.Element, "SyncArray", ""); - if (audio.SyncArray != null) - { - - foreach (PoemAudio.SyncInfo info in audio.SyncArray) - { - XmlNode syncInfoNode = doc.CreateNode(XmlNodeType.Element, "SyncInfo", ""); - - XmlNode vOrderNode = doc.CreateNode(XmlNodeType.Element, "VerseOrder", ""); - vOrderNode.InnerText = info.VerseOrder.ToString(); - syncInfoNode.AppendChild(vOrderNode); - - XmlNode vAudioMiliseconds = doc.CreateNode(XmlNodeType.Element, "AudioMiliseconds", ""); - if (oldVersion) - { - vAudioMiliseconds.InnerText = (info.AudioMiliseconds/2).ToString(); - } - else - vAudioMiliseconds.InnerText = info.AudioMiliseconds.ToString(); - syncInfoNode.AppendChild(vAudioMiliseconds); - - - syncInfoArrayNode.AppendChild(syncInfoNode); - } - } - - poemAudioNode.AppendChild(syncInfoArrayNode); - poemAudioRootNode.AppendChild(poemAudioNode); - } - try - { - doc.Save(FileName); - return true; - } - catch - { - - return false; - } - } - - - /// - /// بارگذاری از فایل - /// - /// - /// - public static List Load(string FileName) - { - List lstPoemAudio = new List(); - - XmlDocument doc = new XmlDocument(); - doc.LoadXml(File.ReadAllText(FileName)); - - //Collect List: - XmlNodeList poemAudioNodes = doc.GetElementsByTagName("PoemAudio"); - foreach (XmlNode poemAudioNode in poemAudioNodes) - { - PoemAudio poemAudioInfo = new PoemAudio(); - poemAudioInfo.IsDirectlyDownloadable = false; - poemAudioInfo.IsUploaded = false; - foreach (XmlNode Node in poemAudioNode.ChildNodes) - { - switch (Node.Name) - { - case "PoemId": - poemAudioInfo.PoemId = Convert.ToInt32(Node.InnerText); - break; - case "Id": - poemAudioInfo.Id = Convert.ToInt32(Node.InnerText); - break; - case "DownloadUrl": - poemAudioInfo.DownloadUrl = Node.InnerText; - break; - case "FilePath": - poemAudioInfo.FilePath = Node.InnerText; - break; - case "Description": - poemAudioInfo.Description = Node.InnerText; - break; - case "SyncGuid": - poemAudioInfo.SyncGuid = Guid.Parse(Node.InnerText); - break; - case "FileCheckSum": - poemAudioInfo.FileCheckSum = Node.InnerText; - break; - case "IsDirectlyDownloadable": - poemAudioInfo.IsDirectlyDownloadable = Convert.ToBoolean(Node.InnerText); - break; - case "IsUploaded": - poemAudioInfo.IsDirectlyDownloadable = Convert.ToBoolean(Node.InnerText); - break; - case "SyncArray": - { - XmlNodeList syncInfoNodeList = Node.SelectNodes("SyncInfo"); - if (syncInfoNodeList != null) - { - List lstSyncInfo = new List(); - - foreach (XmlNode nodeSyncIndo in syncInfoNodeList) - { - - lstSyncInfo.Add( - new PoemAudio.SyncInfo() - { - VerseOrder = Convert.ToInt32(nodeSyncIndo.SelectSingleNode("VerseOrder").InnerText), - AudioMiliseconds = Convert.ToInt32(nodeSyncIndo.SelectSingleNode("AudioMiliseconds").InnerText), - } - ); - } - - if (lstSyncInfo.Count > 0) - { - poemAudioInfo.SyncArray = lstSyncInfo.ToArray(); - } - } - } - break; - - } - - } - lstPoemAudio.Add(poemAudioInfo); - } - - - return lstPoemAudio; - } - - - } -} diff --git a/gsync2vid/Properties/AssemblyInfo.cs b/gsync2vid/Properties/AssemblyInfo.cs index 5dc720c..01408fe 100644 --- a/gsync2vid/Properties/AssemblyInfo.cs +++ b/gsync2vid/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("حمیدرضا محمدی")] [assembly: AssemblyProduct("گنجور رومیزی")] -[assembly: AssemblyCopyright("GPL, 1388-1400, ganjoor.net, Hamid Reza Mohammadi")] +[assembly: AssemblyCopyright("GPL, 1388-1402, ganjoor.net, Hamid Reza Mohammadi")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.0")] -[assembly: AssemblyFileVersion("1.4.0.0")] +[assembly: AssemblyVersion("1.5.0.0")] +[assembly: AssemblyFileVersion("1.5.0.0")] diff --git a/gsync2vid/gsync2vid.csproj b/gsync2vid/gsync2vid.csproj index 7592d64..121b989 100644 --- a/gsync2vid/gsync2vid.csproj +++ b/gsync2vid/gsync2vid.csproj @@ -59,8 +59,8 @@ - - ..\packages\DesktopGanjoorDbBrowser.1.0.6\lib\net472\DesktopGanjoorDbBrowser.dll + + ..\packages\DesktopGanjoorDbBrowser.1.0.7\lib\net472\DesktopGanjoorDbBrowser.dll ..\packages\Splicer.1.1\lib\net45\DirectShowLib-2005.dll @@ -158,7 +158,6 @@ ObjectPropertiesEditor.cs - diff --git a/gsync2vid/packages.config b/gsync2vid/packages.config index 5d7be8a..ef4ea81 100644 --- a/gsync2vid/packages.config +++ b/gsync2vid/packages.config @@ -1,6 +1,6 @@  - +