Example #1
0
        public async void UWP()
        {
            grdMain.IsVisible    = true;
            stkEsimene.IsVisible = true;

            MessagingCenter.Subscribe <App, string>((App)Application.Current, "exception", (sender, arg) => { Device.BeginInvokeOnMainThread(() => { DisplayAlert("VIGA", arg, "OK"); }); });
            MessagingCenter.Subscribe <App, string>((App)Application.Current, "scannerInitStatus", (sender, arg) => { Device.BeginInvokeOnMainThread(() => { Debug.WriteLine("Scanner initialization is complete " + arg); }); });
            MessagingCenter.Subscribe <App, string>((App)Application.Current, "downloadUpdateProgress", (sender, arg) => { Device.BeginInvokeOnMainThread(() => { lblUpdate.Text = "UUE VERSIOONI LAADIMINE " + arg + "%"; }); });
            MessagingCenter.Subscribe <App, string>((App)Application.Current, "deviceSerial", (sender, arg) => { Device.BeginInvokeOnMainThread(() => { lblDeviceSerial.Text = arg; Debug.WriteLine(arg); obj.deviceSerial = arg; }); });
            MessagingCenter.Subscribe <App, string>((App)Application.Current, "isDeviceHandheld", (sender, arg) => { Device.BeginInvokeOnMainThread(() => { obj.isDeviceHandheld = Convert.ToBoolean(arg); }); });
            MessagingCenter.Subscribe <App, string>((App)Application.Current, "backPressed", (sender, arg) => { Device.BeginInvokeOnMainThread(() => { entEdit1.Text = "BackPressed"; }); });

            MessagingCenter.Subscribe <App, string>(this, "KeyboardListener", (sender, args) => { CharacterReceived.Receive(args, this); });

            var version = await VersionCheck.Check(this);

            ScannedValueReceive();
            var resultSettings = await ReadSettings.Read(this);

            if (resultSettings.Item1)
            {
            }
            if (version.Item1)
            {
                if (lstSettings.Any())
                {
                    lstSettings.First().currentVersion = version.Item3;
                    lblVersion.Text = "Versioon: " + lstSettings.First().currentVersion;
                }
                else
                {
                    lstSettings = new List <ListOfSettings>();
                    lstSettings.Add(new ListOfSettings {
                        currentVersion = version.Item3
                    });
                    lblVersion.Text = "Versioon: " + lstSettings.First().currentVersion;
                }
            }
        }
Example #2
0
        private void FormLogin_Load(object sender, EventArgs e)
        {
            if (Properties.Settings.Default.CheckUpdateStartup)
            {
                string str = "";
                try
                {
                    str = VersionCheck.Check(ProductVersion);
                }
                catch (Exception)
                {
                    MessageBox.Show("Could not check version :(");
                    return;
                }

                if (!str.Equals("ok"))
                {
                    MessageBox.Show("A new version is available (" + str +
                                    "). Please visit 'www.futbud.com' to download the newest version");
                }
            }
        }
