public void OnConnection(object application) { this.framework = (IFramework)application; logger.Info("解压核心程序..."); try { bool flag = ProcessHelper.KillProcess(Arguments.PHANTOMJS_PROCESS_NAME); if (flag == true) { ExtractHelper.Extract(Arguments.TEMP_FOLDER, Arguments.PHANTOMJS_NAME, Arguments.SCRIPT_NAME); } } catch (Exception ex) { logger.Error("Extract core failed.", ex); throw new BasicException("Extract core failed."); } logger.Info("解压核心程序结束."); if (File.Exists(Path.Combine(Arguments.TEMP_FOLDER, Arguments.PHANTOMJS_NAME)) == false) { throw new BasicException("Webkit未找到,请重新安装软件或联系客服。"); } VerifyDirectory(); }
public async Task <int> Execute(IReadOnlyList <string> args) { int argumentsResult = this.SetArguments(args); if (argumentsResult != 0) { return(argumentsResult); } try { byte[] passwordHash = null; if (!string.IsNullOrEmpty(this._Password)) { System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); passwordHash = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(this._Password)); } ExtractHelper extractHelper = new ExtractHelper(); await Task.Factory.StartNew( () => extractHelper.Extract( Path.Combine(this._XeoraDomainPath, "app.xeora"), passwordHash, this._ListContent, this._OutputLocation ) ); return(0); } catch (Exception e) { Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Extract operation has been failed!"); Console.WriteLine($" Reason: {e.Message}"); return(1); } }