public void UploadedFile(UDFile udf) { try { _bbsDataContext.UDFiles.Add(udf); _bbsDataContext.SaveChanges(); } catch (Exception e) { LoggingAPI.LogEntry("Exception in DataInterface.UploadedFile(" + udf.Filename + ", " + udf.Description + "): " + e.ToString()); } }
public void UploadedFile(UDFile udf) { try { BBSDataDataContext bbs = GetDataContext(); bbs.UDFiles.InsertOnSubmit(udf); bbs.SubmitChanges(); } catch (Exception e) { LoggingAPI.LogEntry("Exception in DataInterface.UploadedFile(" + udf.Filename + ", " + udf.Description + "): " + e.ToString()); } }
public void CMD_Upload() { //Prompt for file name _bbs.Write("~l1~c1Enter a name for this file: ~c7"); string Filename = _bbs.Input(true, false, false, false, 16); if (Filename != "") { _bbs.Write("~l1~c1File Type(1)PRG, (2)SEQ:~c7"); string Filetype = _bbs.Input(true, false, true, false, 1); if (Filetype != "") { _bbs.Write("~l1~c1Description:~c7"); string Description = _bbs.Input(true, false, false, false, 38); if (Description != "") { _bbs.WriteLine("~l1~c1Send the file now."); //Punter FileTransfers ft = new FileTransfers(_bbs.State_Object); byte[] b = ft.Punter_Receive(); if (b != null) { _bbs.WriteLine("~l1~c1Send successful"); UDFile udf = new UDFile() { Description = Description, Filename = Filename, Filesize = b.Length, FileType = Filetype.ToUpper(), UDBaseId = CurrentUDBase, Uploaded = DateTime.Now, Uploader = _bbs.CurrentUser.UserId, Uploadername = _bbs.CurrentUser.Username }; string filepath = Current_Area_List.FirstOrDefault(p => p.Keys["type"].Equals("base") && p.Id.Equals(CurrentUDBase)).Keys["filepath"]; File.WriteAllBytes(filepath + "\\" + udf.Filename, b); _dataInterface.UploadedFile(udf); } else { LoggingAPI.LogEntry("UPLOAD FAILED ->" + Filename + ", " + Description + "(" + _bbs.CurrentUser.Username + "[" + _bbs.CurrentUser.UserId.ToString() + "]" + ")"); _bbs.Exclaim("Send failed"); } } } } }
public void CMD_Download(string filespec) { if (int.TryParse(filespec, out int filenum)) { if (filenum <= Current_File_List.Count()) { UDFile selectedItem = Current_File_List[filenum]; _bbs.WriteLine("~c1Download: ~c7" + selectedItem.Filename + "~c1"); if (_bbs.YesNo(true, true)) { FileTransfers ft = new FileTransfers(_bbs.State_Object); string filepath = Current_Area_List.FirstOrDefault(p => p.Keys["type"].Equals("base") && p.Id.Equals(CurrentUDBase)).Keys["filepath"]; _bbs.WriteLine("~l1~c1Start Download Now."); ft.Punter_Send(filepath + "\\" + selectedItem.Filename, (selectedItem.FileType == "P")); } } } }