コード例 #1
0
ファイル: VitaNex_Modules.cs プロジェクト: zerodowned/Core
        public static void DisposeModule(CoreModuleInfo cmi)
        {
            if (cmi == null)
            {
                return;
            }

            cmi.ToConsole("Disposing...");

            if (!cmi.Disposed)
            {
                if (cmi.DisposeSupported)
                {
                    TryCatch(cmi.GetDisposeHandler(), cmi.ToConsole);
                }

                TryCatch(cmi.OnDisposed, cmi.ToConsole);

                if (OnModuleDisposed != null)
                {
                    TryCatch(() => OnModuleDisposed(cmi), cmi.ToConsole);
                }

                cmi.ToConsole("Done.");
            }
            else
            {
                cmi.ToConsole("Already disposed, no action taken.");
            }
        }
コード例 #2
0
ファイル: VitaNex_Modules.cs プロジェクト: zerodowned/Core
        public static void SaveModule(CoreModuleInfo cmi)
        {
            if (cmi == null || !cmi.Enabled)
            {
                return;
            }

            cmi.ToConsole("Saving...");

            TryCatch(cmi.SaveOptions, cmi.ToConsole);

            if (cmi.SaveSupported)
            {
                TryCatch(cmi.GetSaveHandler(), cmi.ToConsole);
            }

            TryCatch(cmi.OnSaved, cmi.ToConsole);

            if (OnModuleSaved != null)
            {
                TryCatch(() => OnModuleSaved(cmi), cmi.ToConsole);
            }

            cmi.ToConsole("Done.");
        }
コード例 #3
0
ファイル: VitaNex_Modules.cs プロジェクト: zerodowned/Core
        public static void LoadModule(CoreModuleInfo cmi)
        {
            if (cmi == null || !cmi.Enabled)
            {
                return;
            }

            cmi.ToConsole("Loading...");

            TryCatch(cmi.LoadOptions, cmi.ToConsole);

            if (cmi.LoadSupported)
            {
                TryCatch(cmi.GetLoadHandler(), cmi.ToConsole);
            }

            TryCatch(cmi.OnLoaded, cmi.ToConsole);

            if (OnModuleLoaded != null)
            {
                TryCatch(() => OnModuleLoaded(cmi), cmi.ToConsole);
            }

            cmi.ToConsole("Done.");
        }
コード例 #4
0
ファイル: VitaNex_Modules.cs プロジェクト: zerodowned/Core
        public static void ConfigureModule(CoreModuleInfo cmi)
        {
            if (cmi == null || !cmi.Enabled)
            {
                return;
            }

            cmi.ToConsole("Configuring...");

            if (!cmi.Configured)
            {
                if (cmi.ConfigSupported)
                {
                    TryCatch(cmi.GetConfigHandler(), cmi.ToConsole);
                }

                TryCatch(cmi.OnConfigured, cmi.ToConsole);

                if (OnModuleConfigured != null)
                {
                    TryCatch(() => OnModuleConfigured(cmi), cmi.ToConsole);
                }

                cmi.ToConsole("Done.");
            }
            else
            {
                cmi.ToConsole("Already configured, no action taken.");
            }
        }
コード例 #5
0
ファイル: VitaNex_Modules.cs プロジェクト: zerodowned/Core
        public static void InvokeModule(CoreModuleInfo cmi)
        {
            if (cmi == null || !cmi.Enabled)
            {
                return;
            }

            cmi.ToConsole("Invoking...");

            if (!cmi.Invoked)
            {
                if (cmi.InvokeSupported)
                {
                    TryCatch(cmi.GetInvokeHandler(), cmi.ToConsole);
                }

                TryCatch(cmi.OnInvoked, cmi.ToConsole);

                if (OnModuleInvoked != null)
                {
                    TryCatch(() => OnModuleInvoked(cmi), cmi.ToConsole);
                }

                cmi.ToConsole("Done.");
            }
            else
            {
                cmi.ToConsole("Already invoked, no action taken.");
            }
        }
コード例 #6
0
        private void CompileModule(int x, int y, int w, int h, CoreModuleInfo cm)
        {
            CompileBufferEntry(x, y, w, h, 0, cm);

            y += 75;
            h -= 75;

            cm.CompileControlPanel(this, x, y, w, h);
        }
コード例 #7
0
        public static void DisplayTo(Mobile user, CoreModuleInfo cm)
        {
            var node = "Plugins|Modules";

            if (cm != null)
            {
                node += "|" + cm.FullName;
            }

            DisplayTo(user, false, node);
        }
コード例 #8
0
ファイル: VitaNex_Modules.cs プロジェクト: zerodowned/Core
        public static void InvokeModuleEnabled(CoreModuleInfo cmi)
        {
            if (cmi == null)
            {
                return;
            }

            if (OnModuleEnabled != null)
            {
                TryCatch(() => OnModuleEnabled(cmi), ToConsole);
            }
        }
