Esempio n. 1
0
        /// <summary>
        /// 读取StartupConfiguration.xml
        /// </summary>
        private void ReadStartupConfiguration(string[] args)
        {
            VTMC.Utils.Models.ProcessStartInfo startMVTMCProcess = new VTMC.Utils.Models.ProcessStartInfo()
            {
                RunningMethod = ConstHelper.MVTMClientRunningMethod, FileName = ConstHelper.MVTMClientName, WaitForExit = false, WorkingDir = ConstHelper.MVTMClientWorkingDir
            };
            //{ RunningMethod = "InitRunProcess", FileName = "MVTMClient.exe", WaitForExit = false,WorkingDir= @"C:\Program Files\ChinaSofti\MVTMClient\MVTMCExe"};

            //add by fdp 180521
            if (args?.Length >= 1)
            {
                foreach (string arg in args)
                {
                    startMVTMCProcess.Args += arg + ' ';
                }
            }

            List <VTMC.Utils.Models.ProcessStartInfo> processList = new List <VTMC.Utils.Models.ProcessStartInfo>();

            processList.Add(startMVTMCProcess);
            AppSettings.StartupConfiguration.ProcessList = processList;
            string xmlPath = Path.Combine(System.Windows.Forms.Application.StartupPath, AppSettings.StartupConfiguration.GetType().Name + ConstHelper.XMLExtension);

            if (!File.Exists(xmlPath))
            {
                XMLHelper.SerializeToXmlFile(xmlPath, AppSettings.StartupConfiguration);
            }
            else
            {
                AppSettings.StartupConfiguration = XMLHelper.DeserializeFromXmlFile <VTMC.Utils.Models.StartupConfiguration>(xmlPath);
                //add by fdp 180521, MVTMClient进程不再配置在xml中,通过程序加入参数后写入list
                AppSettings.StartupConfiguration.ProcessList.Add(startMVTMCProcess);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 清理IE缓存
        /// </summary>
        private void ClearIECache()
        {
            string currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;

            VTMC.Utils.Models.ProcessStartInfo clearIECacheProcess = AppSettings.CommonConfiguration.ProcessList.FirstOrDefault(it => it.RunningMethod == currentMethodName);
            if (clearIECacheProcess != null)
            {
                for (int i = 0; i < 3; i++)
                {
                    bool exitCode = ProcessHelper.RunProcess(clearIECacheProcess.FileName, clearIECacheProcess.WaitForExit, clearIECacheProcess.Args);
                    if (exitCode)
                    {
                        break;
                    }
                    else
                    {
                        continue;
                    }
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 读取ComonConfiguration.xml
        /// </summary>
        private void ReadComonConfiguration()
        {
            VTMC.Utils.Models.ProcessStartInfo clearIECacheProcess = new VTMC.Utils.Models.ProcessStartInfo()
            {
                RunningMethod = "ClearIECache", FileName = "RunDll32.exe", WaitForExit = true, Args = "InetCpl.cpl,ClearMyTracksByProcess 4351"
            };
            List <VTMC.Utils.Models.ProcessStartInfo> processList = new List <VTMC.Utils.Models.ProcessStartInfo>();

            processList.Add(clearIECacheProcess);
            AppSettings.CommonConfiguration.ProcessList = processList;
            string xmlPath = Path.Combine(System.Windows.Forms.Application.StartupPath, AppSettings.CommonConfiguration.GetType().Name + ConstHelper.XMLExtension);

            if (!File.Exists(xmlPath))
            {
                XMLHelper.SerializeToXmlFile(xmlPath, AppSettings.CommonConfiguration);
            }
            else
            {
                AppSettings.CommonConfiguration = XMLHelper.DeserializeFromXmlFile <VTMC.Utils.Models.CommonConfiguration>(xmlPath);
            }
        }