/*****************/ /**** Methods ****/ /*****************/ /// <summary> /// Creates a new battle voice package from the files located at the given path. /// </summary> /// <param name="directorypath">Path where the files to pack into the file are located.</param> /// <returns>A newly created <see cref="BVPFile"/>.</returns> public static BVPFile Create(string directorypath) { BVPFile bvp = new BVPFile(); string[] filepaths = Directory.GetFiles(directorypath); foreach (string item in filepaths) bvp.Entries.Add(new BVPEntry(item)); return bvp; }
static void Main(string[] args) { if (args.Length == 0) { Console.WriteLine("No input specified."); Console.WriteLine("Usage:"); Console.WriteLine(" Enter path to BVP file to extract it to a folder of the same name."); Console.WriteLine(" Enter path to directory to pack into a BVP."); Console.WriteLine("Press any key to continue."); Console.ReadKey(); return; } if (args[0].EndsWith(".BVP", StringComparison.InvariantCultureIgnoreCase)) { BVPFile bvp = new BVPFile(args[0]); bvp.Extract(Path.GetFileNameWithoutExtension(args[0])); } else if (!Path.HasExtension(args[0])) { BVPFile bvp = BVPFile.Create(args[0]); bvp.Save(Path.GetFileName(args[0]) + ".BVP"); } }
/*********************************/ /* Base wrapper method overrides */ /*********************************/ internal override void RebuildWrappedObject() { var archive = new BVPFile(); foreach (ResourceWrapper node in Nodes) archive.Entries.Add(new BVPEntry(node.GetBytes())); m_wrappedObject = archive; m_isDirty = false; }
/***************/ /* Constructor */ /***************/ public BVPFileWrapper(string text, BVPFile arc) : base(text, arc, SupportedFileType.BVPArchiveFile, false) { }