This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStep6.cs
65 lines (51 loc) · 1.81 KB
/
Step6.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Newtonsoft.Json.Linq;
namespace M101
{
public class Step6
{
static private string _ACTIV_NAME = "Step6";
public JObject Main(JObject args)
{
Action<string> log = (string msg) => Montage.Log(args, $"{_ACTIV_NAME} {msg}");
log("Start");
Montage.ServerURL = args.GetValue("serverURL").ToString();
log("Downlaod");
{
Montage.Download(Montage.DIFF_TBL).Wait();
}
log("Process " + Montage.DIFF_TBL);
using (var sr = new StreamReader(Montage.DIFF_TBL))
{
var diffTasks = new JArray();
var fields = sr.ReadLine();
// data type
sr.ReadLine();
string f1, f2, rst;
int f1Start = -1, f2Start = -1, rstStart = -1;
int count = 0;
while (true)
{
var line = sr.ReadLine();
if (line == null) break;
(f1, f1Start) = Montage.ReadFromTbl(fields, line, "plus", f1Start);
(f2, f2Start) = Montage.ReadFromTbl(fields, line, "minus", f2Start);
(rst, rstStart) = Montage.ReadFromTbl(fields, line, "diff", rstStart);
var dst = rst;
var diffTask = new JObject();
diffTask.Add("src1", f1);
diffTask.Add("src2", f2);
diffTask.Add("dst", dst);
diffTasks.Add(diffTask);
count++;
}
args.Add("diffTasks", diffTasks);
}
log("Finish");
return args;
}
}
}