/// <summary>
        /// 证书格式转换PEM2DER
        /// </summary>
        /// <param name="pemCertFilePath">PEM格式证书文件完整路径</param>
        /// <param name="derCertFilePath">DER格式证书文件完整路径</param>
        public void PemX509CertToDerX509Cert(string pemCertFilePath, string derCertFilePath)
        {
            pemCertFilePath = pemCertFilePath.Replace('\\', '/');
            derCertFilePath = derCertFilePath.Replace('\\', '/');
            var arguments  = " x509 -in " + pemCertFilePath + " -inform PEM -out " + derCertFilePath + " -outform DER";
            var errorText  = "";
            var resultText = CmdHelper.Execute(this.openSSLFilePath, arguments, out errorText);

            if (errorText.Contains("error"))
            {
                var ex = new Exception(errorText);
                throw ex;
            }
        }
        private void btnImportEmpsInfo_Click(object sender, EventArgs e)
        {
            btnViewTheUncertaiRecordInExcel.Enabled = false;
            lblResult.Text      = "";
            lblResult.BackColor = this.BackColor;
            lblResult.Visible   = false;
            //判断是否存在Excel进程.
            if (CmdHelper.ifExistsTheProcessByName("EXCEL"))
            {
                FrmPrompt frmPrompt = new FrmPrompt();
                frmPrompt.ShowDialog();
            }
            _uncertainWSPath    = _defaultDir + "\\uncertainRecord_" + TimeHelper.getCurrentTimeStr() + ".xls";
            dgv.DataSource      = null;
            lblResult.Visible   = false;
            lblResult.Text      = "";
            lblResult.BackColor = this.BackColor;
            tb.Clear();
            randomStr   = TimeHelper.getCurrentTimeStr();
            xlsFilePath = FileNameDialog.getSelectedFilePathWithDefaultDir("请选择考勤记录:", "*.xls|*.xls", defaultDir);
            string dir = DirectoryHelper.getDirOfFile(xlsFilePath);

            if (string.IsNullOrEmpty(dir))
            {
                return;
            }
            List <string> xlsFileList = DirectoryHelper.getXlsFileUnderThePrescribedDir(dir);

            xlsFilePathList = new List <string>();
            foreach (string xlsFile in xlsFileList)
            {
                string fileName = DirectoryHelper.getFileNameWithoutSuffix(xlsFile);
                if (!CheckString.CheckARName(fileName))
                {
                    continue;
                }
                //格式符合:  3月考勤记录1。
                xlsFilePathList.Add(xlsFile);
            }
            #region 先判断第四行,是否全为数字。
            if (!check4thRow(xlsFilePathList, out maxColIndexOfCheckedNameOfExcel))
            {
                return;
            }
            #endregion
            #region 保存关键信息到后台.
            checkNameBGWorker.RunWorkerAsync();
            #endregion
            //开启后台工作者
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            List <SOTable> list = new List <SOTable>();

            foreach (object item in listBox2.Items)
            {
                list.Add(item as SOTable);
            }
            if (list.Count == 0)
            {
                return;
            }

            if (rbtnPdf.Checked)
            {
                saveFileDialog1.Filter   = "pdf文件(*.pdf)|*.pdf|所有文件(*.*)|*.*";
                saveFileDialog1.FileName = CurrentDatabase.Name;
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    string fileName = saveFileDialog1.FileName;

                    iTextExporter exporter = new iTextExporter(fileName);
                    exporter.DbSchema2Pdf(currentSchema, CurrentDatabase, list);

                    if (MessageBox.Show("数据库文档生成成功,是否打开文档", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        CmdHelper.Execute(fileName);
                    }
                }
            }

            if (rbtnWord.Checked)
            {
                saveFileDialog1.Filter   = "rtf文件(*.rtf)|*.rtf|所有文件(*.*)|*.*";
                saveFileDialog1.FileName = CurrentDatabase.Name;
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    string fileName = saveFileDialog1.FileName;

                    iTextExporter exporter = new iTextExporter(fileName);
                    exporter.DbSchema2Rtf(currentSchema, CurrentDatabase, list);

                    if (MessageBox.Show("数据库文档生成成功,是否打开文档", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        CmdHelper.Execute(fileName);
                    }
                }
            }
        }
