예제 #1
0
        private void SplitCommandLine()
        {
            var firstQuoteIndex = CommandLine.IndexOf("'", StringComparison.Ordinal);
            var lastQuoteIndex  = CommandLine.LastIndexOf("'", StringComparison.Ordinal);

            if (CommandLine.Contains("'") &&
                firstQuoteIndex != lastQuoteIndex)
            {
                ExePath   = CommandLine.Substring(firstQuoteIndex, lastQuoteIndex - firstQuoteIndex + 1).Trim('\'');
                Arguments = CommandLine.Remove(firstQuoteIndex, lastQuoteIndex - firstQuoteIndex + 1).Trim();
                if (ExePath.Contains("'"))
                {
                    _isCommandLineValid = false;
                }
                else
                {
                    _isCommandLineValid = true;
                }
            }
            else
            {
                var splitArgs = CommandLine.Split(new [] { " " }, StringSplitOptions.RemoveEmptyEntries);
                ExePath = splitArgs.First();
                if (splitArgs.Length > 1)
                {
                    Arguments = string.Join(" ", splitArgs.Skip(1)).Trim();
                }

                _isCommandLineValid = true;
            }
        }
예제 #2
0
 /// <summary>
 /// This method needs to be called by the concrete derived class immediately before
 /// the "dumpbin.exe" utility is invoked.
 /// </summary>
 private void EnsureExePathSet()
 {
     if (string.IsNullOrEmpty(ExePath))
     {
         ExePath = _lazyFoundExePath.Value;
     }
     else if (!ExePath.ToLowerInvariant().Contains("dumpbin"))
     {
         throw new Exception("Invalid path for dumpbin.exe");
     }
     if (!File.Exists(ExePath))
     {
         throw new FileNotFoundException("Cannot invoke dumpbin.exe", ExePath);
     }
 }
예제 #3
0
파일: Process.cs 프로젝트: alex687/Yams
        public void StopGracefully()
        {
            if (_process == null)
            {
                return;
            }

            _process.Exited -= ProcessExited;

            Trace.TraceInformation("Attempting to gracefully stop the process");
            var stopEvent = new EventWaitHandle(
                false,
                EventResetMode.AutoReset,
                ExePath.Replace("\\", string.Empty));

            stopEvent.Set();
        }
예제 #4
0
        /// <summary>
        /// Writes compiler_${ShortName}.props and compiler_$(ShortName}_compat.h
        /// </summary>
        public void WriteToFile(AbsoluteCrosspath solutionDir)
        {
            if (Skip)
            {
                return;
            }

            AbsoluteCrosspath compilerDir = RelativeCrosspath.FromString(PropsFileName).Absolutized(AbsoluteCrosspath.GetCurrentDirectory()).ToContainingDirectory();

            Directory.CreateDirectory(compilerDir.ToString());

            foreach (CompilerInstance compilerInstance in Instances)
            {
                compilerInstance.WriteToFile(solutionDir);
            }

            XmlDocument doc = new XmlDocument();

            doc.AppendChild(doc.CreateXmlDeclaration("1.0", "utf-8", null));

            XmlElement projectNode = doc.CreateElement("Project");

            projectNode.SetAttribute("DefaultTargets", "Build");
            projectNode.SetAttribute("ToolsVersion", "Current");
            projectNode.SetAttribute("xmlns", "http://schemas.microsoft.com/developer/msbuild/2003");

            XmlElement projectImportProps = doc.CreateElement("Import");

            projectImportProps.SetAttribute("Project", @"$(SolutionDir)\Solution.props");
            projectNode.AppendChild(projectImportProps);

            XmlElement projectPropertyGroupCompiler = doc.CreateElement("PropertyGroup");
            XmlElement projectCompilerExeName       = doc.CreateElement("RemoteCCompileToolExe");

            projectCompilerExeName.InnerText = ExePath.ToString();
            projectPropertyGroupCompiler.AppendChild(projectCompilerExeName);
            XmlElement projectCompilerCppExeName = doc.CreateElement("RemoteCppCompileToolExe");

            projectCompilerCppExeName.InnerText = ExePath.ToString();
            projectPropertyGroupCompiler.AppendChild(projectCompilerCppExeName);

            projectNode.AppendChild(projectPropertyGroupCompiler);

            doc.AppendChild(projectNode);
            doc.Save(PropsFileName);
        }
