Exemplo n.º 1
0
        private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            if (e.Url.Scheme == "build")
            {
                if (e.Url.LocalPath == "profile")
                {
                    e.Cancel = true;

                    ArtifactProfileForm dlg = new ArtifactProfileForm(fArtifact);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.Name = dlg.Artifact.Name;
                        fArtifact.Tier = dlg.Artifact.Tier;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "description")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fArtifact.Description, "Description", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.Description = dlg.Details;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "details")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fArtifact.Details, "Details", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.Details = dlg.Details;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "goals")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fArtifact.Goals, "Goals", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.Goals = dlg.Details;
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath == "rp")
                {
                    e.Cancel = true;

                    DetailsForm dlg = new DetailsForm(fArtifact.RoleplayingTips, "Roleplaying", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.RoleplayingTips = dlg.Details;
                        update_statblock();
                    }
                }
            }

            if (e.Url.Scheme == "section")
            {
                if (e.Url.LocalPath == "new")
                {
                    e.Cancel = true;

                    MagicItemSection     mis = new MagicItemSection();
                    MagicItemSectionForm dlg = new MagicItemSectionForm(mis);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.Sections.Add(dlg.Section);
                        update_statblock();
                    }
                }

                if (e.Url.LocalPath.Contains(",new"))
                {
                    e.Cancel = true;

                    try
                    {
                        string str             = e.Url.LocalPath.Substring(0, e.Url.LocalPath.IndexOf(","));
                        int    n               = int.Parse(str);
                        ArtifactConcordance ac = fArtifact.ConcordanceLevels[n];

                        MagicItemSection     mis = new MagicItemSection();
                        MagicItemSectionForm dlg = new MagicItemSectionForm(mis);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            ac.Sections.Add(dlg.Section);
                            update_statblock();
                        }
                    }
                    catch
                    {
                        // Not a number
                    }
                }
            }

            if (e.Url.Scheme == "sectionedit")
            {
                if (e.Url.LocalPath.Contains(","))
                {
                    e.Cancel = true;

                    int    comma = e.Url.LocalPath.IndexOf(",");
                    string pre   = e.Url.LocalPath.Substring(0, comma);
                    string post  = e.Url.LocalPath.Substring(comma);

                    try
                    {
                        int ac_index      = int.Parse(pre);
                        int section_index = int.Parse(post);

                        ArtifactConcordance  ac  = fArtifact.ConcordanceLevels[ac_index];
                        MagicItemSection     mis = ac.Sections[section_index];
                        MagicItemSectionForm dlg = new MagicItemSectionForm(mis);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            ac.Sections[section_index] = dlg.Section;
                            update_statblock();
                        }
                    }
                    catch
                    {
                        // Not a number
                    }
                }
                else
                {
                    e.Cancel = true;

                    try
                    {
                        int n = int.Parse(e.Url.LocalPath);
                        MagicItemSection mis = fArtifact.Sections[n];

                        MagicItemSectionForm dlg = new MagicItemSectionForm(mis);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            fArtifact.Sections[n] = dlg.Section;
                            update_statblock();
                        }
                    }
                    catch
                    {
                        // Not a number
                    }
                }
            }

            if (e.Url.Scheme == "sectionremove")
            {
                if (e.Url.LocalPath.Contains(","))
                {
                    e.Cancel = true;

                    int    comma = e.Url.LocalPath.IndexOf(",");
                    string pre   = e.Url.LocalPath.Substring(0, comma);
                    string post  = e.Url.LocalPath.Substring(comma);

                    try
                    {
                        int ac_index      = int.Parse(pre);
                        int section_index = int.Parse(post);

                        ArtifactConcordance ac = fArtifact.ConcordanceLevels[ac_index];
                        ac.Sections.RemoveAt(section_index);
                        update_statblock();
                    }
                    catch
                    {
                        // Not a number
                    }
                }
                else
                {
                    e.Cancel = true;

                    try
                    {
                        int n = int.Parse(e.Url.LocalPath);

                        fArtifact.Sections.RemoveAt(n);
                        update_statblock();
                    }
                    catch
                    {
                        // Not a number
                    }
                }
            }

            if (e.Url.Scheme == "rule")
            {
                e.Cancel = true;

                if (e.Url.LocalPath == "new")
                {
                    Pair <string, string>   rule = new Pair <string, string>("", "");
                    ArtifactConcordanceForm dlg  = new ArtifactConcordanceForm(rule);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.ConcordanceRules.Add(dlg.Concordance);
                        update_statblock();
                    }
                }
            }

            if (e.Url.Scheme == "ruleedit")
            {
                e.Cancel = true;

                try
                {
                    int n = int.Parse(e.Url.LocalPath);
                    Pair <string, string> rule = fArtifact.ConcordanceRules[n];

                    ArtifactConcordanceForm dlg = new ArtifactConcordanceForm(rule);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        fArtifact.ConcordanceRules[n] = dlg.Concordance;
                        update_statblock();
                    }
                }
                catch
                {
                    // Not a number
                }
            }

            if (e.Url.Scheme == "ruleremove")
            {
                e.Cancel = true;

                try
                {
                    int n = int.Parse(e.Url.LocalPath);

                    fArtifact.ConcordanceRules.RemoveAt(n);
                    update_statblock();
                }
                catch
                {
                    // Not a number
                }
            }

            if (e.Url.Scheme == "quote")
            {
                e.Cancel = true;

                try
                {
                    int n = int.Parse(e.Url.LocalPath);
                    ArtifactConcordance ac = fArtifact.ConcordanceLevels[n];

                    DetailsForm dlg = new DetailsForm(ac.Quote, "Concordance Quote", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        ac.Quote = dlg.Details;
                        update_statblock();
                    }
                }
                catch
                {
                    // Not a number
                }
            }

            if (e.Url.Scheme == "desc")
            {
                e.Cancel = true;

                try
                {
                    int n = int.Parse(e.Url.LocalPath);
                    ArtifactConcordance ac = fArtifact.ConcordanceLevels[n];

                    DetailsForm dlg = new DetailsForm(ac.Description, "Concordance Description", null);
                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        ac.Description = dlg.Details;
                        update_statblock();
                    }
                }
                catch
                {
                    // Not a number
                }
            }
        }
