コード例 #1
0
ファイル: Download_Main.cs プロジェクト: 24/source_04
        [STAThread] // STAThread est nécessaire pour accéder au clipboard (Clipboard.GetText)
        public static void Main(string[] args)
        {
            try
            {
                XmlConfig.CurrentConfig = new XmlConfig();
                cTrace.NewOutputPath(XmlConfig.CurrentConfig.Get("Log"));
                //cTrace.KeepOutputOpen = XmlConfig.CurrentConfig.Get<bool>("LogKeepOutputOpen", false);

                FormatInfo.SetInvariantCulture();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                WindowsApp.Trace = XmlConfig.CurrentConfig.Get <bool>("WinProcTrace", false);

                if (!WindowsApp.ControlApplicationExit(args))
                {
                    return;
                }

                //cTrace.Trace("Download");

                Icon icon = WRunSource.Class.Print.Base.Download_resource.AppIcon;
                WindowsApp.CurrentWindowsApp = new WindowsApp(icon, WAOptions.Type2);
                WindowsApp.CurrentWindowsApp.ApplicationExiting      += new WindowsApp.EventApplicationExiting(ApplicationExit);
                WindowsApp.CurrentWindowsApp.TrayIcon.NotifyIcon.Text = "Download";

                Init();

                Application.Run();
            }
            catch (Exception ex)
            {
                cf.ErrorMessageBox(ex);
            }
        }
コード例 #2
0
        public static string compileAndExecuteFile(string strFileToExecute, string[] strReferenceAssembliesToAdd)
        {
            WindowsApp waWindowsApp = new WindowsApp();

            waWindowsApp.Run(new string[] { strFileToExecute }, strReferenceAssembliesToAdd);
            return(waWindowsApp.StrCompilationErrors);
        }
コード例 #3
0
 public static string compileSourceCode(string strSourceCodeToExecute, string[] strReferenceAssembliesToAdd, string strPathToTempCompiledFile)
 {
     if ("" == strPathToTempCompiledFile)
     {
         strPathToTempCompiledFile = Path.GetTempFileName();
     }
     else
     {
         strPathToTempCompiledFile = Path.Combine(strPathToTempCompiledFile, files.returnUniqueFileName(".tmp.cs"));
     }
     if (strSourceCodeToExecute.Length == 0)
     {
         return("Error: Code to compile cannot be empty");
     }
     else
     {
         utils.files.SaveFileWithStringContents(strPathToTempCompiledFile, strSourceCodeToExecute);
         string strCompilationResult = new WindowsApp().Compile(strPathToTempCompiledFile, strReferenceAssembliesToAdd);
         if ("" == strCompilationResult)
         {
             File.Delete(strPathToTempCompiledFile);
             return("Compilation OK");
         }
         else
         {
             return(strCompilationResult);
         }
     }
 }
コード例 #4
0
ファイル: MainStartup.cs プロジェクト: loose-wardrobe/Emby
        /// <summary>
        /// Runs the application.
        /// </summary>
        /// <param name="appPaths">The app paths.</param>
        /// <param name="logManager">The log manager.</param>
        /// <param name="runService">if set to <c>true</c> [run service].</param>
        /// <param name="options">The options.</param>
        private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, bool runService, StartupOptions options)
        {
            var fileSystem = new WindowsFileSystem(new PatternsLogger(logManager.GetLogger("FileSystem")));

            fileSystem.AddShortcutHandler(new MbLinkShortcutHandler(fileSystem));

            var nativeApp = new WindowsApp(fileSystem)
            {
                IsRunningAsService = runService
            };

            _appHost = new ApplicationHost(appPaths,
                                           logManager,
                                           options,
                                           fileSystem,
                                           "emby.windows.zip",
                                           nativeApp);

            var initProgress = new Progress <double>();

            if (!runService)
            {
                if (!options.ContainsOption("-nosplash"))
                {
                    ShowSplashScreen(_appHost.ApplicationVersion, initProgress, logManager.GetLogger("Splash"));
                }

                // Not crazy about this but it's the only way to suppress ffmpeg crash dialog boxes
                SetErrorMode(ErrorModes.SEM_FAILCRITICALERRORS | ErrorModes.SEM_NOALIGNMENTFAULTEXCEPT |
                             ErrorModes.SEM_NOGPFAULTERRORBOX | ErrorModes.SEM_NOOPENFILEERRORBOX);
            }


            var task = _appHost.Init(initProgress);

            task = task.ContinueWith(new Action <Task>(a => _appHost.RunStartupTasks()));

            if (runService)
            {
                StartService(logManager);
            }
            else
            {
                Task.WaitAll(task);

                task = InstallVcredistIfNeeded(_appHost, _logger);
                Task.WaitAll(task);

                SystemEvents.SessionEnding += SystemEvents_SessionEnding;
                SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;

                HideSplashScreen();

                ShowTrayIcon();

                task = ApplicationTaskCompletionSource.Task;
                Task.WaitAll(task);
            }
        }
コード例 #5
0
ファイル: Download_Main.cs プロジェクト: 24/source_04
 private static void ApplicationExit()
 {
     //cTrace.Trace("Exit in progress");
     gAppParameters.Save();
     if (gCon != null)
     {
         gCon.Close();
     }
     WindowsApp.RunControlApplicationExit();
 }
コード例 #6
0
ファイル: App.cs プロジェクト: Svetomech/Svetomech.Utilities
 public static void SwitchAutorun(string appName, string appPath = null, bool isConsoleApp = false)
 {
     if (runningWindows)
     {
         WindowsApp.SwitchAutorun(appName, appPath, isConsoleApp);
     }
     else
     {
         LinuxApp.SwitchAutorun(appName, appPath, isConsoleApp);
     }
 }
