public void Identical_major_minor_versions_are_equal()
        {
            var wv1 = new WindowsVersion(5, 2);
            var wv2 = new WindowsVersion(5, 2);

            wv1.ShouldBe(wv2);
            (wv1 == wv2).ShouldBeTrue();
        }
        public void Different_major_minor_versions_are_unequal()
        {
            var wv1 = new WindowsVersion(5, 0);
            var wv2 = new WindowsVersion(5, 2);

            wv1.ShouldNotBe(wv2);
            (wv1 != wv2).ShouldBeTrue();
        }
        public void Identical_major_minor_and_product_flags_are_equal()
        {
            var wv1 = new WindowsVersion(5, 2, 3);
            var wv2 = new WindowsVersion(5, 2, 3);

            wv1.ShouldBe(wv2);
            (wv1 == wv2).ShouldBeTrue();
        }
        public void Uneven_product_flags_are_unequal()
        {
            var wv1 = new WindowsVersion(5, 0);
            var wv2 = new WindowsVersion(5, 2, 5);

            wv1.ShouldNotBe(wv2);
            (wv1 != wv2).ShouldBeTrue();
        }
예제 #5
0
        public void Renders(string placement)
        {
            if (WindowsVersion.CurrentContains("Server"))
            {
                Assert.Inconclusive("For some reason one pixel off here. Don't have the energy to chase it now.");
            }

            using var app = Application.AttachOrLaunch("Gu.Wpf.Geometry.Demo.exe", WindowName);
            var window = app.MainWindow;

            _ = window.FindListBox("Placements").Select(placement);
            var groupBox = window.FindGroupBox("Render");

            ImageAssert.AreEqual($"Images\\BoxBalloonWindow\\{TestImage.Current}\\{placement}.png", groupBox, TestImage.OnFail);
        }
예제 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="volume"></param>
        /// <returns></returns>
        public static string[] GetInstances(string volume)
        {
            Helper.getVolumeName(ref volume);

            WindowsVersion version = WindowsVersion.Get(volume);

            if (version.CurrentVersion.CompareTo(new Version("6.1")) == 0)
            {
                return(GetInstancesByPath(Helper.GetVolumeLetter(volume) + @"\Windows\AppCompat\Programs\RecentFileCache.bcf"));
            }
            else
            {
                throw new Exception("The RecentFileCache.bcf file is only available on Windows 7 Operating Systems.");
            }
        }
예제 #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="volume"></param>
        /// <returns></returns>
        public static Amcache[] GetInstances(string volume)
        {
            Helper.getVolumeName(ref volume);

            WindowsVersion version = WindowsVersion.Get(volume);

            if (version.CurrentVersion.CompareTo(new Version("6.2")) >= 0)
            {
                return(GetInstancesByPath(Helper.GetVolumeLetter(volume) + @"\Windows\AppCompat\Programs\Amcache.hve"));
            }
            else
            {
                throw new Exception("The Amcache hive is only available on Windows 8 and newer Operating Systems.");
            }
        }
예제 #8
0
        internal InjectionWrapper(InjectionMethod injectionMethod, string processName, byte[] dllBytes)
        {
            RemoteProcess = new ProcessWrapper(processName, WindowsVersion);

            Assembler = new Assembler(RemoteProcess.IsWow64);

            DllBytes = dllBytes;

            InjectionMethod = injectionMethod;

            MemoryManager = new MemoryManager(RemoteProcess.Process.SafeHandle);

            PeParser = new PeParser(dllBytes);

            WindowsVersion = GetWindowsVersion();
        }
예제 #9
0
        private static Application StartApplication()
        {
            if (WindowsVersion.IsWindows10())
            {
                // Use the store application on those systems
                return(Application.LaunchStoreApp("Microsoft.WindowsCalculator_8wekyb3d8bbwe!App"));
            }

            if (WindowsVersion.IsWindowsServer2016())
            {
                // The calc.exe on this system is just a stub which launches win32calc.exe
                return(Application.Launch("win32calc.exe"));
            }

            return(Application.Launch("calc.exe"));
        }
예제 #10
0
        private void Reflesh()
        {
            WindowsVersionLabel.Content = string.Format(@"版本:{0}", WindowsVersion.GetOSCompleteVersion());
            //Windows Update
            if (!_isWin10 && !Reg.Exist(Win10UpdateKey, WinUpdateValue))
            {
                ChooseUpdateBox.SelectedIndex = 0;
            }
            else
            {
                var type = Convert.ToInt32(Reg.Read(Win10UpdateKey, WinUpdateValue));                //如果键值不存在 type==0
                if (type <= 4 && type >= 1)
                {
                    ChooseUpdateBox.SelectedIndex = type - 1;
                }

                /*else
                 * {
                 *      ChooseUpdateBox.IsEnabled = false;
                 * }*/
            }
            //Auto Install Updates
            AutoInstallUpdates_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(Win10UpdateKey, AutoInstallUpdatesValue)) == 1;
            //No Auto Reboot
            NoAutoReboot_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(Win10UpdateKey, NoAutoRebootValue)) == 1;
            //Disable OneDrive
            DisableOneDrive_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(DisableOneDriveKey, DisableOneDriveValue)) == 1;
            //Allow Cortana
            DisableCortana_CheckBox.IsChecked = Reg.Exist(DisableCortanaKey, AllowCortanaValue) && Convert.ToInt32(Reg.Read(DisableCortanaKey, AllowCortanaValue)) == 0;
            //Disable Windows Defender
            DisableWindowsDefender_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(DisableWindowsDefenderKey, DisableWindowsDefenderValue)) == 1;
            //Disable Custom Folder
            DisableCustomFolder_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(DisableCustomFolderKey, DisableCustomFolderValue)) == 1;
            //Exclude Drivers
            if (WindowsVersion.GetOSCompleteVersion() >= Version.Parse(@"10.0.14328.1000"))
            {
                ExcludeWUDrivers_CheckBox.IsEnabled = true;
                ExcludeWUDrivers_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(ExcludeWUDriversKey, ExcludeWUDriversValue)) == 1;
            }
            else
            {
                ExcludeWUDrivers_CheckBox.IsEnabled = false;
                ExcludeWUDrivers_CheckBox.IsChecked = false;
            }
            //Exclude MRT
            ExcludeMRT_CheckBox.IsChecked = Convert.ToInt32(Reg.Read(ExcludeMRTKey, ExcludeMRTValue)) == 1;
        }
예제 #11
0
        public void CalculatorTest()
        {
            if (WindowsVersion.IsAppVeyor() ||
                WindowsVersion.IsAzureDevops())
            {
                Assert.Inconclusive("Bug in store calc.");
            }

            using var app = StartApplication();

            // Looks like it can take a long time on CI
            app.WaitForMainWindow(TimeSpan.FromSeconds(30));
            var window = app.MainWindow;
            var calc   = WindowsVersion.IsWindows10()
                ? (ICalculator) new Win10Calc(window)
                : new LegacyCalc(window);

            Wait.For(TimeSpan.FromMilliseconds(200));

            // Switch to default mode
            Keyboard.TypeSimultaneously(Key.ALT, Key.KEY_1);
            window.WaitUntilResponsive();

            // Simple addition
            calc.Button1.Click();
            calc.Button2.Click();
            calc.Button3.Click();
            calc.Button4.Click();
            calc.ButtonAdd.Click();
            calc.Button5.Click();
            calc.Button6.Click();
            calc.Button7.Click();
            calc.Button8.Click();
            calc.ButtonEquals.Click();
            app.WaitWhileBusy();
            var result = calc.Result;

            Assert.AreEqual("6912", result);

            // Date comparison
            using (Keyboard.Hold(Key.CONTROL))
            {
                Keyboard.Type(Key.KEY_E);
            }
        }
예제 #12
0
        internal InjectionWrapper(InjectionMethod injectionMethod, int processId, string dllPath)
        {
            RemoteProcess = new ProcessWrapper(processId, WindowsVersion);

            Assembler = new Assembler(RemoteProcess.IsWow64);

            DllBytes = File.ReadAllBytes(dllPath);

            DllPath = dllPath;

            InjectionMethod = injectionMethod;

            MemoryManager = new MemoryManager(RemoteProcess.Process.SafeHandle);

            PeParser = new PeParser(dllPath);

            WindowsVersion = GetWindowsVersion();
        }
