Ejemplo n.º 1
0
        public void Init()
        {
            TextBox displayName = new TextBox
            {
                Text      = "Display Name",
                Location  = new Point(10, 10),
                MaxLength = 20,
            };
            TextBox author = new TextBox
            {
                Text      = "Author",
                Location  = new Point(10, 30),
                MaxLength = 15,
            };
            TextBox version = new TextBox
            {
                Text      = "Version",
                Location  = new Point(10, 50),
                MaxLength = 10,
            };
            TextBox description = new TextBox
            {
                Text      = "Short Description - Max: 50 char",
                Location  = new Point(10, 70),
                MaxLength = 50,
                Size      = new Size(200, 200),
            };

            icon = new ModIcon();

            // if the metadata file already exists, try to read from it
            if (File.Exists(modPath + "\\.osml\\metadata.ini"))
            {
                IniData data = INIManage.Read(modPath + "\\metadata.ini");

                displayName.Text = data["config"]["displayName"];
                author.Text      = data["config"]["author"];
                version.Text     = data["config"]["version"];
                description.Text = data["config"]["description"];
            }

            // and the icon
            if (File.Exists(modPath + "\\.osml\\icon.png"))
            {
                icon.Image = Image.FromFile(modPath + "\\icon.png");
            }

            Controls.Add(displayName);
            Controls.Add(author);
            Controls.Add(version);
            Controls.Add(description);
            Controls.Add(icon);
            Controls.Add(new MMDDone());

            displayNameInstance = displayName;
            authorInstance      = author;
            versionInstance     = version;
            descriptionInstance = description;
        }
Ejemplo n.º 2
0
        public static void ReadSettingsData()
        {
            string settingsPath = Static.directory + "\\settings.ini";

            if (!File.Exists(settingsPath))
            {
                INIManage.Parse(settingsPath, new string[] { Constants.soundVolume }, new string[] { "100" });
            }
            else
            {
                config = INIManage.Read(settingsPath);
            }
        }
Ejemplo n.º 3
0
        public ModBox(string path)
        {
            try
            {
                modPath = path;
                Size    = new Size(230, 50);

                Label      displayName = new Label();
                Label      author      = new Label();
                Label      desc        = new Label();
                PictureBox icon        = new PictureBox();

                modName    = modPath.Substring(modPath.LastIndexOf("Mods") + 5);
                desc.Text  = "Metadata is nonexistent or unreadable";
                icon.Image = Image.FromFile(Static.spritesPath + "mmd_icon_default.png");

                // read from metadata
                if (File.Exists(modPath + "\\.osml\\metadata.ini"))
                {
                    IniData data = INIManage.Read(modPath + "\\.osml\\metadata.ini");

                    modName     = data["config"]["displayName"] + " - " + data["config"]["version"];
                    author.Text = "by " + data["config"]["author"];
                    desc.Text   = data["config"]["description"];
                }
                // and the icon
                if (File.Exists(modPath + "\\.osml\\icon.png"))
                {
                    icon.Image = Image.FromFile(modPath + "\\.osml\\icon.png");
                }

                displayName.Text = modName;

                // position
                icon.Location        = new Point(0, 0);
                displayName.Location = new Point(50, 0);
                author.Location      = new Point(50, 10);
                desc.Location        = new Point(50, 20);

                // icon size
                icon.Size     = new Size(50, 50);
                icon.SizeMode = PictureBoxSizeMode.StretchImage;

                // font
                displayName.Font = Static.GetTerminusFont(9);
                author.Font      = Static.GetTerminusFont(9);
                desc.Font        = Static.GetTerminusFont(9);

                // colour
                displayName.ForeColor = Color.MediumPurple;
                author.ForeColor      = Color.MediumPurple;
                desc.ForeColor        = Color.MediumPurple;

                displayName.AutoSize = true;
                author.AutoSize      = true;
                desc.AutoSize        = true;

                Controls.Add(displayName);
                Controls.Add(author);
                Controls.Add(desc);
                Controls.Add(icon);
            }
            catch (Exception ex)
            {
                ExceptionMessage.New(ex, true);
            }
        }