52 lines
1.2 KiB
C#
52 lines
1.2 KiB
C#
using Server.System;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace Server.Service
|
|
{
|
|
public class Downlode : AbstractService
|
|
{
|
|
private DownlodeReq req;
|
|
public override string Process()
|
|
{
|
|
//버전 확인후 암호화된 데이터를 내려주거나 아예 반환을 하지 않음.
|
|
if (req.version == ProtocolProcessor.version)
|
|
return makeResp("");
|
|
return makeResp(ProtocolProcessor.cryptoData);
|
|
}
|
|
|
|
public override Protocol ProtocolValue() => Protocol.Downlode;
|
|
|
|
public override Req Requst(string json)
|
|
{
|
|
req = JsonConvert.DeserializeObject<DownlodeReq>(json);
|
|
return req;
|
|
}
|
|
|
|
private string makeResp(string data)
|
|
{
|
|
DownlodeResp resp = new DownlodeResp();
|
|
resp.data = data;
|
|
resp.version = ProtocolProcessor.version;
|
|
resp.status = 200;
|
|
return resp.ToJson();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public class DownlodeReq : Req
|
|
{
|
|
public string version;
|
|
public override bool IsReceivedAllField()
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public class DownlodeResp : Resp
|
|
{
|
|
public string data;
|
|
public string version;
|
|
}
|
|
}
|