Пример #1
0
 /// <summary>
 /// Creates the library file if the library contents isn't empty
 /// </summary>
 public void create()
 {
     contents = LibraryContents.create(library);
     if (!contents.isEmpty()) {
         write();
     }
 }
 /// <summary>
 /// Creates a LibraryContents instance from the given library lib
 /// </summary>
 /// <param name="lib">Library</param>
 /// <returns>LibraryContents instance</returns>
 public static LibraryContents create(Library lib)
 {
     LibraryContents c = new LibraryContents();
     foreach (string s in lib.Folders) {
         c.addSubFolders(s);
     }
     c.sort();
     return c;
 }
Пример #3
0
 public LibraryFile(Library lib, string file)
 {
     library = lib;
     FILE = file;
     contents = new LibraryContents();
 }
Пример #4
0
 /// <summary>
 /// Updates the library file if the library contents has changed
 /// </summary>
 public void update()
 {
     LibraryContents c = LibraryContents.create(library);
     if (!contents.isEqual(c)) {
         contents = c;
         write();
     }
 }
 /// <summary>
 /// Compares the current instance of LibraryContents with the given contents
 /// parameter.
 /// </summary>
 /// <param name="contents">LibraryContents to compare to</param>
 /// <returns>true if the contents are the same, false otherwise</returns>
 public bool isEqual(LibraryContents contents)
 {
     if (contents == null || contents.getLibraryContents() == null) {
         return false;
     }
     List<string> toCompare = contents.getLibraryContents();
     if (folderList.Count != toCompare.Count) {
         return false;
     }
     for (int i = 0; i < folderList.Count; i++) {
         if(!folderList[i].Equals(toCompare[i])) {
             return false;
         }
     }
     return true;
 }