From a40b2ff597b0755f1ca2828cbe60e977e427b3f9 Mon Sep 17 00:00:00 2001 From: BroPlasmaNinja Date: Wed, 22 May 2024 03:09:54 +0400 Subject: [PATCH] EndOfLab07_1 --- .../projectliner.metadata.v7.bin | Bin 187557 -> 188019 bytes .../projectliner.projects.v7.bin | Bin 835731 -> 942372 bytes .../ProjectLiner/DesignTimeBuild/.dtbcache.v2 | Bin 99116 -> 99116 bytes .../.vs/ProjectLiner/v17/.futdcache.v2 | Bin 160 -> 160 bytes .../.vs/ProjectLiner/v17/DocumentLayout.json | 71 +++++++++++------- .../ListGenericObjects.cs | 10 +-- .../StorageCollection.cs | 31 ++++---- .../Exceptions/CollectionOverflowException.cs | 17 +++++ .../Exceptions/ObjectNotFoundException.cs | 16 ++++ .../PositionOutOfCollectionException.cs | 15 ++++ .../ProjectLiner/FormLinerCollection.cs | 24 ++++-- ProjectLiner/ProjectLiner/Program.cs | 47 ++++++++---- ProjectLiner/ProjectLiner/ProjectLiner.csproj | 11 +++ ProjectLiner/ProjectLiner/nlog.config | 14 ++++ 14 files changed, 192 insertions(+), 64 deletions(-) create mode 100644 ProjectLiner/ProjectLiner/Exceptions/CollectionOverflowException.cs create mode 100644 ProjectLiner/ProjectLiner/Exceptions/ObjectNotFoundException.cs create mode 100644 ProjectLiner/ProjectLiner/Exceptions/PositionOutOfCollectionException.cs create mode 100644 ProjectLiner/ProjectLiner/nlog.config diff --git a/ProjectLiner/.vs/ProjectEvaluation/projectliner.metadata.v7.bin b/ProjectLiner/.vs/ProjectEvaluation/projectliner.metadata.v7.bin index dc77309010854061452c721c5972ed7292a0b789..d14171d61ae16f386fb4edf711181214fdc3d3a1 100644 GIT binary patch delta 262 zcmZ3wll$`?ZZ3v5JPcqEKYbxHqtEmWSD1twGg~tmw`MYx)jB)}%5s<)n3$M38C$#n zax`5ll2Z#xGV}9_W1RDIa#E8)Z2z*M*dOJaFOSS3J`bS2Frb zAw**IQd2TZ@{5x5^U^ZYUqj?2k>%5K@{}?OZI`*mB*r{F=?0T87sA}_$~T#sm;qiRTdn{A delta 101 zcmeyohkNNxZZ3xBJPcqEKfUn^Q~Y%OD@=loRjpNwTdSB-YZ;vB>o4Iah- diff --git a/ProjectLiner/.vs/ProjectEvaluation/projectliner.projects.v7.bin b/ProjectLiner/.vs/ProjectEvaluation/projectliner.projects.v7.bin index eb612d7f6ccd1cfaef2619f5d17d6fc24eaa6eb1..8f9021cf5512cb23399984cd0dcb0927d878520f 100644 GIT binary patch delta 371 zcmbQ-XuRZ*WkU;N3sVbo3rh=Y3tJ0&3r7oQ3s(#G7M{rm*cm@CFn(YZn*MGVO9W%U z#)Mp^=^vE2pRzsYVf^^;`SuO_ScKWP7fj+@!N%s~cs^=T;r7BaEE~9?oXK{wnlNUr ztSXc_z3~PMOnCc-8!R6j*sp+$yTY@1U)&`d#}6OA}^wkH^IS~E_6o(&Xv1rib8{=k?sfN}cDT%gG7>4v62H3oS+dqsiL7sc5k zwqFouTgwkKdtnr3%k?+det+rGrF1E!l2V$cX=*xD(|sQ*l_X}S>Aq(wC4MPVO2Pw_vb(JPJOqB-~a!bf6w_2zZvuY9y?c8+_}1p&+kQ=9IkLye?C^WMpOM=H_?K&YGH$k)1KMpwpD>yw3Ug1-W?{ojY~yoK=vW zpFK4rKPxXQvrBevc3#J+n>RIxe1|T3+f`^0m0acOluWKvqw-1VGYjXI zdgaqf4p(}<h|+q`vcJ&o0Qf9=W(+;ndmlmK^)b zy^CiJ|6=Rf@h-i7)v>9ON97hxPpdg##@yW5BNr9TU$ph*aqiiD2gkdPzC*RNvOf`@ zuH(Z7UK@GU;K!TFdo!Pld6n?mvUSu%*P>Z1{`IZ=(8z7P>{I@q#SO`B=U?5y>rP&G z@w%Ireabz&?&YguV1wI$HVFSod$RoFr}$ivA3x1!`#zRC}mf?240meUf@feO?WchRJD3qoi>uKR7*Uk~B@uNSgKKC)Y@t zae!tN&65_%nMuo1esEUODrrq|cCq_8%_VJelD0X?IXOwYoSI2`PSQRn$;e4ML)c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YNyzXaLqb0vq^E@eJ`9jB$cI4^ zhWH@8Ck*#N+DpdzZ&xbq-1wIr=DDYOL9YAz%VoVJxwgknk delta 27 gcmZ3$xPWm&kBE0%*^FuX?F78??{MV5R<;Du0F;gjy#N3J diff --git a/ProjectLiner/.vs/ProjectLiner/v17/DocumentLayout.json b/ProjectLiner/.vs/ProjectLiner/v17/DocumentLayout.json index 06c5f61..5d87d90 100644 --- a/ProjectLiner/.vs/ProjectLiner/v17/DocumentLayout.json +++ b/ProjectLiner/.vs/ProjectLiner/v17/DocumentLayout.json @@ -2,6 +2,14 @@ "Version": 1, "WorkspaceRootPath": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\", "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|c:\\somegitstuff\\isebd-11_khatypov_k.r_fundamental\\projectliner\\projectliner\\exceptions\\collectionoverflowexception.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\exceptions\\collectionoverflowexception.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, + { + "AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\projectliner\\collectiongenericobjects\\storagecollection.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", + "RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\collectiongenericobjects\\storagecollection.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" + }, { "AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|c:\\somegitstuff\\isebd-11_khatypov_k.r_fundamental\\projectliner\\projectliner\\drawnings\\extentiondrawningliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\drawnings\\extentiondrawningliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" @@ -14,10 +22,6 @@ "AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\projectliner\\entities\\entityliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\entities\\entityliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" }, - { - "AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\projectliner\\collectiongenericobjects\\storagecollection.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\collectiongenericobjects\\storagecollection.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, { "AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\projectliner\\formlinercollection.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\formlinercollection.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" @@ -107,32 +111,45 @@ { "$type": "Document", "DocumentIndex": 0, + "Title": "CollectionOverflowException.cs", + "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Exceptions\\CollectionOverflowException.cs", + "RelativeDocumentMoniker": "ProjectLiner\\Exceptions\\CollectionOverflowException.cs", + "ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Exceptions\\CollectionOverflowException.cs", + "RelativeToolTip": "ProjectLiner\\Exceptions\\CollectionOverflowException.cs", + "ViewState": "AQIAAAAAAAAAAAAAAAAAABAAAAABAAAA", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", + "WhenOpened": "2024-05-10T08:27:45.099Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 2, "Title": "ExtentionDrawningLiner.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Drawnings\\ExtentionDrawningLiner.cs", "RelativeDocumentMoniker": "ProjectLiner\\Drawnings\\ExtentionDrawningLiner.cs", "ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Drawnings\\ExtentionDrawningLiner.cs", "RelativeToolTip": "ProjectLiner\\Drawnings\\ExtentionDrawningLiner.cs", - "ViewState": "AQIAAAUAAAAAAAAAAAAIwBUAAAAJAAAA", + "ViewState": "AQIAAAUAAAAAAAAAAAAIwB4AAAAEAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "WhenOpened": "2024-05-09T09:04:11.58Z", "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 3, + "DocumentIndex": 1, "Title": "StorageCollection.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\CollectionGenericObjects\\StorageCollection.cs", "RelativeDocumentMoniker": "ProjectLiner\\CollectionGenericObjects\\StorageCollection.cs", "ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\CollectionGenericObjects\\StorageCollection.cs", "RelativeToolTip": "ProjectLiner\\CollectionGenericObjects\\StorageCollection.cs", - "ViewState": "AQIAAKgAAAAAAAAAAAAcwLsAAAAQAAAA", + "ViewState": "AQIAALoAAAAAAAAAAAAcwMUAAAAUAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "WhenOpened": "2024-05-08T06:09:32.467Z", "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 7, + "DocumentIndex": 8, "Title": "FormLinerCollection.Designer.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\FormLinerCollection.Designer.cs", "RelativeDocumentMoniker": "ProjectLiner\\FormLinerCollection.Designer.cs", @@ -145,7 +162,7 @@ }, { "$type": "Document", - "DocumentIndex": 4, + "DocumentIndex": 5, "Title": "FormLinerCollection.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\FormLinerCollection.cs", "RelativeDocumentMoniker": "ProjectLiner\\FormLinerCollection.cs", @@ -158,20 +175,20 @@ }, { "$type": "Document", - "DocumentIndex": 1, + "DocumentIndex": 3, "Title": "EntityBetterLiner.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Entities\\EntityBetterLiner.cs", "RelativeDocumentMoniker": "ProjectLiner\\Entities\\EntityBetterLiner.cs", "ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Entities\\EntityBetterLiner.cs", "RelativeToolTip": "ProjectLiner\\Entities\\EntityBetterLiner.cs", - "ViewState": "AQIAAB8AAAAAAAAAAAAywDMAAAA8AAAA", + "ViewState": "AQIAAC4AAAAAAAAAAAAUwDsAAAAEAAAA", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "WhenOpened": "2024-05-07T12:57:41.304Z", "EditorCaption": "" }, { "$type": "Document", - "DocumentIndex": 2, + "DocumentIndex": 4, "Title": "EntityLiner.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Entities\\EntityLiner.cs", "RelativeDocumentMoniker": "ProjectLiner\\Entities\\EntityLiner.cs", @@ -184,7 +201,7 @@ }, { "$type": "Document", - "DocumentIndex": 5, + "DocumentIndex": 6, "Title": "DrawningBetterLiner.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Drawnings\\DrawningBetterLiner.cs", "RelativeDocumentMoniker": "ProjectLiner\\Drawnings\\DrawningBetterLiner.cs", @@ -197,7 +214,7 @@ }, { "$type": "Document", - "DocumentIndex": 8, + "DocumentIndex": 9, "Title": "DrawningLiner.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Drawnings\\DrawningLiner.cs", "RelativeDocumentMoniker": "ProjectLiner\\Drawnings\\DrawningLiner.cs", @@ -210,7 +227,7 @@ }, { "$type": "Document", - "DocumentIndex": 6, + "DocumentIndex": 7, "Title": "MassiveGenericObjects.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\CollectionGenericObjects\\MassiveGenericObjects.cs", "RelativeDocumentMoniker": "ProjectLiner\\CollectionGenericObjects\\MassiveGenericObjects.cs", @@ -223,7 +240,7 @@ }, { "$type": "Document", - "DocumentIndex": 9, + "DocumentIndex": 10, "Title": "AbstractCompany.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\CollectionGenericObjects\\AbstractCompany.cs", "RelativeDocumentMoniker": "ProjectLiner\\CollectionGenericObjects\\AbstractCompany.cs", @@ -236,7 +253,7 @@ }, { "$type": "Document", - "DocumentIndex": 12, + "DocumentIndex": 13, "Title": "DockService.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\CollectionGenericObjects\\DockService.cs", "RelativeDocumentMoniker": "ProjectLiner\\CollectionGenericObjects\\DockService.cs", @@ -248,7 +265,7 @@ }, { "$type": "Document", - "DocumentIndex": 11, + "DocumentIndex": 12, "Title": "ICollectionGenericObjects.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\CollectionGenericObjects\\ICollectionGenericObjects.cs", "RelativeDocumentMoniker": "ProjectLiner\\CollectionGenericObjects\\ICollectionGenericObjects.cs", @@ -260,7 +277,7 @@ }, { "$type": "Document", - "DocumentIndex": 10, + "DocumentIndex": 11, "Title": "FormLinerConfig.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\FormLinerConfig.cs", "RelativeDocumentMoniker": "ProjectLiner\\FormLinerConfig.cs", @@ -272,7 +289,7 @@ }, { "$type": "Document", - "DocumentIndex": 13, + "DocumentIndex": 14, "Title": "ListGenericObjects.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\CollectionGenericObjects\\ListGenericObjects.cs", "RelativeDocumentMoniker": "ProjectLiner\\CollectionGenericObjects\\ListGenericObjects.cs", @@ -284,7 +301,7 @@ }, { "$type": "Document", - "DocumentIndex": 14, + "DocumentIndex": 15, "Title": "CollectionType.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\CollectionGenericObjects\\CollectionType.cs", "RelativeDocumentMoniker": "ProjectLiner\\CollectionGenericObjects\\CollectionType.cs", @@ -296,7 +313,7 @@ }, { "$type": "Document", - "DocumentIndex": 15, + "DocumentIndex": 16, "Title": "Resources.Designer.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Properties\\Resources.Designer.cs", "RelativeDocumentMoniker": "ProjectLiner\\Properties\\Resources.Designer.cs", @@ -308,7 +325,7 @@ }, { "$type": "Document", - "DocumentIndex": 16, + "DocumentIndex": 17, "Title": "FormLinerCollection.cs [\u041A\u043E\u043D\u0441\u0442\u0440\u0443\u0438\u0440\u043E\u0432\u0430\u043D\u0438\u0435]", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\FormLinerCollection.cs", "RelativeDocumentMoniker": "ProjectLiner\\FormLinerCollection.cs", @@ -320,7 +337,7 @@ }, { "$type": "Document", - "DocumentIndex": 17, + "DocumentIndex": 18, "Title": "Program.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Program.cs", "RelativeDocumentMoniker": "ProjectLiner\\Program.cs", @@ -332,7 +349,7 @@ }, { "$type": "Document", - "DocumentIndex": 18, + "DocumentIndex": 19, "Title": "FormLiner.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\FormLiner.cs", "RelativeDocumentMoniker": "ProjectLiner\\FormLiner.cs", @@ -344,7 +361,7 @@ }, { "$type": "Document", - "DocumentIndex": 19, + "DocumentIndex": 20, "Title": "FormLiner.Designer.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\FormLiner.Designer.cs", "RelativeDocumentMoniker": "ProjectLiner\\FormLiner.Designer.cs", @@ -356,7 +373,7 @@ }, { "$type": "Document", - "DocumentIndex": 20, + "DocumentIndex": 21, "Title": "AbstractStrategy.cs", "DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\MovementStrategy\\AbstractStrategy.cs", "RelativeDocumentMoniker": "ProjectLiner\\MovementStrategy\\AbstractStrategy.cs", diff --git a/ProjectLiner/ProjectLiner/CollectionGenericObjects/ListGenericObjects.cs b/ProjectLiner/ProjectLiner/CollectionGenericObjects/ListGenericObjects.cs index 8a7e6bb..1b7acbc 100644 --- a/ProjectLiner/ProjectLiner/CollectionGenericObjects/ListGenericObjects.cs +++ b/ProjectLiner/ProjectLiner/CollectionGenericObjects/ListGenericObjects.cs @@ -37,14 +37,14 @@ public class ListGenericObjects : ICollectionGenericObjects public T? Get(int position) { // TODO проверка позиции - if (position >= Count || position < 0) return null; + if (position >= Count || position < 0) throw new Exceptions.PositionOutOfCollectionException(); return _collection[position]; } public bool Insert(T obj) { // TODO проверка, что не превышено максимальное количество элементов // TODO вставка в конец набора - if (Count == _maxCount) return false; + if (Count == _maxCount) throw new Exceptions.CollectionOverflowException(); _collection.Add(obj); return true;//возможна проблема } @@ -53,8 +53,8 @@ public class ListGenericObjects : ICollectionGenericObjects // TODO проверка, что не превышено максимальное количество элементов // TODO проверка позиции // TODO вставка по позиции - if (Count == _maxCount) return false; - if (position >= Count || position < 0) return false; + if (Count == _maxCount) throw new Exceptions.CollectionOverflowException(); + if (position >= Count || position < 0) throw new Exceptions.PositionOutOfCollectionException(); _collection.Insert(position, obj); return true; } @@ -62,7 +62,7 @@ public class ListGenericObjects : ICollectionGenericObjects { // TODO проверка позиции // TODO удаление объекта из списка - if (position >= Count || position < 0) return false; + if (position >= Count || position < 0) throw new Exceptions.PositionOutOfCollectionException(); _collection.RemoveAt(position); return true; } diff --git a/ProjectLiner/ProjectLiner/CollectionGenericObjects/StorageCollection.cs b/ProjectLiner/ProjectLiner/CollectionGenericObjects/StorageCollection.cs index 51fa3a0..7c17058 100644 --- a/ProjectLiner/ProjectLiner/CollectionGenericObjects/StorageCollection.cs +++ b/ProjectLiner/ProjectLiner/CollectionGenericObjects/StorageCollection.cs @@ -1,4 +1,5 @@ using ProjectLiner.Drawnings; +using ProjectLiner.Exceptions; using System.Text; namespace ProjectLiner.CollectionGenericObjects; @@ -79,7 +80,8 @@ public class StorageCollection // TODO Продумать логику получения объекта if (_storages.ContainsKey(name)) return _storages[name]; - return null; + throw new Exceptions.ObjectNotFoundException(); + } } @@ -92,7 +94,7 @@ public bool SaveData(string filename) { if (_storages.Count == 0) { - return false; + throw new Exception("В хранилище отсутствуют коллекции для сохранения"); } if (File.Exists(filename)) { @@ -140,7 +142,7 @@ public bool SaveData(string filename) { if (!File.Exists(filename)) { - return false; + throw new Exception("Файл не существует"); } string bufferTextFromFile = ""; using (FileStream fs = new(filename, FileMode.Open)) @@ -156,12 +158,11 @@ public bool SaveData(string filename) StringSplitOptions.RemoveEmptyEntries); if (strs == null || strs.Length == 0) { - return false; + throw new Exception("В файле нет данных"); } if (!strs[0].Equals(_collectionKey)) { - //если нет такой записи, то это не те данные - return false; + throw new Exception("В файле неверные данные"); } _storages.Clear(); foreach (string data in strs) @@ -175,11 +176,8 @@ public bool SaveData(string filename) CollectionType collectionType = (CollectionType)Enum.Parse(typeof(CollectionType), record[1]); ICollectionGenericObjects? collection = - StorageCollection.CreateCollection(collectionType); - if (collection == null) - { - return false; - } + StorageCollection.CreateCollection(collectionType)?? throw new Exception("Не удалось определить тип коллекции: " + record[1]); + collection.MaxCount = Convert.ToInt32(record[2]); string[] set = record[3].Split(_separatorItems, StringSplitOptions.RemoveEmptyEntries); @@ -187,9 +185,16 @@ public bool SaveData(string filename) { if (elem?.CreateDrawningLiner() is T liner) { - if (!collection.Insert(liner)) + try { - return false; + if (!collection.Insert(liner)) + { + throw new Exception("Объект не удалось добавить в коллекцию: " + record[3]); + } + } + catch (CollectionOverflowException ex) + { + throw new Exception("Коллекция переполнена", ex); } } } diff --git a/ProjectLiner/ProjectLiner/Exceptions/CollectionOverflowException.cs b/ProjectLiner/ProjectLiner/Exceptions/CollectionOverflowException.cs new file mode 100644 index 0000000..f201d5a --- /dev/null +++ b/ProjectLiner/ProjectLiner/Exceptions/CollectionOverflowException.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; +namespace ProjectLiner.Exceptions; +/// +/// Класс, описывающий ошибку переполнения коллекции +/// +[Serializable] +internal class CollectionOverflowException : ApplicationException +{ + public CollectionOverflowException(int count) : base("В коллекции превышено допустимое количество: " + count) { } +public CollectionOverflowException() : base() { } + public CollectionOverflowException(string message) : base(message) { } + public CollectionOverflowException(string message, Exception exception) : + base(message, exception) + { } + protected CollectionOverflowException(SerializationInfo info, + StreamingContext contex) : base(info, contex) { } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/Exceptions/ObjectNotFoundException.cs b/ProjectLiner/ProjectLiner/Exceptions/ObjectNotFoundException.cs new file mode 100644 index 0000000..41cafa2 --- /dev/null +++ b/ProjectLiner/ProjectLiner/Exceptions/ObjectNotFoundException.cs @@ -0,0 +1,16 @@ +using System.Runtime.Serialization; +namespace ProjectLiner.Exceptions; +/// +/// Класс, описывающий ошибку, что по указанной позиции нет элемента +/// +[Serializable] +internal class ObjectNotFoundException : ApplicationException +{ + public ObjectNotFoundException(int i) : base("Не найден объект по позиции " + i) { } + public ObjectNotFoundException() : base() { } + public ObjectNotFoundException(string message) : base(message) { } + public ObjectNotFoundException(string message, Exception exception) : + base(message, exception) + { } + protected ObjectNotFoundException(SerializationInfo info, StreamingContext contex) : base(info, contex) { } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/Exceptions/PositionOutOfCollectionException.cs b/ProjectLiner/ProjectLiner/Exceptions/PositionOutOfCollectionException.cs new file mode 100644 index 0000000..22263bf --- /dev/null +++ b/ProjectLiner/ProjectLiner/Exceptions/PositionOutOfCollectionException.cs @@ -0,0 +1,15 @@ +using System.Runtime.Serialization; +namespace ProjectLiner.Exceptions; +/// +/// Класс, описывающий ошибку выхода за границы коллекции +/// +[Serializable] +internal class PositionOutOfCollectionException : ApplicationException +{ + public PositionOutOfCollectionException(int i) : base("Выход за границы коллекции.Позиция " + i) { } +public PositionOutOfCollectionException() : base() { } + public PositionOutOfCollectionException(string message) : base(message) { } + public PositionOutOfCollectionException(string message, Exception + exception) : base(message, exception) { } + protected PositionOutOfCollectionException(SerializationInfo info, StreamingContext contex) : base(info, contex) { } +} \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/FormLinerCollection.cs b/ProjectLiner/ProjectLiner/FormLinerCollection.cs index da044ad..0469c66 100644 --- a/ProjectLiner/ProjectLiner/FormLinerCollection.cs +++ b/ProjectLiner/ProjectLiner/FormLinerCollection.cs @@ -1,4 +1,5 @@ -using ProjectLiner.CollectionGenericObjects; +using Microsoft.Extensions.Logging; +using ProjectLiner.CollectionGenericObjects; using ProjectLiner.Drawnings; using System.Windows.Forms; @@ -8,10 +9,19 @@ public partial class FormLinerCollection : Form { private AbstractCompany? _company = null; private readonly StorageCollection _storageCollection; - public FormLinerCollection() + /// + /// Логер + /// + private readonly ILogger _logger; + /// + /// Конструктор + /// + public FormLinerCollection(ILogger logger) { InitializeComponent(); _storageCollection = new(); + + _logger = logger; } private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e) { @@ -180,15 +190,19 @@ public partial class FormLinerCollection : Form { if (saveFileDialog.ShowDialog() == DialogResult.OK) { - if (_storageCollection.SaveData(saveFileDialog.FileName)) + try { + _storageCollection.SaveData(saveFileDialog.FileName); MessageBox.Show("Сохранение прошло успешно", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); + _logger.LogInformation("Сохранение в файл: {filename}", + saveFileDialog.FileName); } - else + catch (Exception ex) { - MessageBox.Show("Не сохранилось", "Результат", + MessageBox.Show(ex.Message, "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error); + _logger.LogError("Ошибка: {Message}", ex.Message); } } } diff --git a/ProjectLiner/ProjectLiner/Program.cs b/ProjectLiner/ProjectLiner/Program.cs index 49d860e..55f75b8 100644 --- a/ProjectLiner/ProjectLiner/Program.cs +++ b/ProjectLiner/ProjectLiner/Program.cs @@ -1,17 +1,36 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using NLog.Extensions.Logging; +using System.Drawing; namespace ProjectLiner { - internal static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - // To customize application configuration such as set high DPI settings or default font, - // see https://aka.ms/applicationconfiguration. - ApplicationConfiguration.Initialize(); - Application.Run(new FormLinerCollection()); - } - } + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + ApplicationConfiguration.Initialize(); + ServiceCollection services = new(); + ConfigureServices(services); + using ServiceProvider serviceProvider = + services.BuildServiceProvider(); + Application.Run(serviceProvider.GetRequiredService()); + } + /// + /// DI + /// + /// + private static void ConfigureServices(ServiceCollection services) + { + services.AddSingleton() + .AddLogging(option => + { + option.SetMinimumLevel(LogLevel.Information); + option.AddNLog("nlog.config"); + }); + } + } } \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/ProjectLiner.csproj b/ProjectLiner/ProjectLiner/ProjectLiner.csproj index 244387d..6d62c1f 100644 --- a/ProjectLiner/ProjectLiner/ProjectLiner.csproj +++ b/ProjectLiner/ProjectLiner/ProjectLiner.csproj @@ -8,6 +8,11 @@ enable + + + + + True @@ -23,4 +28,10 @@ + + + Always + + + \ No newline at end of file diff --git a/ProjectLiner/ProjectLiner/nlog.config b/ProjectLiner/ProjectLiner/nlog.config new file mode 100644 index 0000000..7df8c4d --- /dev/null +++ b/ProjectLiner/ProjectLiner/nlog.config @@ -0,0 +1,14 @@ + + + + + + + + + + + \ No newline at end of file