Esempio n. 1
0
        public static string GetAuthorAsSting(AuthorType author)
        {
            var sb = new StringBuilder();
            if ((author.FirstName != null) && !string.IsNullOrEmpty(author.FirstName.Text))
            {
                sb.AppendFormat("{0} ", author.FirstName.Text);
            }

            if ((author.MiddleName != null) && !string.IsNullOrEmpty(author.MiddleName.Text))
            {
                sb.AppendFormat("{0} ", author.MiddleName.Text);
            }

            if ((author.LastName != null) && !string.IsNullOrEmpty(author.LastName.Text))
            {
                sb.AppendFormat("{0} ", author.LastName.Text);
            }

            if ((author.NickName != null) && !string.IsNullOrEmpty(author.NickName.Text))
            {
                sb.AppendFormat(sb.Length == 0 ? "{0} " : "({0}) ", author.NickName.Text);
            }

            if ((author.UID != null) && !string.IsNullOrEmpty(author.UID.Text))
            {
                sb.AppendFormat(": {0}", author.UID.Text);
            }
            return sb.ToString();
        }
        public string GenerateAuthorString(AuthorType author)
        {
            if (string.IsNullOrEmpty(Format)) // in case format set to empty just return title
            {
                return ""; // need to change to default ?
            }
            string newFirstName = ParseTemplate("f", (author.FirstName==null)? string.Empty :author.FirstName.Text);
            string newMiddleName = ParseTemplate("m", (author.MiddleName == null) ? string.Empty : author.MiddleName.Text);
            string newLastName = ParseTemplate("l", (author.LastName == null) ? string.Empty : author.LastName.Text);
            string newNick = ParseTemplate("n", (author.NickName == null) ? string.Empty : author.NickName.Text);

            String rc = Format.Replace("$f$", newFirstName.Trim());
            rc = rc.Replace("$m$", newMiddleName.Trim());
            rc = rc.Replace("$l$", newLastName.Trim());
            rc = rc.Replace("$n$", newNick.Trim());
            return rc.Trim();
        }
Esempio n. 3
0
 public static string GenerateAuthorString(AuthorType author,IEPubConversionSettings commonSettings)
 {
     var processor = new ProcessAuthorFormat { Format = commonSettings.AuthorFormat };
     return processor.GenerateAuthorString(author);
 }