コード例 #1
0
        public static void UninstallBuiltInDrivers()
        {
            LogWriter.Write("Uninstalling Built-in drivers");
            try
            {
                var    path = ResourceExtractor.ExtractResource(Assembly.GetExecutingAssembly(), "KeyboardSplitter.Lib.keyboard_driver.exe");
                string msg1 = InterceptionDriver.Uninstall(path);
                string msg2 = VirtualXboxBus.Uninstall();
                LogWriter.Write(msg1);
                LogWriter.Write(msg2);

                Controls.MessageBox.Show(
                    "Uninstallation finished. You must reboot the system to completely remove the drivers.\r\n\r\n Application will now close.",
                    ApplicationInfo.AppName,
                    MessageBoxButton.OK,
                    MessageBoxImage.Information);

                Environment.Exit(0);
            }
            catch (Exception ex)
            {
                LogWriter.Write("Uninstalling Built-in drivers FAILED:\r\n" + ex.ToString());

                Controls.MessageBox.Show(
                    "Uninstall failed: " + ex.Message,
                    "Uninstall failed",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
            }
        }
コード例 #2
0
        private static void LoadAssemblies()
        {
            if (!App.assembliesLoaded)
            {
                // Setting the native dll search path
                LogWriter.Write("Setting environment");
                Environment.SetEnvironmentVariable(
                    "PATH",
                    ApplicationInfo.AppTempDirectory,
                    EnvironmentVariableTarget.Process);

                LogWriter.Write("Extracting native resources");
                var assembly = Assembly.GetExecutingAssembly();
                ResourceExtractor.ExtractResource(assembly, "KeyboardSplitter.Lib.interception.dll", ApplicationInfo.AppTempDirectory);
                ResourceExtractor.ExtractResource(assembly, "KeyboardSplitter.Lib.VirtualXboxNative.dll", ApplicationInfo.AppTempDirectory);

                ManagedAssemblyLoader.Load(
                    "KeyboardSplitter.Lib.Interceptor.dll",
                    "Interceptor.dll");

                ManagedAssemblyLoader.Load(
                    "KeyboardSplitter.Lib.SplitterCore.dll",
                    "SplitterCore.dll");

                ManagedAssemblyLoader.Load(
                    "KeyboardSplitter.Lib.VirtualXbox.dll",
                    "VirtualXbox.dll");

                ManagedAssemblyLoader.Load(
                    "KeyboardSplitter.Lib.XinputWrapper.dll",
                    "XinputWrapper.dll");

                App.assembliesLoaded = true;
            }
        }
        private void CopyXinputDlls(string dir)
        {
            var resourceFile = ResourceExtractor.ExtractResource(Assembly.GetExecutingAssembly(), "KeyboardSplitter.Lib.xinput.dll", dir);

            var xinput13  = System.IO.Path.Combine(dir, "xinput1_3.dll");
            var xinput14  = System.IO.Path.Combine(dir, "xinput1_4.dll");
            var xinput910 = System.IO.Path.Combine(dir, "XINPUT9_1_0.DLL");

            System.IO.File.Copy(resourceFile, xinput13, true);
            System.IO.File.Copy(resourceFile, xinput14, true);
            System.IO.File.Copy(resourceFile, xinput910, true);
            System.IO.File.Delete(resourceFile);
        }
コード例 #4
0
        static void Main(string[] args)
        {
            ResourceExtractor.ExtractResource("MapEditor.SomeC++Stuffs.dll", "SomeC++Stuffs.dll", 3);

            WZ.File.InitializeKey();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MapEditor());

            ResourceExtractor.DeleteResource("SomeC++Stuffs.dll");

            //GarbageCollector.StopGC();
        }