public System.IO.Stream Read(string file) { if (_archive != null) { return(_archive.GetData(file)); } else { return(new System.IO.FileStream(System.IO.Path.Combine(BaseFolder, file), System.IO.FileMode.Open, System.IO.FileAccess.Read)); } }
public _7thWrapperLib.RuntimeMod GetRuntime(_7thWrapperLib.LoaderContext context) { var mod = Sys.Library.GetItem(ModID); if (mod == null) { return(null); } string location = System.IO.Path.Combine(Sys.Settings.LibraryLocation, mod.LatestInstalled.InstalledLocation); _7thWrapperLib.ModInfo modinfo = null; if (mod.LatestInstalled.InstalledLocation.EndsWith(".iro")) { using (var arc = new _7thWrapperLib.IrosArc(location)) { if (arc.HasFile("mod.xml")) { var doc = new System.Xml.XmlDocument(); doc.Load(arc.GetData("mod.xml")); modinfo = new _7thWrapperLib.ModInfo(doc, context); } } } else { string mfile = System.IO.Path.Combine(location, "mod.xml"); if (System.IO.File.Exists(mfile)) { modinfo = new _7thWrapperLib.ModInfo(mfile, context); } } modinfo = modinfo ?? new _7thWrapperLib.ModInfo(); foreach (var opt in modinfo.Options) { if (!Settings.Any(s => s.ID.Equals(opt.ID, StringComparison.InvariantCultureIgnoreCase))) { Settings.Add(new ProfileSetting() { ID = opt.ID, Value = opt.Default }); } } return(new _7thWrapperLib.RuntimeMod( location, modinfo.Conditionals.Where(f => IsActive(f.ActiveWhen)), modinfo.ModFolders.Where(f => IsActive(f.ActiveWhen)).Select(f => f.Folder), modinfo )); }
public Stream GetData(string name) { string path = Path.Combine(Sys.Settings.LibraryLocation, InstalledLocation); if (InstalledLocation.EndsWith(".iro", StringComparison.InvariantCultureIgnoreCase) && File.Exists(path)) { using (var arc = new _7thWrapperLib.IrosArc(path)) return(arc.GetData(name)); } else { path = Path.Combine(path, name); if (File.Exists(path)) { return(new FileStream(path, FileMode.Open, FileAccess.Read)); } } return(null); }