/// <summary>
 /// Initializes a new instance of the <see cref="Resolutions" /> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="resolvable">The resolvable.</param>
 public Resolutions(
     [CanBeNull] Resolutions parent,
     [NotNull] IResolvable resolvable)
     : base(resolvable.IsCaseSensitive, resolvable.ResolveOuterTags, resolvable.ResolveControls)
 {
     if (resolvable == null) throw new ArgumentNullException("resolvable");
     Parent = parent;
     _resolver = resolvable.Resolve;
 }
Example #2
0
 public IfSpectrumViewModel(RadioViewModel radioViewModel, ISpectrumAnalyzer spectrumAnalyzer)
     : base(radioViewModel, spectrumAnalyzer)
 {
     SelectedResolution = Resolutions.ToArray <ResolutionBandwidth>()[3];
 }
Example #3
0
 public BingSchema()
 {
     Format = "jpg";
     Name   = "BingMaps";
     Resolutions.Remove("0"); //Bing does not have the single tile top level.
 }
        public void FillData()
        {
            //engine setting
            uint width, height;

            Engine.Instance.Driver.GetDisplayMode(out width, out height);
            SVideoSetting videoSetting = Engine.Instance.VideoSetting;

            //
            DisplayModes.Clear();
            DisplayModes.Add(new DisplayMode()
            {
                WindowMode = true
            });
            _cbDisplayModes.SelectedIndex     = 0;
            _cbDisplayModes.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            Resolutions.Clear();
            Resolutions.Add(new Resolution()
            {
                Width = width, Height = height
            });

            _cbResolutions.SelectedIndex     = 0;
            _cbResolutions.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //

            RefreshRates.Default();
            _cbRefreshRates.SelectedIndex     = 0;
            _cbRefreshRates.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            VideoDevices.Clear();
            VideoDevices.Add(new VideoDevice()
            {
                Index = 0
            });

            _cbVideoDevices.SelectedIndex     = 0;
            _cbVideoDevices.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            MultiSamples.Default();
            _cbMultisamples.SelectedItem      = (from x in MultiSamples where x.Sample == videoSetting.antialias select x).ToArray()[0];
            _cbMultisamples.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            _cbVsyncs.SelectedItem      = (from x in VSyncs where x.On == videoSetting.vsync select x).ToArray()[0];
            _cbVsyncs.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            MatResolutions.Clear();
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_ONE
            });
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_TWO
            });
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_THREE
            });
            MatResolutions.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_FOUR
            });

            _cbMatResolutions.SelectedItem      = (from x in MatResolutions where x.Level == videoSetting.materialResolution select x).ToArray()[0];
            _cbMatResolutions.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            _cbMatTextureFilters.SelectedItem      = (from x in MatTextureFilters where x.Filter == videoSetting.textureFilter select x).ToArray()[0];
            _cbMatTextureFilters.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            _cbMatProjections.SelectedItem      = (from x in MatProjections where x.On == false select x).ToArray()[0];
            _cbMatProjections.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            //
            ViewDistances.Default();
            _cbViewDistances.SelectedItem      = (from x in ViewDistances where x.Level == videoSetting.viewDistance select x).ToArray()[0];
            _cbViewDistances.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            EnvDetails.Default();
            _cbEnvDetails.SelectedItem      = (from x in EnvDetails where x.Level == videoSetting.envDetail select x).ToArray()[0];
            _cbEnvDetails.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            GroundScenes.Default();
            _cbGroundScenes.SelectedItem      = (from x in GroundScenes where x.Level == videoSetting.groundScene select x).ToArray()[0];
            _cbGroundScenes.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            ShadowQualities.Default();
            _cbShadowQuality.SelectedItem      = (from x in ShadowQualities where x.Level == videoSetting.shadowQuality select x).ToArray()[0];
            _cbShadowQuality.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            LiquidDetails.Clear();
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_ONE
            });
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_TWO
            });
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_THREE
            });
            LiquidDetails.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_FIVE
            });
            _cbLiquidDetail.SelectedItem      = (from x in LiquidDetails where x.Level == videoSetting.liquidDetail select x).ToArray()[0];
            _cbLiquidDetail.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            SunLightEffects.Clear();
            SunLightEffects.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_ZERO
            });
            SunLightEffects.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_ONE
            });
            SunLightEffects.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_FOUR
            });
            _cbSunLightEffect.SelectedItem      = (from x in SunLightEffects where x.Level == videoSetting.sunLightEffect select x).ToArray()[0];
            _cbSunLightEffect.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            ParticleDensities.Default();
            _cbParticleDensity.SelectedItem      = (from x in ParticleDensities where x.Level == videoSetting.particleDensity select x).ToArray()[0];
            _cbParticleDensity.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);

            SSAOLevels.Clear();
            SSAOLevels.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_ZERO
            });
            SSAOLevels.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_ONE
            });
            SSAOLevels.Add(new OptionLevel()
            {
                Level = E_LEVEL.EL_FOUR
            });
            _cbSSAO.SelectedItem      = (from x in SSAOLevels where x.Level == videoSetting.SSAO select x).ToArray()[0];
            _cbSSAO.SelectionChanged += new SelectionChangedEventHandler(_option_SelectionChanged);
        }
Example #5
0
        public static string ChooseResolutionFromM3U8(string M3U8Url)
        {
            string          M3U8Content = new WebClient().DownloadString(M3U8Url);
            MatchCollection Streams     = Regex.Matches(M3U8Content, "(#EXT-X-STREAM.*)\\s(.*)");
            List <(int resolution, int bandwidth, string url)> Resolutions = new List <(int, int, string)>();

            foreach (Match Stream in Streams)
            {
                string INFO = Stream.Groups[1].Value;
                Resolutions.Add((int.Parse(Regex.Match(INFO, "RESOLUTION=[^x]*x([^,]*)").Groups[1].Value), int.Parse(Regex.Match(INFO, "BANDWIDTH=([^,]*)").Groups[1].Value), Stream.Groups[2].Value));
            }
            IOrderedEnumerable <(int resolution, int bandwidth, string url)> OrderedResolutions = Resolutions.OrderByDescending(x => x.bandwidth).OrderByDescending(x => x.resolution);
            string Choice           = string.Empty;
            bool   CLIChoiceInvalid = Arguments.Quality != null && Arguments.Quality != "best" && !OrderedResolutions.Cast <Match>().Any(x => x.Groups[2].Value == Arguments.Quality);

            if (Arguments.Quality == null || CLIChoiceInvalid)
            {
                if (CLIChoiceInvalid)
                {
                    Logger.Error("--quality value \"" + Arguments.Quality + "\" is not valid\n Please choose a new one below.");
                }
                VideoTracks(OrderedResolutions.Select(res => new[] { res.resolution.ToString(), res.bandwidth.ToString() }).ToArray());
                Choice = AskInput("Which resolution do you wish to download? (use # or 'best')").Trim('#');
            }
            else
            {
                Choice = Arguments.Quality;
            }
            var Selected = Choice == "best" ? OrderedResolutions.First() : OrderedResolutions.ElementAt(int.Parse(Choice) - 1);

            if (!Selected.url.StartsWith("http"))
            {
                Selected.url = M3U8Url.Substring(0, M3U8Url.LastIndexOf('/') + 1) + Selected.url;
            }
            Logger.Info("VIDEO: " + Selected.resolution + "p @ " + Selected.bandwidth + " bandwidth");
            Logger.Debug("M3U8: " + Selected.url);
            return(Selected.url);
        }
