コード例 #1
0
ファイル: Globals.cs プロジェクト: owner-gamers/Arctium
 public static void InitializeManager()
 {
     AddonMgr = AddonManager.GetInstance();
     DataMgr = DataManager.GetInstance();
     ObjectMgr = ObjectManager.GetInstance();
     SkillMgr = SkillManager.GetInstance();
     SpawnMgr = SpawnManager.GetInstance();
     SpellMgr = SpellManager.GetInstance();
     WorldMgr = WorldManager.GetInstance();
 }
コード例 #2
0
ファイル: Globals.cs プロジェクト: Mathias1000/Arctium
 public static void InitializeManager()
 {
     ActionMgr         = ActionManager.GetInstance();
     AddonMgr          = AddonManager.GetInstance();
     SkillMgr          = SkillManager.GetInstance();
     SpellMgr          = SpellManager.GetInstance();
     SpecializationMgr = SpecializationManager.GetInstance();
     ItemMgr = ItemManager.GetInstance();
     DataMgr           = DataManager.GetInstance();
     SpawnMgr          = SpawnManager.GetInstance();
     GossipMgr         = GossipManager.GetInstance();
     ObjectMgr         = ObjectManager.GetInstance();
     WorldMgr          = WorldManager.GetInstance();
     LevelStatMgr      = LevelStatManager.GetInstance();
 }
コード例 #3
0
ファイル: Globals.cs プロジェクト: Khiy/Arctium-WoW
        public static void Initialize()
        {
            // Load dbc files.
            CliDB.Initialize();

            ActionMgr         = ActionManager.GetInstance();
            AddonMgr          = AddonManager.GetInstance();
            SkillMgr          = SkillManager.GetInstance();
            SpellMgr          = SpellManager.GetInstance();
            SpecializationMgr = SpecializationManager.GetInstance();
            DataMgr           = DataManager.GetInstance();
            SpawnMgr          = SpawnManager.GetInstance();
            GossipMgr         = GossipManager.GetInstance();
            ObjectMgr         = ObjectManager.GetInstance();
            WorldMgr          = WorldManager.GetInstance();
        }
コード例 #4
0
 public override void OnLoad(AddonManager manager, Addon owner)
 {
     wantsTrackingData = new List <Overlay>();
     SteamVR_Event.Listen("new_poses", OnNewPoses);
 }
コード例 #5
0
 // Start is called before the first frame update
 void OnEnable()
 {
     AddonManager.ActivateMods(AddonStart.Designer);
     Helper.InvokeOnEnterDesigner();
 }
コード例 #6
0
ファイル: App.xaml.cs プロジェクト: walkingthicc/EarTrumpet
        private Window CreateSettingsExperience()
        {
            var defaultCategory = new SettingsCategoryViewModel(
                EarTrumpet.Properties.Resources.SettingsCategoryTitle,
                "\xE71D",
                EarTrumpet.Properties.Resources.SettingsDescriptionText,
                null,
                new SettingsPageViewModel[]
            {
                new EarTrumpetShortcutsPageViewModel(_settings),
                new EarTrumpetLegacySettingsPageViewModel(_settings),
                new EarTrumpetAboutPageViewModel(() => _errorReporter.DisplayDiagnosticData())
            });

            var allCategories = new List <SettingsCategoryViewModel>();

            allCategories.Add(defaultCategory);

            if (AddonManager.Host.SettingsItems != null)
            {
                allCategories.AddRange(AddonManager.Host.SettingsItems.Select(a => a.Get(AddonManager.FindAddonInfoForObject(a))));
            }

            var viewModel = new SettingsViewModel(EarTrumpet.Properties.Resources.SettingsWindowText, allCategories);

            return(new SettingsWindow {
                DataContext = viewModel
            });
        }
