Exemplo n.º 1
0
 internal void Init(_7thWrapperLib.ModInfo info, Func <string, System.Drawing.Bitmap> imageReader, Func <string, System.IO.Stream> audioReader, ProfileItem profile, IEnumerable <fLibrary.Constraint> constraints, string iroPath)
 {
     _iroPath     = iroPath;
     _info        = info;
     _imageReader = imageReader;
     _audioReader = audioReader;
     _constraints = constraints.ToList();
     _values      = profile.Settings.ToDictionary(s => s.ID, s => s.Value, StringComparer.InvariantCultureIgnoreCase);
     lbOptions.Items.AddRange(info.Options.ToArray());
     lbOptions.SelectedIndex = 0;
 }
Exemplo n.º 2
0
        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.LoadLibraries,
                       modinfo.LoadAssemblies,
                       modinfo.LoadPlugins
                       ));
        }