Example #1
0
 public KeyboardLayout(string name)
 {
     try
     {
         if (inis == null)
         {
             inis = IniStructure.ReadIni("Layouts\\" + name + ".keylayout");
             if (inis == null)
                 inis = IniStructure.ReadIni(name);
             this.name = name;
         }
         if (inis.filename != "Layouts\\" + name + ".keylayout" && inis.filename != name)
         {
             inis = null;
             inis = IniStructure.ReadIni("Layouts\\" + name + ".keylayout");
             if (inis == null)
                 inis = IniStructure.ReadIni(name);
             this.name = name;
         }
     }
     catch
     {
         inis = new IniStructure();
     }
 }
Example #2
0
        private static string CreateData(IniStructure IniData, string comment)
        {               //Iterates through all categories and keys and appends all data to Data
            int CategoryCount = IniData.GetCategories().Length;

            int[]  KeyCountPerCategory = new int[CategoryCount];
            string Data = comment;

            string[] temp = new string[2];             // will contain key-value pair

            for (int i = 0; i < CategoryCount; i++)    // Gets keycount per category
            {
                string CategoryName = IniData.GetCategories()[i];
                KeyCountPerCategory[i] = IniData.GetKeys(CategoryName).Length;
            }

            for (int catcounter = 0; catcounter < CategoryCount; catcounter++)
            {
                Data += "\r\n[" + IniData.GetCategoryName(catcounter) + "]\r\n";
                // writes [Category] to Data
                for (int keycounter = 0; keycounter < KeyCountPerCategory[catcounter]; keycounter++)
                {
                    temp[0] = IniData.GetKeyName(catcounter, keycounter);
                    temp[1] = IniData.GetValue(catcounter, keycounter);
                    Data   += temp[0] + "=" + temp[1] + "\r\n";
                    // writes the key-value pair to Data
                }
            }
            return(Data);
        }
Example #3
0
        public Magazine_Driver(LabManager.LabManager parent, int nMagazine_ID)
        {
            _nMagazine_ID = nMagazine_ID;
             _parent = parent;

             myMagazineHelper = new MagazineHelper(_nMagazine_ID);

             string IniFilePath = myDef.LanguageFile;
             myIniHandler = IniStructure.ReadIni(IniFilePath);

              //  _parent.InsertLoggingEntry((int)Definition.ThorLogWindows.ROUTING, "starting magazine '" + myMagazineHelper.GetMagazineName() + "' ");
             string strStarting = String.Format(myIniHandler.GetValue("Magazine", "StartMagazineInit"), myMagazineHelper.GetMagazineName());

             WriteLoggEntry((int)Definition.ThorLogWindows.ROUTING, strStarting, (int)Definition.Message.D_MESSAGE);

             UpdateMagazine();

             // Hook up the Elapsed event for the timer.
             MagazineDriverTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);

             // Set the Interval to 1 seconds (1000 milliseconds).
             MagazineDriverTimer.Interval = 1000;
             MagazineDriverTimer.Enabled = true;

             if (myMagazineHelper.GetOutputPosition() == -1 || myMagazineHelper.GetMachine_ID() == -1)
             {
                 string strCorruptConf = String.Format(myIniHandler.GetValue("Magazine", "CorruptConfiguration"), myMagazineHelper.GetOutputPosition(), myMagazineHelper.GetMachine_ID());
                 WriteLoggEntry((int)Definition.ThorLogWindows.ERROR, strCorruptConf, (int)Definition.Message.D_ALARM);
             }

             // Keep the timer alive until the end of Main.
              //GC.KeepAlive(MagazineDriverTimer);
        }
        public Machine_Configuration_Form()
        {
            Application.EnableVisualStyles();
            this.StartPosition = FormStartPosition.CenterScreen;
            InitializeComponent();

            string IniFilePath = myDefinitions.LanguageFile;
            myIniHandler = IniStructure.ReadIni(IniFilePath);
        }
Example #5
0
        /// <summary>
        /// Reads an ini file and returns the content as an IniStructure. Returns null if an error occurred.
        /// </summary>
        /// <param name="Filename">The filename to read</param>
        /// <returns></returns>
        public static IniStructure ReadIni(string Filename)
        {
            string Data = ReadFile(Filename);

            if (Data == null)
            {
                return(null);
            }

            IniStructure data = InterpretIni(Data);

            return(data);
        }
Example #6
0
        public TCPIPConfiguration(C1FlexGrid grid)
        {
            c1FlexGrid_TCP_IP_Conf = grid;

            // errorProvider1
            errorProvider = new System.Windows.Forms.ErrorProvider();
            errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;

            string IniFilePath = myDefinitions.LanguageFile;
            myIniHandler = IniStructure.ReadIni(IniFilePath);

            grid.BeforeEdit += new C1.Win.C1FlexGrid.RowColEventHandler(this.c1FlexGrid_TCPIPConfiguration_BeforeEdit);
            grid.GetCellErrorInfo += new C1.Win.C1FlexGrid.GetErrorInfoEventHandler(this.c1FlexGrid_Conditions_GetCellErrorInfo);
               // grid.GetRowErrorInfo += new C1.Win.C1FlexGrid.GetErrorInfoEventHandler(this.c1FlexGrid_Conditions_GetRowErrorInfo);
        }
Example #7
0
        public static IniStructure InterpretIni(string Data)
        {
            IniStructure IniData = new IniStructure();

            string[] Lines = RemoveAndVerifyIni(DivideToLines(Data));
            // Divides the Data in lines, removes comments and empty lines
            // and verifies if the ini is not corrupted
            // Returns null if it is.
            if (Lines == null)
            {
                return(null);
            }

            if (Lines.Length == 0 || IsLineACategoryDef(Lines[0]) != LineType.Category)
            {
                return(null);
                // Ini is faulty - does not begin with a categorydef
            }
            string CurrentCategory = "";

            foreach (string line in Lines)
            {
                switch (IsLineACategoryDef(line))
                {
                case LineType.Category:                         // the line is a correct category definition
                    string NewCat = line.Substring(1, line.Length - 2);
                    IniData.AddCategory(NewCat);                // adds the category to the IniData
                    CurrentCategory = NewCat;
                    break;

                case LineType.NotACategory:                         // the line is not a category definition
                    string[] keyvalue = GetDataFromLine(line);
                    IniData.AddValue(CurrentCategory, keyvalue[0], keyvalue[1]);
                    // Adds the key-value to the current category
                    break;

                case LineType.Faulty:                         // the line is faulty
                    return(null);
                }
            }
            return(IniData);
        }
