public static FSDir MakeRoot(ParamSfo sfo = null, FSFile[] sc0Files = null) { if (sfo == null) { sfo = ParamSfo.DefaultAC; } var root = new FSDir(); var sysDir = new FSDir() { name = "sce_sys", Parent = root, }; sysDir.Files.Add(new FSFile(s => sfo.Write(s), "param.sfo", sfo.FileSize) { Parent = sysDir }); if (sc0Files != null) { foreach (var f in sc0Files) { sysDir.Files.Add(f); f.Parent = sysDir; } } root.Dirs.Add(sysDir); return(root); }
private static FSDir MakeRoot(ParamSfo sfo = null) { if (sfo == null) { sfo = ParamSfo.DefaultAC; } var root = new FSDir(); var sysDir = new FSDir() { name = "sce_sys", Parent = root, }; sysDir.Files.Add(new FSFile(s => sfo.Write(s), "param.sfo", sfo.FileSize) { Parent = sysDir }); root.Dirs.Add(sysDir); return(root); }
public void TestSfoWriteRead() { var sfo = new ParamSfo(); sfo.SetValue("KEY1", SfoEntryType.Integer, "1234"); sfo.SetValue("KEY2", SfoEntryType.Utf8, "This is the title", 32); sfo.SetValue("KEY3", SfoEntryType.Utf8Special, "This is a special string", 32); sfo.SetValue("KEY4", SfoEntryType.Integer, "0x1234"); using (var ms = new MemoryStream()) { sfo.Write(ms); ms.Seek(0, SeekOrigin.Begin); var sfo2 = ParamSfo.FromStream(ms); Assert.AreEqual((sfo2["KEY1"] as IntegerValue).Value, 1234); Assert.AreEqual((sfo2["KEY2"] as Utf8Value).Value, "This is the title"); Assert.AreEqual((sfo2["KEY3"] as Utf8SpecialValue).Value, "This is a special string"); Assert.AreEqual((sfo2["KEY4"] as IntegerValue).Value, 0x1234); } }