From 53ea0d31bf59719469dd827936790754d7c114b1 Mon Sep 17 00:00:00 2001 From: Mask Date: Wed, 16 Mar 2022 21:23:32 +0300 Subject: [PATCH] The patch functionality is finished --- .gitignore | 1 + Program/ClassDiagram.cd | 21 +++----- Program/ClassDiagram1.cd | 51 ------------------ Program/Handler.cs | 37 ++++++------- Program/IDefaultSettings.cs | 11 +++- Program/Information.xaml | 3 +- Program/Information.xaml.cs | 19 +++++-- Program/MainWindow.xaml | 12 ++++- Program/MainWindow.xaml.cs | 63 ++++++++++++----------- Program/Platform.cs | 6 +-- Program/Properties/Resources.Designer.cs | 10 ---- Program/Properties/Resources.resx | 4 -- Program/Resources/button.png | Bin 18243 -> 0 bytes Program/xmlAdapter.cs | 13 ++--- Program/xmlparser.csproj | 8 --- 15 files changed, 99 insertions(+), 160 deletions(-) delete mode 100644 Program/ClassDiagram1.cd delete mode 100644 Program/Resources/button.png diff --git a/.gitignore b/.gitignore index 874d81c..198dc43 100644 --- a/.gitignore +++ b/.gitignore @@ -353,3 +353,4 @@ MigrationBackup/ *.xlsx *links *db +*/Resources/ diff --git a/Program/ClassDiagram.cd b/Program/ClassDiagram.cd index 36c2609..2dad9ef 100644 --- a/Program/ClassDiagram.cd +++ b/Program/ClassDiagram.cd @@ -1,13 +1,5 @@  - - - - gAIAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAABAA= - DataBase.cs - - - @@ -18,29 +10,28 @@ - AAIAAgQABACAIgAAACAAAAAAAAASUAACAAgAAACgAAA= + AAIAAoQABAAAIgAAACAAAAAIAAASUAAAAAgAAACgAAA= Handler.cs - + - AAAAAAAAAAAAAAQAAAAAAQAACBAAQAgAACAAAAAAAAA= + AAAAAAAAAAAAAAQAAAAAAAAACBAAQAgAACAAAAAAAAA= xmlAdapter.cs - - AAAAAAkAACAAEgBAAAAAAAAAAgAgIABACAAAAAAAAAA= + AAAAoQsAACAgAgBAAAAAAAAAAgEgIABQCAAAAAAAAAA= Platform.cs - AAAIAAAAAAAAAAYIAAAAAAAAAgACAAABAAAFBBBAAAA= + AEAIAAAAAAAAAAYIAAAAAAAAAgADAAABAAGEBBAAAAA= MainWindow.xaml.cs @@ -69,7 +60,7 @@ - AAACAAAAAAACAAAAAAAAAwgAAAAAAACAAgAAAAAAAAA= + AAACAAAAAAACAAAAAAAAAgAAAAAAAACAAgAAAAAAAAA= IDefaultSettings.cs diff --git a/Program/ClassDiagram1.cd b/Program/ClassDiagram1.cd deleted file mode 100644 index a81af13..0000000 --- a/Program/ClassDiagram1.cd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAA= - Content.cs - - - - - - AAAAAQAAACAAAgAAAAEAAAAAAAAAAAAAAAEAAAAUAAA= - Information.xaml.cs - - - - - - - AAIAAoQABAAAIgAAACAAAAAIAAASUAAAAAgAAACgAAA= - Handler.cs - - - - - - AAAAAAAAAAAAAAQAAAAAAAAACBAAQAgAACAAAAAAAAA= - xmlAdapter.cs - - - - - - AAAAAAgAACAggoBAAAAEAAAAAgAAIAAACAAAAAAAAAA= - Platform.cs - - - - - - AAACAAAAAAACAAAAAAAAAgAAAAAAAACAAgAAAAAAAAA= - IDefaultSettings.cs - - - - - - - - \ No newline at end of file diff --git a/Program/Handler.cs b/Program/Handler.cs index 8a7691c..ede1054 100644 --- a/Program/Handler.cs +++ b/Program/Handler.cs @@ -24,21 +24,11 @@ internal class Handler public Handler() { - try - { - _grossWeightQuantity = 0; - _netWeightQuantity = 0; - _positions = 0; - _awb = new List<(string, string)>(); - _data = new List<(string, string)>(); - } - catch (Exception exception) { MessageBox.Show(exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } - finally - { - this._grossWeightQuantity = default; - this._netWeightQuantity = default; - this._positions = default; - } + _grossWeightQuantity = 0; + _netWeightQuantity = 0; + _positions = 0; + _awb = new(); + _data = new(); } public List<(string, string)> XmlHandler(in string file) @@ -49,7 +39,8 @@ public Handler() if (File.Exists(file)) document.Load(file); else document.LoadXml(file); } - catch (Exception exp) { MessageBox.Show(exp.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return new List<(string, string)>() { ("Файл повреждён", "Неудалось прочитать файл") }; } + catch (Exception exp) { MessageBox.Show(exp.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); + return new List<(string, string)>() { ("Файл повреждён", "Неудалось прочитать файл") }; } var book = Open(); @@ -70,7 +61,7 @@ public Handler() break; case "ESADout_CUConsigment": foreach (XmlNode transport in info.ChildNodes) - foreach(XmlNode unused in transport) + foreach (XmlNode unused in transport) Collect(Search("catESAD_cu:TransportIdentifier", info, "Транспорт"), book); break; case "ESADout_CUMainContractTerms": @@ -82,7 +73,10 @@ public Handler() Calc(Search("catESAD_cu:GrossWeightQuantity", info, "Масса брутто").Item2, ref _grossWeightQuantity); Calc(Search("catESAD_cu:NetWeightQuantity", info, "Масса нетто").Item2, ref _netWeightQuantity); break; + default: + break; } + foreach (XmlNode product in info.ChildNodes) { foreach (XmlNode count in product.ChildNodes) @@ -90,6 +84,7 @@ public Handler() foreach (var about in count.Cast().Where(about => about.Name == "catESAD_cu:GoodsGroupQuantity")) Calc(Search("catESAD_cu:GoodsQuantity", about, "Количество товара").Item2, ref _positions); } + foreach (XmlNode doc in info) { if (doc.Name == "ESADout_CUPresentedDocument") @@ -103,15 +98,15 @@ public Handler() } } } - } + } Collect(("Общая масса брутто", this._grossWeightQuantity.ToString(CultureInfo.InvariantCulture)), book); - Collect(("Общая масса нетто", this._netWeightQuantity.ToString(CultureInfo.InvariantCulture)), book); + Collect(("Общая масса нетто", this._netWeightQuantity.ToString(CultureInfo.InvariantCulture)), book); Collect(("Всего позиций", this._positions.ToString(CultureInfo.InvariantCulture)), book); foreach (var pair in _awb.Distinct()) Collect(pair, book); Close(book.Item1); return this._data; } - + //auxiliary methods private static void Close(IWorkbook wb) { @@ -163,6 +158,6 @@ private void Collect((string, string) value, (IWorkbook, ISheet) book) Save(value, book); } private static bool Validation((string, string) value) => !string.IsNullOrWhiteSpace(value.Item1) || !string.IsNullOrWhiteSpace(value.Item2); - + } } diff --git a/Program/IDefaultSettings.cs b/Program/IDefaultSettings.cs index 53a7202..db3792f 100644 --- a/Program/IDefaultSettings.cs +++ b/Program/IDefaultSettings.cs @@ -1,10 +1,19 @@ using System.Collections.Generic; +using System.IO; namespace XmlParser { public interface IDefaultSettings { - const string DefaultPath = "../../../Resources/"; + static string DefaultPath { + get + { + string path = "../../../Resources/"; + if (!Directory.Exists(path)) + Directory.CreateDirectory(path); + return path; + } + } static string NameExcelFile => DefaultPath + "declarationInfo.xlsx"; static string IndexFileName => DefaultPath + "links"; static string DataFileName => DefaultPath + "db"; diff --git a/Program/Information.xaml b/Program/Information.xaml index 3404c38..d0fa529 100644 --- a/Program/Information.xaml +++ b/Program/Information.xaml @@ -10,8 +10,7 @@ - + diff --git a/Program/MainWindow.xaml.cs b/Program/MainWindow.xaml.cs index 5829c25..7591060 100644 --- a/Program/MainWindow.xaml.cs +++ b/Program/MainWindow.xaml.cs @@ -14,7 +14,7 @@ public partial class MainWindow private string _fileName; private bool _dataBaseFlag = false; private static void Copy(string text) => Clipboard.SetText(text); - + //получает путь к обрабаываемому файлу private static void GetPath(out string directoryName, out string fileName) { @@ -27,7 +27,7 @@ private static void GetPath(out string directoryName, out string fileName) } catch (Exception exception1) { - if (MessageBox.Show( $"Ошибка - {exception1.HResult}\nНажмите OK чтобы скопировать код ошибки, или нажмите Отмена чтобы переписать самостоятельно", + if (MessageBox.Show($"Ошибка - {exception1.HResult}\nНажмите OK чтобы скопировать код ошибки, или нажмите Отмена чтобы переписать самостоятельно", "Ошибка получения пути", MessageBoxButton.OKCancel, MessageBoxImage.Error) == MessageBoxResult.OK) Copy(exception1.HResult.ToString()); @@ -57,11 +57,11 @@ private void SetSource() try { GetPath(out this._directoryName, out this._fileName); - if ( new[] { _directoryName, _fileName }.Any(string.IsNullOrWhiteSpace)) + if (new[] { _directoryName, _fileName }.Any(string.IsNullOrWhiteSpace)) throw new IOException("Null path"); GetFile(); - var declarations = _fileNames.Select(item => new Content - { FileName = item }).ToList(); + var declarations = _fileNames.Select(item => new Content + { FileName = item }).ToList(); Data.ItemsSource = declarations; } @@ -84,14 +84,12 @@ private void Btn_Click(object sender, RoutedEventArgs e) if (Data.SelectedItem is not Content path) return; if (_dataBaseFlag) { - using (XmlAdapter adapter = new()) - { - string path1 = adapter.GetContent(path.FileName); - info = new(path1); - } + using XmlAdapter adapter = new(); + string path1 = adapter.GetContent(path.FileName); + info = new(path1); } else - { + { info = new(path.FileName); AddFile(path.FileName); } @@ -99,28 +97,33 @@ private void Btn_Click(object sender, RoutedEventArgs e) } private static void AddFile(string name) { - using var reader = XmlReader.Create(name); - if (reader.IsEmptyElement) return; - using (XmlAdapter adapter = new()) - { - string xml = ""; - string filename = Path.GetFileName(name); - adapter.CreateLink(xml, filename); - } + using XmlAdapter adapter = new(); + if (adapter.IsLinks(name)) + return; + + XmlDocument document = new(); + document.Load(name); + XmlElement root = document.DocumentElement; + + string xml = root.OuterXml; + string filename = Path.GetFileName(name); + adapter.CreateLink(xml, filename); } - private void OpenFromDatabase() - { - _dataBaseFlag = _dataBaseFlag == false; + private List OpenFromDatabase() + { List contents = new(); - using (XmlAdapter @base = new()) { - var data = @base.GetAllFileNames(); - if(data != default) contents.AddRange(data.Select(para => new Content { FileName = para })); - } - Data.ItemsSource = contents; - Data.Items.Refresh(); + using XmlAdapter @base = new(); + var data = @base.GetAllFileNames(); + if (data != default) contents.AddRange(data.Select(para => new Content { FileName = para })); + return contents; + } + private void Open_Click(object sender, RoutedEventArgs e) + { + _dataBaseFlag = !_dataBaseFlag; + Data.ItemsSource = OpenData(_dataBaseFlag); } - private void Change_Click(object sender, RoutedEventArgs e) {} - private void Open_Click(object sender, RoutedEventArgs e) => OpenFromDatabase(); + private List OpenData(bool _dataBaseFlag) => _dataBaseFlag ? OpenFromDatabase() : OpenFromDirectory(); + private List OpenFromDirectory() => _fileNames.Select(item => new Content { FileName = item }).ToList(); } } diff --git a/Program/Platform.cs b/Program/Platform.cs index 7186637..aab6e9c 100644 --- a/Program/Platform.cs +++ b/Program/Platform.cs @@ -26,11 +26,11 @@ public class Platform : DisposableBase private readonly CachingConverterDecorator _unicodeSequenceToStringConverter; private readonly UInt64SplitMemoryLinks _disposableLinks; protected readonly UInt64Links Links; - public Platform() + public Platform(string DataFileName, string IndexFileName) { - var dataMemory = new FileMappedResizableDirectMemory(IDefaultSettings.DataFileName); - var indexMemory = new FileMappedResizableDirectMemory(IDefaultSettings.IndexFileName); + var dataMemory = new FileMappedResizableDirectMemory(DataFileName); + var indexMemory = new FileMappedResizableDirectMemory(IndexFileName); var linksConstants = new LinksConstants(enableExternalReferencesSupport: true); diff --git a/Program/Properties/Resources.Designer.cs b/Program/Properties/Resources.Designer.cs index 460d832..9609ea5 100644 --- a/Program/Properties/Resources.Designer.cs +++ b/Program/Properties/Resources.Designer.cs @@ -59,15 +59,5 @@ internal Resources() { resourceCulture = value; } } - - /// - /// Поиск локализованного ресурса типа System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap button { - get { - object obj = ResourceManager.GetObject("button", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } } } diff --git a/Program/Properties/Resources.resx b/Program/Properties/Resources.resx index b17c26b..1af7de1 100644 --- a/Program/Properties/Resources.resx +++ b/Program/Properties/Resources.resx @@ -117,8 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\Resources\button.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - \ No newline at end of file diff --git a/Program/Resources/button.png b/Program/Resources/button.png deleted file mode 100644 index 05927ec3e16635d4b842879a554697d1d6e58e20..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18243 zcmeHuWmFwq(k|}q?(PS7cXxsWKj^_7g1fszaJS%Y0fI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=)!I0B3kf^`ZEdp90oyJPR$#!!^#A?v+;Q`xus&MC<+4I4tuv<++u`S}ExAS#Z0e z8JVVS_qwE)E)H!VUCch-$uFf4E^KCGJLP=p1nr1J7jX5u3Hy*Kp(RWO^n9aTr+#|- z37tB~oJp(YUZ)BNL2&bSYZsZh@oVQB;XJkaJ=LF6oHX`N)kbgbly~H_Y{{DajFm~) zHMy|8la!Xy-2Ec+V<8oP-brI;x!q_(-$z({bPS5NZ(n{}uOR(^&z{#ZTXl)DuI=5H z3cR}8^Li4N#_Hdm^$p(>@$v4m`?1#a73xY*1ouk3(I zr*VmCoGwfQk!ZBx$hf8iUOu&l%Zb|&gFe|3ar$NH@K?r2k?whsWFu31^C}HZP+1ty zb(h)Q^?M0oK4kTpOs@9nh)Tss^Et0AeltaK0E)kV*W>qBqsvf#Q)-lvBWcrTtdN-_ zRrSb}P`|iU%LS6*y8*v*p1A8||4$^0*d3>gN9=r^A9K>CBsVYAtRCTCFCw~Mc;eTG vqJQ`T@*^queT-GRwTDNELh8wdR#*8fzo diff --git a/Program/xmlAdapter.cs b/Program/xmlAdapter.cs index aefa8d6..0923d64 100644 --- a/Program/xmlAdapter.cs +++ b/Program/xmlAdapter.cs @@ -9,17 +9,14 @@ namespace XmlParser public class XmlAdapter : Platform { private readonly ulong _fileNameMarker; - - private Link Query(ulong marker) => new(this.Links.Constants.Any, marker, this.Links.Constants.Any); + public Link Query(ulong marker) => new(this.Links.Constants.Any, marker, this.Links.Constants.Any); public void CreateLink(in string innerXml, string filename) { - var nameLink = ConvertToSequence(filename); var documentLink = ConvertToSequence(innerXml); Links.GetOrCreate(_fileNameMarker, nameLink); Links.GetOrCreate(nameLink, documentLink); } - public List GetAllFileNames() { var names = new List(); @@ -34,10 +31,10 @@ public List GetAllFileNames() }, query); return names; } - public string GetContent(string filename) => ConvertToString(Links.SearchOrDefault(ConvertToSequence(filename), Links.Constants.Any)); - private bool IsLinks(Link query) => this.Links.Count(query) > 0; - - public XmlAdapter() => _fileNameMarker = Links.GetOrCreate(ConvertToSequence(nameof(_fileNameMarker)), ConvertToSequence(nameof(_fileNameMarker))); + public string GetContent(string filename) => ConvertToString(Links.GetTarget(Links.SearchOrDefault(ConvertToSequence(filename), Links.Constants.Any))); + public bool IsLinks(Link query) => this.Links.Count(query) > 0; + public bool IsLinks(string element) => this.Links.Count(Query(ConvertToSequence(element))) > 0; + public XmlAdapter() : base(IDefaultSettings.DataFileName, IDefaultSettings.IndexFileName) => _fileNameMarker = Links.GetOrCreate(ConvertToSequence(nameof(_fileNameMarker)), ConvertToSequence(nameof(_fileNameMarker))); } } \ No newline at end of file diff --git a/Program/xmlparser.csproj b/Program/xmlparser.csproj index 2f86dac..53f0554 100644 --- a/Program/xmlparser.csproj +++ b/Program/xmlparser.csproj @@ -11,10 +11,6 @@ true - - - - @@ -22,10 +18,6 @@ - - - - True