public Main() { bool reCreated = false; foreach (KeyValuePair <String, String> configFile in (new Dictionary <String, String> { { Path.Combine(AppDomain.CurrentDomain.BaseDirectory, iniFileName), CertificateScanner.Properties.Resources.config }, { Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config\\messages.ini"), CertificateScanner.Properties.Resources.messages }, { Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "NLog.config"), CertificateScanner.Properties.Resources.NLog } })) { if (!(File.Exists(configFile.Key))) { IniCreator configCreator = new IniCreator(configFile.Key); if (!configCreator.CreateIni(configFile.Value)) { MessageBox.Show(this.Messages("configCreateError")); } reCreated = true; } } if (reCreated) { this.Info("!!!!!!Configuration has been restored!!!!!!!", this.Messages("Конфігураційні файли відновлено після пошкоджень.")); } this.Text += String.Format(" " + this.Messages("version"), FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion); InitializeComponent(); }
public void FileIOManagerQueueTest() { IniCreator ic = new IniCreator(Environment.CurrentDirectory + "/MyECFMail.ini"); string filepath = Environment.CurrentDirectory + "/MyECFMail.ini"; string filepath2 = Environment.CurrentDirectory + "/Memmy.ini"; var e = new Entry("users", "tester1", "tester1value"); var ee = new Entry("users", "tester2", "tester2value"); var eee = new Entry("section1", "property2", "value2"); var eeee = new Entry("section2", "propertyB", "valueB_2"); bool success = ic.SaveEntry("users", "tester1"); Assert.IsTrue(success); success = ic.SaveEntry("users", "tester1", "tester1value"); Assert.IsTrue(success); //******you ended here testing the multi entry stuff. // need a good test dictionary of values. maybe make // separate method that creates it. //var entries = new Dictionary<string,Dictionary<string,string>>(); //Dictionary<string,string> vals = new Dictionary<string,string>(); //vals.Add("e1", "e1val"); //vals.Add("e2", "e2val"); //vals.Add("e3", "e3val"); //entries.Add("users", vals); //success = ic.SaveEntries(entries as IDictionary<string,IDictionary<string,string>>); //int loc = "modwyer=XtOnLPcds4G2B9FQx11l+g==".IndexOf('='); //var list = FileContents.splitString(loc, "modwyer=XtOnLPcds4G2B9FQx11l+g=="); //Assert.AreEqual("modwyer", list[0]); //Assert.AreEqual("XtOnLPcds4G2B9FQx11l+g==", list[1]); //success = ic.SaveEntry(); //bool success; //success = FileIOManager.AddEntryToList(e); //Assert.IsTrue(success); //success = FileIOManager.AddEntryToList(ee); //Assert.IsTrue(success); //success = FileIOManager.AddEntryToList(eee); //Assert.IsTrue(success); //success = FileIOManager.AddEntryToList(eeee); //Assert.IsTrue(success); FileIOManager.FlushEntries(); }