Example #6
0
        public override void Activate()
        {
            this._itemsPosition = new Vector2(
                this.ScreenManager.GraphicsDevice.Viewport.Width * 0.5f,
                this.ScreenManager.GraphicsDevice.Viewport.Height * 0.33f);

            PresentationParameters pp = ScreenManager.GraphicsDevice.PresentationParameters;

            this.fullscreen = pp.IsFullScreen;
            float height = pp.BackBufferHeight;

            if (height == 720)
            {
                resolution = Resolutions.A;
            }
            else
            {
                if (height == 800)
                {
                    resolution = Resolutions.B;
                }
                else
                {
                    if (height == 768)
                    {
                        resolution = Resolutions.C;
                    }
                    else
                    {
                        if (height == 900)
                        {
                            resolution = Resolutions.D;
                        }
                        else
                        {
                            if (height == 1050)
                            {
                                resolution = Resolutions.E;
                            }
                            else
                            {
                                if (height == 1080)
                                {
                                    resolution = Resolutions.F;
                                }
                                else
                                {
                                    if (height == 1200)
                                    {
                                        resolution = Resolutions.G;
                                    }
                                    else
                                    {
                                        resolution = Resolutions.A;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            SetMenuEntryText();
        }
Example #7
0
        private Configuration loadConfig()
        {
            #region DeviceConfig
            if (!configFile.KeyExists("CaptureDevice", "Devices"))
            {
                this.CaptureDevice = 0;
            }
            else
            {
                if (int.TryParse(configFile.Read("CaptureDevice", "Devices"), out int result))
                {
                    this.captureDevice = result;
                }
                else
                {
                    this.CaptureDevice = 0;
                }
            }

            if (!configFile.KeyExists("CaptureResolution", "Devices"))
            {
                this.CaptureResolution = (Resolutions)1;
            }
            else
            {
                if (int.TryParse(configFile.Read("CaptureResolution", "Devices"), out int result))
                {
                    this.captureResolution = (Resolutions)result;
                }
                else
                {
                    this.CaptureResolution = (Resolutions)1;
                }
            }

            if (!configFile.KeyExists("SerialPort", "Devices"))
            {
                this.SerialPort = "COM3";
            }
            else
            {
                this.serialPort = configFile.Read("SerialPort", "Devices");
            }

            if (!configFile.KeyExists("SerialBaudRate", "Devices"))
            {
                this.SerialBaudRate = 19200;
            }
            else
            {
                if (int.TryParse(configFile.Read("SerialBaudRate", "Devices"), out int result))
                {
                    this.serialBaudRate = result;
                }
                else
                {
                    this.SerialBaudRate = 19200;
                }
            }

            if (!configFile.KeyExists("SerialParity", "Devices"))
            {
                this.SerialParity = (Parity)2;
            }
            else
            {
                if (int.TryParse(configFile.Read("SerialParity", "Devices"), out int result))
                {
                    this.serialParity = (Parity)result;
                }
                else
                {
                    this.SerialParity = (Parity)2;
                }
            }

            if (!configFile.KeyExists("SerialDataBits", "Devices"))
            {
                this.SerialDataBits = 8;
            }
            else
            {
                if (int.TryParse(configFile.Read("SerialDataBits", "Devices"), out int result))
                {
                    this.serialDataBits = result;
                }
                else
                {
                    this.SerialDataBits = 8;
                }
            }

            if (!configFile.KeyExists("SerialStopBits", "Devices"))
            {
                this.SerialStopBits = (StopBits)1;
            }
            else
            {
                if (int.TryParse(configFile.Read("SerialStopBits", "Devices"), out int result))
                {
                    this.serialStopBits = (StopBits)result;
                }
                else
                {
                    this.SerialStopBits = (StopBits)1;
                }
            }
            #endregion

            #region StartupConfig
            if (!configFile.KeyExists("SerialOnStartup", "Startup"))
            {
                this.SerialOnStartup = false;
            }
            else
            {
                if (bool.TryParse(configFile.Read("SerialOnStartup", "Startup"), out bool result))
                {
                    this.serialOnStartup = result;
                }
                else
                {
                    this.SerialOnStartup = false;
                }
            }

            if (!configFile.KeyExists("ControllerOnStartup", "Startup"))
            {
                this.ControllerOnStartup = false;
            }
            else
            {
                if (bool.TryParse(configFile.Read("ControllerOnStartup", "Startup"), out bool result))
                {
                    this.controllerOnStartup = result;
                }
                else
                {
                    this.ControllerOnStartup = false;
                }
            }

            if (!configFile.KeyExists("CaptureOnStartup", "Startup"))
            {
                this.CaptureOnStartup = false;
            }
            else
            {
                if (bool.TryParse(configFile.Read("CaptureOnStartup", "Startup"), out bool result))
                {
                    this.captureOnStartup = result;
                }
                else
                {
                    this.CaptureOnStartup = false;
                }
            }

            if (!configFile.KeyExists("ButtonsOnStartup", "Startup"))
            {
                this.ButtonsOnStartup = false;
            }
            else
            {
                if (bool.TryParse(configFile.Read("ButtonsOnStartup", "Startup"), out bool result))
                {
                    this.buttonsOnStartup = result;
                }
                else
                {
                    this.ButtonsOnStartup = false;
                }
            }
            #endregion

            #region VideoConfig

            #endregion


            return(this);
        }
    public void OnGUI()
    {
        if (gradient == null)
        {
            gradient = new Gradient();
        }
        if (oldGradient == null)
        {
            oldGradient = new Gradient();
        }

        if (focusedMat != null && gradient != null)
        {
            XSStyles.ShurikenHeader("Current Material: " + focusedMat.name);
        }
        else
        {
            XSStyles.ShurikenHeader("Current Material: None");
        }

        SerializedObject   serializedGradient = new SerializedObject(this);
        SerializedProperty colorGradient      = serializedGradient.FindProperty("gradient");

        EditorGUILayout.PropertyField(colorGradient, true, null);
        serializedGradient.ApplyModifiedProperties();

        bool changed = !CompareGradients(oldGradient, gradient);

        if (oldFocusedMat != focusedMat)
        {
            changed = true;
            if (this.oldTexture != null)
            {
                if (this.oldTexture == EditorGUIUtility.whiteTexture)
                {
                    this.oldTexture = null;
                }
                oldFocusedMat.SetTexture("_Ramp", this.oldTexture);
                this.oldTexture = null;
            }
            oldFocusedMat = focusedMat;
        }

        if (changed)
        {
            oldGradient.SetKeys(gradient.colorKeys, gradient.alphaKeys);
            oldGradient.mode = gradient.mode;
        }

        Resolutions oldRes = res;

        res = (Resolutions)EditorGUILayout.EnumPopup("Resolution: ", res);
        if (oldRes != res)
        {
            changed = true;
        }

        int width  = (int)res;
        int height = 8;

        isLinear = GUILayout.Toggle(isLinear, "Make Linear Texture");

        if (gradient != null)
        {
            Texture2D tex = new Texture2D(width, height, TextureFormat.RGBA32, false);

            for (int y = 0; y < tex.height; y++)
            {
                for (int x = 0; x < tex.width; x++)
                {
                    tex.SetPixel(x, y, gradient.Evaluate((float)x / (float)width));
                }
            }

            if (focusedMat != null)
            {
                if (changed)
                {
                    if (focusedMat.HasProperty("_Ramp"))
                    {
                        if (this.oldTexture == null)
                        {
                            if (focusedMat.GetTexture("_Ramp") == null)
                            {
                                this.oldTexture = EditorGUIUtility.whiteTexture;
                            }
                            else
                            {
                                this.oldTexture = focusedMat.GetTexture("_Ramp");
                            }
                        }
                        tex.wrapMode = TextureWrapMode.Clamp;
                        tex.Apply(false);
                        focusedMat.SetTexture("_Ramp", tex);
                    }
                }
            }

            XSStyles.Separator();
            if (GUILayout.Button("Save Ramp"))
            {
                finalFilePath = XSStyles.findAssetPath(finalFilePath);
                string path = EditorUtility.SaveFilePanel("Save Ramp as PNG", finalFilePath + "/Textures/Shadow Ramps/Generated", "gradient.png", "png");
                if (path.Length != 0)
                {
                    bool success = GenTexture(tex, path);
                    if (success)
                    {
                        if (focusedMat != null)
                        {
                            string  s    = path.Substring(path.IndexOf("Assets"));
                            Texture ramp = AssetDatabase.LoadAssetAtPath <Texture>(s);
                            if (ramp != null)
                            {
                                focusedMat.SetTexture("_Ramp", ramp);
                                this.oldTexture = null;
                            }
                        }
                    }
                }
            }
        }

        XSStyles.HelpBox("You can use this to create a custom shadow ramp in realtime. \nIf you do not save, the ramp will be reverted back to what it was previously. \n\n - Click the Gradient box. \n - Choose resolution of the texture. \n - Save.", MessageType.Info);
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="Resolutions" /> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="resolver">The resolver.</param>
 /// <param name="isCaseSensitive">if set to <see langword="true" /> then tags are case sensitive.</param>
 /// <param name="resolveOuterTags">if set to <see langword="true" />  outer tags should be resolved automatically in formats.</param>
 /// <param name="resolveControls">if set to <see langword="true" /> then controls will passed to the resolvable.</param>
 public Resolutions(
     [CanBeNull] Resolutions parent,
     [NotNull] ResolveDelegate resolver,
     bool isCaseSensitive,
     bool resolveOuterTags,
     bool resolveControls)
     : base(isCaseSensitive, resolveOuterTags, resolveControls)
 {
     if (resolver == null) throw new ArgumentNullException("resolver");
     Parent = parent;
     _resolver = resolver;
 }
Example #10
0
        void btnStart_Click(object sender, EventArgs e)
        {
            Resolutions rRes = Resolutions.Daily;

            switch (cResolution.SelectedIndex)
            {
            case 0:
                rRes = Resolutions.Daily;
                break;

            case 1:
                rRes = Resolutions.Weekly;
                break;

            case 2:
                rRes = Resolutions.Monthly;
                break;

            case 3:
                rRes = Resolutions.Yearly;
                break;
            }
            GraphEngine gEngine = new GraphEngine("Archive\\" + cResolution.Items[cResolution.SelectedIndex].ToString(), rRes);

            for (int i = 0; i < cItemType.Length; i++)
            {
                GraphItem.Type tType = GraphItem.Type.Barcode;
                switch (cItemType[i].SelectedIndex)
                {
                case 0:
                    tType = GraphItem.Type.Barcode;
                    break;

                case 1:
                    tType = GraphItem.Type.Category;
                    break;

                case 2:
                    tType = GraphItem.Type.Staff;
                    break;
                }
                GraphItem.Parameter gParam = GraphItem.Parameter.Gross;
                switch (cItemProperty[i].SelectedIndex)
                {
                case 0:
                    gParam = GraphItem.Parameter.Gross;
                    break;

                case 1:
                    gParam = GraphItem.Parameter.Net;
                    break;

                case 2:
                    gParam = GraphItem.Parameter.QuantitySold;
                    break;

                case 3:
                    gParam = GraphItem.Parameter.Profit;
                    break;
                }
                string sFieldDesc = "";

                if (tbItemParam[i].Text == "")
                {
                    MessageBox.Show("No item entered in box " + (i + 1).ToString());
                    return;
                }

                if (tType == GraphItem.Type.Barcode)
                {
                    sFieldDesc = sEngine.GetMainStockInfo(tbItemParam[i].Text)[1];
                }
                else if (tType == GraphItem.Type.Category)
                {
                    sFieldDesc = sEngine.GetCategoryDesc(tbItemParam[i].Text);
                }
                gEngine.AddGraphItem(tType, btnItemClr[i].BackColor, tbItemParam[i].Text, gParam, sFieldDesc);
            }
            gEngine.Start(GenerateListOfFolders());

            SaveFileDialog sFile = new SaveFileDialog();

            sFile.Filter = "Bitmap File|*.bmp";
            if (sFile.ShowDialog() == DialogResult.OK)
            {
                System.IO.File.Copy("graph.bmp", sFile.FileName, true);
            }

            this.Close();
        }
Example #11
0
 public ResolutionChangeEventArgs(Resolutions resolution)
 {
     Resolution = resolution;
 }
Example #12
0
 public Ddc1SpectrumViewModel(RadioViewModel radioViewModel, Arction.ISpectrumAnalyzer spectrumAnalyzer)
     : base(radioViewModel, spectrumAnalyzer)
 {
     SelectedResolution = Resolutions.ToArray <ResolutionBandwidth>()[4];
 }
Example #13
0
        public void InitializeOptions(bool DefaultClick)
        {
            using (IniFile iniFile = new IniFile())
            {
                if (!DefaultClick)
                {
                    /// <switch>current profile</switch>
                    iniFile.IniPath = Application.StartupPath + @"\locations.ini";
                    iniFile.IniPath = Application.StartupPath + iniFile.ReadValue("PROFILES", "0");
                }
                else
                {
                    /// <switch>default profile</switch>
                    iniFile.IniPath = Application.StartupPath + @"\Resources\profile.resource";
                }

                #region General

                #region Run the Texture Max Load Editor when FSX starts

                switch (iniFile.ReadValue("OPTIONS.GENERAL", "runfsx"))
                {
                    case "1":
                        optionsGeneral0.Checked = true;
                        break;
                    case "0":
                        optionsGeneral0.Checked = false;
                        break;
                }

                #endregion

                #region Run the Texture Max Load Editor when you log onto this user account

                switch (iniFile.ReadValue("OPTIONS.GENERAL", "runwin"))
                {
                    case "1":
                        optionsGeneral1.Checked = true;
                        break;
                    case "0":
                        optionsGeneral1.Checked = false;
                        break;
                }

                #endregion

                #region Start this application minimized:

                switch (iniFile.ReadValue("OPTIONS.GENERAL", "minimize"))
                {
                    case "1":
                        optionsGeneral2.Checked = true;
                        optionsGeneral30.Enabled = true;
                        optionsGeneral31.Enabled = true;
                        break;
                    case "0":
                        optionsGeneral2.Checked = false;
                        optionsGeneral30.Enabled = false;
                        optionsGeneral31.Enabled = false;
                        break;
                }

                #endregion

                #region When started with FSX || Always

                switch (iniFile.ReadValue("OPTIONS.GENERAL", "sub"))
                {
                    case "1":
                        optionsGeneral31.Checked = true;
                        break;
                    case "0":
                        optionsGeneral30.Checked = true;
                        break;
                }

                #endregion

                #endregion

                #region Auto Change

                #region Enable auto-change

                switch (iniFile.ReadValue("OPTIONS.AUTO", "auto"))
                {
                    case "1":
                        optionsAuto0.Checked = true;
                        optionsAuto2.Enabled = true;
                        optionsAuto2Remove.Enabled = true;
                        optionsAuto2L.Enabled = true;
                        optionsAuto3.Enabled = true;
                        optionsAuto1.Enabled = true;
                        optionsAuto1L.Enabled = true;
                        break;
                    case "0":
                        optionsAuto0.Checked = false;
                        optionsAuto2.Enabled = false;
                        optionsAuto2Remove.Enabled = false;
                        optionsAuto2L.Enabled = false;
                        optionsAuto3.Enabled = false;
                        optionsAuto1.Enabled = false;
                        optionsAuto1L.Enabled = false;
                        break;
                }

                #endregion

                #region Set the dropdown items

                using (Resolutions resolutions = new Resolutions())
                {
                    // Fill the drop down box
                    resolutions.FillField(optionsAuto1, null);

                    if (iniFile.ReadValue("OPTIONS.AUTO", "resolution") == "")
                    {
                        // Select the current resolution in fsx.cfg
                        resolutions.SelectCurrentResolution(optionsAuto1, currentTmlValue);
                    }
                    else
                    {
                        // Select the chosen resolution
                        optionsAuto1.SelectedIndex = optionsAuto1.FindString(iniFile.ReadValue("OPTIONS.AUTO", "resolution"), 0);
                    }
                }

                #endregion

                #region Application to run after change

                optionsAuto2.Text = iniFile.ReadValue("OPTIONS.AUTO", "application");

                #endregion

                #region Close this application after changes have been made

                switch (iniFile.ReadValue("OPTIONS.AUTO", "close"))
                {
                    case "1":
                        optionsAuto3.Checked = true;
                        break;
                    case "0":
                        optionsAuto3.Checked = false;
                        break;
                }

                #endregion

                #endregion

                #region Resolutions

                using (Resolutions resolutions = new Resolutions())
                {
                    // Fill the List Box with resolutions
                    resolutions.FillField(null, optionsResolutionR);
                }

                // Disable the function buttons
                optionsResolutionEdit.Enabled = false;
                optionsResolutionAdd.Enabled = false;
                optionsResolutionRemove.Enabled = false;

                #endregion
            }
        }
Example #14
0
    // Use this for initialization
    void Start()
    {
        self = this;
        resolutions = Screen.resolutions;
        isFullScreen = Screen.fullScreen;
        buttons = new GameObject[resolutions.Length];

        CreateButtons();
        PositionButtons();
    }
Example #15
0
 private ResolutionEntry GetPreferredResolution()
 {
     return(Resolutions.ApartFrom(CustomResolution).MaxEntry(x => x.Volume));
 }
    public void OnGUI()
    {
        changed = false;
        if (focusedMat != null)
        {
            XSStyles.ShurikenHeader("Current Material: " + focusedMat.name);
        }
        else
        {
            XSStyles.ShurikenHeader("Current Material: None");
        }

        if (preButton == null)
        {
            iconToolbarPlus  = EditorGUIUtility.IconContent("Toolbar Plus", "Add Gradient");
            iconToolbarMinus = EditorGUIUtility.IconContent("Toolbar Minus", "Remove Gradient");
            preButton        = new GUIStyle("RL FooterButton");
            buttonBackground = new GUIStyle("RL Header");
        }

        if (gradients.Count == 0)
        {
            gradients.Add(new Gradient());
            gradients.Add(new Gradient());
            gradients.Add(new Gradient());
            gradients.Add(new Gradient());
            gradients.Add(new Gradient());
        }

        if (grad_index_reorderable == null)
        {
            makeReorderedList();
        }

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        Rect  r         = EditorGUILayout.GetControlRect();
        float rightEdge = r.xMax;
        float leftEdge  = rightEdge - 48f;

        r = new Rect(leftEdge, r.y, rightEdge - leftEdge, r.height);
        if (Event.current.type == EventType.Repaint)
        {
            buttonBackground.Draw(r, false, false, false, false);
        }
        leftEdge += 18f;
        EditorGUI.BeginDisabledGroup(gradients_index.Count == 5);
        bool addE = GUI.Button(new Rect(leftEdge + 4, r.y, 25, 13), iconToolbarPlus, preButton);

        EditorGUI.EndDisabledGroup();
        EditorGUI.BeginDisabledGroup(gradients_index.Count == 1);
        bool removeE = GUI.Button(new Rect(leftEdge - 19, r.y, 25, 13), iconToolbarMinus, preButton);

        EditorGUI.EndDisabledGroup();

        if (addE)
        {
            grad_index_reorderable.index++;
            int wat = 0;
            for (int i = 0; i < 5; i++)
            {
                if (!gradients_index.Contains(i))
                {
                    wat = i;
                    break;
                }
            }
            gradients_index.Add(wat);
            changed = true;
        }
        if (removeE)
        {
            gradients_index.Remove(gradients_index[gradients_index.Count - 1]);
            grad_index_reorderable.index--;
            changed = true;
        }

        GUIStyle button = new GUIStyle(EditorStyles.miniButton);

        button.normal = !reorder ? EditorStyles.miniButton.normal : EditorStyles.miniButton.onNormal;
        if (GUILayout.Button(new GUIContent("Reorder", "Don't use Reorder if you want to undo a gradient change"), button, GUILayout.ExpandWidth(false)))
        {
            reorder = !reorder;
        }
        GUILayout.EndHorizontal();

        SerializedObject serializedObject = new SerializedObject(this);

        if (reorder)
        {
            grad_index_reorderable.DoLayoutList();
        }
        else
        {
            SerializedProperty colorGradients = serializedObject.FindProperty("gradients");
            if (colorGradients.arraySize == 5)
            {
                for (int i = 0; i < gradients_index.Count; i++)
                {
                    Rect _r = EditorGUILayout.GetControlRect();
                    _r.x      += 16f;
                    _r.width  -= 2f + 16f;
                    _r.height += 5f;
                    _r.y      += 2f + (3f * i);
                    EditorGUI.PropertyField(_r, colorGradients.GetArrayElementAtIndex(gradients_index[i]), new GUIContent(""));
                }
                GUILayout.Space(Mathf.Lerp(9f, 24f, gradients_index.Count / 5f));
            }
        }
        if (serializedObject.ApplyModifiedProperties())
        {
            changed = true;
        }

        if (oldFocusedMat != focusedMat)
        {
            changed = true;
            if (this.oldTexture != null)
            {
                if (this.oldTexture == EditorGUIUtility.whiteTexture)
                {
                    this.oldTexture = null;
                }
                oldFocusedMat.SetTexture(rampProperty, this.oldTexture);
                this.oldTexture = null;
            }
            oldFocusedMat = focusedMat;
        }

        Resolutions oldRes = res;

        res = (Resolutions)EditorGUILayout.EnumPopup("Resolution: ", res);
        if (oldRes != res)
        {
            changed = true;
        }

        int width  = (int)res;
        int height = 30;

        if (gradients_index.Count == 1)
        {
            height = 8;
        }
        else
        {
            height = 150;
        }
        if (tex == null)
        {
            tex = new Texture2D(width, height, TextureFormat.RGBA32, false);
        }

        bool old_isLinear = isLinear;

        drawAdvancedOptions();
        if (old_isLinear != isLinear)
        {
            changed = true;
        }

        if (manualMaterial)
        {
            focusedMat = (Material)EditorGUILayout.ObjectField(new GUIContent("", ""), focusedMat, typeof(Material), true);
        }

        if (focusedMat != null)
        {
            if (focusedMat.HasProperty("_Ramp"))
            {
                rampProperty = "_Ramp";
            }
            else
            {
                rampProperty = EditorGUILayout.TextField("Ramp Property Name", rampProperty);
                if (!focusedMat.HasProperty(rampProperty))
                {
                    GUILayout.Label("Property not found!");
                }
            }
        }

        if (changed)
        {
            updateTexture(width, height);
            if (focusedMat != null)
            {
                if (focusedMat.HasProperty(rampProperty))
                {
                    if (this.oldTexture == null)
                    {
                        if (focusedMat.GetTexture(rampProperty) == null)
                        {
                            this.oldTexture = EditorGUIUtility.whiteTexture;
                        }
                        else
                        {
                            this.oldTexture = focusedMat.GetTexture(rampProperty);
                        }
                    }
                    tex.wrapMode = TextureWrapMode.Clamp;
                    tex.Apply(false, false);
                    focusedMat.SetTexture(rampProperty, tex);
                }
            }
        }

        XSStyles.Separator();
        drawMGInputOutput();


        if (GUILayout.Button("Save Ramp"))
        {
            finalFilePath = XSStyles.findAssetPath(finalFilePath);
            string path = EditorUtility.SaveFilePanel("Save Ramp as PNG", finalFilePath + "/Textures/Shadow Ramps/Generated", "gradient", "png");
            if (path.Length != 0)
            {
                updateTexture(width, height);
                bool success = GenTexture(tex, path);
                if (success)
                {
                    if (focusedMat != null)
                    {
                        string  s    = path.Substring(path.IndexOf("Assets"));
                        Texture ramp = AssetDatabase.LoadAssetAtPath <Texture>(s);
                        if (ramp != null)
                        {
                            focusedMat.SetTexture(rampProperty, ramp);
                            this.oldTexture = null;
                        }
                    }
                }
            }
        }
        drawHelpText();
    }
Example #17
0
 private ResolutionEntry GetClosestToCustom()
 {
     return(Resolutions.FirstOrDefault(
                x => x.Width == CustomResolution.Width && x.Height == CustomResolution.Height && Equals(x.Framerate, CustomResolution.Framerate)) ??
            Resolutions.FirstOrDefault(x => x.Width == CustomResolution.Width && x.Height == CustomResolution.Height) ?? GetPreferredResolution());
 }
Example #18
0
 /* ----------------------------------------------------------------- */
 ///
 /// ResolutionValue
 /// 
 /// <summary>
 /// Resolutions 列挙型の各値に対応する実際の数値を取得します。
 /// </summary>
 ///
 /* ----------------------------------------------------------------- */
 public static int ResolutionValue(Resolutions id)
 {
     switch (id) {
     case Resolutions.Resolution72:  return 72;
     case Resolutions.Resolution150: return 150;
     case Resolutions.Resolution300: return 300;
     case Resolutions.Resolution450: return 450;
     case Resolutions.Resolution600: return 600;
     default: break;
     }
     return 300;
 }
Example #19
0
        protected override void LoadFromIni()
        {
            // VIDEO
            var section = Ini["VIDEO"];

            Fullscreen = section.GetBool("FULLSCREEN", true);
            UpdateResolutionsList();

            CustomResolution.Width     = section.GetInt("WIDTH", 0);
            CustomResolution.Height    = section.GetInt("HEIGHT", 0);
            CustomResolution.Framerate = section.GetInt("REFRESH", 0);

            var resolution = Resolutions.GetByIdOrDefault(section.GetInt("INDEX", 0)) ??
                             Resolutions.FirstOrDefault(x => x.Same(CustomResolution)) ?? CustomResolution;

            if (Fullscreen && ReferenceEquals(resolution, CustomResolution) && SettingsHolder.Common.FixResolutionAutomatically)
            {
                Resolution = GetClosestToCustom();
                if (!ReferenceEquals(CustomResolution, Resolution))
                {
                    ForceSave();
                    Logging.Debug($"RESOLUTION ({CustomResolution.DisplayName}) IS INVALID, CHANGED TO ({Resolution?.DisplayName})");
                }
            }
            else
            {
                Resolution = resolution;
            }

            VerticalSyncronization = section.GetBool("VSYNC", false);
            AntiAliasingLevel      = section.GetEntry("AASAMPLES", AntiAliasingLevels);
            AnisotropicLevel       = section.GetEntry("ANISOTROPIC", AnisotropicLevels, "8");
            ShadowMapSize          = section.GetEntry("SHADOW_MAP_SIZE", ShadowMapSizes, "2048");

            var limit = section.GetDouble("FPS_CAP_MS", 0);

            FramerateLimitEnabled = Math.Abs(limit) >= 0.1;
            FramerateLimit        = FramerateLimitEnabled ? (int)Math.Round(1e3 / limit) : 60;

            CameraMode = Ini["CAMERA"].GetEntry("MODE", CameraModes);

            // ASSETTOCORSA
            section           = Ini["ASSETTOCORSA"];
            HideArms          = section.GetBool("HIDE_ARMS", false);
            HideSteeringWheel = section.GetBool("HIDE_STEER", false);
            LockSteeringWheel = section.GetBool("LOCK_STEER", false);
            WorldDetail       = section.GetEntry("WORLD_DETAIL", WorldDetailLevels, "4");

            MotionBlur     = Ini["EFFECTS"].GetInt("MOTION_BLUR", 6);
            SmokeInMirrors = Ini["EFFECTS"].GetBool("RENDER_SMOKE_IN_MIRROR", false);
            SmokeLevel     = Ini["EFFECTS"].GetEntry("SMOKE", SmokeLevels, "2");

            // POST_PROCESS
            section               = Ini["POST_PROCESS"];
            PostProcessing        = section.GetBool("ENABLED", true);
            PostProcessingQuality = section.GetEntry("QUALITY", PostProcessingQualities, "4");
            PostProcessingFilter  = section.GetNonEmpty("FILTER", "default");
            GlareQuality          = section.GetEntry("GLARE", GlareQualities, "4");
            DepthOfFieldQuality   = section.GetEntry("DOF", DepthOfFieldQualities, "4");
            RaysOfGod             = section.GetBool("RAYS_OF_GOD", true);
            HeatShimmering        = section.GetBool("HEAT_SHIMMER", true);
            Fxaa            = section.GetBool("FXAA", true);
            ColorSaturation = Ini["SATURATION"].GetInt("LEVEL", 100);

            MirrorHighQuality = Ini["MIRROR"].GetBool("HQ", false);
            MirrorResolution  = Ini["MIRROR"].GetEntry("SIZE", MirrorResolutions, "512");

            section           = Ini["CUBEMAP"];
            CubemapResolution = section.GetEntry("SIZE", CubemapResolutions, "1024");
            var orig = CubemapResolution.Value == @"0" && section.ContainsKey(@"__ORIG_FACES_PER_FRAME");

            CubemapRenderingFrequency = section.GetEntry(orig ? @"__ORIG_FACES_PER_FRAME" : @"FACES_PER_FRAME", CubemapRenderingFrequencies, "3");
            CubemapDistance           = section.GetInt(orig ? @"__ORIG_FARPLANE" : @"FARPLANE", 600);
        }
Example #20
0
 public void UpdatePreferenceResolutionData(Resolutions resolution)
 {
     DataHelper.PreferenceData.Resolution = resolution;
     _backgroundThread.AddPreferenceRequest(DataHelper.PreferenceData.Copy());
 }
Example #21
0
        /// <summary>
        /// Form Constructor
        /// </summary>
        public Main()
        {
            InitializeComponent();
            Icon = global::TextureMaxLoadEditor.Properties.Resources.icon;

            #region Check for existing instanstance

            using (InitMain initialize = new InitMain())
            {
                if (!initialize.IsSingleInstance(Text))
                {
                    MessageBox.Show("Another instance of this application is already running.",
                        "Multiple application instances", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    requireExit = true;
                }
            }

            #endregion

            #region Check if FSX is running

            using (InitMain initialize = new InitMain())
            {
                if (initialize.IsProcessOpen("fsx"))
                {
                    fsxIsRunning = true;
                }
            }

            #endregion

            #region Integrity Checks

            #region Check File Existence and Hash

            using (Hash hash = new Hash())
            {
                if (File.Exists(Application.StartupPath + @"\Resources\core.resource"))
                {
                    if (hash.Match(Application.StartupPath + @"\Resources\core.resource", "DDAE1DD174117AC9ABADCBA70323590F77F67513"))
                    {
                        // Get the file lines one by one
                        string[] lines = File.ReadAllLines(Application.StartupPath + @"\Resources\core.resource");

                        for (int i = 0; i < lines.Length; i++)
                        {
                            // Split the line
                            string[] splitLine = lines[i].Split(';');

                            if (File.Exists(Application.StartupPath + splitLine[0]))
                            {
                                if (!hash.Match(Application.StartupPath + splitLine[0], splitLine[1]))
                                {
                                    // Show an error
                                    MessageBox.Show("The file " + splitLine[0] + " has been modified or is corrupt. Please reinstall the Texture Max Load Editor.",
                                        "Integrity Check", MessageBoxButtons.OK, MessageBoxIcon.Error);

                                    // Require an exit
                                    requireExit = true;
                                }
                            }
                            else
                            {
                                // Show an error
                                MessageBox.Show("The file " + splitLine[0] + " could not be found. Please reinstall the Texture Max Load Editor.",
                                    "Integrity Check", MessageBoxButtons.OK, MessageBoxIcon.Error);

                                // Require an exit
                                requireExit = true;
                            }
                        }
                    }
                    else
                    {
                        // Show an error
                        MessageBox.Show("The file core.resource has been modified or is corrupt. Please reinstall the Texture Max Load Editor.",
                            "Integrity Check", MessageBoxButtons.OK, MessageBoxIcon.Error);

                        // Require an exit
                        requireExit = true;
                    }
                }
                else
                {
                    // Show an error
                    MessageBox.Show("The file core.resource could not be found. Please reinstall the Texture Max Load Editor.",
                        "Integrity Check", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    // Require an exit
                    requireExit = true;
                }
            }

            #endregion

            #region Check INI Files

            using (IniFile iniFile = new IniFile())
            {
                /// <switch>current profile</switch>
                iniFile.IniPath = Application.StartupPath + @"\locations.ini";

                if (!File.Exists(Application.StartupPath + @"\locations.ini"))
                {
                    // Copy the locations resource
                    File.Copy(Application.StartupPath + @"\Resources\locations.resource",
                        Application.StartupPath + @"\locations.ini", false);
                }

                if (!File.Exists(Application.StartupPath + iniFile.ReadValue("PROFILES", "0")))
                {
                    try
                    {
                        if (!Directory.Exists(Application.StartupPath + @"\Profiles\"))
                        {
                            Directory.CreateDirectory(Application.StartupPath + @"\Profiles\");
                        }

                        if (!File.Exists(Application.StartupPath + @"\Profiles\default.ini"))
                        {
                            // Copy the resource
                            File.Copy(Application.StartupPath + @"\Resources\profile.resource",
                                Application.StartupPath + @"\Profiles\default.ini", false);
                        }

                        // Write the new path value
                        iniFile.WriteValue("PROFILES", "0", @"\Profiles\default.ini");

                        // Success message
                        MessageBox.Show("The default profile specified in 'locations.ini' could not be found. A new one has been automatically generated.",
                            "Integrity Check", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    catch
                    {
                        // Error message
                        MessageBox.Show("The default profile specified in 'locations.ini' could not be found and a new profile could not be generated. Please reinstall the Texture Max Load Editor.",
                            "Integrity Check", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }

            #endregion

            #region Check INI Variables

            using (IniFile iniFile = new IniFile())
            {
                using (Existence existence = new Existence())
                {
                    /// <switch>current profile</switch>
                    iniFile.IniPath = Application.StartupPath + @"\locations.ini";

                    if (!Directory.Exists(iniFile.ReadValue("LOCATIONS", "exe")) &&
                        !Directory.Exists(iniFile.ReadValue("LOCATIONS", "cfg")) &&
                        !Directory.Exists(iniFile.ReadValue("LOCATIONS", "self")))
                    {
                        // Require a locations reset
                        iniFile.WriteValue("GENERAL", "reset", "1");
                    }
                }
            }

            #endregion

            #endregion

            #region Check For Reset Switch

            using (IniFile iniFile = new IniFile())
            {
                /// <switch>locations.ini</switch>
                iniFile.IniPath = Application.StartupPath + @"\locations.ini";

                if (iniFile.ReadValue("GENERAL", "reset") == "1")
                {
                    using (Locations.FSX fsxLocations = new Locations.FSX())
                    {
                        // Reset the location variables
                        iniFile.WriteValue("LOCATIONS", "exe", fsxLocations.GetExe());
                        iniFile.WriteValue("LOCATIONS", "cfg", fsxLocations.GetCfg());
                        iniFile.WriteValue("LOCATIONS", "self", Application.StartupPath);
                    }

                    try
                    {
                        if (File.Exists(iniFile.ReadValue("LOCATIONS", "cfg") + @"\exe.xml"))
                        {
                            string dateTime = DateTime.Now.ToString();
                            dateTime = dateTime.Replace("/", "");
                            dateTime = dateTime.Replace(" ", "_");
                            dateTime = dateTime.Replace(":", "");

                            if (!Directory.Exists(Application.StartupPath + @"\Backups\"))
                            {
                                Directory.CreateDirectory(Application.StartupPath + @"\Backups\");
                            }

                            // Make a copy of exe.xml
                            File.Copy(iniFile.ReadValue("LOCATIONS", "cfg") + @"\exe.xml", Application.StartupPath + @"\Backups\exe_xml_backup_" + dateTime + ".bak");
                        }
                    }
                    catch
                    {
                        // Show an error
                        MessageBox.Show("Unable to make a copy of exe.xml. The file has not been backed up.",
                            "Unable to backup exe.xml", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    // Set the reset value back to 0
                    iniFile.WriteValue("GENERAL", "reset", "0");
                }
            }

            #endregion

            #region Set Main Resolutions

            using (Resolutions resolutions = new Resolutions())
            {
                // Set the resolution list items
                resolutions.FillField(homeResolution, null);
            }

            #endregion

            #region Set Location Fields

            using (IniFile iniFile = new IniFile())
            {
                /// <switch>locations.ini</switch>
                iniFile.IniPath = Application.StartupPath + @"\locations.ini";

                // Set the location fields
                homeExePath.Text = iniFile.ReadValue("LOCATIONS", "exe");
                homeCfgPath.Text = iniFile.ReadValue("LOCATIONS", "cfg");
            }

            #endregion

            #region Switch Main Resolution To Current

            using (Resolutions resolutions = new Resolutions())
            {
                // Select the current resolution in fsx.cfg
                resolutions.SelectCurrentResolution(homeResolution, null);

                // Set the current value
                string[] selectedItem = homeResolution.SelectedItem.ToString().Split(' ');
                currentValue = selectedItem[0];
                selectedItem = null;
            }

            #endregion

            #region Check for exe.xml existence and entry

            using (IniFile iniFile = new IniFile())
            {
                ///<switch>locations.ini</switch>
                iniFile.IniPath = Application.StartupPath + @"\locations.ini";

                using (ExeXML exeXml = new ExeXML(iniFile.ReadValue("LOCATIONS", "cfg") + @"\exe.xml"))
                {
                    ///<switch>current profile</switch>
                    iniFile.IniPath = Application.StartupPath + iniFile.ReadValue("PROFILES", "0");

                    if (iniFile.ReadValue("OPTIONS.GENERAL", "runfsx") == "1")
                    {
                        // Check the existence of the document
                        exeXml.CheckExistence("Texture Max Load Editor", false, Application.ExecutablePath);
                    }
                    else
                    {
                        // Check the existence of the document
                        exeXml.CheckExistence("Texture Max Load Editor", true, Application.ExecutablePath);
                    }
                }
            }

            #endregion

            #region Minimize the Form

            using (IniFile iniFile = new IniFile())
            {
                /// <switch>current profile</switch>
                iniFile.IniPath = Application.StartupPath + @"\locations.ini";
                iniFile.IniPath = Application.StartupPath + iniFile.ReadValue("PROFILES", "0");

                if (iniFile.ReadValue("OPTIONS.GENERAL", "minimize") == "1")
                {
                    if (iniFile.ReadValue("OPTIONS.GENERAL", "sub") == "0")
                    {
                        if (fsxIsRunning)
                            this.WindowState = FormWindowState.Minimized;
                    }
                    else
                        this.WindowState = FormWindowState.Minimized;
                }
            }

            #endregion

            #region Auto Change

            using (IniFile iniFile = new IniFile())
            {
                /// <switch>current profile</switch>
                iniFile.IniPath = Application.StartupPath + @"\locations.ini";
                iniFile.IniPath = Application.StartupPath + iniFile.ReadValue("PROFILES", "0");

                if (iniFile.ReadValue("OPTIONS.AUTO", "auto") == "1")
                {
                    // Get the auto resolution
                    string autoResolution = iniFile.ReadValue("OPTIONS.AUTO", "resolution");

                    if (autoResolution != "")
                    {
                        /// <switch>fsx.cfg</switch>
                        iniFile.IniPath = Application.StartupPath + @"\locations.ini";
                        iniFile.IniPath = iniFile.ReadValue("LOCATIONS", "cfg") + @"\fsx.cfg";

                        // Set the Texture Max Load Value in fsx.cfg
                        iniFile.WriteValue("GRAPHICS", "TEXTURE_MAX_LOAD", autoResolution);

                        /// <switch>current profile</switch>
                        iniFile.IniPath = Application.StartupPath + @"\locations.ini";
                        iniFile.IniPath = Application.StartupPath + iniFile.ReadValue("PROFILES", "0");
                    }
                    else
                    {
                        // Show an error informing the user that the TML value has not been set
                        MessageBox.Show("Unable to set a null resolution. The Texture Max Load value has not been changed in fsx.cfg.",
                            "Null resolution", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    if (iniFile.ReadValue("OPTIONS.AUTO", "application") != "")
                    {
                        try
                        {
                            // Try to start the specified process
                            System.Diagnostics.Process.Start(iniFile.ReadValue("OPTIONS.AUTO", "application"));
                        }
                        catch
                        {
                            // Show an error informing the user that their application could not be started
                            MessageBox.Show("Unable to run the post auto change application you specified.",
                                "External process error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }

                    if (iniFile.ReadValue("OPTIONS.AUTO", "close") == "1")
                    {
                        // Set the seconds for the timer
                        autoSeconds = Int32.Parse(iniFile.ReadValue("MISCELLANEOUS", "autotime"));

                        // Require an exit
                        autoCounter = 0;
                        autoChangeExit = true;
                    }
                    else
                    {
                        // Make the auto counter negative
                        autoCounter = -1;
                    }
                }
            }

            #endregion
        }
Example #22
0
 public void AddResolution(object attachment)
 {
     Resolutions.Add((ResolutionAttachment)attachment);
 }
Example #23
0
        /// <summary>
        /// Opens the options window
        /// </summary>
        private void homeOptionsButton_ButtonClick()
        {
            // Create a new optionsBox object
            Options optionsBox = new Options(currentValue);

            // Null the form owner (.Net 1.1 -> 2.0 workaround)
            Form formOwner = this.Owner;
            this.Owner = null;

            // Show the options box
            optionsBox.ShowDialog();

            // Reset the form owner
            this.Owner = formOwner;

            using (Resolutions resolutions = new Resolutions())
            {
                // Set the resolution list items
                resolutions.FillField(homeResolution, null);
            }

            using (Resolutions resolutions = new Resolutions())
            {
                // Select the current resolution in fsx.cfg
                resolutions.SelectCurrentResolution(homeResolution, null);
            }
        }
Example #24
0
 public Video(string name, Resolutions resolution)
     : base(name)
 {
     _resolution = resolution;
 }
Example #25
0
        static void Main(string[] args)
        {
            Console.WriteLine("This a list of your New Year Resolutions.");
            Console.WriteLine("Insert your resolutions separated by a comma and a space (, ).");
            string userinput = Console.ReadLine();

            string[]      Resolutions       = userinput.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
            List <string> listOfResolutions = Resolutions.ToList();

Start:
            string filePath = @"Users\andrisuga\Desktop\FailidVS\NewYearRes.txt";

            File.WriteAllLines(filePath, listOfResolutions);
            List <Resolutions> listOfDescriptions = new List <Resolutions>();

            foreach (string line in listOfResolutions)
            {
                Resolutions newRes = new Resolutions(line);
                listOfDescriptions.Add(newRes);
                File.WriteAllLines(filePath, listOfResolutions);
            }


            int i = 1;

            foreach (Resolutions resolutions in listOfDescriptions)
            {
                Console.WriteLine($"Resolution {i} on your resolutions list is to {resolutions.description}");
                i++;
            }

            Console.WriteLine("ADD/REMOVE/EXIT.");
            string userAnswer = Console.ReadLine();

            if (userAnswer.ToLower() == "add")
            {
                Console.WriteLine("Enter a resolution to add: ");
                string newRes = Console.ReadLine();
                listOfResolutions.Add(newRes);

                Console.Clear();
                Console.WriteLine("A resolution was added.");
                goto Start;
            }
            else if (userAnswer.ToLower() == "remove")
            {
                Console.WriteLine("Enter a resolution to remove: ");
                string removeRes = Console.ReadLine();
                listOfResolutions.Remove(removeRes);

                Console.Clear();
                Console.WriteLine("A resolution was removed.");
                goto Start;
            }
            else
            {
                Console.Clear();
                int j = 1;

                foreach (Resolutions resolutions in listOfDescriptions)
                {
                    Console.WriteLine($"Resolution {j} on your resolutions list is to {resolutions.description}");
                    j++;
                }
            }
        }