コード例 #7
0
 public static CompilerResults compileAndReturnCompilerResults(string strSourceCodeToExecute, string[] strReferenceAssembliesToAdd, ref string strCompilationErrors)
 {
     string strTempFileName = Path.GetTempFileName();
     if (strSourceCodeToExecute.Length == 0)
     {
         MessageBox.Show("Code to compile cannot be empty");
         return null;
     }
     else
     {
         utils.files.SaveFileWithStringContents(strTempFileName, strSourceCodeToExecute);
         WindowsApp  waWindowsApp = new WindowsApp();
         CompilerResults crCompilerResults = waWindowsApp.compileAndReturnCompilerResultsObject(strTempFileName, strReferenceAssembliesToAdd);
         strCompilationErrors = waWindowsApp.StrCompilationErrors;
         return crCompilerResults;
     }
 }
コード例 #8
0
        public static CompilerResults compileAndReturnCompilerResults(string strSourceCodeToExecute, string[] strReferenceAssembliesToAdd, ref string strCompilationErrors)
        {
            string strTempFileName = Path.GetTempFileName();

            if (strSourceCodeToExecute.Length == 0)
            {
                MessageBox.Show("Code to compile cannot be empty");
                return(null);
            }
            else
            {
                utils.files.SaveFileWithStringContents(strTempFileName, strSourceCodeToExecute);
                WindowsApp      waWindowsApp      = new WindowsApp();
                CompilerResults crCompilerResults = waWindowsApp.compileAndReturnCompilerResultsObject(strTempFileName, strReferenceAssembliesToAdd);
                strCompilationErrors = waWindowsApp.StrCompilationErrors;
                return(crCompilerResults);
            }
        }
コード例 #9
0
        private static int run()
        {
            int error = 0;

            //Start calculator and wait for UI to be loaded
            try
            {
                System.Diagnostics.Process pr = System.Diagnostics.Process.Start("calc.exe");
                Thread.Sleep(2000);
                //Get process name
                string processName = GetActualCalculatorProcessName();

                //Find Calculator | Windows 10
                if (IsWindows10())
                {
                    WindowsApp calculator = Host.Local.FindSingle <WindowsApp>("winapp[@processname='" + processName + "']");

                    Button button = calculator.FindSingle <Ranorex.Button>(".//button[@automationid='num2Button']");
                    button.Click();

                    button = calculator.FindSingle <Ranorex.Button>(".//button[@automationid='plusButton']");
                    button.Click();

                    button = calculator.FindSingle <Ranorex.Button>(".//button[@automationid='num3Button']");
                    button.Click();

                    button = calculator.FindSingle <Ranorex.Button>(".//button[@automationid='minusButton']");
                    button.Click();

                    button = calculator.FindSingle <Ranorex.Button>(".//button[@automationid='num3Button']");
                    button.Click();

                    button = calculator.FindSingle <Ranorex.Button>(".//button[@automationid='equalButton']");
                    button.Click();

                    Thread.Sleep(2000);
                    //Close calculator
                    calculator.As <Form>().Close();
                }
                //Find Calculator | Windows 8.X or older
                else
                {
                    Form calculator = Host.Local.FindSingle <Form>("form[@processname='" + processName + "']");

                    calculator.EnsureVisible();

                    Button button = calculator.FindSingle <Ranorex.Button>(".//button[@controlid='132']");
                    button.Click();

                    button = calculator.FindSingle <Ranorex.Button>(".//button[@controlid='92']");
                    button.Click();

                    button = calculator.FindSingle <Ranorex.Button>(".//button[@controlid='133']");
                    button.Click();

                    button = calculator.FindSingle <Ranorex.Button>(".//button[@controlid='121']");
                    button.Click();

                    //Close calculator
                    calculator.Close();
                }
            }
            catch (RanorexException e)
            {
                Console.WriteLine(e.ToString());
                error = -1;
            }

            return(error);
        }
コード例 #10
0
 public static string compileSourceCode(string strSourceCodeToExecute,string[] strReferenceAssembliesToAdd, string strPathToTempCompiledFile)
 {
     if ("" == strPathToTempCompiledFile)
         strPathToTempCompiledFile = Path.GetTempFileName();
     else
         strPathToTempCompiledFile = Path.Combine(strPathToTempCompiledFile, files.returnUniqueFileName(".tmp.cs"));
     if (strSourceCodeToExecute.Length==0)
         return "Error: Code to compile cannot be empty";
     else
     {
         utils.files.SaveFileWithStringContents(strPathToTempCompiledFile, strSourceCodeToExecute);
         string strCompilationResult = new WindowsApp().Compile(strPathToTempCompiledFile, strReferenceAssembliesToAdd);
         if ("" == strCompilationResult)
         {
             File.Delete(strPathToTempCompiledFile);
             return "Compilation OK";
         }
         else
             return strCompilationResult;
     }
 }
コード例 #11
0
 public static string compileAndExecuteFile(string strFileToExecute,string[] strReferenceAssembliesToAdd)
 {
     WindowsApp waWindowsApp = new WindowsApp();
     waWindowsApp.Run(new string[] { strFileToExecute }, strReferenceAssembliesToAdd);
     return waWindowsApp.StrCompilationErrors;
 }
コード例 #12
0
ファイル: App.cs プロジェクト: Svetomech/Svetomech.Utilities
 public static bool VerifyAutorun(string appName, string appPath) => runningWindows?
 WindowsApp.VerifyAutorun(appName, appPath) : LinuxApp.VerifyAutorun(appName, appPath);
コード例 #13
0
ファイル: App.cs プロジェクト: Svetomech/Svetomech.Utilities
 public static bool IsElevated() => runningWindows?WindowsApp.IsElevated() : LinuxApp.IsElevated();