コード例 #9
0
ファイル: VitaNex_Modules.cs プロジェクト: zerodowned/Core
        public static void InvokeModuleDisabled(CoreModuleInfo cmi)
        {
            if (cmi == null)
            {
                return;
            }

            if (OnModuleDisabled != null)
            {
                OnModuleDisabled(cmi);
            }
        }
コード例 #10
0
ファイル: VitaNex_Modules.cs プロジェクト: Ravenwolfe/Core
		public static void InvokeModuleEnabled(CoreModuleInfo cmi)
		{
			if (cmi == null)
			{
				return;
			}

			if (OnModuleEnabled != null)
			{
				TryCatch(() => OnModuleEnabled(cmi), ToConsole);
			}
		}
コード例 #11
0
ファイル: VitaNex_Modules.cs プロジェクト: Ravenwolfe/Core
		public static void DisposeModule(CoreModuleInfo cmi)
		{
			if (cmi == null)
			{
				return;
			}

			cmi.ToConsole("Disposing...");

			if (!cmi.Disposed)
			{
				if (cmi.DisposeSupported)
				{
					TryCatch(cmi.GetDisposeHandler(), cmi.ToConsole);
				}

				TryCatch(cmi.OnDisposed, cmi.ToConsole);

				if (OnModuleDisposed != null)
				{
					TryCatch(() => OnModuleDisposed(cmi), cmi.ToConsole);
				}

				cmi.ToConsole("Done.");
			}
			else
			{
				cmi.ToConsole("Already disposed, no action taken.");
			}
		}
コード例 #12
0
ファイル: VitaNex_Modules.cs プロジェクト: Ravenwolfe/Core
		public static void LoadModule(CoreModuleInfo cmi)
		{
			if (cmi == null || !cmi.Enabled)
			{
				return;
			}

			cmi.ToConsole("Loading...");

			TryCatch(cmi.LoadOptions, cmi.ToConsole);

			if (cmi.LoadSupported)
			{
				TryCatch(cmi.GetLoadHandler(), cmi.ToConsole);
			}

			TryCatch(cmi.OnLoaded, cmi.ToConsole);

			if (OnModuleLoaded != null)
			{
				TryCatch(() => OnModuleLoaded(cmi), cmi.ToConsole);
			}

			cmi.ToConsole("Done.");
		}
コード例 #13
0
ファイル: VitaNex_Modules.cs プロジェクト: Ravenwolfe/Core
		public static void SaveModule(CoreModuleInfo cmi)
		{
			if (cmi == null || !cmi.Enabled)
			{
				return;
			}

			cmi.ToConsole("Saving...");

			TryCatch(cmi.SaveOptions, cmi.ToConsole);

			if (cmi.SaveSupported)
			{
				TryCatch(cmi.GetSaveHandler(), cmi.ToConsole);
			}

			TryCatch(cmi.OnSaved, cmi.ToConsole);

			if (OnModuleSaved != null)
			{
				TryCatch(() => OnModuleSaved(cmi), cmi.ToConsole);
			}

			cmi.ToConsole("Done.");
		}
コード例 #14
0
ファイル: VitaNex_Modules.cs プロジェクト: Ravenwolfe/Core
		public static void InvokeModule(CoreModuleInfo cmi)
		{
			if (cmi == null || !cmi.Enabled)
			{
				return;
			}

			cmi.ToConsole("Invoking...");

			if (!cmi.Invoked)
			{
				if (cmi.InvokeSupported)
				{
					TryCatch(cmi.GetInvokeHandler(), cmi.ToConsole);
				}

				TryCatch(cmi.OnInvoked, cmi.ToConsole);

				if (OnModuleInvoked != null)
				{
					TryCatch(() => OnModuleInvoked(cmi), cmi.ToConsole);
				}

				cmi.ToConsole("Done.");
			}
			else
			{
				cmi.ToConsole("Already invoked, no action taken.");
			}
		}
コード例 #15
0
ファイル: VitaNex_Modules.cs プロジェクト: Ravenwolfe/Core
		public static void ConfigureModule(CoreModuleInfo cmi)
		{
			if (cmi == null || !cmi.Enabled)
			{
				return;
			}

			cmi.ToConsole("Configuring...");

			if (!cmi.Configured)
			{
				if (cmi.ConfigSupported)
				{
					TryCatch(cmi.GetConfigHandler(), cmi.ToConsole);
				}

				TryCatch(cmi.OnConfigured, cmi.ToConsole);

				if (OnModuleConfigured != null)
				{
					TryCatch(() => OnModuleConfigured(cmi), cmi.ToConsole);
				}

				cmi.ToConsole("Done.");
			}
			else
			{
				cmi.ToConsole("Already configured, no action taken.");
			}
		}