Exemple #4
0
        public Tuple <Procedure, Implementation> GenerateStepChecker(AtomicAction pendingAsync, Function pendingAsyncAdd)
        {
            this.checkName = "step";
            var requires = invariantAction.gate.Select(g => new Requires(false, g.Expr)).ToList();
            var locals   = new List <Variable>();

            if (!HasChoice)
            {
                locals.Add(choice.Decl);
            }

            List <Cmd> cmds = new List <Cmd>();

            cmds.Add(GetCallCmd(invariantAction));
            cmds.Add(CmdHelper.AssumeCmd(ExprHelper.FunctionCall(pendingAsync.pendingAsyncCtor.membership, choice)));
            cmds.Add(CmdHelper.AssumeCmd(Expr.Gt(Expr.Select(PAs, choice), Expr.Literal(0))));
            cmds.Add(RemoveChoice);

            AtomicAction abs = elim[pendingAsync];
            Dictionary <Variable, Expr> map = new Dictionary <Variable, Expr>();
            List <Expr> inputExprs          = new List <Expr>();

            for (int i = 0; i < abs.impl.InParams.Count; i++)
            {
                var pendingAsyncParam = ExprHelper.FunctionCall(pendingAsync.pendingAsyncCtor.selectors[i], choice);
                map[abs.impl.InParams[i]] = pendingAsyncParam;
                inputExprs.Add(pendingAsyncParam);
            }
            var subst = Substituter.SubstitutionFromHashtable(map);

            cmds.AddRange(GetGateAsserts(abs, subst));

            List <IdentifierExpr> outputVars = new List <IdentifierExpr>();

            if (abs.HasPendingAsyncs)
            {
                locals.Add(newPAs.Decl);
                outputVars.Add(newPAs);
            }
            cmds.Add(CmdHelper.CallCmd(abs.proc, inputExprs, outputVars));
            if (abs.HasPendingAsyncs)
            {
                cmds.Add(AddNewPAs(pendingAsyncAdd));
            }

            cmds.Add(GetCheck(GetTransitionRelation(invariantAction)));

            return(GetCheckerTuple(requires, locals, cmds, "_" + abs.proc.Name));
        }
Exemple #5
0
        public virtual async Task ExecuteAsync(CommandLineArgs commandLineArgs)
        {
            if (commandLineArgs.Target.IsNullOrEmpty())
            {
                throw new CliUsageException("DbMigrations folder path is missing!");
            }

            var dbMigrationsFolder = commandLineArgs.Target;

            var dbMigratorProjectPath = GetDbMigratorProjectPath(dbMigrationsFolder);

            if (dbMigratorProjectPath == null)
            {
                throw new Exception("DbMigrator is not found!");
            }

            if (!IsDotNetEfToolInstalled())
            {
                InstallDotnetEfTool();
            }

            var tenantDbContextName = FindTenantDbContextName(dbMigrationsFolder);
            var dbContextName       = tenantDbContextName != null?
                                      FindDbContextName(dbMigrationsFolder)
                                          : null;

            var migrationOutput       = AddMigrationAndGetOutput(dbMigrationsFolder, dbContextName, "Migrations");
            var tenantMigrationOutput = tenantDbContextName != null?
                                        AddMigrationAndGetOutput(dbMigrationsFolder, tenantDbContextName, "TenantMigrations")
                                            : null;

            if (CheckMigrationOutput(migrationOutput) && CheckMigrationOutput(tenantMigrationOutput))
            {
                // Migration added successfully
                CmdHelper.RunCmd("cd \"" + Path.GetDirectoryName(dbMigratorProjectPath) + "\" && dotnet run");
                await Task.CompletedTask;
            }
            else
            {
                var exceptionMsg = "Migrations failed! A migration command didn't run successfully:" +
                                   Environment.NewLine +
                                   Environment.NewLine + migrationOutput +
                                   Environment.NewLine +
                                   Environment.NewLine + tenantMigrationOutput;

                Logger.LogError(exceptionMsg);
                throw new Exception(exceptionMsg);
            }
        }
