public PboEntry(string name, long size, DateTimeOffset timestamp, PboFile file, PboResolver resolver) { _name = name; _size = size; _file = file; _timestamp = timestamp; _resolver = resolver; }
/// <summary> /// Pack a folder into .pbo format /// </summary> /// <param name="pbo"></param> /// <returns>bool</returns> internal static bool PackPBO(PBOFile pbo, out Exception exception) { try { exception = null; string folderPath = Path.Combine(DLL.ConfigValues.GitDirectory, pbo.GitBranch); string modPath = Path.Combine(DLL.ConfigValues.GitDirectory, pbo.Name); Console.WriteLine($"Packing {pbo.Name}\n"); PboFile pboFile = new PboFile(); foreach (string files in Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories)) { string path = files.Replace(folderPath, ""); if (path.StartsWith(@"\")) { path = path.Substring(1); } string file = File.ReadAllText(files); pboFile.AddEntry(path, Encoding.UTF8.GetBytes(file)); } string modDirectory = modPath + ".pbo"; pboFile.Save(modDirectory); return(File.Exists(modDirectory)); } catch (IOException ex) { exception = ex; return(false); } catch (Exception ex) { exception = ex; return(false); } }