Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GorgonEditorSettings"/> class.
        /// </summary>
        internal GorgonEditorSettings()
            : base("Gorgon.Editor", new Version(1, 0))
        {
            AnimateStartPageLogo        = true;
            StartPageAnimationPulseRate = 0.125f;

            // Set the path for the application settings.
            Path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).FormatDirectory(System.IO.Path.DirectorySeparatorChar)
                   + "Tape_Worm".FormatDirectory(System.IO.Path.DirectorySeparatorChar)
                   + ApplicationName.FormatDirectory(System.IO.Path.DirectorySeparatorChar)
#if !DEBUG
                   + "Gorgon.Editor.config.xml";
#else
                   + "Gorgon.Editor.DEBUG.config.xml";
#endif

            var baseSize = new Size(1280, 800);

            // Set the default size, but ensure that it fits within the primary monitor.
            // Do not go larger than 1280x800 by default.
            if (Screen.PrimaryScreen.WorkingArea.Width < 1280)
            {
                baseSize.Width = Screen.PrimaryScreen.WorkingArea.Width;
            }
            if (Screen.PrimaryScreen.WorkingArea.Height < 800)
            {
                baseSize.Height = Screen.PrimaryScreen.WorkingArea.Height;
            }

            WindowDimensions = new Rectangle(Screen.PrimaryScreen.WorkingArea.Width / 2 - baseSize.Width / 2, Screen.PrimaryScreen.WorkingArea.Height / 2 - baseSize.Height / 2, 1280, 800);

            RecentFiles          = new List <string>();
            _userDisabledPlugIns = new List <string>();
            PlugInDirectory      = Gorgon.ApplicationDirectory + "PlugIns";

            // Set the default scratch location.
            ScratchPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
                          .FormatDirectory(System.IO.Path.DirectorySeparatorChar)
                          + "Tape_Worm".FormatDirectory(System.IO.Path.DirectorySeparatorChar)
                          + ApplicationName.FormatDirectory(System.IO.Path.DirectorySeparatorChar);

            var dirInfo = new DirectoryInfo(ScratchPath);

            if (!dirInfo.Exists)
            {
                return;
            }

            try
            {
                // Attempt to find the directory and write to it.
                dirInfo.GetAccessControl();
            }
            catch (UnauthorizedAccessException)
            {
                ScratchPath = GetBestDrive().Name;
            }
        }