Exemple #6
0
    protected virtual void RunAddMigrationCommand(
        string dbMigrationsProjectFolder,
        string migrationName,
        string dbContext,
        string outputDirectory)
    {
        var dbContextOption = string.IsNullOrWhiteSpace(dbContext)
            ? string.Empty
            : $"--context {dbContext}";

        CmdHelper.RunCmd($"dotnet ef migrations add {migrationName}" +
                         $" --output-dir {outputDirectory}" +
                         $" {dbContextOption}",
                         workingDirectory: dbMigrationsProjectFolder);
    }
Exemple #7
0
        private void ScreencapBtn_Click(object sender, EventArgs e)
        {
            String path = @"D:\ScreenCap\";

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            String pngName = String.Format("{0}{1}.png", path, DateTime.Now.ToString("yyyyMMdd-hhmmss"));
            string r       = ExecCMD(String.Format(@"adb shell screencap -p /sdcard/sc.png {0}", pngName));
            string result  = CmdHelper.GetCMDResult(r);

            this.ScreencapImg.Load(pngName);
            ScreencapOutPathTxt.Text = pngName;
        }
        public FileItemViewModel(string fullPath)
        {
            FullPath       = fullPath;
            _directoryItem = new DirectoryItem(FullPath);

            OpenFileCommand = new RelayCommand(() =>
            {
                CmdHelper.Run(FullPath);
            });

            ShowFilePropertiesCommand = new RelayCommand(() =>
            {
                FilePropertiesHelper.ShowFileProperties(FullPath);
            });
        }
        public static Vehicle VehicleHeal(Player sender, int id = -1)
        {
            if (!sender.AccountData.HavePerm("admin.cmds.vehicle.heal"))
            {
                throw new Exception("Vous n'avez pas les permissions pour cela.");
            }


            Vehicle vehicle = CmdHelper.GetCurrentVehicleOrID(sender, id);

            vehicle.Health        = 1000;
            vehicle.Data.Dammages = 1000;

            return(vehicle);
        }
        /// <summary>
        /// 获取证书吊销列表文件的内容
        /// </summary>
        /// <param name="crlFilePath">证书吊销列表文件完整路径</param>
        /// <returns>证书吊销列表文件的内容</returns>
        public string GetCRLText(string crlFilePath)
        {
            crlFilePath = crlFilePath.Replace('\\', '/');
            var arguments  = " crl -in " + crlFilePath + " -text -noout ";
            var errorText  = "";
            var resultText = CmdHelper.Execute(this.openSSLFilePath, arguments, out errorText);

            if (errorText.Contains("error"))
            {
                var ex = new Exception(errorText);
                throw ex;
            }

            return(resultText);
        }
 /// <summary>
 /// Taken van het initialiseren van een MainWindowViewModel:
 /// 1. Maken van een nieuwe repo/Data source
 /// 2. Aanmaken van een InlogViewModel en deze zetten in de basis contentcontrole
 /// 3. Herfrist de statusbar
 /// 4. Maakt de verschillende commando's aan voor de menu items in het openklapbaar menu
 /// </summary>
 public MainWindowViewModel()
 {
     repo           = new AandelenRepo();
     InlogViewModel = new InlogViewModel(repo);
     BasisContentControl(InlogViewModel);
     RefreshStatusBarProperties();
     CmdVeranderGebruiker = new CmdHelper(() => BasisContentControl(InlogViewModel), ValidUser);
     CmdCloseWindow       = new CmdHelper(() => Application.Current.Shutdown());
     CmdToonRapporten     = new CmdHelper(ToonRapport, ValidUser);
     CmdToonLogs          = new CmdHelper(ToonLogs, ValidUser);
     CmdSaveShortCut      = new CmdHelper(OpslaanRapportLogs, () => RapportLogsContent != null);
     CmdRefreshRapport    = new CmdHelper(() => RapporteringViewModel.CmdRefreshPreview.Execute(""), ValidRapportLogs);
     CmdHighDate          = new CmdHelper(() => LogViewModel.BtnHighDate.Execute(""), ValidRapportLogs);
     CmdLowDate           = new CmdHelper(() => LogViewModel.BtnLowDate.Execute(""), ValidRapportLogs);
 }
