Refresh() public method

public Refresh ( ) : void
return void
        private void startbtn_Click(object sender, RoutedEventArgs e)
        {
            ProcessStartInfo psi = new ProcessStartInfo(@"C:\q\w32\q.exe");
            psi.WindowStyle = ProcessWindowStyle.Normal;
            _process = Process.Start(psi);

            while (hWndDocked == IntPtr.Zero)
            {
                Thread.Sleep(100);
                //_process.WaitForInputIdle(1000); //wait for the window to be ready for input;
                _process.Refresh();              //update process info
                if (_process.HasExited)
                {
                    return; //abort if the process finished before we got a handle.
                }
                hWndDocked = _process.MainWindowHandle;  //cache the window handle
            }

            //SetParent(_process.MainWindowHandle, helper.Handle);
            SetParent(_process.MainWindowHandle, _panel.Handle);

            // resize embedded application & refresh
            SizeChanged += window_SizeChanged;
            ResizeEmbeddedApp();
        }
Esempio n. 2
0
 void OnGUI()
 {
     // disable everything if editor doesn't support lumin and notify user
     using (new EditorGUI.DisabledScope(!supportsLumin))
     {
         // disable controls when a process is running
         using (new EditorGUI.DisabledScope(!hasExited))
         {
             setupEnv();
             manageBuilds();
             deviceControl();
             fileManagement();
             setupTerminalWindow();
         }
         // however, supply a force quit button to kill the process in case it hangs for too long
         if (p != null)
         {
             p.Refresh();
             if ((System.DateTime.Now - p.StartTime).Seconds > 5)
             {
                 forceQuit();
             }
         }
     }
     if (!supportsLumin)
     {
         ShowNotification(new GUIContent("Lumin is not supported in this version of Unity. Please download a supported build from https://unity3d.com/partners/magicleap."));
     }
 }
        public void ShowLogViewer()
        {
            Process[] process = Process.GetProcesses();
            string MainFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
            foreach (Process proc in process)
            {

                if (proc.ProcessName.Equals("LogArchive"))
                //  Pgm_FileName 프로그램의 실행 파일[.exe]를 제외한 파일명
                {
                    isExecuting = true;
                    break;
                }

                else
                    isExecuting = false;
            }
            if (isExecuting)
            {IntPtr procHandler = FindWindow(null, "제독업무도 바빠! 기록열람");
                ShowWindow(procHandler, SW_SHOWNORMAL);
                SetForegroundWindow(procHandler);
            }
            else if(!isExecuting)
            {
                if (File.Exists(Path.Combine(MainFolder, "LogArchive.exe")))
                {
                    Process MyProcess = new Process();
                    MyProcess.StartInfo.FileName = "LogArchive.exe";
                    MyProcess.StartInfo.WorkingDirectory = MainFolder;
                    MyProcess.Start();
                    MyProcess.Refresh();
                }
            }
        }
Esempio n. 4
0
        public LSVorbis(LSSettings settings, LSPcmFeed pimp) : base()
        {
            logger = Logger.ogg;

            this.pimp     = pimp;
            this.settings = settings;
            logger.a("creating oggenc object");
            proc = new System.Diagnostics.Process();
            proc.StartInfo.FileName               = Program.tools + "oggenc2.exe";
            proc.StartInfo.WorkingDirectory       = Program.tools.Trim('\\');
            proc.StartInfo.CreateNoWindow         = true;
            proc.StartInfo.UseShellExecute        = false;
            proc.StartInfo.RedirectStandardInput  = true;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.Arguments              = string.Format(
                "-Q -R 44100 {0} {1} {2} " +               //.................target params
                "-r -F 1 -B 16 -C 2 --raw-endianness 0 -", //...source params
                (settings.ogg.compression == LSSettings.LSCompression.cbr ? "-b" : "-q"),
                (settings.ogg.compression == LSSettings.LSCompression.cbr ? settings.ogg.bitrate : settings.ogg.quality),
                (settings.ogg.channels == LSSettings.LSChannels.stereo ? "" : "--downmix"));

            if (!File.Exists(proc.StartInfo.FileName))
            {
                System.Windows.Forms.MessageBox.Show(
                    "Could not start streaming due to a missing required file:\r\n\r\n" + proc.StartInfo.FileName +
                    "\r\n\r\nThis is usually because whoever made your loopstream.exe f****d up",
                    "Shit wont fly", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                Program.kill();
            }

            logger.a("starting oggenc");
            proc.Start();
            while (true)
            {
                logger.a("waiting for oggenc");
                try
                {
                    proc.Refresh();
                    if (proc.Modules.Count > 1)
                    {
                        break;
                    }

                    logger.a("modules: " + proc.Modules.Count);
                    System.Threading.Thread.Sleep(10);
                }
                catch { }
            }

            /*foreach (System.Diagnostics.ProcessModule mod in proc.Modules)
             * {
             *  Console.WriteLine(mod.ModuleName + " // " + mod.FileName);
             * }*/
            logger.a("oggenc running");
            pstdin  = proc.StandardInput.BaseStream;
            pstdout = proc.StandardOutput.BaseStream;
            dump    = settings.recOgg;
            enc     = settings.ogg;
            makeShouter();
        }
Esempio n. 5
0
        }//end getFFHandle from a list of handles

        //Actual code which starts FF and returns the Browser Process which we started
        //Start FireFox and open the addons web page, throws an Exception if Firefox does not exist on the system
        private Process start_Firefox(int tries, int maxtries)
        {
            Process browserProc = new System.Diagnostics.Process();

            if (FirfoxExists == false)
            {
                Exception ex = new Exception(FFpathExe);
                throw ex;
            }

            browserProc.StartInfo.FileName  = FFpathExe + FFexe;
            browserProc.StartInfo.Arguments = addonURL;

            try
            {
                browserProc.Start();
                do
                {
                    Thread.Sleep(100);
                    browserProc.Refresh();
                } while (browserProc.MainWindowHandle == IntPtr.Zero && !browserProc.HasExited);

                return(browserProc);
            }
            catch (System.ComponentModel.Win32Exception ex)
            {
                Console.WriteLine("FF is not installed at the specified location or it is not installed in the system.");
                Console.WriteLine(ex.Message);
                return(null);

#if (EXCEPTION)
                {
                    throw ex;
                }
#endif
            }//end catch
            catch (SystemException ex)
            {
                Console.WriteLine(ex.Message);
                if (tries > maxtries)
                {
                    throw ex;
                }
                try
                {
                    Process FFprocess = null;
                    FFprocess = getFFProcess();
                    if (FFprocess != null)
                    {
                        killFF(FFprocess);
                    }
                    return(start_Firefox(tries + 1, maxtries));
                }
                catch (System.InvalidOperationException e)
                {
                    Console.WriteLine("Could not start the Process" + e.ToString());
                    return(null);
                }
            }
        }
Esempio n. 6
0
        public static bool executeProcessWithParams(string stringPathToFileToExecute,string stringArguments,bool bShowCmdWindow, ref bool bCancelProcessExecution)
        {
            bCancelProcessExecution = false;
            try
            {
                Process pProcess = new Process();

                pProcess.StartInfo.Arguments = stringArguments;
                pProcess.StartInfo.FileName = stringPathToFileToExecute;
                if (bShowCmdWindow)
                    pProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                else
                    pProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                pProcess.Start();
                while (! pProcess.HasExited)
                {
                    pProcess.Refresh();
                    Thread.Sleep(100);
                    Application.DoEvents();
                    if (bCancelProcessExecution)
                    {
                        pProcess.Kill();
                        MessageBox.Show("Process execution canceled");
                        return false;
                    }
                }
                return true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return false;
            }
        }
Esempio n. 7
0
 /// <summary>
 /// 不创建文件打开记事本显示自定义内容
 /// </summary>
 /// <param name="txtValue">内容</param>
 public static void OpenNotepad(string txtValue)
 {
     System.Diagnostics.Process Proc;
     try
     {
         // 新建进程
         Proc = new System.Diagnostics.Process();
         Proc.StartInfo.FileName               = "notepad.exe";
         Proc.StartInfo.UseShellExecute        = false;
         Proc.StartInfo.RedirectStandardInput  = true;
         Proc.StartInfo.RedirectStandardOutput = true;
         Proc.Start();
     }
     catch (Exception msg)
     {
         Proc = null;
         Log.LogWrite(msg);
     }
     if (Proc != null)
     {
         // 调用 API, 传递数据
         while (Proc.MainWindowHandle == IntPtr.Zero)
         {
             Proc.Refresh();
         }
         IntPtr vHandle = FindWindowEx(Proc.MainWindowHandle, IntPtr.Zero, "Edit", null);
         // 传递数据给记事本
         SendMessage(vHandle, WM_SETTEXT, 0, txtValue);
     }
 }
Esempio n. 8
0
        static void Main(string[] args)
        {
            Process currentProcess = new Process();
            currentProcess = Process.GetCurrentProcess();

            CodeGenerator codeGen = new CodeGenerator();
            codeGen.fileWriter();

            // generating intercept.cpp and stdafx.h
            InterceptCodeGenerator interceptCodeGen = new InterceptCodeGenerator();
            interceptCodeGen.GenerateInterceptsFile();

            /// include code here to build project i.e compiling *.cpp file created
            RegistryKey localMachineHive = Registry.LocalMachine;
            // Open the subkey...
            RegistryKey pathLocationKey = localMachineHive.OpenSubKey( "SOFTWARE\\HolodeckEE" );

            string functionXMLFile = (string)pathLocationKey.GetValue( "InstallPath" ) + "\\function_db\\functions.xml";
            string holodeckFunctionDBPath = (string)pathLocationKey.GetValue( "InstallPath" ) + "\\function_db";

            string Win32CodeGeneratorDumpDirPath = string.Concat(holodeckFunctionDBPath,"\\Win32CodeGeneratorDump");

            if (!Directory.Exists(Win32CodeGeneratorDumpDirPath))
            {
                DirectoryInfo di = Directory.CreateDirectory(Win32CodeGeneratorDumpDirPath);
            }

            string common_h_FilePath = string.Concat(holodeckFunctionDBPath,"\\common.h");
            string buildWin32InterceptFunction_cmd_FilePath = string.Concat(holodeckFunctionDBPath,"\\buildWin32InterceptFunction.cmd");

            FileInfo FileToCopy = new FileInfo(common_h_FilePath);
            FileToCopy.CopyTo(string.Concat(Win32CodeGeneratorDumpDirPath,"\\common.h"),true);

            FileToCopy = new FileInfo(buildWin32InterceptFunction_cmd_FilePath);
            FileToCopy.CopyTo(string.Concat(Win32CodeGeneratorDumpDirPath,"\\buildWin32InterceptFunction.cmd"),true);

            currentProcess.Close();
            currentProcess.Refresh();

            Process compileProcess = new Process();
            compileProcess.StartInfo.FileName = string.Concat(Win32CodeGeneratorDumpDirPath,"\\buildWin32InterceptFunction.cmd");
            compileProcess.StartInfo.CreateNoWindow = true;
            compileProcess.Start();

            //launching AUT
            Holodeck.HolodeckProcess.Start();
            Holodeck.HolodeckPane.Reset();
            Holodeck.HolodeckPane.File_NewProject();
            Holodeck.NewProjectPane1.Reset();
            Holodeck.NewProjectPane1.SetProjectLocation(@"c:\Win32InterceptGen");
            Holodeck.NewProjectPane1.Next();
            Holodeck.NewProjectPane2.Reset();
            Holodeck.NewProjectPane2.SetApplicationName(string.Concat(Win32CodeGeneratorDumpDirPath,"\\FunctionIntercepts.exe"));
            Holodeck.NewProjectPane2.Next();
            Holodeck.NewProjectPane3.Reset();
            Holodeck.NewProjectWizard.NativeFunctions("All");
            Holodeck.NewProjectWizard.NetFunctions("All");
            Holodeck.NewProjectPane3.Finish();
        }