Example #8
0
        public Administration_Form()
        {
            Application.EnableVisualStyles();
            this.StartPosition = FormStartPosition.CenterScreen;

            InitializeComponent();

            string IniFilePath = myDefinitions.LanguageFile;
            myIniHandler = IniStructure.ReadIni(IniFilePath);

            this.c1FlexGrid_Administartion.DrawMode = DrawModeEnum.OwnerDraw;
            this.c1FlexGrid_Administartion.Renderer = new MyRenderer();
            this.c1FlexGrid_Administartion.FocusRect = C1.Win.C1FlexGrid.FocusRectEnum.None;

            myTimer.Tick += new EventHandler(TimerEventProcessor);

            // Sets the timer interval to x milliseconds.
            myTimer.Interval = 125;
            myTimer.Start();
        }
Example #9
0
        /// <summary>
        /// Writes an IniStructure to a file with a comment.
        /// </summary>
        /// <param name="IniData">The contents to write</param>
        /// <param name="Filename">The complete path and name of the file</param>
        /// <param name="comment">Comment to add</param>
        /// <returns></returns>
        public static bool WriteIni(IniStructure IniData, string Filename, string comment)
        {
            string DataToWrite = CreateData(IniData, BuildComment(comment));

            return(WriteFile(Filename, DataToWrite));
        }
Example #10
0
// ----------------------------------------------

		private void ReadSettings()
		{
			string file = findSettingFile();
			try
			{
				if (File.Exists(file) == true)
				{
					ini = IniStructure.ReadIni(file);
					string[] allCategories = ini.GetCategories();
					string[] keys;
					foreach (string category in allCategories)
					{
						keys = ini.GetKeys(category);
						foreach (string key in keys)
						{
							string settingValue = ini.GetValue(category, key);
							bool settingValueBool;
							if (settingValue != "")
							{
								try
								{
									settingValueBool = Convert.ToBoolean(settingValue);
								}
								catch
								{
									settingValueBool = false;
								}
							}
							else
							{
								settingValueBool = false;
							}

							switch (key)
							{
								#region cases
								case "UPDATESURL":
									UpdatesURL = settingValue;
									break;
								case "AUTOLAUNCHTIMER":
									autoLaunchTimer = Convert.ToInt32(settingValue);
									break;
								#endregion
								default:
									break;
							}
						}
					}
				}
				else
				{
					//settings file doesn't exist yet, manually set the UpdatesURL thing with the defaults
					// UpdatesURL = "http://wowroster.net/uniuploader_updater2/update.php";
				}
			}
			catch (Exception e)
			{
				DebugLine("ReadSettings: " + e.Message);
				if (e.Message == "Object reference not set to an instance of an object.")
				{
					MessageBox.Show("Your settings file is somehow corrupted.\nPlease delete settings.ini or repair it.");
				}
				return;
			}
		}
Example #11
0
		public static IniStructure InterpretIni(string Data)
		{
			IniStructure IniData = new IniStructure();
			string[] Lines = RemoveAndVerifyIni(DivideToLines(Data));
			// Divides the Data in lines, removes comments and empty lines
			// and verifies if the ini is not corrupted
			// Returns null if it is.
			if (Lines == null)
				return null;

			if (IsLineACategoryDef(Lines[0]) != LineType.Category)
			{
				return null;
				// Ini is faulty - does not begin with a categorydef
			}
			string CurrentCategory = "";
			foreach (string line in Lines)
			{
				switch (IsLineACategoryDef(line))
				{
					case LineType.Category:	// the line is a correct category definition
						string NewCat = line.Substring(1,line.Length - 2);
						IniData.AddCategory(NewCat); // adds the category to the IniData
						CurrentCategory = NewCat;
						break;
					case LineType.NotACategory: // the line is not a category definition
						string[] keyvalue = GetDataFromLine(line);
						IniData.AddValue(CurrentCategory, keyvalue[0], keyvalue[1]);
						// Adds the key-value to the current category
						break;
					case LineType.Faulty: // the line is faulty
						return null;
				}
			}
			return IniData;
		}
Example #12
0
// ----------------------------------------------

		public void PopulateLanguageSelector()
		{
			try
			{
				string file = findLangFile();
				if (File.Exists(file))
				{
					LanguageIni = IniStructure.ReadIni(file);
					string[] allCategories = LanguageIni.GetCategories();
					if (allCategories.Length > 0)
					{
						setControlEnabled(langselect, true);
						SetComboBoxSelectedItem(langselect, Language);
						ResetLangVars(Language);
					}
					else
					{
						setControlEnabled(langselect, false);
						SetComboBoxSelectedItem(langselect, "English");
					}
				}
				else
				{
					setControlEnabled(langselect, false);
				}
			}
			catch (Exception e)
			{
				DebugLines("PopulateLanguageSelector: " + e.Message);
				setControlEnabled(langselect, false);
			}
		}
Example #13
0
        private string SetConnectionString()
        {
            string conString = "";
              string IniFilePath = definitions.PathIniFile;
            inis = IniStructure.ReadIni(IniFilePath);

            if (inis == null)
                MessageBox.Show("Something went wrong with the ini-Reader!\r\nerror reading from file: " + IniFilePath, "error");

            conString = "server= " + inis.GetValue("DB", "server") + ";User Id=" + inis.GetValue("DB", "UserId") + ";password="******"DB", "password") + ";database=" + inis.GetValue("DB", "database") + ";Persist Security Info=no";

            return conString;
        }