Exemplo n.º 2
0
 private void Browser_Navigating(object sender, WebBrowserNavigatingEventArgs e)
 {
     if (e.Url.Scheme == "build")
     {
         if (e.Url.LocalPath == "profile")
         {
             e.Cancel = true;
             ArtifactProfileForm artifactProfileForm = new ArtifactProfileForm(this.fArtifact);
             if (artifactProfileForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.Name = artifactProfileForm.Artifact.Name;
                 this.fArtifact.Tier = artifactProfileForm.Artifact.Tier;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "description")
         {
             e.Cancel = true;
             DetailsForm detailsForm = new DetailsForm(this.fArtifact.Description, "Description", null);
             if (detailsForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.Description = detailsForm.Details;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "details")
         {
             e.Cancel = true;
             DetailsForm detailsForm1 = new DetailsForm(this.fArtifact.Details, "Details", null);
             if (detailsForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.Details = detailsForm1.Details;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "goals")
         {
             e.Cancel = true;
             DetailsForm detailsForm2 = new DetailsForm(this.fArtifact.Goals, "Goals", null);
             if (detailsForm2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.Goals = detailsForm2.Details;
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath == "rp")
         {
             e.Cancel = true;
             DetailsForm detailsForm3 = new DetailsForm(this.fArtifact.RoleplayingTips, "Roleplaying", null);
             if (detailsForm3.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.RoleplayingTips = detailsForm3.Details;
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "section")
     {
         if (e.Url.LocalPath == "new")
         {
             e.Cancel = true;
             MagicItemSectionForm magicItemSectionForm = new MagicItemSectionForm(new MagicItemSection());
             if (magicItemSectionForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.Sections.Add(magicItemSectionForm.Section);
                 this.update_statblock();
             }
         }
         if (e.Url.LocalPath.Contains(",new"))
         {
             e.Cancel = true;
             try
             {
                 string str = e.Url.LocalPath.Substring(0, e.Url.LocalPath.IndexOf(","));
                 int    num = int.Parse(str);
                 ArtifactConcordance  item = this.fArtifact.ConcordanceLevels[num];
                 MagicItemSectionForm magicItemSectionForm1 = new MagicItemSectionForm(new MagicItemSection());
                 if (magicItemSectionForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     item.Sections.Add(magicItemSectionForm1.Section);
                     this.update_statblock();
                 }
             }
             catch
             {
             }
         }
     }
     if (e.Url.Scheme == "sectionedit")
     {
         if (!e.Url.LocalPath.Contains(","))
         {
             e.Cancel = true;
             try
             {
                 int section = int.Parse(e.Url.LocalPath);
                 MagicItemSectionForm magicItemSectionForm2 = new MagicItemSectionForm(this.fArtifact.Sections[section]);
                 if (magicItemSectionForm2.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     this.fArtifact.Sections[section] = magicItemSectionForm2.Section;
                     this.update_statblock();
                 }
             }
             catch
             {
             }
         }
         else
         {
             e.Cancel = true;
             int    num1 = e.Url.LocalPath.IndexOf(",");
             string str1 = e.Url.LocalPath.Substring(0, num1);
             string str2 = e.Url.LocalPath.Substring(num1);
             try
             {
                 int num2     = int.Parse(str1);
                 int section1 = int.Parse(str2);
                 ArtifactConcordance  artifactConcordance   = this.fArtifact.ConcordanceLevels[num2];
                 MagicItemSectionForm magicItemSectionForm3 = new MagicItemSectionForm(artifactConcordance.Sections[section1]);
                 if (magicItemSectionForm3.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     artifactConcordance.Sections[section1] = magicItemSectionForm3.Section;
                     this.update_statblock();
                 }
             }
             catch
             {
             }
         }
     }
     if (e.Url.Scheme == "sectionremove")
     {
         if (!e.Url.LocalPath.Contains(","))
         {
             e.Cancel = true;
             try
             {
                 int num3 = int.Parse(e.Url.LocalPath);
                 this.fArtifact.Sections.RemoveAt(num3);
                 this.update_statblock();
             }
             catch
             {
             }
         }
         else
         {
             e.Cancel = true;
             int    num4 = e.Url.LocalPath.IndexOf(",");
             string str3 = e.Url.LocalPath.Substring(0, num4);
             string str4 = e.Url.LocalPath.Substring(num4);
             try
             {
                 int num5 = int.Parse(str3);
                 int num6 = int.Parse(str4);
                 this.fArtifact.ConcordanceLevels[num5].Sections.RemoveAt(num6);
                 this.update_statblock();
             }
             catch
             {
             }
         }
     }
     if (e.Url.Scheme == "rule")
     {
         e.Cancel = true;
         if (e.Url.LocalPath == "new")
         {
             ArtifactConcordanceForm artifactConcordanceForm = new ArtifactConcordanceForm(new Pair <string, string>("", ""));
             if (artifactConcordanceForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.ConcordanceRules.Add(artifactConcordanceForm.Concordance);
                 this.update_statblock();
             }
         }
     }
     if (e.Url.Scheme == "ruleedit")
     {
         e.Cancel = true;
         try
         {
             int concordance = int.Parse(e.Url.LocalPath);
             ArtifactConcordanceForm artifactConcordanceForm1 = new ArtifactConcordanceForm(this.fArtifact.ConcordanceRules[concordance]);
             if (artifactConcordanceForm1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 this.fArtifact.ConcordanceRules[concordance] = artifactConcordanceForm1.Concordance;
                 this.update_statblock();
             }
         }
         catch
         {
         }
     }
     if (e.Url.Scheme == "ruleremove")
     {
         e.Cancel = true;
         try
         {
             int num7 = int.Parse(e.Url.LocalPath);
             this.fArtifact.ConcordanceRules.RemoveAt(num7);
             this.update_statblock();
         }
         catch
         {
         }
     }
     if (e.Url.Scheme == "quote")
     {
         e.Cancel = true;
         try
         {
             int num8 = int.Parse(e.Url.LocalPath);
             ArtifactConcordance details      = this.fArtifact.ConcordanceLevels[num8];
             DetailsForm         detailsForm4 = new DetailsForm(details.Quote, "Concordance Quote", null);
             if (detailsForm4.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 details.Quote = detailsForm4.Details;
                 this.update_statblock();
             }
         }
         catch
         {
         }
     }
     if (e.Url.Scheme == "desc")
     {
         e.Cancel = true;
         try
         {
             int num9 = int.Parse(e.Url.LocalPath);
             ArtifactConcordance item1        = this.fArtifact.ConcordanceLevels[num9];
             DetailsForm         detailsForm5 = new DetailsForm(item1.Description, "Concordance Description", null);
             if (detailsForm5.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 item1.Description = detailsForm5.Details;
                 this.update_statblock();
             }
         }
         catch
         {
         }
     }
 }