Esempio n. 9
0
        public LSVorbis(LSSettings settings, LSPcmFeed pimp)
            : base()
        {
            logger = Logger.ogg;

            this.pimp = pimp;
            this.settings = settings;
            logger.a("creating oggenc object");
            proc = new System.Diagnostics.Process();
            proc.StartInfo.FileName = Program.tools + "oggenc2.exe";
            proc.StartInfo.WorkingDirectory = Program.tools.Trim('\\');
            proc.StartInfo.CreateNoWindow = true;
            proc.StartInfo.UseShellExecute = false;
            proc.StartInfo.RedirectStandardInput = true;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.Arguments = string.Format(
                "-Q -R 44100 {0} {1} {2} " + //.................target params
                "-r -F 1 -B 16 -C 2 --raw-endianness 0 -", //...source params
                (settings.ogg.compression == LSSettings.LSCompression.cbr ? "-b" : "-q"),
                (settings.ogg.compression == LSSettings.LSCompression.cbr ? settings.ogg.bitrate : settings.ogg.quality),
                (settings.ogg.channels == LSSettings.LSChannels.stereo ? "" : "--downmix"));

            if (!File.Exists(proc.StartInfo.FileName))
            {
                System.Windows.Forms.MessageBox.Show(
                    "Could not start streaming due to a missing required file:\r\n\r\n" + proc.StartInfo.FileName +
                    "\r\n\r\nThis is usually because whoever made your loopstream.exe f****d up",
                    "Shit wont fly", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                Program.kill();
            }

            logger.a("starting oggenc");
            proc.Start();
            while (true)
            {
                logger.a("waiting for oggenc");
                try
                {
                    proc.Refresh();
                    if (proc.Modules.Count > 1) break;

                    logger.a("modules: " + proc.Modules.Count);
                    System.Threading.Thread.Sleep(10);
                }
                catch { }
            }
            /*foreach (System.Diagnostics.ProcessModule mod in proc.Modules)
            {
                Console.WriteLine(mod.ModuleName + " // " + mod.FileName);
            }*/
            logger.a("oggenc running");
            pstdin = proc.StandardInput.BaseStream;
            pstdout = proc.StandardOutput.BaseStream;
            dump = settings.recOgg;
            enc = settings.ogg;
            makeShouter();
        }
Esempio n. 10
0
        public LSLame(LSSettings settings, LSPcmFeed pimp)
        {
            logger = Logger.mp3;

            this.pimp     = pimp;
            this.settings = settings;
            logger.a("creating lame object");
            proc = new System.Diagnostics.Process();
            proc.StartInfo.FileName               = Program.tools + "lame.exe";
            proc.StartInfo.WorkingDirectory       = Program.tools.Trim('\\');
            proc.StartInfo.CreateNoWindow         = true;
            proc.StartInfo.UseShellExecute        = false;
            proc.StartInfo.RedirectStandardInput  = true;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.Arguments              = string.Format(
                "{0} {1} -h -m {2} --noreplaygain -S " +                //..................target params
                "-r -s {3} --bitwidth 16 --signed --little-endian - -", //...source params
                (settings.mp3.compression == LSSettings.LSCompression.cbr ? "--preset cbr" : "-V"),
                (settings.mp3.compression == LSSettings.LSCompression.cbr ? settings.mp3.bitrate : settings.mp3.quality),
                (settings.mp3.channels == LSSettings.LSChannels.stereo ? "j" : "s -a"),
                settings.samplerate);

            if (!File.Exists(proc.StartInfo.FileName))
            {
                System.Windows.Forms.MessageBox.Show(
                    "Could not start streaming due to a missing required file:\r\n\r\n" + proc.StartInfo.FileName +
                    "\r\n\r\nThis is usually because whoever made your loopstream.exe f****d up",
                    "Shit wont fly", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                Program.kill();
            }

            logger.a("starting lame");
            proc.Start();
            while (true)
            {
                logger.a("waiting for lame");
                try
                {
                    proc.Refresh();
                    if (proc.Modules.Count > 1)
                    {
                        break;
                    }

                    logger.a("modules: " + proc.Modules.Count);
                    System.Threading.Thread.Sleep(10);
                }
                catch { }
            }
            logger.a("lame running");
            pstdin  = proc.StandardInput.BaseStream;
            pstdout = proc.StandardOutput.BaseStream;
            dump    = settings.recMp3;
            enc     = settings.mp3;
            makeShouter();
        }
Esempio n. 11
0
        public LSOpus(LSSettings settings, LSPcmFeed pimp) : base()
        {
            logger = Logger.opus;

            this.pimp     = pimp;
            this.settings = settings;
            logger.a("creating opusenc object");
            proc = new System.Diagnostics.Process();
            proc.StartInfo.FileName               = Program.tools + "opusenc.exe";
            proc.StartInfo.WorkingDirectory       = Program.tools.Trim('\\');
            proc.StartInfo.CreateNoWindow         = true;
            proc.StartInfo.UseShellExecute        = false;
            proc.StartInfo.RedirectStandardInput  = true;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.Arguments              = string.Format(
                "--quiet --bitrate {1} --raw --raw-rate {0} {2} - -",
                settings.samplerate,
                settings.opus.quality,
                (settings.opus.channels == LSSettings.LSChannels.stereo ? "--downmix-stereo" : "--downmix-mono"));

            if (!File.Exists(proc.StartInfo.FileName))
            {
                System.Windows.Forms.MessageBox.Show(
                    "Could not start streaming due to a missing required file:\r\n\r\n" + proc.StartInfo.FileName +
                    "\r\n\r\nThis is usually because whoever made your loopstream.exe f****d up",
                    "Shit wont fly", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                Program.kill();
            }

            logger.a("starting opusenc");
            proc.Start();
            while (true)
            {
                logger.a("waiting for opusenc");
                try
                {
                    proc.Refresh();
                    if (proc.Modules.Count > 1)
                    {
                        break;
                    }

                    logger.a("modules: " + proc.Modules.Count);
                    System.Threading.Thread.Sleep(10);
                }
                catch { }
            }
            logger.a("opusenc running");
            pstdin  = proc.StandardInput.BaseStream;
            pstdout = proc.StandardOutput.BaseStream;
            dump    = settings.recOpus;
            enc     = settings.opus;
            makeShouter();
        }
Esempio n. 12
0
 void CloseApplication(Process process, bool force) {
     int num = force ? 1 : 0x2710;
     DateTime now = DateTime.Now;
     TimeSpan zero = TimeSpan.Zero;
     bool flag = false;
     IntPtr ptr = IntPtr.Zero;
     while (zero.TotalMilliseconds < num){
         Trace.WriteLine(DateTime.Now + "\tCall Process.Refresh() at WinApplicationAdapter.CloseApplication");
         process.Refresh();
         Trace.WriteLine(DateTime.Now + "\tCall Process.Refresh() success");
         Trace.WriteLine(DateTime.Now +"\tCall Process.MainWindowHandle at WinApplicationAdapter.CloseApplication");
         IntPtr mainWindowHandle = IntPtr.Zero;
         try{
             mainWindowHandle = process.MainWindowHandle;
         }
         catch (InvalidOperationException){
         }
         if ((mainWindowHandle != ptr) && (mainWindowHandle != IntPtr.Zero)){
             ptr = mainWindowHandle;
             try{
                 process.CloseMainWindow();
             }
             catch (Exception exception){
                 Logger.Instance.AddMessage(string.Format("Process{0}.CloseMainWindow return error:\n'{1}'",process.ProcessName, exception.Message));
             }
         }
         Trace.WriteLine(DateTime.Now + "\tCall Process.MainWindowHandle success");
         try{
             if (process.WaitForExit(Math.Min(0x3e8, num - ((int) zero.TotalMilliseconds)))){
                 flag = true;
                 break;
             }
         }
         catch (Exception exception2){
             Logger.Instance.AddMessage(string.Format("Process.WaitForExit return error:\n'{0}'",exception2.Message));
         }
         zero = DateTime.Now - now;
     }
     if (!flag){
         if (!force){
             Logger.Instance.AddMessage(string.Format("The process '{0}' was not closed in '{1}' millisecond after the Process.CloseMainWindow was invoked, trying to kill this process",process.ProcessName, num));
         }
         try{
             process.Kill();
         }
         catch (Exception exception3){
             Logger.Instance.AddMessage(string.Format("Process name: '{0}' is not killed.\nReason:\n'{1}'",process.ProcessName, exception3.Message));
         }
         if (!process.WaitForExit(0x2710)){
             throw new WarningException(
                 string.Format("Process name: '{0}' doesn't exited in 10 seconds after the Process.Kill was invoked",process.ProcessName));
         }
     }
 }
        /// <summary>
        /// Finds the main window of the given process and returns its window handle.
        /// </summary>
        /// <param name="processname"></param>
        /// <exception cref="System.Exception"></exception>
        /// <returns></returns>
        public IntPtr FindMainWindowHandleOfProcess(Process p)
        {
            p.Refresh();
            if (p.HasExited)
                throw new ArgumentException("The process has exited.");

            IntPtr hWnd = p.MainWindowHandle;
            if (hWnd == IntPtr.Zero)
                throw new ArgumentException("Could not find Main Window.");

            return hWnd;
        }
Esempio n. 14
0
        static void WaitForFinish(string callDescription, Process proc)
        {
            if (proc.WaitForExit((int)TimeSpan.FromSeconds(20).TotalMilliseconds)) return;

            proc.Refresh();
            LogOutput.Log.Warning("Call taking a long time, will abort in 2 minutes: " + callDescription);
            if (!proc.WaitForExit((int)TimeSpan.FromMinutes(2).TotalMilliseconds))
            {
                LogOutput.Log.Error("ABORTING LONG CALL: " + callDescription);
                // ReSharper disable EmptyGeneralCatchClause
                try
                {
                    proc.Kill();
                    proc.Refresh();
                }
                catch
                {
                }
                // ReSharper restore EmptyGeneralCatchClause
            }
        }
Esempio n. 15
0
        public ClientMC(Process p)
        {
            process = p;
            process.WaitForInputIdle();

            while (process.MainWindowHandle == IntPtr.Zero)
            {
                process.Refresh();
                System.Threading.Thread.Sleep(5);
            }
            processHandle = WinApi.OpenProcess(WinApi.PROCESS_ALL_ACCESS, 0, (uint)process.Id);
        }
Esempio n. 16
0
    public override IEnumerator LoadScenes([ValueSource(nameof(GetVDBScenes))] string scenePath)
    {
        var vdbProcess = new System.Diagnostics.Process();

        // Close any existing instances of the VDB and make a new one
        {
            string vdbExe         = System.IO.Path.GetFullPath("Packages/com.havok.physics/Tools/VisualDebugger/HavokVisualDebugger.exe");
            string vdbProcessName = System.IO.Path.GetFileNameWithoutExtension(vdbExe);

            List <System.Diagnostics.Process> processes = new List <System.Diagnostics.Process>();
            processes.AddRange(System.Diagnostics.Process.GetProcessesByName(vdbProcessName));
            foreach (var process in processes)
            {
                process.CloseMainWindow();
                process.Close();
            }

            vdbProcess.StartInfo.FileName  = vdbExe;
            vdbProcess.StartInfo.Arguments = "";
            vdbProcess.Start();
            vdbProcess.WaitForInputIdle();
            // How do we ensure the VDB is ready to connect?
            yield return(new WaitForSeconds(2));

            vdbProcess.Refresh();
        }

        var havokConfig = HavokConfiguration.Default;

        // Enabled VDB
        havokConfig.VisualDebugger.Enable = 1;
        yield return(SetupAndLoadScene(World.DefaultGameObjectInjectionWorld, havokConfig, scenePath));

        // Disabled VDB
        havokConfig.VisualDebugger.Enable = 0;
        yield return(SetupAndLoadScene(World.DefaultGameObjectInjectionWorld, havokConfig, scenePath));

        // Enabled VDB with zero Timer memory
        havokConfig.VisualDebugger.Enable = 1;
        havokConfig.VisualDebugger.TimerBytesPerThread = 0;
        yield return(SetupAndLoadScene(World.DefaultGameObjectInjectionWorld, havokConfig, scenePath));

        // Close VDB client
        vdbProcess.CloseMainWindow();
        vdbProcess.Close();

        // Enabled VDB with no Client running.
        havokConfig = HavokConfiguration.Default;
        havokConfig.VisualDebugger.Enable = 1;
        yield return(SetupAndLoadScene(World.DefaultGameObjectInjectionWorld, havokConfig, scenePath));

        LogAssert.NoUnexpectedReceived();
    }
Esempio n. 17
0
        public LSLame(LSSettings settings, LSPcmFeed pimp)
        {
            logger = Logger.mp3;

            this.pimp = pimp;
            this.settings = settings;
            logger.a("creating lame object");
            proc = new System.Diagnostics.Process();
            proc.StartInfo.FileName = Program.tools + "lame.exe";
            proc.StartInfo.WorkingDirectory = Program.tools.Trim('\\');
            proc.StartInfo.CreateNoWindow = true;
            proc.StartInfo.UseShellExecute = false;
            proc.StartInfo.RedirectStandardInput = true;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.Arguments = string.Format(
                "{0} {1} -h -m {2} --noreplaygain -S " + //..................target params
                "-r -s {3} --bitwidth 16 --signed --little-endian - -", //...source params
                (settings.mp3.compression == LSSettings.LSCompression.cbr ? "--preset cbr" : "-V"),
                (settings.mp3.compression == LSSettings.LSCompression.cbr ? settings.mp3.bitrate : settings.mp3.quality),
                (settings.mp3.channels == LSSettings.LSChannels.stereo ? "j" : "s -a"),
                settings.samplerate);

            if (!File.Exists(proc.StartInfo.FileName))
            {
                System.Windows.Forms.MessageBox.Show(
                    "Could not start streaming due to a missing required file:\r\n\r\n" + proc.StartInfo.FileName +
                    "\r\n\r\nThis is usually because whoever made your loopstream.exe f****d up",
                    "Shit wont fly", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                Program.kill();
            }

            logger.a("starting lame");
            proc.Start();
            while (true)
            {
                logger.a("waiting for lame");
                try
                {
                    proc.Refresh();
                    if (proc.Modules.Count > 1) break;

                    logger.a("modules: " + proc.Modules.Count);
                    System.Threading.Thread.Sleep(10);
                }
                catch { }
            }
            logger.a("lame running");
            pstdin = proc.StandardInput.BaseStream;
            pstdout = proc.StandardOutput.BaseStream;
            dump = settings.recMp3;
            enc = settings.mp3;
            makeShouter();
        }
Esempio n. 18
0
        protected WindowInfoWithHandle LaunchSampleApplication()
        {
            var proc = new System.Diagnostics.Process();

            proc.StartInfo.FileName = @"c:\Windows\System32\notepad.exe";
            proc.Start();
            proc.WaitForInputIdle();
            proc.Refresh();

            //Debug.WriteLine(proc.MainWindowHandle);

            var windowInfoWithHandle = new WindowInfoWithHandle(proc.MainWindowHandle);

            return(windowInfoWithHandle);
        }
 public static void SetWindowPosition(Process process, int x, int y, int width, int height)
 {
     IntPtr p = IntPtr.Zero;
     while (p == IntPtr.Zero)
     {
         // process.WaitForInputIdle(100); //wait for the window to be ready for input;
         process.Refresh();              //update process info
         if (process.HasExited)
         {
             return; //abort if the process finished before we got a handle.
         }
         p = process.MainWindowHandle;  //cache the window handle
     }
     SetWindowPos(p, 0, x, y, width, height, SWP_SHOWWINDOW);
 }
Esempio n. 20
0
        private static void RunMongo(string script)
        {
            var psi = new ProcessStartInfo("mongo", string.Format("--norc --eval \"{0}\" test", script))
                          {
                              UseShellExecute = false,
                              CreateNoWindow = true,
                              RedirectStandardOutput = true,
                              RedirectStandardError = true
                          };

            var process = new Process
                              {
                                  StartInfo = psi,
                                  EnableRaisingEvents = true
                              };

            var stdOut = new StringBuilder();
            var stdErr = new StringBuilder();

            Action<StringBuilder, string> handleLine = (builder, line) =>
            {
                if (line == null)
                    return;
                builder.AppendLine(line);
            };

            process.OutputDataReceived += (obj, e) => handleLine(stdOut, e.Data);
            process.ErrorDataReceived += (obj, e) => handleLine(stdErr, e.Data);

            process.Start();
            process.BeginErrorReadLine();
            process.BeginOutputReadLine();
            do
            {
                process.WaitForExit(100);
                process.Refresh();
            } while (!process.HasExited);

            process.WaitForExit();
            var infoOutput = stdOut.ToString();
            var errorOutput = stdErr.ToString();
            var exitCode = process.ExitCode;

            if (exitCode > 0)
            {
                throw new Exception(string.Format("Mongo exited with code {0}", exitCode));
            }
        }
Esempio n. 21
0
        public double snap()
        {
            double   oldt = tt;
            DateTime oldc = wc; p.Refresh();

            tt     = p.TotalProcessorTime.TotalMilliseconds - stt;
            deltat = tt - oldt;
            ws     = p.WorkingSet64 - sws;
            vm     = p.VirtualMemorySize64 - svm;
            wc     = DateTime.Now;

            TimeSpan x = oldc.Subtract(wc);

            deltac = -x.TotalMilliseconds;
            return(deltac);
        }
Esempio n. 22
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            p = System.Diagnostics.Process.Start(ofd.FileName);

            //念のため待つ。
            p.WaitForInputIdle();

            //ウィンドウハンドルが取得できるか、
            //生成したプロセスが終了するまで待ってみる。
            while (p.MainWindowHandle == IntPtr.Zero &&
            p.HasExited == false)
            {
                System.Threading.Thread.Sleep(1);
                p.Refresh();
            }
        }
Esempio n. 23
0
        private int GetMainWindowHandle(Process proc)
        {
            proc.Refresh();
            var timestamp = DateTime.Now;
            while (true)
            {
                if (proc.MainWindowHandle != IntPtr.Zero)
                    return proc.MainWindowHandle.ToInt32();

                if (DateTime.Now.Subtract(timestamp).TotalSeconds > 60)
                {
                    throw new TimeoutException("Can't find main window");
                }
                Thread.Sleep(250);
            }
        }
Esempio n. 24
0
        public static bool scanJava(Process p)
        {
            p.Refresh();
            try
            {
                if (p.HasExited)
                {
                    return false;
                }
            }
            catch (Exception)
            {
                return false;
            }
            //Console.WriteLine("Scanning " + p.ProcessName);
            IntPtr Addy = new IntPtr();
            List<MEMORY_BASIC_INFORMATION> MemReg = new List<MEMORY_BASIC_INFORMATION>();
            while (true)
            {
                MEMORY_BASIC_INFORMATION MemInfo = new MEMORY_BASIC_INFORMATION();
                int MemDump = VirtualQueryEx(p.Handle, Addy, out  MemInfo, Marshal.SizeOf(MemInfo));
                if (MemDump == 0) break;
                if (0 != (MemInfo.State & MEM_COMMIT) && 0 != (MemInfo.Protect & WRITABLE) && 0 == (MemInfo.Protect & PAGE_GUARD))
                {
                    MemReg.Add(MemInfo);
                }
                Addy = new IntPtr(MemInfo.BaseAddress.ToInt64() + MemInfo.RegionSize.ToInt64());
            }

            for (int i = 0; i < MemReg.Count; i++)
            {
                byte[] buff = new byte[MemReg[i].RegionSize.ToInt32()];
                ReadProcessMemory(p.Handle, MemReg[i].BaseAddress, buff, MemReg[i].RegionSize.ToInt32(), IntPtr.Zero);

                long Result = IndexOf(buff, javameter);
                if (Result > 0)
                {
                    buff = null;
                    GC.Collect();
                    return true;
                }
                buff = null;
            }
            GC.Collect();
            return false;
        }
Esempio n. 25
0
    public static void SetWindowPosition(int x, int y, int sizeX = 0, int sizeY = 0)
    {
        System.Diagnostics.Process process = System.Diagnostics.Process.GetCurrentProcess();
        process.Refresh();

        EnumWindows(delegate(System.IntPtr wnd, System.IntPtr param)
        {
            int id;
            GetWindowThreadProcessId(wnd, out id);
            if (id == process.Id)
            {
                SetWindowPos(wnd, 0, x, y, sizeX, sizeY, sizeX * sizeY == 0 ? 1 : 0);
                return(false);
            }

            return(true);
        }, System.IntPtr.Zero);
    }
        public static IDisposable Explore(this DirectoryInfo directory)
        {
            var process = new Process
            {
                StartInfo = new ProcessStartInfo("explorer", directory.FullName)
            };

            process.Start();

            return new DisposableAction(()=>
            {
                process.Refresh();

                if(!process.HasExited)
                {
                    process.Kill();
                }
            });
        }
Esempio n. 27
0
        private void Open()
        {
            Cleanup();

            var loc  = @"%ProgramFiles(x86)%\Bethesda.net Launcher";
            var path = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Bethesda Softworks\Bethesda.net",
                                                 "installLocation", loc);

            var proc = new System.Diagnostics.Process
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName        = $@"{(string.IsNullOrWhiteSpace(path) ? loc : path)}\{Proc}.exe",
                    CreateNoWindow  = true,
                    UseShellExecute = false,
                    WindowStyle     = ProcessWindowStyle.Hidden
                }
            };

            proc.Start();
            while (string.IsNullOrEmpty(proc.MainWindowTitle))
            {
                Task.Delay(100).Wait();
                proc.Refresh();
            }

            var procs = System.Diagnostics.Process.GetProcessesByName(Proc);

            if (procs.Length == 0)
            {
                throw new Exception("BNL processes were not found!");
            }

            var statuses = GetProcessStatuses();

            foreach (var p in procs)
            {
                Win32.ShowWindow(p.MainWindowHandle, 2);
                _pStatus.Add(p, statuses[p.Id]);
            }
        }
