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 pathStep3.cs
59 lines (49 loc) · 1.58 KB
/
Step3.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
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using Newtonsoft.Json.Linq;
namespace M101
{
public class Step3
{
private const string _ACTIV_NAME = "Step3";
private const string _EXE_NAME = "mProjectPP";
private static string _EXE_PATH = Path.Combine(Montage.BIN_PATH, _EXE_NAME);
public JObject Main(JObject args)
{
Action<string> log = (string msg) => Montage.Log(args, $"{_ACTIV_NAME} {msg}");
log("Start");
Montage.ServerURL = args.GetValue("serverURL").ToString();
var task = args.GetValue("task") as JObject;
var src = task.GetValue("src").ToString();
var dst = task.GetValue("dst").ToString();
log("Download");
{
Montage.Download(src, Montage.TEMPLATE
).Wait();
}
log("Run " + _EXE_NAME);
using (var proc = new Process()
{
StartInfo = new ProcessStartInfo()
{
FileName = _EXE_PATH,
RedirectStandardOutput = true
}
})
{
proc.StartInfo.Arguments = $"{src} {dst} {Montage.TEMPLATE}";
proc.Start();
proc.WaitForExit();
log(proc.StandardOutput.ReadToEnd());
}
log("Upload");
{
Montage.Upload(dst, Montage.ToArea(dst)).Wait();
}
log("Finish");
return args;
}
}
}