Пример #1
0
 public PatchModsMenu(TypeDefinitionCollection types, ModLoader loader)
     : base(types)
 {
     this.loader = loader;
     this.modManager = this.loader.modManager;
     this.repoManager = modManager.repoManager;
 }
Пример #2
0
 public ModInterceptor(ModLoader loader)
 {
     this.loader = loader;
     types = AssemblyFactory.GetAssembly (Platform.getGlobalScrollsInstallPath()+"ModLoader/Assembly-CSharp.dll").MainModule.Types;
 }
Пример #3
0
 public SimpleMethodReplacementProvider(ModLoader loader)
 {
     interceptor = new ModInterceptor (loader);
 }
Пример #4
0
 public APIHandler(ModLoader loader)
 {
     this.loader = loader;
 }
Пример #5
0
        //initial game callback
        public static void Init()
        {
            //wiredly App.Awake() calls Init multiple times, but we do not want multiple instances
            if (init)
                return;
            init = true;

            Console.WriteLine ("ModLoader version: " + ModLoader.getVersion ());

            if (Updater.tryUpdate ()) { //update
                Application.Quit ();
                return;
            }

            //Install global mod exception helper
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;

            instance = new ModLoader();
            MethodBodyReplacementProviderRegistry.SetProvider (new SimpleMethodReplacementProvider(instance));

            //otherwise we can finally load
            instance.loadMods ();

            //delete checks for loading crashes
            if (System.IO.File.Exists (Platform.getGlobalScrollsInstallPath () + System.IO.Path.DirectorySeparatorChar + "check.txt")) {
                System.IO.File.Delete (Platform.getGlobalScrollsInstallPath () + System.IO.Path.DirectorySeparatorChar + "check.txt");
            }
        }
Пример #6
0
 public ModInterceptor(ModLoader loader)
 {
     this.loader = loader;
     types       = AssemblyFactory.GetAssembly(Platform.getGlobalScrollsInstallPath() + "ModLoader/Assembly-CSharp.dll").MainModule.Types;
 }
Пример #7
0
 public SimpleMethodReplacementProvider(ModLoader loader)
 {
     interceptor = new ModInterceptor(loader);
 }
Пример #8
0
        private static byte[] token = new byte[] { 8, 95, 174, 161, 22, 41, 180, 133 };         //public key

        public static bool tryUpdate()
        {
            WebClientTimeOut client = new WebClientTimeOut();
            String           versionMessageRaw;

            try {
                versionMessageRaw = client.DownloadString(new Uri("http://mods.scrollsguide.com/version"));
            } catch (WebException) {
                return(false);
            }

            JsonReader     reader         = new JsonReader();
            VersionMessage versionMessage = (VersionMessage)reader.Read(versionMessageRaw, typeof(VersionMessage));

            int    version     = versionMessage.version();
            String installPath = Platform.getGlobalScrollsInstallPath() + Path.DirectorySeparatorChar + "ModLoader" + Path.DirectorySeparatorChar;

            try {
                File.Delete(installPath + "Updater.exe");
            } catch {}

            if (!System.IO.Directory.Exists(installPath))
            {
                System.IO.Directory.CreateDirectory(installPath);
            }

            if (version > ModLoader.getVersion())
            {
                byte[] asm;
                try {
                    asm = client.DownloadData(new Uri("http://mods.scrollsguide.com/download/update"));
                } catch (WebException) {
                    return(false);
                }
                File.WriteAllBytes(installPath + "Updater.exe", asm);
                if (CheckToken(installPath + "Updater.exe", token))
                {
                    try {
                        App.Popups.ShowInfo("Scrolls Summoner is updating", "Please wait while the update is being downloaded");
                        Dialogs.showNotification("Scrolls Summoner is updating", "Please wait while the update is being downloaded");
                    } catch { }

                    if (Platform.getOS() == Platform.OS.Win)
                    {
                        new Process {
                            StartInfo = { FileName = installPath + "Updater.exe", Arguments = "" }
                        }.Start();
                    }
                    else if (Platform.getOS() == Platform.OS.Mac)
                    {
                        Assembly.LoadFrom(installPath + "Updater.exe").EntryPoint.Invoke(null, new object[] { new string[] {} });
                    }
                    return(true);
                }

                try {
                    App.Popups.KillCurrentPopup();
                } catch {}
            }

            return(false);
        }
Пример #9
0
        public ModManager(ModLoader loader)
        {
            Platform.ErrorLog("ModManager creator");
            modsPath = Platform.getModsPath();

            if (!Directory.Exists (modsPath))
                Directory.CreateDirectory (modsPath);

            this.loader = loader;
            repoManager = new RepoManager (this);

            String installPath = Platform.getGlobalScrollsInstallPath();
            String modLoaderPath = Platform.getModLoaderPath() + System.IO.Path.DirectorySeparatorChar;

            Platform.ErrorLog("loadInstalledMods");
            this.loadInstalledMods ();
            Platform.ErrorLog("checkForUpdates");
            this.checkForUpdates   ();
            Platform.ErrorLog("sortInstalledMods");
            this.sortInstalledMods ();
        }
Пример #10
0
        //initial game callback
        public static void Init()
        {
            //wiredly App.Awake() calls Init multiple times, but we do not want multiple instances
            //TO-DO, find out why InjectBeforeEnd does this (Hooks.cs)
            if (init)
                return;
            init = true;

            instance = new ModLoader();
            MethodBodyReplacementProviderRegistry.SetProvider (new SimpleMethodReplacementProvider(instance));

            foreach (BaseMod mod in instance.modInstances) {
                mod.Init ();
            }
        }