예제 #13
0
        internal ProcessWrapper(string processName, WindowsVersion windowsVersion)
        {
            Process = GetProcess(processName);

            IsWow64 = IsProcessWow64();

            Modules = new List <Module>();

            _assembler = new Assembler(IsWow64);

            _memoryManager = new MemoryManager(Process.SafeHandle);

            _windowsVersion = windowsVersion;

            EnableDebuggerPrivileges();

            Modules.AddRange(GetProcessModules());
        }
예제 #14
0
        internal static string GetOS()
        {
            string os = (string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", "ProductName", "");

            if (os.Contains("Windows 7"))
            {
                CurrentWindowsVersion = WindowsVersion.Windows7;
            }
            if ((os.Contains("Windows 8")) || (os.Contains("Windows 8.1")))
            {
                CurrentWindowsVersion = WindowsVersion.Windows8;
            }
            if (os.Contains("Windows 10"))
            {
                CurrentWindowsVersion = WindowsVersion.Windows10;
            }

            return(os);
        }
예제 #15
0
        private static string GetCurrent()
        {
            if (WindowsVersion.IsWindows7())
            {
                return("Win7");
            }

            if (WindowsVersion.IsWindows10())
            {
                return("Win10");
            }

            if (WindowsVersion.CurrentContains("Windows Server 2019"))
            {
                return("WinServer2019");
            }

            return(WindowsVersion.CurrentVersionProductName);
        }
예제 #16
0
        public void RenderBounds()
        {
            using var app = Application.AttachOrLaunch(ExeFileName, "SizeWindow");
            var window = app.MainWindow;
            var button = window.FindButton("SizeButton");

            window.MoveTo(100, 200);
            if (WindowsVersion.IsWindows7())
            {
                Assert.AreEqual(new System.Windows.Rect(150, 311, 200, 100), button.Bounds);
                Assert.AreEqual(new System.Windows.Rect(100, 200, 300, 300), window.Bounds);
                Assert.AreEqual(new System.Windows.Rect(50, 111, 200, 100), button.RenderBounds);
            }
            else
            {
                Assert.AreEqual(new System.Windows.Rect(150, 311, 200, 100), button.Bounds);
                Assert.AreEqual(new System.Windows.Rect(100, 200, 300, 300), window.Bounds);
                Assert.AreEqual(new System.Windows.Rect(50, 111, 200, 100), button.RenderBounds);
            }
        }
예제 #17
0
        public void Tap()
        {
            using var app = Application.AttachOrLaunch(ExeFileName, WindowName);
            var window = app.MainWindow;
            var area   = window.FindGroupBox("Touch area");
            var events = window.FindListBox("Events");

            Touch.Tap(area.Bounds.Center());
            var expected = WindowsVersion.IsWindows10()
                ? new[]
            {
                "TouchEnter Position: 250,300",
                "PreviewTouchDown Position: 250,300",
                "TouchDown Position: 250,300",
                "ManipulationStarting",
                "ManipulationStarted",
                "StylusSystemGesture SystemGesture: Tap",
                "PreviewTouchUp Position: 250,300",
                "TouchUp Position: 250,300",
                "ManipulationInertiaStarting",
                "ManipulationCompleted",
                "TouchLeave Position: 250,300",
            }
                : new[]
            {
                "TouchEnter Position: 249,299",
                "PreviewTouchDown Position: 249,299",
                "TouchDown Position: 249,299",
                "ManipulationStarting",
                "ManipulationStarted",
                "StylusSystemGesture SystemGesture: Tap",
                "PreviewTouchUp Position: 249,299",
                "TouchUp Position: 249,299",
                "ManipulationInertiaStarting",
                "ManipulationCompleted",
                "TouchLeave Position: 249,299",
            };

            Dump(events);
            CollectionAssert.AreEqual(expected, events.Items.Select(x => x.Text).ToArray(), EventStringComparer.Default);
        }
예제 #18
0
        private void AboutWindowSourceInitialized(object sender, EventArgs e)
        {
            System.Reflection.AssemblyName name = System.Reflection.Assembly.GetExecutingAssembly().GetName();
            string architecture = name.ProcessorArchitecture.ToString();
            string a            = null;

            switch (architecture)
            {
            case "Amd64": a = "64"; break;

            case "X86": a = "32"; break;
            }
            TextBlock1.Text = app.Language.Version + ": " + name.Version.ToString()
                              + Environment.NewLine + app.Language.Type + ": " + a + " " + app.Language.BitWidthApplication;
//
            TextBlock2.Text = app.Language.Runtime + ":"
                              + Environment.NewLine + "Common Language Runtime " + Environment.Version.ToString(2)
                              + Environment.NewLine
                              + Environment.NewLine + app.Language.OS + ":"
                              + Environment.NewLine + WindowsVersion.ToString();
        }
예제 #19
0
        static OSVersion()
        {
            System.Version version = Environment.OSVersion.Version;

            if (version.Major == 5 && version.Minor == 1)
                _windowsVersion = WindowsVersion.XP;
            else if (version.Major == 5 && version.Minor == 2)
                _windowsVersion = WindowsVersion.Server2003;
            else if (version.Major == 6 && version.Minor == 0)
                _windowsVersion = WindowsVersion.Vista;
            else if (version.Major == 6 && version.Minor == 1)
                _windowsVersion = WindowsVersion.Seven;
            else if ((version.Major == 6 && version.Minor > 1) || version.Major > 6)
                _windowsVersion = WindowsVersion.Unreleased;

            if (IsBelow(WindowsVersion.Vista))
            {
                _hasSetAccessToken = true;
            }

            if (IsAboveOrEqual(WindowsVersion.Vista))
            {
                _minProcessQueryInfoAccess = ProcessAccess.QueryLimitedInformation;
                _minThreadQueryInfoAccess = ThreadAccess.QueryLimitedInformation;
                _minThreadSetInfoAccess = ThreadAccess.SetLimitedInformation;

                _hasCycleTime = true;
                _hasProtectedProcesses = true;
                _hasPsSuspendResumeProcess = true;
                _hasQueryLimitedInformation = true;
                _hasTaskDialogs = true;
                _hasUac = true;
                _hasWin32ImageFileName = true;
            }

            if (IsAboveOrEqual(WindowsVersion.Seven))
            {
                _hasExtendedTaskbar = true;
            }
        }
예제 #20
0
        public void CalculatorTest()
        {
            using (var app = StartApplication())
            {
                var window = app.MainWindow;
                var calc   = WindowsVersion.IsWindows10()
                    ? (ICalculator) new Win10Calc(window)
                    : new LegacyCalc(window);
                if (WindowsVersion.IsWindows7())
                {
                    Wait.For(TimeSpan.FromMilliseconds(200));
                }

                // Switch to default mode
                Keyboard.TypeSimultaneously(Key.ALT, Key.KEY_1);
                window.WaitUntilResponsive();

                // Simple addition
                calc.Button1.Click();
                calc.Button2.Click();
                calc.Button3.Click();
                calc.Button4.Click();
                calc.ButtonAdd.Click();
                calc.Button5.Click();
                calc.Button6.Click();
                calc.Button7.Click();
                calc.Button8.Click();
                calc.ButtonEquals.Click();
                app.WaitWhileBusy();
                var result = calc.Result;
                Assert.AreEqual("6912", result);

                // Date comparison
                using (Keyboard.Pressing(Key.CONTROL))
                {
                    Keyboard.Type(Key.KEY_E);
                }
            }
        }
        public void VirtualMachine_Should_Set_Windows_VirtualMachineResource_Correctly()
        {
            //Arrang
            int            cpu            = 8;
            int            ram            = 4;
            int            hdd            = 40;
            WindowsVersion windowsVersion = WindowsVersion.WindowsServer2012;
            var            fileSystemMock = new Mock <IFileManager>();

            fileSystemMock.Setup(w => w.WriteJsonFile(It.IsAny <object>(),
                                                      It.IsAny <string>(),
                                                      It.IsAny <string>()))
            .Verifiable();
            string providerPath = @"D:\IGS";
            var    expected     = @"UAT_Server.json";

            //Act
            var actual = new Infrastructure("UAT", providerPath, fileSystemMock.Object)
                         .VirtualMachine(new Windows(windowsVersion), hdd, ram, cpu);

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void Build_Windows_VirtualMachine_with_Right_Object()
        {
            //Arrange
            int            cpu            = 8;
            int            ram            = 4;
            int            hdd            = 40;
            WindowsVersion windowsVersion = WindowsVersion.WindowsServer2012;
            var            vm             = new VirtualMachine(new Windows(windowsVersion), hdd, ram, cpu);

            var excepted = new VirtualMachineResource
            {
                CPU             = 8,
                HardDisk        = 40,
                RAM             = 4,
                OperatingSystem = "WindowsServer2012"
            };

            //Act
            var action = vm.Build();

            //Assert
            Assert.AreEqual(excepted, action);
        }
예제 #23
0
        public UIA3Automation()
            : base(new UIA3PropertyLibrary(), new UIA3EventLibrary(), new UIA3PatternLibrary())
        {
            if (WindowsVersion.IsWindows8_1())
            {
                // Try CUIAutomation8 (Windows 8)
                try
                {
                    this.NativeAutomation = new Interop.UIAutomationClient.CUIAutomation8();
                }
                catch (COMException)
                {
                    // Fall back to CUIAutomation
                    this.NativeAutomation = new Interop.UIAutomationClient.CUIAutomation();
                }
            }
            else
            {
                this.NativeAutomation = new Interop.UIAutomationClient.CUIAutomation();
            }

            this.TreeWalkerFactory = new UIA3TreeWalkerFactory(this);
        }
        public void Provider_Should_Create_Windows_VirtualMachine_Infrastructure_Json_File()
        {
            //Arrang
            int            cpu            = 8;
            int            ram            = 4;
            int            hdd            = 40;
            WindowsVersion windowsVersion = WindowsVersion.WindowsServer2012;

            var expectedObject = new VirtualMachineResource
            {
                CPU             = cpu,
                HardDisk        = hdd,
                RAM             = ram,
                OperatingSystem = windowsVersion.ToString()
            };

            var fileSystemMock = new Mock <IFileManager>();

            fileSystemMock.Setup(w => w.WriteJsonFile(It.IsAny <object>(),
                                                      It.IsAny <string>(),
                                                      It.IsAny <string>()))
            .Verifiable();

            //Act
            var provider = new Providers.Provider(_providerName, fileSystemMock.Object);
            var infra    = provider.CreateInfrastructure("UAT");

            infra.VirtualMachine(new Windows(windowsVersion), hdd, ram, cpu);

            //Assert
            fileSystemMock.Verify(mock => mock.WriteJsonFile(It.IsAny <object>(),
                                                             It.IsAny <string>(),
                                                             It.IsAny <string>()), Times.Once());
            fileSystemMock.Verify(mock => mock.WriteJsonFile(expectedObject,
                                                             @"c:\test\UAT\VirtualMachine",
                                                             "UAT_Server.json"), Times.Once());
        }
예제 #25
0
        public void DragTo()
        {
            if (WindowsVersion.IsAppVeyor())
            {
                Assert.Inconclusive("We need a Win 10 image on AppVeyor for testing touch.");
            }

            using (var app = Application.AttachOrLaunch(ExeFileName, WindowName))
            {
                var window = app.MainWindow;
                var area   = window.FindGroupBox("Touch area");
                var events = window.FindListBox("Events");
                using (Touch.Down(area.Bounds.Center()))
                {
                    Touch.DragTo(area.Bounds.TopLeft);
                }

                var expected = new[]
                {
                    "TouchEnter Position: 99,299",
                    "PreviewTouchDown Position: 99,299",
                    "TouchDown Position: 99,299",
                    "ManipulationStarting",
                    "ManipulationStarted",
                    "PreviewTouchMove Position: -1,-1",
                    "TouchMove Position: -1,-1",
                    "ManipulationDelta",
                    "PreviewTouchUp Position: -1,-1",
                    "TouchUp Position: -1,-1",
                    "ManipulationInertiaStarting",
                    "ManipulationCompleted",
                    "TouchLeave Position: -1,-1",
                };

                CollectionAssert.AreEqual(expected, events.Items.Select(x => x.Text).ToArray());
            }
        }
예제 #26
0
        /// <summary>
        /// Make the current process DPI Aware, this should be done via the manifest but sometimes this is not possible.
        /// </summary>
        /// <returns>bool true if it was possible to change the DPI awareness</returns>
        public static bool EnableDpiAware()
        {
            // We can only test this for Windows 8.1 or later
            if (!WindowsVersion.IsWindows81OrLater)
            {
                Log.Verbose().WriteLine("An application can only be DPI aware starting with Window 8.1 and later.");
                return(false);
            }

            if (WindowsVersion.IsWindows10BuildOrLater(15063))
            {
                if (IsValidDpiAwarenessContext(DpiAwarenessContext.PerMonitorAwareV2))
                {
                    SetProcessDpiAwarenessContext(DpiAwarenessContext.PerMonitorAwareV2);
                }
                else
                {
                    SetProcessDpiAwarenessContext(DpiAwarenessContext.PerMonitorAwareV2);
                }

                return(true);
            }
            return(SetProcessDpiAwareness(DpiAwareness.PerMonitorAware).Succeeded());
        }
예제 #27
0
        public static void EnableCompatMode()
        {
            try
            {
                RegistryKey    regKeyCompat = Registry.CurrentUser.CreateSubKey(COMPAT_REGISTRY);
                WindowsVersion winver       = getOSInfo();
                String         compat       = "";
                switch (winver)
                {
                case WindowsVersion.WINME:
                case WindowsVersion.WINXP:
                    compat = COMPAT_XP;
                    break;

                case WindowsVersion.WINVISTA:
                case WindowsVersion.WIN7:
                case WindowsVersion.WIN8:
                    compat = COMPAT_VISTA;
                    break;
                }
                regKeyCompat.SetValue(GAMEPATH + GAME_EXE, compat);
            }
            catch { } // ignore
        }
 public WindowsVersionCheck GetVersion(WindowsVersion version)
 {
     switch (version)
     {
         case WindowsVersion.WindowsNt4:
             return new WindowsNt4(this);
         case WindowsVersion.Windows98:
             return new Windows98(this);
         case WindowsVersion.WindowsMe:
             return new WindowsMe(this);
         case WindowsVersion.Windows2000:
             return new Windows2000(this);
         case WindowsVersion.WindowsXp:
             return new WindowsXp(this);
         case WindowsVersion.WindowsVista:
             return new WindowsVista(this);
         case WindowsVersion.Windows7:
             return new Windows7(this);
         case WindowsVersion.Windows8:
             return new Windows8(this);
         default:
             return new NullWindowsVersion(this);
     }
 }
예제 #29
0
        public void Translates()
        {
            using var application = Application.AttachOrLaunch("Gu.Wpf.Localization.Demo.Fody.exe");
            var window = application.MainWindow;

            if (WindowsVersion.IsAzureDevops())
            {
                var fileName = Path.Combine(Path.GetTempPath(), "screen.png");
                Capture.ScreenToFile(fileName);
                TestContext.AddTestAttachment(fileName);
            }

            var comboBox = window.FindComboBox("LanguageComboBox");
            var label    = window.FindLabel("TranslatedLabel");

            comboBox.Select("English (United Kingdom)");
            Assert.AreEqual("English", label.Text);

            comboBox.Select("Nederlands (Nederland)");
            Assert.AreEqual("Nederlands", label.Text);

            comboBox.Select("svenska (Sverige)");
            Assert.AreEqual("Svenska", label.Text);
        }
예제 #30
0
			public InvalidWindowsTargetException ( WindowsVersion   ExpectedVersion, 
							       WindowsVersion   FoundVersion )
					: base ( "Wrong Windows platform (\"" + FoundVersion. ToString ( ) +
							"\") ; Expected version is : " + ExpectedVersion. ToString ( ) + "." )
			   { }
예제 #31
0
        public override void Initialize() {
            
            if (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("ProgramW6432"))) {
                this.AddPath(EnvironmentVariable.ProgramFiles, Environment.GetEnvironmentVariable("ProgramW6432"));
                this.AddPath(EnvironmentVariable.ProgramFilesX86, Environment.GetEnvironmentVariable("PROGRAMFILES(X86)"));
            } else {
                this.AddPath(EnvironmentVariable.ProgramFiles, Environment.GetEnvironmentVariable("PROGRAMFILES"));
                //this.AddPath(EnvironmentVariable.ProgramFilesX86,Environment.GetEnvironmentVariable("PROGRAMFILES"));
            }
            if (!String.IsNullOrEmpty(Environment.GetEnvironmentVariable("LOCALAPPDATA"))) {
                Version = WindowsVersion.WindowsVista;
            } else {
                Version = WindowsVersion.WindowsXP;
            }

            this.AddPath(EnvironmentVariable.StartMenu, Environment.GetFolderPath(Environment.SpecialFolder.CommonStartMenu));

            // Not really used
            //common_program_files = Environment.GetEnvironmentVariable("COMMONPROGRAMFILES");

            foreach (DriveInfo look_here in DriveInfo.GetDrives()) {
                if (look_here.IsReady && (look_here.DriveType == DriveType.Fixed || look_here.DriveType == DriveType.Removable)) {
                    Drives.Add(look_here.Name);
                }
            }


            //host_name = Environment.GetEnvironmentVariable("COMPUTERNAME");
            this.AddPath(EnvironmentVariable.AllUsersProfile, Environment.GetEnvironmentVariable("ALLUSERSPROFILE"));

            if (Version == WindowsVersion.WindowsVista)
                this.AddPath(EnvironmentVariable.Public, Environment.GetEnvironmentVariable("PUBLIC"));

            this.AddPath(EnvironmentVariable.CommonApplicationData, Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData));

            if (Version != WindowsVersion.WindowsXP) {
                RegistryHandler uac_status = new RegistryHandler("local_machine", @"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", false);
                if (uac_status.getValue("EnableLUA") == "1") {
                    UACEnabled = true;
                }
            }
            string[] split = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData).Split(Path.DirectorySeparatorChar);

            StringBuilder user_root = new StringBuilder(split[0]);
            if (Version == WindowsVersion.WindowsXP) {
                for (int i = 1; i < split.Length - 2; i++) {
                    user_root.Append(Path.DirectorySeparatorChar + split[i]);
                }
            } else {
                for (int i = 1; i < split.Length - 3; i++) {
                    user_root.Append(Path.DirectorySeparatorChar + split[i]);
                }
            }





            //Per-user variables
            loadUsersData("current_user", null);

            if (Core.AllUsersModes) {
                // All this crap lets me get data from other user's registries
                IntPtr token = new IntPtr(0);
                int retval = 0;

                TOKEN_PRIVILEGES TP = new TOKEN_PRIVILEGES();
                TOKEN_PRIVILEGES TP2 = new TOKEN_PRIVILEGES();
                LUID RestoreLuid = new LUID();
                LUID BackupLuid = new LUID();

                int return_length = 0;
                TOKEN_PRIVILEGES oldPriveleges = new TOKEN_PRIVILEGES();

                System.Diagnostics.Process process = System.Diagnostics.Process.GetCurrentProcess();
                //IntPtr hndle = GetModuleHandle(null);

                //retval = OpenProcessToken(hndle, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref token);
                retval = OpenProcessToken(process.Handle, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, ref token);

                retval = LookupPrivilegeValue(null, SE_RESTORE_NAME, ref RestoreLuid);
                TP.PrivilegeCount = 1;
                TP.Privileges.attributes = SE_PRIVILEGE_ENABLED;
                TP.Privileges.luid = RestoreLuid;
                retval = AdjustTokenPrivileges(token, 0, ref TP, TP.Size(), ref oldPriveleges, ref return_length);
                
                if (retval == 0)
                    throw new Exception(Core.Translator["ProcessRestorePermissionError", retval.ToString()]);

                retval = LookupPrivilegeValue(null, SE_BACKUP_NAME, ref BackupLuid);
                TP2.PrivilegeCount = 1;
                TP2.Privileges.attributes = SE_PRIVILEGE_ENABLED;
                TP2.Privileges.luid = BackupLuid;
                retval = AdjustTokenPrivileges(token, 0, ref TP2, TP2.Size(), ref oldPriveleges, ref return_length);
                if (retval == 0)
                    throw new Exception(Core.Translator["ProcessBackupPermissionError", retval.ToString()]);


                Console.WriteLine(retval);

                foreach (DirectoryInfo user_folder in new DirectoryInfo(user_root.ToString()).GetDirectories()) {
                    if (user_folder.Name.ToLower() == "default user")
                        continue;
                    if (user_folder.Name.ToLower() == "default")
                        continue;
                    if (user_folder.Name.ToLower() == "all users")
                        continue;

                    string hive_file = Path.Combine(user_folder.FullName, "NTUSER.DAT");
                    if (!File.Exists(hive_file))
                        continue;


                    int h = RegLoadKey(HKEY_USERS, user_folder.Name, hive_file);
                    //int h = RegLoadAppKey(hive_file,out hKey, RegSAM.AllAccess,REG_PROCESS_APPKEY,0);

                    if (h == 32)
                        continue;

                    if (h != 0)
                        throw new Exception(Core.Translator["UserRegistryLoadError", user_folder.Name, h.ToString()]);

                    //sub_key = new RegistryHandler(hKey);
                    //sub_key = new RegistryHandler(RegRoot.users,user_folder.Name,false);
                    loadUsersData("users", user_folder.Name);
                    string result = RegUnLoadKey(HKEY_USERS, user_folder.Name).ToString();

                }
            }

            
        }
