| Код | using System; using System.IO; namespace conf.App_Code.Utils { [Serializable] public class Binary : MarshalByRefObject, IBinary { public byte[] ReadFile(string filePath) { try { string temp = filePath; return File.ReadAllBytes(temp); } catch { return null; } } public void Write(string filePath, byte[] b) { string cp = filePath; new FileInfo(cp).Directory.Create(); try { File.WriteAllBytes(cp, b); } catch { File.Delete(cp); File.WriteAllBytes(cp, b); } } public byte[] ReadSuper(string filePath) { try { return File.ReadAllBytes(filePath); } catch { return null; } } public FileStream StreamSuper(string path) { return new FileStream(path, FileMode.Open); } public string ReadText(string path) { return File.ReadAllText(path); } public void CreateFolder(string path) { Directory.CreateDirectory(path); } public string GetDirectory(string path) { return Directory.GetParent(path).FullName; } } }
|
|