/// <summary> /// Execute processing. /// </summary> /// <param name="request">RequestModel</param> /// <returns>ResponseModel</returns> private InitResponseModel Execute(InitRequestModel request) { // Local variable declaration InitResponseModel responseModel = null; InitDataModel inputObject = null; InitDataModel resultObject = null; // Variable initialize responseModel = new InitResponseModel(); // Execute convert input. inputObject = Convert(request); // Check infomation Check(inputObject); // Get infomation resultObject = GetInfo(inputObject); // Execute convert ouput. responseModel = Convert(resultObject); // Return value return(responseModel); }
public List <DbModel> GetDiff(InitRequestModel requestModel) { var result = Serializers.DeSerializeObjectToFile <Db>(configuration.GetDbFolder()); var rr = from dbmodel in result.Entries where dbmodel.Files.Except(requestModel.Files).Count() > 0 select dbmodel; return(rr.ToList()); }
private byte[] GetInitialReqData() { var files = Directory.GetFiles(configuration.GetHomeDirectory()); InitRequestModel model = new InitRequestModel() { Port = configuration.GetListenPort(), Files = files, UserName = configuration.GetCurrentUserName() }; byte[] data = Serializers.SerializeObject <InitRequestModel>(model); return(data); }
/// <summary> /// Execute convert input. /// </summary> /// <param name="request">RequestModel</param> /// <returns>DataModel</returns> private InitDataModel Convert(InitRequestModel request) { // Local variable declaration InitDataModel inputObject = null; // Variable initialize inputObject = new InitDataModel(); // Convert data input DataHelper.ConvertInput(request, inputObject); // Return value return(inputObject); }
/// <summary> /// Execute convert input. /// </summary> /// <param name="request">RequestModel</param> /// <returns>DataModel</returns> private InitDataModel Convert(InitRequestModel request) { // Local variable declaration InitDataModel inputObject = null; // Variable initialize inputObject = new InitDataModel(); // Convert data input DataHelper.ConvertInput(request, inputObject); // Return value return inputObject; }
public Task Handle(TcpClient client, IPEndPoint address, List <Tuple <string, int, TcpClient> > usersDict) { return(Task.Factory.StartNew(() => { byte[] data = NetworkInfrastructure.GetNetworkDate(client); InitRequestModel request = Serializers.DeserializeObject <InitRequestModel>(data); usersDict.Add(new Tuple <string, int, TcpClient>(request.UserName, request.Port, client)); var diff = dbHandle.GetDiff(request); diff.ForEach(x => { x.Files.ForEach(async y => { var deserialized = Serializers.SerializeObject <FileModel>(FileModel.Create(x.SerwerName, y.ToString())); await NetworkInfrastructure.SendFileAsync(address.Address, request.Port, deserialized); }); }); client.Dispose(); })); }
/// <summary> /// Initialization process. /// </summary> /// <param name="request">RequestModel</param> /// <returns>ResponseModel</returns> public InitResponseModel Invoke(InitRequestModel request) { var responseModel = Execute(request); return(responseModel); }
/// <summary> /// Initialization process. /// </summary> /// <param name="request">RequestModel</param> /// <returns>ResponseModel</returns> public InitResponseModel Invoke(InitRequestModel request) { var responseModel = Execute(request); return responseModel; }
/// <summary> /// Execute processing. /// </summary> /// <param name="request">RequestModel</param> /// <returns>ResponseModel</returns> private InitResponseModel Execute(InitRequestModel request) { // Local variable declaration InitResponseModel responseModel = null; InitDataModel inputObject = null; InitDataModel resultObject = null; // Variable initialize responseModel = new InitResponseModel(); // Execute convert input. inputObject = Convert(request); // Check infomation Check(inputObject); // Get infomation resultObject = GetInfo(inputObject); // Execute convert ouput. responseModel = Convert(resultObject); return responseModel; }