예제 #32
0
 public static bool IsBelowOrEqual(WindowsVersion version)
 {
     return WindowsVersion <= version;
 }
예제 #33
0
 public static bool IsAboveOrEqual(WindowsVersion version)
 {
     return WindowsVersion >= version;
 }
예제 #34
0
        public void Pinch()
        {
            using var app = Application.AttachOrLaunch(ExeFileName, WindowName);
            var window = app.MainWindow;
            var area   = window.FindGroupBox("Touch area");
            var events = window.FindListBox("Events");
            var cp     = area.Bounds.Center();

            Touch.Pinch(cp, 100, 50, TimeSpan.FromMilliseconds(10));
            var expected = WindowsVersion.IsWindows10()
                ? new[]
            {
                "TouchEnter Position: 320,370",
                "PreviewTouchDown Position: 320,370",
                "TouchDown Position: 320,370",
                "ManipulationStarting",
                "ManipulationStarted",
                "TouchEnter Position: 178,229",
                "PreviewTouchDown Position: 178,229",
                "TouchDown Position: 178,229",
                "ManipulationDelta",
                "StylusSystemGesture SystemGesture: Drag",
                "PreviewTouchMove Position: 285,335",
                "TouchMove Position: 285,335",
                "PreviewTouchMove Position: 213,264",
                "TouchMove Position: 213,264",
                "PreviewTouchUp Position: 285,335",
                "TouchUp Position: 285,335",
                "TouchLeave Position: 285,335",
                "PreviewTouchUp Position: 213,264",
                "TouchUp Position: 213,264",
                "ManipulationInertiaStarting",
                "ManipulationCompleted",
                "TouchLeave Position: 213,264",
            }
                : new[]
            {
                "TouchEnter Position: 319,369",
                "PreviewTouchDown Position: 319,369",
                "TouchDown Position: 319,369",
                "ManipulationStarting",
                "ManipulationStarted",
                "TouchEnter Position: 178,228",
                "PreviewTouchDown Position: 178,228",
                "TouchDown Position: 178,228",
                "ManipulationDelta",
                "StylusSystemGesture SystemGesture: Drag",
                "PreviewTouchMove Position: 284,334",
                "TouchMove Position: 284,334",
                "PreviewTouchMove Position: 213,263",
                "TouchMove Position: 213,263",
                "PreviewTouchUp Position: 284,334",
                "TouchUp Position: 284,334",
                "TouchLeave Position: 284,334",
                "PreviewTouchUp Position: 213,263",
                "TouchUp Position: 213,263",
                "ManipulationInertiaStarting",
                "ManipulationCompleted",
                "TouchLeave Position: 213,263",
            };

            CollectionAssert.AreEqual(expected, events.Items.Select(x => x.Text).ToArray(), EventStringComparer.Default);
        }
