diff --git a/.github/Notes/file manipulation.txt b/.github/Notes/file manipulation.txt new file mode 100644 index 00000000..a89d712f --- /dev/null +++ b/.github/Notes/file manipulation.txt @@ -0,0 +1,18 @@ +for adding from the saved file, the idea is that the "add" function can be modified to output the whole thing/ be used to get all of the entrie. + +that way, the order is: + +1. open +2. read file +3. split CSV +4. create classes based on CSV +5. add that into the list +6. use this to add it to the contacts +7. done! + +___________________________________________________________ +save to file just adds a new line with the necessary separation symbol (determined by a constant variable, in this case a "~") + +a new system will be added to replace tildes with something else, so the splitting symbol is replaced in the text by something, then that becomes a tilde. + +details to be figured out \ No newline at end of file diff --git a/Program.cs b/Program.cs index dd4bb892..6ee81199 100644 --- a/Program.cs +++ b/Program.cs @@ -18,7 +18,38 @@ static void Main() Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frm_snackInvent()); } - + internal const bool debug = true; //global var to controll default for debugs internal static List snacks = new List(); } -} + internal static class coreCommands + { + internal static void error(string message = constants.preMadeErrorMsg, Exception ex = null, bool revealException = false) + { + string msg = message; //what message to display + if (revealException) //put the toggle + { + msg = msg + ": " + ex.Message; //the message + }//a bool to toggle if the exception code should be included in the error message + MessageBox.Show(msg); //show the message + } //this is for error messages. the text is mandatory, but the + //rest isn't necessary. if you don't provide an exception, it won't display one. If you provide an error, it will default to "hide error". + // WARNING: If you provide a boolean, you can controll if it's hidden. If you provide a boolean but no error, well, it won't work righ + + /* internal static string path() + { + var pathSpliter = '\\'; //part between paths + var loc = AppDomain.CurrentDomain.BaseDirectory; //get the current domain + var comps = loc.Split('\\'); //array of path after being split + var len = comps.Length; //length of path + var completeLoc = string.Empty; //blank variable for path + for (var i = 0; i < len-3; i++) //repeat by the length minus 2, which will lead to it excluding the 2 folders that are unwanted + { + var comp = comps[i]; + completeLoc = completeLoc + comp + char.ToString(pathSpliter); //add next part to path + } + return completeLoc; //output path + } //derive the path of the base file */ + + } //base commands to aid in everything + +} \ No newline at end of file diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 9c8e39d3..74e8f968 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -8,10 +8,10 @@ // //------------------------------------------------------------------------------ -namespace snackShack.Properties -{ - - +namespace snackShack.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -19,51 +19,43 @@ namespace snackShack.Properties // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - + internal class Resources { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { + internal Resources() { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("snackShack.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { + internal static global::System.Globalization.CultureInfo Culture { + get { return resourceCulture; } - set - { + set { resourceCulture = value; } } diff --git a/Properties/Resources.resx b/Properties/Resources.resx index af7dbebb..1af7de15 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,9 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/bin/Debug/Inventory/inventory.csv b/bin/Debug/Inventory/inventory.csv new file mode 100644 index 00000000..e69de29b diff --git a/frm_snackInvent.cs b/frm_snackInvent.cs index d81f0597..fd163df5 100644 --- a/frm_snackInvent.cs +++ b/frm_snackInvent.cs @@ -94,7 +94,7 @@ private void frm_snackInvent_FormClosing(object sender, FormClosingEventArgs e) } catch (Exception ex) //catch exception { - MessageBox.Show("Error during file write", "", MessageBoxButtons.OK, MessageBoxIcon.Error); + coreCommands.error("Error during file write", ex, true); //show error with exception message } } private void frm_snackInvent_Load(object sender, EventArgs e) @@ -133,8 +133,7 @@ private void frm_snackInvent_Load(object sender, EventArgs e) } } catch (Exception ex) //catch exception { - MessageBox.Show("Error during file read", "", MessageBoxButtons.OK, MessageBoxIcon.Error); - + coreCommands.error("Error during file read", ex, true); //show error with exception message } } } diff --git a/snackShack.csproj b/snackShack.csproj index 6c65c74e..1d7a424b 100644 --- a/snackShack.csproj +++ b/snackShack.csproj @@ -55,19 +55,20 @@ + + True + True + Resources.resx + frm_snackInvent.cs ResXFileCodeGenerator - Resources.Designer.cs Designer + Resources.Designer.cs - - True - Resources.resx - SettingsSingleFileGenerator Settings.Designer.cs @@ -81,5 +82,6 @@ + \ No newline at end of file