-
Notifications
You must be signed in to change notification settings - Fork 0
/
DistributionService.cs
71 lines (55 loc) · 1.94 KB
/
DistributionService.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
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Web;
using System.Text;
using System.Threading.Tasks;
namespace DistributeLib
{
public class Distribute : IDistributeService, IReply
{
private GitUtilCommnad mGitUtilCommand;
DistributeManager distributeWorker =null;
[WebInvoke(Method = "GET",
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "data/{id}")]
public Person GetPerson(string id)
{
return new Person()
{
id = Convert.ToInt32(id),
name = "Anders Selborn"
};
}
[WebInvoke(UriTemplate = "/UpgradeSoftware",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
Method = "POST")]
public bool UpgradeSoftware(GitUtilCommnad command)
{
//Task T = new Task(new Action(RunDistribute(order: order))).ContinueWith(OnDistributeFinished);
mGitUtilCommand = command;
distributeWorker = new DistributeManager(mGitUtilCommand);
distributeWorker.eventFileZipped += BeginOnFileZipped;
return true;
}
private void BeginOnFileZipped(object sender, EventArgs e)
{
ZipFileCreated myZipFile = (ZipFileCreated)e;
Console.WriteLine("My ZipFile was created, name = {0}, size = {1}", myZipFile.filePath, myZipFile.fileSize);
SendZipFile sendZipFile = new SendZipFile(myZipFile,mGitUtilCommand);
}
private void OnDistributeFinished(Task obj)
{
string r = "Distribute finished.";
}
public string GetValue(int value)
{
return "You enetered " + value;
}
public void ServerAnswer()
{
Console.WriteLine("Server Ok.");
}
}
}