예제 #35
0
파일: OS.cs 프로젝트: jordan49/websitepanel
		public static string GetName(WindowsVersion version)
		{
			string ret = string.Empty; 
			switch (version)
			{
				case WindowsVersion.Unknown:
					ret = "Unknown";
					break;
				case WindowsVersion.Windows2000:
					ret = "Windows 2000";
					break;
				case WindowsVersion.Windows95:
					ret = "Windows 95";
					break;
				case WindowsVersion.Windows98:
					ret = "Windows 98";
					break;
				case WindowsVersion.WindowsMe:
					ret = "Windows Me";
					break;
				case WindowsVersion.WindowsNT351:
					ret = "Windows NT 3.51";
					break;
				case WindowsVersion.WindowsNT4:
					ret = "Windows NT 4.0";
					break;
				case WindowsVersion.WindowsServer2003:
					ret = "Windows Server 2003";
					break;
				case WindowsVersion.WindowsServer2008:
					ret = "Windows Server 2008";
					break;
				case WindowsVersion.WindowsVista:
					ret = "Windows Vista";
					break;
				case WindowsVersion.WindowsXP:
					ret = "Windows XP";
					break;
			}
			return ret;
		}
예제 #36
0
 public static bool IsBelowOrEqual(WindowsVersion version)
 {
     return (int)_windowsVersion <= (int)version;
 }
