Beispiel #1
0
        public static List <AvailableOverlaySetting> GetValidOverlaySettings()
        {
            List <AvailableOverlaySetting> availableSettings = new List <AvailableOverlaySetting>();
            Uri baseUri = new Uri(OverlaysBasePath.FullName);

            if (!OverlaysBasePath.Exists)
            {
                OverlaysBasePath.Create();
            }

            foreach (DirectoryInfo settingsFolder in OverlaysBasePath.GetDirectories())
            {
                foreach (FileInfo overlaySettingFile in settingsFolder.GetFiles("*.xml"))
                {
                    AvailableOverlaySetting aos = new AvailableOverlaySetting()
                    {
                        Local     = true,
                        Name      = settingsFolder.Name + ": " + Path.GetFileNameWithoutExtension(overlaySettingFile.Name),
                        Path      = baseUri.MakeRelativeUri(new Uri(overlaySettingFile.FullName)).ToString(),
                        IsCurrent = (Instance.diskLocation != null ? (Instance.diskLocation.FullName == overlaySettingFile.FullName) : false)
                    };

                    availableSettings.Add(aos);
                }
            }

            return(availableSettings);
        }
        public static List<AvailableOverlaySetting> GetValidOverlaySettings()
        {
            List<AvailableOverlaySetting> availableSettings = new List<AvailableOverlaySetting>();
                Uri baseUri = new Uri(OverlaysBasePath.FullName);

                if (!OverlaysBasePath.Exists)
                    OverlaysBasePath.Create();

                foreach (DirectoryInfo settingsFolder in OverlaysBasePath.GetDirectories())
                {
                    foreach (FileInfo overlaySettingFile in settingsFolder.GetFiles("*.xml"))
                    {
                        AvailableOverlaySetting aos = new AvailableOverlaySetting()
                        {
                            Local = true,
                            Name = settingsFolder.Name + ": " + Path.GetFileNameWithoutExtension(overlaySettingFile.Name),
                            Path = baseUri.MakeRelativeUri(new Uri(overlaySettingFile.FullName)).ToString(),
                            IsCurrent = (Instance.diskLocation != null ? (Instance.diskLocation.FullName == overlaySettingFile.FullName) : false)
                        };

                        availableSettings.Add(aos);

                    }
                }

                return availableSettings;
        }
        void SelectOverlaySettings_OverlaySettingSelected(AvailableOverlaySetting selectedSetting)
        {
            if (selectedSetting.Local != true)
                        throw new ArgumentException();

                    try
                    {
                        OverlaySettings.Instance.Load(new FileInfo(Path.Combine(OverlaySettings.OverlaysBasePath.FullName, selectedSetting.Path)));
                    } catch (OverlayLoadingException ole) {
                        MessageBox.Show("Overlay Loading Exception: " + ole.Message);
                    } catch (Exception ex) {
                        MessageBox.Show("Unhandled exception: " + ex.Message);
                    }
        }