Exemple #1
0
        public void WriteLogEntry( )
        {
            var entry    = "Now is the time...";
            var expEntry = string.Format(LogFormatter.Default, "{0:D}{1:L}{2:E}", DateTime.Now, LogLevel.Forced, entry);

            mLogger.Write(entry);
            var file = fMap.Get(mLogFile);

            Assert.AreEqual(expEntry.Length, file.Length);
        }
Exemple #2
0
        public void GetFile( )
        {
            var fileExists = mFile.Exists;

            Assert.IsTrue(fileExists, $"{mFile.Name} !Exist");

            var file = fMap.Get(TextFile);

            Assert.AreEqual(mFile.Name, file.Name);
            Assert.AreEqual(fileExists, file.Exists);
        }
Exemple #3
0
        public void Execute(HttpRequest httpRequest, JsonPacket jsonRequest)
        {
            Clear();

            // Connect
            NetworkChannel channel = new NetworkChannel(Connection);

            // Request
            JsonDownloadRequestMessage jsonRequestMessage = JsonDownloadRequestMessage.Parse(jsonRequest.Message);
            JsonChunk jsonChunk = jsonRequestMessage.Chunk;
            string    jsonId    = jsonRequestMessage.Id;

            JsonDownloadRequestData jsonRequestData = JsonDownloadRequestData.Parse(Group.Decrypt(jsonRequest.Data));
            JsonFile jsonFile = jsonRequestData.File;

            // Data
            FileComponent file = FileMap.Get(jsonFile.Id);

            if (file == null)
            {
                channel.SendNotFound();
                return;
            }

            // Controller
            //UploadData uploadData = new UploadData(fileData, Client) { Id = jsonId, Chunk = jsonChunk };
            //OnUpload(uploadData);

            // Response
            JsonDownloadResponseMessage jsonResponseMessage = new JsonDownloadResponseMessage();
            JsonPacket jsonResponse = new JsonPacket(jsonResponseMessage);

            HttpResponse httpResponse = new HttpResponse()
            {
                Data = Session.Encrypt(jsonResponse)
            };

            channel.Send(httpResponse);
#if DEBUG
            jsonRequest.Data = null;
            Log.Add(httpRequest, httpResponse, jsonRequest, jsonResponse);
#endif
        }