Beispiel #1
0
        public static string GetResourceRootPath(ContentURI uri,
                                                 string networkWebFileSystemPath)
        {
            string sPathToContent = string.Empty;
            //networkWebFileSystemName derives from uri.URINetwork.WebFileSystemPath
            //and is stored in db table Network
            string sContentContainerOrFolderName =
                (string.IsNullOrEmpty(networkWebFileSystemPath)) ?
                uri.URIDataManager.ContentURIName
                : networkWebFileSystemPath;

            FileStorageIO.PLATFORM_TYPES ePlatform = FileStorageIO.GetPlatformType(uri);
            if (ePlatform == FileStorageIO.PLATFORM_TYPES.webserver)
            {
                //store in temp subfolder of resources directory (set permissions once)
                bool   bIsAzureStorage = false;
                string sRoot           = GetResourceRootPath(uri, bIsAzureStorage);
                if (!sRoot.EndsWith(GeneralHelpers.FILE_PATH_DELIMITER) &&
                    (!string.IsNullOrEmpty(sRoot)))
                {
                    sRoot = string.Concat(sRoot, GeneralHelpers.FILE_PATH_DELIMITER);
                }
                sPathToContent = string.Format("{0}{1}{2}",
                                               sRoot, sContentContainerOrFolderName,
                                               GeneralHelpers.FILE_PATH_DELIMITER);
            }
            else if (ePlatform == FileStorageIO.PLATFORM_TYPES.azure)
            {
                //store in 'commontreks' (or other network containername) container
                sPathToContent = string.Format("{0}{1}{2}",
                                               uri.URIDataManager.DefaultRootWebStoragePath,
                                               sContentContainerOrFolderName, GeneralHelpers.WEBFILE_PATH_DELIMITER);
            }
            return(sPathToContent);
        }
Beispiel #2
0
        public static string GetTempRootPath(ContentURI uri)
        {
            string sPathToTempContent = string.Empty;

            FileStorageIO.PLATFORM_TYPES ePlatform = FileStorageIO.GetPlatformType(uri);
            if (ePlatform == FileStorageIO.PLATFORM_TYPES.webserver)
            {
                //store in temp subfolder of resources directory (set permissions once)
                bool   bIsAzureStorage = false;
                string sRoot           = GetResourceRootPath(uri, bIsAzureStorage);
                if (!sRoot.EndsWith(GeneralHelpers.FILE_PATH_DELIMITER) &&
                    (!string.IsNullOrEmpty(sRoot)))
                {
                    sRoot = string.Concat(sRoot, GeneralHelpers.FILE_PATH_DELIMITER);
                }
                sPathToTempContent = string.Format("{0}{1}{2}",
                                                   sRoot, uri.URIDataManager.TempDocsURIName,
                                                   GeneralHelpers.FILE_PATH_DELIMITER);
            }
            else if (ePlatform == FileStorageIO.PLATFORM_TYPES.azure)
            {
                //performance will be better when temp files are in same cloud storage as content
                //copying back and forth will be easier
                sPathToTempContent = string.Format("{0}{1}{2}",
                                                   uri.URIDataManager.DefaultRootWebStoragePath,
                                                   uri.URIDataManager.TempDocsURIName,
                                                   GeneralHelpers.WEBFILE_PATH_DELIMITER);
            }
            return(sPathToTempContent);
        }
Beispiel #3
0
        //set in ViewDataHelper when uri is configured with appsettings
        public static void SetAbsoluteURLPath(ContentURI uri,
                                              string absoluteURLPath)
        {
            string sWebPath = absoluteURLPath;

            FileStorageIO.PLATFORM_TYPES ePlatform = FileStorageIO.GetPlatformType(uri);
            if (ePlatform != FileStorageIO.PLATFORM_TYPES.azure)
            {
                //only azure should be using https
                sWebPath = absoluteURLPath.Replace("https", "http");
            }
            uri.URIDataManager.WebPath = sWebPath;
        }
Beispiel #4
0
        //gets paths to css, js, images in web root
        public static string GetWebContentFullPath(ContentURI uri,
                                                   string webSubfolder, string filename)
        {
            string sPathToContent = string.Empty;

            FileStorageIO.PLATFORM_TYPES ePlatform = FileStorageIO.GetPlatformType(uri);
            if (ePlatform == FileStorageIO.PLATFORM_TYPES.webserver)
            {
                sPathToContent = string.Format("{0}{1}{2}{3}",
                                               uri.URIDataManager.DefaultRootFullFilePath,
                                               webSubfolder, GeneralHelpers.FILE_PATH_DELIMITER,
                                               filename);
            }
            else if (ePlatform == FileStorageIO.PLATFORM_TYPES.azure)
            {
                //do not use the path to blob storage: DefaultRootWebStoragePath
                sPathToContent = string.Format("{0}{1}{2}{3}",
                                               uri.URIDataManager.DefaultWebDomain,
                                               webSubfolder, GeneralHelpers.WEBFILE_PATH_DELIMITER,
                                               filename);
            }
            return(sPathToContent);
        }