Esempio n. 28
0
        static void Main(string[] args)
        {
            using (System.Diagnostics.Process p = new System.Diagnostics.Process())
            {
                //Set Window Title Based on Current if Value is currently in use or not
                while (WinGetHandle(GetCurrentWindowTitle()) != IntPtr.Zero)
                {
                    windowTitleNum++;
                }

                p.StartInfo = new System.Diagnostics.ProcessStartInfo()
                {
                    FileName         = @"eqgame.exe",
                    Arguments        = @"patchme",
                    WorkingDirectory = System.Configuration.ConfigurationManager.AppSettings["EqDirectory"]
                };
                string window_title = GetCurrentWindowTitle();

                //Set HotKey Based on Window Number
                if (GetHotkey() != Keys.None)
                {
                    HotKeyManager.RegisterHotKey(GetHotkey(), GetKeyMod());
                    HotKeyManager.HotKeyPressed += new EventHandler <HotKeyEventArgs>(HotKeyManager_HotKeyPressed);
                }

                p.Start();
                System.Threading.SpinWait.SpinUntil(() => p.HasExited || p.MainWindowHandle != IntPtr.Zero);
                windowHandle = p.MainWindowHandle;
                while (!p.HasExited)
                {
                    p.Refresh();
                    if (p.MainWindowTitle != GetCurrentWindowTitle())
                    {
                        SetWindowText(p.MainWindowHandle, window_title);
                    }
                    Thread.Sleep(100);
                }
                p.WaitForExit();
            }
        }
