當前位置: 首頁>>代碼示例>>C#>>正文


C# Album.getMetadata方法代碼示例

本文整理匯總了C#中Album.getMetadata方法的典型用法代碼示例。如果您正苦於以下問題:C# Album.getMetadata方法的具體用法?C# Album.getMetadata怎麽用?C# Album.getMetadata使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Album的用法示例。


在下文中一共展示了Album.getMetadata方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: compareFiles

        /// <summary>
        /// Files Comparison of Comparator
        /// </summary>
        /// <param name="result">SyncResult Object to catch Exception Thrown</param>
        /// <param name="resultAlbum">Result Album to Store Result</param>
        /// <param name="sourceAlbum">Source Album being Compared</param>
        /// <param name="targetAlbum">Target Album being Compared</param>
        private void compareFiles(SyncResult result, Album[] resultAlbum, Album sourceAlbum, Album targetAlbum)
        {
            try
            {
                /* Get the necessary Metadatas and Files (in string) */
                List<Files> sourceMetadata = sourceAlbum.getMetadata();               // S'
                List<Files> targetMetadata = targetAlbum.getMetadata();               // T'
                List<string> sourceFiles = getFilesFromPath(sourceAlbum.getPath()); // S
                List<string> targetFiles = getFilesFromPath(targetAlbum.getPath()); // T

                /* Merge the Lists into a single List containing all filename (in string) */
                List<string> listUnion = mergeLists(sourceAlbum.getPath(), targetAlbum.getPath(),
                                                    sourceFiles, targetFiles, sourceMetadata, targetMetadata);

                /* Boolean values for Comparison Logic: */
                bool sOne;  // File exist in S
                bool tOne;  // File exist in T
                bool sTwo;  // File exist in S'
                bool tTwo;  // File exist in T'
                bool sS;    // S.File == S'.File
                bool tT;    // T.File == T'.File
                bool ST;    // S.File == T.File

                /* Comparison Logic: */
                foreach (string filenames in listUnion)
                {
                    String filename = filenames;

                    //Console.WriteLine("file: " + filename);

                    if (filename.Contains(PATH_DELIMITER))
                    {
                        filename = filename.Replace(PATH_DELIMITER, "");
                    }
                    /* Get the boolean values for the first 4 variables: */
                    sOne = isFileExist(Album.combinePath(sourceAlbum.getPath(), filename), sourceFiles);    // Source FileSystem (S) Exist
                    tOne = isFileExist(Album.combinePath(targetAlbum.getPath(), filename), targetFiles);    // Target FileSystem (T) Exist
                    sTwo = isFileExist(Album.combinePath(sourceAlbum.getPath(), filename), sourceMetadata); // Source Metadata (S') Exist
                    tTwo = isFileExist(Album.combinePath(targetAlbum.getPath(), filename), targetMetadata); // Target Metadata (T') Exist

                    /* Envelope Check: */
                    // To Check: Use Binary of the form sOne sTwo tOne tTwo
                    //     e.g.: if true true false true -> 1101 = 13
                    if (sOne && sTwo && tOne && tTwo)           // 1111 = 15
                    {
                        /* Get boolean for sS tT ST */
                        Files sourceMTDT = getPhotoFromFilename(sourceMetadata, filename);
                        Files targetMTDT = getPhotoFromFilename(targetMetadata, filename);

                        // Use Factory Method Pattern
                        Files sourceFile = Files.getFilesObject(Album.combinePath(sourceAlbum.getPath(), filename));
                        Files targetFile = Files.getFilesObject(Album.combinePath(targetAlbum.getPath(), filename));

                        // Check Files Read and Write Access
                        if (sourceFile == null || targetFile == null)
                            continue;

                        sS = sourceFile.equals(sourceMTDT);
                        tT = targetFile.equals(targetMTDT);
                        ST = sourceFile.equals(targetFile);

                        /* Inner Check: */
                        if (sS && tT && ST)         // 111 = 7
                        {
                            // EQUAL: Ignore
                            continue;
                        }
                        else if (sS && tT && !ST)   // 110 = 6
                        {
                            /* Check for Modification Date and File Size */
                            checkModificationDate(resultAlbum, sourceFile, targetFile);
                            continue;
                        }
                        else if (sS && !tT && ST)   // 101 = 5
                        {
                            // UPDATE T'
                            targetMTDT.update(targetFile);
                            continue;
                        }
                        else if (sS && !tT && !ST)  // 100 = 4
                        {
                            // TARGET IS NEWER: Add target file to resultAlbum[TARGET_LATEST]
                            resultAlbum[TARGET_LATEST].add(targetFile);
                            continue;
                        }
                        else if (!sS && tT && ST)   // 011 = 3
                        {
                            // UPDATE S'
                            sourceMTDT.update(sourceFile);
                            continue;
                        }
                        else if (!sS && tT && !ST)  // 010 = 2
                        {
//.........這裏部分代碼省略.........
開發者ID:emadhura,項目名稱:doublesnap,代碼行數:101,代碼來源:Comparator.cs

示例2: backupMove

        /// <summary>
        /// Runs the backup job.
        /// </summary>
        /// <param name="source">Album retreived from backup()</param>
        public void backupMove(Album source)
        {
            string srcPath, trgPath;

            #region Backing up from Source to Target
            // Back up folders.
            foreach (Album temp in source.getSubAlbum())
            {
                srcPath = temp.getPath();
                trgPath = srcPath.Replace(job.getSource().getPath(), job.getTarget().getPath());
                mover.move(srcPath, trgPath, Mover.MOVE_BACK_UP);
            }
            // Back up files.
            foreach (Files temp in source.getMetadata())
            {
                srcPath = temp.getFullpath();
                trgPath = srcPath.Replace(job.getSource().getPath(), job.getTarget().getPath());
                mover.move(srcPath, trgPath, Mover.MOVE_BACK_UP);
            }
            #endregion

            if (mover.getMoverError())
                MessageBox.Show("Some file are unable to move. Check the log file for details.", "Error on Moving");

            // Resets the mover and logs the completion.
            mover.resetMover();
            mover.getLogger().logJobEnded(job.getJobName());

            // Saves the meta data and job name list
            saveJobList();
            saveJobNameList();
        }
開發者ID:emadhura,項目名稱:doublesnap,代碼行數:36,代碼來源:Controller.cs

示例3: append

        private Album append(Album original, Album appendix)
        {
            Album appended = new Album(DIFF_ALBUM_NAME, "");

            /* Get Files: */
            foreach (Files metadata in original.getMetadata())
            {
                appended.add(metadata);
            }
            foreach (Files metadata in appendix.getMetadata())
            {
                appended.add(metadata);
            }

            /* Get Sub Folders: */
            foreach (Album subAlbum in original.getSubAlbum())
            {
                appended.add(subAlbum);
            }
            foreach (Album subAlbum in appendix.getSubAlbum())
            {
                appended.add(subAlbum);
            }

            return appended;
        }
開發者ID:emadhura,項目名稱:doublesnap,代碼行數:26,代碼來源:Comparator.cs


注:本文中的Album.getMetadata方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。