Example #14
0
        public string GetConnectionString()
        {
            string conString = "";
            string IniFilePath = myDefinitions.PathIniFile;
            inis = IniStructure.ReadIni(IniFilePath);

            if (inis == null)
            {
            if (!bINIReaderError)
            {
                //   MessageBox.Show("Something went wrong with the ini-Reader path!", "error");
                InsertRow((int)Definition.Message.D_ALARM, "Something went wrong with the ini-Reader path!");
                bINIReaderError = true;
            }
            }
            else
            {
            bINIReaderError = false;
            }

               // conString = inis.GetValue("DB", "ConnectionString");
            conString = "server= " + inis.GetValue("DB", "server") + ";User Id=" + inis.GetValue("DB", "UserId") + ";password="******"DB", "password") + ";database=" + inis.GetValue("DB", "database") + ";Persist Security Info=no";

            try
            {
            string debug = inis.GetValue("Logging", "DebugMode");
            if (String.Equals(debug, "true", StringComparison.Ordinal)) { DEBUGMODE = true; }
            }
            catch { }
            try
            {
            string debug = inis.GetValue("Logging", "Debug");
            if (String.Equals(debug, "true", StringComparison.Ordinal)) { DEBUG = true; }
            }
            catch { }
            try
            {
            string debug = inis.GetValue("Logging", "Message");
            if (String.Equals(debug, "true", StringComparison.Ordinal)) { MESSAGE = true; }
            }
            catch { }
            try
            {
            string debug = inis.GetValue("Logging", "Alarm");
            if (String.Equals(debug, "true", StringComparison.Ordinal)) { ALARM = true; }
            }
            catch { }
            try
            {
            string debug = inis.GetValue("Logging", "Receive");
            if (String.Equals(debug, "true", StringComparison.Ordinal)) { RECEIVE = true; }
            }
            catch { }
            try
            {
            string debug = inis.GetValue("Logging", "Send");
            if (String.Equals(debug, "true", StringComparison.Ordinal)) { SEND = true; }
            }
            catch { }
            return conString;
        }
Example #15
0
        /// <summary>
        /// Writes an IniStructure to a file without a comment.
        /// </summary>
        /// <param name="IniData">The contents to write</param>
        /// <param name="Filename">The complete path and name of the file</param>
        /// <returns></returns>
        public static bool WriteIni(IniStructure IniData, string Filename)
        {
            string DataToWrite = CreateData(IniData);

            return(WriteFile(Filename, DataToWrite));
        }
Example #16
0
 private static string CreateData(IniStructure IniData)
 {
     return(CreateData(IniData, ""));
 }
Example #17
0
		/// <summary>
		/// Writes an IniStructure to a file with a comment.
		/// </summary>
		/// <param name="IniData">The contents to write</param>
		/// <param name="Filename">The complete path and name of the file</param>
		/// <param name="comment">Comment to add</param>
		/// <returns></returns>
		public static bool WriteIni(IniStructure IniData, string Filename, string comment)
		{
			string DataToWrite = CreateData(IniData, BuildComment(comment));
			return WriteFile(Filename, DataToWrite);
		}
Example #18
0
		/// <summary>
		/// Writes an IniStructure to a file without a comment.
		/// </summary>
		/// <param name="IniData">The contents to write</param>
		/// <param name="Filename">The complete path and name of the file</param>
		/// <returns></returns>
		public static bool WriteIni(IniStructure IniData, string Filename)
		{
			string DataToWrite = CreateData(IniData);
			return WriteFile(Filename, DataToWrite);
		}
Example #19
0
		private static string CreateData(IniStructure IniData)
		{
			return CreateData(IniData,"");
		}
