示例#1
0
        public void DeleteLoginOptions()
        {
            this.Username   = "";
            this.Password   = "";
            this.AutoLogin  = false;
            this.RememberMe = false;

            if (CurrentUsername == "")
            {
                return;
            }
            try
            {
                lock (this.NetworksConfiguration)
                {
                    foreach (ClientConfigurationNetworks networkcfg in this.NetworksConfiguration)
                    {
                        if (networkcfg.Username == this.CurrentUsername)
                        {
                            this.NetworksConfiguration.Remove(networkcfg);
                            break;
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
            ClientConfigurationNetworks imnetworkcfg = new ClientConfigurationNetworks();

            imnetworkcfg.Username       = this.CurrentUsername;
            imnetworkcfg.AIM_Password   = this.AIM_Password;
            imnetworkcfg.AIM_Username   = this.AIM_Username;
            imnetworkcfg.GG_Password    = this.GG_Password;
            imnetworkcfg.GG_Username    = this.GG_Username;
            imnetworkcfg.ICQ_Password   = this.ICQ_Password;
            imnetworkcfg.ICQ_Username   = this.ICQ_Username;
            imnetworkcfg.IRC_Password   = this.IRC_Password;
            imnetworkcfg.IRC_Username   = this.IRC_Username;
            imnetworkcfg.MSN_Password   = this.MSN_Password;
            imnetworkcfg.MSN_Username   = this.MSN_Username;
            imnetworkcfg.Yahoo_Password = this.Yahoo_Password;
            imnetworkcfg.Yahoo_Username = this.Yahoo_Username;

            this.NetworksConfiguration.Add(imnetworkcfg);
            this.CurrentUsername = "";
        }
示例#2
0
        public void SaveClientConfiguration(ClientConfiguration clientConfiguration)
        {
            byte[] data;
            ClientConfiguration tmpClientConfiguration = new ClientConfiguration();

            try
            {
                if (!Directory.Exists(ClientConfigurationDir))
                {
                    Directory.CreateDirectory(ClientConfigurationDir);
                }

                lock (clientConfiguration.NetworksConfiguration)
                {
                    foreach (ClientConfigurationNetworks networkcfg in clientConfiguration.NetworksConfiguration)
                    {
                        if (networkcfg.Username == clientConfiguration.CurrentUsername)
                        {
                            clientConfiguration.NetworksConfiguration.Remove(networkcfg);
                            break;
                        }
                    }
                }

                //to fix compatibility issues sanitize saved object
                ClientConfigurationNetworks imnetworkcfg = new ClientConfigurationNetworks();
                imnetworkcfg.Username = clientConfiguration.CurrentUsername;
                imnetworkcfg.AIM_Password = clientConfiguration.AIM_Password;
                imnetworkcfg.AIM_Username = clientConfiguration.AIM_Username;
                imnetworkcfg.GG_Password = clientConfiguration.GG_Password;
                imnetworkcfg.GG_Username = clientConfiguration.GG_Username;
                imnetworkcfg.ICQ_Password = clientConfiguration.ICQ_Password;
                imnetworkcfg.ICQ_Username = clientConfiguration.ICQ_Username;
                imnetworkcfg.IRC_Password = clientConfiguration.IRC_Password;
                imnetworkcfg.IRC_Username = clientConfiguration.IRC_Username;
                imnetworkcfg.MSN_Password = clientConfiguration.MSN_Password;
                imnetworkcfg.MSN_Username = clientConfiguration.MSN_Username;
                imnetworkcfg.Yahoo_Password = clientConfiguration.Yahoo_Password;
                imnetworkcfg.Yahoo_Username = clientConfiguration.Yahoo_Username;

                clientConfiguration.NetworksConfiguration.Add(imnetworkcfg);


                tmpClientConfiguration.AutoLogin = clientConfiguration.AutoLogin;
                tmpClientConfiguration.LastNews = clientConfiguration.LastNews;
                tmpClientConfiguration.Password = clientConfiguration.Password;
                tmpClientConfiguration.RememberMe = clientConfiguration.RememberMe;
                tmpClientConfiguration.Username = clientConfiguration.Username;
                tmpClientConfiguration.NetworksConfiguration = clientConfiguration.NetworksConfiguration;

                MemoryStream xmlStream = new MemoryStream();
                this.serializer.Serialize(xmlStream, tmpClientConfiguration);
                xmlStream.Position = 0;
                data = xmlStream.GetBuffer();
                data = Protect(data);
                File.WriteAllBytes(ClientConfigurationDir + ClientConfigurationFile, data);
            }
            catch (Exception ex)
            {
                Console.WriteLine("SaveClientConfiguration : " + ex.Message);
            }
        }
示例#3
0
        public void DeleteLoginOptions()
        {
            this.Username = "";
            this.Password = "";
            this.AutoLogin = false;
            this.RememberMe = false;

            if (CurrentUsername == "") return;
            try
            {
                lock (this.NetworksConfiguration)
                {
                    foreach (ClientConfigurationNetworks networkcfg in this.NetworksConfiguration)
                    {
                        if (networkcfg.Username == this.CurrentUsername)
                        {
                            this.NetworksConfiguration.Remove(networkcfg);
                            break;
                        }
                    }
                }
            }
            catch (Exception)
            {

            }
            ClientConfigurationNetworks imnetworkcfg = new ClientConfigurationNetworks();

            imnetworkcfg.Username = this.CurrentUsername;
            imnetworkcfg.AIM_Password = this.AIM_Password;
            imnetworkcfg.AIM_Username = this.AIM_Username;
            imnetworkcfg.GG_Password = this.GG_Password;
            imnetworkcfg.GG_Username = this.GG_Username;
            imnetworkcfg.ICQ_Password = this.ICQ_Password;
            imnetworkcfg.ICQ_Username = this.ICQ_Username;
            imnetworkcfg.IRC_Password = this.IRC_Password;
            imnetworkcfg.IRC_Username = this.IRC_Username;
            imnetworkcfg.MSN_Password = this.MSN_Password;
            imnetworkcfg.MSN_Username = this.MSN_Username;
            imnetworkcfg.Yahoo_Password = this.Yahoo_Password;
            imnetworkcfg.Yahoo_Username = this.Yahoo_Username;

            this.NetworksConfiguration.Add(imnetworkcfg);
            this.CurrentUsername = "";
        }
示例#4
0
        public void SaveClientConfiguration(ClientConfiguration clientConfiguration)
        {
            byte[] data;
            ClientConfiguration tmpClientConfiguration = new ClientConfiguration();

            try
            {
                if (!Directory.Exists(ClientConfigurationDir))
                {
                    Directory.CreateDirectory(ClientConfigurationDir);
                }

                lock (clientConfiguration.NetworksConfiguration)
                {
                    foreach (ClientConfigurationNetworks networkcfg in clientConfiguration.NetworksConfiguration)
                    {
                        if (networkcfg.Username == clientConfiguration.CurrentUsername)
                        {
                            clientConfiguration.NetworksConfiguration.Remove(networkcfg);
                            break;
                        }
                    }
                }

                //to fix compatibility issues sanitize saved object
                ClientConfigurationNetworks imnetworkcfg = new ClientConfigurationNetworks();
                imnetworkcfg.Username       = clientConfiguration.CurrentUsername;
                imnetworkcfg.AIM_Password   = clientConfiguration.AIM_Password;
                imnetworkcfg.AIM_Username   = clientConfiguration.AIM_Username;
                imnetworkcfg.GG_Password    = clientConfiguration.GG_Password;
                imnetworkcfg.GG_Username    = clientConfiguration.GG_Username;
                imnetworkcfg.ICQ_Password   = clientConfiguration.ICQ_Password;
                imnetworkcfg.ICQ_Username   = clientConfiguration.ICQ_Username;
                imnetworkcfg.IRC_Password   = clientConfiguration.IRC_Password;
                imnetworkcfg.IRC_Username   = clientConfiguration.IRC_Username;
                imnetworkcfg.MSN_Password   = clientConfiguration.MSN_Password;
                imnetworkcfg.MSN_Username   = clientConfiguration.MSN_Username;
                imnetworkcfg.Yahoo_Password = clientConfiguration.Yahoo_Password;
                imnetworkcfg.Yahoo_Username = clientConfiguration.Yahoo_Username;

                clientConfiguration.NetworksConfiguration.Add(imnetworkcfg);


                tmpClientConfiguration.AutoLogin             = clientConfiguration.AutoLogin;
                tmpClientConfiguration.LastNews              = clientConfiguration.LastNews;
                tmpClientConfiguration.Password              = clientConfiguration.Password;
                tmpClientConfiguration.RememberMe            = clientConfiguration.RememberMe;
                tmpClientConfiguration.Username              = clientConfiguration.Username;
                tmpClientConfiguration.NetworksConfiguration = clientConfiguration.NetworksConfiguration;

                MemoryStream xmlStream = new MemoryStream();
                this.serializer.Serialize(xmlStream, tmpClientConfiguration);
                xmlStream.Position = 0;
                data = xmlStream.GetBuffer();
                data = Protect(data);
                File.WriteAllBytes(ClientConfigurationDir + ClientConfigurationFile, data);
            }
            catch (Exception ex)
            {
                Console.WriteLine("SaveClientConfiguration : " + ex.Message);
            }
        }