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


C# Album.trim方法代码示例

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


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

示例1: delete

        /// <summary>
        /// Public Method to Delete the File/Folder:
        /// Delete Both the FileSystem Information and Metadata Information.
        /// </summary>
        /// <param name="path">The Path of the File/Folder in the FileSystem.</param>
        /// <param name="album">The Album Containing the Metadata Information.</param>
        public void delete(string path, Album album)
        {
            // Get the Delete Type:
            int type;
            if (Directory.Exists(path))
                type = Album.TRIM_ALBUM;
            else
                type = Album.TRIM_METADATA;

            // Delete the Path (Can be Either Folder or File)
            delete(path);

            // Trim the Metadata Information
            album.trim(path, type);
        }
开发者ID:emadhura,项目名称:doublesnap,代码行数:21,代码来源:Mover.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: compareFiles


//.........这里部分代码省略.........
                        {
                            // UPDATE S' & UPDATE T'
                            sourceMTDT.update(sourceFile);
                            targetMTDT.update(targetFile);
                            continue;
                        }
                        else                        // 000 = 0
                        {
                            // CONFLICT FILE: Add source file to resultAlbum[SOURCE_CONFLICT]
                            //                Add target file to resultAlbum[TARGET_CONFLICT]
                            resultAlbum[SOURCE_CONFLICT].add(sourceFile);
                            resultAlbum[TARGET_CONFLICT].add(targetFile);
                            continue;
                        }
                    }
                    else if (sOne && sTwo && !tOne && tTwo)     // 1101 = 13
                    {
                        /* Get boolean for sS tT ST */
                        Files sourceMTDT = getPhotoFromFilename(sourceMetadata, filename);

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

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

                        sS = sourceFile.equals(sourceMTDT);

                        if (sS)
                        {
                            // TARGET IS DELETED: Add source file to resultAlbum[SOURCE_DELETE]
                            targetAlbum.trim(Album.combinePath(targetAlbum.getPath(), filename), Album.TRIM_METADATA);
                            resultAlbum[SOURCE_DELETE].add(sourceFile);
                            continue;
                        }
                        else
                        {
                            // SOURCE IS CHANGED: Takes precedence over deletion
                            //                    Add source to resultAlbum[SOURCE_LATEST];
                            resultAlbum[SOURCE_LATEST].add(sourceFile);
                            continue;
                        }
                    }
                    else if (sOne && !sTwo && tOne && !tTwo)    // 1010 = 10
                    {
                        /* Get boolean for ST */
                        // Use Factory Method Pattern
                        //Files sourceFile = new Photo(Album.combinePath(sourceAlbum.getPath(), filename));
                        //Files targetFile = new Photo(Album.combinePath(targetAlbum.getPath(), filename));
                        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;

                        ST = sourceFile.equals(targetFile);

                        /* Inner Check: */
                        if (!ST)    // 0
                        {
                            /* Check for Modification Date and File Size: */
                            checkModificationDate(resultAlbum, sourceFile, targetFile);
                        }
开发者ID:emadhura,项目名称:doublesnap,代码行数:67,代码来源:Comparator.cs


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