public void Init() { library = new Library("Source Sorter Test Library"); sorter = new SourceSorter(library); CitationFormat format = new CitationFormat("Print"); format.AddField("Title", typeof(WordField), false); format.AddField("Author", typeof(NameField), true); source1 = new Source(format); source1.SetValues("Title", "The Lion, the Witch, and the Wardrobe"); source1.SetValues("Author", "C.S. Lewis"); library.AddSource(source1); source2 = new Source(format); source2.SetValues("Title", "The Lord of the Rings"); source2.SetValues("Author", "J.R.R. Tolkien"); library.AddSource(source2); source3 = new Source(format); source1.SetValues("Title", "The Aspiring Adventures of Joe Bob"); source1.SetValues("Author", "Clive Tolkien", "Justice Beaver", "Mustard Yellow"); library.AddSource(source1); }
public SourceTests() { GlobalResources.CreateInitialDirectories(); format = new CitationFormat("Print"); format.AddField("Title", typeof(WordField), false); format.AddField("Author", typeof(NameField), true); format.AddField("Publish Year", typeof(NumberField), false); }
// Initialize all the Resource Data, avaialble throughout the // entire program // TODO - eventually store in external data public static void Initialize() { _libraryFilters = new List <Tuple <string, Type> > ( new Tuple <string, Type>[] { new Tuple <string, Type>("Title", typeof(WordField)), new Tuple <string, Type>("Author", typeof(NameField)), new Tuple <string, Type>("Publisher", typeof(WordField)), new Tuple <string, Type>("Publish Year", typeof(NumberField)), new Tuple <string, Type>("KeyGroup: Any", typeof(WordField)) } ); ResetOpenLibraryKeywords(); CreateInitialDirectories(); OpenLibrary.SetKeywordGroups("Keywords"); // Create a print CitationFormat CitationFormat printFormat = new CitationFormat("Print"); printFormat.AddField("Title", typeof(WordField), false); printFormat.AddField("Author", typeof(NameField), true); printFormat.AddField("Editor", typeof(NameField), true); printFormat.AddField("Publisher Region", typeof(WordField), false); printFormat.AddField("Publisher Name", typeof(WordField), false); printFormat.AddField("Publish Year", typeof(NumberField), false); CitationFormats.Add("print", printFormat); // Create an E-Book CitationFormat CitationFormat ebookFormat = new CitationFormat("E-Book"); ebookFormat.AddField("Title", typeof(WordField), false); ebookFormat.AddField("Author", typeof(NameField), true); ebookFormat.AddField("Editor", typeof(NameField), true); ebookFormat.AddField("Publisher Region", typeof(WordField), false); ebookFormat.AddField("Publisher Name", typeof(WordField), false); ebookFormat.AddField("Publish Year", typeof(NumberField), false); CitationFormats.Add("ebook", printFormat); CitationFormat websiteFormat = new CitationFormat("Website"); websiteFormat.AddField("Author", typeof(NameField), true); websiteFormat.AddField("URL", typeof(WordField), false); websiteFormat.AddField("Date Accessed", typeof(DateField), false); CitationFormats.Add("website", websiteFormat); }
/// <summary> /// Citations in AzLeg look like 1-203 where '1' is the Title, '2' is the Chapter, and '3' is the Article number (two digits) /// </summary> /// <returns></returns> private CitationFormat ParseCitation(string content) { Regex citationPattern = new Regex(@"(\d{1})-(\d{1})(\d{1,2})"); var matchesFound = citationPattern.Match(content); var citation = new CitationFormat(); if (matchesFound.Groups.Count > 1) { citation.Title = Int32.Parse(matchesFound.Groups[1].Value); citation.Chapter = Int32.Parse(matchesFound.Groups[2].Value); citation.Article = Int32.Parse(matchesFound.Groups[3].Value); } return(citation); }
private void FormatSourceFields(CitationFormat format) { DataSourceSourceFields.FieldInfo.Clear(); foreach (var fieldInfo in format.Fields) { if (fieldInfo.Name.ToLower() != "title") { DataSourceSourceFields.FieldInfo.Add( new DataSourceOutlineViewSourceFieldsInfo( fieldInfo ) ); } } OutlineViewSourceFields.ReloadData(); }
private void CreateSources() { CitationFormat format = GlobalResources.GetFormat("Print"); Source source1 = new Source(format), source2 = new Source(format), source3 = new Source(format); source1.GetField("title").SetValues("The Lion, the Witch, and the Wardrobe"); source1.GetField("author").SetValues("C.S. Lewis"); source2.GetField("title").SetValues("The Lord of the Rings: the Fellowship of the Ring"); source2.GetField("author").SetValues("J.R.R. Tolkien"); source3.GetField("title").SetValues("To Kill a Mockingbird"); source3.GetField("author").SetValues("Harper Lee"); GlobalResources.OpenLibrary.AddSource(source1); GlobalResources.OpenLibrary.AddSource(source2); GlobalResources.OpenLibrary.AddSource(source3); _sourceSorter.FilterSources(); }