コード例 #1
0
ファイル: GCA.WikiExport.cs プロジェクト: Syndaryl/GCAPlugins
 /// <summary>
 /// Wrapper for creating a new SheetOption and adding it to the SheetOptionsManager.
 /// </summary>
 /// <param name="options"></param>
 /// <param name="descFormat"></param>
 /// <param name="name"></param>
 /// <param name="userPrompt"></param>
 /// <param name="type"></param>
 /// <param name="arguments"></param>
 /// <returns></returns>
 bool insertOption(SheetOptionsManager options, SheetOptionDisplayFormat descFormat, string name, string userPrompt,
     OptionType type = GCA5Engine.OptionType.Caption, params object[] arguments)
 {
     bool ok;
     GCA5Engine.SheetOption newOption;
     newOption = new GCA5Engine.SheetOption();
     newOption.Name = name;
     newOption.Type = GCA5Engine.OptionType.Header;
     newOption.UserPrompt = userPrompt;
     newOption.DisplayFormat = descFormat;
     ok = options.AddOption(newOption);
     return ok;
 }
コード例 #2
0
ファイル: GCA.WikiExport.cs プロジェクト: Syndaryl/GCAPlugins
        void extractOptionsFromFile(string optionsPath, SheetOptionsManager options)
        {
            var optionsSerializer = new XmlSerializer(typeof(SheetOption[]));

            try
            {
                var inFile = new FileStream(optionsPath, FileMode.Open);
                var optionsArray = new List<SheetOption>((SheetOption[])optionsSerializer.Deserialize(inFile));

                var descFormatHeader = new SheetOptionDisplayFormat();
                descFormatHeader.BackColor = SystemColors.Info;
                descFormatHeader.CaptionLocalBackColor = SystemColors.Info;

                var descFormatBody = new SheetOptionDisplayFormat();
                //descFormatBody.BackColor = SystemColors.;
                //descFormatBody.CaptionLocalBackColor = SystemColors.Info;

                foreach (var opt in optionsArray)
                {
                    opt.DisplayFormat = opt.Type == OptionType.Header ? descFormatHeader : descFormatBody;
                    opt.UserPrompt = opt.UserPrompt.Replace(@"$Name", Name).Replace(@"$Version", Version);
                    options.AddOption(opt);
                }
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.ToString() + "\n" + e.InnerException.ToString(), assemblyName);
            }
            #region disabledcode
            //var inFile = new FileStream(optionsPath, FileMode.Open);
            //var optionsArray = (SheetOption[])tilesetSerializer.Deserialize(inFile);
            //* Description block at top *
            //ok = insertOption(Options, descFormat, "Header_Description", Name + " " + this.Version, GCA5Engine.OptionType.Header);
            //var outFile = new FileStream(optionsPath + ".updated", FileMode.Create);
            //optionsSerializer.Serialize(outFile, optionsArray.ToArray());

            //bool ok;

            //var descFormat = new SheetOptionDisplayFormat();
            //descFormat.BackColor = SystemColors.Info;
            //descFormat.CaptionLocalBackColor = SystemColors.Info;
            //var newOption = new GCA5Engine.SheetOption();
            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "Header_Description";
            //newOption.Type = GCA5Engine.OptionType.Header;
            //newOption.UserPrompt = Name + " " + this.Version;
            //newOption.DisplayFormat = descFormat;
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);

            //ok = insertOption(Options, descFormat, "Description", this.Description);
            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "Description";
            //newOption.Type = GCA5Engine.OptionType.Caption;
            //newOption.UserPrompt = this.Description;
            //newOption.DisplayFormat = descFormat;
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);

            ////******************************
            ////* Characters
            ////******************************
            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "Header_Characters";
            //newOption.Type = GCA5Engine.OptionType.Header;
            //newOption.UserPrompt = "Printing Characters";
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);

            ////NOTE: Because List is now a 0-based Array, the number of the
            ////DefaultValue and the selected Value is 0-based!
            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "OutputCharacters";
            //newOption.Type = GCA5Engine.OptionType.ListNumber;
            //newOption.UserPrompt = "When exporting, how do you want to handle exporting when multiple characters are loaded?";
            //newOption.DefaultValue = 0;// 'first item;
            //newOption.List = new string[] { "Export just the current character", "Export all the characters to the file", "Always ask me what to do" };
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);
            ////AlwaysAskMe = 2;

            ////NOTE: Because List is now a 0-based Array, the number of the
            ////DefaultValue and the selected Value is 0-based!
            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "CharacterSeparator";
            //newOption.Type = GCA5Engine.OptionType.ListNumber;
            //newOption.UserPrompt = "Please select how you'd like to mark the break between characters when printing multiple characters to the file.";
            //newOption.DefaultValue = 1;// 'second item;
            //newOption.List = new string[] { "Do nothing", "Print a line of *", "Print a line of =", "Print a line of -", "Use HTML to indicate a horizontal rule" };
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);

            ////******************************
            ////* Included Sections
            ////******************************
            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "Header_TextBlocks";
            //newOption.Type = GCA5Engine.OptionType.Header;
            //newOption.UserPrompt = "Sections to Include";
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);

            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "ShowMovementBlock";
            //newOption.Type = GCA5Engine.OptionType.YesNo;
            //newOption.UserPrompt = "Include a block showing all the Environment Move rates?";
            //newOption.DefaultValue = true;
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);

            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "ShowMovementZero";
            //newOption.Type = GCA5Engine.OptionType.YesNo;
            //newOption.UserPrompt = "When printing the block above, include movement rates even when they're at zero?";
            //newOption.DefaultValue = false;
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);

            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "ShowAllAdditionalStats";
            //newOption.Type = GCA5Engine.OptionType.YesNo;
            //newOption.UserPrompt = "Include a block showing all additional attributes that aren't hidden?";
            //newOption.DefaultValue = false;
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);

            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "ShowAdditionalStatsAtZero";
            //newOption.Type = GCA5Engine.OptionType.YesNo;
            //newOption.UserPrompt = "When printing the block above, include attributes even when they're at zero?";
            //newOption.DefaultValue = false;
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);

            ////******************************
            ////* Other Stuff
            ////******************************
            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "Header_Other";
            //newOption.Type = GCA5Engine.OptionType.Header;
            //newOption.UserPrompt = "Other Options";
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);

            ////NOTE: Because List is now a 0-based Array, the number of the
            ////DefaultValue and the selected Value is 0-based!
            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "HeadingStyle";
            //newOption.Type = GCA5Engine.OptionType.ListNumber;
            //newOption.UserPrompt = "Please select the way you'd like to differentiate section headers from their various items.";
            //newOption.DefaultValue = 1; //second item;
            //newOption.List = new string[] { "Do nothing", "Use a row of dashes under the header", "Use BBCode to mark the header as bold", "Use HTML to mark the header as bold" };
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);

            ////NOTE: Because List is now a 0-based Array, the number of the
            ////DefaultValue and the selected Value is 0-based!
            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "BonusLineStyle";
            //newOption.Type = GCA5Engine.OptionType.ListNumber;
            //newOption.UserPrompt = "Please select the way you'd like to differentiate bonus lines ('Includes: +X from Z') from their related items.";
            //newOption.DefaultValue = 1;// 'second item;
            //newOption.List = new string[] { "Do nothing", "Use a tab character preceding them", "Use BBCode to mark them in italic", "Use HTML to mark them in italic", "Tab character and BBCode", "Tab character and HTML" };
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);

            ////NOTE: Because List is now a 0-based Array, the number of the
            ////DefaultValue and the selected Value is 0-based!
            //newOption = new GCA5Engine.SheetOption();
            //newOption.Name = "PointsLineStyle";
            //newOption.Type = GCA5Engine.OptionType.ListNumber;
            //newOption.UserPrompt = "Please select the way you'd like to differentiate the Point Summary line from the surrounding text.";
            //newOption.DefaultValue = 1;// 'second item;
            //newOption.List = new string[] { "Do nothing", "Print it as multiple lines with a header", "Use BBCode to mark them in bold", "Use HTML to mark them in bold", "Use BBCode to mark them in italic", "Use HTML to mark them in italic", "Use BBCode to mark them in bold and italic", "Use HTML to mark them in bold and italic" };
            //ok = Options.AddOption(newOption);
            //optionsArray.Add(newOption);
            #endregion disabledcode
        }