Пример #1
0
        public static void ReadSettings(MainForm form)
        {
            FTPSettings ftpSettings = new FTPSettings();

            form.PenSize      = Properties.Settings.Default.PenWidth;
            form.ShapeOpacity = Properties.Settings.Default.Opacity;
            form.ArrowSize    = Properties.Settings.Default.ArrowSize;

            form.txtFont = new Font(Properties.Settings.Default.FontName, Properties.Settings.Default.FontSize, FontStyle.Regular, GraphicsUnit.Pixel);

            form.DrawingColor     = Properties.Settings.Default.Color;
            ftpSettings.FTPServer = Properties.Settings.Default.FTPServer;
            ftpSettings.FTPPort   = Properties.Settings.Default.FTPPort;
            ftpSettings.FTPUser   = Properties.Settings.Default.FTPUser;

            string     temp = Properties.Settings.Default.FTPPwd;
            SimplerAES aes  = new SimplerAES();

            ftpSettings.FTPPwd = temp == "" ? "" : aes.Decrypt(temp);

            ftpSettings.AnonymousLogin = Properties.Settings.Default.AnonymousLogin;
            ftpSettings.UseProxy       = Properties.Settings.Default.UseProxyServer;
            ftpSettings.PrxyServer     = Properties.Settings.Default.ProxyServer;
            ftpSettings.PrxyUser       = Properties.Settings.Default.ProxyUser;

            temp = Properties.Settings.Default.ProxyPassword;
            ftpSettings.PrxyPwd = temp == "" ? "" : aes.Decrypt(temp);

            ftpSettings.PrxyPort = Properties.Settings.Default.ProxyPort;
            ftpSettings.DefaultImagesLocation = Properties.Settings.Default.DefaultImagesLocation;
            form.GridColor        = Properties.Settings.Default.GridColor;
            form.ftpSettings      = ftpSettings;
            form.NoOfHistoryItems = Properties.Settings.Default.NoOfHistoryFiles;
        }
Пример #2
0
        public static void WriteSettings(MainForm form)
        {
            FTPSettings ftpSettings = form.ftpSettings;

            Properties.Settings.Default.PenWidth  = form.PenSize;
            Properties.Settings.Default.Opacity   = form.ShapeOpacity;
            Properties.Settings.Default.ArrowSize = form.ArrowSize;
            Properties.Settings.Default.FontName  = form.txtFont.Name;
            Properties.Settings.Default.FontSize  = form.txtFont.Size;
            Properties.Settings.Default.Color     = form.DrawingColor;
            Properties.Settings.Default.FTPServer = ftpSettings.FTPServer;
            Properties.Settings.Default.FTPPort   = ftpSettings.FTPPort;
            Properties.Settings.Default.FTPUser   = ftpSettings.FTPUser;
            SimplerAES aes    = new SimplerAES();
            string     encPwd = ftpSettings.FTPPwd == null ? "" : ftpSettings.FTPPwd;

            encPwd = aes.Encrypt(encPwd);
            Properties.Settings.Default.FTPPwd         = encPwd;
            Properties.Settings.Default.AnonymousLogin = ftpSettings.AnonymousLogin;
            Properties.Settings.Default.UseProxyServer = ftpSettings.UseProxy;
            Properties.Settings.Default.ProxyServer    = ftpSettings.PrxyServer;
            Properties.Settings.Default.ProxyUser      = ftpSettings.PrxyUser;
            string prxyPwd = ftpSettings.PrxyPwd == null ? "" : ftpSettings.PrxyPwd;

            prxyPwd = aes.Encrypt(prxyPwd);
            Properties.Settings.Default.ProxyPassword         = prxyPwd;
            Properties.Settings.Default.ProxyPort             = ftpSettings.PrxyPort;
            Properties.Settings.Default.DefaultImagesLocation = ftpSettings.DefaultImagesLocation;
            Properties.Settings.Default.GridColor             = form.GridColor;
            Properties.Settings.Default.NoOfHistoryFiles      = form.NoOfHistoryItems;

            Properties.Settings.Default.Save();
        }