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


C# IFolder.GetChildren方法代码示例

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


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

示例1: FolderTree

        public FolderTree(IFolder folder, string name = null) {
            this.Name = name ?? folder.Name;
            this.IsFile = false;
            this.RemoteId = folder.Id;
            foreach (var child in folder.GetChildren()) {
                if (child is IFolder) {
                    this.children.Add(new FolderTree(child as IFolder));
                } else if (child is IDocument) {
                    this.children.Add(new FolderTree(child as IDocument));
                }
            }

            this.children.Sort((FolderTree x, FolderTree y) => x.Name.CompareTo(y.Name));
        }
开发者ID:OpenDataSpace,项目名称:CmisSync,代码行数:14,代码来源:FolderTree.cs

示例2: Upload

        private IDocument Upload(IFolder uploadFolder, MakuraDocument document)
        {
            var cmisDocumentStream = document.ContentStream.ConvertCmis();
            var existDoc = uploadFolder.GetChildren().OfType<IDocument>().FirstOrDefault(p => p.Name == document.Name);

            if (existDoc == null) {
                var properties = new Dictionary<string, object>();
                properties[PropertyIds.Name] = document.Name;
                properties[PropertyIds.ObjectTypeId] = "cmis:document";

                return uploadFolder.CreateDocument(properties, cmisDocumentStream, DotCMIS.Enums.VersioningState.Minor);
            } else {
                existDoc.SetContentStream(cmisDocumentStream,true);
                return existDoc;
            }
        }
开发者ID:sixpetals,项目名称:CmisActionAgent,代码行数:16,代码来源:CmisUploadAction.cs

示例3: AddTreeNode

        private void AddTreeNode(IFolder rootFolder, TreeNode node)
            {
            foreach (ICmisObject cmisObject in rootFolder.GetChildren())
                {

                try
                    {
                    IFolder folder = cmisObject as IFolder;
                    if (folder != null)
                        {
                        TreeNode currentNode = node.Nodes.Add(cmisObject.Id, cmisObject.Name);
                        Application.DoEvents();
                        AddTreeNode(folder, currentNode);
                        }


                    }
                catch (Exception ex)
                    {

                    }
                }
            }
开发者ID:muralidharand,项目名称:AlfrescoDotCMISExamples,代码行数:23,代码来源:AlfrescoTreeViewer.cs

示例4: UpdateFile

            /// <summary>
            /// Upload new version of file content.
            /// </summary>
            private bool UpdateFile(string filePath, IFolder remoteFolder)
            {
                SleepWhileSuspended();
                try
                {
                    // Find the document within the folder.
                    var syncItem = database.GetSyncItemFromLocalPath(filePath);
                    if (null == syncItem)
                    {
                        syncItem = SyncItemFactory.CreateFromLocalPath(filePath, repoinfo);
                    }
                    string fileName = syncItem.RemoteFileName;
                    IDocument document = null;
                    bool found = false;
                    foreach (ICmisObject obj in remoteFolder.GetChildren())
                    {
                        if (null != (document = obj as IDocument))
                        {
                            if (document.Name == fileName)
                            {
                                found = true;
                                break;
                            }
                        }
                    }

                    // If not found, it means the document has been deleted.
                    if (!found)
                    {
                        Logger.Info(syncItem.LocalPath + " not found on server, must be uploaded instead of updated");
                        return UploadFile(syncItem.LocalPath, remoteFolder);
                    }

                    // Update the document itself.
                    return UpdateFile(syncItem.LocalPath, document);
                }
                catch (CmisBaseException e)
                {
                    ProcessRecoverableException("Could not update file: " + filePath, e);
                    return false;
                }
            }
开发者ID:jelacote,项目名称:CmisSync,代码行数:45,代码来源:SynchronizedFolder.cs

