Exemplo n.º 1
0
        public Guid CreateFileReadToken(string sourceFile, Guid fileId, int timeout)
        {
            Guid id = Guid.NewGuid();
            LocalFileAccessToken newToken = new LocalFileAccessToken(id, new Guid[] { fileId }, new string[] { sourceFile }, timeout);

            currentAccessTokens.Add(id, newToken);
            return(id);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates an access token for a group of files
        /// </summary>
        /// <param name="info">The file IDs and file sources to include in token</param>
        /// <param name="timeout">Time in seconds to automatically delete token if inactive. 0 = disabled</param>
        /// <returns></returns>
        private Guid CreateFileReadTokenForGroup(FileAccessInfo info, int timeout)
        {
            Guid accessId = Guid.NewGuid();

            ISLogger.Write("Access token timeout = " + timeout);
            LocalFileAccessToken token = new LocalFileAccessToken(accessId, info.FileIds, info.FileSources, timeout);

            token.TokenClosed += Token_TokenClosed;
            currentAccessTokens.Add(accessId, token);
            ISLogger.Write("FileAccessController: Created group token {0} for {1} files", accessId, info.FileIds.Length);
            return(accessId);
        }