Exemple #12
0
        public static void DisguiseFile(string path)
        {
            if (!File.Exists(path))
            {
                throw new Exception(string.Format(Rpx.Strings.Disguise_ErrorPathDoesNotExist, path));
            }

            CmdHelper.WriteInfoToConsole(Rpx.Strings.Hide_Protection, Rpx.Strings.Hide_Disguised, RC.Theme[ConsoleThemeColor.SubTextNutral]);

            byte[] bytes = File.ReadAllBytes(path);

            Array.Reverse(bytes);

            File.WriteAllBytes(path, bytes);
        }
Exemple #13
0
        protected virtual async Task <string> GetLatestVersion(
            JProperty package)
        {
            if (_fileVersionStorage.ContainsKey(package.Name))
            {
                return(_fileVersionStorage[package.Name]);
            }

            var newVersion           = CmdHelper.RunCmdAndGetOutput($"npm show {package.Name} version");
            var newVersionWithPrefix = $"~{newVersion}";

            _fileVersionStorage[package.Name] = newVersionWithPrefix;

            return($"~{newVersionWithPrefix}");
        }
Exemple #14
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var   str   = CmdHelper.RunCmd("javac --version");
            Regex reg   = new Regex("javac (.+)$");
            var   match = reg.Match(str);
            var   ver   = match.Groups[1].Value; // 版本号

            this.tbVer.Text = ver;

            str   = CmdHelper.RunCmd("java -verbose");
            reg   = new Regex("opened: (.+)\\\\lib\\\\modules");
            match = reg.Match(str);
            var path = match.Groups[1].Value; // 路径

            this.tbPath.Text = path;
        }
Exemple #15
0
        public override void Execute(IChannel session, Message package)
        {
            Thread.Sleep(1 * 1000);
            var msg = new Message();

            msg.Ctrl = (byte)(Key + 0x80);
            msg.Sn   = package.Sn;
            var list = new List <byte> {
                0x01
            };

            list.AddRange(CmdHelper.GetBCD_Date(DateTime.Now));
            msg.Content = list.ToArray();

            session.WriteAsync(msg);
        }
Exemple #16
0
        /// <summary>
        /// 对文件进行MD5运算
        /// </summary>
        /// <param name="filePath">文件完整路径</param>
        /// <returns>文件的MD5结果</returns>
        public string MD5File(string filePath)
        {
            filePath = filePath.Replace('\\', '/');
            var arguments  = " md5 " + filePath;
            var errorText  = "";
            var resultText = CmdHelper.Execute(this.openSSLFilePath, arguments, out errorText);

            if (errorText.Contains("error"))
            {
                var ex = new Exception(errorText);
                throw ex;
            }
            var md5Text = resultText.Substring(resultText.IndexOf('=') + 1).TrimEnd('\n').Trim().ToUpper();

            return(md5Text);
        }
