Ejemplo n.º 1
0
 /// <summary>
 /// Saves all organization data into XML.
 /// </summary>
 public static void Save()
 {
     if (Shows.LoadCompleted)
     {
         Shows.Save();
     }
     if (Movies.LoadCompleted)
     {
         Movies.Save();
     }
     //SaveLog();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Search through all sub-folders and attempt to assign each one to content.
        /// </summary>
        /// <param name="fastUpdate">Whether update is fast, skips detailed updating(e.g. episodes for shows)</param>
        /// <param name="idsToUpdate">List of dtabase IDs that need updating</param>
        /// <param name="cancel">Cancelation flag</param>
        /// <param name="serverTime">Time on online database server</param>
        /// <returns>Whether update was completed without cancelation</returns>
        public bool UpdateContent(bool fastUpdate, ref bool cancel)
        {
            updateCancelled = false;

            // Update progress
            string progressMsg = "Update of '" + this.FullPath + "' started - Building threads";

            OnUpdateProgressChange(this, false, 0, progressMsg);

            // Initialize processing - First pass
            OrgProcessing firstPass = new OrgProcessing(UpdateProcess);

            updateNumber = firstPass.ProcessNumber;

            // Run 1st pass (build of sub-dirs is recursive, so all child root folder sub-dirs will be included)
            firstPass.Run(BuildSubDirectories(this.ContentType), ref cancel, true, Settings.General.NumProcessingThreads);
            updateCancelled = cancel;

            // Initialize processing - Second pass
            OrgProcessing secondPass = new OrgProcessing(UpdateProcess);

            updateNumber = secondPass.ProcessNumber;

            // Run 2nd pass (build of sub-dirs is recursive, so all child root folder sub-dirs will be included)
            secondPass.Run(BuildSubDirectories(this.ContentType), ref cancel, false, Settings.General.NumProcessingThreads);
            updateCancelled = cancel;

            // Get content collection to add content to
            ContentCollection content = GetContentCollection();

            // Remove shows that no longer exists
            if (!cancel)
            {
                content.RemoveMissing();
            }

            // Save changes
            //content.Sort();
            content.Save();

            // Set progress to completed
            progressMsg = "Update of '" + this.FullPath + "' complete!";
            OnUpdateProgressChange(this, false, 100, progressMsg);
            OnUpdateProgressComplete(this);

            // Return whether update was completed without cancelation
            return(!cancel);
        }