예제 #1
0
 public NativeSelectionOptionData(NativeOptions.NativeOptionsType type)
     : base(type)
 {
     this._selectableOptionsLimit = NativeSelectionOptionData.GetOptionsLimit(type);
     this._selectableOptionNames  = NativeSelectionOptionData.GetOptionNames(type);
 }
예제 #2
0
 public IEnumerable <SelectionData> GetSelectableOptionNames() => NativeSelectionOptionData.GetOptionNames(this.Type);
예제 #3
0
        private static IEnumerable <SelectionData> GetOptionNames(
            NativeOptions.NativeOptionsType type)
        {
            int i1;
            int i2;

            switch (type)
            {
            case NativeOptions.NativeOptionsType.SoundDevice:
                for (i1 = 0; i1 < NativeOptions.GetSoundDeviceCount(); ++i1)
                {
                    string soundDeviceName = NativeOptions.GetSoundDeviceName(i1);
                    if (soundDeviceName != "")
                    {
                        yield return(new SelectionData(false, soundDeviceName));
                    }
                }
                break;

            case NativeOptions.NativeOptionsType.SelectedMonitor:
                for (i1 = 0; i1 < NativeOptions.GetMonitorDeviceCount(); ++i1)
                {
                    yield return(new SelectionData(false, NativeOptions.GetMonitorDeviceName(i1)));
                }
                break;

            case NativeOptions.NativeOptionsType.SelectedAdapter:
                for (i1 = 0; i1 < NativeOptions.GetVideoDeviceCount(); ++i1)
                {
                    yield return(new SelectionData(false, NativeOptions.GetVideoDeviceName(i1)));
                }
                break;

            case NativeOptions.NativeOptionsType.ScreenResolution:
                for (i2 = 0; i2 < NativeOptions.GetResolutionCount(); ++i2)
                {
                    Vec2 resolutionAtIndex = NativeOptions.GetResolutionAtIndex(i2);
                    yield return(new SelectionData(false, string.Format("{0}x{1} ({2})", (object)resolutionAtIndex.x, (object)resolutionAtIndex.y, (object)NativeSelectionOptionData.GetAspectRatioOfResolution((int)resolutionAtIndex.x, (int)resolutionAtIndex.y))));
                }
                int width   = 0;
                int height1 = 0;
                i1 = 0;
                int height2 = 0;
                NativeOptions.GetDesktopResolution(ref width, ref height1);
                NativeOptions.GetResolution(ref i1, ref height2);
                if (NativeOptions.GetDLSSTechnique() != 4 || width >= 3840)
                {
                    yield return(new SelectionData(true, "str_options_type_ScreenResolution_Desktop"));
                }
                if (NativeOptions.GetDLSSTechnique() == 4 && i1 < 3840)
                {
                    break;
                }
                yield return(new SelectionData(true, "str_options_type_ScreenResolution_Custom"));

                break;

            case NativeOptions.NativeOptionsType.RefreshRate:
                for (i1 = 0; i1 < NativeOptions.GetRefreshRateCount(); ++i1)
                {
                    yield return(new SelectionData(false, NativeOptions.GetRefreshRateAtIndex(i1).ToString() + " Hz"));
                }
                break;

            default:
                i1 = NativeSelectionOptionData.GetOptionsLimit(type);
                string typeName = type.ToString();
                for (i2 = 0; i2 < i1; ++i2)
                {
                    yield return(new SelectionData(true, "str_options_type_" + typeName + "_" + i2.ToString()));
                }
                typeName = (string)null;
                break;
            }
        }