Example #20
0
// ----------------------------------------------

		private void ReadSettings()
		{
			string file = findSettingFile();
			try
			{
				if (File.Exists(file) == true)
				{
					ini = IniStructure.ReadIni(file);
					string[] allCategories = ini.GetCategories();
					string[] keys;
					foreach (string category in allCategories)
					{
						keys = ini.GetKeys(category);
						foreach (string key in keys)
						{
							string settingValue = ini.GetValue(category, key);
							bool settingValueBool;
							if (settingValue != "")
							{
								try
								{
									settingValueBool = Convert.ToBoolean(settingValue);
								}
								catch
								{
									settingValueBool = false;
								}
							}
							else
							{
								settingValueBool = false;
							}

							switch (key)
							{
								#region cases
								case "HOMEURL":
									HomeURL.Text = settingValue;
									doHomeURL(HomeURL.Text);
									break;
								case "FORUMURL":
									ForumURL.Text = settingValue;
									doForumURL(ForumURL.Text);
									break;
								case "ROSTERURL":
									RosterURL.Text = settingValue;
									doRosterURL(RosterURL.Text);
									break;
								case "UNIADMINURL":
									UniAdminURL.Text = settingValue;
									checkHideUAURL();
									break;
								case "UPLOADSVS":
									cbInclAddonData.Checked = settingValueBool;
									break;
								case "UPLOADSCREENSHOTS":
									cbInclScreenShots.Checked = settingValueBool;
									break;
								case "PURGEFIRST":
									purgefirstCh.Checked = settingValueBool;
									break;
								case "ALLOWADDONDEL":
									chAllowDelAddons.Checked = settingValueBool;
									if (addonAutoUpdate.Checked) { chAllowDelAddons.Enabled = true; }
									else { chAllowDelAddons.Enabled = false; }
									break;
								case "SELECTEDACCT":
									selectedAcc = settingValue;
									break;
								//case "SELECTEDACCT":
								//	AccountList.SelectedItem = settingValue;
								//	break;
								case "UPLOADALLACCOUNTS":
									UploadALLAccounts.Checked = settingValueBool;
									break;
								case "WEBWOWSVFILE":
									webWoWSvFile.Text = settingValue;
									break;
								case "AUTODETECTWOW":
									AutoInstallDirDetect.Checked = settingValueBool;
									break;
								case "EXELOC":
									if (Directory.Exists(settingValue))
										wowExeLoc = settingValue;
									populateAccountList();
									populateSvList();
									setupWatchers();
									break;
								case "USERAGENT":
									userAgent.Text = settingValue;
									break;
								case "WOWARGS":
									launchWoWargs.Text = settingValue;
									break;
								case "PRIMARYURL":
									URL.Text = settingValue;
									break;
								case "USELAUNCHER":
									chUseLauncher.Checked = settingValueBool;
									break;
								case "DOWNLOADAFTERUPLOAD":
									chWtoWOWafterUpload.Checked = settingValueBool;
									break;
								case "DOWNLOADBEFOREUPLOAD":
									chWtoWOWbeforeUpload.Checked = settingValueBool;
									break;
								case "DOWNLOADBEFOREWOWL":
									chWtoWOWbeforeWOWLaunch.Checked = settingValueBool;
									break;
								case "SENDPWSECURE":
									sendPwSecurely.Checked = settingValueBool;
									break;
								case "STOREPWSECURE":
									storePwSecurely.Checked = settingValueBool;
									break;
								case "CHECKEDSVLIST":
									checkedSVsFromSettings = settingValue.Split('|');
									break;
								case "CHECKEDADDONS":
									string[] cas = settingValue.Split('|');
									foreach (string ca in cas)
									{
										checkedAddons.Add(ca);
									}
									break;
								case "EXEUULAUNCH":
									exeOnUuStart.Checked = settingValueBool;
									break;
								case "EXEWOWLAUNCH":
									exeOnWowLaunch.Checked = settingValueBool;
									break;
								case "EXE1":
									exe1.Checked = settingValueBool;
									break;
								case "EXE2":
									exe2.Checked = settingValueBool;
									break;
								case "EXE3":
									exe3.Checked = settingValueBool;
									break;
								case "EXE1LOCATION":
									exe1Location.Text = settingValue;
									break;
								case "EXE2LOCATION":
									exe2Location.Text = settingValue;
									break;
								case "EXE3LOCATION":
									exe3Location.Text = settingValue;
									break;
								case "FILELOCATION":
									if (!PathFound)
									{
										mainSvLocation = settingValue;
										populateAccountList();
										populateSvList();
										setupWatchers();
										if (!File.Exists(mainSvLocation))
										{
											if (ProgramMode == "Basic")
											{
												//this.tabPage1.Controls.AddRange(new System.Windows.Forms.Control[] {this.browse});
												//DebugLine("Please click Browse to select the SV file.");
											}
										}
										else
										{
											PathFound = true;
										}
									}
									break;
								case "PROGRAMMODE":
									if (settingValue == "Advanced")
									{
										SwitchMode();
									}
									break;
								case "WINDOWMODE":
									windowmode.Checked = settingValueBool;
									break;
								case "OPENGL":
									OpenGl.Checked = settingValueBool;
									break;
								case "RETRDATAURL":
									retrDataUrl.Text = settingValue;
									break;
								case "ADDONAUTOUPDATE":
									addonAutoUpdate.Checked = settingValueBool;
									if (addonAutoUpdate.Checked) { chAllowDelAddons.Enabled = true; }
									else { chAllowDelAddons.Enabled = false; }
									break;
								case "UUSETTINGSUPDATER":
									uuSettingsUpdater.Checked = settingValueBool;
									break;
								case "UUUPDATERCHECK":
									UUUpdaterCheck.Checked = settingValueBool;
									break;
								case "UUAUTOUPDATERCHECK":
									UUAutoUpdaterCheck.Checked = settingValueBool;
									break;
								case "SYNCHROURL":
									AutoAddonURL.Text = settingValue;
									break;
								case "UPDATESURL":
									UpdatesURL.Text = settingValue;
									break;
								case "LANGUAGE":
									try
									{
										Language = settingValue;
										langselect.SelectedItem = settingValue;
									}
									catch (Exception e)
									{
										DebugLine(e.Message);
									}
									break;
								case "SYSTRAY":
									checkBox1.Checked = settingValueBool;
									break;
								case "ALWAYSONTOP":
									checkBox6.Checked = settingValueBool;
									break;
								case "AUTOUPLOADONFILECHANGES":
									autoUploader.Checked = settingValueBool;
									break;
								case "ADDVAR1CH":
									arg1check.Checked = settingValueBool;
									break;
								case "ADDVAR2CH":
									arg2check.Checked = settingValueBool;
									break;
								case "ADDVAR3CH":
									arg3check.Checked = settingValueBool;
									break;
								case "ADDVAR4CH":
									arg4check.Checked = settingValueBool;
									break;
								case "ADDURL1CH":
									chaddurl1.Checked = settingValueBool;
									break;
								case "ADDURL2CH":
									chaddurl2.Checked = settingValueBool;
									break;
								case "ADDURL3CH":
									chaddurl3.Checked = settingValueBool;
									break;
								case "ADDURL4CH":
									chaddurl4.Checked = settingValueBool;
									break;
								case "ADDVARNAME1":
									arrg1.Text = settingValue;
									break;
								case "ADDVARNAME2":
									arrg2.Text = settingValue;
									break;
								case "ADDVARNAME3":
									arrg3.Text = settingValue;
									break;
								case "ADDVARNAME4":
									arrg4.Text = settingValue;
									break;
								case "ADDVARVAL1":
									valu1.Text = settingValue;
									break;
								case "ADDVARVAL2":
									if (storePwSecurely.Checked) { valu2.Text = Decrypt(settingValue); }
									else{ valu2.Text = settingValue; }
									break;
								case "ADDVARVAL3":
									valu3.Text = settingValue;
									break;
								case "ADDVARVAL4":
									valu4.Text = settingValue;
									break;
								case "ADDURL1":
									addurl1.Text = settingValue;
									break;
								case "ADDURL2":
									addurl2.Text = settingValue;
									break;
								case "ADDURL3":
									addurl3.Text = settingValue;
									break;
								case "ADDURL4":
									addurl4.Text = settingValue;
									break;
								case "GZIP":
									GZcompress.Checked = settingValueBool;
									break;
								case "RETRDATAFROMSITE":
									retrDataUrl.Enabled = settingValueBool;
									retrdatafromsite.Checked = settingValueBool;
									break;
								case "STARTWITHWINDOWS":
									stboot.Checked = settingValueBool;
									if (settingValueBool)
										DebugLine(InstallStartupKey());
									else
										DebugLine(UninstallStartupKey());
									break;
								case "AUTOLAUNCHWOW":
									stwowlaunch.Checked = settingValueBool;
									break;
								case "STARTMINI":
									stmin.Checked = settingValueBool;
									break;
								case "CLOSETOSYSTRAY":
									CloseToSysTray.Checked = settingValueBool;
									break;
								case "DELAYUPLOAD":
									delaych.Checked = settingValueBool;
									break;
								case "DELAYSECONDS":
									DelaySecs.Text = settingValue;
									break;
								case "UPERRPOPUP":
									cbUpErrorPop.Checked = settingValueBool;
									break;
								case "CLOSEAFUPD":
									cbCloseAfterUpdates.Checked = settingValueBool;
									break;
								case "CLOSEAFLAU":
									cbCloseAfterWowLaunch.Checked = settingValueBool;
									break;
								case "AUTOSYNCIN":
									nudAutoSyncInterval.Value = Decimal.Parse(settingValue);
									break;
								case "USEAPPDATA":
									cbAppData.Checked = settingValueBool;
									break;
								case "AUTOLAUNCHTIMER":
									autoLaunchTimer = Convert.ToInt32(settingValue);
									break;
								case "UUTIMEOUT":
									UUTimeOut = Convert.ToInt32(settingValue);
									break;
								case "GUILDNAME":
									GuildName = settingValue;
									if (GuildName != "") // Only alter the title/systray text if theres an actual setting text to use
									{
										if (EnableOfficerBuild && !IsOfficerBuild) { OfficerStr = ""; }
										Text = GuildName + "UniUploader" + OfficerStr;
										notifyIcon1.Text = Text;
									}
									break;
								case "ENABLEOFFICERBUILD":
									EnableOfficerBuild = settingValueBool;
									break;
								case "OFFICERSTR":
									if (EnableOfficerBuild && IsOfficerBuild)
									{
										OfficerStr = settingValue;
										if (OfficerStr != "") // Only alter the title/systray text if theres an actual setting text to use
										{
											Text = GuildName + "UniUploader" + OfficerStr;
											notifyIcon1.Text = Text;
										}
									}
									else
									{
										OfficerStr = "";
										Text = GuildName + "UniUploader" + OfficerStr;
										notifyIcon1.Text = Text;
									}
									break;
								case "MEMBERUUVAL":
									if (storePwSecurely.Checked) { MemberUUVal = Decrypt(settingValue); }
									else{ MemberUUVal = settingValue; }
									if (EnableOfficerBuild && !IsOfficerBuild)
									{
										if (MemberUUVal!="") { valu2.Text=MemberUUVal; }
									}
									break;
								case "OFFICERUUVAL":
									if (storePwSecurely.Checked) { OfficerUUVal = Decrypt(settingValue); }
									else{ OfficerUUVal = settingValue; }
									if (EnableOfficerBuild && IsOfficerBuild)
									{
										if (OfficerUUVal!="") { valu2.Text=OfficerUUVal; }
									}
									break;
								#endregion
								default:
									break;
							}
						}
					}
				}
				else
				{
					//settings file doesn't exist yet, manually set the checkedSVList thing with the defaults
					checkedSVsFromSettings = presets;
					//togSVList.Text = "Hide SVs";
					//this.Width = 645;
				}
			}
			catch (Exception e)
			{
				DebugLine("ReadSettings: " + e.Message);
				if (e.Message == "Object reference not set to an instance of an object.")
				{
					MessageBox.Show("Your settings file is somehow corrupted.\nPlease delete settings.ini or repair it.");
				}
				return;
			}
		}