Esempio n. 29
0
        public void Start()
        {
            var process      = new System.Diagnostics.Process();
            var explorerPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "explorer.exe");

            logger.Debug("Starting explorer shell process...");

            process.StartInfo.CreateNoWindow = true;
            process.StartInfo.FileName       = explorerPath;
            process.Start();

            logger.Debug("Waiting for explorer shell to initialize...");

            while (nativeMethods.GetShellWindowHandle() == IntPtr.Zero)
            {
                Thread.Sleep(20);
            }

            process.Refresh();
            logger.Info($"Explorer shell successfully started with PID = {process.Id}.");
            process.Close();
        }
Esempio n. 30
0
        private static bool CheckInjectedStatus(Process process)
        {
            bool containsFile = false;
            process.Refresh();
            foreach (ProcessModule module in process.Modules)
            {
                if (module.FileName.Contains("ManagedInjector"))
                {
                    containsFile = true;
                }
            }
            if (containsFile)
            {
                Injector.LogMessage(string.Format("Successfully injected Snoop for process {0} (PID = {1})", process.ProcessName, process.Id), true);
            }
            else
            {
                Injector.LogMessage(string.Format("Failed to inject for process {0} (PID = {1})", process.ProcessName, process.Id), true);
            }

            return containsFile;
        }
Esempio n. 31
0
        private static bool CheckInjectedStatus(Process process)
        {
            var log = SimpleLogManager.GetLogger(typeof(Program), "CheckInjectedStatus");

            var containsFile = false;
            process.Refresh();
            foreach (ProcessModule module in process.Modules)
            {
                if (module.FileName.Contains("HawkeyeInjector"))
                {
                    containsFile = true;
                    break;
                }
            }

            if (containsFile) log.Info(string.Format(
                "Successfully injected Hawkeye for process {0} (PID = {1})", process.ProcessName, process.Id));
            else log.Error(string.Format(
                "Failed to inject for process {0} (PID = {1})", process.ProcessName, process.Id));

            return containsFile;
        }
Esempio n. 32
0
        private static bool GenerateTTS(string phrase, string outPath, ILogger log, ExecutionContext context)
        {
            string directory = context.FunctionAppDirectory;
            string lib       = Path.Combine(directory, "lib");
            string exePath   = Path.Combine(lib, "say.exe");

            foreach (var str in Directory.GetFiles(lib))
            {
                log.LogDebug("1 " + str);
            }

            try
            {
                System.Diagnostics.Process process = new System.Diagnostics.Process();
                process.StartInfo.FileName               = exePath;
                process.StartInfo.UseShellExecute        = false;
                process.StartInfo.CreateNoWindow         = true;
                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.RedirectStandardError  = true;
                process.StartInfo.Arguments              = $"-w out.wav \"{phrase}\"";
                process.StartInfo.WorkingDirectory       = lib;
                process.StartInfo.WindowStyle            = ProcessWindowStyle.Minimized;

                process.EnableRaisingEvents = true;
                process.Refresh();
                process.Start();
                string output = process.StandardOutput.ReadToEnd();
                string error  = process.StandardError.ReadToEnd();
                bool   exited = process.WaitForExit(3000);
                log.LogInformation("received output: " + output);
                log.LogError("received error: " + error);
                return(exited);
            }
            catch (Exception ex)
            {
                log.LogError(ex.ToString());
                return(false);
            }
        }
 private static bool WaitForExit(Process process, TimeSpan timeout)
 {
     var hasExited = false;
     var dt = DateTime.UtcNow;
     while (DateTime.UtcNow - dt < timeout)
     {
         try
         {
             process.Refresh();
             hasExited = process.HasExited;
         }
         catch (InvalidOperationException)
         {
             // ignored
         }
         catch (System.ComponentModel.Win32Exception)
         {
             // ignored
         }
         Thread.Sleep(0);
     }
     return hasExited;
 }
        public override List<AutomationElement> LaunchApp(string applicationName, string processName)
        {
            ApplicationProcessName = processName;
            StateDiagnosis.Instance.StartDiagnosis(this);
            List<AutomationElement> aeList = new List<AutomationElement>();

            try
            {
                ProcessStartInfo startInfo = new ProcessStartInfo(applicationName);
                startInfo.WorkingDirectory = Path.GetDirectoryName(applicationName);
                startInfo.UseShellExecute = false;

                targetProcess = Process.Start(startInfo);
                int runningTime = 0;
                while (targetProcess.MainWindowHandle.Equals(IntPtr.Zero))
                {
                    if (runningTime > MAXTIME)
                        throw new Exception("Could not find " + applicationName);

                    Thread.Sleep(TIMEWAIT);
                    runningTime += TIMEWAIT;

                    targetProcess.Refresh();
                }


                AutomationElement aeWindow = AutomationElement.FromHandle(targetProcess.MainWindowHandle);
                StateDiagnosis.Instance.StopDiagnosis(this);
                aeList.Add(aeWindow);
                return aeList;
            }
            catch (Exception)
            {
                UnloadApp(targetProcess);
                return null;
            }
        }
        private void LaunchChildProcess(object sender, RoutedEventArgs e)
        {
            ProcessStartInfo psi = new ProcessStartInfo(@"C:\q\w32\q.exe");
            psi.WindowStyle = ProcessWindowStyle.Normal;
            _process = Process.Start(psi);

            //_process.WaitForInputIdle();

            //var helper = new WindowInteropHelper(this);

            while (hWndDocked == IntPtr.Zero)
            {
                Thread.Sleep(100);
                //_process.WaitForInputIdle(1000); //wait for the window to be ready for input;
                _process.Refresh();              //update process info
                if (_process.HasExited)
                {
                    return; //abort if the process finished before we got a handle.
                }
                hWndDocked = _process.MainWindowHandle;  //cache the window handle
            }

            //SetParent(_process.MainWindowHandle, helper.Handle);
            SetParent(_process.MainWindowHandle, _panel.Handle);

            /*
            // remove control box
            int style = GetWindowLong(_process.MainWindowHandle, GWL_STYLE);
            style = style & ~WS_CAPTION & ~WS_THICKFRAME;
            SetWindowLong(_process.MainWindowHandle, GWL_STYLE, style);
            */

            // resize embedded application & refresh
            SizeChanged += window_SizeChanged;
            ResizeEmbeddedApp();
        }
Esempio n. 36
0
        /// <summary>
        /// Main constructor
        /// </summary>
        /// <param name="p">the client's process object</param>
        public Client(Process p)
        {
            process = p;
            process.Exited += new EventHandler(process_Exited);
            process.EnableRaisingEvents = true;

            // Wait until we can really access the process
            process.WaitForInputIdle();

            while (process.MainWindowHandle == IntPtr.Zero)
            {
                process.Refresh();
                System.Threading.Thread.Sleep(5);
            }

            // Save a copy of the handle so the process doesn't have to be opened
            // every read/write operation
            processHandle = Util.WinApi.OpenProcess(Util.WinApi.PROCESS_ALL_ACCESS, 0, (uint)process.Id);

            pathFinder = new Tibia.Util.AStarPathFinder(this);
            contextMenu = new ContextMenu(this);

            memory = new MemoryHelper(this);
            window = new WindowHelper(this);
            io = new IOHelper(this);
            login = new LoginHelper(this);
            dll = new DllHelper(this);
            input = new InputHelper(this);
            player = new PlayerHelper(this);

            icon = new Icon(this);
            skin = new Skin(this);

            // Save the start time (it isn't changing)
            startTime = Memory.ReadInt32(Addresses.Client.StartTime);
        }
Esempio n. 37
0
        /// <summary>
        /// Main constructor
        /// </summary>
        /// <param name="p">the client's process object</param>
        public Client(Process p)
        {
            process = p;
            process.Exited += new EventHandler(process_Exited);
            process.EnableRaisingEvents = true;

            // Wait until we can really access the process
            process.WaitForInputIdle();

            while (process.MainWindowHandle == IntPtr.Zero)
            {
                process.Refresh();
                System.Threading.Thread.Sleep(5);
            }

            // Save a copy of the handle so the process doesn't have to be opened
            // every read/write operation
            processHandle = Util.WinApi.OpenProcess(Util.WinApi.PROCESS_ALL_ACCESS, 0, (uint)process.Id);

            memory = new MemoryHelper(this);
            window = new WindowHelper(this);
            login = new LoginHelper(this);
            input = new InputHelper(this);
        }