示例5: CrawlRemote

            /// <summary>
            /// Crawl remote content, syncing down if needed.
            /// Meanwhile, cache remoteFiles and remoteFolders, they are output parameters that are used in CrawlLocalFiles/CrawlLocalFolders
            /// </summary>
            private bool CrawlRemote(IFolder remoteFolder, string localFolder, IList remoteFiles, IList remoteFolders)
            {
                bool success = true;

                foreach (ICmisObject cmisObject in remoteFolder.GetChildren())
                {
                    sleepWhileSuspended();

                    #region Cmis Folder
                    if (cmisObject is DotCMIS.Client.Impl.Folder)
                    {
                        // It is a CMIS folder.
                        IFolder remoteSubFolder = (IFolder)cmisObject;
                        if (Utils.WorthSyncing(remoteSubFolder.Name) && !repoinfo.isPathIgnored(remoteSubFolder.Path))
                        {
                            //Logger.Debug("CrawlRemote dir: " + localFolder + Path.DirectorySeparatorChar.ToString() + remoteSubFolder.Name);
                            remoteFolders.Add(remoteSubFolder.Name);
                            string localSubFolder = localFolder + Path.DirectorySeparatorChar.ToString() + remoteSubFolder.Name;

                            // Check whether local folder exists.
                            if (Directory.Exists(localSubFolder))
                            {
                                // Recurse into folder.
                                success = success && CrawlSync(remoteSubFolder, localSubFolder);
                            }
                            else
                            {
                                // If there was previously a file with this name, delete it.
                                // TODO warn if local changes in the file.
                                if (File.Exists(localSubFolder))
                                {
                                    File.Delete(localSubFolder);
                                }

                                if (database.ContainsFolder(localSubFolder))
                                {
                                    // If there was previously a folder with this name, it means that
                                    // the user has deleted it voluntarily, so delete it from server too.

                                    // Delete the folder from the remote server.
                                    remoteSubFolder.DeleteTree(true, null, true);

                                    // Delete the folder from database.
                                    database.RemoveFolder(localSubFolder);
                                }
                                else
                                {
                                    // The folder has been recently created on server, so download it.

                                    // Skip if invalid folder name. See https://github.com/nicolas-raoul/CmisSync/issues/196
                                    if (Utils.IsInvalidFileName(remoteSubFolder.Name))
                                    {
                                        Logger.Info("Skipping download of folder with illegal name: " + remoteSubFolder.Name);
                                    }
                                    else if (repoinfo.isPathIgnored(remoteSubFolder.Path))
                                    {
                                        Logger.Info("Skipping dowload of ignored folder: " + remoteSubFolder.Name);
                                    }
                                    else
                                    {
                                        // Create local folder.remoteDocument.Name
                                        Directory.CreateDirectory(localSubFolder);

                                        // Create database entry for this folder.
                                        // TODO - Yannick - Add metadata
                                        database.AddFolder(localSubFolder, remoteFolder.LastModificationDate);

                                        // Recursive copy of the whole folder.
                                        success = success && RecursiveFolderCopy(remoteSubFolder, localSubFolder);
                                    }
                                }
                            }
                        }
                    }
                    #endregion

                    #region Cmis Document
                    else
                    {
                        // It is a CMIS document.
                        IDocument remoteDocument = (IDocument)cmisObject;

                        if (Utils.WorthSyncing(remoteDocument.Name))
                        {
                            // We use the filename of the document's content stream.
                            // This can be different from the name of the document.
                            // For instance in FileNet it is not usual to have a document where
                            // document.Name is "foo" and document.ContentStreamFileName is "foo.jpg".
                            string remoteDocumentFileName = remoteDocument.ContentStreamFileName;
                            //Logger.Debug("CrawlRemote doc: " + localFolder + Path.DirectorySeparatorChar.ToString() + remoteDocumentFileName);

                            // Check if file extension is allowed

                            remoteFiles.Add(remoteDocumentFileName);
                            // If this file does not have a filename, ignore it.
                            // It sometimes happen on IBM P8 CMIS server, not sure why.
//.........这里部分代码省略.........
开发者ID:prignony,项目名称:CmisSync,代码行数:101,代码来源:CrawlStrategy.cs

示例6: UploadFolderRecursively

            /// <summary>
            /// Upload folder recursively.
            /// After execution, the hierarchy on server will be: .../remoteBaseFolder/localFolder/...
            /// </summary>
            private bool UploadFolderRecursively(IFolder remoteBaseFolder, string localFolder)
            {
                bool success = true;
                SleepWhileSuspended();

                IFolder folder = null;
                try
                {
                    var syncItem = database.GetFolderSyncItemFromLocalPath(localFolder);
                    if (null == syncItem)
                    {
                        syncItem = SyncItemFactory.CreateFromLocalPath(localFolder, repoinfo);
                    }
                    // Create remote folder.
                    Dictionary<string, object> properties = new Dictionary<string, object>();
                    properties.Add(PropertyIds.Name, syncItem.RemoteFileName);
                    properties.Add(PropertyIds.ObjectTypeId, "cmis:folder");
                    properties.Add(PropertyIds.CreationDate, Directory.GetCreationTime(localFolder));
                    properties.Add(PropertyIds.LastModificationDate, Directory.GetLastWriteTime(localFolder));
                    try
                    {
                        Logger.Debug(String.Format("Creating remote folder {0} for local folder {1}", syncItem.RemoteFileName, localFolder));
                        folder = remoteBaseFolder.CreateFolder(properties);
                        Logger.Debug(String.Format("Created remote folder {0}({1}) for local folder {2}", syncItem.RemoteFileName, folder.Id ,localFolder));
                    }
                    catch (CmisNameConstraintViolationException)
                    {
                        foreach (ICmisObject cmisObject in remoteBaseFolder.GetChildren())
                        {
                            if (cmisObject.Name == syncItem.RemoteFileName)
                            {
                                folder = cmisObject as IFolder;
                            }
                        }
                        if (folder == null)
                        {
                            Logger.Warn("Remote file conflict with local folder " + syncItem.LocalFileName);
                            // TODO Show error message
                            return false;
                        }
                        success = false;
                    }
                    catch (Exception e)
                    {
                        ProcessRecoverableException(String.Format("Exception when create remote folder for local folder {0}: {1}", localFolder, e.Message), e);
                        return false;
                    }


                    // Create database entry for this folder
                    // TODO Add metadata
                    database.AddFolder(syncItem, folder.Id, folder.LastModificationDate);
                    Logger.Info("Added folder to database: " + localFolder);
                }
                catch (CmisBaseException e)
                {
                    ProcessRecoverableException("Could not create remote directory: " + remoteBaseFolder.Path + "/" + Path.GetFileName(localFolder), e);
                    return false;
                }

                try
                {
                    // Upload each file in this folder.
                    foreach (string file in Directory.GetFiles(localFolder))
                    {
                        if (Utils.WorthSyncing(localFolder, Path.GetFileName(file), repoinfo))
                        {
                            success &= UploadFile(file, folder);
                        }
                    }

                    // Recurse for each subfolder in this folder.
                    foreach (string subfolder in Directory.GetDirectories(localFolder))
                    {
                        if (Utils.WorthSyncing(localFolder, Path.GetFileName(subfolder), repoinfo))
                        {
                            success &= UploadFolderRecursively(folder, subfolder);
                        }
                    }
                }
                catch (Exception e)
                {
                    ProcessRecoverableException("Could not uploading folder: " + localFolder, e);
                    return false;
                }
                return success;
            }
开发者ID:jelacote,项目名称:CmisSync,代码行数:91,代码来源:SynchronizedFolder.cs

示例7: RecursiveFolderCopy

            /// <summary>
            /// Download all content from a CMIS folder.
            /// </summary>
            /// <param name="remoteFolder">The new folder to download. Example: /sites/project/newfolder</param>
            /// <param name="remotePath">The new folder to download. Example: /sites/project/newfolder</param>
            /// <param name="localFolder">The new folder that will be filled by this operation. Warning: It must exist already! Example: C:\CmisSync\project\newfolder</param> TODO: Create the local folder in this method.
            private void RecursiveFolderCopy(IFolder remoteFolder, string remotePath, string localFolder)
            {
                SleepWhileSuspended();

                IItemEnumerable<ICmisObject> children;
                try
                {
                    children = remoteFolder.GetChildren();
                }
                catch (CmisBaseException e)
                {
                    ProcessRecoverableException("Could not get children objects: " + remoteFolder.Path, e);
                    return;
                }

                // List all children.
                foreach (ICmisObject cmisObject in children)
                {
                    string remoteSubPath = remotePath + CmisUtils.CMIS_FILE_SEPARATOR + cmisObject.Name;
                    if (cmisObject is DotCMIS.Client.Impl.Folder)
                    {
                        // Case of a folder: Download recursively.

                        IFolder remoteSubFolder = (IFolder)cmisObject;
                        var localSubFolderItem = database.GetFolderSyncItemFromRemotePath(remoteSubFolder.Path);

                        if (null == localSubFolderItem)
                        {
                            localSubFolderItem = SyncItemFactory.CreateFromRemoteFolder(remoteSubFolder.Path, repoInfo, database);
                        }

                        if (Utils.WorthSyncing(localFolder, PathRepresentationConverter.RemoteToLocal(remoteSubFolder.Name), repoInfo))
                        {
                            DownloadDirectory(remoteSubFolder, remoteSubPath, localSubFolderItem.LocalPath);
                        }
                    }
                    else if (cmisObject is DotCMIS.Client.Impl.Document)
                    {
                        // Case of a document: Download it.

                        Document document = (Document)cmisObject;
                        if (Utils.WorthSyncing(localFolder, repoInfo.CmisProfile.localFilename(document), repoInfo))
                        {
                            DownloadFile(document, remoteSubPath, localFolder);
                        }
                    }
                    else
                    {
                        Logger.Debug("Unknown object type: " + cmisObject.ObjectType.DisplayName
                            + " for object " + remoteFolder + "/" + cmisObject.Name);
                    }
                }
            }
开发者ID:aegif,项目名称:ASaasDriveClient,代码行数:59,代码来源:SynchronizedFolder.cs

示例8: CrawlRemote

 /// <summary>
 /// Crawl remote content, syncing down if needed.
 /// Meanwhile, cache remoteFiles and remoteFolders, they are output parameters that are used in CrawlLocalFiles/CrawlLocalFolders
 /// </summary>
 private void CrawlRemote(IFolder remoteFolder, string localFolder, IList remoteFiles, IList remoteFolders)
 {
     sleepWhileSuspended();
     
     foreach (ICmisObject cmisObject in remoteFolder.GetChildren())
     {
         if (cmisObject is DotCMIS.Client.Impl.Folder)
         {
             // It is a CMIS folder.
             IFolder remoteSubFolder = (IFolder)cmisObject;
             CrawlRemoteFolder(remoteSubFolder, localFolder, remoteFolders);
         }
         else if (cmisObject is DotCMIS.Client.Impl.Document)
         {
             // It is a CMIS document.
             IDocument remoteDocument = (IDocument)cmisObject;
             CrawlRemoteDocument(remoteDocument, localFolder, remoteFiles);
         }
         else
         {
             Logger.Warn("Unknown object type: " + cmisObject.ObjectType.DisplayName);
         }
     }
 }
开发者ID:keithwharrison,项目名称:Oris4Sync,代码行数:28,代码来源:CrawlStrategy.cs

示例9: RecursiveFolderCopy

        /**
         * Download all content from a CMIS folder.
         */
        private void RecursiveFolderCopy(IFolder remoteFolder, string localFolder)
        {
            activityListener.ActivityStarted();
            // List all children.
            foreach (ICmisObject cmisObject in remoteFolder.GetChildren())
            {
                if (cmisObject is DotCMIS.Client.Impl.Folder)
                {
                    IFolder remoteSubFolder = (IFolder)cmisObject;
                    string localSubFolder = localFolder + Path.DirectorySeparatorChar + cmisObject.Name;

                    // Create local folder.
                    Directory.CreateDirectory(localSubFolder);

                    // Create database entry for this folder.
                    database.AddFolder(localSubFolder, remoteFolder.LastModificationDate);

                    // Recurse into folder.
                    RecursiveFolderCopy(remoteSubFolder, localSubFolder);
                }
                else
                {
                    // It is a file, just download it.
                    DownloadFile((IDocument)cmisObject, localFolder);
                }
            }
            activityListener.ActivityStopped();
        }
开发者ID:smcardle,项目名称:CmisSync,代码行数:31,代码来源:CmisDirectory.cs

示例10: RecursiveFolderCopy

            /// <summary>
            /// Download all content from a CMIS folder.
            /// </summary>
            private bool RecursiveFolderCopy(IFolder remoteFolder, string localFolder)
            {
                activityListener.ActivityStarted();

                bool success = true;
                // List all children.
                foreach (ICmisObject cmisObject in remoteFolder.GetChildren())
                {
                    if (cmisObject is DotCMIS.Client.Impl.Folder)
                    {
                        IFolder remoteSubFolder = (IFolder)cmisObject;
                        string localSubFolder = localFolder + Path.DirectorySeparatorChar.ToString() + cmisObject.Name;
                        if (Utils.WorthSyncing(localSubFolder) && !repoinfo.isPathIgnored(remoteSubFolder.Path))
                        {
                            // Create local folder.
                            Directory.CreateDirectory(localSubFolder);

                            // Create database entry for this folder
                            // TODO Add metadata
                            database.AddFolder(localSubFolder, remoteFolder.LastModificationDate);

                            // Recurse into folder.
                            success = success && RecursiveFolderCopy(remoteSubFolder, localSubFolder);
                        }
                    }
                    else
                    {
                        if (Utils.WorthSyncing(cmisObject.Name))
                            // It is a file, just download it.
                            success = success && DownloadFile((IDocument)cmisObject, localFolder);
                    }
                }

                activityListener.ActivityStopped();

                return success;
            }
开发者ID:prignony,项目名称:CmisSync,代码行数:40,代码来源:SynchronizedFolder.cs

示例11: RecursiveFolderCopy

            /// <summary>
            /// Download all content from a CMIS folder.
            /// </summary>
            private void RecursiveFolderCopy(IFolder remoteFolder, string localFolder)
            {
                SleepWhileSuspended();

                IItemEnumerable<ICmisObject> children;
                try
                {
                    children = remoteFolder.GetChildren();
                }
                catch (CmisBaseException e)
                {
                    ProcessRecoverableException("Could not get children objects: " + remoteFolder.Path, e);
                    return;
                }

                // List all children.
                foreach (ICmisObject cmisObject in children)
                {
                    if (cmisObject is DotCMIS.Client.Impl.Folder)
                    {
                        IFolder remoteSubFolder = (IFolder)cmisObject;
                        // string localSubFolder = Path.Combine(localFolder, PathRepresentationConverter.RemoteToLocal(cmisObject.Name));

                        var localSubFolderItem = database.GetFolderSyncItemFromRemotePath(remoteSubFolder.Path);
                        if (null == localSubFolderItem)
                        {
                            localSubFolderItem = SyncItemFactory.CreateFromRemotePath(remoteSubFolder.Path, repoinfo);
                        }

                        if (Utils.WorthSyncing(localFolder, PathRepresentationConverter.RemoteToLocal(remoteSubFolder.Name), repoinfo))
                        {
                            DownloadDirectory(remoteSubFolder, localSubFolderItem.LocalPath);
                        }
                    }
                    else if (cmisObject is DotCMIS.Client.Impl.Document)
                    {
                        if (Utils.WorthSyncing(localFolder, cmisObject.Name, repoinfo))
                        {
                            // It is a file, just download it.
                            DownloadFile((IDocument)cmisObject, localFolder);
                        }
                    }
                    else
                    {
                        Logger.Debug("Unknown object type: " + cmisObject.ObjectType.DisplayName
                            + " for object " + remoteFolder + "/" + cmisObject.Name);
                    }
                }
            }
开发者ID:jelacote,项目名称:CmisSync,代码行数:52,代码来源:SynchronizedFolder.cs

示例12: CrawlRemote

            /// <summary>
            /// Crawl remote content, syncing down if needed.
            /// Meanwhile, cache remoteFiles and remoteFolders, they are output parameters that are used in CrawlLocalFiles/CrawlLocalFolders
            /// </summary>
            private bool CrawlRemote(IFolder remoteFolder, string localFolder, IList<string> remoteFiles, IList<string> remoteFolders)
            {
                bool success = true;
                SleepWhileSuspended();

                // Get all remote children.
                // TODO: use paging
                IOperationContext operationContext = session.CreateOperationContext();
                operationContext.MaxItemsPerPage = Int32.MaxValue;
                foreach (ICmisObject cmisObject in remoteFolder.GetChildren(operationContext))
                {
                    try
                    {
                        if (cmisObject is DotCMIS.Client.Impl.Folder)
                        {
                            // It is a CMIS folder.
                            IFolder remoteSubFolder = (IFolder)cmisObject;
                            CrawlRemoteFolder(remoteSubFolder, localFolder, remoteFolders);
                        }
                        else if (cmisObject is DotCMIS.Client.Impl.Document)
                        {
                            // It is a CMIS document.
                            IDocument remoteDocument = (IDocument)cmisObject;
                            CrawlRemoteDocument(remoteDocument, localFolder, remoteFiles);
                        }
                        else if (isLink(cmisObject))
                        {
                            Logger.Debug("Ignoring file '" + remoteFolder + "/" + cmisObject.Name + "' of type '" +
                                cmisObject.ObjectType.Description + "'. Links are not currently handled.");
                        }
                        else
                        {
                            Logger.Warn("Unknown object type: '" + cmisObject.ObjectType.Description + "' (" + cmisObject.ObjectType.DisplayName
                                + ") for object " + remoteFolder + "/" + cmisObject.Name);
                        }
                    }
                    catch (CmisBaseException e)
                    {
                        ProcessRecoverableException("Could not access remote object: " + cmisObject.Name, e);
                        success = false;
                    }
                }
                return success;
            }
开发者ID:jelacote,项目名称:CmisSync,代码行数:48,代码来源:CrawlStrategy.cs

示例13: RecursiveFolderCopy

        private void RecursiveFolderCopy(IFolder remoteFolder, string localFolder)
        {
            String id = new Random().Next(0, 1000000).ToString();
            // List all children.
            foreach (ICmisObject cmisObject in remoteFolder.GetChildren())
            {
                if (cmisObject is DotCMIS.Client.Impl.Folder)
                {
                    IFolder remoteSubFolder = (IFolder)cmisObject;
                    string localSubFolder = localFolder + Path.DirectorySeparatorChar + cmisObject.Name;

                    // Create local folder.
                    Directory.CreateDirectory(localSubFolder);

                    // Recurse into folder.
                    RecursiveFolderCopy(remoteSubFolder, localSubFolder);
                }
                else
                {
                    // It is a file, just download it.
                    DownloadFile((IDocument)cmisObject, localFolder);
                }
            }
        }
开发者ID:vfh,项目名称:CmisSync,代码行数:24,代码来源:Cmis.cs

示例14: CrawlSync

        private void CrawlSync(IFolder remoteFolder, string localFolder)
        {
            //String id = new Random().Next(0, 1000000).ToString();

            // Sync down.

            // Lists of files/folders, to delete those that have been removed on the server.
            IList remoteFiles = new ArrayList();
            IList remoteFolders = new ArrayList();

            // List all children.
            foreach (ICmisObject cmisObject in remoteFolder.GetChildren())
            {
                if (cmisObject is DotCMIS.Client.Impl.Folder)
                {
                    IFolder remoteSubFolder = (IFolder)cmisObject;
                    remoteFolders.Add(remoteSubFolder.Name);
                    string localSubFolder = localFolder + Path.DirectorySeparatorChar + remoteSubFolder.Name;

                    // Check whether local folder exists.
                    if (Directory.Exists(localSubFolder))
                    {
                        // Recurse into folder.
                        CrawlSync(remoteSubFolder, localSubFolder);
                    }
                    else
                    {
                        // If there was previously a file with this name, delete it.
                        // TODO warn if local changes in the file.
                        if (File.Exists(localSubFolder))
                        {
                            File.Delete(localSubFolder);
                        }

                        // Create local folder.
                        Directory.CreateDirectory(localSubFolder);

                        // Recursive copy of the whole folder.
                        RecursiveFolderCopy(remoteSubFolder, localSubFolder);
                    }
                }
                else
                {
                    // It is a file, check whether it exists and has the same modifica download it.
                    IDocument remoteDocument = (IDocument)cmisObject;
                    remoteFiles.Add(remoteDocument.Name);

                    string remoteDocumentFileName = remoteDocument.ContentStreamFileName;
                    // If this file does not have a filename, ignore it.
                    // It sometimes happen on IBM P8 CMIS server, not sure why.
                    if (remoteDocumentFileName == null)
                    {
                        SparkleLogger.LogInfo("Sync", "Skipping download of file with null content stream in " + localFolder);
                        continue;
                    }

                    string filePath = localFolder + Path.DirectorySeparatorChar + remoteDocumentFileName;

                    if (File.Exists(filePath))
                    {
                        // Check modification date stored in database and download if remote modification date if different.
                        DateTime? serverSideModificationDate = remoteDocument.LastModificationDate;
                        try
                        {
                            SQLiteCommand command = new SQLiteCommand(sqliteConnection);
                            command.CommandText =
                                "SELECT serverSideModificationDate FROM files WHERE [email protected]";
                            command.Parameters.AddWithValue("filePath", filePath);
                            object obj = command.ExecuteScalar();
                            DateTime clientSideModificationDate = (DateTime)obj;
                            if (clientSideModificationDate == null)
                            {
                                SparkleLogger.LogInfo("Sync", "Downloading file absent from database: " + remoteDocumentFileName);
                                DownloadFile(remoteDocument, localFolder);
                            }
                            else
                            {
                                // If the file has been modified since last time we downloaded it, then download again.
                                if (serverSideModificationDate > clientSideModificationDate)
                                {
                                    SparkleLogger.LogInfo("Sync", "Downloading modified file: " + remoteDocumentFileName);
                                    DownloadFile(remoteDocument, localFolder);
                                }
                            }
                        }
                        catch (SQLiteException e)
                        {
                            SparkleLogger.LogInfo("Sync", e.Message);
                        }
                    }
                    else
                    {
                        SparkleLogger.LogInfo("Sync", "Downloading new file: " + remoteDocumentFileName);
                        DownloadFile(remoteDocument, localFolder);
                    }
                }
            }

            // Delete folders that have been removed on the server.
            //foreach (string dirPath in Directory.GetDirectories(localFolder, "*", SearchOption.AllDirectories))
//.........这里部分代码省略.........
开发者ID:vfh,项目名称:CmisSync,代码行数:101,代码来源:Cmis.cs

示例15: CrawlRemote

            /// <summary>
            /// Crawl remote content, syncing down if needed.
            /// Meanwhile, cache remoteFiles and remoteFolders, they are output parameters that are used in CrawlLocalFiles/CrawlLocalFolders
            /// </summary>
            private bool CrawlRemote(IFolder remoteFolder, string remotePath, string localFolder, IList<string> remoteFiles, IList<string> remoteFolders)
            {
                bool success = true;
                SleepWhileSuspended();

                // Remember seen names, and depending on the profile ignore the ones that have appeared already.
                // For instance, if the CMIS server has a file called Hello and a folder called HELLO, then on Windows the paths would conflict.
                // Store lowercase file and folder names inside.
                HashSet<string> names = new HashSet<string>();

                // Get all remote children.
                // TODO: use paging
                IOperationContext operationContext = session.CreateOperationContext();
                this.repoInfo.CmisProfile.ConfigureOperationContext(operationContext);
                operationContext.MaxItemsPerPage = Int32.MaxValue;
                foreach (ICmisObject cmisObject in remoteFolder.GetChildren(operationContext))
                {
                    try
                    {
                        if (cmisObject is DotCMIS.Client.Impl.Folder)
                        {
                            // It is a CMIS folder.
                            IFolder remoteSubFolder = (IFolder)cmisObject;
                            string remoteSubPath = CmisUtils.PathCombine(remotePath, remoteSubFolder.Name);
                            if (repoInfo.CmisProfile.IgnoreIfSameLowercaseNames && names.Contains(remoteSubFolder.Name.ToLowerInvariant()))
                            {
                                Logger.Warn("Ignoring " + remoteSubFolder.Name + "because other file or folder has the same name when ignoring lowercase/uppercase");
                            }
                            else
                            {
                                CrawlRemoteFolder(remoteSubFolder, remoteSubPath, localFolder, remoteFolders);
                                names.Add(remoteSubFolder.Name.ToLowerInvariant());
                            }
                        }
                        else if (cmisObject is DotCMIS.Client.Impl.Document)
                        {
                            // It is a CMIS document.
                            IDocument remoteDocument = (IDocument)cmisObject;
                            string remoteDocumentPath = CmisUtils.PathCombine(remotePath, remoteDocument.Name);
                            if (repoInfo.CmisProfile.IgnoreIfSameLowercaseNames && names.Contains(remoteDocument.Name.ToLowerInvariant()))
                            {
                                Logger.Warn("Ignoring " + remoteDocument.Name + "because other file or folder has the same name when ignoring lowercase/uppercase");
                            }
                            else
                            {
                                CrawlRemoteDocument(remoteDocument, remoteDocumentPath, localFolder, remoteFiles);
                                names.Add(remoteDocument.Name.ToLowerInvariant());
                            }
                        }
                        else if (isLink(cmisObject))
                        {
                            Logger.Debug("Ignoring file '" + remoteFolder + "/" + cmisObject.Name + "' of type '" +
                                cmisObject.ObjectType.Description + "'. Links are not currently handled.");
                        }
                        else
                        {
                            Logger.Warn("Unknown object type: '" + cmisObject.ObjectType.Description + "' (" + cmisObject.ObjectType.DisplayName
                                + ") for object " + remoteFolder + "/" + cmisObject.Name);
                        }
                    }
                    catch (CmisBaseException e)
                    {
                        ProcessRecoverableException("Could not access remote object: " + cmisObject.Name, e);
                        success = false;
                    }
                }
                return success;
            }
开发者ID:aegif,项目名称:CmisSync,代码行数:72,代码来源:CrawlStrategy.cs


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