示例#1
0
        public TBook(string name, TParsingParameters parsingParameters, EBookType bookType = EBookType.folder, string relativePath = "") : this()
        {
            if (bookType == EBookType.unknown)
            {
                BookType = _FindBookType(name);
            }
            else
            {
                BookType = bookType;
            }

            string ProcessedName = BookType.IsFileType() ? name.BeforeLast(".") : name;

            if (!_NewParse(ProcessedName, parsingParameters))
            {
                if (!_Parse(ProcessedName))
                {
                    Name = ProcessedName;
                }
            }

            if (!CollectionNameComponents.Any())
            {
                int i = 0;
                foreach (string PathItem in relativePath.Split('\\'))
                {
                    CollectionNameComponents.Add(i++, PathItem);
                }
            }

            RelativePath = relativePath;
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Edition" /> class.
 /// </summary>
 /// <param name="publisher">The publisher name.</param>
 /// <param name="pageNumber">The page number.</param>
 /// <param name="year">The year.</param>
 /// <param name="bookType">The book type.</param>
 /// <param name="noForLibrary">The number of books for library reading.</param>
 /// <param name="noForLoan">The number of books for loan.</param>
 /// <param name="loans">The loan list.</param>
 public Edition(string publisher, int pageNumber, int year, EBookType bookType, int noForLibrary, int noForLoan, List <Loan> loans)
 {
     Publisher    = publisher;
     PageNumber   = pageNumber;
     Year         = year;
     BookType     = bookType;
     NoForLibrary = noForLibrary;
     NoForLoan    = noForLoan;
     NoTotal      = noForLoan + noForLibrary;
     Loans        = loans;
 }
 public void AddABook(EBookType type)
 {
     if (borrowedBook.ContainsKey(type))
     {
         borrowedBook[type]++;
     }
     else
     {
         borrowedBook.Add(type, 1);
     }
 }
示例#4
0
        private BookRegister GetBookRegister(EBookType type)
        {
            BookRegister register = null;

            switch (type)
            {
            case EBookType.Fiction:
                register = RegisterFiction;
                break;

            case EBookType.NonFiction:
                register = RegisterNonFiction;
                break;
            }

            return(register);
        }
示例#5
0
 public static bool IsFolderType(this EBookType bookType)
 {
     return(bookType == EBookType.folder);
 }
示例#6
0
 public static bool IsFileType(this EBookType bookType)
 {
     return(FileTypes.Contains(bookType));
 }
示例#7
0
 public void AddNewBook(EBookType type)
 {
     GetBookRegister(type).AddABook(type);
 }