コード例 #1
0
        public BackendLogic()
        {
            ip      = "";
            iniPath = "";
            port    = null;
            url     = "";
            typ     = BackendProtokollTypes.http;

            iniPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Vereinsverwaltung\\";
            if (!Directory.Exists(iniPath))
            {
                Directory.CreateDirectory(iniPath);
            }
            iniPath += FILENAME;
            parser   = new FileIniDataParser();
        }
コード例 #2
0
        public void SaveData(string ip, BackendProtokollTypes protokollTyp, int?port, string url)
        {
            this.ip   = ip;
            this.typ  = protokollTyp;
            this.port = port;
            this.url  = url;

            iniData = new IniData();
            iniData.Sections.AddSection("Backend-Settings");

            iniData.Sections.GetSectionData("Backend-Settings").Keys.AddKey("IP", ip);
            iniData.Sections.GetSectionData("Backend-Settings").Keys.AddKey("URL", url);
            iniData.Sections.GetSectionData("Backend-Settings").Keys.AddKey("Protokoll", Convert.ToString(Convert.ToInt32(protokollTyp)));
            iniData.Sections.GetSectionData("Backend-Settings").Keys.AddKey("Port", Convert.ToString(port));

            parser.WriteFile(iniPath, iniData);
        }
コード例 #3
0
        private void LoadBackendSettings()
        {
            if (IsFieldVorhanden("Backend-Settings", "IP"))
            {
                ip = iniData.Sections["Backend-Settings"].GetKeyData("IP").Value;
            }
            if (IsFieldVorhanden("Backend-Settings", "URL"))
            {
                url = iniData.Sections["Backend-Settings"].GetKeyData("URL").Value;
            }

            if ((IsFieldVorhanden("Backend-Settings", "Protokoll")) && int.TryParse(iniData.Sections["Backend-Settings"].GetKeyData("Protokoll").Value, out _))
            {
                typ = (BackendProtokollTypes)int.Parse(iniData.Sections["Backend-Settings"].GetKeyData("Protokoll").Value);
            }
            if ((IsFieldVorhanden("Backend-Settings", "Port")) && int.TryParse(iniData.Sections["Backend-Settings"].GetKeyData("Port").Value, out _))
            {
                port = int.Parse(iniData.Sections["Backend-Settings"].GetKeyData("Port").Value);
            }
        }