예제 #37
0
파일: OS.cs 프로젝트: pasamsin/SolidCP
        /// <summary>
        /// Determine OS version
        /// </summary>
        /// <returns></returns>
        public static WindowsVersion GetVersion()
        {
            WindowsVersion ret = WindowsVersion.Unknown;

            OSVERSIONINFOEX info = new OSVERSIONINFOEX();

            info.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
            GetVersionEx(ref info);

            // Get OperatingSystem information from the system namespace.
            System.OperatingSystem osInfo = System.Environment.OSVersion;

            // Determine the platform.
            switch (osInfo.Platform)
            {
            // Platform is Windows 95, Windows 98, Windows 98 Second Edition, or Windows Me.
            case System.PlatformID.Win32Windows:
                switch (osInfo.Version.Minor)
                {
                case 0:
                    ret = WindowsVersion.Windows95;
                    break;

                case 10:
                    ret = WindowsVersion.Windows98;
                    break;

                case 90:
                    ret = WindowsVersion.WindowsMe;
                    break;
                }
                break;

            // Platform is Windows NT 3.51, Windows NT 4.0, Windows 2000, or Windows XP.
            case System.PlatformID.Win32NT:
                switch (osInfo.Version.Major)
                {
                case 3:
                    ret = WindowsVersion.WindowsNT351;
                    break;

                case 4:
                    ret = WindowsVersion.WindowsNT4;
                    break;

                case 5:
                    switch (osInfo.Version.Minor)
                    {
                    case 0:
                        ret = WindowsVersion.Windows2000;
                        break;

                    case 1:
                        ret = WindowsVersion.WindowsXP;
                        break;

                    case 2:
                        int i = GetSystemMetrics(SM_SERVERR2);
                        if (i != 0)
                        {
                            //Server 2003 R2
                            ret = WindowsVersion.WindowsServer2003;
                        }
                        else
                        {
                            if (info.wProductType == (byte)WinPlatform.VER_NT_WORKSTATION)
                            {
                                //XP Pro x64
                                ret = WindowsVersion.WindowsXP;
                            }
                            else
                            {
                                ret = WindowsVersion.WindowsServer2003;
                            }
                            break;
                        }
                        break;
                    }
                    break;

                case 6:
                    if (info.wProductType == (byte)WinPlatform.VER_NT_WORKSTATION)
                    {
                        ret = WindowsVersion.Vista;
                    }
                    else
                    {
                        ret = WindowsVersion.WindowsServer2008;
                    }
                    break;
                }
                break;
            }
            return(ret);
        }
예제 #38
0
 public static bool IsEqualTo(WindowsVersion version)
 {
     return _windowsVersion == version;
 }
예제 #39
0
		public  ConstraintAttribute ( )
		   {
			MinVersion	=  WindowsVersion. Default ;
			MaxVersion	=  WindowsVersion. Any ;
		    }
예제 #40
0
 protected override string OptionString(Version option)
 {
     return($"{WindowsVersion.ToDesktopName(option)} / {WindowsVersion.ToServerName(option)}");
 }
예제 #41
0
        static OSVersion()
        {
            System.Version version = Environment.OSVersion.Version;

            if (version.Major == 5 && version.Minor == 0)
                _windowsVersion = WindowsVersion.TwoThousand;
            else if (version.Major == 5 && version.Minor == 1)
                _windowsVersion = WindowsVersion.XP;
            else if (version.Major == 5 && version.Minor == 2)
                _windowsVersion = WindowsVersion.Server2003;
            else if (version.Major == 6 && version.Minor == 0)
                _windowsVersion = WindowsVersion.Vista;
            else if (version.Major == 6 && version.Minor == 1)
                _windowsVersion = WindowsVersion.Seven;
            else
                _windowsVersion = WindowsVersion.Unknown;

            if (_windowsVersion != WindowsVersion.Unknown)
            {
                if (IsAboveOrEqual(WindowsVersion.XP))
                {
                    _hasThemes = true;
                }

                if (IsBelow(WindowsVersion.Vista))
                {
                    _hasSetAccessToken = true;
                }

                if (IsAboveOrEqual(WindowsVersion.Vista))
                {
                    _minProcessQueryInfoAccess = ProcessAccess.QueryLimitedInformation;
                    _minThreadQueryInfoAccess = ThreadAccess.QueryLimitedInformation;
                    _minThreadSetInfoAccess = ThreadAccess.SetLimitedInformation;

                    _hasCycleTime = true;
                    _hasIoPriority = true;
                    _hasPagePriority = true;
                    _hasProtectedProcesses = true;
                    _hasPsSuspendResumeProcess = true;
                    _hasQueryLimitedInformation = true;
                    _hasTaskDialogs = true;
                    _hasUac = true;
                    _hasWin32ImageFileName = true;
                }

                if (IsAboveOrEqual(WindowsVersion.Seven))
                {
                    _hasExtendedTaskbar = true;
                }
            }

            _versionString = Environment.OSVersion.VersionString;
        }
예제 #42
0
 public static bool IsAbove(WindowsVersion version)
 {
     return (int)_windowsVersion > (int)version;
 }
예제 #43
0
 public static bool IsAbove(WindowsVersion version)
 {
     return WindowsVersion > version;
 }
예제 #44
0
 public static bool IsAboveOrEqual(WindowsVersion version)
 {
     return (int)_windowsVersion >= (int)version;
 }
예제 #45
0
        public void TwoFingers()
        {
            using var app = Application.AttachOrLaunch(ExeFileName, WindowName);
            var window = app.MainWindow;
            var area   = window.FindGroupBox("Touch area");
            var events = window.FindListBox("Events");
            var cp     = area.Bounds.Center();

            Touch.Multi(
                new TwoFingers(cp + new Vector(-100, 0), cp + new Vector(100, 0)),
                new TwoFingers(cp + new Vector(-50, 0), cp + new Vector(50, 0)),
                TimeSpan.FromMilliseconds(10));
            var expected = WindowsVersion.IsWindows10()
                ? new[]
            {
                "TouchEnter Position: 150,300",
                "PreviewTouchDown Position: 150,300",
                "TouchDown Position: 150,300",
                "ManipulationStarting",
                "ManipulationStarted",
                "TouchEnter Position: 350,300",
                "PreviewTouchDown Position: 350,300",
                "TouchDown Position: 350,300",
                "ManipulationDelta",
                "StylusSystemGesture SystemGesture: Drag",
                "PreviewTouchMove Position: 200,300",
                "TouchMove Position: 200,300",
                "PreviewTouchMove Position: 300,300",
                "TouchMove Position: 300,300",
                "PreviewTouchUp Position: 200,300",
                "TouchUp Position: 200,300",
                "TouchLeave Position: 200,300",
                "PreviewTouchUp Position: 300,300",
                "TouchUp Position: 300,300",
                "ManipulationInertiaStarting",
                "ManipulationCompleted",
                "TouchLeave Position: 300,300",
            }
                : new[]
            {
                "TouchEnter Position: 149,299",
                "PreviewTouchDown Position: 149,299",
                "TouchDown Position: 149,299",
                "ManipulationStarting",
                "ManipulationStarted",
                "TouchEnter Position: 349,299",
                "PreviewTouchDown Position: 349,299",
                "TouchDown Position: 349,299",
                "ManipulationDelta",
                "StylusSystemGesture SystemGesture: Drag",
                "PreviewTouchMove Position: 199,299",
                "TouchMove Position: 199,299",
                "PreviewTouchMove Position: 299,299",
                "TouchMove Position: 299,299",
                "PreviewTouchUp Position: 199,299",
                "TouchUp Position: 199,299",
                "TouchLeave Position: 199,299",
                "PreviewTouchUp Position: 299,299",
                "TouchUp Position: 299,299",
                "ManipulationInertiaStarting",
                "ManipulationCompleted",
                "TouchLeave Position: 299,299",
            };

            CollectionAssert.AreEqual(expected, events.Items.Select(x => x.Text).ToArray(), EventStringComparer.Default);
        }
