From 5c2aaef09ee191d34716ff01cda8de3870efe801 Mon Sep 17 00:00:00 2001
From: "random()" <randomhuman@noreply.localhost>
Date: Thu, 28 Mar 2024 04:58:24 +0000
Subject: [PATCH] put back some files that vanished for absolutely no reason

---
 WebBrowser/Config.cs             | 92 ++++++++++++++++++++++++++++++++
 WebBrowser/Resource1.Designer.cs | 73 +++++++++++++++++++++++++
 2 files changed, 165 insertions(+)
 create mode 100644 WebBrowser/Config.cs
 create mode 100644 WebBrowser/Resource1.Designer.cs

diff --git a/WebBrowser/Config.cs b/WebBrowser/Config.cs
new file mode 100644
index 0000000..3bebdfb
--- /dev/null
+++ b/WebBrowser/Config.cs
@@ -0,0 +1,92 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace XeroBrowser
+{
+    internal class Config
+    {
+        private static string Cfg_File = Environment.GetEnvironmentVariable("appdata") + "/Xero Browser/prefrences.conf";
+        private const string SEPERATOR = "=";
+        private static Dictionary<string, string> cfgEntries = new Dictionary<string, string>();
+
+        static Config()
+        {
+            loadCfg();
+        }
+
+        private static void loadCfg()
+        {
+            cfgEntries.Clear();
+            if (!File.Exists(Cfg_File))
+                saveCfg();
+
+            using (StreamReader cfgReader = File.OpenText(Cfg_File))
+            {
+                for (string? line = cfgReader.ReadLine(); line is not null; line = cfgReader.ReadLine())
+                {
+                    if (line.StartsWith("#")) continue;
+                    string[] values = line.Split(SEPERATOR.First());
+                    cfgEntries.Add(values.First().Trim(), String.Join(SEPERATOR, values.Skip(1)).Trim());
+                }
+
+            }
+        }
+        private static void saveCfg()
+        {
+            using (StreamWriter cfgWriter = File.CreateText(Cfg_File))
+            {
+                cfgWriter.WriteLine("############################################################################################");
+                cfgWriter.WriteLine("#              Caution: This is your settings file for Xero Browser!                       #");
+                cfgWriter.WriteLine("# Modifying anything in this file could cause things to break and is thus not reccomended. #");
+                cfgWriter.WriteLine("#                            Continue at your own risk!                                    #");
+                cfgWriter.WriteLine("############################################################################################");
+                foreach (KeyValuePair<String, String> values in cfgEntries)
+                {
+                    cfgWriter.WriteLine(String.Join(SEPERATOR, new String[] { values.Key.Trim(), values.Value.Trim() }));
+                }
+                
+            }
+        }
+                
+        public static void SetEntry(string key, string value)
+        {
+            key = key.Trim();
+            value = value.Trim().Replace("\n", String.Empty).Replace("\r", String.Empty);
+
+            if (EntryExists(key))
+                cfgEntries[key] = value;
+            else
+                cfgEntries.Add(key, value);
+
+            saveCfg();
+        }
+        public static bool EntryExists(string key)
+        {
+            return cfgEntries.ContainsKey(key);
+        }
+
+        public static string GetEntry(string key)
+        {
+            return EntryExists(key) ? cfgEntries[key] : String.Empty;
+        }
+        public static void RemoveEntry(string key)
+        {
+            cfgEntries.Remove(key.Trim());
+            saveCfg();
+        }
+        public static string GetEntry(string key, string defaultValue)
+        {
+            if (!EntryExists(key))
+            {
+                SetEntry(key, defaultValue);
+                return defaultValue;
+            }
+            return GetEntry(key);
+        }
+
+    }
+}
diff --git a/WebBrowser/Resource1.Designer.cs b/WebBrowser/Resource1.Designer.cs
new file mode 100644
index 0000000..fd8b14b
--- /dev/null
+++ b/WebBrowser/Resource1.Designer.cs
@@ -0,0 +1,73 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//     Runtime Version:4.0.30319.42000
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace XeroBrowser {
+    using System;
+    
+    
+    /// <summary>
+    ///   A strongly-typed resource class, for looking up localized strings, etc.
+    /// </summary>
+    // This class was auto-generated by the StronglyTypedResourceBuilder
+    // 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", "17.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resource1 {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resource1() {
+        }
+        
+        /// <summary>
+        ///   Returns the cached ResourceManager instance used by this class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("XeroBrowser.Resource1", typeof(Resource1).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   Overrides the current thread's CurrentUICulture property for all
+        ///   resource lookups using this strongly typed resource class.
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized resource of type System.Byte[].
+        /// </summary>
+        internal static byte[] prefrences_conf {
+            get {
+                object obj = ResourceManager.GetObject("prefrences_conf", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+    }
+}