コード例 #1
0
        public Export(string lastfile)
        {
            this.lastfile = lastfile;
            InitializeComponent();
            foreach (String s in Program.Context.Config.PDFExporters)
            {
                try
                {
                    PDF p = PlayerExtensions.Load(s);
                    if (p.Name != "" && p.Name != null && !CUSTOM.Equals(p.Name) && !SAVE.Equals(p.Name))
                    {
                        pdfs[p.Name] = p;
                    }
                    if (p.File != null && p.File != "" && (!charsheets.ContainsKey(p.SheetName ?? Path.GetFileName(p.File)) || charsheets[p.SheetName ?? Path.GetFileName(p.File)].SheetPreview == null))
                    {
                        charsheets[p.SheetName ?? Path.GetFileName(p.File)] = p;
                    }
                    if (p.SpellFile != null && p.SpellFile != "" && (!spellsheets.ContainsKey(p.SpellName ?? Path.GetFileName(p.SpellFile)) || spellsheets[p.SpellName ?? Path.GetFileName(p.SpellFile)].SpellPreview == null))
                    {
                        spellsheets[p.SpellName ?? Path.GetFileName(p.SpellFile)] = p;
                    }
                    if (p.LogFile != null && p.LogFile != "" && (!logsheets.ContainsKey(p.LogName ?? Path.GetFileName(p.LogFile)) || logsheets[p.LogName ?? Path.GetFileName(p.LogFile)].LogPreview == null))
                    {
                        logsheets[p.LogName ?? Path.GetFileName(p.LogFile)] = p;
                    }
                    if (p.SpellbookFile != null && p.SpellbookFile != "" && (!spellbooks.ContainsKey(p.SpellbookName ?? Path.GetFileName(p.SpellbookFile)) || spellbooks[p.SpellbookName ?? Path.GetFileName(p.SpellbookFile)].SpellbookPreview == null))
                    {
                        spellbooks[p.SpellbookName ?? Path.GetFileName(p.SpellbookFile)] = p;
                    }
                    if (p.ActionsFile != null && p.ActionsFile != "" && (!actionsheets.ContainsKey(p.ActionsName ?? Path.GetFileName(p.ActionsFile)) || actionsheets[p.ActionsName ?? Path.GetFileName(p.ActionsFile)].ActionsPreview == null))
                    {
                        actionsheets[p.ActionsName ?? Path.GetFileName(p.ActionsFile)] = p;
                    }
                    if (p.MonstersFile != null && p.MonstersFile != "" && (!monstersheets.ContainsKey(p.MonstersName ?? Path.GetFileName(p.MonstersFile)) || monstersheets[p.MonstersName ?? Path.GetFileName(p.MonstersFile)].MonstersPreview == null))
                    {
                        monstersheets[p.MonstersName ?? Path.GetFileName(p.MonstersFile)] = p;
                    }
                }
                catch (Exception e)
                {
                    ConfigManager.LogError(e);
                }
            }
            Preset.Items.Add(CUSTOM);
            foreach (string s in pdfs.Keys.OrderBy(s => s))
            {
                Preset.Items.Add(s);
            }
            Preset.Items.Add(SAVE);
            SpellBox.Items.Add(NONE);
            LogBox.Items.Add(NONE);
            SpellbookBox.Items.Add(NONE);
            ActionsBox.Items.Add(NONE);
            MonsterBox.Items.Add(NONE);
            SheetBox.Items.AddRange(charsheets.Keys.OrderBy(s => s).ToArray());
            SpellBox.Items.AddRange(spellsheets.Keys.OrderBy(s => s).ToArray());
            LogBox.Items.AddRange(logsheets.Keys.OrderBy(s => s).ToArray());
            SpellbookBox.Items.AddRange(spellbooks.Keys.OrderBy(s => s).ToArray());
            ActionsBox.Items.AddRange(actionsheets.Keys.OrderBy(s => s).ToArray());
            MonsterBox.Items.AddRange(monstersheets.Keys.OrderBy(s => s).ToArray());

            foreach (string s in PDFBase.APFormats)
            {
                ACPBox.Items.Add(PDF.APFormat(Program.Context, s, 14) + " + 4 AP = " + PDF.APFormat(Program.Context, s, 18));
            }
            string last = Properties.Settings.Default.LastPDFPreset;

            if (pdfs.ContainsKey(last) || CUSTOM.Equals(last))
            {
                Preset.SelectedItem = last;
            }
            else
            {
                button1.Enabled = false;
            }
            ResourcesBox.Checked               = Properties.Settings.Default.PDFUsedResources;
            PreserveBox.Checked                = Properties.Settings.Default.PDFPreserveForms;
            DuplexBox.Checked                  = Properties.Settings.Default.PDFDuplex;
            DuplexWhiteBox.Checked             = Properties.Settings.Default.PDFDuplexWhite;
            ACPBox.SelectedIndex               = Properties.Settings.Default.PDFACPFormat;
            SwapScoreModBox.Checked            = Properties.Settings.Default.PDFSwapScoreMod;
            IgnoreMagicItemsBox.Checked        = !Properties.Settings.Default.PDFLogMagicItems;
            MundaneItemBox.Checked             = Properties.Settings.Default.PDFSpellbookMundaneItems;
            BonusSpellsResources.SelectedIndex = Properties.Settings.Default.PDFBonusSpellResources;
            EquipmentKeywords.Checked          = Properties.Settings.Default.PDFEquipmentKeywords;
            EquipmentStats.Checked             = Properties.Settings.Default.PDFEquipmentStats;
            FeatureTitle.Checked               = Properties.Settings.Default.PDFFeatureTitlesOnly;

            BuildAttacks();
        }