Esempio n. 1
0
        /*
         * Identical to ToString(), accept it uses the Mnemonics per MARCMaker/Breaker (also MARCedit)
         * see: http://www.loc.gov/marc/makrbrkr.html#mnemonics
         */
        public string MARCMakerFormat()
        {
            StringBuilder returnText             = new StringBuilder();
            List <string> spaceOrSlashIndicators = new List <string> {
                " ", "\\", ""
            };

            if (this.IsControlField())
            {
                returnText.Append(
                    MARCMakerMnemonics.ReplaceCharsWithMnemonics(
                        "=" + this.tag + "  " + this.data.Replace(" ", "\\")));
            }
            else
            {
                returnText.Append("=" + this.tag + "  ");
                foreach (string indicator in this.indicators)
                {
                    if (spaceOrSlashIndicators.Contains(indicator))
                    {
                        returnText.Append("\\");
                    }
                    else
                    {
                        returnText.Append(indicator);
                    }
                }
                for (int i = 0; i < this.subfields.ToArray().Length; i = i + 2)
                {
                    returnText.Append(
                        "$" + //don't want to accidently replace this "$" with "{dollar}"
                        MARCMakerMnemonics.ReplaceCharsWithMnemonics(
                            this.subfields[i] + this.subfields[i + 1]));
                }
            }
            return(returnText.ToString());
        }
Esempio n. 2
0
 public void ReplaceMnemsWithChars()
 {
     Assert.Equals(unprocessed2, MARCMakerMnemonics.ReplaceMnemonicsWithChars(processed2));
     Assert.Equals(unprocessed1, MARCMakerMnemonics.ReplaceMnemonicsWithChars(processed1));
 }