예제 #5
0
파일: GTAPATH.cs 프로젝트: Skylumz/Rage
 public bool HaveFolder()
 {
     if (ExePath != null)
     {
         if (ExePath.Contains(key))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
예제 #6
0
        public override void DoStuff(MainController controller, int buttonNum)
        {
            try
            {
                if (ExePath == null)
                {
                    return;
                }
                ExePath = ExePath.Trim(new[] { '"' });
                if (Args == null)
                {
                    Args = "";
                }
                switch (AlreadyRunningAction)
                {
                case ProcessRunningAction.NewProcess:
                    Process.Start(new ProcessStartInfo(ExePath, Args));
                    break;

                case ProcessRunningAction.FocusOldProcess:
                case ProcessRunningAction.KillOldProcess:
                    var oldProcess = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(ExePath))
                                     .FirstOrDefault();
                    if (oldProcess == null)
                    {
                        Process.Start(new ProcessStartInfo(ExePath, Args));
                    }
                    else if (AlreadyRunningAction == ProcessRunningAction.FocusOldProcess)
                    {
                        MainController.ShowWindow(oldProcess.MainWindowHandle);
                        MainController.SetForegroundWindow(oldProcess.MainWindowHandle);
                    }
                    else
                    {
                        oldProcess.Kill();
                    }

                    break;
                }
            }
            catch (Exception exc)
            {
            }
        }
예제 #7
0
        internal string GetLogStartupMessage()
        {
            string statusMessage = String.Format(
                "{0} is running {3} {1} ({5}) in ProcessId={2} on OS={4} under {6}"
                , Environment.MachineName
                , Version
                , Process.GetCurrentProcess().Id   // Make it easier to find which service is smashing a server CPU in task manager
                , Name
                , Environment.OSVersion
                , BuildConfigurationText
                , UserName
                );

            if (!ExePath.Contains("ASP.NET") && !string.IsNullOrEmpty(ExePath))
            {
                statusMessage += " from " + ExePath;
            }

            return(statusMessage);
        }
예제 #8
0
        private void AutoStartCheckBox_OnChecked(object sender, RoutedEventArgs e)
        {
            try
            {
                RegistryKey rKey   = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
                var         chkBox = (CheckBox)sender;

                if (chkBox.IsChecked.Equals(false))
                {
                    rKey?.DeleteValue("RetroBar");
                }
                else
                {
                    rKey?.SetValue("RetroBar", ExePath.GetExecutablePath());
                }
            }
            catch (Exception exception)
            {
                ShellLogger.Error($"PropertiesWindow: Unable to update registry autorun setting: {exception.Message}");
            }
        }
예제 #9
0
        public void Initialize(IVVVVHost vvvvHost, INodeBrowserHost nodeBrowserHost, IWindowSwitcherHost windowSwitcherHost, IKommunikatorHost kommunikatorHost)
        {
            // Used for Windows Forms message loop
            FIsRunning = true;

            //set blackbox mode?
            this.IsBlackBoxMode = vvvvHost.IsBlackBoxMode;

            // Set VVVV45 to this running vvvv.exe
            Environment.SetEnvironmentVariable(ENV_VVVV, Path.GetFullPath(Shell.CallerPath.ConcatPath("..").ConcatPath("..")));

            FVVVVHost       = vvvvHost;
            NodeInfoFactory = new ProxyNodeInfoFactory(vvvvHost.NodeInfoFactory);

            FVVVVHost.AddMouseClickListener(this);
            FVVVVHost.AddNodeSelectionListener(this);
            FVVVVHost.AddWindowListener(this);
            FVVVVHost.AddWindowSelectionListener(this);
            FVVVVHost.AddComponentModeListener(this);
            FVVVVHost.AddEnumListener(this);

            NodeInfoFactory.NodeInfoUpdated += factory_NodeInfoUpdated;

            // Route log messages to vvvv
            Logger.AddLogger(new VVVVLogger(FVVVVHost));

            DeviceService = new DeviceService(vvvvHost.DeviceService);
            MainLoop      = new MainLoop(vvvvHost.MainLoop);

            ExposedNodeService = new ExposedNodeService(vvvvHost.ExposedNodeService, NodeInfoFactory);

            NodeBrowserHost    = new ProxyNodeBrowserHost(nodeBrowserHost, NodeInfoFactory);
            WindowSwitcherHost = windowSwitcherHost;
            KommunikatorHost   = kommunikatorHost;

            //do not add the entire directory for faster startup
            var catalog = new AggregateCatalog();

            catalog.Catalogs.Add(new AssemblyCatalog(typeof(HDEHost).Assembly.Location));
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(NodeCollection).Assembly.Location));
            //allow plugin writers to add their own factories (deprecated, see below)
            var factoriesPath = ExePath.ConcatPath(@"lib\factories");

            if (Directory.Exists(factoriesPath))
            {
                catalog.Catalogs.Add(new DirectoryCatalog(factoriesPath));
            }

            //register custom assembly resolvers which look also in the PACK_NAME/core and PACK_NAME/core/[x86|x64] folders
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
            AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += CurrentDomain_ReflectionOnlyAssemblyResolve;

            //search for packs, add factories dir to this catalog, add core dir to assembly search path,
            //add nodes to nodes search path
            var packsPath = Path.Combine(ExePath, "packs");

            if (Directory.Exists(packsPath))
            {
                LoadFactoriesFromLegacyPackages(packsPath, catalog);
            }
            //new package loading system
            LoadFactoriesFromPackages(catalog);

            Container = new CompositionContainer(catalog);
            Container.ComposeParts(this);

            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\VVVV.Nodes.dll"));

            //Get node infos from core plugins here to avoid looping all node infos
            var windowSwitcherNodeInfo = GetNodeInfo(WINDOW_SWITCHER);
            var kommunikatorNodeInfo   = GetNodeInfo(KOMMUNIKATOR);
            var nodeBrowserNodeInfo    = GetNodeInfo(NODE_BROWSER);

            foreach (var factory in AddonFactories)
            {
                if (factory is PatchFactory)
                {
                    NodeCollection.Add(string.Empty, ExePath.ConcatPath(@"lib\nodes\native\"), factory, true, false);
                }
            }

            //now instantiate a NodeBrowser, a Kommunikator and a WindowSwitcher
            FWindowSwitcher = PluginFactory.CreatePlugin(windowSwitcherNodeInfo, null);
            FKommunikator   = PluginFactory.CreatePlugin(kommunikatorNodeInfo, null);
            FNodeBrowser    = PluginFactory.CreatePlugin(nodeBrowserNodeInfo, null);

            this.IsBoygroupClient = FVVVVHost.IsBoygroupClient;
            if (IsBoygroupClient)
            {
                this.BoygroupServerIP = FVVVVHost.BoygroupServerIP;
            }

            var clockport = 3334;

            try
            {
                if (Environment.CommandLine.Contains("/clockport"))
                {
                    var env = Environment.GetCommandLineArgs();
                    var idx = Array.IndexOf(env, "/clockport") + 1;
                    clockport = int.Parse(env[idx]);
                }
            }
            catch (Exception)
            {
                throw new Exception("Could not parse clockport, make sure you have the right syntax, e.g. '/clockport 3344' ");
            }

            //start time server of client
            FNetTimeSync = IsBoygroupClient ? new UDPTimeClient(BoygroupServerIP, clockport) : new UDPTimeServer(clockport);
            FNetTimeSync.Start();

            //now that all basics are set up, see if there are any node search paths to add
            //from the installed packs
            if (Directory.Exists(packsPath))
            {
                LoadNodesFromLegacyPackages(packsPath);
            }
            LoadNodesFromPackages();
        }
예제 #10
0
 public override int GetHashCode()
 {
     return(IdentityType.GetHashCode() ^ ServerType.GetHashCode() ^ InstancingType.GetHashCode() ^
            ServiceName.GetSafeHashCode() ^ ExePath.GetSafeHashCode() ^ Permissions.GetSafeHashCode() ^
            Identity.GetSafeHashCode() ^ PackageId.GetSafeHashCode() ^ Source.GetHashCode());
 }
예제 #11
0
파일: HDEHost.cs 프로젝트: VRaul/vvvv-sdk
        public void Initialize(IVVVVHost vvvvHost, INodeBrowserHost nodeBrowserHost, IWindowSwitcherHost windowSwitcherHost, IKommunikatorHost kommunikatorHost)
        {
            // Set VVVV45 to this running vvvv.exe
            Environment.SetEnvironmentVariable(ENV_VVVV, Path.GetFullPath(Shell.CallerPath.ConcatPath("..").ConcatPath("..")));

            FVVVVHost       = vvvvHost;
            NodeInfoFactory = new ProxyNodeInfoFactory(vvvvHost.NodeInfoFactory);

            FVVVVHost.AddMouseClickListener(this);
            FVVVVHost.AddNodeSelectionListener(this);
            FVVVVHost.AddWindowListener(this);
            FVVVVHost.AddWindowSelectionListener(this);

            NodeInfoFactory.NodeInfoUpdated += factory_NodeInfoUpdated;

            // Route log messages to vvvv
            Logger.AddLogger(new VVVVLogger(FVVVVHost));

            DeviceService = new DeviceService(vvvvHost.DeviceService);
            MainLoop      = new MainLoop(vvvvHost.MainLoop);

            ExposedNodeService = new ExposedNodeService(vvvvHost.ExposedNodeService, NodeInfoFactory);

            NodeBrowserHost    = new ProxyNodeBrowserHost(nodeBrowserHost, NodeInfoFactory);
            WindowSwitcherHost = windowSwitcherHost;
            KommunikatorHost   = kommunikatorHost;

            //do not add the entire directory for faster startup
            var catalog = new AggregateCatalog();

            catalog.Catalogs.Add(new AssemblyCatalog(typeof(HDEHost).Assembly.Location));
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(NodeCollection).Assembly.Location));
            //allow plugin writers to add their own factories
            var factoriesPath = ExePath.ConcatPath(@"lib\factories");

            if (Directory.Exists(factoriesPath))
            {
                catalog.Catalogs.Add(new DirectoryCatalog(factoriesPath));
            }
            Container = new CompositionContainer(catalog);
            Container.ComposeParts(this);

            //NodeCollection.AddJob(Shell.CallerPath.Remove(Shell.CallerPath.LastIndexOf(@"bin\managed")));
            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\VVVV.Nodes.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\Kommunikator.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\NodeBrowser.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\NodeCollector.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\WindowSwitcher.dll"));

            //Get node infos from core plugins here to avoid looping all node infos
            var windowSwitcherNodeInfo = GetNodeInfo(WINDOW_SWITCHER);
            var kommunikatorNodeInfo   = GetNodeInfo(KOMMUNIKATOR);
            var nodeBrowserNodeInfo    = GetNodeInfo(NODE_BROWSER);

            foreach (var factory in AddonFactories)
            {
                if (factory is PatchFactory)
                {
                    NodeCollection.Add(string.Empty, ExePath.ConcatPath(@"lib\nodes\native\"), factory, true, false);
                }
            }

            //now instantiate a NodeBrowser, a Kommunikator and a WindowSwitcher
            FWindowSwitcher = PluginFactory.CreatePlugin(windowSwitcherNodeInfo, null);
            FKommunikator   = PluginFactory.CreatePlugin(kommunikatorNodeInfo, null);
            FNodeBrowser    = PluginFactory.CreatePlugin(nodeBrowserNodeInfo, null);

            this.IsBoygroupClient = FVVVVHost.IsBoygroupClient;
            if (IsBoygroupClient)
            {
                this.BoygroupServerIP = FVVVVHost.BoygroupServerIP;
            }


            //start time server of client
            FNetTimeSync = IsBoygroupClient ? new UDPTimeClient(BoygroupServerIP, 3334) : new UDPTimeServer(3334);
            FNetTimeSync.Start();
        }
예제 #12
0
파일: HDEHost.cs 프로젝트: vnmone/vvvv-sdk
        public void Initialize(IVVVVHost vvvvHost, INodeBrowserHost nodeBrowserHost, IWindowSwitcherHost windowSwitcherHost, IKommunikatorHost kommunikatorHost)
        {
            //set blackbox mode?
            this.IsBlackBoxMode = vvvvHost.IsBlackBoxMode;

            // Set VVVV45 to this running vvvv.exe
            Environment.SetEnvironmentVariable(ENV_VVVV, Path.GetFullPath(Shell.CallerPath.ConcatPath("..").ConcatPath("..")));

            FVVVVHost       = vvvvHost;
            NodeInfoFactory = new ProxyNodeInfoFactory(vvvvHost.NodeInfoFactory);

            FVVVVHost.AddMouseClickListener(this);
            FVVVVHost.AddNodeSelectionListener(this);
            FVVVVHost.AddWindowListener(this);
            FVVVVHost.AddWindowSelectionListener(this);
            FVVVVHost.AddComponentModeListener(this);

            NodeInfoFactory.NodeInfoUpdated += factory_NodeInfoUpdated;

            // Route log messages to vvvv
            Logger.AddLogger(new VVVVLogger(FVVVVHost));

            DeviceService = new DeviceService(vvvvHost.DeviceService);
            MainLoop      = new MainLoop(vvvvHost.MainLoop);

            ExposedNodeService = new ExposedNodeService(vvvvHost.ExposedNodeService, NodeInfoFactory);

            NodeBrowserHost    = new ProxyNodeBrowserHost(nodeBrowserHost, NodeInfoFactory);
            WindowSwitcherHost = windowSwitcherHost;
            KommunikatorHost   = kommunikatorHost;

            //do not add the entire directory for faster startup
            var catalog = new AggregateCatalog();

            catalog.Catalogs.Add(new AssemblyCatalog(typeof(HDEHost).Assembly.Location));
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(NodeCollection).Assembly.Location));
            //allow plugin writers to add their own factories (deprecated, see below)
            var factoriesPath = ExePath.ConcatPath(@"lib\factories");

            if (Directory.Exists(factoriesPath))
            {
                catalog.Catalogs.Add(new DirectoryCatalog(factoriesPath));
            }

            //search for packs, add factories dir to this catalog, add core dir to assembly search path,
            //add nodes to nodes search path
            var packsDirInfo = new DirectoryInfo(Path.Combine(ExePath, "packs"));

            if (packsDirInfo.Exists)
            {
                AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
                AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += CurrentDomain_ReflectionOnlyAssemblyResolve;
                foreach (var packDirInfo in packsDirInfo.GetDirectories())
                {
                    var packDir     = packDirInfo.FullName;
                    var coreDirInfo = new DirectoryInfo(Path.Combine(packDir, "core"));
                    if (coreDirInfo.Exists)
                    {
                        FAssemblySearchPaths.Add(coreDirInfo.FullName);
                        var platformDir = IntPtr.Size == 4 ? "x86" : "x64";
                        var platformDependentCorDirInfo = new DirectoryInfo(Path.Combine(coreDirInfo.FullName, platformDir));
                        if (platformDependentCorDirInfo.Exists)
                        {
                            FAssemblySearchPaths.Add(platformDependentCorDirInfo.FullName);
                        }
                    }
                    var factoriesDirInfo = new DirectoryInfo(Path.Combine(packDir, "factories"));
                    if (factoriesDirInfo.Exists)
                    {
                        catalog.Catalogs.Add(new DirectoryCatalog(factoriesDirInfo.FullName));
                    }
                    // We look for nodes later
                }
            }

            Container = new CompositionContainer(catalog);
            Container.ComposeParts(this);

            //NodeCollection.AddJob(Shell.CallerPath.Remove(Shell.CallerPath.LastIndexOf(@"bin\managed")));
            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\VVVV.Nodes.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\Kommunikator.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\NodeBrowser.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\NodeCollector.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\WindowSwitcher.dll"));

            //Get node infos from core plugins here to avoid looping all node infos
            var windowSwitcherNodeInfo = GetNodeInfo(WINDOW_SWITCHER);
            var kommunikatorNodeInfo   = GetNodeInfo(KOMMUNIKATOR);
            var nodeBrowserNodeInfo    = GetNodeInfo(NODE_BROWSER);

            foreach (var factory in AddonFactories)
            {
                if (factory is PatchFactory)
                {
                    NodeCollection.Add(string.Empty, ExePath.ConcatPath(@"lib\nodes\native\"), factory, true, false);
                }
            }

            //now instantiate a NodeBrowser, a Kommunikator and a WindowSwitcher
            FWindowSwitcher = PluginFactory.CreatePlugin(windowSwitcherNodeInfo, null);
            FKommunikator   = PluginFactory.CreatePlugin(kommunikatorNodeInfo, null);
            FNodeBrowser    = PluginFactory.CreatePlugin(nodeBrowserNodeInfo, null);

            this.IsBoygroupClient = FVVVVHost.IsBoygroupClient;
            if (IsBoygroupClient)
            {
                this.BoygroupServerIP = FVVVVHost.BoygroupServerIP;
            }


            //start time server of client
            FNetTimeSync = IsBoygroupClient ? new UDPTimeClient(BoygroupServerIP, 3334) : new UDPTimeServer(3334);
            FNetTimeSync.Start();

            //now that all basics are set up, see if there are any node search paths to add
            //from the installed packs
            if (packsDirInfo.Exists)
            {
                foreach (var packDirInfo in packsDirInfo.GetDirectories())
                {
                    var packDir      = packDirInfo.FullName;
                    var nodesDirInfo = new DirectoryInfo(Path.Combine(packDir, "nodes"));
                    if (nodesDirInfo.Exists)
                    {
                        NodeCollection.AddJob(nodesDirInfo.FullName, true);
                    }
                }
            }
        }
예제 #13
0
 protected void UpdateVersionInfo()
 => Version = File.Exists(ExePath)
                ? "v" + ExePath.GetShortVersion()
                : "Missing: " + ExeName;
예제 #14
0
 public override String ToString()
 {
     return(ExePath.ToString());
 }
예제 #15
0
 public override Int32 GetHashCode()
 {
     return(ExePath.GetHashCode());
 }
예제 #16
0
        private void GetWindowStr(object sender, EventArgs e)
        {
            ExeTitle = CurrentWindow.GetTopWindowText();
            ExePath  = CurrentWindow.GetTopWindowName();
            if (GlobalCommon.UsingModel != null)
            {
                //如果名字匹配
                if (ExeTitle.Contains(GlobalCommon.UsingModel.ExeTitleName))
                {
                    //如果已设置程序路径,程序名字和路径双重匹配
                    if ((!string.IsNullOrWhiteSpace(GlobalCommon.UsingModel.ExePathName) && ExePath.Contains(GlobalCommon.UsingModel.ExePathName)) ||
                        string.IsNullOrWhiteSpace(GlobalCommon.UsingModel.ExePathName))
                    {
                        CurrentID      = GlobalCommon.CurrentExeID = GlobalCommon.UsingModel.ExeID; //当前ID
                        LeaveExeSecond = 0;                                                         //重置离开程序时间
                        if (WatchExeSecond == 0)
                        {
                            StageName = ProgramStageConfigServiceBLLService.Instance.GetCurrentState();
                            //插入时间到时间表中
                            CurrentWatchTimeModel.StartTime = System.DateTime.Now;
                            CurrentWatchTimeModel.ExeID     = Convert.ToInt32(GlobalCommon.CurrentExeID);

                            int resultID = WatchTimeBLLService.Instance.InsertWathExeTime(CurrentWatchTimeModel);
                            CurrentWatchTimeModel.TimeID = resultID;
                        }
                        WatchExeSecond += 1;
                    }
                }
                else//离开要监视的程序
                {
                    //更新时间
                    if (LeaveExeSecond == 0 && WatchExeSecond != 0)
                    {
                        CurrentWatchTimeModel.EndTime = System.DateTime.Now;
                        int resultID = WatchTimeBLLService.Instance.UpdateWathExeTime(CurrentWatchTimeModel);
                    }
                    LeaveExeSecond++;
                    CurrentID = GlobalCommon.CurrentExeID = null;
                    //监视类型
                    WatchType = WatchTypeBLLService.Instance.SelectData();
                    //当为间隔时间模式时,重置时间
                    if (WatchExeSecond != 0 && true == WatchType?.IntervalType)
                    {
                        WatchExeSecond = 0;
                    }
                }
            }
        }