/// <summary> /// Stores a file into the Content Managers file, Throws FileNotFoundException if the file doesn't exist. Same effect from using "manager.Write(filePath, entryName, "file")" /// </summary> /// <param name="entryName">Name to give the entry</param> /// <param name="filePath">Path to the file to store</param> /// <param name="manager">Content Manager to store the file with</param> /// <exception cref="FileNotFoundException">Thrown if "filePath" doesn't point to a file</exception> public static void StoreFile(String entryName, String filePath, ref Content_Manager manager) { if (!File.Exists(filePath)) { throw new FileNotFoundException(filePath + " not found!"); } manager.Write(filePath, entryName, "file"); }
public static void WriteByteArray(String entryName, byte[] data, ref Content_Manager manager) { manager.Write(data, entryName, "byteArray"); }
public static void WriteBool(String entryName, bool data, ref Content_Manager manager) { manager.Write(data, entryName, "bool"); }
public static void WriteInt32Array(String entryName, int[] data, ref Content_Manager manager) { manager.Write(data, entryName, "int32Array"); }
public static void WriteStringArray(String entryName, String[] data, ref Content_Manager manager) { manager.Write(data, entryName, "stringArray"); }
/// <summary> /// Takes the data from a file entry/byte array entry and puts it into a file /// </summary> /// <param name="entryName">Name of the Byte Array/File entry</param> /// <param name="filePath">Path to extract the file to</param> /// <param name="manager">Content Manager used to read the data file</param> public static void ExtractFile(String entryName, String filePath, ref Content_Manager manager) { File.WriteAllBytes(filePath, manager.Read <byte[]>(entryName)); }
public static MemoryStream FileEntryToMemoryStream(String entryName, ref Content_Manager manager) { return(new MemoryStream(manager.Read <byte[]>(entryName))); }