public static Narc Open(String filePath) { FileStream file = File.OpenRead(filePath); Narc narc = new Narc(Path.GetFileNameWithoutExtension(filePath)); BinaryReader br = new BinaryReader(file); narc.ReadOffsets(br); narc.ReadElements(br); br.Close(); return narc; }
public static Narc Open(String filePath) { FileStream file = File.OpenRead(filePath); Narc narc = new Narc(Path.GetFileNameWithoutExtension(filePath)); BinaryReader br = new BinaryReader(file); narc.ReadOffsets(br); narc.ReadElements(br); br.Close(); return(narc); }
public static Narc FromFolder(String folderPath) { Narc narc = new Narc(Path.GetDirectoryName(folderPath)); String[] fileNames = Directory.GetFiles(folderPath, "*.*", SearchOption.AllDirectories); uint numberOfElements = (uint)fileNames.Length; narc.Elements = new MemoryStream[numberOfElements]; for (int i = 0; i < numberOfElements; i++) { FileStream fs = File.OpenRead(fileNames[i]); MemoryStream ms = new MemoryStream(); byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, (int)fs.Length); ms.Write(buffer, 0, (int)fs.Length); narc.Elements[i] = ms; fs.Close(); } return narc; }
public static Narc FromFolder(String dirPath) { Narc narc = new Narc(Path.GetDirectoryName(dirPath)); String[] fileNames = Directory.GetFiles(dirPath, "*.*", SearchOption.AllDirectories); uint numberOfElements = (uint)fileNames.Length; narc.Elements = new MemoryStream[numberOfElements]; for (int i = 0; i < numberOfElements; i++) { FileStream fs = File.OpenRead(fileNames[i]); MemoryStream ms = new MemoryStream(); byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, (int)fs.Length); ms.Write(buffer, 0, (int)fs.Length); narc.Elements[i] = ms; fs.Close(); } return(narc); }
public static Narc NewEmpty(String name = "NewNarc") { Narc narc = new Narc(name); return(narc); }
public static Narc NewEmpty(String name = "NewNarc") { Narc narc = new Narc(name); return narc; }