예제 #46
0
 public static bool IsBelow(WindowsVersion version)
 {
     return (int)_windowsVersion < (int)version;
 }
예제 #47
0
		/// <summary>
		/// Creates and initializes a new instance of the attribute.
		/// </summary>
		/// <param name="version">The version to associate with the marked object.</param>
		public VersionAttribute(WindowsVersion version)
			: this((uint)version)
		{
		}
예제 #48
0
파일: OS.cs 프로젝트: pasamsin/SolidCP
        public static string GetName(WindowsVersion version)
        {
            string ret = string.Empty;

            switch (version)
            {
            case WindowsVersion.Unknown:
                ret = "Unknown";
                break;

            case WindowsVersion.Windows2000:
                ret = "Windows 2000";
                break;

            case WindowsVersion.Windows95:
                ret = "Windows 95";
                break;

            case WindowsVersion.Windows98:
                ret = "Windows 98";
                break;

            case WindowsVersion.WindowsMe:
                ret = "Windows Me";
                break;

            case WindowsVersion.WindowsNT351:
                ret = "Windows NT 3.51";
                break;

            case WindowsVersion.WindowsNT4:
                ret = "Windows NT 4.0";
                break;

            case WindowsVersion.WindowsServer2003:
                ret = "Windows Server 2003";
                break;

            case WindowsVersion.WindowsServer2008:
                ret = "Windows Server 2008";
                break;

            case WindowsVersion.WindowsServer2008R2:
                ret = "Windows Server 2008 R2";
                break;

            case WindowsVersion.WindowsServer2012:
                ret = "Windows Server 2012";
                break;

            case WindowsVersion.WindowsServer2012R2:
                ret = "Windows Server 2012 R2";
                break;

            case WindowsVersion.WindowsVista:
                ret = "Windows Vista";
                break;

            case WindowsVersion.WindowsXP:
                ret = "Windows XP";
                break;

            case WindowsVersion.Windows7:
                ret = "Windows 7";
                break;

            case WindowsVersion.Windows8:
                ret = "Windows 8";
                break;

            case WindowsVersion.Windows10:
                ret = "Windows 10";
                break;

            case WindowsVersion.WindowsServer2016:
                ret = "Windows Server 2016";
                break;

            default:
                ret = "Windows";
                break;
            }
            return(ret);
        }
예제 #49
0
        private void InitConsole()      // changes yt7pwr
        {
            this.Text = this.Text + GSDR_version + GSDR_revision;
            WinVer = WindowsVersion.WindowsXP;      // default
            OSInfo = System.Environment.OSVersion;
            Mixer.console = this;

            switch (OSInfo.Version.Major)
            {
                case 5:
                    {
                        switch (OSInfo.Version.Minor)
                        {
                            case 0:
                                WinVer = WindowsVersion.Windows2000;
                                break;
                            case 1:
                                WinVer = WindowsVersion.WindowsXP;
                                break;
                        }
                    }
                    break;
                case 6:
                    {
                        switch (OSInfo.Version.Minor)
                        {
                            case 0:
                                WinVer = WindowsVersion.WindowsVista;
                                break;
                            case 1:
                                WinVer = WindowsVersion.Windows7;
                                break;
                            case 2:
                                WinVer = WindowsVersion.Windows8;
                                break;
                            case 3:
                                WinVer = WindowsVersion.Windows8;
                                break;
                            default:
                                WinVer = WindowsVersion.WindowsVista;
                                break;
                        }
                    }
                    break;
                default:
                    WinVer = WindowsVersion.WindowsXP;
                    break;
            }

            booting = true;
            skin = new Skin(this);
            VoiceMsgForm = new VoiceMessages(this);
            g59 = new GenesisG59.G59(Handle);
            g59.booting = true;
            g11 = new GenesisG11.G11(Handle);
            g11.booting = true;
            g6 = new GenesisG6.G6(Handle);
            g6.booting = true;
            g6.SetCallback(GenesisG6CommandCallback);
            g6.SetIQCallback(Audio.G6AudioCallback);
            //g6.SetIQCallback(Audio.G6ADCaudioCallback);
            //g6.SetDACcallback(Audio.G6DACaudioCallback);
            net_device = new GenesisNetBox.NetBox(Handle);
            net_device.booting = true;
            qrp2000 = new QRP2000(this);
            AnalogSignalGauge = new AGauge(this);
            NewVFOSignalGauge = new AGauge(this);

            try
            {
                ServerSocket = new ServerSendData(this);    // error!
                ClientSocket = new ClientRecvData(this);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error1 in network configuration!\nCheck your network settings!\n" +
                    ex.ToString());
            }

            try
            {
                CAT_server_socket = new CAToverEthernetServer(this);
                CAT_client_socket = new CAToverEthernetClient(this);
            }
            catch (Exception ex)
            {
                Debug.Write("Error while creating network CAT!\n" +
                    ex.ToString());
            }

            try
            {
                MultiPSKServer = new MultiPSKEthernetServer(this);
            }
            catch (Exception ex)
            {
                Debug.Write("Error in MultiPSK network configuration!\nCheck your network settings!\n" +
                    ex.ToString());
            }

            UpdateBandStackRegisters();

            Audio.console = this;
            chkDSPNB2.Enabled = true;
            Display_GDI.console = this;     // for GDI+
#if(DirectX)
            try
            {
                Display_DirectX.console = this; // for DirectX
            }
            catch (Exception ex)
            {
                MessageBox.Show("DirectX general fault!\n" + ex.ToString());
            }
