Exemple #1
0
        public override void ServerSide(List <Connection> ServerConnections, Connection ThisConnection)
        {
            using (FilesDataContext tmpDB = new FilesDataContext())
            {
                Message_GetFile tmpReturn = (from a in tmpDB.FileItems where a.FileID == this.FileID select new Message_GetFile()
                {
                    FileBytes = a.FileBytes.ToArray(), FileName = a.FileName, SaveLocation = this.SaveLocation
                }).FirstOrDefault();

                if (tmpReturn != null)
                {
                    tmpReturn.Send(ThisConnection);
                }
            }
        }
Exemple #2
0
        //Function to create Pattern objects and add to a List of Pattern Objects which will be bound to the ListView
        public List <FileDetails> loadPatterns()
        {
            patternsList = new List <FileDetails>();
            FilesDataContext filesDataContext = new FilesDataContext();
            var items = filesDataContext.GetPatternFiles();

            foreach (string s in items)
            {
                patternsList.Add(new FileDetails {
                    FileName = s
                });
            }
            PatternsList = patternsList;
            return(patternsList);
        }
        public override void ServerSide(List <Connection> ServerConnections, Connection ThisConnection)
        {
            using (FilesDataContext tmpDB = new FilesDataContext())
            {
                FileItem tmpFile = new FileItem()
                {
                    FileBytes = this.FileBytes, FileID = this.FileID, FileName = this.FileName, UploadDate = DateTime.Now, FileHash = ComputeHash(this.FileBytes)
                };
                tmpDB.FileItems.InsertOnSubmit(tmpFile);
                tmpDB.SubmitChanges();
            }

            //ZERO OUT THE FILE WHICH WAS SENT SO WE DONT SEND IT BACK TO THE USER FOR NO REASON AND RESPOND TO THE PERSON WHO SENT THIS MESSAGE THAT IT WORKED
            this.FileBytes = null;
            Send(ThisConnection);
        }
 public FilesLibraryController(FilesDataContext db, IHostingEnvironment appEnvironment)
 {
     _db             = db;
     _appEnvironment = appEnvironment;
 }