Exemple #17
0
    private bool IsYarnAvailable()
    {
        var output = CmdHelper.RunCmdAndGetOutput("npm list yarn -g").Trim();

        if (output.Contains("empty"))
        {
            return(false);
        }

        if (!SemanticVersion.TryParse(output.Substring(output.IndexOf('@') + 1), out var version))
        {
            return(false);
        }

        return(version > SemanticVersion.Parse("1.20.0"));
    }
Exemple #18
0
        /// <summary>
        /// 获取证书请求文件中的信息
        /// </summary>
        /// <param name="reqFilePath">证书请求文件完整路径</param>
        /// <returns>证书请求文件中的信息</returns>
        public string GetRequestText(string reqFilePath)
        {
            reqFilePath = reqFilePath.Replace('\\', '/');
            var errorText = "";
            var arguments = " req -in " + reqFilePath + " -text -noout ";
            //+ " -config " + this.configFilePath.Replace('\\', '/');
            var resultText = CmdHelper.Execute(this.openSSLFilePath, arguments, out errorText);

            if (errorText.Contains("error"))
            {
                var ex = new Exception(reqFilePath + Environment.NewLine + errorText);
                throw ex;
            }

            return(resultText);
        }
Exemple #19
0
        public Tuple <Procedure, Implementation> GenerateChoiceChecker()
        {
            this.checkName = "choice";
            var requires = invariantAction.gate.Select(g => new Requires(false, g.Expr)).ToList();

            List <Cmd> cmds = new List <Cmd>();

            cmds.Add(GetCallCmd(invariantAction));
            cmds.Add(CmdHelper.AssumeCmd(ExistsElimPendingAsyncExpr));
            cmds.Add(CmdHelper.AssertCmd(
                         invariantAction.proc.tok,
                         ElimPendingAsyncExpr(choice),
                         $"Failed to validate choice in IS of {inputAction.proc.Name}"));

            return(GetCheckerTuple(requires, new List <Variable>(), cmds));
        }
Exemple #20
0
        public static void VehicleInfos(Player sender, int id = -1)
        {
            if (!sender.AccountData.HavePerm("admin.cmds.vehicle.infos"))
            {
                throw new Exception("Vous n'avez pas les permissions pour cela.");
            }

            Vehicle veh     = CmdHelper.GetCurrentVehicleOrID(sender, id);
            var     strings = CmdHelper.DisplayAdminInfos(veh);

            Chat.AdminChat(sender, "======= Infos du véhicule =======");
            foreach (string line in strings)
            {
                Chat.AdminChat(sender, line);
            }
        }
Exemple #21
0
        public override void ExecuteCommand(MsgPackSession session, BinaryRequestInfo requestInfo)
        {
            CmdHelper.GenSocketLog(session, requestInfo.Key, requestInfo.Body);
            try
            {
                var gpsinfo = Encoding.UTF8.GetString(requestInfo.Body, 1, requestInfo.Body.Length - 1 - 8);
                Console.WriteLine(string.Format("命令:{0} 经纬度:{1}", requestInfo.Key, gpsinfo));
                if (SessionCaches.SCSessionDic.ContainsKey(session.SessionID))
                {
                    var scid = SessionCaches.SCSessionDic[session.SessionID];
                    var gps  = Data.Entities.Instance.gpses.Where(p => p.scid == scid).OrderByDescending(p => p.datetime).FirstOrDefault();
                    if (gps == null || gps.gpsdetaile != gpsinfo)
                    {
                        gps            = new Data.gps();
                        gps.id         = string.Format("{0}_{1}", scid, DateTime.Now.ToString("yyMMddHHmmssfff"));
                        gps.datetime   = DateTime.Now;
                        gps.gpsdetaile = gpsinfo;
                        gps.scid       = scid;
                        Data.Entities.Instance.gpses.Add(gps);
                        Data.Entities.Instance.SaveChanges();
                    }
                    var scinfo = Data.Entities.Instance.scinfoes.FirstOrDefault(p => p.id == scid);
                    if (scinfo != null && string.IsNullOrEmpty(scinfo.gpg))
                    {
                        scinfo.gpg = gpsinfo;
                        Data.Entities.Instance.SaveChanges();
                    }
                }

                var sendData = CmdHelper.GenSocketData(new List <byte[]> {
                    new byte[] { 0x02 },
                    Encoding.UTF8.GetBytes("PING"),
                    new byte[] { 0x00 }
                });
                CmdHelper.SendData(session, sendData);
            }
            catch (Exception es)
            {
                LogHelper.LogError(es);
                var sendData = CmdHelper.GenSocketData(new List <byte[]> {
                    new byte[] { 0x02 },
                    Encoding.UTF8.GetBytes("ERRO"),
                    new byte[] { 0x00 }
                });
                CmdHelper.SendData(session, sendData);
            }
        }
