//public string Truncate(string value, int maxLength) //{ // return value?.Substring(0, Math.Min(value.Length, maxLength)); //} public static new Catechism Parse(string stringValue, bool answers, bool proofs) { string[] words; Catechism catechism = new Catechism(); words = stringValue.Split('~'); catechism.Type = words[0]; catechism.IDNumber = Int32.Parse(words[1]); catechism.question = words[2]; if (answers == true) { catechism.answer = words[3]; } else { catechism.answer = ""; } catechism.Title = words[4]; if (proofs == true) { catechism.Proofs = words[5]; } else { catechism.Proofs = ""; } catechism.DocTitle = words[6]; catechism.Tags = words[7]; return(catechism); }
public static Document Parse(String fileName, bool answers, bool proofs) { string[] words; Document document = new Document(); words = fileName.Split('~'); document.Type = words[0]; switch (words[0].ToUpper()) { case "CONFESSION": document = Confession.Parse(fileName, proofs); break; case "CATECHISM": document = Catechism.Parse(fileName, answers, proofs); break; case "CREED": document = Creed.Parse(fileName); break; default: ProcessError(String.Format("{0} is an invalid " + "Document type value for the Document " + "class Parse method", words[0])); break; } return(document); }
public void Copy(Catechism catechisms) { this.question = catechisms.question; this.answer = catechisms.answer; }
public Catechism(Catechism sourceCatechism) : base(sourceCatechism) { this.Copy(sourceCatechism); }