コード例 #16
0
ファイル: VitaNex.cs プロジェクト: LordEnigma/UO
        private static void OnCoreCommand(CommandEventArgs e)
        {
            if (e == null || e.Mobile == null || e.Mobile.Deleted)
            {
                return;
            }

            if (e.Arguments == null || e.Arguments.Length == 0)
            {
                new MenuGump(
                    e.Mobile as PlayerMobile,
                    null,
                    new MenuGumpOptions(
                        new[]
                {
                    new ListGumpEntry("Help", () => OnCoreCommand(new CommandEventArgs(e.Mobile, e.Command, "?", new[] { "?" }))),
                    new ListGumpEntry("Services", () => new CoreServiceListGump(e.Mobile as PlayerMobile).Send()),
                    new ListGumpEntry("Modules", () => new CoreModuleListGump(e.Mobile as PlayerMobile).Send())
                })).Send();
                return;
            }

            switch (e.Arguments[0].ToLower())
            {
            case "?":
            case "help":
            {
                e.Mobile.SendMessage(0x55, "Usage: {0}{1} <srv | mod | ? | help>", CommandSystem.Prefix, e.Command);
                e.Mobile.SendMessage(0x55, "Usage: srv <name> <ver | save>");
                e.Mobile.SendMessage(0x55, "Usage: mod <name> <ver | save | enable | disable>");
            }
            break;

            case "srv":
            {
                if (e.Arguments.Length < 2)
                {
                    new CoreServiceListGump(e.Mobile as PlayerMobile).Send();
                    return;
                }

                string          search = e.Arguments[1];
                CoreServiceInfo info   = _CoreServices.FirstOrDefault(csi => Insensitive.Contains(csi.Name, search));

                if (info == null)
                {
                    new CoreServiceListGump(e.Mobile as PlayerMobile).Send();
                    return;
                }

                if (e.Arguments.Length < 3)
                {
                    e.Mobile.SendGump(new PropertiesGump(e.Mobile, info));
                    return;
                }

                switch (e.Arguments[2].ToLower())
                {
                case "ver":
                case "version":
                    e.Mobile.SendMessage(0x55, "{0} version: {1}", info.Name, info.Version);
                    break;

                case "save":
                {
                    Action sh = info.GetSaveHandler();

                    if (sh == null)
                    {
                        e.Mobile.SendMessage(0x22, "{0} does not implement the CSSave feature.", info.Name);
                        return;
                    }

                    TryCatch(sh, ex => e.Mobile.SendMessage(0x22, "An error occured, check the logs for more information."));
                }
                break;
                }
            }
            break;

            case "mod":
            {
                if (e.Arguments.Length < 2)
                {
                    new CoreModuleListGump(e.Mobile as PlayerMobile).Send();
                    return;
                }

                string         search = e.Arguments[1];
                CoreModuleInfo info   = _CoreModules.FirstOrDefault(cmi => Insensitive.Contains(cmi.Name, search));

                if (info == null)
                {
                    new CoreModuleListGump(e.Mobile as PlayerMobile).Send();
                    return;
                }

                if (e.Arguments.Length < 3)
                {
                    e.Mobile.SendGump(new PropertiesGump(e.Mobile, info));
                    return;
                }

                switch (e.Arguments[2].ToLower())
                {
                case "ver":
                case "version":
                    e.Mobile.SendMessage(0x55, "{0} version: {1}", info.Name, info.Version);
                    break;

                case "enable":
                {
                    if (info.Enabled)
                    {
                        e.Mobile.SendMessage(0x22, "{0} is already enabled.", info.Name);
                    }
                    else
                    {
                        info.Enabled = true;
                        e.Mobile.SendMessage(0x55, "{0} has been enabled.", info.Name);
                    }
                }
                break;

                case "disable":
                {
                    if (!info.Enabled)
                    {
                        e.Mobile.SendMessage(0x22, "{0} is already disabled.", info.Name);
                    }
                    else
                    {
                        info.Enabled = false;
                        e.Mobile.SendMessage(0x55, "{0} has been disabled.", info.Name);
                    }
                }
                break;

                case "save":
                {
                    Action sh = info.GetSaveHandler();

                    if (sh == null)
                    {
                        e.Mobile.SendMessage(0x22, "{0} does not implement the CMSave feature.", info.Name);
                    }
                    else
                    {
                        TryCatch(
                            sh,
                            ex =>
                                {
                                    e.Mobile.SendMessage(0x22, "An error occured, check the logs for more information.");
                                    ToConsole(ex);
                                });
                    }
                }
                break;
                }
            }
            break;
            }
        }
コード例 #17
0
ファイル: VitaNex_Modules.cs プロジェクト: Ravenwolfe/Core
		public static void InvokeModuleDisabled(CoreModuleInfo cmi)
		{
			if (cmi == null)
			{
				return;
			}

			if (OnModuleDisabled != null)
			{
				OnModuleDisabled(cmi);
			}
		}