Exemple #22
0
        private static Tuple <Procedure, Implementation> GenerateAbstractionChecker(CivlTypeChecker civlTypeChecker, AtomicAction action, AtomicAction abs)
        {
            var requires = abs.gate.Select(g => new Requires(false, g.Expr)).ToList();
            // TODO: check frame computation
            var frame = new HashSet <Variable>(
                action.modifiedGlobalVars
                .Union(action.gateUsedGlobalVars)
                .Union(abs.modifiedGlobalVars)
                .Union(abs.gateUsedGlobalVars));

            var        subst = InductiveSequentialization.GetSubstitution(action, abs);
            List <Cmd> cmds  = InductiveSequentialization.GetGateAsserts(action, subst,
                                                                         $"Abstraction {abs.proc.Name} fails gate of {action.proc.Name}").ToList <Cmd>();

            cmds.Add(
                CmdHelper.CallCmd(
                    action.proc,
                    abs.impl.InParams,
                    abs.impl.OutParams
                    ));
            cmds.Add(
                CmdHelper.AssertCmd(
                    abs.proc.tok,
                    TransitionRelationComputation.Refinement(civlTypeChecker, abs, frame),
                    $"Abstraction {abs.proc.Name} does not summarize {action.proc.Name}"
                    ));

            var blocks = new List <Block> {
                BlockHelper.Block("init", cmds)
            };

            var proc = DeclHelper.Procedure(
                civlTypeChecker.AddNamePrefix($"AbstractionCheck_{action.proc.Name}_{abs.proc.Name}"),
                abs.impl.InParams,
                abs.impl.OutParams,
                requires,
                action.proc.Modifies,
                new List <Ensures>());
            var impl = DeclHelper.Implementation(
                proc,
                proc.InParams,
                proc.OutParams,
                new List <Variable>(),
                blocks);

            return(Tuple.Create(proc, impl));
        }
        /// <summary>
        /// 根据证书请求文件,签发一个证书
        /// </summary>
        /// <param name="reqFilePath">证书请求文件</param>
        /// <param name="caDataDir">CAData目录</param>
        /// <param name="caPassword">CA私钥保护口令</param>
        /// <returns></returns>
        public string SignCert(string reqFilePath, string caPassword)
        {
            var requestObj = this.GetRequestObj(reqFilePath);

            reqFilePath = reqFilePath.Replace('\\', '/');
            var myCADataDir = this.caDataDir.Replace('\\', '/');
            var reqFileName = reqFilePath.Substring(reqFilePath.LastIndexOf('/') + 1);

            var certFileDir = myCADataDir.TrimEnd('/') + "/certs";
            // -notext 不输出明文信息到证书文件中
            var arguments = " ca -batch -config " + this.configFilePath.Replace('\\', '/')
                            + " -in " + reqFilePath + " -passin pass:"******" -outdir " + certFileDir
                            + " -notext ";

            if (requestObj.SubjectType == SubjectType.User)
            {
                arguments += " -extensions usr_cert";
            }
            else
            {
                arguments += " -extensions v3_ca";
            }
            var errorText  = "";
            var resultText = CmdHelper.Execute(this.openSSLFilePath, arguments, out errorText);

            if (errorText.Contains("error"))
            {
                var ex = new Exception(errorText);
                throw ex;
            }

            var lastCert = this.GetCertList().Last();

            //签发证书后,将证书申请文件从reqwait目录移到reqsigned
            var signed_reqFileName = reqFileName.Insert(reqFileName.IndexOf('.'), "-cert" + lastCert.SerialNo);
            var destFilePath       = myCADataDir.TrimEnd('/') + "/reqsigned/" + signed_reqFileName;

            //destFilePath = FileHelper.GetUniqueFilePath(destFilePath);
            if (File.Exists(destFilePath))
            {
                File.Delete(destFilePath);
            }
            File.Move(reqFilePath, destFilePath);

            return(resultText);
        }
