CmisSync.Lib.Sync.CmisRepo.SynchronizedFolder.ApplyAddedFiles C# (CSharp) Method

ApplyAddedFiles() public method

Apply: Added files.
public ApplyAddedFiles ( List &addedFiles ) : bool
addedFiles List
return bool
            public bool ApplyAddedFiles(ref List<string> addedFiles)
            {
                bool success = true;
                foreach (string addedFile in addedFiles)
                {
                    string destinationFolderPath = Path.GetDirectoryName(addedFile);
                    SyncItem folderItem = SyncItemFactory.CreateFromLocalPath(destinationFolderPath, true, repoInfo, database);
                    SyncItem fileItem = SyncItemFactory.CreateFromLocalPath(addedFile, false, repoInfo, database);
                    try
                    {
                        IFolder destinationFolder = (IFolder)session.GetObjectByPath(folderItem.RemotePath);

                        // Fill documents list, needed by the crawl method.
                        IList<string> remoteFiles = new List<string>();

                        if (CmisUtils.DocumentExists(session, fileItem.RemotePath))
                        {
                            remoteFiles.Add(fileItem.RemoteLeafname);
                        }

                        // Crawl this particular file.
                        CheckLocalFile(fileItem.LocalPath, destinationFolder, remoteFiles);
                    }
                    catch (Exception e)
                    {
                        Logger.Error("Error applying local file addition to the server: " + addedFile, e);
                        success = false;
                    }
                }
                return success;
            }
        }