コード例 #1
0
        private void SaveSettings()
        {
            var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);

            si = new Settings ();
            si.SettingsList = new List<SettingsDetails> ();
            SettingsDetails sid = new SettingsDetails ();
            var filename = Path.Combine (documents, "delugemobile_settings.xml");
            sid.host = url.Value;

            int iport;
            int.TryParse (port.Value, out iport);

            sid.port = iport;
            sid.auto = autoupdt.Value;
            sid.pass = password.Value;

            si.SettingsList.Add (sid);

            XmlSerializer serializer = new XmlSerializer (typeof(Settings));
            TextWriter textWriter = new StreamWriter (filename);
            serializer.Serialize (textWriter, si);
            textWriter.Close ();
        }
コード例 #2
0
        private void SaveSettings()
        {
            var documents = Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments);
            var filename = Path.Combine (documents, "proscanmobile_servers.xml");

            Servers s_tmp = new Servers ();
            s_tmp.ServerList = new List<ServerDetails> ();

            foreach (ServerDetails sd_tmp in s.ServerList) {
                s_tmp.ServerList.Add (new ServerDetails () {
                    host = XmlConvert.EncodeName(sd_tmp.host),
                    port = XmlConvert.EncodeName(sd_tmp.port),
                    desc = XmlConvert.EncodeName(sd_tmp.desc),
                    country = XmlConvert.EncodeName(sd_tmp.country),
                    state = XmlConvert.EncodeName(sd_tmp.state),
                    county = XmlConvert.EncodeName(sd_tmp.county),
                    open = XmlConvert.EncodeName(sd_tmp.open)
                });
            }

            XmlSerializer serializer = new XmlSerializer (typeof(Servers));
            TextWriter textWriter = new StreamWriter (filename);
            serializer.Serialize (textWriter, s_tmp);
            textWriter.Close ();

            s_tmp = null;

            si = new Settings ();
            si.SettingsList = new List<SettingsDetails> ();
            SettingsDetails sid = new SettingsDetails ();
            filename = Path.Combine (documents, "proscanmobile_settings.xml");
            sid.host = _txtServerHost.Text;

            int port;
            int.TryParse (_txtServerPort.Text, out port);

            sid.port = port;
            sid.auto = _swAutoConnect.On;
            #if PLUS_VERSION
            sid.pass = enc.Encrypt(_txtServerPassword.Text);
            #else
            sid.pass = string.Empty;
            #endif
            si.SettingsList.Add (sid);

            serializer = new XmlSerializer (typeof(Settings));
            textWriter = new StreamWriter (filename);
            serializer.Serialize (textWriter, si);
            textWriter.Close ();
        }