Esempio n. 38
0
        private void launchTrainer()
        {
            //MessageBox.Show("DEBUG: Launching Trainer - Dir:" + trainerDir);
            try
            {
                /*foreach (var file in Directory.GetFiles(trainerDir, "*.exe", SearchOption.AllDirectories))
                {
                    try
                    {
                        Microsoft.Win32.RegistryKey key;
                        key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers");
                        key.SetValue(file, "RUNASADMIN");
                        key.Close();
                    }
                    catch
                    {
                        //MessageBox.Show("ERROR: Cannot add admin privileges to program " + Path.GetFileName(file));
                    }
                }*/
                foreach (var file in Directory.GetFiles(trainerDir, "*trainer*.exe", SearchOption.AllDirectories))
                {
                    //ProcessStartInfo info = new ProcessStartInfo(file);
                    //info.UseShellExecute = true;
                    //info.Verb = "runas";
                    //Process.Start(info);
                    //try
                    //{
                    if (tProc != null) //close old trainer
                    {
                        tProc.CloseMainWindow();
                        tProc.Close();
                    }
                    tProc = new Process();
                    tProc.StartInfo.FileName = file;
                    tProc.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
                    tProc.Start();
                    while (string.IsNullOrEmpty(tProc.MainWindowTitle))
                    {
                        //System.Threading.Thread.Sleep(100);
                        tProc.Refresh();
                    }
                    ShowWindow(tProc.MainWindowHandle, 0);
                    SetParent(tProc.MainWindowHandle, panel3.Handle);
                    ShowWindow(tProc.MainWindowHandle, SW_SHOWMAXIMIZED);
                    /*} catch
                    {

                    }*/
                    return;
                }
            } catch
            {
                MessageBox.Show("ERROR: Issue launching trainer application.");
            }
        }
        private void ManageExtPlayer(Process player, PlayableItem playable)
        {
            //minimize MCE if indicated
            IntPtr mceWnd = FindWindow(null, "Windows Media Center");
            WINDOWPLACEMENT wp = new WINDOWPLACEMENT();
            GetWindowPlacement(mceWnd, ref wp);

            Cursor.Hide();

            if (HideTaskbar)
            {
                Taskbar.Hide();
            }

            if (ShowSplashScreen)
            {
                //throw up a form to cover the desktop if we minimize and we are in the primary monitor
                if (System.Windows.Forms.Screen.FromHandle(mceWnd).Primary)
                {
                    ExternalSplashForm.Display(Application.CurrentInstance.ExtSplashBmp);
                }
            }

            if (MinimizeMCE)
            {
                Logger.ReportVerbose("Minimizing Windows Media Center");
                wp.showCmd = 2; // 1 - Normal; 2 - Minimize; 3 - Maximize;
                SetWindowPlacement(mceWnd, ref wp);
            }

            // async this so it doesn't slow us down if the service isn't responding for some reason
            Async.Queue("Wait for external player to launch", () =>
            {
                player.Refresh();
                player.WaitForInputIdle(5000);
                OnExternalPlayerLaunched(playable);
            });

            //and wait for it to exit
            player.WaitForExit();

            player.Dispose();

            //now restore MCE
            wp.showCmd = 1; // 1 - Normal; 2 - Minimize; 3 - Maximize;
            SetWindowPlacement(mceWnd, ref wp);

            if (ShowSplashScreen)
            {
                ExternalSplashForm.Hide();
            }

            if (HideTaskbar)
            {
                Taskbar.Show();
            }

            Cursor.Show();

            SetForegroundWindow(mceWnd);

            OnPlaybackFinished(GetFinishedPlaybackState());
        }
Esempio n. 40
0
        private static void worddocverification(string filename, string title)
        {
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            if (File.Exists(filename))
            {
                Console.WriteLine("File exists");
                p.StartInfo.FileName = "WINWORD.EXE";
                p.StartInfo.Arguments = filename;
                p.Start();
                while (!p.MainWindowTitle.Contains(title))
                {
                    Console.WriteLine("Word Title---->" + p.MainWindowTitle.ToString());
                    Thread.Sleep(10);
                    p.Refresh();

                }
                Console.WriteLine("Word title: " + p.MainWindowTitle.ToString());
                p.Kill();

                FileInfo f = new FileInfo(filename);
                long s1 = f.Length;
                Console.WriteLine("File Size: " + s1);
            }
            else
                Console.WriteLine("File does not exist");

        }