Example #3
0
        private void btnCheckUpdates_Click(object sender, EventArgs e)
        {
            string str;

            try
            {
                str = VersionCheck.Check(ProductVersion);
            }
            catch (Exception)
            {
                MessageBox.Show("Could not check version :(");
                return;
            }

            if (!str.Equals("ok"))
            {
                MessageBox.Show("A new version is available (" + str + "). Please visit 'www.futbud.com' to download the newest version");
            }
            else
            {
                MessageBox.Show("No update available");
            }
        }
        internal static void Patch()
        {
            try
            {
                if (Patched)
                {
                    return; // Halt patching
                }
                Patched = true;

                var gameDetector = new GameDetector();

                if (!gameDetector.IsValidGameRunning || !gameDetector.IsValidGameVersion)
                {
                    return;
                }

                CurrentlyRunningGame = gameDetector.CurrentlyRunningGame;

                if (QModBaseDir == null)
                {
                    Logger.Fatal("A fatal error has occurred.");
                    Logger.Fatal("There was an error with the QMods directory");
                    Logger.Fatal("Please make sure that you ran Subnautica from Steam/Epic/Discord, and not from the executable file!");

                    Dialogs.Add(new Dialog()
                    {
                        message     = "A fatal error has occurred. QModManager could not be initialized.",
                        color       = Dialog.DialogColor.Red,
                        leftButton  = Dialog.Button.SeeLog,
                        rightButton = Dialog.Button.Close,
                    });

                    return;
                }


                try
                {
                    Logger.Info("Game Folder structure:");
                    IOUtilities.LogFolderStructureAsTree();
                    Logger.Info("Game Folder structure ended.");
                }
                catch (Exception e)
                {
                    Logger.Error("There was an error while trying to display the folder structure.");
                    Logger.Exception(e);
                }

                var normalizedModDir = Path.GetFullPath(QModBaseDir);
                if (!normalizedModDir.EndsWith($"{Path.DirectorySeparatorChar}") && !normalizedModDir.EndsWith($"{Path.AltDirectorySeparatorChar}"))
                {
                    normalizedModDir += $"{Path.DirectorySeparatorChar}";
                }
                var ModDirUri = new Uri(normalizedModDir);

                var normalizedGameDir = Path.GetFullPath(Environment.CurrentDirectory);

                if (!normalizedGameDir.EndsWith($"{Path.DirectorySeparatorChar}") && !normalizedGameDir.EndsWith($"{Path.AltDirectorySeparatorChar}"))
                {
                    normalizedGameDir += $"{Path.DirectorySeparatorChar}";
                }
                var GameDirUri = new Uri(normalizedGameDir);


                if (!GameDirUri.IsBaseOf(ModDirUri))
                {
                    try
                    {
                        Logger.Info("Mods Folder structure:");
                        IOUtilities.LogFolderStructureAsTree(Path.Combine(BepInEx.Paths.BepInExRootPath, ".."));
                        Logger.Info("Mods Folder structure ended.");
                    }
                    catch (Exception e)
                    {
                        Logger.Error("There was an error while trying to display the folder structure.");
                        Logger.Exception(e);
                    }
                }

                PirateCheck.IsPirate(Environment.CurrentDirectory);

                PatchHarmony();

                if (NitroxCheck.IsRunning)
                {
                    Logger.Warn($"Nitrox was detected running!");

                    Dialogs.Add(new Dialog()
                    {
                        message     = "Nitrox detected. \nNitrox compatibility with QModManager is HIGHLY EXPERIMENTAL Expect bugs!.",
                        leftButton  = Dialog.Button.Close,
                        rightButton = Dialog.Button.Disabled,
                        color       = Dialog.DialogColor.Red,
                    });

                    return;
                }

                VersionCheck.Check();

                Logger.Info("Started loading mods");
            }
            catch (FatalPatchingException pEx)
            {
                Logger.Fatal($"A fatal patching exception has been caught! Patching ended prematurely!");
                Logger.Exception(pEx);

                Dialogs.Add(new Dialog()
                {
                    message    = "A fatal patching exception has been caught. QModManager could not be initialized.",
                    color      = Dialog.DialogColor.Red,
                    leftButton = Dialog.Button.SeeLog,
                });
            }
            catch (Exception e)
            {
                Logger.Fatal("An unhandled exception has been caught! Patching ended prematurely!");
                Logger.Exception(e);

                Dialogs.Add(new Dialog()
                {
                    message    = "An unhandled exception has been caught. QModManager could not be initialized.",
                    color      = Dialog.DialogColor.Red,
                    leftButton = Dialog.Button.SeeLog,
                });
            }
        }
