示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Configuration"/> class
        /// with values from another instance.
        /// </summary>
        /// <param name="that">
        /// The <see cref="Configuration"/> instance whose values to copy.
        /// </param>
        public Configuration(Configuration that)
        {
            // Server
            this.FtpHostname = that.FtpHostname;
            this.FtpPort = that.FtpPort;
            this.UseSSH = that.UseSSH;
            this.FtpTimeout = that.FtpTimeout;

            // Authentication
            this.FtpUsername = that.FtpUsername;
            this.FtpPassword = that.FtpPassword;
            this.PrivateKeyPath = that.PrivateKeyPath;

            // Upload
            this.UseCompression = that.UseCompression;
            this.JpegQuality = that.JpegQuality;
            this.FilenameFormat = that.FilenameFormat;
            this.FtpServerPath = that.FtpServerPath;
            this.HttpBaseUri = that.HttpBaseUri;
            this.FailedScreenshotsFolder = that.FailedScreenshotsFolder;
            this.CheckForDuplicateFiles = that.CheckForDuplicateFiles;

            // UI
            this.ShowPreviewDialog = that.ShowPreviewDialog;
            this.OverlayBackgroundColor = that.OverlayBackgroundColor;
            this.OverlayForegroundColor = that.OverlayForegroundColor;
            this.OverlayOpacity = that.OverlayOpacity;
            this.EnableTrayIcon = that.EnableTrayIcon;
            this.ShowBalloontip = that.ShowBalloontip;
        }
示例#2
0
        private static void LoadSettings()
        {
            string appData = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Superscrot");
            if (!Directory.Exists(appData))
                Directory.CreateDirectory(appData);

            settingsPath = Path.Combine(appData, "Config.xml");

            var logName = string.Format("{0:y}.svclog", DateTime.Now);
            var logPath = Path.Combine(appData, logName);
            Trace.Listeners.Add(new XmlWriterTraceListener(logPath, "Superscrot"));
            Trace.AutoFlush = true;

            if (File.Exists(settingsPath))
            {
                config = Configuration.LoadSettings(settingsPath);
            }
            else
            {
                //Save default settings
                config = new Configuration();
                Program.Config.SaveSettings(settingsPath);
                startedWithDefaultSettings = true;
            }
        }