Esempio n. 41
0
        public static Boolean driveFromExcel(string excelfilePath)
        {
            try
            {

                DataTable dtResultSummary = new DataTable();
                dtResultSummary.Columns.Add("SNO");
                dtResultSummary.Columns.Add("SCRIPTNAME");
                dtResultSummary.Columns.Add("COMMENT");
                dtResultSummary.Columns.Add("ACTION");
                dtResultSummary.Columns.Add("ARGUMENT");
                dtResultSummary.Columns.Add("RESULT");
                dtResultSummary.Columns.Add("TIMETAKEN");
                dtResultSummary.Columns.Add("MESSAGE");
                string keyWord = ""; string stpexecute = ""; string stepFrom = ""; string comment = "";
                string arg1 = ""; string arg2 = ""; string arg3 = ""; string arg4 = ""; string arg5 = "";
                Helper.TestDataManagement driverData = new Helper.TestDataManagement();
                string _epath = ConfigurationManager.AppSettings["logfile"];
                string apppath = ConfigurationManager.AppSettings["apppath"];
                string reportsSectionFile = ConfigurationManager.AppSettings["reportssectionfile"];
                string strfile = ConfigurationManager.AppSettings["driverfile"];


                Boolean returndriveFromExcel = true;
                Boolean _usewhite = Boolean.Parse(ConfigurationManager.AppSettings["usewhite"]);
                Boolean _detlog = Boolean.Parse(ConfigurationManager.AppSettings["Detaillog"]);

                //*************** 1. Launch Wellflo application ************************************

                //WPF_App.WpfAction wpfaction = new WPF_App.WpfAction();
                UIAutomation_App.UIAutomationAction uiautomation = new UIAutomation_App.UIAutomationAction();
                uiautomation._Attempts = _attempt;
                uiautomation.UseWhite = _usewhite;
                uiautomation._eLogPtah = _epath;
                uiautomation._reportsPath = _reportsPath;
                uiautomation._reportsSectionPath = reportsSectionFile;
                uiautomation.UseDetaillog = _detlog;
                Helper.TestDataManagement testdataobj = new Helper.TestDataManagement();
                Helper.LogManagement logg = new Helper.LogManagement();
                WellFloUI.MSUIAutomation wellflocomui = new WellFloUI.MSUIAutomation();
                uiautomation._testDataPath = _strPath;
                AutoItX3Lib.AutoItX3 autoit = new AutoItX3Lib.AutoItX3();
                Helper.ReportsManagement rpt = new Helper.ReportsManagement();

                driverData.GetTestData(excelfilePath, "Tmaster");

                int pascount = 0;
                int failcount = 0;

                for (int i = 0; i < driverData.Structure.Rows.Count; i++)
                {
                    System.Diagnostics.Stopwatch stopwatch3 = new System.Diagnostics.Stopwatch();
                    stopwatch3.Start();
                    DataRow dr = dtResultSummary.NewRow();
                    comment = driverData.Structure.Rows[i]["Comment"].ToString();
                    keyWord = driverData.Structure.Rows[i]["Keyword"].ToString();
                    stpexecute = driverData.Structure.Rows[i]["Execute"].ToString();
                    stepFrom = driverData.Structure.Rows[i]["StepFrom"].ToString();
                    arg1 = driverData.Structure.Rows[i]["arg1"].ToString();
                    arg2 = driverData.Structure.Rows[i]["arg2"].ToString();
                    arg3 = driverData.Structure.Rows[i]["arg3"].ToString();
                    arg4 = driverData.Structure.Rows[i]["arg4"].ToString();
                    arg5 = driverData.Structure.Rows[i]["arg5"].ToString();
                    dr["SCRIPTNAME"] = _scriptName;
                    dr["SNO"] = (sNo + 1).ToString();
                    dr["ACTION"] = keyWord;
                    if (comment == null)
                    {
                        dr["COMMENT"] = " ";
                    }
                    else
                    {
                        dr["COMMENT"] = comment;
                    }
                    if (arg1 == null)
                    {
                        dr["ARGUMENT"] = " ";
                    }
                    else
                    {
                        dr["ARGUMENT"] = arg1;
                    }

                    if (stpexecute.ToLower() == "y")
                    {
                        logg.CreateCustomLog(_epath, "Performing Keyword:=====>" + comment + "====================================");
                        switch (keyWord.ToLower())
                        {
                            #region Generic keywords
                            #region launchapplication
                            case "launchapplication":
                                {
                                    string repeat = new string('=', 50);
                                    logg.CreateCustomLog(_epath, repeat + " Launching Application " + arg1 + DateTime.Now.ToString() + repeat);
                                    try
                                    {

                                        if (stepFrom == "0")
                                        {

                                            if (GetOSArchitecture() == "32")
                                            {
                                                logg.CreateCustomLog(_epath, "Os is 32 bit OS ");
                                                arg1 = arg1.Replace("Program Files (x86)", "Program Files");
                                                logg.CreateCustomLog(_epath, "app path is " + arg1);
                                            }
                                            else
                                            {
                                                logg.CreateCustomLog(_epath, "Os is 64 bit OS ");
                                                if (arg1.Contains("x86") == false)
                                                {
                                                    arg1 = arg1.Replace("Program Files", "Program Files (x86)");
                                                }
                                                logg.CreateCustomLog(_epath, "app path is " + arg1);
                                            }

                                            //we are using realtive path wrt test folder for launch
                                            if (arg1.Contains("\\") == false)
                                            {
                                                arg1 = Path.Combine(ConfigurationManager.AppSettings["testinputdata"], arg1);
                                            }
                                            #region OriginalLaunch
                                            if (File.Exists(arg1) == false)
                                            {
                                                Console.WriteLine("The Argument passed from excel script -arg1" + arg1 + "Does not exist..Please verifty if paths and configurations are correct");
                                                return false;
                                            }
                                            System.Diagnostics.Process p = new System.Diagnostics.Process();
                                            p.StartInfo.FileName = arg1;
                                            Console.WriteLine("Argument is " + arg1);
                                            p.Start();
                                            int processId = p.Id;
                                            uiautomation._processId = processId;
                                            while (!p.MainWindowTitle.Contains(arg3))
                                            {
                                                Console.WriteLine("Window Title----> {0}", p.MainWindowTitle);
                                                Thread.Sleep(10);
                                                p.Refresh();

                                            }
                                            Console.WriteLine("End Window Title {0}", p.MainWindowTitle);
                                            #endregion OriginalLaunch



                                            int lastbackslashpos = arg1.LastIndexOf("\\") + 1;
                                            System.Console.WriteLine("lastbackslashpos: " + lastbackslashpos);
                                            int arg1Len = arg1.Length;
                                            System.Console.WriteLine("arg1 Length: " + arg1Len);
                                            int diff = arg1.Length - lastbackslashpos;
                                            System.Console.WriteLine("diff Length: " + diff);
                                            arg1 = arg1.Substring(lastbackslashpos, diff);
                                            if (arg1.Contains(".exe") == true)
                                            {
                                                arg1 = arg1.Replace(".exe", "");
                                            }

                                            System.Console.WriteLine("Exe or Process name to attach is: " + arg1);
                                            if (arg2 == null || arg2 == "") //use Process name from arg1 itself no need to supply from excel
                                            {
                                                //White.Core.Application app = wpfaction.GetWPFApp(arg1); // ---> Launch the Application 
                                                //uiautomation._application = app;
                                            }
                                            else //read arg2 from Script File 
                                            {
                                                //White.Core.Application app = wpfaction.GetWPFApp(arg2); // ---> Launch the Application 
                                                //uiautomation._application = app;
                                            }



                                        }
                                        else if (stepFrom == "1")
                                        {
                                            //White.Core.Application app = wpfaction.GetWPFApp(arg2); // ---> Launch the Application 
                                            //uiautomation._application = app;
                                            //wpfaction._application = app;

                                        }
                                        else
                                        {
                                            logg.CreateCustomLog(_epath, "[Wraper]:Invalid stepfrom value");
                                        }
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        repeat = new string('=', 50);
                                        logg.CreateCustomLog(_epath, repeat + " Application Launched " + DateTime.Now.ToString() + repeat);
                                        pascount++;

                                    }

                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in Keyword Launch:" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated " + ex.Message;
                                        logg.CreateCustomLog(_epath, repeat + " Failed to Launch Application" + DateTime.Now.ToString() + repeat);
                                        failcount++;
                                    }


                                    break;
                                }
                            #endregion
                            #region launchindirect
                            case "launchindirect":
                                {
                                    try
                                    {

                                        if (stepFrom == "0")
                                        {

                                            if (GetOSArchitecture() == "32")
                                            {
                                                logg.CreateCustomLog(_epath, "Os is 32 bit OS ");
                                                arg1 = arg1.Replace("Program Files (x86)", "Program Files");
                                                logg.CreateCustomLog(_epath, "app path is " + arg1);
                                            }
                                            else
                                            {
                                                logg.CreateCustomLog(_epath, "Os is 64 bit OS ");
                                                if (arg1.Contains("x86") == false)
                                                {
                                                    arg1 = arg1.Replace("Program Files", "Program Files (x86)");
                                                }
                                                logg.CreateCustomLog(_epath, "app path is " + arg1);
                                            }



                                            #region New Launch
                                            System.Diagnostics.Process p = new System.Diagnostics.Process();
                                            p.StartInfo.FileName = arg1;

                                            p.Start();

                                            Process[] myprocess = Process.GetProcessesByName(arg2);

                                            while (myprocess.Length == 0)
                                            {
                                                logg.CreateCustomLog(_epath, "Launching Main Process ");
                                                myprocess = Process.GetProcessesByName(arg2);
                                                Thread.Sleep(1000);

                                            }
                                            logg.CreateCustomLog(_epath, "Launched: " + myprocess[0].ProcessName);
                                            Process actualProcess = myprocess[0];

                                            while (!actualProcess.MainWindowTitle.Contains(arg3))
                                            {
                                                Console.WriteLine("Window Title----> {0}", actualProcess.MainWindowTitle);
                                                Thread.Sleep(10);
                                                actualProcess.Refresh();

                                            }
                                            Console.WriteLine("End Window Title {0}", actualProcess.MainWindowTitle);
                                            uiautomation._processId = actualProcess.Id;
                                            #endregion



                                            int lastbackslashpos = arg1.LastIndexOf("\\") + 1;
                                            System.Console.WriteLine("lastbackslashpos: " + lastbackslashpos);
                                            int arg1Len = arg1.Length;
                                            System.Console.WriteLine("arg1 Length: " + arg1Len);
                                            int diff = arg1.Length - lastbackslashpos;
                                            System.Console.WriteLine("diff Length: " + diff);
                                            arg1 = arg1.Substring(lastbackslashpos, diff);
                                            if (arg1.Contains(".exe") == true)
                                            {
                                                arg1 = arg1.Replace(".exe", "");
                                            }

                                            System.Console.WriteLine("Exe or Process name to attach is: " + arg1);
                                            if (arg2 == null || arg2 == "") //use Process name from arg1 itself no need to supply from excel
                                            {
                                                //White.Core.Application app = wpfaction.GetWPFApp(arg1); // ---> Launch the Application 
                                                //uiautomation._application = app;
                                            }
                                            else //read arg2 from Script File 
                                            {
                                                //White.Core.Application app = wpfaction.GetWPFApp(arg2); // ---> Launch the Application 
                                                //uiautomation._application = app;
                                            }



                                        }
                                        else if (stepFrom == "1")
                                        {
                                            //White.Core.Application app = wpfaction.GetWPFApp(arg2); // ---> Launch the Application 
                                            //uiautomation._application = app;
                                            //uiautomation._processId = app.Process.Id;
                                            //wpfaction._application = app;

                                        }
                                        else
                                        {
                                            logg.CreateCustomLog(_epath, "[Wraper]:Invalid stepfrom value");
                                        }
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }

                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in Keyword Launchindirect:" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated " + ex.Message;
                                    }
                                    break;
                                }
                            #endregion
                            #region closewindow
                            case "closewindow":
                                {
                                    try
                                    {
                                        Thread.Sleep(2000);
                                        SendKeys.SendWait("{ENTER}");
                                        SendKeys.SendWait("{ENTER}");
                                        SendKeys.SendWait("%{F4}");
                                        SendKeys.SendWait("{ENTER}");
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in keyword  Function CloseWindow" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;
                                }
                            #endregion
                            #region inputformdata
                            case "inputformdata":
                                {
                                    string repeat = new string('=', 50);
                                    logg.CreateCustomLog(_epath, "Strpath value is :" + _strPath);
                                    logg.CreateCustomLog(_epath, repeat + " Adding Data from Excel Path:=" + _strPath + arg1 + " for test case " + arg2 + DateTime.Now.ToString() + repeat);
                                    try
                                    {
                                        uiautomation.AddData(_strPath + arg1, arg2);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;

                                    }
                                    catch (Exception ex)
                                    {
                                        failcount++;
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in keyword  Function inputformdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();


                                    }
                                    break;
                                }
                            #endregion
                            #region comapredoc
                            case "comparedoc":
                                {
                                    try
                                    {
                                        TestDataManagement testData = new Helper.TestDataManagement();

                                        testData.GetTestData(_strPath + arg1, "T1");
                                        DataTable expectedData = testData.Data;
                                        int tableNumber = int.Parse(arg3);
                                        //DataTable actualData = verifyReport(_strPath + arg2, tableNumber);
                                        //DataTable ResultTable = CompareData(expectedData, actualData);
                                        //Helper.ReportsManagement rppt1 = new Helper.ReportsManagement();
                                        //rppt1.ResultTable = ResultTable;
                                        //rppt1.ReportPath = arg5;
                                        //rppt1.GenerateReport(_strPath + arg4);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in keyword  Function inputformdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;
                                }
                            #endregion
                            #region verifyfileexistence
                            case "verifyfileexistence":
                                {
                                    try
                                    {
                                        string expectedData = _strPath + arg1;
                                        DataTable ResultTable = verifyFileExistence(expectedData);
                                        Helper.ReportsManagement rppt1 = new Helper.ReportsManagement();
                                        rppt1.ResultTable = ResultTable;
                                        rppt1.ReportPath = arg5;
                                        rppt1.GenerateReport(_strPath + arg4);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in keyword  Function inputformdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;
                                }
                            #endregion
                            #region closewindowwithtitle
                            case "closewindowwithtitle":
                                {
                                    try
                                    {
                                        //uiautomation._globalWindow = wpfaction.GetWPFWindow(arg1);
                                        uiautomation.closeGlobalWindow();
                                        Thread.Sleep(2000);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in closewindowwithtitle" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region resetuiwindow
                            case "resetuiwindow":
                                {
                                    try
                                    {
                                        uiautomation.uiAutomationWindow = null;
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in resetuiwindow" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifydatatable
                            case "verifydatatable":
                                {
                                    try
                                    {
                                        uiautomation.VerifyData(_strPath + arg1, arg2);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verifydatatable" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;


                                }
                            #endregion
                            #region verifyformdata
                            case "verifyformdata":
                                {
                                    try
                                    {
                                        _finalReports = arg5;
                                        string repeat = new string('=', 50);
                                        logg.CreateCustomLog(_epath, arg1);
                                        logg.CreateCustomLog(_epath, arg2);
                                        logg.CreateCustomLog(_epath, arg3);
                                        logg.CreateCustomLog(_epath, arg4);
                                        logg.CreateCustomLog(_epath, arg5);
                                        logg.CreateCustomLog(_epath, "1-5 arguments");
                                        logg.CreateCustomLog(_epath, repeat + "Verifying Data from Excel " + arg1 + "for test case " + arg2 + DateTime.Now.ToString() + repeat);
                                        uiautomation.verifyDataForm(_strPath + arg1, arg2, arg3, _strPath + arg4, arg5);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verifydatatable" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region compareXML
                            case "comparexml":
                                {
                                    try
                                    {
                                        _finalReports = arg4;
                                        arg3 = ConfigurationManager.AppSettings["testinputdata"] + arg3;  //arr[0];
                                        logg.CreateCustomLog(_epath, "Path used for comparexml keyword" + arg1);

                                        if (arg1.Trim().Length == 0 || arg2.Trim().Length == 0 || arg3.Trim().Length == 0 || arg4.Trim().Length == 0)
                                            logg.CreateCustomLog(_epath, "Need values for arg1,arg2,arg3 and arg4");
                                        else
                                        {

                                            CompareXML(arg1, arg2, arg3, arg4, logg, _epath);
                                            stopwatch3.Stop();
                                            dr["RESULT"] = "Success";
                                            dr["MESSAGE"] = "Completed";
                                            dr["TimeTaken"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  comparexml " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifydataiepanetable
                            case "verifydataiepanetable":
                                {
                                    try
                                    {
                                        uiautomation.verifyDataIEPaneTable(_strPath + arg1, arg2, arg3, _strPath + arg4, arg5);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "verifydataiepanetable" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region manualintervention
                            case "manualintervention":
                                {
                                    try
                                    {
                                        fn_BalloonToolTip(arg1, arg2);
                                        Console.WriteLine("Please Press Enter to proceed to next step");
                                        Console.ReadLine();
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in manualintervention" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifywpfdatagrid
                            case "verifywpfdatagrid":
                                {
                                    try
                                    {
                                        uiautomation.VerifyDataGridContent(_strPath + arg1, arg2, arg3, _strPath + arg4, arg5);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verifywpfdatagrid" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifydatagrid

                            case "verifydatagrid":
                                {
                                    try
                                    {
                                        uiautomation.VerifyDataGrid2Content(_strPath + arg1, arg2, arg3, _strPath + arg4, arg5);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verifydatagrid" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;

                                }
                            #endregion
                            #region verify_plotdata
                            case "verify_plotdata":
                                {
                                    try
                                    {
                                        verify_plotdata(arg1, arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in verify_plotdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region infraselectrows

                            case "infraselectrows":
                                {
                                    try
                                    {
                                        selectspecfedrows(Int32.Parse(arg1), Int32.Parse(arg2));
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in infraselectrows" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;

                                }
                            #endregion
                            #region clickbuttonwindowtitle
                            case "clickbuttonwindowtitle":
                                {
                                    try
                                    {
                                        wellflocomui.GetAppWindow(arg1);
                                        wellflocomui.ClickButton(arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in clickbuttonwindowtitle" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region clickbuttonwindowautoid
                            case "clickbuttonwindowautoid":
                                {
                                    try
                                    {
                                        //SearchCriteria search = SearchCriteria.ByAutomationId(arg1);
                                        //Window wnd = wpfaction._application.GetWindow(search, White.Core.Factory.InitializeOption.NoCache);
                                        //var btn = wnd.Get<White.Core.UIItems.Button>(arg2);
                                        //btn.Click();
                                        //dr["RESULT"] = "Success";
                                        //dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        //pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in clickbuttonwindowautoid" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region clickbuttonchildwindowtitle
                            case "clickbuttonchildwindowtitle":
                                {
                                    try
                                    {
                                        specialApply(arg1, arg2, arg3);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in clickbuttonchildwindowtitle" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region clickcordinates
                            case "clickcordinates":
                                {
                                    try
                                    {
                                        string repeat = new string('=', 50);
                                        logg.CreateCustomLog(_epath, repeat + " Clicking coordinates " + arg1 + ";" + arg2 + DateTime.Now.ToString() + repeat);
                                        AutoItX3Lib.AutoItX3 at1 = new AutoItX3Lib.AutoItX3();
                                        int x1 = Convert.ToInt32(arg1);
                                        int y1 = Convert.ToInt32(arg2);
                                        at1.MouseClick("LEFT", x1, y1, 1);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  clickcordinates" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region createoutputimage
                            case "createoutputimage":
                                {
                                    try
                                    {
                                        createOutputImage(arg1);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  createoutputimage" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;

                                    }
                                    break;
                                }
                            #endregion
                            #region clickcordinatesdbl
                            case "clickcordinatesdbl":
                                {
                                    try
                                    {
                                        AutoItX3Lib.AutoItX3 at1 = new AutoItX3Lib.AutoItX3();
                                        int x1 = Convert.ToInt32(arg1);
                                        int y1 = Convert.ToInt32(arg2);
                                        at1.MouseClick("LEFT", x1, y1, 2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  clickcordinates" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region rightclick
                            case "rightclick":
                                {
                                    try
                                    {
                                        AutoItX3Lib.AutoItX3 at1 = new AutoItX3Lib.AutoItX3();
                                        int x1 = Convert.ToInt32(arg1);
                                        int y1 = Convert.ToInt32(arg2);
                                        at1.MouseClick("RIGHT", x1, y1, 1);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  rightclick" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region wait
                            case "wait":
                                {
                                    try
                                    {
                                        logg.CreateCustomLog(_epath, "Performing Keyword:===== Wait ====================================");
                                        Console.WriteLine("Waiting in Driver script for " + arg1 + "seconds");
                                        Thread.Sleep(Int32.Parse(arg1) * 1000);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  wait" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region updatestructure
                            case "updatestructure":
                                {
                                    try
                                    {
                                        UpdateStructure(arg1, arg2, arg3, arg4, arg5);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  updatestructure" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region setexpectednactualdata
                            case "setexpectednactualdata":
                                {
                                    try
                                    {
                                        testdataobj.ActualData.Clear();
                                        testdataobj.ExpectedData.Clear();
                                        testdataobj.GetTestData(arg1, arg2);
                                        testdataobj.ActualData = testdataobj.Data;
                                        testdataobj.ExpectedData = testdataobj.GetVerificationData(arg3, arg4);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  setexpectednactualdata" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region comparecsv
                            case "comparecsv":
                                {
                                    try
                                    {
                                        testdataobj.CompareData();
                                        logg.CreateCustomLog(_epath, "Compare Data Finished");
                                        rpt.ResultTable = testdataobj.ResultTable;
                                        rpt.ReportPath = arg2;
                                        logg.CreateCustomLog(_epath, "Trying to create Report");
                                        rpt.GenerateReport(_strPath + arg1);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  comparecsv" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }


                                    break;
                                }
                            #endregion
                            #region upadtereportersheet
                            case "upadtereportersheet":
                                {
                                    try
                                    {
                                        testdataobj.UpdateReporterSheet(_strPath + arg1, "testcase", arg2);
                                        testdataobj.UpdateReporterSheet(_strPath + arg1, "section", arg3);
                                        testdataobj.UpdateReporterSheet(_strPath + arg1, "webtable", arg4);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  upadtereportersheet" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;
                                }
                            #endregion
                            #region copydata
                            case "copydata":
                                {
                                    try
                                    {
                                        Excel.Application xlApp = new Excel.Application();
                                        Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(_strPath + arg1);
                                        Excel._Worksheet xlWorksheet = (Excel._Worksheet)xlWorkbook.Sheets[1];
                                        Excel.Range xlRange = xlWorksheet.UsedRange;
                                        xlRange.Copy(System.Type.Missing);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  CopyData" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region verifywordfile
                            case "verifywordfile":
                                {
                                    try
                                    {
                                        worddocverification(arg1, arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  verifywordfile " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }

                                    break;

                                }

                            #endregion
                            #region writeingrid
                            case "writeingrid":
                                {
                                    try
                                    {
                                        writeGridContent(arg1, arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  writeingrid " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }
                            #endregion
                            #region Compare Excel
                            case "compareexcel":
                                {
                                    try
                                    {
                                        CompareExcel(arg1, arg2);
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        pascount++;
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  writeingrid " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        failcount++;
                                    }
                                    break;
                                }

                            #endregion

                            #region Lowis related keywords
                            #region deletefile
                            case "deletefile":
                                {
                                    try
                                    {


                                        DeleteFile(arg1, logg, _epath);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  DeleteFile " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region deletefiles
                            case "deletefiles":
                                {
                                    try
                                    {
                                        testdataobj.GetTestData(_deleteFilesPath, "");

                                        DataTable dtDelete = testdataobj.Data;
                                        for (int row = 0; i < dtDelete.Rows.Count; row++)
                                        {
                                            DeleteFile((string)dtDelete.Rows[row][0], logg, _epath);
                                        }
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  DeleteFiles " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region searchgridrow
                            case "searchgridrow":
                                {
                                    try
                                    {
                                        SearchGridRow(arg1, arg2, arg3, uiautomation._processId);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {


                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  searchgridrow " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region addrowtodatagrid
                            case "addrowtodatagrid":
                                {
                                    try
                                    {
                                        AddRowToDataGrid(arg1, arg2, uiautomation._processId);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed"; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {


                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  addrowtodatagrid " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message;
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region clickmenus
                            case "clickmenus":
                                {
                                    try
                                    {
                                        ClickMenus(arg1, arg2, uiautomation._processId);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed";
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    catch (Exception ex)
                                    {


                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  clickmenus " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message;
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region clickmenus
                            case "clickbeamdesign":
                                {
                                    try
                                    {
                                        ClickBeamDesign(arg1, arg2, arg3, uiautomation._processId);
                                        stopwatch3.Stop();
                                        dr["RESULT"] = "Success";
                                        dr["MESSAGE"] = "Completed";
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();


                                    }
                                    catch (Exception ex)
                                    {

                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  clickbeamdesign " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message;
                                        dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region cleanupcstore
                            case "cleanupcstore":
                                {
                                    try
                                    {
                                        cleanupcstore(arg1);

                                        dr["RESULT"] = "Success";
                                        dr["Message"] = "Completed";
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in  cleanupcstore " + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();

                                    }
                                    break;
                                }

                            #endregion
                            #region menuiteam
                            case "menuiteam":
                                {
                                    try
                                    {
                                        menuiteam(arg1);

                                        dr["RESULT"] = "Sucess";
                                        dr["Message"] = "Completed";
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in menuiteam" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #region standardpump
                            case "standardpump":
                                {
                                    try
                                    {
                                        standardpump(arg1, arg2, arg3);

                                        dr["RESULT"] = "Sucess";
                                        dr["Message"] = "Completed";
                                    }
                                    catch (Exception ex)
                                    {
                                        returndriveFromExcel = false;
                                        logg.CreateCustomLog(_epath, "Error in standardpumpsave" + ex.Message.ToString());
                                        dr["RESULT"] = "Failed";
                                        dr["MESSAGE"] = "Terminated" + ex.Message; dr["TIMETAKEN"] = (string)stopwatch3.Elapsed.Seconds.ToString();
                                    }
                                    break;
                                }
                            #endregion
                            #endregion

                            default:
                                returndriveFromExcel = false;
                                throw new Exception("Not a valid Keyword");
                        }
                        dtResultSummary.Rows.Add(dr);
                        sNo = sNo + 1;
                    }
                    else
                    {
                        // logg.CreateCustomLog(_epath, "[Wraper]:Not Executing the Keyword: -> " + keyWord);
                    }

                    if (returndriveFromExcel == false)
                    {
                        logg.CreateCustomLog(_epath, "*********************ScriptTermination ********************************");
                        logg.CreateCustomLog(_epath, "Script: " + excelfilePath + "was terminited due to above errors and host or application was also terminated");
                        break;
                    }

                }
                GenerateReport(_resultsSummaryFile, dtResultSummary);

                if (File.Exists(_resultsFile) == false)
                {
                    Console.WriteLine("Result File does not exist:  " + _resultsFile);
                }
                else
                {
                    DataTable dtResults = GetResultsData(_resultsFile, "");
                    DataRow[] success = dtResults.Select("Result= 'Pass'");
                    DataRow[] failed = dtResults.Select("Result='Fail'");


                    Console.WriteLine("Finished Test (Errors:" + failed.Length.ToString() + "," + " Warnings:" + failcount + ")");
                }
                return returndriveFromExcel;
            }
            catch (Exception ex)

            {
                Console.WriteLine("Generic Error has occurred " + ex.Message);
                return false;
            }

        }
Esempio n. 42
0
        /// <summary>
        /// 用记事本打开文件路径或内容
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="strContext"></param>
        public static void OpenEdit(String filePath, String strContext)
        {
            #region 启动 notepad++

            System.Diagnostics.Process ProcNotePad = null;

            List <String> programFolderList = new List <String>();
            //programFolderList.Add(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles));
            //if (Environment.Is64BitOperatingSystem)
            //    programFolderList.Add(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86));
            programFolderList.Add("C:\\Program Files");
            programFolderList.Add("C:\\Program Files (x86)");

            foreach (String programFolder in programFolderList)
            {
                if (String.IsNullOrWhiteSpace(programFolder))
                {
                    continue;
                }

                String notePadPath = Path.Combine(programFolder, "Notepad++", "notepad++.exe");

                if (File.Exists(notePadPath))
                {
                    try
                    {
                        ProcNotePad = new System.Diagnostics.Process();
                        ProcNotePad.StartInfo.FileName               = notePadPath;
                        ProcNotePad.StartInfo.Arguments              = filePath;
                        ProcNotePad.StartInfo.UseShellExecute        = true;
                        ProcNotePad.StartInfo.RedirectStandardInput  = false;
                        ProcNotePad.StartInfo.RedirectStandardOutput = false;

                        ProcNotePad.Start();
                        return;
                    }
                    catch
                    {
                        ProcNotePad = null;
                    }
                }
            }
            #endregion

            if (ProcNotePad == null)
            {
                #region [ 启动记事本 ]

                System.Diagnostics.Process Proc;

                try
                {
                    // 启动记事本
                    Proc = new System.Diagnostics.Process();
                    Proc.StartInfo.FileName               = "notepad.exe";
                    Proc.StartInfo.UseShellExecute        = false;
                    Proc.StartInfo.RedirectStandardInput  = true;
                    Proc.StartInfo.RedirectStandardOutput = true;

                    Proc.Start();
                }
                catch
                {
                    Proc = null;
                }

                #endregion

                #region [ 传递数据给记事本 ]

                if (Proc != null)
                {
                    // 调用 API, 传递数据
                    while (Proc.MainWindowHandle == IntPtr.Zero)
                    {
                        Proc.Refresh();
                    }

                    IntPtr vHandle = Win32API.FindWindowEx(Proc.MainWindowHandle, IntPtr.Zero, "Edit", null);

                    // 传递数据给记事本
                    Win32API.SendMessage(vHandle, Win32API.WM_SETTEXT, 0, strContext);
                }
                else
                {
                    LogForm form = new LogForm(strContext);
                    form.ShowDialog();
                }

                #endregion
            }
        }
Esempio n. 43
0
 internal static void ProcessRefresh(Process process)
 {
     try
     {
         process.Refresh();
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.ToString());
     }
 }
Esempio n. 44
0
		internal static void SafeRefresh(Process process)
		{
			try
			{
				process.Refresh();
			}
			catch (Win32Exception win32Exception)
			{
			}
			catch (InvalidOperationException invalidOperationException)
			{
			}
		}
Esempio n. 45
0
    //private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
    static public Tuple <SldWorks, Process> Solidworks(int Num)
    {
        System.Diagnostics.Process SolidWorksPrc = null;
        if (SolidWorksPath() != null)
        {
            RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\SolidWorks\SOLIDWORKS 2018\ExtReferences", true);
            key.SetValue("SolidWorks Journal Folders", @"C:\Users\tsowers\Documents\Journals\" + Num.ToString());
            SolidWorksPrc = System.Diagnostics.Process.Start(SolidWorksPath());

            System.Threading.Thread.Sleep(11500);
            key.SetValue("SolidWorks Journal Folders", @"C:\Users\tsowers\AppData\Roaming\SolidWorks\SOLIDWORKS 2018");
            key.Dispose();
        }



        if (SolidWorksPrc == null)
        {
            Debug.Print(Num.ToString() + " failed to start");
            //return null;
            Tuple <SldWorks, Process> tuple = new Tuple <SldWorks, Process>(null, SolidWorksPrc);
            return(tuple);
        }


        int ID = SolidWorksPrc.Id;

        try
        {
            SldWorks sldWorks = (SldWorks)ROTHelper.GetActiveObjectList(ID.ToString()).Where(keyvalue => (keyvalue.Key.ToLower().Contains("solidworks")))
                                .Select(keyvalue => keyvalue.Value)
                                .First();
            Tuple <SldWorks, Process> tuple = new Tuple <SldWorks, Process>(sldWorks, SolidWorksPrc);
            return(tuple);
        }
        catch (Exception ex)
        {
            //logger.Error(ex, "Error marshalling the solidworks object");
            Debug.Print(Num.ToString() + " Failed to get SldWorks object, will try again");
            //Thread.Sleep(300);
            SolidWorksPrc.Refresh();
            if (SolidWorksPrc.HasExited == false)
            {
                SolidWorksPrc.Kill();
            }

            Tuple <SldWorks, Process> tuple = new Tuple <SldWorks, Process>(null, SolidWorksPrc);
            return(tuple);
            //SolidWorks(Num);
        }

        /*
         * try
         * {
         *  return (SldWorks, SolidWorksPrc)
         *      ROTHelper.GetActiveObjectList(ID.ToString())
         *  .Where(
         *      keyvalue => (keyvalue.Key.ToLower().Contains("solidworks")))
         *  .Select(keyvalue => keyvalue.Value)
         *  .First();
         * }
         * catch
         * {
         *  Debug.Print(Num.ToString() + " Failed to get SldWorks object, will try again");
         *  Thread.Sleep(300);
         *  try
         *  {
         *      return (SldWorks)
         *      ROTHelper.GetActiveObjectList(ID.ToString())
         *  .Where(
         *      keyvalue => (keyvalue.Key.ToLower().Contains("solidworks")))
         *  .Select(keyvalue => keyvalue.Value)
         *  .First();
         *  }
         *  catch
         *  {
         *      Debug.Print(Num.ToString() + " Failed on second try to get solidworks object");
         *      SolidWorksPrc.Kill();
         *      return null;
         *  }
         *
         * }
         */
    }
        public static void RunExe(string filePath, string argument, TimeSpan timeout)
        {
            if (string.IsNullOrEmpty(filePath))
            {
                throw new ArgumentNullException("filePath");
            }

            if (argument == null)
            {
                throw new ArgumentNullException("argument");
            }

            if (!File.Exists(filePath))
            {
                throw new InstallerVerificationLibraryException("Could not find file '" + filePath + "'");
            }

            var fileInfo = new FileInfo(filePath);

            using (var setup = new Process())
            {
                setup.StartInfo.FileName = filePath;
                setup.StartInfo.Arguments = argument;
                RunProcessAndWaitForExit(setup, fileInfo.Name + " time out", timeout);
                setup.Refresh();
                Log.WriteInfo(fileInfo.Name + " executed with exit code:" + setup.ExitCode, "Installer");
            }
        }
Esempio n. 47
0
    // Update is called once per frame
    void Update()
    {
        if (displaySettings != null)
        {
            displaySettings.Refresh();

            if (displaySettings.HasExited == true)
            {
                displaySettings.Close();
                displaySettings = null;
            }
        }

        //configuration utility, waiting for exit
        if (configUtility != null)
        {
            configUtility.Refresh(); //not sure if needed, check again.
            if (configUtility.HasExited == true)
            {
                Debug.Log("Configwindow Exited");
                configUtility.Close(); //free up resources
                configUtility = null;

                //Debug.Log(MenuController.menuController.userSettings.isReload);
                MenuController.menuController.Load(); // loaded onto single menucontroller
                if (MenuController.menuController.userSettings.isReload == true)
                {
                    //  FileBrowser.HideDialog(true); //force close open file dialog
                    //..apply new settings
                    MenuController.menuController.userSettings.isReload = false;
                    MenuController.menuController.isFirstTime           = false; // since setting is saved, no need for notification dialogue.
                    MenuController.menuController.Save();                        // save isReload = false with the new data

                    //...system tray update
                    if (MenuController.menuController.userSettings.isDemo == true) //weather control
                    {
                        main.instance.WeatherMenuEnable(true);
                    }
                    else
                    {
                        main.instance.WeatherMenuEnable(false);
                    }

                    main.instance.SetStartup(MenuController.menuController.userSettings.runAtStartup);
                    //checkmark btn
                    if (MenuController.menuController.userSettings.runAtStartup == true)
                    {
                        main.instance.startup.Checked = true;
                    }
                    else
                    {
                        main.instance.startup.Checked = false;
                    }

                    if (MenuController.menuController.userSettings.vidPath != null)
                    {
                        vidScript.Stop_DXVA();
                    }

                    main.instance.ClockCheckMark(); // update clock systray checkmark
                    main.instance.ColorCheckMark(); //update ui button checkmark

                    cycleScript.UnloadAssets();
                    //......restart scene, cleary memory.

                    MenuController.menuController.LoadWeatherParameters();                            //updated weather parameters.

                    MenuController.menuController.Deserialize(MenuController.menuController.appList); //update application exclusion list
                    SceneManager.LoadScene("wallpaper");
                }
            }
            else
            {
                //  Debug.Log("Running Process?");
            }
        }
        else
        {
            //Debug.Log("PGM NULL");
        }

        WallpaperChangeDetect();
    }
Esempio n. 48
0
        /// <summary>
        /// Starts Wow, assigns GameProcess and Memory after lauch and releases lock. Can only call from a valid token
        /// </summary>
        /// <exception cref="System.InvalidOperationException">Lock token is not valid</exception>
        public void StartWoW()
        {
            lock (LockObject)
            {
                if (!IsValid)
                {
                    throw new InvalidOperationException("Lock token is not valid");
                }

                if (_wowProcess != null && Utility.Is64BitProcess(_wowProcess))
                {
                    _lockOwner.Profile.Log("64 bit Wow is not supported. Delete or rename the WoW-64.exe file in your WoW install folder");
                    _lockOwner.Stop();
                }

                // check if a batch file or any .exe besides WoW.exe is used and try to get the child WoW process started by this process.

                if (_launcherProc != null)
                {
                    System.Diagnostics.Process wowProcess;
                    // Two methods are used to find the WoW process if a launcher is used;
                    // Method one: launcher exit code return the WoW process ID or a negative if an error occured.
                    //			   If launcher does not use return the expected return values then a batch file or console app
                    //			   must be used to start the launcher and return the expected return codes.
                    // Method two: Find a child WoW process of the launcher process.

                    if (_launcherProc.HasExited && _launcherProc.ExitCode < 0)
                    {
                        _lockOwner.Profile.Log("Pausing profile because launcher exited with error code: {0}", _launcherProc.ExitCode);
                        _lockOwner.Profile.Pause();
                        return;
                    }

                    if (!_launcherProc.HasExited || _launcherProc.ExitCode == 0 ||
                        !Utility.TryGetProcessById(_launcherProc.ExitCode, out wowProcess))
                    {
                        var executablePath = Path.GetFileNameWithoutExtension(_lockOwner.Profile.Settings.WowSettings.WowPath);
                        wowProcess = Utility.GetChildProcessByName(_launcherProc.Id, "Wow")
                                     ?? Utility.GetChildProcessByName(_launcherProc.Id, "WowB")                     // Beta
                                     ?? Utility.GetChildProcessByName(_launcherProc.Id, "WowT")                     // PTR
                                     ?? Utility.GetChildProcessByName(_launcherProc.Id, executablePath);            // Renamed executables
                    }
                    if (wowProcess != null)
                    {
                        _lockOwner.Profile.Log($"WoW Launcher Pid: {_launcherProc.Id} launched WoW Pid: {wowProcess.Id}");
                        _launcherProc.Dispose();
                        _launcherProc       = null;
                        _dialogDisplayTimer = null;
                        Helpers.ResumeProcess(wowProcess.Id);
                        _wowProcess = wowProcess;
                    }
                    else
                    {
                        _lockOwner.Profile.Log("Waiting on external application to start WoW");
                        _lockOwner.Profile.Status = "Waiting on external application to start WoW";
                        return;
                    }
                }

                if (_wowProcess == null || _wowProcess.HasExitedSafe())
                {
                    // throttle the number of times wow is launched.
                    if (_wowProcess != null && _wowProcess.HasExitedSafe() &&
                        DateTime.Now - _startTime < TimeSpan.FromSeconds(HbRelogManager.Settings.WowDelay))
                    {
                        return;
                    }

                    StartWowProcess();
                    return;
                }
                // need to refresh everytime because of the dialog at startup
                _wowProcess.Refresh();
                // return if wow isn't ready for input.
                IntPtr wowWindow = FindWowWindowHandle(_wowProcess);
                if (wowWindow == IntPtr.Zero)
                {
                    _lockOwner.Profile.Status = "Waiting for Wow to start";
                    _lockOwner.Profile.Log(_lockOwner.Profile.Status);
                    return;
                }
                var isPopup = (NativeMethods.GetWindowStyle(_wowProcess.MainWindowHandle) & NativeMethods.WindowStyle.Popup) != 0;

                if (isPopup)
                {
                    // WoW is now shown as a dialog very breifly everytime it's started,
                    // so we only care if it's a dialog window longer than normal
                    if (_dialogDisplayTimer == null)
                    {
                        _dialogDisplayTimer = Stopwatch.StartNew();
                    }
                    else if (_dialogDisplayTimer.ElapsedMilliseconds > 10000)
                    {
                        _lockOwner.Profile.Log($"WoW v{_wowProcess.VersionString()} failed to load and is a popup. " +
                                               $"Make sure your WoW installation is updated and WoW is using windowed mode. Pausing profile.");
                        _lockOwner.Profile.Pause();
                        ReleaseLock();
                    }
                    return;
                }
                _lockOwner.GameWindow      = wowWindow;
                _lockOwner.GameProcessId   = _wowProcess.Id;
                _lockOwner.GameProcessName = _wowProcess.ProcessName;
                _lockOwner.Processsharp    = new ProcessSharp(_wowProcess, MemoryType.Remote);
                _wowProcess = null;
                _lockOwner.Profile.Log("Wow is ready to login.");
            }
        }