Example #5
0
        internal static void Patch()
        {
            try
            {
                if (Patched)
                {
                    Logger.Warn("Patch method was called multiple times!");
                    return; // Halt patching
                }

                Patched = true;

                Logger.Info("Game Version: " + SNUtils.GetPlasticChangeSetOfBuild() + " Build Date: " + SNUtils.GetDateTimeOfBuild().ToLongDateString());
                Logger.Info($"Loading QModManager v{Assembly.GetExecutingAssembly().GetName().Version.ToStringParsed()}...");
                Logger.Info($"Today is {DateTime.Today:dd-MMMM-yyyy}");

                if (QModBaseDir == null)
                {
                    Logger.Fatal("A fatal error has occurred.");
                    Logger.Fatal("There was an error with the QMods directory");
                    Logger.Fatal("Please make sure that you ran Subnautica from Steam/Epic/Discord, and not from the executable file!");

                    new Dialog()
                    {
                        message     = "A fatal error has occurred. QModManager could not be initialized.",
                        color       = Dialog.DialogColor.Red,
                        leftButton  = Dialog.Button.SeeLog,
                        rightButton = Dialog.Button.Close,
                    }.Show();

                    return;
                }

                try
                {
                    Logger.Info($"Folder structure:\n{IOUtilities.GetFolderStructureAsTree()}\n");
                }
                catch (Exception e)
                {
                    Logger.Error("There was an error while trying to display the folder structure.");
                    Logger.Exception(e);
                }

                PirateCheck.IsPirate(Environment.CurrentDirectory);

                var gameDetector = new GameDetector();

                if (!gameDetector.IsValidGameRunning)
                {
                    return;
                }

                CurrentlyRunningGame = gameDetector.CurrentlyRunningGame;

                try
                {
                    PatchHarmony();
                }
                catch (Exception e)
                {
                    Logger.Error("There was an error while trying to apply Harmony patches.");
                    Logger.Exception(e);
                }

                if (NitroxCheck.IsInstalled)
                {
                    Logger.Fatal($"Nitrox was detected!");

                    new Dialog()
                    {
                        message     = "Both QModManager and Nitrox detected. QModManager is not compatible with Nitrox. Please uninstall one of them.",
                        leftButton  = Dialog.Button.Disabled,
                        rightButton = Dialog.Button.Disabled,
                        color       = Dialog.DialogColor.Red,
                    }.Show();

                    return;
                }

                VersionCheck.Check();

                Logger.Info("Started loading mods");

                AddAssemblyResolveEvent();

                IQModFactory modFactory = new QModFactory();
                List <QMod>  modsToLoad = modFactory.BuildModLoadingList(QModBaseDir);

                QModServices.LoadKnownMods(modsToLoad);

                var initializer = new Initializer(CurrentlyRunningGame);
                initializer.InitializeMods(modsToLoad);

                SummaryLogger.ReportIssues(modsToLoad);

                SummaryLogger.LogSummaries(modsToLoad);
            }
            catch (FatalPatchingException pEx)
            {
                Logger.Fatal($"A fatal patching exception has been caught! Patching ended prematurely!");
                Logger.Exception(pEx);

                new Dialog()
                {
                    message    = "A fatal patching exception has been caught. QModManager could not be initialized.",
                    color      = Dialog.DialogColor.Red,
                    leftButton = Dialog.Button.SeeLog,
                }.Show();
            }
            catch (Exception e)
            {
                Logger.Fatal("An unhandled exception has been caught! Patching ended prematurely!");
                Logger.Exception(e);

                new Dialog()
                {
                    message    = "An unhandled exception has been caught. QModManager could not be initialized.",
                    color      = Dialog.DialogColor.Red,
                    leftButton = Dialog.Button.SeeLog,
                }.Show();
            }
        }
Example #6
0
        internal static void Patch()
        {
            try
            {
                if (patched)
                {
                    Logger.Warn("Patch method was called multiple times!");
                    return; // Halt patching
                }

                Patched = true;

                Logger.Info($"Loading QModManager v{Assembly.GetExecutingAssembly().GetName().Version.ToStringParsed()}...");
                Logger.Info($"Today is {DateTime.Today:dd-MMMM-yyyy}");

                if (QModBaseDir == null)
                {
                    Logger.Fatal("A fatal error has occurred.");
                    Logger.Fatal("There was an error with the QMods directory");
                    Logger.Fatal("Please make sure that you ran Subnautica from Steam/Epic/Discord, and not from the executable file!");

                    Dialog.Show("A fatal error has occurred. QModManager could not be initialized.", Dialog.Button.close, Dialog.Button.Disabled, false);

                    return;
                }

                try
                {
                    Logger.Info($"Folder structure:\n{IOUtilities.GetFolderStructureAsTree()}\n");
                }
                catch (Exception e)
                {
                    Logger.Error("There was an error while trying to display the folder structure.");
                    Logger.Exception(e);
                }

                Logger.Info($"Loading QModManager v{Assembly.GetExecutingAssembly().GetName().Version.ToStringParsed()}...");

                PirateCheck.IsPirate(Environment.CurrentDirectory);

                var gameDetector = new GameDetector();

                if (!gameDetector.IsValidGameRunning)
                {
                    return;
                }

                CurrentlyRunningGame = gameDetector.CurrentlyRunningGame;

                PatchHarmony();

                if (NitroxCheck.IsInstalled)
                {
                    Logger.Fatal($"Nitrox was detected!");

                    Dialog.Show("Both QModManager and Nitrox detected. QModManager is not compatible with Nitrox. Please uninstall one of them.", Dialog.Button.Disabled, Dialog.Button.Disabled, false);

                    return;
                }

                VersionCheck.Check();

                Logger.Info("Started loading mods");

                AddAssemblyResolveEvent();

                IQModFactory modFactory = new QModFactory();
                List <QMod>  modsToLoad = modFactory.BuildModLoadingList(QModBaseDir);

                QModServices.LoadKnownMods(modsToLoad);

                var initializer = new Initializer(CurrentlyRunningGame);
                initializer.InitializeMods(modsToLoad);

                int loadedMods  = 0;
                int erroredMods = 0;
                foreach (QMod mod in modsToLoad)
                {
                    if (mod.IsLoaded)
                    {
                        loadedMods++;
                    }
                    else if (mod.Enable)
                    {
                        erroredMods++;
                    }
                }

                ErrorModCount = erroredMods;

                Logger.Info($"Finished loading QModManager. Loaded {loadedMods} mods");

                if (ErrorModCount > 0)
                {
                    string msg = $"A total of {ErrorModCount} mods failed to load";
                    Logger.Warn(msg);
                    Dialog.Show(msg + "\nSee log file for details.", Dialog.Button.close, Dialog.Button.Disabled, false);
                }

                SummaryLogger.LogSummaries(modsToLoad);
            }
            catch (FatalPatchingException pEx)
            {
                Logger.Fatal($"A fatal patching exception has been caught! Patching ended prematurely!");
                Logger.Exception(pEx);

                Dialog.Show("A fatal patching exception has been caught. QModManager could not be initialized.", Dialog.Button.close, Dialog.Button.Disabled, false);
            }
            catch (Exception e)
            {
                Logger.Fatal("An unhandled exception has been caught! - Patching ended prematurely!");
                Logger.Exception(e);

                Dialog.Show("An unhandled exception has been caught. QModManager could not be initialized.", Dialog.Button.close, Dialog.Button.Disabled, false);
            }
        }