#endif

            if (CmdLineArgs != null)
            {
                for (int i = 0; i < CmdLineArgs.Length; i++)
                {
                    switch (CmdLineArgs[i])
                    {
                        case "--disable-swr-prot-at-my-risk":
                            DisableSWRProtection = true;
                            this.Text = this.Text + "  *** SWR Protection Disabled! ***";
                            break;
                        case "--high-pwr-am":
                            Audio.high_pwr_am = true;
                            MessageBox.Show("high power am");
                            break;
                        case "--debug-enable":
                            debug_enabled = true;
                            debug = new DebugForm(this, true);
                            debug.StartPosition = FormStartPosition.Manual;
                            debug.Show();
                            debug.Focus();
                            Win32.SetWindowPos(debug.Handle.ToInt32(),
                                -1, this.Left, this.Top, debug.Width, debug.Height, 0);
                            this.Text = this.Text + " Debug enabled!";
                            break;
                    }
                }
            }

            losc_hover_digit = -1;
            vfoA_hover_digit = -1;
            vfoB_hover_digit = -1;
            run_setup_wizard = true;

            // get culture specific decimal separator
            separator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;

            last_band = "";						// initialize bandstack

            wheel_tune_list = new double[15];		// initialize wheel tuning list array
            wheel_tune_list[0] = 0.000001;
            wheel_tune_list[1] = 0.000010;
            wheel_tune_list[2] = 0.000050;
            wheel_tune_list[3] = 0.000100;
            wheel_tune_list[4] = 0.000250;
            wheel_tune_list[5] = 0.000500;
            wheel_tune_list[6] = 0.001000;
            wheel_tune_list[7] = 0.005000;
            wheel_tune_list[8] = 0.009000;
            wheel_tune_list[9] = 0.010000;
            wheel_tune_list[10] = 0.100000;
            wheel_tune_list[11] = 0.250000;
            wheel_tune_list[12] = 0.500000;
            wheel_tune_list[13] = 1.000000;
            wheel_tune_list[14] = 10.000000;
            wheel_tune_index = 6;
            wheel_tune_index_subRX = 6;

            meter_text_history = new float[multimeter_text_peak_samples];
            current_meter_data = -200.0f;
            this.ActiveControl = chkPower;		// Power has focus initially

            Display_GDI.Target = picDisplay;
            Display_GDI.Init();					// Initialize Display variables
            InitDisplayModes();					// Initialize Display Modes
            InitAGCModes();						// Initialize AGC Modes
            InitMultiMeterModes();				// Initialize MultiMeter Modes

            ProcessSampleThreadController[] pstc = new ProcessSampleThreadController[1];
            audio_process_thread = new Thread[1];

            for (uint proc_thread = 0; proc_thread < 1; proc_thread++)
            {
                pstc[proc_thread] = new ProcessSampleThreadController(proc_thread);
                audio_process_thread[proc_thread] = new Thread(new ThreadStart(pstc[proc_thread].ProcessSampleThread));
                audio_process_thread[proc_thread].Name = "Audio Process Thread " + proc_thread.ToString();
                audio_process_thread[proc_thread].Priority = ThreadPriority.Highest;
                audio_process_thread[proc_thread].IsBackground = true;
                audio_process_thread[proc_thread].Start();
            }

            siolisten = new SIOListenerII(this);

            Keyer = new CWKeyer2(this);			// create new Keyer
            CWXForm = new CWX(this);            // create CWX form
            CWXForm.stopButton_Click(null, null);
            EQForm = new EQForm();
            XTRVForm = new XTRV(this);
            UpdateBandStackRegisters();

            InitFilterPresets(ref filter_presets, ref filter_presets_subRX);					// Initialize filter values

            SI570 = new ExtIO_si570_usb(this);
            RTL_SDR = new ExtIO_RTL(this);

            ir_remote = new WinLIRC(this);

            rx_image_real_table = new float[(int)Band.LAST + 1];
            rx_image_imag_table = new float[(int)Band.LAST + 1];
            tx_image_phase_table = new float[(int)Band.LAST + 1];
            tx_image_gain_table = new float[(int)Band.LAST + 1];
            rx_image_phase_table = new float[(int)Band.LAST + 1];
            rx_image_gain_table = new float[(int)Band.LAST + 1];

            SetupForm = new Setup(this);		// create Setup form
            SetupForm.StartPosition = FormStartPosition.Manual;

            SetupForm.GetTxProfiles();
            UpdateTXProfile();

            WaveForm = new WaveControl(this);	// create Wave form
            WaveForm.StartPosition = FormStartPosition.Manual;

            CurrentAGCMode = AGCMode.MED;				// Initialize front panel controls
            vfob_dsp_mode = DSPMode.LSB;
            vfob_filter = Filter.F3;
            comboDisplayMode.Text = "Panafall";
            comboMeterRXMode.SelectedIndex = 0;
            ptbPWR.Value = 10;

            CurrentDSPMode = DSPMode.CWU;
            CurrentDSPModeSubRX = DSPMode.CWU;
            old_dsp_mode = DSPMode.CWU;
            old_dsp_mode_subRX = DSPMode.CWU;
            Splash.SetStatus("Restore Console state...");
            GetState();							// recall saved state

            if (current_dsp_mode == DSPMode.FIRST || current_dsp_mode == DSPMode.LAST)
                radModeLSB.Checked = true;
            if (current_dsp_mode_subRX == DSPMode.FIRST || current_dsp_mode == DSPMode.LAST)
                radSUBRxModeLSB.Checked = true;
            if (current_filter == Filter.FIRST || current_filter == Filter.LAST ||
                (current_filter == Filter.NONE && current_dsp_mode != DSPMode.DRM && current_dsp_mode != DSPMode.SPEC))
                radFilter3.Checked = true;
            if (current_filter_subRX == Filter.FIRST || current_filter_subRX == Filter.LAST ||
                (current_filter_subRX == Filter.NONE && current_dsp_mode_subRX != DSPMode.DRM &&
                current_dsp_mode_subRX != DSPMode.SPEC))
                radSubRXFilter3.Checked = true;

            booting = false;
            EQForm.Init();                  // set EQU parameter
            SetupForm.DSPBufferSize = 0;    // force refresh
            VFOAFreq = vfoAFreq;
            VFOBFreq = vfoBFreq;
            LOSCFreq = loscFreq;
            PWR_ValueChanged();
            udMIC_ValueChanged(this, EventArgs.Empty);
            tbRX0Gain_Scroll(this, EventArgs.Empty);
            tbRX1Gain_Scroll(this, EventArgs.Empty);
            tbPanMainRX_Scroll(this, EventArgs.Empty);
            tbPanSubRX_Scroll(this, EventArgs.Empty);
            ptbPanMainRX.Value = pan_main_rx;
            ptbPanSubRX.Value = pan_sub_rx;
            ptbDisplayZoom.Value = 4;
            CalcDisplayFreq();

            wheel_tune_index--;					// Setup wheel tuning
            wheel_tune_index_subRX--;
            ChangeWheelTuneLeft();
            ChangeWheelTuneLeftSubRX();

            SetupForm.initCATandPTTprops();   // wjt added -- get console props setup for cat and ptt 

            if (comboMeterTXMode.Items.Count > 0 && comboMeterTXMode.SelectedIndex < 0)
                comboMeterTXMode.SelectedIndex = 0;
            chkMOX.Enabled = false;

            CheckSkins();

#if(DirectX)
            if (CurrentDisplayEngine == DisplayEngine.DIRECT_X)
            {
                CurrentDisplayEngine = current_display_engine;
            }