Exemple #24
0
        private static void consumer_Listener(IMessage message)
        {
            string taskId = string.Empty;

            try
            {
                ITextMessage msg = (ITextMessage)message;
                Dictionary <string, object> param      = MqConsumerBase.ReadMapFromJson(msg.Text);
                IPerfApiChariot             chariotBll = ChariotFactory.GetChariot(param["deviceModel"].ToString());

                log.Info(msg.NMSMessageId, taskId);
                if (msg.NMSType == "TestThroughput")
                {
                    taskId = param["taskId"].ToString();
                    string        param1      = param["param1"].ToString();
                    string        param2      = param["param2"].ToString();
                    string        param3      = param["param3"].ToString();
                    string        param4      = param["param4"].ToString();
                    string        param5      = param["param5"].ToString();
                    string        param6      = param["param6"].ToString();
                    string        ping        = "ping 127.0.0.1 -n 2 >nul";
                    List <string> commandList = new List <string>()
                    {
                        param1, ping, param2, ping, param3, ping, param4, ping, param5, ping, param6, ping + "&exit"
                    };
                    CmdHelper.SendCmdCommandList(commandList);
                    WriteLogAndSendResponse(msg.NMSMessageId, "回复消息,我已经完成任务!", StepTestStatus.测试通过, "", param["projectId"].ToString(), param["caseId"].ToString(), param["stepId"].ToString());
                }
                else if (msg.NMSType == "AnalysisResult")
                {
                    taskId = param["taskId"].ToString();
                    List <string> resultList = new List <string>();
                    string        filePath1  = param["FilePath1"].ToString();
                    //string filePath2 = param["FilePath2"].ToString();
                    //string filePath3 = param["FilePath3"].ToString();
                    resultList.Add(chariotBll.GetTestValue(filePath1));
                    //resultList.Add(AnalysisResult.GetTestValue(filePath2));
                    //resultList.Add(AnalysisResult.GetTestValue(filePath3));
                    string result = string.Join(",", resultList.ToArray());
                    WriteLogAndSendResponse(msg.NMSMessageId, "回复消息,我已经完成任务!", StepTestStatus.测试通过, "", param["projectId"].ToString(), param["caseId"].ToString(), param["stepId"].ToString());
                }
            }
            catch (Exception ex)
            {
                log.Info(ex.Message, taskId);
            }
        }
        /// <summary>
        /// 生成CRL(证书撤销列表)文件
        /// </summary>
        /// <param name="crlFilePath">要生成的证书撤销列表文件完整路径</param>
        /// <param name="caPassword">CA私钥保护密码</param>
        public void GenCRL(string crlFilePath, string caPassword)
        {
            crlFilePath = crlFilePath.Replace('\\', '/');
            var myCADataDir = this.caDataDir.Replace('\\', '/');

            var arguments = " ca -gencrl -crldays 7 -out " + crlFilePath
                            + " -config " + this.configFilePath.Replace('\\', '/')
                            + " -passin pass:"******"";
            var resultText = CmdHelper.Execute(this.openSSLFilePath, arguments, out errorText);

            if (errorText.Contains("error"))
            {
                var ex = new Exception(errorText);
                throw ex;
            }
        }
        protected override void ExecuteMain()
        {
            try
            {
                this.Status = StepStatusEnum.Executing;
                Impersonator impersonator = new Impersonator(
                    Properties.Settings.Default.CommandsUserName,
                    Properties.Settings.Default.CommandsDomain,
                    Properties.Settings.Default.CommandsPassword
                    );

                System.Collections.Generic.List <CommandExecutionResult> results = new CmdHelper().ExecuteCommandsConcurrently(
                    Properties.Settings.Default.Commands.ToArray(),
                    Properties.Settings.Default.CommandsUserName,
                    Properties.Settings.Default.CommandsPassword,
                    Properties.Settings.Default.CommandsDomain);

                this.Status       = StepStatusEnum.Pass;
                this.ResultDetail = new StepResultDetail("");
                StringBuilder sb = new StringBuilder();
                this.ResultDetail.Exceptions = new List <Exception>();
                foreach (CommandExecutionResult result in results)
                {
                    if (result.ExitCode != 0)
                    {
                        this.Status = StepStatusEnum.Failed;
                    }
                    sb.Append(result.StandardOutput.ToString());
                    this.ResultDetail.Exceptions.Add(new Exception(result.StandardError.ToString()));
                }

                this.ResultDetail.Message = sb.ToString();
            }
            catch (Exception ex)
            {
                this.Status       = StepStatusEnum.Failed;
                this.ResultDetail = new StepResultDetail("Error has occurred, please check log.", ExceptionHelper.CentralProcessSingle2(ex));
            }
            finally
            {
                if (this.ResultDetail != null)
                {
                    Log.Info(this.ResultDetail.Message);
                }
            }
        }
