예제 #1
0
 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));
     }
 }
예제 #2
0
파일: Profile.cs 프로젝트: rodriada000/7h
        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
                       ));
        }
예제 #3
0
파일: Library.cs 프로젝트: rodriada000/7h
        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);
        }