void InitalizeCkbIfNecessary() { if (File.Exists(TomlFile)) { return; } using System.Diagnostics.Process process = new(); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardInput = true; process.StartInfo.FileName = BinaryFullPath(WorkPathManage.CkbForPaltform(ckbenum.ckb)); process.StartInfo.WorkingDirectory = WorkingDirectory(); process.StartInfo.Arguments = BuildArguments(); process.Start(); StreamWriter writer = process.StandardInput; writer.Write(ChainSpec()); writer.Close(); process.WaitForExit(); CopyTheConstractFiles(ProcessInfo.Contracts); }
private static void CreateDbIfNotExists(IHost host) { using var scope = host.Services.CreateScope(); var services = scope.ServiceProvider; var logger = services.GetRequiredService <ILogger <Program> >(); var dbPath = Path.Combine(Core.Environment.GetAppDataFolder(), "tippy-db.db"); if (File.Exists(dbPath)) { logger.LogWarning("the db path: " + dbPath + " is exist;"); } else { logger.LogWarning("the db path: " + dbPath + " is not exist;"); } logger.LogWarning("the working path: " + WorkPathManage.WorkingScriptDirectory(0)); try { var context = services.GetRequiredService <Core.Data.TippyDbContext>(); context.Database.Migrate(); } catch (Exception ex) { logger.LogError(ex, "An error occurred creating the DB."); } }
public IActionResult OnPost() { using (var fileStream = new FileStream(Path.Combine(WorkPathManage.ScriptDirectory(), FileUpload.UploadPrivateSchedule.FileName), FileMode.Create)) { FileUpload.UploadPrivateSchedule.CopyTo(fileStream); } return(RedirectToPage("./Index")); }
protected override void Configure() { process = new System.Diagnostics.Process(); process.StartInfo.UseShellExecute = false; //process.StartInfo.FileName = BinaryFullPath("ckb-indexer.exe"); process.StartInfo.FileName = BinaryFullPath(WorkPathManage.CkbForPaltform(ckbenum.ckbindexer)); process.StartInfo.WorkingDirectory = WorkingDirectory(); process.StartInfo.Arguments = $"-s indexer-data -c http://127.0.0.1:{ProcessInfo.NodeRpcPort} -l 127.0.0.1:{ProcessInfo.IndexerRpcPort}"; }
protected override void Configure() { UpdateConfiguration(); process = new System.Diagnostics.Process(); process.StartInfo.UseShellExecute = false; process.StartInfo.FileName = BinaryFullPath(WorkPathManage.CkbForPaltform(ckbenum.ckb)); process.StartInfo.WorkingDirectory = WorkingDirectory(); process.StartInfo.Arguments = "miner"; }
/// <summary> /// domain: return List<Domain_ConstractFile> /// </summary> /// <returns></returns> public List <Domain_ConstractFile> GetConstractFiles() { List <Domain_ConstractFile> list = new List <Domain_ConstractFile>(); WorkPathManage.GetListOfConstractFiles().ForEach(item => { list.Add(new Domain_ConstractFile() { filename = item.Name, filepath = item.FullName, filecreatetime = item.CreationTime, modifytime = item.LastWriteTime, }); }); return(list); }
public void OnGet() { ConstractFiles = WorkPathManage.GetListOfConstractFiles().Select(item => new Domain_ConstractFile { filename = item.Name, filepath = item.FullName }).ToList(); var calculatingFromUsed = Projects.Count > 0; var rpcPorts = Projects.Select(p => p.NodeRpcPort); var networkPorts = Projects.Select(p => p.NodeNetworkPort); var indexerPorts = Projects.Select(p => p.IndexerRpcPort); Project = new Project { Name = $"CKB Chain", Chain = Project.ChainType.Dev, NodeRpcPort = calculatingFromUsed ? rpcPorts.Max() + 3 : 8114, NodeNetworkPort = calculatingFromUsed ? networkPorts.Max() + 3 : 8115, IndexerRpcPort = calculatingFromUsed ? indexerPorts.Max() + 3 : 8116, LockArg = "0xc8328aabcd9b9e8e64fbc566c4385c3bdeb219d7" }; }
protected override void Configure() { string?workingDirectory = Path.GetDirectoryName(TxFilePath); if (workingDirectory == null) { throw new Exception("No file path found!"); } string debuggerBinaryPath = BinaryFullPath(WorkPathManage.CkbForPaltform(ckbenum.ckbdebugger)); string arguments = $"--port 7682 {debuggerBinaryPath} -l 0.0.0.0:2000 -g {ScriptGroupType} -h {ScriptHash} -t {TxFilePath} -e {IoType} -i {IoIndex}"; if (BinaryPath != null) { arguments += $" -r {BinaryPath}"; } process = new System.Diagnostics.Process(); process.StartInfo.UseShellExecute = false; process.StartInfo.FileName = "ttyd"; process.StartInfo.WorkingDirectory = workingDirectory; process.StartInfo.Arguments = arguments; }