/// <summary> /// Changes the files content and therefore repairs it. /// </summary> /// Gets the correct values from the ini-File and compares the actual value from the files. /// If the values aren't the same, the wrong values get changed and corrected. public void RepairFiles() { //Get filepath for all files that need to get changed foreach (string filepath in _incorrectFiles) { var configIniHandler = new IniHandler(filepath); _tempRootSpecsDir = configIniHandler.IniReadValue("System", "Root_Specs_Dir"); _tempRootModulesDir = configIniHandler.IniReadValue("System", "Root_Modules_Dir"); _tempModulesIniFile = configIniHandler.IniReadValue("System", "Modules_Ini_File"); //Get which variable needs to get changed if (_tempRootSpecsDir != _correctRootSpecsDir) { configIniHandler.IniWriteValue("System", "Root_Specs_Dir", _correctRootSpecsDir); } if (_tempRootModulesDir != _correctRootModulesDir) { configIniHandler.IniWriteValue("System", "Root_Modules_Dir", _correctRootModulesDir); } if (_tempModulesIniFile != _correctModulesIniFile) { configIniHandler.IniWriteValue("System", "Modules_Ini_File", _correctModulesIniFile); } } }
public static void loadInifiles(string currentDirectory) { if (Program.useIniFiles && File.Exists(currentDirectory + "/RedirectionSettings.ini")) { //Read from .ini file IniHandler settings = new IniHandler(currentDirectory + "/RedirectionSettings.ini"); //Init values Program.loginServerIP = settings.IniReadValue("Config", "serverIP"); Program.serverWebsite = settings.IniReadValue("Config", "website"); Program.registerUrl = settings.IniReadValue("Config", "registerUrl"); Program.serverName = settings.IniReadValue("Config", "serverName"); //DNS settings Program.resolveDNS = false; //Game settings Program.gameVersion = Int32.Parse(settings.IniReadValue("Config", "gameVersion")); Program.patchVersion = settings.IniReadValue("Config", "patchVersion"); Program.locale = (byte)Int32.Parse(settings.IniReadValue("Config", "locale")); //Port range (lowPort and highPort should cover all your channels and misc. servers like cash shop and farm) Program.lowPort = (ushort)Int32.Parse(settings.IniReadValue("Config", "portRangeMin")); Program.highPort = (ushort)Int32.Parse(settings.IniReadValue("Config", "portRangeMax")); } }
public ArrayList SetCorrectValues(string iniPath, string[] section, string key) //TODO get arrays for section and key to make application dynamic. { var iniHandler = new IniHandler(iniPath); ArrayList correctValueList = new ArrayList(); return(correctValueList); }
/// <summary> /// Gets the wrong values from the files and changes them if needed. /// </summary> /// Gets the correct values from the ini-File and compares the actual value from the files. /// If the values aren't the same, the wrong values get changed and corrected. public void RepairFiles() { //Get filepath for all files that need to get changed foreach (string filepath in _incorrectFiles) { var configIniHandler = new IniHandler(filepath); _tempRootSpecsDir = configIniHandler.IniReadValue("System", "Root_Specs_Dir"); _tempRootModulesDir = configIniHandler.IniReadValue("System", "Root_Modules_Dir"); _tempModulesIniFile = configIniHandler.IniReadValue("System", "Modules_Ini_File"); /* * TODO Check if user wants to correct file * Take the whole EntityList as parameter so that the User can choose * which Item to change by clicking on the checkbox. * * [Important] * Check if value updates on changes to checkbox.IsChecked → Is this value also updated here (maybe use static method?) * Use UpdateSourceTrigger="OnValueChanged" in MainWindow.xaml */ if (_tempRootSpecsDir != _correctRootSpecsDir) { configIniHandler.IniWriteValue("System", "Root_Specs_Dir", _correctRootSpecsDir); } if (_tempRootModulesDir != _correctRootModulesDir) { configIniHandler.IniWriteValue("System", "Root_Modules_Dir", _correctRootModulesDir); } if (_tempModulesIniFile != _correctModulesIniFile) { configIniHandler.IniWriteValue("System", "Modules_Ini_File", _correctModulesIniFile); } } }
public static void checkIniFiles(string currentDirectory) { if (!File.Exists(currentDirectory + "/RedirectionSettings.ini")) { //Init values Program.loginServerIP = "127.0.0.1"; //loginServerIP : IP of your loginserver. Program.serverWebsite = "http://127.0.0.1/"; //URL to your server's website. Program.registerUrl = "http://127.0.0.1/register"; //URL to your site's register page. Program.serverName = "LocalHostedMS"; //Server name to be shown on the application screen. //DNS settings Program.resolveDNS = false; //Game settings Program.gameVersion = 146; Program.patchVersion = "1"; //subversion is after the dot. AKA 146.1 means: subversion = "1"; Program.locale = 8; //GMS locale = 8, change for other regions. //Port range (lowPort and highPort should cover all your channels and misc. servers like cash shop and farm) Program.lowPort = 8585; Program.highPort = 8605; //Create new Settings Ini file. IniHandler settings = new IniHandler(currentDirectory + "/RedirectionSettings.ini"); settings.IniWriteValue("Config", "serverIP", Program.loginServerIP); settings.IniWriteValue("Config", "website", Program.serverWebsite); settings.IniWriteValue("Config", "registerUrl", Program.registerUrl); settings.IniWriteValue("Config", "serverName", Program.serverName); settings.IniWriteValue("Config", "gameVersion", "146"); settings.IniWriteValue("Config", "patchVersion", Program.patchVersion); settings.IniWriteValue("Config", "locale", Program.locale.ToString()); settings.IniWriteValue("Config", "portRangeMin", "8585"); settings.IniWriteValue("Config", "portRangeMax", "8605"); } }
public AddMandant(IniHandler ini, string Mandant) { InitializeComponent(); INI = ini; oldmandant = Mandant; //Speichern des alten Mandanten tb_mandant.Text = Mandant; }
public SettingService() { this.handler = new IniHandler(); handler.init(path); if (!handler.ExistINIFile()) { handler.CreateFile(); } }
public AddServer(IniHandler ini) { InitializeComponent(); INI = ini; if (INI.GetSetting("DefaultService") != null) { _instanz.Text = ini.GetSetting("DefaultService"); } }
public static void checkAuthIni(string currentDirectory) { if (!File.Exists(currentDirectory + "/nmconew.ini")) { //Create new MSAuth Ini file. IniHandler msauth = new IniHandler(currentDirectory + "/nmconew.ini"); msauth.IniWriteValue("Settings", "ServerIp", Program.authServerIP); msauth.IniWriteValue("Settings", "ServerPort", Program.authServerPort); } }
public static HardwareInformation GetHardwareInfo(string infoFilePath, string hwName) { var data = IniHandler.ReadIniFile(infoFilePath); var section = data.Sections.ToList().Find(x => x.SectionName == hwName); HardwareInformation info = new HardwareInformation(); info.MaxChannel = int.Parse(data[hwName]["MaxChannel"]); info.MaxSampleRate = double.Parse(data[hwName]["MaxSampleRate"]); info.Coupling = data[hwName]["Coupling"].Split(','); info.Terminal = data[hwName]["Terminal"].Split(','); info.Ranges = data[hwName]["Ranges"].Split(',').ToList().ConvertAll(new Converter <string, double>(x => double.Parse(x))).ToArray(); info.IsSimultaneous = bool.Parse(data[hwName]["IsSimultaneous"]); info.SupportDifferential = bool.Parse(data[hwName]["SupportDifferential"]); return(info); }
void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); return; } else { // just move it to the root this.transform.parent = null; _instance = this; } DontDestroyOnLoad(this.gameObject); }
public Options(IniHandler Ini) { InitializeComponent(); if (Ini == null) { return; } ini = Ini; if (ini.GetSetting("upd") == "true") { opt_upd_yes.IsChecked = true; } else { opt_upd_no.IsChecked = true; } if (!String.IsNullOrEmpty(ini.GetSetting("upd_user"))) { opt_upd_user.Text = ini.GetSetting("upd_user"); } if (!String.IsNullOrEmpty(ini.GetSetting("upd_user"))) { opt_upd_repository.Text = ini.GetSetting("upd_repository"); } if (ini.GetSetting("upd_beta") == "true") { opt_upd_beta.IsChecked = true; } else { opt_upd_beta.IsChecked = false; } if (ini.GetSetting("favgroup") == "true") { opt_favgroup_yes.IsChecked = true; } else { opt_favgroup_no.IsChecked = true; } }
public AddServer(IniHandler ini, string ServerName) { InitializeComponent(); INI = ini; _servername.Text = ServerName; _servername.IsEnabled = false; string serverstring = INI.GetServerAdress(ServerName); _serveradress.Text = serverstring.Split(':')[0]; _port.Text = serverstring.Split(':')[1].Split('/')[0]; _instanz.Text = serverstring.Split('/')[1]; Title = "Bearbeite Server"; addServer.Content = "Server Aktualisieren"; }
/// <summary> /// Reads the content from the files and calls SetEntityContent to save the values. /// </summary> /// <param name="directoryOfFoldersList">List with the path to the folders</param> private void ReadFileContent(IEnumerable <string> directoryOfFoldersList) { var prefix = _resEdit.GetPrefix(); foreach (var filepath in directoryOfFoldersList) { //Analyzes the Filepath and checks if it contains the prefix selected in the Settings //Prepare the path to the files if (filepath.Substring(_workingDirectory.Length, prefix.Length) != prefix) { continue; } var projIniHandler = new IniHandler($@"{filepath}\project.ini"); var configIniHandler = new IniHandler($@"{filepath}\Config\config.ini"); //Get content from project.ini _tempProjectName = projIniHandler.IniReadValue("GENERAL", "PROJECTNAME"); _tempProjectId = projIniHandler.IniReadValue("GENERAL", "PROJECTID"); _tempProjectGuid = projIniHandler.IniReadValue("GENERAL", "PROJECTGUID"); _tempPwProject = projIniHandler.IniReadValue("ProjectWise", "PWProject"); _tempPwProjectGuid = projIniHandler.IniReadValue("ProjectWise", "PWProjectGUID"); //get content from config.ini _tempRootSpecsDir = configIniHandler.IniReadValue("System", "Root_Specs_Dir"); _tempRootModulesDir = configIniHandler.IniReadValue("System", "Root_Modules_Dir"); _tempModulesIniFile = configIniHandler.IniReadValue("System", "Modules_Ini_File"); //Search for wrong values and set the if (_tempRootSpecsDir != _correctRootSpecsDir || _tempRootModulesDir != _correctRootModulesDir || _tempModulesIniFile != _correctModulesIniFile) //MODULES INI FILE { _tempIsChecked = true; _incorrectFiles.Add($@"{filepath}\Config\config.ini"); //TODO check onenote for infos (Buhler AG → iniTool) } else { _tempIsChecked = false; } //Add content to _entityContent SetEntityContents(filepath, _tempIsChecked, _tempProjectName, _tempProjectId, _tempProjectGuid, _tempPwProject, _tempPwProjectGuid, _tempRootSpecsDir, _tempRootModulesDir, _tempModulesIniFile); } }
private void SetCorrectFiles(IEnumerable <string> fileArray, string dir) { var prefix = _resEdit.GetPrefix(); foreach (var filepath in fileArray) { if (filepath.Substring(dir.Length, prefix.Length) != prefix) { continue; } var projIniHandler = new IniHandler($@"{filepath}\project.ini"); var configIniHandler = new IniHandler($@"{filepath}\Config\config.ini"); //get content form project.ini _tempProjectName = projIniHandler.IniReadValue("GENERAL", "PROJECTNAME"); _tempProjectId = projIniHandler.IniReadValue("GENERAL", "PROJECTID"); _tempProjectGuid = projIniHandler.IniReadValue("GENERAL", "PROJECTGUID"); _tempPwProject = projIniHandler.IniReadValue("ProjectWise", "PWProject"); _tempPwProjectGuid = projIniHandler.IniReadValue("ProjectWise", "PWProjectGUID"); //get content from config.ini _tempRootSpecsDir = configIniHandler.IniReadValue("System", "Root_Specs_Dir"); _tempRootModulesDir = configIniHandler.IniReadValue("System", "Root_Modules_Dir"); _tempModulesIniFile = configIniHandler.IniReadValue("System", "Modules_Ini_File"); //Search for files if (_tempRootSpecsDir != _correctRootSpecsDir || _tempRootModulesDir != _correctRootModulesDir || _tempModulesIniFile != _correctModulesIniFile) //MODULES INI FILE { _tempIsChecked = true; _incorrectFiles.Add($@"{filepath}\Config\config.ini"); //TODO was here } else { _tempIsChecked = false; } //Add content to contentList SetContentList(filepath, _tempIsChecked, _tempProjectName, _tempProjectId, _tempProjectGuid, _tempPwProject, _tempPwProjectGuid, _tempRootSpecsDir, _tempRootModulesDir, _tempModulesIniFile); } }
public AddMandant(IniHandler ini) { InitializeComponent(); INI = ini; }
static Util() { ConstIni = new IniHandler(Util.basedir + "\\Const.ini", ""); }
public SettingsUserControl() { _iniHandler = new IniHandler(@".\preferences.ini"); InitializeComponent(); }