#endif

            // yt7pwr
            if (!skins_enabled)
            {
                radDisplayZoom1x.BackColor = button_selected_color;
                radDisplayZoom2x.BackColor = SystemColors.Control;
                radDisplayZoom4x.BackColor = SystemColors.Control;
                radDisplayZoom8x.BackColor = SystemColors.Control;
            }
            else
                radDisplayZoom1x.Checked = true;

            Splash.SetStatus("Initializing Genesis radio communication");	// Set progress point
            g59.booting = false;
            g11.booting = false;
            g6.booting = false;
            net_device.booting = false;
            g59.si570_i2c_address = (int)SetupForm.udSi570_address.Value;
            g59.si570_fxtal = (int)SetupForm.udSi570_xtal1.Value;
            g59.HSDiv = (int)SetupForm.udSi570_divisor.Value;
            g11.si570_i2c_address = (int)SetupForm.udSi570_address.Value;
            g11.si570_fxtal = (int)SetupForm.udSi570_xtal1.Value;
            g11.HSDiv = (int)SetupForm.udSi570_divisor.Value;
            g6.si570_i2c_address = (int)SetupForm.udSi570_address.Value;
            g6.si570_fxtal = (int)SetupForm.udSi570_xtal1.Value;
            g6.HSDiv = (int)SetupForm.udSi570_divisor.Value;
            net_device.si570_i2c_address = (int)SetupForm.udSi570_address.Value;
            net_device.si570_fxtal = (int)SetupForm.udSi570_xtal1.Value;
            net_device.si570_div = (int)SetupForm.udSi570_divisor.Value;

            if (CurrentModel == Model.GENESIS_G59USB)
            {
                bool conn = false;
                g59.USB_Serial = SetupForm.USB_serial_No;
                conn = g59.Connect();

                if (conn)
                {
                    G59Init();
                    btnUSB.BackColor = Color.Green;
                }
                else
                {
                    btnUSB.BackColor = Color.Red;
                }
            }
            else if (CurrentModel == Model.GENESIS_G11)
            {
                bool conn = false;
                g11.USB_Serial = SetupForm.USB_serial_No;
                conn = g11.Connect();

                if (conn)
                {
                    G11Init();
                    btnUSB.BackColor = Color.Green;
                }
                else
                {
                    btnUSB.BackColor = Color.Red;
                }
            }
            else if (CurrentModel == Model.GENESIS_G6)
            {
                bool conn = false;
                g6.USB_Serial = SetupForm.USB_serial_No;
                conn = g6.Connect();

                if (conn)
                {
                    G11Init();
                    btnUSB.BackColor = Color.Green;
                }
                else
                {
                    btnUSB.BackColor = Color.Red;
                }
            }
            else if (current_model == Model.QRP2000)
            {
                ReInit_USB();
            }
            else if (current_model == Model.RTL_SDR)
            {
                bool result = RTL_SDR.InitUSB();

                if (result)
                {
                    btnUSB.Visible = true;
                    btnUSB.BackColor = Color.Green;
                }
                else
                {
                    btnUSB.BackColor = Color.Red;
                }
            }
            else if (SetupForm.chkGeneralUSBPresent.Checked)
            {
                bool result = SI570.Init_USB();

                if (result)
                {
                    btnUSB.Visible = true;
                    btnUSB.BackColor = Color.Green;
                }
                else
                {
                    btnUSB.BackColor = Color.Red;
                }
            }

            txtMemory_fill();
            txtFMmemory_fill();

            SetTXOscFreqs(false, false);

            btnG3020_X1.Text = G3020Xtal1.ToString();
            btnG3020_X2.Text = G3020Xtal2.ToString();
            btnG3020_X3.Text = G3020Xtal3.ToString();
            btnG3020_X4.Text = G3020Xtal4.ToString();
            btnG160_X1.Text = G160Xtal1.ToString();
            btnG160_X2.Text = G160Xtal2.ToString();
            btnG80_X1.Text = G80Xtal1.ToString();
            btnG80_X2.Text = G80Xtal2.ToString();
            btnG80_X3.Text = G80Xtal3.ToString();
            btnG80_X4.Text = G80Xtal4.ToString();
            btnG40_X1.Text = G40Xtal1.ToString();
            btnG137_X1.Text = G137Xtal1.ToString();
            btnG500_X1.Text = G500Xtal1.ToString();

            txtVFOAMSD.Font = vfo_large_font;
            txtVFOBMSD.Font = vfo_large_font;
            txtLOSCMSD.Font = (vfo_large_font);
            txtVFOAFreq.Font = vfo_large_font;
            txtVFOBFreq.Font = vfo_large_font;
            txtLOSCFreq.Font = vfo_large_font;
            txtVFOALSD.Font = vfo_small_font;
            txtVFOBLSD.Font = vfo_small_font;
            txtLOSCLSD.Font = vfo_small_font;
            NewVFOLargeFont = new_vfo_large_font;     // refresh
            NewVFOSmallFont = new_vfo_small_font;
            VFOLargeFont = vfo_large_font;
            VFOSmallFont = vfo_small_font;
            network_event = new AutoResetEvent(false);
            sMeterDigital2.MeterForeColor = vfo_text_dark_color;
            sMeterDigital1.MeterForeColor = vfo_text_dark_color;

            try
            {
                eventWatcher = new ManagementEventWatcher("root\\wmi", "SELECT * FROM MSNdis_StatusMediaDisconnect");
                eventWatcher.EventArrived += new
                EventArrivedEventHandler(eventWatcher_EventArrived);
                eventWatcher.Start();
            }
            catch (Exception ex)
            {
                //MessageBox.Show("Error starting Network watcher!\nCheck you network settings!\n" +
                    //ex.ToString());
            }

            if (current_model == Model.GENESIS_G59NET)
                NetworkThreadRunning = true;

            SetupForm.StartEthernetCATServer();       // try ethernet CAT 
            SetupForm.StartEthernetCATClient();
            SetupForm.StartMultiPSKServer();

            InitSMeterModes();

            if (File.Exists(SetupForm.txtLoopDll.Text + "\\loop.dll") &&
                SetupForm.chkAudioEnableVAC.Checked &&
                SetupForm.comboAudioInputVAC.Text == "loop.dll" &&
                SetupForm.comboAudioOutputVAC.Text == "loop.dll")
            {
                loopDLL = new LoopDLL(this);
                Audio.loopDLL_enabled = true;
            }
            else
                Audio.loopDLL_enabled = false;

            chkVFOSplit.Enabled = false;

            switch (current_model)
            {
                case Model.GENESIS_G59NET:
                case Model.GENESIS_G59USB:
                    if (SetupForm.chkG59RX2.Checked)
                        lblRX2.BackColor = Color.Red;
                    else
                        lblRX2.BackColor = NewBackgroundVFOColor;
                    break;

                case Model.GENESIS_G11:
                    if (SetupForm.chkG11RX2.Checked)
                        lblRX2.BackColor = Color.Red;
                    else
                        lblRX2.BackColor = NewBackgroundVFOColor;
                    break;
            }

            EQForm.RestoreSettings();
            band_button_height = radMoreBands.Height;
            band_button_width = radMoreBands.Width;
            AF_ValueChanged();
            SetupForm.MultimeterCalOffset = multimeter_cal_offset;
            SetupForm.DisplayCalOffset = display_cal_offset;
            FilterUpdate();
            PWR_ValueChanged();

            if (radMoreBands.Checked)
            {
                radMoreBands_Click(this, EventArgs.Empty);
            }

            IR_Remote_enabled = ir_remote_enabled;      // try WinLIRC
            SetTXOscFreqs(true, true);
            SetTXOscFreqs(false, true);

            SetupForm.ForceAllEvents();
        }
예제 #50
0
		/// <summary>
		/// Creates and initializes a new instance of the attribute.
		/// </summary>
		/// <param name="type">The type of the class.</param>
		/// <param name="version">The version of the class.</param>
		public ActivatableAttribute(Type type, WindowsVersion version)
			: this(type, (uint)version)
		{
		}
예제 #51
0
		/// <summary>
		/// Creates and initializes a new instance of the attribute.
		/// </summary>
		/// <param name="version">The version of the class.</param>
		public ActivatableAttribute(WindowsVersion version)
			: this((uint)version)
		{
		}
    public static string GetQuickOsid()
    {
        WindowsVersion windowsVersion = GetWindowsVersion();

        return(Enum.GetName(windowsVersion.GetType(), windowsVersion));
    }
예제 #53
0
 public Windows(WindowsVersion version)
 {
     _version = version;
 }
예제 #54
0
파일: OS.cs 프로젝트: jonwbstr/Websitepanel
 public static string GetName(WindowsVersion version)
 {
     string ret = string.Empty;
     switch (version)
     {
         case WindowsVersion.Unknown:
             ret = "Unknown";
             break;
         case WindowsVersion.Windows2000:
             ret = "Windows 2000";
             break;
         case WindowsVersion.Windows95:
             ret = "Windows 95";
             break;
         case WindowsVersion.Windows98:
             ret = "Windows 98";
             break;
         case WindowsVersion.WindowsMe:
             ret = "Windows Me";
             break;
         case WindowsVersion.WindowsNT351:
             ret = "Windows NT 3.51";
             break;
         case WindowsVersion.WindowsNT4:
             ret = "Windows NT 4.0";
             break;
         case WindowsVersion.WindowsServer2003:
             ret = "Windows Server 2003";
             break;
         case WindowsVersion.WindowsServer2008:
             ret = "Windows Server 2008";
             break;
         case WindowsVersion.WindowsServer2008R2:
             ret = "Windows Server 2008 R2";
             break;
         case WindowsVersion.WindowsServer2012:
             ret = "Windows Server 2012";
             break;
         case WindowsVersion.WindowsServer2012R2:
             ret = "Windows Server 2012 R2";
             break;
         case WindowsVersion.WindowsVista:
             ret = "Windows Vista";
             break;
         case WindowsVersion.WindowsXP:
             ret = "Windows XP";
             break;
         case WindowsVersion.Windows7:
             ret = "Windows 7";
             break;
         case WindowsVersion.Windows8:
             ret = "Windows 8";
             break;
         case WindowsVersion.Win32NTWorkstation:
             ret = "Windows Workstation";
             break;
         case WindowsVersion.Win32NTServer:
             ret = "Windows Server";
             break;
         default:
             ret = "Windows";
             break;
     }
     return ret;
 }
예제 #55
0
 public static bool IsBelow(WindowsVersion version)
 {
     return WindowsVersion < version;
 }