Exemple #1
0
        private FolderShim DefineCacheFolder(ISessionClient client,
                                             IBasicAuthenticationKey authKey)
        {
            //Throw.IfNull(_fs, "private FileSystemShim");
            //if (_fs == null) return null;

            if (authKey.BaseUrl.IsBlank() || authKey.UserName.IsBlank())
            {
                Warn_n("Unable to define cache folder.",
                       "User name or base URL should not be blank.");
                return(null);
            }


            var loc  = _fs.GetSpecialDir(SpecialDir.LocalApplicationData);
            var typ  = client.GetType().Name;
            var dom  = authKey.BaseUrl.TextAfter("//").Replace(":", "-");
            var usr  = authKey.UserName;//.Replace(" ", "_");
            var end  = "CachedNodes";
            var path = loc.Bslash(typ).Bslash(dom).Bslash(usr).Bslash(end);

            return(_fs.Folder(path));
        }