Ejemplo n.º 1
0
 public void Delete()
 {
     if (!Exists)
     {
         return;
     }
     InternalFile.Delete();
     InternalFile.Refresh();
 }
 /// <summary>
 /// Deletes the file
 /// </summary>
 /// <returns>Any response for deleting the resource (usually FTP, HTTP, etc)</returns>
 public override string Delete()
 {
     if (!Exists)
     {
         return("");
     }
     InternalFile.Delete();
     InternalFile.Refresh();
     return("");
 }
 /// <summary>
 /// Writes content to the file
 /// </summary>
 /// <param name="Content">Content to write</param>
 /// <param name="Mode">Mode to open the file as</param>
 /// <returns>The result of the write or original content</returns>
 public override byte[] Write(byte[] Content, System.IO.FileMode Mode = FileMode.Create)
 {
     if (Content == null)
     {
         Content = new byte[0];
     }
     Directory.Create();
     using (FileStream Writer = InternalFile.Open(Mode, FileAccess.Write))
     {
         Writer.Write(Content, 0, Content.Length);
     }
     InternalFile.Refresh();
     return(Content);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Writes content to the file
 /// </summary>
 /// <param name="content">Content to write</param>
 /// <param name="mode">Mode to open the file as</param>
 /// <returns>The result of the write or original content</returns>
 public override byte[] Write(byte[] content, FileMode mode = FileMode.Create)
 {
     if (InternalFile is null)
     {
         return(content);
     }
     content ??= Array.Empty <byte>();
     Directory?.Create();
     using (var Writer = InternalFile.Open(mode, FileAccess.Write))
     {
         Writer.Write(content, 0, content.Length);
     }
     InternalFile.Refresh();
     return(content);
 }
Ejemplo n.º 5
0
 public void Write(byte[] Content, System.IO.FileMode Mode = FileMode.Create)
 {
     InternalFile.Save(Content, Mode);
     InternalFile.Refresh();
 }
Ejemplo n.º 6
0
 public void Write(string Content, System.IO.FileMode Mode = FileMode.Create, Encoding Encoding = null)
 {
     InternalFile.Save(Content, Mode, Encoding);
     InternalFile.Refresh();
 }