public static string GetTempDocsPathToNewFileSystemPath(ContentURI uri, bool isLocalCacheDirectory, string newFileName) { //210 added specifically for script file handling (http to file server path conversions) string sTempDocPath = string.Empty; if (!string.IsNullOrEmpty(uri.URIDataManager.TempDocPath)) { string sOldTempFileName = Path.GetFileName(uri.URIDataManager.TempDocPath); sTempDocPath = uri.URIDataManager.TempDocPath.Replace(sOldTempFileName, newFileName); } else { //make a new temp doc path for temp storage of script file string sDirectoryPath = GetTempWebDirectory(uri, isLocalCacheDirectory, GeneralHelpers.Get2RandomInteger()); string sDelimiter = FileStorageIO.GetDelimiterForFileStorage(sDirectoryPath); //make the tempdocpath string sTempDocPath2 = string.Concat(sDirectoryPath, sDelimiter, newFileName); //return sTempDocPath; bool bHasDirectory = FileStorageIO.DirectoryCreate( uri, sTempDocPath2); } return(sTempDocPath); }
//used to build the download package zip file on azure public static string GetCloudTempBlobURI(ContentURI uri, string fileName) { string sTempBlobURI = string.Empty; string sDir = GetTempWebDirectory(uri, false, GeneralHelpers.Get2RandomInteger()); //2.0.0 deprecated guid in name because of azure appserve msg about resource name of blob being too long //blob names are limited to 1024 chars sTempBlobURI = string.Concat(sDir, GeneralHelpers.WEBFILE_PATH_DELIMITER, GeneralHelpers.Get2RandomInteger().ToString(), GeneralHelpers.WEBFILE_PATH_DELIMITER, fileName); //sTempBlobURI = string.Concat(sDir, GeneralHelpers.WEBFILE_PATH_DELIMITER, // Guid.NewGuid().ToString(), GeneralHelpers.WEBFILE_PATH_DELIMITER, // fileName); return(sTempBlobURI); }
public static string GetTempDocPath(ContentURI uri, bool isLocalCacheDirectory, string uriPattern, string tempURIPattern) { string sTempDocPath = string.Empty; //use uri.URIDataManager.TempDocURI to set subdirectory for holding //all related tempdocs (easy to package) string sRandomId = ContentURI.GetURIPatternPart(tempURIPattern, ContentURI.URIPATTERNPART.id); string sNodeName = ContentURI.GetURIPatternPart(tempURIPattern, ContentURI.URIPATTERNPART.node); string sDirectory = string.Empty; //ok to put empty uris in a "0" subfolder if (sRandomId != string.Empty && sNodeName != GeneralHelpers.NONE && sRandomId != "0") { //has a tempdoc to work with //uri.uridatamanager.tempdocuri's random urid is always subdir sDirectory = GetTempWebDirectory(uri, isLocalCacheDirectory, GeneralHelpers.ConvertStringToInt(sRandomId)); } else { //may be starting to build a tempdoc //need a random directory sDirectory = GetTempWebDirectory(uri, isLocalCacheDirectory, GeneralHelpers.Get2RandomInteger()); } string sDelimiter = FileStorageIO.GetDelimiterForFileStorage(sDirectory); //don't use uri.uriclubdocpath filename because it may not need to be set //for the selectedlinkedviewuri string sFileName = string.Concat( ContentHelper.MakeStandardFileNameFromURIPattern(uriPattern), GeneralHelpers.EXTENSION_XML); //make the tempdocpath sTempDocPath = string.Concat(sDirectory, sDelimiter, ContentHelper.MakeStandardFileNameFromURIPattern(uriPattern), GeneralHelpers.EXTENSION_XML); return(sTempDocPath); }