Пример #1
0
        /// <summary>
        /// Open a new issue template for reporting plugins.
        /// </summary>
        /// <param name="category"></param>
        /// <param name="modItem"></param>
        internal static void OpenReportTemplatePlugins(Category category, ModItemData modItem)
        {
            string formatModName = modItem.Name
                                   .Replace("&", "and")
                                   .Replace("%", "%25")
                                   .Replace("(", "%28")
                                   .Replace(")", "%29")
                                   .Replace("/", "%2F")
                                   .Replace(@"\", "%5C");

            string template =
                $"assignees=ohhsodead&" +
                $"title=[MOD REPORT] {formatModName.Replace("&", "and")} ({modItem.Platform})&"
                + "body="
                + $"- Category: {category.Title}%0D%0A"
                + $"- Id: %23{modItem.Id}%0D%0A"
                + $"- Name: {formatModName}%0D%0A"
                + $"- Version: {modItem.Version.Replace("&", "and")}%0D%0A"
                + $"- Game Type: {modItem.ModType.Replace("&", "and")}%0D%0A"
                + $"- Creators: {modItem.CreatedBy.Replace("&", "and")}%0D%0A"
                + "----------------------- %0D%0A"
                + "*Please include additional information about the issue, details such as how to reproduce the problem, what happened before this occurred, etc...";

            Process.Start(Urls.GitHubRepo + "issues/new?" + template
                          .Replace("/", "%2F")
                          .Replace(@"\", "%5C")
                          .Replace("(", "%28")
                          .Replace(")", "%29"));
        }
Пример #2
0
        public static void ShowTransferModsDialog(Form owner, TransferType transferType, Category category, ModItemData modItem, string region = "")
        {
            using TransferDialog transferDialog = new()
                  {
                      TransferType = transferType,
                      Category     = category,
                      ModItem      = modItem,
                      GameRegion   = region
                  };

            transferDialog.Owner = owner;
            transferDialog.ShowDialog();
        }
Пример #3
0
        /*********
        ** Public methods
        *********/
        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        public override void Entry(IModHelper helper)
        {
            // read config
            this.Config = helper.ReadConfig <ModConfig>();
            this.Monitor.Log($"Started with menu key {this.Config.ShowMenuKey}.");

            // read item data
            this.ItemData = helper.Data.ReadJsonFile <ModItemData>("assets/item-data.json");
            if (this.ItemData?.ProblematicItems == null)
            {
                this.Monitor.Log("One of the mod files (assets/item-data.json) is missing or invalid. Some features may not work correctly; consider reinstalling the mod.", LogLevel.Warn);
            }

            // read categories
            this.Categories = helper.Data.ReadJsonFile <ModDataCategory[]>("assets/categories.json");
            if (this.Categories == null)
            {
                this.Monitor.LogOnce("One of the mod files (assets/categories.json) is missing or invalid. Some features may not work correctly; consider reinstalling the mod.", LogLevel.Warn);
            }

            // init mod
            I18n.Init(helper.Translation);
            helper.Events.Input.ButtonPressed += this.OnButtonPressed;
        }
Пример #4
0
        public static void ShowItemDetailsDialog(Form owner, PlatformPrefix consoleType, CategoriesData categories, ModItemData modItem)
        {
            XtraForm detailsDialog = new();

            switch (consoleType)
            {
            case PlatformPrefix.PS3:
                if (modItem.GetCategoryType(categories) == CategoryType.Game)
                {
                    detailsDialog = new GameModDialog
                    {
                        ModItem = modItem
                    };
                }
                else if (modItem.GetCategoryType(categories) == CategoryType.Homebrew)
                {
                    detailsDialog = new HomebrewDialog
                    {
                        ModItem = modItem
                    };
                }
                else if (modItem.GetCategoryType(categories) == CategoryType.Resource)
                {
                    detailsDialog = new ResourceDialog
                    {
                        ModItem = modItem
                    };
                }
                break;

            case PlatformPrefix.XBOX:
                detailsDialog = new PluginDialog
                {
                    ModItem = modItem
                };
                break;

            default:
                break;
            }

            XtraForm overlayForm = new();

            overlayForm.StartPosition   = FormStartPosition.Manual;
            overlayForm.FormBorderStyle = FormBorderStyle.None;
            overlayForm.Opacity         = .50d;
            overlayForm.BackColor       = Color.Black;
            overlayForm.Size            = owner.Size;
            overlayForm.Location        = owner.Location;
            overlayForm.ShowInTaskbar   = false;
            overlayForm.Show(owner);

            detailsDialog.Owner = owner;
            detailsDialog.ShowDialog();

            //Get rid of the overlay form
            overlayForm.Dispose();
        }