コード例 #1
0
        /// <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);
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: InitLogic.cs プロジェクト: hieur8/web-mbec
        /// <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);
        }
コード例 #5
0
ファイル: InitLogic.cs プロジェクト: hieur8/web-mbec
        /// <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();
     }));
 }
コード例 #7
0
ファイル: InitLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Initialization process.
        /// </summary>
        /// <param name="request">RequestModel</param>
        /// <returns>ResponseModel</returns>
        public InitResponseModel Invoke(InitRequestModel request)
        {
            var responseModel = Execute(request);

            return(responseModel);
        }
コード例 #8
0
ファイル: InitLogic.cs プロジェクト: hieur8/web-mbec
 /// <summary>
 /// Initialization process.
 /// </summary>
 /// <param name="request">RequestModel</param>
 /// <returns>ResponseModel</returns>
 public InitResponseModel Invoke(InitRequestModel request)
 {
     var responseModel = Execute(request);
     return responseModel;
 }
コード例 #9
0
ファイル: InitLogic.cs プロジェクト: hieur8/web-mbec
        /// <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;
        }