Exemplo n.º 1
0
        public void Serialize()
        {
            MemoryStream    ms         = new MemoryStream();
            BinaryFormatter serializer = new BinaryFormatter();

            serializer.Serialize(ms, this);
            ms.Seek(0, SeekOrigin.Begin);
            UsefullMethods.SaveStreamToFile(ms, fileName);
        }
Exemplo n.º 2
0
        private void uploadFile(Stream fileStream)
        {
            string path = this.server.user.rootDirectory.FullName + "\\"
                          + DateTime.UtcNow.ToString("yyyy_MM_dd_HH_mm_ss_fff",
                                                     CultureInfo.InvariantCulture);
            FBFile        newFile;
            FBFileBuilder fb;

            UsefullMethods.SaveStreamToFile(fileStream, path);
            fb      = new FBFileBuilder(path);
            newFile = (FBFile)fb.generate();

            if (!this.server.necessaryFiles.Contains(newFile))
            {
                File.Delete(path);
                this.errorEvent(token);
                return;
            }

            this.completeEvent(newFile, new PhysicFile(newFile, path), token);
        }