public override void Run(string[] args) { Logger.Info("run"); var countToCreate = 1; var threadCount = 1; var cmdargs = ParseArgs(args); foreach (var cmdarg in cmdargs) { switch (cmdarg.Item1) { case "-n": countToCreate = int.Parse(cmdarg.Item2); break; case "-t": threadCount = int.Parse(cmdarg.Item2); break; } } _dataTask = new DataTask <Tuple <int, int> >(); for (var i = 0; i < threadCount; i++) { _dataTask.AddTask(new Tuple <int, int>(i, countToCreate / threadCount)); } _dataTask.Start(DoTask, threadCount); _dataTask.Wait(); }
public override void Run(string[] args) { var cmdArgs = this.ParseArgs(args); string fn = "acc.txt"; foreach (var arg in cmdArgs) { switch (arg.Item1) { case "fn": fn = arg.Item2; break; } } var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fn); if (!File.Exists(filePath)) { Console.WriteLine($"{filePath} not exists"); return; } LevelDbHelper.Instance.Init(); Rpcclient = new RpcClient(new Uri($"http://127.0.0.1:10008")); DataTask.DataTask <dynamic> contractTask = new DataTask <dynamic>(); using (var fr = new StreamReader(filePath)) { while (true) { var line = fr.ReadLine(); if (string.IsNullOrEmpty(line)) { break; } var pair = line.Split(","); var addr = pair[0]; var key = pair[1]; if (LevelDbHelper.Instance.IsKeyExists(addr)) { continue; } contractTask.AddTask(pair); } } contractTask.Start(DoTask); contractTask.Wait(); LevelDbHelper.Instance.Destroy(); }