当前位置: 首页>>代码示例>>C#>>正文


C# Album.getSubAlbum方法代码示例

本文整理汇总了C#中Album.getSubAlbum方法的典型用法代码示例。如果您正苦于以下问题:C# Album.getSubAlbum方法的具体用法?C# Album.getSubAlbum怎么用?C# Album.getSubAlbum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Album的用法示例。


在下文中一共展示了Album.getSubAlbum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: compareFolders

        /// <summary>
        /// Folders Comparison of Comparator
        /// </summary>
        /// <param name="result"></param>
        /// <param name="resultAlbum"></param>
        /// <param name="recursive"></param>
        /// <param name="sourceAlbum"></param>
        /// <param name="targetAlbum"></param>
        private void compareFolders(SyncResult result, Album[] resultAlbum, Stack<CompareStackContent> recursive, Album sourceAlbum, Album targetAlbum)
        {
            try
            {
                /* Get the Necessary Metadata and Folder Info */
                List<string> sourceSubFolders = getSubFoldersFromPath(sourceAlbum.getPath());
                List<string> targetSubFolders = getSubFoldersFromPath(targetAlbum.getPath());
                List<Album> sourceSubAlbums = sourceAlbum.getSubAlbum();
                List<Album> targetSubAlbums = targetAlbum.getSubAlbum();

                /* Merge into a Single List */
                List<string> allSubFolders = mergeLists(sourceAlbum.getPath(), targetAlbum.getPath(),
                                                           sourceSubFolders, targetSubFolders,
                                                           sourceSubAlbums, targetSubAlbums);

                Album newSource, newTarget;

                foreach (string subName in allSubFolders)
                {
                    bool SF = isFileExist(subName, sourceSubFolders);
                    bool TF = isFileExist(subName, targetSubFolders);
                    bool SA = isFileExist(subName, sourceSubAlbums);
                    bool TA = isFileExist(subName, targetSubAlbums);

                    if (SF && SA && TF && TA)           // 1111 = 15
                    {
                        // ALL EXIST: Recursion
                        // Get the New Source and Target Album
                        newSource = getSubAlbum(subName, sourceAlbum);
                        newTarget = getSubAlbum(subName, targetAlbum);

                        // Recursion = Push into Stack
                        CompareStackContent tempStackContent = new CompareStackContent();
                        tempStackContent.source = newSource;
                        tempStackContent.target = newTarget;

                        recursive.Push(tempStackContent);

                        continue;
                    }
                    else if (SF && SA && !TF && TA)     // 1101 = 13
                    {
                        // TARGET DELETED: Delete Source
                        newSource = getSubAlbum(subName, sourceAlbum);
                        targetAlbum.trim(Album.combinePath(targetAlbum.getPath(), subName), Album.TRIM_ALBUM);
                        resultAlbum[SOURCE_DELETE].add(newSource);

                        continue;
                    }
                    else if (SF && !SA && TF && !TA)    // 1010 = 10
                    {
                        // CREATE ALBUM METADATA: Recursion
                        newSource = new Album(Album.combinePath(sourceAlbum.getPath(), subName));
                        newTarget = new Album(Album.combinePath(targetAlbum.getPath(), subName));

                        // ADD TO ALBUM
                        sourceAlbum.add(newSource);
                        targetAlbum.add(newTarget);

                        // Recursion = Push into Stack
                        CompareStackContent tempStackContent = new CompareStackContent();
                        tempStackContent.source = newSource;
                        tempStackContent.target = newTarget;

                        recursive.Push(tempStackContent);

                        continue;
                    }
                    else if (SF && !SA && !TF && !TA)   // 1000 = 8
                    {
                        try
                        {
                            // NEW JOB: Move Source
                            // POPULATE SA
                            populate(sourceAlbum, Album.combinePath(sourceAlbum.getPath(), subName));

                            // COPY ALBUM SA -> TA
                            populate(targetAlbum, Album.combinePath(targetAlbum.getPath(), subName), sourceAlbum);

                            newSource = getSubAlbum(subName, sourceAlbum);
                            resultAlbum[SOURCE_LATEST].add(newSource);
                        }
                        catch (UnauthorizedAccessException uae)
                        {
                            // IGNORE:
                        }
                        continue;
                    }
                    else if (!SF && SA && TF && TA)     // 0111 = 7
                    {
                        // DELETE TF
                        newTarget = getSubAlbum(subName, targetAlbum);
//.........这里部分代码省略.........
开发者ID:emadhura,项目名称:doublesnap,代码行数:101,代码来源:Comparator.cs

示例3: getSubAlbum

 /// <summary>
 /// Private function to get the sub-album from the album with the album name given:
 /// Return the album if the album exist, otherwise, return null.
 /// </summary>
 /// <param name="albumName">Album name to search.</param>
 /// <param name="parentAlbum">Parent Album containing the album name to be searched.</param>
 /// <returns>
 /// Album with the specified album name if it is exist.
 /// NULL otherwise.
 /// </returns>
 private Album getSubAlbum(string albumName, Album parentAlbum)
 {
     List<Album> parentSubAlbums = parentAlbum.getSubAlbum();
     if (parentSubAlbums.Exists(delegate(Album tempAlbum) { return getNameFromPath(tempAlbum.getPath()).ToUpper() == albumName.ToUpper(); }))
     {
         return parentSubAlbums.Find(delegate(Album tempAlbum) { return getNameFromPath(tempAlbum.getPath()).ToUpper() == albumName.ToUpper(); });
     }
     return null;
 }
开发者ID:emadhura,项目名称:doublesnap,代码行数:19,代码来源:Comparator.cs

示例4: 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.getSubAlbum方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。