Exemplo n.º 1
0
        /// <summary>
        /// Sets lock info.
        /// </summary>
        /// <param name="lockInfo">Lock info.</param>
        internal async Task SetLockInfoAsync(ServerLockInfo lockInfo)
        {
            await using (FileStream lockTokenFileStream = File.Open(lockInfoFilePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Delete))
            {
                lockTokenFileStream.Seek(0, SeekOrigin.Begin);
                await JsonSerializer.SerializeAsync(lockTokenFileStream, lockInfo);

                //lockTokenFileStream.SetLength(lockTokenFileStream.Position);
            }
        }
 /// <summary>
 /// Sets or removes "Lock" icon and all lock properties.
 /// </summary>
 /// <param name="lockInfo">Information about the lock. Pass null to remove lock info.</param>
 public async Task SetLockInfoAsync(ServerLockInfo lockInfo)
 {
     if (lockInfo != null)
     {
         // Add lock info columns.
         IEnumerable <FileSystemItemPropertyData> lockProps = lockInfo.GetLockProperties(Path.Combine(iconsFolderPath, "Locked.ico"));
         await SetCustomColumnsAsync(lockProps);
     }
     else
     {
         // Remove lock info columns.
         IEnumerable <FileSystemItemPropertyData> lockProps = new ServerLockInfo().GetLockProperties(null);
         await RemoveCustomColumnsAsync(lockProps);
     }
 }