コード例 #7
0
        private async void StartGame(string otp)
        {
            Log.Information("StartGame() called");
            try
            {
                var gateStatus = false;
                try
                {
                    gateStatus = await Task.Run(() => _game.GetGateStatus());
                }
                catch
                {
                    // ignored
                }

#if !DEBUG
                if (!gateStatus)
                {
                    Log.Information("GateStatus is false.");
                    var startLauncher = MessageBox.Show(
                        "Square Enix seems to be running maintenance work right now. The game shouldn't be launched. Do you want to start the official launcher to check for patches?", "XIVLauncher", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes;

                    if (startLauncher)
                    {
                        Util.StartOfficialLauncher(App.Settings.GamePath, SteamCheckBox.IsChecked == true);
                    }

                    _isLoggingIn = false;

                    return;
                }
#endif

                var loginResult = _game.Login(LoginUsername.Text, LoginPassword.Password, otp, SteamCheckBox.IsChecked == true, App.Settings.UniqueIdCacheEnabled, App.Settings.GamePath);

                if (loginResult == null)
                {
                    Log.Information("LoginResult was null...");
                    _isLoggingIn = false;

                    // If this is an autologin, we don't want to stick around after a failed login
                    if (AutoLoginCheckBox.IsChecked == true)
                    {
                        Close();
                        Environment.Exit(0);
                    }

                    return;
                }

                if (loginResult.State != XivGame.LoginState.Ok)
                {
                    var msgBoxResult = MessageBox.Show(
                        "Your game is out of date. Please start the official launcher and update it before trying to log in. Do you want to start the official launcher?",
                        "Out of date", MessageBoxButton.YesNo, MessageBoxImage.Error);

                    if (msgBoxResult == MessageBoxResult.Yes)
                    {
                        Util.StartOfficialLauncher(App.Settings.GamePath, SteamCheckBox.IsChecked == true);
                    }

                    /*
                     * var patcher = new Game.Patch.PatchInstaller(_game, "ffxiv");
                     * //var window = new IntegrityCheckProgressWindow();
                     * var progress = new Progress<PatchDownloadProgress>();
                     * progress.ProgressChanged += (sender, checkProgress) => Log.Verbose("PROGRESS");
                     *
                     * Task.Run(async () => await patcher.DownloadPatchesAsync(loginResult.PendingPatches, loginResult.OauthLogin.SessionId, progress)).ContinueWith(task =>
                     * {
                     *  //window.Dispatcher.Invoke(() => window.Close());
                     *  MessageBox.Show("Download OK");
                     * });
                     */
                    return;
                }

                var gameProcess = XivGame.LaunchGame(loginResult.UniqueId, loginResult.OauthLogin.Region,
                                                     loginResult.OauthLogin.MaxExpansion, App.Settings.SteamIntegrationEnabled,
                                                     SteamCheckBox.IsChecked == true, App.Settings.AdditionalLaunchArgs, App.Settings.GamePath, App.Settings.IsDx11, App.Settings.Language.GetValueOrDefault(ClientLanguage.English), App.Settings.EncryptArguments.GetValueOrDefault(false));

                if (gameProcess == null)
                {
                    Log.Information("GameProcess was null...");
                    _isLoggingIn = false;
                    return;
                }

                this.Hide();

                var addonMgr = new AddonManager();

                try
                {
                    var addons = App.Settings.AddonList.Where(x => x.IsEnabled).Select(x => x.Addon).Cast <IAddon>().ToList();

                    if (App.Settings.InGameAddonEnabled && App.Settings.IsDx11)
                    {
                        addons.Add(new DalamudLauncher());
                    }

                    await Task.Run(() => addonMgr.RunAddons(gameProcess, App.Settings, addons));
                }
                catch (Exception ex)
                {
                    new ErrorWindow(ex,
                                    "This could be caused by your antivirus, please check its logs and add any needed exclusions.",
                                    "Addons").ShowDialog();
                    _isLoggingIn = false;

                    addonMgr.StopAddons();
                }

                var watchThread = new Thread(() =>
                {
                    while (!gameProcess.HasExited)
                    {
                        gameProcess.Refresh();
                        Thread.Sleep(1);
                    }

                    Log.Information("Game has exited.");
                    addonMgr.StopAddons();
                    Environment.Exit(0);
                });
                watchThread.Start();

                this.Close();
            }
            catch (Exception ex)
            {
                new ErrorWindow(ex, "Please also check your login information or try again.", "Login").ShowDialog();
                _isLoggingIn = false;
            }
        }
コード例 #8
0
        private async Task StartGameAndAddon(Launcher.LoginResult loginResult, bool gateStatus)
        {
            if (!gateStatus)
            {
                Log.Information("GateStatus is false.");
                CustomMessageBox.Show(
                    Loc.Localize("MaintenanceNotice",
                                 "Maintenance seems to be in progress. The game shouldn't be launched."),
                    "XIVLauncher", MessageBoxButton.OK, MessageBoxImage.Exclamation, false);

                _isLoggingIn = false;

                _ = Task.Run(SetupHeadlines);
                Show();
                Activate();
                return;
            }

            // We won't do any sanity checks here anymore, since that should be handled in StartLogin

            var gameProcess = Launcher.LaunchGame(loginResult.UniqueId, loginResult.OauthLogin.Region,
                                                  loginResult.OauthLogin.MaxExpansion, App.Settings.SteamIntegrationEnabled,
                                                  SteamCheckBox.IsChecked == true, App.Settings.AdditionalLaunchArgs, App.Settings.GamePath, App.Settings.IsDx11, App.Settings.Language.GetValueOrDefault(ClientLanguage.English), App.Settings.EncryptArguments.GetValueOrDefault(false));

            if (gameProcess == null)
            {
                Log.Information("GameProcess was null...");
                _isLoggingIn = false;
                return;
            }

            CleanUp();

            this.Hide();

            var addonMgr = new AddonManager();

            try
            {
                if (App.Settings.AddonList == null)
                {
                    App.Settings.AddonList = new List <AddonEntry>();
                }

                var addons = App.Settings.AddonList.Where(x => x.IsEnabled).Select(x => x.Addon).Cast <IAddon>().ToList();

                if (App.Settings.InGameAddonEnabled && App.Settings.IsDx11)
                {
                    var overlay = new DalamudLoadingOverlay();
                    overlay.Hide();
                    addons.Add(new DalamudLauncher(overlay));
                }
                else
                {
                    Log.Warning("In-Game addon was not enabled.");
                }

                await Task.Run(() => addonMgr.RunAddons(gameProcess, App.Settings, addons));
            }
            catch (Exception ex)
            {
                new ErrorWindow(ex,
                                "This could be caused by your antivirus, please check its logs and add any needed exclusions.",
                                "Addons").ShowDialog();
                _isLoggingIn = false;

                addonMgr.StopAddons();
            }

            var watchThread = new Thread(() =>
            {
                while (!gameProcess.HasExited)
                {
                    gameProcess.Refresh();
                    Thread.Sleep(1);
                }

                Log.Information("Game has exited.");
                addonMgr.StopAddons();

                CleanUp();

                Environment.Exit(0);
            });

            watchThread.Start();

            Log.Debug("Started WatchThread");
        }
コード例 #9
0
 private static Starter GetInstance()
 {
     return((Starter)AddonManager.GetRequiredAddon(RequiredAddon.Starter));
 }
コード例 #10
0
        //todo: we want to use the same guid, to overwrite existing addon.
        //todo: we want to parse a different version of the .c3ide file with relative paths
        //todo: abstract this functionaility out to a helper class

        /// <summary>
        /// when a file is dropped into the list box, if the file is a .c3ide file parse the file and load the addon
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void AddonFile_OnDrop(object sender, DragEventArgs e)
        {
            try
            {
                var     file = ((string[])e.Data.GetData(DataFormats.FileDrop))?.FirstOrDefault();
                var     info = new FileInfo(file);
                C3Addon c3addon;

                if (info.Extension.Contains("c3ide"))
                {
                    var addonInfo = File.ReadAllLines(info.FullName)[0];
                    if (addonInfo == "@@METADATA")
                    {
                        c3addon = ProjectManager.ReadProject(info.FullName);
                    }
                    else
                    {
                        var data = File.ReadAllText(info.FullName);
                        c3addon = JsonConvert.DeserializeObject <C3Addon>(data);
                    }

                    //when you import the project, it should not overwrite any other project
                    if (OptionsManager.CurrentOptions.OverwriteGuidOnImport)
                    {
                        c3addon.Id = Guid.NewGuid();
                    }

                    c3addon.LastModified = DateTime.Now;

                    //get the plugin template
                    c3addon.Template = TemplateFactory.Insatnce.CreateTemplate(c3addon.Type);

                    var addonIndex = AddonManager.AllAddons.Count - 1;
                    AddonManager.CurrentAddon = c3addon;
                    AddonManager.SaveCurrentAddon();
                    AddonManager.LoadAllAddons();
                    AddonListBox.ItemsSource = AddonManager.AllAddons;
                    AddonManager.LoadAddon(c3addon);
                }
                else if (info.Extension.Contains("c3addon"))
                {
                    var result = await WindowManager.ShowDialog("(EXPERIMENTAL) Importing C3Addon File", "Importing a C3addon file is an experimental feature. Please verify your file was improted correctly. If you encounter an issue please open a Github Issue Ticket");

                    if (result)
                    {
                        c3addon = await C3AddonImporter.Insatnce.Import(info.FullName);

                        AddonManager.LoadAddon(c3addon);
                        AddonManager.SaveCurrentAddon();
                        AddonManager.LoadAllAddons();
                        AddonListBox.ItemsSource = AddonManager.AllAddons;
                        AddonManager.LoadAddon(c3addon);
                    }
                }
                else if (info.Extension.Contains("c2addon"))
                {
                    var result = await WindowManager.ShowDialog("(VERY EXPERIMENTAL) Importing C2Addon File", "Importing a C2addon file is an very experimental feature and expected to have BUGS. THIS DOES NOT FULLY CONVERT YOUR ADDON, it will attempt to generate stubs for the ACES. if you run into any issue importing please file Github Issue Ticket, please include the c2addon your trying to convert to help identify the issues, NOT ALL ISSUE WILL BE RESOLVED but i will do my best!!!");

                    if (result)
                    {
                        c3addon = await C2AddonImporter.Insatnce.Import2Addon(info.FullName);

                        AddonManager.LoadAddon(c3addon);
                        AddonManager.SaveCurrentAddon();
                        AddonManager.LoadAllAddons();
                        AddonListBox.ItemsSource = AddonManager.AllAddons;
                        AddonManager.LoadAddon(c3addon);
                    }
                }
                //else if (info.Extension.Contains("svg"))
                //{
                //    //todo: need to find a way to drag items into list box item
                //}
                else
                {
                    throw new InvalidOperationException("invalid file type, for import");
                }
            }
            catch (Exception exception)
            {
                LogManager.AddErrorLog(exception);
                NotificationManager.PublishErrorNotification($"error importing file, check import.log => {Path.Combine(OptionsManager.CurrentOptions.DataPath, "import.log")}");
            }
        }
コード例 #11
0
        public static FileBuilder Parse <T>(
            string returnValueExpression = "0",
            string statements            = "",
            bool varGeneration           = true,
            bool varDummyClass           = false)
        {
            string typeName = "";

            if (typeof(T) == typeof(long))
            {
                typeName = "int";
            }
            else if (typeof(T) == typeof(double))
            {
                typeName = "decimal";
            }
            else if (typeof(T) == typeof(bool))
            {
                typeName = "bool";
            }
            else if (typeof(T) == typeof(string))
            {
                typeName = "string";
            }
            else if (typeof(T) == typeof(TimeSpan))
            {
                typeName = "timespan";
            }
            else if (typeof(T) == typeof(DateTime))
            {
                typeName = "datetime";
            }
            else if (typeof(T) == typeof(Verdict))
            {
                typeName = "verdict";
            }
            else if (typeof(T) == typeof(DummyDataClass))
            {
                typeName = "DummyDataClass";
            }
            else if (typeof(T) == typeof(DataReport))
            {
                typeName = "DataReport";
            }
            else
            {
                throw new NotImplementedException();
            }
            StringBuilder source = new StringBuilder();

            source.AppendLine(typeName + " ExpressionProcedure(){");
            if (varGeneration || varDummyClass)
            {
                AddLocalVariables(source, varDummyClass);
            }
            source.AppendLine(statements);
            source.AppendLine(typeName + " result = " + returnValueExpression + ";");
            source.AppendLine("return result;");
            source.AppendLine("}");
            IAddonManager addons = AddonManager.Create();

            addons.AddAssembly(typeof(Enumerable).Assembly, false);
            addons.AddAssembly(typeof(ExpressionParser).Assembly, false);
            return(FileBuilder.ParseProcedure(
                       addons,
                       new string[] { typeof(DataReport).Namespace, typeof(DummyClass).FullName, typeof(DummyClass).Namespace },
                       null,
                       source.ToString()));
        }
コード例 #12
0
ファイル: Plugin.cs プロジェクト: andybak/VRUtilityBelt
 public override void OnLoad(AddonManager manager, Addon owner)
 {
     _owner = owner;
 }
コード例 #13
0
ファイル: IPlugin.cs プロジェクト: andybak/VRUtilityBelt
 /// <summary>
 /// OnLoad is called once when the DLL is loaded, not per-addon that uses it.
 /// </summary>
 /// <param name="manager">Instance of AddonManager used to manage all addons</param>
 /// <param name="owner">Owner of this plugin.</param>
 public virtual void OnLoad(AddonManager manager, Addon owner)
 {
 }
コード例 #14
0
ファイル: App.xaml.cs プロジェクト: privatuser/EarTrumpet
        private Window CreateSettingsExperience()
        {
            var defaultCategory = new SettingsCategoryViewModel(
                EarTrumpet.Properties.Resources.SettingsCategoryTitle,
                "\xE71D",
                EarTrumpet.Properties.Resources.SettingsDescriptionText,
                null,
                new SettingsPageViewModel[]
            {
                new EarTrumpetShortcutsPageViewModel(_settings),
                new EarTrumpetLegacySettingsPageViewModel(_settings),
                new EarTrumpetAboutPageViewModel(() => _errorReporter.DisplayDiagnosticData())
            });

            var allCategories = new List <SettingsCategoryViewModel>();

            allCategories.Add(defaultCategory);

            if (AddonManager.Host.SettingsItems != null)
            {
                allCategories.AddRange(AddonManager.Host.SettingsItems.Select(a => a.Get(AddonManager.FindAddonInfoForObject(a))));
            }

            bool canClose  = false;
            var  viewModel = new SettingsViewModel(EarTrumpet.Properties.Resources.SettingsWindowText, allCategories);
            var  window    = new SettingsWindow {
                DataContext = viewModel
            };

            window.CloseClicked += () => viewModel.OnClosing();
            viewModel.Close     += () =>
            {
                canClose = true;
                window.SafeClose();
            };
            window.Closing += (_, e) =>
            {
                if (canClose)
                {
                    _settingsWindow.Destroyed();
                }
                else
                {
                    e.Cancel = true;
                    viewModel.OnClosing();
                }
            };
            return(window);
        }
コード例 #15
0
        private async void StartGame(string otp)
        {
            Log.Information("StartGame() called");
            try
            {
                var gateStatus = false;
                try
                {
                    gateStatus = await Task.Run(() => _game.GetGateStatus());
                }
                catch
                {
                    // ignored
                }

                #if !DEBUG
                if (!gateStatus)
                {
                    Log.Information("GateStatus is false.");
                    MessageBox.Show(
                        "Square Enix seems to be running maintenance work right now or the login server is unreachable. The game shouldn't be launched.",
                        "Error", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    _isLoggingIn = false;

                    return;
                }
                #endif

                var loginResult = _game.Login(LoginUsername.Text, LoginPassword.Password, otp, SteamCheckBox.IsChecked == true, Settings.UniqueIdCacheEnabled);

                if (loginResult == null)
                {
                    Log.Information("LoginResult was null...");
                    _isLoggingIn = false;
                    return;
                }

                if (loginResult.State == XivGame.LoginState.NeedsPatch)
                {
                    /*
                     * var patcher = new Game.Patch.PatchInstaller(_game, "ffxiv");
                     * //var window = new IntegrityCheckProgressWindow();
                     * var progress = new Progress<PatchDownloadProgress>();
                     * progress.ProgressChanged += (sender, checkProgress) => Log.Verbose("PROGRESS");
                     *
                     * Task.Run(async () => await patcher.DownloadPatchesAsync(loginResult.PendingPatches, loginResult.OauthLogin.SessionId, progress)).ContinueWith(task =>
                     * {
                     *  //window.Dispatcher.Invoke(() => window.Close());
                     *  MessageBox.Show("Download OK");
                     * });
                     */
                    return;
                }

                var gameProcess = XivGame.LaunchGame(loginResult.UniqueId, loginResult.OauthLogin.Region,
                                                     loginResult.OauthLogin.MaxExpansion, Settings.SteamIntegrationEnabled,
                                                     SteamCheckBox.IsChecked == true, Settings.AdditionalLaunchArgs);

                if (gameProcess == null)
                {
                    Log.Information("GameProcess was null...");
                    _isLoggingIn = false;
                    return;
                }

                var addonMgr = new AddonManager();

                try
                {
                    var addons = Settings.GetAddonList().Where(x => x.IsEnabled).ToList();

                    addons.Add(new AddonEntry {
                        Addon = new CharacterBackupAddon()
                    });

                    if (Settings.CharacterSyncEnabled)
                    {
                        addons.Add(new AddonEntry {
                            Addon = new CharacterSyncAddon()
                        });
                    }

                    await Task.Run(() => addonMgr.RunAddons(gameProcess, addons));
                }
                catch (Exception ex)
                {
                    new ErrorWindow(ex,
                                    "This could be caused by your antivirus, please check its logs and add any needed exclusions.",
                                    "Addons").ShowDialog();
                    _isLoggingIn = false;

                    addonMgr.StopAddons();
                }

                try
                {
                    if (Settings.IsInGameAddonEnabled())
                    {
                        var hooks = new DalamudLauncher(gameProcess);
                        hooks.Run();
                    }
                }
                catch (Exception ex)
                {
                    new ErrorWindow(ex,
                                    "This could be caused by your antivirus, please check its logs and add any needed exclusions.",
                                    "Hooks").ShowDialog();
                    _isLoggingIn = false;

                    addonMgr.StopAddons();
                }

                this.Close();

                var watchThread = new Thread(() =>
                {
                    while (!gameProcess.HasExited)
                    {
                        gameProcess.Refresh();
                        Thread.Sleep(1);
                    }

                    Log.Information("Game has exited.");
                    addonMgr.StopAddons();
                    Environment.Exit(0);
                });
                watchThread.Start();
            }
            catch (Exception ex)
            {
                new ErrorWindow(ex, "Please also check your login information or try again.", "Login").ShowDialog();
                _isLoggingIn = false;
            }
        }
コード例 #16
0
ファイル: Plugin.cs プロジェクト: andybak/VRUtilityBelt
 public override void OnLoad(AddonManager manager, Addon owner)
 {
     Logger.Info("SUPER SIMPLE OnLoad Fired");
 }
コード例 #17
0
 /// <summary>
 ///  Managers used by the Garage Instance
 /// </summary>
 public Instance(VehicleManager vm, AddonManager am, BayManager bm)
 {
     _manager.Add("Vehicle", vm);
     _manager.Add("Addon", am);
     _manager.Add("Bay", bm);
 }
コード例 #18
0
 public override void OnLoad(AddonManager manager, Addon owner)
 {
     _containers = new Dictionary <Addon, PersistenceContainer>();
     _owner      = owner;
 }
コード例 #19
0
 private void OnEnable()
 {
     AddonManager.ActivateMods(AddonStart.Map);
     AddonManager.ActivateMods(AddonStart.Level);
     Helper.InvokeOnEnterLevel();
 }
コード例 #20
0
ファイル: Program.cs プロジェクト: bellyfat/BitMarket
        /// <summary>
        /// Loads Plugins (Servers and Processors) from a Directory
        /// </summary>
        /// <param name="D">Plugin directory with info.txt file in it</param>
        private static void loadModule(string D)
        {
            NameValueCollection NVC = Base.ParseContent(File.ReadAllText(Path.Combine(D, "info.txt")));

            if (!string.IsNullOrEmpty(NVC["FILE"]) && !string.IsNullOrEmpty(NVC["TYPE"]))
            {
                if (Contains(NVC["TYPE"].ToLower().Split(','), "genericprocessor"))
                {
                    if (NVC["FILE"].Contains("."))
                    {
                        try
                        {
                            switch (NVC["FILE"].Substring(NVC["FILE"].LastIndexOf('.') + 1).ToUpper())
                            {
                            case "CS":
                                AddonManager.LoadProcessor(Path.Combine(D, NVC["FILE"]));
                                break;

                            case "DLL":
                                AddonManager.LoadProcessorLib(Path.Combine(D, NVC["FILE"]));
                                break;

                            default:
                                break;
                            }
                        }
                        catch (Exception ex)
                        {
                            LOG(string.Format("Cannot load server module {0}", NVC["NAME"]));
                            LOG(string.Format(ex.Message));
                            if (AddonManager.LastErrors != null)
                            {
                                foreach (var e in AddonManager.LastErrors)
                                {
                                    LOG(e.ToString());
                                }
                                AddonManager.LastErrors = null;
                            }
                        }
                    }
                }
            }

            //Load Servers
            if (!string.IsNullOrEmpty(NVC["FILE"]) && !string.IsNullOrEmpty(NVC["TYPE"]))
            {
                if (Contains(NVC["TYPE"].ToLower().Split(','), "genericserver"))
                {
                    if (NVC["FILE"].Contains("."))
                    {
                        try
                        {
                            switch (NVC["FILE"].Substring(NVC["FILE"].LastIndexOf('.') + 1).ToUpper())
                            {
                            case "CS":
                                AddonManager.LoadServer(Path.Combine(D, NVC["FILE"]));
                                break;

                            case "DLL":
                                AddonManager.LoadServerLib(Path.Combine(D, NVC["FILE"]));
                                break;

                            default:
                                break;
                            }
                        }
                        catch (Exception ex)
                        {
                            LOG(string.Format("Cannot load server module {0}", NVC["NAME"]));
                            LOG(string.Format(ex.Message));
                            if (AddonManager.LastErrors != null)
                            {
                                foreach (var e in AddonManager.LastErrors)
                                {
                                    LOG(e.ToString());
                                }
                                AddonManager.LastErrors = null;
                            }
                        }
                    }
                }
            }
        }
コード例 #21
0
        private async void StartGame(string otp)
        {
            Log.Information("StartGame() called");
            try
            {
                var gateStatus = false;
                try
                {
                    gateStatus = await Task.Run(() => _game.GetGateStatus());
                }
                catch
                {
                    // ignored
                }

                #if !DEBUG
                if (!gateStatus)
                {
                    Log.Information("GateStatus is false.");
                    MessageBox.Show(
                        "Square Enix seems to be running maintenance work right now or the login server is unreachable. The game shouldn't be launched.",
                        "Error", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                    _isLoggingIn = false;

                    return;
                }
                #endif

                var gameProcess = _game.Login(LoginUsername.Text, LoginPassword.Password, otp,
                                              Settings.SteamIntegrationEnabled, SteamCheckBox.IsChecked == true, Settings.AdditionalLaunchArgs, Settings.UniqueIdCacheEnabled);

                if (gameProcess == null)
                {
                    Log.Information("GameProcess was null...");
                    _isLoggingIn = false;
                    return;
                }

                var addonMgr = new AddonManager();

                try
                {
                    await Task.Run(() => addonMgr.RunAddons(gameProcess, Settings.GetAddonList().Where(x => x.IsEnabled).ToList()));
                }
                catch (Exception ex)
                {
                    new ErrorWindow(ex,
                                    "This could be caused by your antivirus, please check its logs and add any needed exclusions.",
                                    "Addons").ShowDialog();
                    _isLoggingIn = false;

                    addonMgr.StopAddons();
                }

                try
                {
                    if (Settings.IsInGameAddonEnabled())
                    {
                        await Task.Run(() =>
                        {
                            var hooks = new HooksAddon(); hooks.Setup(gameProcess); hooks.Run();
                        });
                    }
                }
                catch (Exception ex)
                {
                    new ErrorWindow(ex,
                                    "This could be caused by your antivirus, please check its logs and add any needed exclusions.",
                                    "Hooks").ShowDialog();
                    _isLoggingIn = false;

                    addonMgr.StopAddons();
                }

                this.Close();

                var watchThread = new Thread(() =>
                {
                    while (!gameProcess.HasExited)
                    {
                        gameProcess.Refresh();
                        Thread.Sleep(1);
                    }

                    Log.Information("Game has exited.");
                    addonMgr.StopAddons();
                    Environment.Exit(0);
                });
                watchThread.Start();
            }
            catch (Exception ex)
            {
                new ErrorWindow(ex, "Please also check your login information or try again.", "Login").ShowDialog();
                _isLoggingIn = false;
            }
        }
コード例 #22
0
 public override void OnLoad(AddonManager manager, Addon owner)
 {
     _containers = new Dictionary <Addon, ConfigAPI>();
     _owner      = owner;
 }
コード例 #23
0
ファイル: Plugin.cs プロジェクト: andybak/VRUtilityBelt
        public override void OnLoad(AddonManager manager, Addon owner)
        {
            _owner = owner;

            BridgeHandler.RegisterGlobalLink("VRUB_Core_AddonManagement", AddonManagementAPI.Instance);
        }