Example #7
0
        internal static void Patch()
        {
            try
            {
                if (Patched)
                {
                    Logger.Warn("Patch method was called multiple times!");
                    return; // Halt patching
                }

                Patched = true;

                var gameDetector = new GameDetector();

                if (!gameDetector.IsValidGameRunning || !gameDetector.IsValidGameVersion)
                {
                    return;
                }

                CurrentlyRunningGame = gameDetector.CurrentlyRunningGame;

                if (QModBaseDir == null)
                {
                    Logger.Fatal("A fatal error has occurred.");
                    Logger.Fatal("There was an error with the QMods directory");
                    Logger.Fatal("Please make sure that you ran Subnautica from Steam/Epic/Discord, and not from the executable file!");

                    new Dialog()
                    {
                        message     = "A fatal error has occurred. QModManager could not be initialized.",
                        color       = Dialog.DialogColor.Red,
                        leftButton  = Dialog.Button.SeeLog,
                        rightButton = Dialog.Button.Close,
                    }.Show();

                    return;
                }

                try
                {
                    Logger.Info("Folder structure:");
                    IOUtilities.LogFolderStructureAsTree();
                    Logger.Info("Folder structure ended.");
                }
                catch (Exception e)
                {
                    Logger.Error("There was an error while trying to display the folder structure.");
                    Logger.Exception(e);
                }

                PirateCheck.IsPirate(Environment.CurrentDirectory);

                PatchHarmony();

                if (NitroxCheck.IsInstalled)
                {
                    Logger.Fatal($"Nitrox was detected!");

                    new Dialog()
                    {
                        message     = "Both QModManager and Nitrox detected. QModManager is not compatible with Nitrox. Please uninstall one of them.",
                        leftButton  = Dialog.Button.Disabled,
                        rightButton = Dialog.Button.Disabled,
                        color       = Dialog.DialogColor.Red,
                    }.Show();

                    return;
                }

                VersionCheck.Check();

                Logger.Info("Started loading mods");

                AddAssemblyResolveEvent();
            }
            catch (FatalPatchingException pEx)
            {
                Logger.Fatal($"A fatal patching exception has been caught! Patching ended prematurely!");
                Logger.Exception(pEx);

                new Dialog()
                {
                    message    = "A fatal patching exception has been caught. QModManager could not be initialized.",
                    color      = Dialog.DialogColor.Red,
                    leftButton = Dialog.Button.SeeLog,
                }.Show();
            }
            catch (Exception e)
            {
                Logger.Fatal("An unhandled exception has been caught! Patching ended prematurely!");
                Logger.Exception(e);

                new Dialog()
                {
                    message    = "An unhandled exception has been caught. QModManager could not be initialized.",
                    color      = Dialog.DialogColor.Red,
                    leftButton = Dialog.Button.SeeLog,
                }.Show();
            }
        }