Пример #1
0
        /// <summary>
        /// Returns a reference to the inriver resource folder. It will be created if it does not already exist.
        /// </summary>
        /// <param name="fileInfo"></param>
        /// <param name="contentType"></param>
        protected ContentReference GetFolder(FileInfo fileInfo, ContentType contentType)
        {
            lock (LockObject) {
                var rootFolderName = ConfigurationManager.AppSettings["InRiverConnector.ResourceFolderName"];
                var rootFolder     = _contentFolderCreator.CreateOrGetFolder(SiteDefinition.Current.GlobalAssetsRoot, rootFolderName ?? "ImportedResources");

                var firstLevelFolderName = fileInfo.Name[0].ToString().ToUpper();
                var firstLevelFolder     = _contentFolderCreator.CreateOrGetFolder(rootFolder, firstLevelFolderName);

                var secondLevelFolderName = contentType.Name.Replace("File", "");
                return(_contentFolderCreator.CreateOrGetFolder(firstLevelFolder, secondLevelFolderName));
            }
        }
Пример #2
0
        /// <summary>
        /// Returns a reference to the inriver resource folder. It will be created if it does not already exist.
        /// </summary>
        /// <param name="fileInfo"></param>
        /// <param name="contentType"></param>
        protected ContentReference GetFolder(FileInfo fileInfo, ContentType contentType)
        {
            return(ExecuteWithinLock(() =>
            {
                string rootFolderName = ConfigurationManager.AppSettings["InRiverConnector.ResourceFolderName"];
                ContentReference rootFolder =
                    _contentFolderCreator.CreateOrGetFolder(SiteDefinition.Current.GlobalAssetsRoot, rootFolderName ?? "ImportedResources");

                string firstLevelFolderName = fileInfo.Name[0].ToString().ToUpper();
                ContentReference firstLevelFolder = _contentFolderCreator.CreateOrGetFolder(rootFolder, firstLevelFolderName);

                string secondLevelFolderName = contentType.Name.Replace("File", "");
                return _contentFolderCreator.CreateOrGetFolder(firstLevelFolder, secondLevelFolderName);
            }));
        }