CmisSync.Lib.Sync.CmisRepo.SynchronizedFolder.UpdateFile C# (CSharp) Метод

UpdateFile() приватный Метод

Upload new version of file content.
private UpdateFile ( string filePath, IFolder remoteFolder ) : bool
filePath string
remoteFolder IFolder
Результат bool
            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, false, repoInfo, database);
                    }
                    string fileName = syncItem.RemoteLeafname;
                    IDocument document = null;
                    bool found = false;
                    foreach (ICmisObject obj in remoteFolder.GetChildren())
                    {
                        if (null != (document = obj as IDocument))
                        {
                            if (repoInfo.CmisProfile.localFilename(document).Equals(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;
                }
            }

Same methods

CmisRepo.SynchronizedFolder::UpdateFile ( string localFilePath, IDocument remoteFile ) : bool