Exemple #27
0
        private void ExecuteCommand(NetPacket packet)
        {
            string cmd = "";

            try
            {
                cmd = _encoding.GetString(packet.Body);
                var result = CmdHelper.ExecuteCmd(cmd);

                this.SendMessage(result);
            }
            catch (Exception ex)
            {
                _log.Error("cmd命令:" + cmd, ex);
                this.SendMessage("ExecuteCommand CMD Failed!" + Environment.NewLine + cmd + Environment.NewLine + ex.Message);
            }
        }
Exemple #28
0
        private void RunSuite()
        {
            try
            {
                if (!GlobalToolHelper.IsGlobalToolInstalled("abp-suite"))
                {
                    Logger.LogWarning("ABP Suite is not installed! To install it you can run the command: \"abp suite install\"");
                    return;
                }
            }
            catch (Exception ex)
            {
                Logger.LogWarning("Couldn't check ABP Suite installed status: " + ex.Message);
            }

            CmdHelper.RunCmd("abp-suite");
        }
Exemple #29
0
        private async Task InstallSuiteAsync()
        {
            var nugetIndexUrl = await GetNuGetIndexUrlAsync();

            if (nugetIndexUrl == null)
            {
                return;
            }

            var result = CmdHelper.RunCmd("dotnet tool install " + SuitePackageName + " --add-source " + nugetIndexUrl + " -g");

            if (result == 0)
            {
                Logger.LogInformation("ABP Suite has been successfully installed.");
                Logger.LogInformation("You can run it with the CLI command \"abp suite\"");
            }
        }
Exemple #30
0
        public override List <Cmd> CreateInitCmds()
        {
            var lhss = new List <IdentifierExpr> {
                Expr.Ident(pc), Expr.Ident(ok)
            };
            var rhss = new List <Expr> {
                Expr.False, Expr.False
            };
            var cmds = new List <Cmd> {
                CmdHelper.AssignCmd(lhss, rhss)
            };

            cmds.AddRange(CreateUpdatesToOldOutputVars());
            // assume spec gate at procedure entry
            cmds.Add(CmdHelper.AssumeCmd(gate));
            return(cmds);
        }