/// <summary> /// Gets the syncitem from id. /// </summary> /// <returns>syncitem.</returns> /// <param name="id">Identifier.</param> public SyncItem GetSyncItem(string id) { Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("id", id); var result = ExecuteSQL("SELECT path, localPath FROM files WHERE id=@id", parameters); string remotePath = (string)result["path"]; object localPathObj = result["localPath"]; string localPath = (localPathObj is DBNull) ? remotePath : (string)localPathObj; return(SyncItemFactory.CreateFromPaths(pathPrefix, localPath, remotePathPrefix, remotePath)); }
/// <summary> /// Gets the syncitem from remote path. /// </summary> /// <returns>syncitem. If the item is not included in the database, return null.</returns> /// <param name="remotePath">Remote path.</param> public SyncItem GetFolderSyncItemFromRemotePath(string remotePath) { string normalizedRemotePath = RemoveRemotePrefix(remotePath); Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("path", normalizedRemotePath); string localPath = (string)ExecuteSQLFunction("SELECT localPath FROM folders WHERE path=@path", parameters); if (string.IsNullOrEmpty(localPath)) { return(null); } return(SyncItemFactory.CreateFromPaths(pathPrefix, localPath, remotePathPrefix, normalizedRemotePath)); }
/// <summary> /// Gets the syncitem from local path. /// </summary> /// <returns>syncitem. If the item is not included in the database, return null.</returns> /// <param name="localPath">Local path.</param> public SyncItem GetSyncItemFromLocalPath(string localPath) { string normalizedLocalPath = RemoveLocalPrefix(localPath); Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters.Add("localPath", normalizedLocalPath); string path = (string)ExecuteSQLFunction("SELECT path FROM files WHERE localPath=@localPath", parameters); if (string.IsNullOrEmpty(path)) { return(null); } return(SyncItemFactory.CreateFromPaths(pathPrefix, normalizedLocalPath, remotePathPrefix, path)); }