Example #21
0
		private static string CreateData(IniStructure IniData, string comment)
		{	//Iterates through all categories and keys and appends all data to Data
			int CategoryCount = IniData.GetCategories().Length;
			int[] KeyCountPerCategory = new int[CategoryCount];
			string Data = comment;
			string[] temp = new string[2]; // will contain key-value pair
			
			for (int i = 0; i < CategoryCount; i++) // Gets keycount per category
			{
				string CategoryName = IniData.GetCategories()[i];
				KeyCountPerCategory[i] = IniData.GetKeys(CategoryName).Length;
			}

			for (int catcounter = 0; catcounter < CategoryCount; catcounter++)
			{
				Data += "\r\n[" + IniData.GetCategoryName(catcounter) + "]\r\n"; 
				// writes [Category] to Data
				for (int keycounter = 0; keycounter < KeyCountPerCategory[catcounter]; keycounter++)
				{
					temp[0] = IniData.GetKeyName(catcounter, keycounter);
					temp[1] = IniData.GetValue(catcounter, keycounter);
					Data += temp[0] + "=" + temp[1] + "\r\n";
					// writes the key-value pair to Data
				}
			}
			return Data;
		}
Example #22
0
// ----------------------------------------------

		public void ResetLangVars(string Lang)
		{
			string file = WorkSpacePath + "\\languages.ini";
			LanguageIni = IniStructure.ReadIni(file);
			string[] allCategories = LanguageIni.GetCategories();
			string[] keys;
			foreach (string category in allCategories)
			{
				if (category == Lang)
				{
					keys = LanguageIni.GetKeys(category);
					foreach (string key in keys)
					{
						string settingValue = LanguageIni.GetValue(category, key).Replace("<br>", '\n'.ToString());
						switch (key)
						{
							#region cases
							case "_UPDATERHELP":
								_UPDATERHELP = @settingValue;
								break;
							case "_PURGEFIRST":
								_PURGEFIRST = @settingValue;
								break;
							case "_INSTALL":
								_INSTALL = @settingValue;
								break;
							case "_ADDONAME":
								_ADDONAME = @settingValue;
								break;
							case "_ADDOVERS":
								_ADDOVERS = @settingValue;
								break;
							case "_ADDOTOC":
								_ADDOTOC = @settingValue;
								break;
							case "_ADDODESCRIP":
								_ADDODESCRIP = @settingValue;
								break;
							case "_UNLISTEDFILE":
								_UNLISTEDFILE = @settingValue;
								break;
							case "_CREATINGDIR":
								_CREATINGDIR = @settingValue;
								break;
							case "_WRITINGFILE":
								_WRITINGFILE = @settingValue;
								break;
							case "_ALLOWUAADDONDEL":
								_ALLOWUAADDONDEL = @settingValue;
								break;
							case "_DELETINGADDON":
								_DELETINGADDON = @settingValue;
								break;
							case "_CONFIGG":
								_CONFIGG = @settingValue;
								break;
							case "_ADDONS":
								_ADDONS = @settingValue;
								break;
							case "_SVBLS":
								_SVBLS = @settingValue;
								break;
							case "_ARRGS":
								_ARRGS = @settingValue;
								break;
							case "_CLEARTHESVS":
								_CLEARTHESVS = @settingValue;
								break;
							case "_SHOWSVSBUT":
								_SHOWSVSBUT = @settingValue;
								break;
							case "_HIDESVSBUT":
								_HIDESVSBUT = @settingValue;
								break;
							case "_SHOWADDONSBUT":
								_SHOWADDONSBUT = @settingValue;
								break;
							case "_HIDEADDONSBUT":
								_HIDEADDONSBUT = @settingValue;
								break;
							case "_AUTODETECTWOWCH":
								_AUTODETECTWOWCH = @settingValue;
								break;
							case "_FINDWOWEXEBUT":
								_FINDWOWEXEBUT = @settingValue;
								break;
							case "_UPALLACC":
								_UPALLACC = @settingValue;
								break;
							case "_UPSCRSHT":
								_UPSCRSHT = @settingValue;
								break;
							case "_UPSVS":
								_UPSVS = @settingValue;
								break;
							case "_SENDPWSECURELE":
								_SENDPWSECURELE = @settingValue;
								break;
							case "_STOREPWSECURE":
								_STOREPWSECURE = @settingValue;
								break;
							case "_DELAYTHEUPLOAD":
								_DELAYTHEUPLOAD = @settingValue;
								break;
							case "_BEFOREWOWLAUNCH":
								_BEFOREWOWLAUNCH = @settingValue;
								break;
							case "_BEFOREUPLOADING":
								_BEFOREUPLOADING = @settingValue;
								break;
							case "_AFTERUPLOADING":
								_AFTERUPLOADING = @settingValue;
								break;
							case "_SVFILETOWRITETO":
								_SVFILETOWRITETO = @settingValue;
								break;
							case "_DOWNLOADIT":
								_DOWNLOADIT = @settingValue;
								break;
							case "_USETHELAUNCHER":
								_USETHELAUNCHER = @settingValue;
								break;
							case "_THEDEBUGINFO":
								_THEDEBUGINFO = @settingValue;
								break;
							case "_CANTFINDLICENSE":
								_CANTFINDLICENSE = @settingValue;
								break;
							case "_THELICENSE":
								_THELICENSE = @settingValue;
								break;
							case "_CANTFINDCHANGELOG":
								_CANTFINDCHANGELOG = @settingValue;
								break;
							case "_THECHANGELOG":
								_THECHANGELOG = @settingValue;
								break;
							case "_EXPANDALL":
								_EXPANDALL = @settingValue;
								break;
							case "_COLLAPSEALL":
								_COLLAPSEALL = @settingValue;
								break;
							case "_THESEAREADDONS":
								_THESEAREADDONS = @settingValue;
								break;
							case "_TRANSLATIONS":
								_TRANSLATIONS = @settingValue;
								break;
							case "_LOGINONCE":
								_LOGINONCE = @settingValue;
								break;
							case "_WARNING":
								_WARNING = @settingValue;
								break;
							case "_WARNINGWILLCLEAR":
								_WARNINGWILLCLEAR = @settingValue;
								break;
							case "_UPDSRCHTIMEOUT":
								_UPDSRCHTIMEOUT = @settingValue;
								break;
							case "_LAUNCHOTHERPROGRAMS":
								_LAUNCHOTHERPROGRAMS = @settingValue;
								break;
							case "_ONUULAUNCH":
								_ONUULAUNCH = @settingValue;
								break;
							case "_ONWOWLAUNCH":
								_ONWOWLAUNCH = @settingValue;
								break;
							case "_MD5ID":
								_MD5ID = @settingValue;
								break;
							case "_STING":
								_STING = @settingValue;
								break;
							case "_FILECHDET":
								_FILECHDET = @settingValue;
								break;
							case "_UPLDING":
								_UPLDING = @settingValue;
								break;
							case "_PARSING":
								_PARSING = @settingValue;
								break;
							case "_COMPING":
								_COMPING = @settingValue;
								break;
							case "_UPDLANGPACK":
								_UPDLANGPACK = @settingValue;
								break;
							case "_UPLOAD":
								_UPLOAD = @settingValue;
								break;
							case "_STOPT":
								_STOPT = @settingValue;
								break;
							case "_UPLACC":
								_UPLACC = @settingValue;
								break;
							case "_UPLOADING_PRIMARY":
								_UPLOADING_PRIMARY = @settingValue;
								break;
							case "_USEUP":
								_USEUP = @settingValue;
								break;
							case "_UPLOADING_ADDURL1":
								_UPLOADING_ADDURL1 = @settingValue;
								break;
							case "_UPLOADING_ADDURL2":
								_UPLOADING_ADDURL2 = @settingValue;
								break;
							case "_UPLOADING_ADDURL3":
								_UPLOADING_ADDURL3 = @settingValue;
								break;
							case "_UPLOADING_ADDURL4":
								_UPLOADING_ADDURL4 = @settingValue;
								break;
							case "_RETRDATA":
								_RETRDATA = @settingValue;
								break;
							case "_WRITINGSV":
								_WRITINGSV = @settingValue;
								break;
							case "_READY":
								_READY = @settingValue;
								break;
							case "_CANTREADFILE":
								_CANTREADFILE = @settingValue;
								break;
							case "_WOWACCSEARCH":
								_WOWACCSEARCH = @settingValue;
								break;
							case "_NOTFOUND":
								_NOTFOUND = @settingValue;
								break;
							case "_NOACCFOUND":
								_NOACCFOUND = @settingValue;
								break;
							case "_INIT":
								_INIT = @settingValue;
								break;
							case "_WOWNOTFOUND":
								_WOWNOTFOUND = @settingValue;
								break;
							case "_STVALCREATE":
								_STVALCREATE = @settingValue;
								break;
							case "_STVALFIX":
								_STVALFIX = @settingValue;
								break;
							case "_STVALFUNC":
								_STVALFUNC = @settingValue;
								break;
							case "_REGPROB":
								_REGPROB = @settingValue;
								break;
							case "_STVALDEL":
								_STVALDEL = @settingValue;
								break;
							case "_STVALNOTFD":
								_STVALNOTFD = @settingValue;
								break;
							case "_HITBROWSE":
								_HITBROWSE = @settingValue;
								break;
							case "_HELP1":
								_HELP1 = @settingValue;
								break;
							case "_HELP2":
								_HELP2 = @settingValue;
								break;
							case "_HELP3":
								_HELP3 = @settingValue;
								break;
							case "_HELP4":
								_HELP4 = @settingValue;
								break;
							case "_GZIPPING":
								_GZIPPING = @settingValue;
								break;
							case "_NOCOMP":
								_NOCOMP = @settingValue;
								break;
							case "_COMPSIZE":
								_COMPSIZE = @settingValue;
								break;
							case "_UPLERR":
								_UPLERR = @settingValue;
								break;
							case "_DATARETRERR":
								_DATARETRERR = @settingValue;
								break;
							case "_CHECKSET":
								_CHECKSET = @settingValue;
								break;
							case "_UPDWOWADDON":
								_UPDWOWADDON = @settingValue;
								break;
							case "_CHUUUPDATE":
								_CHUUUPDATE = @settingValue;
								break;
							case "_WINDOWMODE":
								_WINDOWMODE = @settingValue;
								break;
							case "_CHANGES":
								_CHANGES = @settingValue;
								break;
							case "_UPDYESNO":
								_UPDYESNO = @settingValue;
								break;
							case "_NEWUPDAVAIL":
								_NEWUPDAVAIL = @settingValue;
								break;
							case "_UPDEXENOTFD":
								_UPDEXENOTFD = @settingValue;
								break;
							case "_DOWNUPD":
								_DOWNUPD = @settingValue;
								break;
							case "_OF":
								_OF = @settingValue;
								break;
							case "_DOWNLOADING":
								_DOWNLOADING = @settingValue;
								break;
							case "_SAVLOG":
								_SAVLOG = @settingValue;
								break;
							case "_UPDADDONSST":
								_UPDADDONSST = @settingValue;
								break;
							case "_RETRXMLDATA":
								_RETRXMLDATA = @settingValue;
								break;
							case "_XMLDATA":
								_XMLDATA = @settingValue;
								break;
							case "_XMLPARS":
								_XMLPARS = @settingValue;
								break;
							case "_NUMADDONS":
								_NUMADDONS = @settingValue;
								break;
							case "_ADDONLIST":
								_ADDONLIST = @settingValue;
								break;
							case "_NOADDONS":
								_NOADDONS = @settingValue;
								break;
							case "_NOWUPD":
								_NOWUPD = @settingValue;
								break;
							case "_ADDONSUPD":
								_ADDONSUPD = @settingValue;
								break;
							case "_ADDONUPD":
								_ADDONUPD = @settingValue;
								break;
							case "_MD5NOMATCH":
								_MD5NOMATCH = @settingValue;
								break;
							case "_UNZIPPING":
								_UNZIPPING = @settingValue;
								break;
							case "_DELZIPFILE":
								_DELZIPFILE = @settingValue;
								break;
							case "_UPDFOR":
								_UPDFOR = @settingValue;
								break;
							case "_ISCOMP":
								_ISCOMP = @settingValue;
								break;
							case "_FILENAME":
								_FILENAME = @settingValue;
								break;
							case "_ADDONRETRRESP":
								_ADDONRETRRESP = @settingValue;
								break;
							case "_ADVMODE":
								_ADVMODE = @settingValue;
								break;
							case "_SIMPMODE":
								_SIMPMODE = @settingValue;
								break;
							case "_URLLABEL":
								_URLLABEL = @settingValue;
								break;
							case "_SELACC":
								_SELACC = @settingValue;
								break;
							case "_FILELOC":
								_FILELOC = @settingValue;
								break;
							case "_BROWSE":
								_BROWSE = @settingValue;
								break;
							case "_AUTOPATH":
								_AUTOPATH = @settingValue;
								break;
							case "_WINMODE":
								_WINMODE = @settingValue;
								break;
							case "_LAUNCHWOW":
								_LAUNCHWOW = @settingValue;
								break;
							case "_SETTINGS":
								_SETTINGS = @settingValue;
								break;
							case "_SERVRESP":
								_SERVRESP = @settingValue;
								break;
							case "_UPLLABEL":
								_UPLLABEL = @settingValue;
								break;
							case "_DATARESP1":
								_DATARESP1 = @settingValue;
								break;
							case "_DATARESP2":
								_DATARESP2 = @settingValue;
								break;
							case "_DATARESP3":
								_DATARESP3 = @settingValue;
								break;
							case "_OPTIONS":
								_OPTIONS = @settingValue;
								break;
							case "_SECURITY":
								_SECURITY = @settingValue;
								break;
							case "_HTTPCRED":
								_HTTPCRED = @settingValue;
								break;
							case "_DOMAIN":
								_DOMAIN = @settingValue;
								break;
							case "_USER":
								_USER = @settingValue;
								break;
							case "_MISC":
								_MISC = @settingValue;
								break;
							case "_FFNAME":
								_FFNAME = @settingValue;
								break;
							case "_SIST":
								_SIST = @settingValue;
								break;
							case "_CSIST":
								_CSIST = @settingValue;
								break;
							case "_AOT":
								_AOT = @settingValue;
								break;
							case "_AUOFC":
								_AUOFC = @settingValue;
								break;
							case "_UPERRPU":
								_UPERRPU = @settingValue;
								break;
							case "_CLAFUP":
								_CLAFUP = @settingValue;
								break;
							case "_CLAFWL":
								_CLAFWL = @settingValue;
								break;
							case "_SYSTICO":
								_SYSTICO = @settingValue;
								break;
							case "_USERAGENT":
								_USERAGENT = @settingValue;
								break;
							case "_ADDVARS":
								_ADDVARS = @settingValue;
								break;
							case "_ADDURLS":
								_ADDURLS = @settingValue;
								break;
							case "_UPDATER":
								_UPDATER = @settingValue;
								break;
							case "_AUTOUPD":
								_AUTOUPD = @settingValue;
								break;
							case "_KMAU":
								_KMAU = @settingValue;
								break;
							case "_KMCUSU":
								_KMCUSU = @settingValue;
								break;
							case "_CFUTU":
								_CFUTU = @settingValue;
								break;
							case "_AUTLU":
								_AUTLU = @settingValue;
								break;
							case "_SYNCHURL":
								_SYNCHURL = @settingValue;
								break;
							case "_UPDATESURL":
								_UPDATESURL = @settingValue;
								break;
							case "_SAPU":
								_SAPU = @settingValue;
								break;
							case "_SYNCHNOW":
								_SYNCHNOW = @settingValue;
								break;
							case "_UPDCHK":
								_UPDCHK = @settingValue;
								break;
							case "_WARN":
								_WARN = @settingValue;
								break;
							case "_WARNMSG":
								_WARNMSG = @settingValue;
								break;
							case "_DEBUGGER":
								_DEBUGGER = @settingValue;
								break;
							case "_CLEARDB":
								_CLEARDB = @settingValue;
								break;
							case "_SAVEASDB":
								_SAVEASDB = @settingValue;
								break;
							case "_ADVANCED":
								_ADVANCED = @settingValue;
								break;
							case "_ADVANCEDSETTINGS":
								_ADVANCEDSETTINGS = @settingValue;
								break;
							case "_EFF":
								_EFF = @settingValue;
								break;
							case "_GZIPLAB":
								_GZIPLAB = @settingValue;
								break;
							case "_USEAPPDATA":
								_USEAPPDATA = @settingValue;
								break;
							case "_PP":
								_PP = @settingValue;
								break;
							case "_VARKEEP":
								_VARKEEP = @settingValue;
								break;
							case "_SITEWOW":
								_SITEWOW = @settingValue;
								break;
							case "_RETRDATA2":
								_RETRDATA2 = @settingValue;
								break;
							case "_WRITEAS":
								_WRITEAS = @settingValue;
								break;
							case "_OTHEROPT":
								_OTHEROPT = @settingValue;
								break;
							case "_DELAYUP":
								_DELAYUP = @settingValue;
								break;
							case "_SECONDS":
								_SECONDS = @settingValue;
								break;
							case "_STOPTIONS":
								_STOPTIONS = @settingValue;
								break;
							case "_STWITHWIN":
								_STWITHWIN = @settingValue;
								break;
							case "_AUTOLCHWOW":
								_AUTOLCHWOW = @settingValue;
								break;
							case "_STMINI":
								_STMINI = @settingValue;
								break;
							case "_HELP":
								_HELP = @settingValue;
								break;
							case "_SETT":
								_SETT = @settingValue;
								break;
							case "_OPTI":
								_OPTI = @settingValue;
								break;
							case "_ADV":
								_ADV = @settingValue;
								break;
							case "_INFOZ":
								_INFOZ = @settingValue;
								break;
							case "_ABT":
								_ABT = @settingValue;
								break;
							case "_CPY":
								_CPY = @settingValue;
								break;
							case "_LANG":
								_LANG = @settingValue;
								break;
							case "_LANGNTFD":
								_LANGNTFD = @settingValue;
								break;
							case "_MINLBL":
								_MINLBL = @settingValue;
								break;
							case "_ASILBL":
								_ASILBL = @settingValue;
								break;
							case "_CRTDBY":
								_CRTDBY = @settingValue;
								break;
							case "_UPTDBY":
								_UPTDBY = @settingValue;
								break;
							default:
								break;
							#endregion
						}
					}
				}
			}
			InitLanguageChange();
		}
