Sorts by level now.

Signed-off-by: Melissa Avery-Weir <melissa.avery@wellsfargo.com>
This commit is contained in:
Melissa Avery-Weir
2011-09-16 13:32:39 -04:00
parent 4b31f5a561
commit c330e590b0
32 changed files with 918 additions and 58 deletions

8
.gitignore vendored
View File

@@ -1,3 +1,5 @@
bin/*
obj/*
*.suo
*/bin/*
*/obj/*
*.suo
*.exe
*.pdb

View File

@@ -6,6 +6,7 @@ using Xunit;
using d20_SRD_Spell_Lists.Models;
using System.Xml.Linq;
using System.IO;
using d20_SRD_Spell_Lists.Properties;
namespace d20_SRD_Spell_Lists_Tests
{
@@ -49,6 +50,23 @@ namespace d20_SRD_Spell_Lists_Tests
});
}
//[Fact]
//public void savingWithoutPreexistingUserFileCreatesOne() {
// if (System.IO.File.Exists(Settings.Default.UserSpells)) {
// System.IO.File.Delete(Settings.Default.UserSpells);
// }
// SpellSet spells = new SpellSet(masterSpellList);
// spells.addUserSpell(new XElement("spell",
// new XElement("name", "custom test spell")
// ));
// Assert.DoesNotThrow(delegate {
// spells.save();
// });
// Assert.True(System.IO.File.Exists(Settings.Default.UserSpells));
//}
[Fact]
public void loadingValidMasterXMLShouldResultIn699MasterSpells() {
SpellSet spells = new SpellSet(masterSpellList, userSpellList);

View File

@@ -1 +1 @@
<?xml version="1.0" encoding="utf-8" ?><character><name>Thomasina</name><class>Cleric</class><spells><spell><name>Dummy Character Spell</name><short_description>A short description.</short_description></spell></spells></character>
<?xml version="1.0" encoding="utf-8" ?><character><spells><spell><name>Dummy Character Spell</name><short_description>A short description.</short_description></spell></spells></character>

Binary file not shown.

View File

@@ -1,5 +1,5 @@
namespace d20_SRD_Spell_Lists {
partial class Form1 {
partial class FrmCredits {
/// <summary>
/// Required designer variable.
/// </summary>
@@ -23,12 +23,33 @@
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
this.lblCredits = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblCredits
//
this.lblCredits.AutoSize = true;
this.lblCredits.Location = new System.Drawing.Point(12, 66);
this.lblCredits.Name = "lblCredits";
this.lblCredits.Size = new System.Drawing.Size(35, 13);
this.lblCredits.TabIndex = 0;
this.lblCredits.Text = "label1";
//
// FrmCredits
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Text = "Form1";
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.lblCredits);
this.Name = "FrmCredits";
this.Text = "Credits";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
}
}
private System.Windows.Forms.Label lblCredits;
}
}

View File

@@ -8,9 +8,11 @@ using System.Text;
using System.Windows.Forms;
namespace d20_SRD_Spell_Lists {
public partial class Form1 : Form {
public Form1() {
public partial class FrmCredits : Form {
public FrmCredits() {
InitializeComponent();
lblCredits.Text = "Developer: Melissa Avery-Weir @ http://irrsinn.net\r\n";
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

322
d20 SRD Spell Lists/FrmMain.Designer.cs generated Normal file
View File

@@ -0,0 +1,322 @@
namespace d20_SRD_Spell_Lists {
partial class FrmMain {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain));
this.mainTabControl = new System.Windows.Forms.TabControl();
this.spellListTab = new System.Windows.Forms.TabPage();
this.spellsDataGridView = new System.Windows.Forms.DataGridView();
this.classComboBox = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.characterTab = new System.Windows.Forms.TabPage();
this.mainToolStrip = new System.Windows.Forms.ToolStrip();
this.newToolStripButton = new System.Windows.Forms.ToolStripButton();
this.openToolStripButton = new System.Windows.Forms.ToolStripButton();
this.saveToolStripButton = new System.Windows.Forms.ToolStripButton();
this.printToolStripButton = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator();
this.cutToolStripButton = new System.Windows.Forms.ToolStripButton();
this.copyToolStripButton = new System.Windows.Forms.ToolStripButton();
this.pasteToolStripButton = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.helpToolStripButton = new System.Windows.Forms.ToolStripButton();
this.prepColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.spellNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.componentColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.descColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.customColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.charCustomColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.mainTabControl.SuspendLayout();
this.spellListTab.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.spellsDataGridView)).BeginInit();
this.mainToolStrip.SuspendLayout();
this.SuspendLayout();
//
// mainTabControl
//
this.mainTabControl.Controls.Add(this.spellListTab);
this.mainTabControl.Controls.Add(this.characterTab);
this.mainTabControl.Dock = System.Windows.Forms.DockStyle.Bottom;
this.mainTabControl.Location = new System.Drawing.Point(0, 30);
this.mainTabControl.Multiline = true;
this.mainTabControl.Name = "mainTabControl";
this.mainTabControl.SelectedIndex = 0;
this.mainTabControl.Size = new System.Drawing.Size(571, 375);
this.mainTabControl.TabIndex = 0;
//
// spellListTab
//
this.spellListTab.Controls.Add(this.spellsDataGridView);
this.spellListTab.Controls.Add(this.classComboBox);
this.spellListTab.Controls.Add(this.label1);
this.spellListTab.Location = new System.Drawing.Point(4, 22);
this.spellListTab.Name = "spellListTab";
this.spellListTab.Padding = new System.Windows.Forms.Padding(3);
this.spellListTab.Size = new System.Drawing.Size(563, 349);
this.spellListTab.TabIndex = 0;
this.spellListTab.Text = "Spell List";
this.spellListTab.UseVisualStyleBackColor = true;
//
// spellsDataGridView
//
this.spellsDataGridView.AllowUserToOrderColumns = true;
this.spellsDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.spellsDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.prepColumn,
this.spellNameColumn,
this.componentColumn,
this.descColumn,
this.customColumn,
this.charCustomColumn});
this.spellsDataGridView.Dock = System.Windows.Forms.DockStyle.Bottom;
this.spellsDataGridView.Location = new System.Drawing.Point(3, 44);
this.spellsDataGridView.Name = "spellsDataGridView";
this.spellsDataGridView.Size = new System.Drawing.Size(557, 302);
this.spellsDataGridView.TabIndex = 2;
//
// classComboBox
//
this.classComboBox.FormattingEnabled = true;
this.classComboBox.Location = new System.Drawing.Point(49, 6);
this.classComboBox.Name = "classComboBox";
this.classComboBox.Size = new System.Drawing.Size(121, 21);
this.classComboBox.TabIndex = 1;
this.classComboBox.Text = "Choose a class:";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(6, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Class:";
//
// characterTab
//
this.characterTab.Location = new System.Drawing.Point(4, 22);
this.characterTab.Name = "characterTab";
this.characterTab.Padding = new System.Windows.Forms.Padding(3);
this.characterTab.Size = new System.Drawing.Size(563, 349);
this.characterTab.TabIndex = 1;
this.characterTab.Text = "Character";
this.characterTab.UseVisualStyleBackColor = true;
//
// mainToolStrip
//
this.mainToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.newToolStripButton,
this.openToolStripButton,
this.saveToolStripButton,
this.printToolStripButton,
this.toolStripSeparator,
this.cutToolStripButton,
this.copyToolStripButton,
this.pasteToolStripButton,
this.toolStripSeparator1,
this.helpToolStripButton});
this.mainToolStrip.Location = new System.Drawing.Point(0, 0);
this.mainToolStrip.Name = "mainToolStrip";
this.mainToolStrip.Size = new System.Drawing.Size(571, 25);
this.mainToolStrip.TabIndex = 1;
//
// newToolStripButton
//
this.newToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.newToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripButton.Image")));
this.newToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.newToolStripButton.Name = "newToolStripButton";
this.newToolStripButton.Size = new System.Drawing.Size(23, 22);
this.newToolStripButton.Text = "&New";
//
// openToolStripButton
//
this.openToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.openToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripButton.Image")));
this.openToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.openToolStripButton.Name = "openToolStripButton";
this.openToolStripButton.Size = new System.Drawing.Size(23, 22);
this.openToolStripButton.Text = "&Open";
//
// saveToolStripButton
//
this.saveToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.saveToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripButton.Image")));
this.saveToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.saveToolStripButton.Name = "saveToolStripButton";
this.saveToolStripButton.Size = new System.Drawing.Size(23, 22);
this.saveToolStripButton.Text = "&Save";
//
// printToolStripButton
//
this.printToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.printToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("printToolStripButton.Image")));
this.printToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.printToolStripButton.Name = "printToolStripButton";
this.printToolStripButton.Size = new System.Drawing.Size(23, 22);
this.printToolStripButton.Text = "&Print";
//
// toolStripSeparator
//
this.toolStripSeparator.Name = "toolStripSeparator";
this.toolStripSeparator.Size = new System.Drawing.Size(6, 25);
//
// cutToolStripButton
//
this.cutToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.cutToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("cutToolStripButton.Image")));
this.cutToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.cutToolStripButton.Name = "cutToolStripButton";
this.cutToolStripButton.Size = new System.Drawing.Size(23, 22);
this.cutToolStripButton.Text = "C&ut";
//
// copyToolStripButton
//
this.copyToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.copyToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("copyToolStripButton.Image")));
this.copyToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.copyToolStripButton.Name = "copyToolStripButton";
this.copyToolStripButton.Size = new System.Drawing.Size(23, 22);
this.copyToolStripButton.Text = "&Copy";
//
// pasteToolStripButton
//
this.pasteToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.pasteToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("pasteToolStripButton.Image")));
this.pasteToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.pasteToolStripButton.Name = "pasteToolStripButton";
this.pasteToolStripButton.Size = new System.Drawing.Size(23, 22);
this.pasteToolStripButton.Text = "&Paste";
//
// toolStripSeparator1
//
this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
//
// helpToolStripButton
//
this.helpToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.helpToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("helpToolStripButton.Image")));
this.helpToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.helpToolStripButton.Name = "helpToolStripButton";
this.helpToolStripButton.Size = new System.Drawing.Size(23, 22);
this.helpToolStripButton.Text = "He&lp";
//
// prepColumn
//
this.prepColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
this.prepColumn.DataPropertyName = "IsPrepped";
this.prepColumn.HeaderText = "Prep?";
this.prepColumn.Name = "prepColumn";
this.prepColumn.Width = 41;
//
// spellNameColumn
//
this.spellNameColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
this.spellNameColumn.DataPropertyName = "Name";
this.spellNameColumn.HeaderText = "Name";
this.spellNameColumn.Name = "spellNameColumn";
this.spellNameColumn.Width = 60;
//
// componentColumn
//
this.componentColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells;
this.componentColumn.DataPropertyName = "Components";
this.componentColumn.HeaderText = "Comp";
this.componentColumn.Name = "componentColumn";
this.componentColumn.Width = 59;
//
// descColumn
//
this.descColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.descColumn.DataPropertyName = "ShortDescription";
this.descColumn.HeaderText = "Description";
this.descColumn.Name = "descColumn";
//
// customColumn
//
this.customColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
this.customColumn.DataPropertyName = "IsCustom";
this.customColumn.HeaderText = "A?";
this.customColumn.Name = "customColumn";
this.customColumn.ReadOnly = true;
this.customColumn.Width = 26;
//
// charCustomColumn
//
this.charCustomColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.ColumnHeader;
this.charCustomColumn.DataPropertyName = "IsCharCustom";
this.charCustomColumn.HeaderText = "C";
this.charCustomColumn.Name = "charCustomColumn";
this.charCustomColumn.ReadOnly = true;
this.charCustomColumn.Width = 20;
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(571, 405);
this.Controls.Add(this.mainToolStrip);
this.Controls.Add(this.mainTabControl);
this.Name = "FrmMain";
this.Text = "D&D 3.5 SRD Spell Lists";
this.mainTabControl.ResumeLayout(false);
this.spellListTab.ResumeLayout(false);
this.spellListTab.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.spellsDataGridView)).EndInit();
this.mainToolStrip.ResumeLayout(false);
this.mainToolStrip.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TabControl mainTabControl;
private System.Windows.Forms.TabPage spellListTab;
private System.Windows.Forms.TabPage characterTab;
private System.Windows.Forms.ToolStrip mainToolStrip;
private System.Windows.Forms.ToolStripButton newToolStripButton;
private System.Windows.Forms.ToolStripButton openToolStripButton;
private System.Windows.Forms.ToolStripButton saveToolStripButton;
private System.Windows.Forms.ToolStripButton printToolStripButton;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator;
private System.Windows.Forms.ToolStripButton cutToolStripButton;
private System.Windows.Forms.ToolStripButton copyToolStripButton;
private System.Windows.Forms.ToolStripButton pasteToolStripButton;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
private System.Windows.Forms.ToolStripButton helpToolStripButton;
private System.Windows.Forms.ComboBox classComboBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.DataGridView spellsDataGridView;
private System.Windows.Forms.DataGridViewCheckBoxColumn prepColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn spellNameColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn componentColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn descColumn;
private System.Windows.Forms.DataGridViewCheckBoxColumn customColumn;
private System.Windows.Forms.DataGridViewCheckBoxColumn charCustomColumn;
}
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using d20_SRD_Spell_Lists.Models;
namespace d20_SRD_Spell_Lists {
public partial class FrmMain : Form {
private SpellSet spells;
private Character character;
public FrmMain() {
InitializeComponent();
character = new Character();
spells = new SpellSet();
spellsDataGridView.AutoGenerateColumns = false;
setupClassList();
}
private void setupClassList() {
classComboBox.DataSource = Character.ClassNames;
classComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
classComboBox.SelectedIndexChanged += new System.EventHandler(classComboBox_SelectedIndexChanged);
classComboBox_SelectedIndexChanged(classComboBox, new EventArgs());
}
private void classComboBox_SelectedIndexChanged(object sender, EventArgs e) {
ComboBox classList = (ComboBox)sender;
string charClass = classList.SelectedItem.ToString();
this.spellsDataGridView.DataSource = spells.byClass((Character.SpellCastingClasses)Enum.Parse(typeof(Character.SpellCastingClasses), charClass, true));
}
}
}

View File

@@ -0,0 +1,263 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="prepColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="spellNameColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="componentColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="descColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="customColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="charCustomColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="mainToolStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="newToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAQ9JREFUOE+t09lq
wkAUBmBfyr5DfY32jaReSOmFCyKCgkKLFrVUBZeKiEbshqRuaNw1xiXmLxMJBJ0Zc+GBw9zMfDPnHMZm
u1ZE35s4zXCqjmC8Al+sgHLjD9y7yGFWPIbecOO45yORtMAEHnxxJHL1IyKI9JeEXqtMwOl50Q8bSS0l
8PzBBPbqAQQxICrgjeapgKZpkJUdBmNZB+y3d/QSnsIZKrDdqZjMFYj9OR9wB1NngHrQsJC36EkrfIkT
PuDyJ84AZbOHNF2j1Z2h9i3xAVKfOUjjZssN2oMFmq0xSkLfOmBu3E97iurnENlKxzpgbpzwO0Kh1kOy
KFoDjHmzVuYYjRmTDZfyWh9Yd/4B2Mz2w1z7EGUAAAAASUVORK5CYII=
</value>
</data>
<data name="openToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAlpJREFUOE+tk21I
k1EYhif0oyA0sqIQCix/+GcQFFH9CCmiUBTLLEjShJofVBgL2fxoU9Pp5ubUlS5rU9f8rCyjsA+pUCRC
TR1ppmVFUSlmhq78unrnQF1KGHTg/nEOz30993PO+7qJFrmUeiv2n+Mij+XLRLLYULdF2pxlEVIDcw0p
AsyxD5fmI/rQ94pqi26eOlsfuZj+7BgSm01QdA4ih7m73Yx9qGpavwatjPebqCzOprPt8YKQgzFagqL0
BEjyEFWVaBkdLHMxT34uYNwWR9nVTEoL0zHlp2DMSeaSRk6eKt4VWm5WM/rVPNN5SjDTLQebZEHNA1wr
UvHjk3E6tsNcV62e1r3KLGqtKm6WplNpSsVqVFJsOM8VfSKFWjkGtcyZptSYzvC7XByx3zQoqCnTMvlG
CX1prnornPUmQJcUXsbSVhGK5bIOkcmQyveeTHiv4VZ5Nk33Nc6iuSO8CIfmECYa/bE/8ON1iRipJNh5
F0V6Bd86lfQ1JlFj1TDVq4COKCegLVIwHmGiKRB7/V6G7+5koHozymgfYRy5E1CgTWKgXcZ1i5qWp0KS
rjgBcAJawph6FszYk/2M1O1isGYLX8p9ab6wgqP+3rMvYciS01GfzA1LFvQkQ6sQ9/khxhoCGHnox1Dt
NvorxXw0b8Km8UQh2cip6GOzgNyMeKqKM7HdjqFZJ5pRk2YJ9aql3EnxoCJxNaZ4Ly6e3UDY3O6OEXRp
59ApTpIhiyDh9GHORAZyPHQPB/ZtZ/cOMVvFPvh6e7F+3SrWrHRnraf7Xz/xf/rJ/kvxb84I3U1y+9/W
AAAAAElFTkSuQmCC
</value>
</data>
<data name="saveToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAixJREFUOE+tk91L
k3EUx/cvdN9N0EW3NTWGa7EaPOUcyqphWBG9PZEv5dJlmqhYmUYtXyBb4dJJy+kknFT4BqZIjaFMJUsz
V7TEoabYRDD49ju/6Pm1Mi+iH5zLz+c855zvo1L9j/fsaRRUvvZltHmX8Ni9gMaGCO47ZlBb8wn22yHc
KJ9CackECgteIy93FBfOB6H0JrC3B6ipXsVGb2V1Dca0XhxOe8JLEXhbF7mgsuLLX3mCIwsr2G1+DrVa
huWQRwjcj+a5oLTk87qCn/D78CLiTD4UXJ7GAXOTEDjrZ7ngku3dH4Jf4ZHJCLZJXlhzxpGa4hSCurth
LsjOGo0R/A4PBsPYrHdDlgMwmRxCUF31kQvkMwFFsB7c4/+ATYkNOHL0BZKSaoXgZuU0urvATgkcP/kK
lmMDfNu0MJqZPps6/4D7cNDSCUmyC8HVskl0+MAyADS5vrG7f0X59Tm+VFoYzZyZEVTg5NR2GAwVQnCl
cByeZuChc40FJwpjek5MmU/YkH6uiHdOTmHwfg/0+jIhsOWNMRiouhPlnUnAQoI4rYSht7MYm5qDnHsN
e41tHNbucUGnKxICiqXjHpTPJgHBZ/Nv4U1oHqGZJVwstiNe72JwI+J3PYA2MV8IMjOG2dzLfOatBg+2
7JDQ0tEPX9cguvv8GHg5hH0mC9S6eiQweLumDhqNVQgo06dP9fN4UsIoJHRnOhVtmxZGM1NXKoJ3JmTH
Cv71r/4OTrQ4xWMwWlcAAAAASUVORK5CYII=
</value>
</data>
<data name="printToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAi1JREFUOE+1k/9P
UlEYxv2nWK2tVlttGmpltrCcEQ1XUjSMaUHJNLIpNcnCragplBvUoC/okJhZLG92ySUpU8RNICdIhAio
EF+e7r1UZMDW1jrb+8t7z/N83vucc8rK/sdyeYIwvpopWYbRaZTk0uIx0o0/V/JbGt7lVTwxT6CKKylt
oLd8xGYihS/hKGz2WaaeWUnoTATsMz7UCztx9Ex7cYN3jkUQU4tb4DR5LZaAcyEAg4VE5YlLMFmJQoNQ
JA61gUA6k4XPH9pCN9s+gZz2oq5Jjlq+DDfUz3Fba86bOGY9jHiUdDF0mvqT7A/F4fKEcE9nZf5d1jOI
B4ZxVJ2U5gyc8z70akegMX3AXb0ND1+8R6/GgvZbeog61OA2K3CA2lxR34JjZ69B2T8EsVyN/Q0XcwY3
B14iGk8UpE43UukMNqhA6QyC4Q0srcQg7dagsbWHmuDHScj7jDC9nsJTqx0a4xjuaIfRqXoMSXc/hG0q
8C4owGnqwEGeFOXHxThH9eoEV7G7VpiboE2pK0qnm9H1JLz+NUzOBfHWEcAQsQSuqAuVDa1gVZzKGUgU
jwoMqAzxNZbC3Od1jDvDYPdth+7NCpP8Yf4V7KoR5A1arg8gmQIoGMLxLJYjWSwEMphwb2J4MoZB2yqU
LBZUIxHGYB9HlBfTE4jl9+GmBPTHv6lfo//+GGoaZajmXQabumXl1HHt5TRjz5Hz2HlIgB3Vp7GNzWeo
RcX/+pq/AwHYL0leVl8fAAAAAElFTkSuQmCC
</value>
</data>
<data name="cutToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAYdJREFUOE+t001L
QlEQBuB+TdCmRVEJRRIWtRAUlKsQhFmkpZQtIiWyAlMwP5KkXS0shLqGFkgoFqWQmaRR2qIvU7FMwWhd
8JZXkFx0uVGzOcNh5jkDw6mr+++4SN7B6fbju/uQecYm6a25+/Hdl2IJptWNmmJyL4DwWZwZUJbtayT8
RxGqIV8oQaaaRfrxkTmw4z2G+WuKbC6PYDgOkUSJp6ccc+AgdI4luwPbHh/UCxb0S0aZN5fHTmefMTVv
wfDEHIiBMegMpt8BZUShNoGQTIKQGxA8TTIHMoUPGF1vEOvTWHTcgqeJQahNwLqVQiRRpIdS+XcM2l4h
1t2DI3WAP7oGoSYE3kwSPQofljcqm/kxjK4SCH0OXSMetItsUC26wZuOVptYhI0eEOuz1YI2gZnKBdpr
6iR9V2jkKOkBQpeiCryhFFr4eioft16iU7qNho4h1Dc00QOqlRuwpSSa+UawuZXdByIZsPoUaOmWwrUf
owcOozlwZeto7ZXDuXvCfHV/+dGfqqrf44qgu28AAAAASUVORK5CYII=
</value>
</data>
<data name="copyToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAeJJREFUOE+lk9FP
klEYxv1TSsecde0f0FpZrTbbal7URVvZuuJCr7pq2WzLNWy0iSHNwtIB9qG0ltLSYRJpBomUgZPMGSyU
8SmJIOiv7zssCdrAzXd77s77e5/nnPdUVR20HBPfUCWNB4QsI176HB8IL/9iX2y1ubTMwx6utz0nuLhc
GWIfCxT153Z26ep/g9Md4FJLZ2WIZdQnAM4QSJ/BH5Z5aH6NNCljm0hgdSV4MppAPxQXCq5kil31OTx7
DjLbOeSNNJFYUgBKq31glfpmN76F9QLEZHOJc73ubXQjMreln7Q+DdP/du0/QIsxhmNK5mjTMJ/m43mI
Qcmr5t5MZVlNpFiKrPM1vIbpVVQAOqSckF+ZekUX5UjTS+ouDFLb+CwPUPNupbN7k7WmEDcMX3hgXSpy
IP/OsrCyhXtuA6M0g+bc4wJATqaZ/x7DF4zg8f9g/OMibb355701kERriHL5fojzd2aFjNI0mjPdBUD9
6auUqlU/KwBZJV4skWUuvMmYV8b+Ls6jQQ81DfryO3KtfUoA/p3810G37T3VJ3TlARdvukhldjANeemx
z2B8MS0mq80GyySHj98rD2jQOpXbtgrVNprRnO2h5lQX1Sc7leYODh27W3nN9/WZDnroDx0A5wwhdtmt
AAAAAElFTkSuQmCC
</value>
</data>
<data name="pasteToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAlBJREFUOE+1k1lI
lGEUhn/owm6KFuqqq4LoJooIqouMwixMM4zEjKyJGJUSlcnSITU1RSe3SdPGyGVQc6tEUSkSIXFo13CM
FonUyGmy5p9xz+Lp/z8ZbGjzpgMv5+a8z1n4Pkn6H9HZnEH7zVQayxKYF7+hMg+3ynKO4LBVMWa7xmBf
Nme1vuSl67hi0GNMj/sVqBon5XqmnXVMOqoxF+sYH6kgJyWKF13xnD/tT7xmM7bOY4y0riY6bL8nRAWo
5mlnDUUZR+m2ZCO/L2C4T89bywmaSgIJD/WmKnEVT/MkIg/v8wTUVeTMAuQbGBLDSNaFoI8K5lxkEDpt
IDEafyJCfciPXiMAIX7enoDqUgNTci1TdhPjQ5nYn0dhrVgu1Fu+jO7iRTwyegmzKp9tGz0BZlMGE/Yy
JgbSGH95irFnB5GbF5Nb3kqmqZELl2uJN5iJSS0hPMFIWGyWJ6C0MJXRQSNjfVpGH/vjur+Jj7dXCLM7
pme+4XBOMjDsIDgihYDj+jlISW4S8qs0XA99cXWsx9m2ksFySXRWo/RWp5Cppp3efpsw3+2ysidIMwsp
zErgc88ZnO3rkFuWYq/3ov+6JMb+OvOdLy6l8wcHvW9sWHre4Rcag69i3rX3AN7bdyDlX4zD/iBCMS/h
U8NChioXYC2SiFZ2Vsd2T3BVmaDA3EZTh1VkVVs3rEW6lBwrHoj7yu6sVQ72c+d7ltfCXH+nm5rWJ3MA
dY3cpJPKCwtEE7SbgJ1bBFm9trqzu9vvspjgT3FIubZa8C/N67P9regHTvjvLQ3rR38AAAAASUVORK5C
YII=
</value>
</data>
<data name="helpToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAhhJREFUOE+1U09r
E0EU70fIR9iPUBQ8eMrR46IN5JhCDz2oBA8SBHEpCMFgG5GiwdJdq2Ijqe6ldo3Wrmhri0gXazW2YbMt
UdNmm45ulf7R/HwzU1hLIzn54LFvhvn9eW9nOjr+R0wvBLhTXEf6bgV9w0sYLJQx/uoz2mq9c7eRn2pA
L67Bq+/i29YeWLBL9Q6u5ktI6w6Kr1dbE3HwA3sT/o8mbAfQRgE1LZPXtsPgbjZxaXAG4y/Kh0m48sbP
JgwbiKYAwwLYNkR4DEje5HsMFSI5l3l2kGD6/RYezzeEMgfzwzzMWSCRlV9OFk0xqhl06wNy+Tchyb2n
dXxhv4TVaFLazppAJ9VKL0MySxYoVI0hkXaw5AbovjAWEmTur4qBqZoEdfbKVCgTBObqdolBUW0ocRs1
P8Cx2PWQ4PJtl6a9J+xLIB1OMHIilU2b1gSMqCZ9TdTq33FEHQgJcg8rWPF3qHcJVOKeyOyoJIioDqUk
UFM2SuUqus4YIcHEzFdYji8GxIGROAc41JJHc6E1B58wRRqWhzFrEVduTR78E5mRBSz7v0l1H0AgXgsH
+2DNcPBp3cep0/rhezA5V0Vfbg5ug+4CqaiaI/rmyWu+t1zdQIysDxdmW9/GiZcVnO+fgvHkI+YXV7BG
067VA9Ezt91Fyvq/wH8/lKHCW/RcfITj8Rs4evIaYmdHkBl63v4xtX1tLQ78AZ3a8qxOv4hDAAAAAElF
TkSuQmCC
</value>
</data>
</root>

View File

@@ -271,5 +271,16 @@ namespace d20_SRD_Spell_Lists.Models {
}
}
public static string[] ClassNames {
get {
List<string> classes = new List<string>();
foreach (SpellCastingClasses cl in Enum.GetValues(typeof(SpellCastingClasses))) {
classes.Add(getClassName(cl));
}
return classes.ToArray<string>();
}
}
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace d20_SRD_Spell_Lists.Models {
public class Spell {
public bool IsPrepped { get; set; }
public string Name { get; set; }
public int Level { get; set; }
public string Component { get; set; }
public string ShortDescription { get; set; }
public bool IsCustom { get; set; }
public bool IsCharCustom { get; set; }
}
public class SpellComparer : IEqualityComparer<Spell> {
public bool Equals(Spell x, Spell y) {
return x.Name == y.Name;
}
public int GetHashCode(Spell obj) {
return obj.Name.GetHashCode();
}
}
}

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Xml;
using System.Xml.Linq;
using d20_SRD_Spell_Lists.Exceptions;
using System.Text.RegularExpressions;
namespace d20_SRD_Spell_Lists.Models {
public class SpellSet {
@@ -44,8 +45,8 @@ namespace d20_SRD_Spell_Lists.Models {
userSpellList.Add(xElement);
}
public IEnumerable<XElement> byClass(Character.SpellCastingClasses spellCastingClass) {
XElement spells = new XElement("spells");
public IEnumerable<Spell> byClass(Character.SpellCastingClasses spellCastingClass) {
List<Spell> spells = new List<Spell>();
filterMasterSpellsByClass(spellCastingClass, spells);
filterUserSpellsByClass(spellCastingClass, spells);
@@ -53,56 +54,43 @@ namespace d20_SRD_Spell_Lists.Models {
removeHiddenSpells(spells);
return spells.Elements("spell");
return spells;
}
private void filterMasterSpellsByClass(Character.SpellCastingClasses spellCastingClass, XElement spells) {
spells.Add((from sp in masterSpellList.Elements("spell")
let level = (string)sp.Element("level")
where level != null && level.Contains(Character.getClassName(spellCastingClass))
select sp));
private void filterMasterSpellsByClass(Character.SpellCastingClasses spellCastingClass, List<Spell> spells) {
spells.AddRange(querySpellsByClass(masterSpellList, spellCastingClass, false, false).ToList<Spell>());
}
private void filterCharacterSpellsByClass(Character.SpellCastingClasses spellCastingClass, XElement spells) {
private void filterCharacterSpellsByClass(Character.SpellCastingClasses spellCastingClass, List<Spell> spells) {
if (characterSpellCount() > 0) {
spells.Add((from sp in charSpellList.Elements("spell")
let level = (string)sp.Element("level")
where level != null && level.Contains(Character.getClassName(spellCastingClass))
select sp));
spells.AddRange(querySpellsByClass(charSpellList, spellCastingClass, false, true));
}
}
private void filterUserSpellsByClass(Character.SpellCastingClasses spellCastingClass, XElement spells) {
private void filterUserSpellsByClass(Character.SpellCastingClasses spellCastingClass, List<Spell> spells) {
if (userSpellCount() > 0) {
spells.Add((from sp in userSpellList.Elements("spell")
let level = (string)sp.Element("level")
where level != null && level.Contains(Character.getClassName(spellCastingClass))
select sp));
spells.AddRange(querySpellsByClass(userSpellList, spellCastingClass, true, false).ToList<Spell>());
}
}
private void removeHiddenSpells(XElement spells) {
private void removeHiddenSpells(List<Spell> spells) {
if (hiddenSpellCount() > 0) {
foreach (string hiddenSpellName in (from hp in userSpellList.Elements("hidden_spell").Elements("spell")
select (string)hp.Element("name"))) {
(from sp in spells.Elements("spell")
where (string)sp.Element("name") == hiddenSpellName
select sp).Remove();
spells.RemoveAll(sp => sp.Name == hiddenSpellName);
}
}
if (hiddenCharacterSpellCount() > 0) {
foreach (string hiddenSpellName in (from hp in charSpellList.Elements("hidden_spell").Elements("spell")
select (string)hp.Element("name"))) {
(from sp in spells.Elements("spell")
where (string)sp.Element("name") == hiddenSpellName
select sp).Remove();
spells.RemoveAll(sp => sp.Name == hiddenSpellName);
}
}
}
public IEnumerable<XElement> byClassAndLevel(Character.SpellCastingClasses spellCastingClass, int level) {
XElement spells = new XElement("spells");
public IEnumerable<Spell> byClassAndLevel(Character.SpellCastingClasses spellCastingClass, int level) {
List<Spell> spells = new List<Spell>();
filterMasterSpellsByClassAndLevel(spellCastingClass, level, spells);
filterUserSpellsByClassAndLevel(spellCastingClass, level, spells);
@@ -110,32 +98,63 @@ namespace d20_SRD_Spell_Lists.Models {
removeHiddenSpells(spells);
return spells.Elements("spell");
return spells;
}
private void filterCharacterSpellsByClassAndLevel(Character.SpellCastingClasses spellCastingClass, int level, XElement spells) {
private void filterCharacterSpellsByClassAndLevel(Character.SpellCastingClasses spellCastingClass, int level, List<Spell> spells) {
if (characterSpellCount() > 0) {
spells.Add((from sp in charSpellList.Elements("spell")
let xmlLevel = (string)sp.Element("level")
where xmlLevel != null && xmlLevel.Contains(Character.getClassName(spellCastingClass) + " " + level.ToString())
select sp));
spells.AddRange(querySpellsByClassAndLevel(charSpellList, spellCastingClass, level, false, true));
}
}
private void filterUserSpellsByClassAndLevel(Character.SpellCastingClasses spellCastingClass, int level, XElement spells) {
private void filterUserSpellsByClassAndLevel(Character.SpellCastingClasses spellCastingClass, int level, List<Spell> spells) {
if (userSpellCount() > 0) {
spells.Add((from sp in userSpellList.Elements("spell")
let xmlLevel = (string)sp.Element("level")
where xmlLevel != null && xmlLevel.Contains(Character.getClassName(spellCastingClass) + " " + level.ToString())
select sp));
spells.AddRange(querySpellsByClassAndLevel(userSpellList, spellCastingClass, level, true, false).ToList<Spell>());
}
}
private void filterMasterSpellsByClassAndLevel(Character.SpellCastingClasses spellCastingClass, int level, XElement spells) {
spells.Add((from sp in masterSpellList.Elements("spell")
let xmlLevel = (string)sp.Element("level")
where xmlLevel != null && xmlLevel.Contains(Character.getClassName(spellCastingClass) + " " + level.ToString())
select sp));
private IEnumerable<Spell> querySpellsByClassAndLevel(XElement list, Character.SpellCastingClasses spellCastingClass, int level, bool isCustom, bool isCharCustom) {
string c = Character.getClassName(spellCastingClass);
Regex levelReg = new Regex(@" (\d+)?");
return (from sp in list.Elements("spell")
let xmlLevel = (string)sp.Element("level")
let xmlComp = (string)sp.Element("components")
let xmlDesc = (string)sp.Element("short_description")
where xmlLevel != null && xmlLevel.Contains(c + " " + level.ToString())
orderby levelReg.Match(xmlLevel, xmlLevel.IndexOf(c)).Groups[1].Value
select new Spell {
IsPrepped = false,
Name = sp.Element("name").Value,
Level = int.Parse(levelReg.Match(xmlLevel, xmlLevel.IndexOf(c)).Groups[1].Value),
Component = (xmlComp != null ? xmlComp : ""),
ShortDescription = (xmlDesc != null ? xmlDesc : ""),
IsCustom = isCustom,
IsCharCustom = isCharCustom
});
}
private IEnumerable<Spell> querySpellsByClass(XElement list, Character.SpellCastingClasses spellCastingClass, bool isCustom, bool isCharCustom) {
string c = Character.getClassName(spellCastingClass);
Regex levelReg = new Regex(@" (\d+),?");
return (from sp in list.Elements("spell")
let xmlLevel = (string)sp.Element("level")
let xmlComp = (string)sp.Element("components")
let xmlDesc = (string)sp.Element("short_description")
where xmlLevel != null && xmlLevel.Contains(c)
orderby levelReg.Match(xmlLevel, xmlLevel.IndexOf(c)).Groups[1].Value
select new Spell {
IsPrepped = false,
Name = sp.Element("name").Value,
Level = int.Parse(levelReg.Match(xmlLevel, xmlLevel.IndexOf(c)).Groups[1].Value),
Component = (xmlComp != null ? xmlComp : ""),
ShortDescription = (xmlDesc != null ? xmlDesc : ""),
IsCustom = isCustom,
IsCharCustom = isCharCustom
});
}
private void filterMasterSpellsByClassAndLevel(Character.SpellCastingClasses spellCastingClass, int level, List<Spell> spells) {
spells.AddRange(querySpellsByClassAndLevel(masterSpellList, spellCastingClass, level, false, false).ToList<Spell>());
}
/// <summary>

View File

@@ -12,7 +12,7 @@ namespace d20_SRD_Spell_Lists {
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
Application.Run(new FrmMain());
}
}
}

View File

@@ -62,16 +62,29 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Exceptions\NoCharacterFileException.cs" />
<Compile Include="Form1.cs">
<Compile Include="FrmCredits.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
<Compile Include="FrmCredits.Designer.cs">
<DependentUpon>FrmCredits.cs</DependentUpon>
</Compile>
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="Models\Character.cs" />
<Compile Include="Models\Spell.cs" />
<Compile Include="Models\SpellSet.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FrmCredits.resx">
<DependentUpon>FrmCredits.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>

View File

@@ -9,3 +9,5 @@ F:\spelllists\d20 SRD Spell Lists\obj\x86\Release\d20 SRD Spell Lists.pdb
F:\spelllists\d20 SRD Spell Lists\bin\Release\d20 SRD Spell Lists.exe.config
F:\spelllists\d20 SRD Spell Lists\bin\Release\AppData\MasterSpellList.xml
F:\spelllists\d20 SRD Spell Lists\bin\Release\AppData\UserSpellList.xml
F:\spelllists\d20 SRD Spell Lists\obj\x86\Release\d20_SRD_Spell_Lists.FrmCredits.resources
F:\spelllists\d20 SRD Spell Lists\obj\x86\Release\d20_SRD_Spell_Lists.FrmMain.resources