Example #23
0
        public int RemoteObject(int nForm, int nMachine, int nReserve, string strSampleID)
        {
            int returnValue = -1;
            string IniFileName = CDef.PathIniFileName;
            string IniFilePath = null;
            string localPath = System.IO.Path.GetDirectoryName(new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath);
            IniFilePath = localPath + @"\..\..\..\..\" + IniFileName;
            inis = IniStructure.ReadIni(IniFilePath);
            string ProjectPath = localPath + @"\..\..\..\..\";
            string strAssemblyInfo = "";

            if (inis == null)
                MessageBox.Show("Something went wrong", "error");

            switch (nForm)
            {
                case 1:
                    {
                        Path = inis.GetValue("Path", "Machine_Info");
                        strAssemblyInfo = "Machine_Info.RemoteObject";
                        break;
                    }
                case 2:
                    {
                        Path = inis.GetValue("Path", "Routing_Table");
                        strAssemblyInfo = "Routing_Table.RemoteObject";
                        break;
                    }

                case 3:
                    {
                        Path = inis.GetValue("Path", "Sample_Info");
                        strAssemblyInfo = "Sample_Info.RemoteObject";
                        break;
                    }
                case 4:
                    {
                        Path = inis.GetValue("Path", "Logging_Info");
                        strAssemblyInfo = "Logging_Info.RemoteObject";
                        break;
                    }

                case 5:
                    {
                        Path = inis.GetValue("Path", "Sample_Registration");
                        strAssemblyInfo = "Sample_Registration.RemoteObject";
                        break;
                    }
                case 6:
                    {
                        Path = inis.GetValue("Path", "Sample_Statistic");
                        strAssemblyInfo = "Sample_Statistic.RemoteObject";
                        break;
                    }
                case 7:
                    {
                        Path = inis.GetValue("Path", "Sample_ValueStatistic");
                        strAssemblyInfo = "SampleValue_Statistic.RemoteObject";
                        break;
                    }
                case 8:
                    {
                        Path = inis.GetValue("Path", "Magazine_Info");
                        strAssemblyInfo = "Magazine_Info.RemoteObject";
                        break;
                    }
                case 9:
                    {
                        Path = inis.GetValue("Path", "Lab_Manager");
                        strAssemblyInfo = "LabManager.RemoteObject";
                        break;
                    }
                case 10:
                    {
                        Path = @"d:\Arbeit\Hephaistos\WindowsFormsApplication1\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe";
                        strAssemblyInfo = "WindowsFormsApplication1.RemoteObject";
                        object[] argstopass2 = new object[] { (object)nForm, (object)nMachine, (object)nReserve, (object)strSampleID };

                        System.Reflection.Assembly newAssembly2 = System.Reflection.Assembly.LoadFrom( Path);
                             newAssembly2.CreateInstance(strAssemblyInfo,
                           false, //do not ignore the case
                           System.Reflection.BindingFlags.CreateInstance, //specifies we want to call a ctor method
                           null, //a null binder specifies the default binder will be used (works in most cases)
                           argstopass2, //the arguments (based on the arguments, CreateInstance() will decide which ctor to invoke)
                           null, //CultureInfo is null so we will use the culture info from the current thread
                           null //no activation attributes
                           );
                        return 10;
                    }
            }
            //the arguments we will pass
            object[] argstopass = new object[] { (object)nForm, (object)nMachine, (object)nReserve, (object)strSampleID };

            System.Reflection.Assembly newAssembly = System.Reflection.Assembly.LoadFrom(ProjectPath+Path);

            newAssembly.CreateInstance(strAssemblyInfo,
            false, //do not ignore the case
            System.Reflection.BindingFlags.CreateInstance, //specifies we want to call a ctor method
            null, //a null binder specifies the default binder will be used (works in most cases)
            argstopass, //the arguments (based on the arguments, CreateInstance() will decide which ctor to invoke)
            null, //CultureInfo is null so we will use the culture info from the current thread
            null //no activation attributes
            );

            return returnValue;
        }