public static bool VerifyGalleryFolders(IFileSystem fileSystem, string virtualRoot) { bool result = false; string originalPath = virtualRoot + "FullSizeImages/"; string webSizeImagePath = virtualRoot + "WebImages/"; string thumbnailPath = virtualRoot + "Thumbnails/"; try { if (!fileSystem.FolderExists(originalPath)) { fileSystem.CreateFolder(originalPath); } if (!fileSystem.FolderExists(webSizeImagePath)) { fileSystem.CreateFolder(webSizeImagePath); } if (!fileSystem.FolderExists(thumbnailPath)) { fileSystem.CreateFolder(thumbnailPath); } result = true; } catch (UnauthorizedAccessException ex) { log.Error("Error creating directories in GalleryHelper.VerifyGalleryFolders", ex); } return(result); }
private void SetupThumbnails() { if (bigConfig.FolderPath == string.Empty) { return; } var galleryDiskPath = HttpContext.Current.Server.MapPath(galleryPath); var dirInfo = new DirectoryInfo(galleryDiskPath); var images = Web.ImageHelper.GetImageExtensions() .SelectMany(ext => dirInfo.GetFiles(ext, SearchOption.AllDirectories)) .ToArray(); var thumbnailCachePath = moduleThumbnailCachePath + dirInfo.Name + "/"; // Creates thumbnail cache folder if it doesn't exist, should only happen // the first time this gallery instance is hit. if (!fileSystem.FolderExists(thumbnailCachePath)) { fileSystem.CreateFolder(thumbnailCachePath); //CreateThumbnailDataFile(images, thumbnailCachePath); CreateThumbnails(images, thumbnailCachePath); } else { //var thumbnails = GetThumbnailDataFile(thumbnailCachePath); //var imageNameList = images.Select(x => FileNameWithJpegExt(x.Name)).ToList(); //// Finds what images are in the thumbnails data file, but not in the gallery folder ////var missingThumbnailsList = thumbnails.Except(imageNameList).ToList(); //// Finds what images are in the galler folder, but not in the data file //var missingImageNamesList = imageNameList.Except(thumbnails).ToList(); //// Creates missing thumbnail images //if (missingImageNamesList.Count() > 0) //{ // var missingImages = images.Where(i => missingImageNamesList.Contains(Path.GetFileNameWithoutExtension(i.Name) + ".jpg")).ToArray(); // CreateThumbnailDataFile(images, thumbnailCachePath); // CreateThumbnails(missingImages, thumbnailCachePath); //} var thumbnailCacheDiscPath = HttpContext.Current.Server.MapPath(thumbnailCachePath); var cacheDirInfo = new DirectoryInfo(thumbnailCacheDiscPath); var cacheImages = Web.ImageHelper.GetImageExtensions() .SelectMany(ext => cacheDirInfo.GetFiles(ext, SearchOption.AllDirectories)) .ToArray(); var imageNameList = images.Select(x => FileNameWithJpegExt(x.Name)).ToList(); var thumbnailNameList = cacheImages.Select(x => FileNameWithJpegExt(x.Name)).ToList(); var missingImageNamesList = imageNameList.Except(thumbnailNameList).ToList(); // Creates missing thumbnail images if (missingImageNamesList.Count() > 0) { var missingImages = images.Where(i => missingImageNamesList.Contains(Path.GetFileNameWithoutExtension(i.Name) + ".jpg")).ToArray(); CreateThumbnails(missingImages, thumbnailCachePath); } } }
void btnNewFolder_Click(object sender, EventArgs e) { if (!canEdit) { return; } if ((hdnFolder.Value.Length > 0) && (hdnFolder.Value != rootDirectory)) { currentDir = hdnFolder.Value; } if (fileSystem.CountFolders() <= fileSystem.Permission.MaxFolders) { try { fileSystem.CreateFolder(VirtualPathUtility.Combine(GetCurrentDirectory(), Path.GetFileName(txtNewDirectory.Text).ToCleanFolderName(WebConfigSettings.ForceLowerCaseForFolderCreation))); txtNewDirectory.Text = ""; WebUtils.SetupRedirect(this, GetRedirectUrl()); } catch (UnauthorizedAccessException ex) { lblError.Text = ex.Message; } catch (ArgumentException ex) { lblError.Text = ex.Message; } } else { lblError.Text = Resource.FileSystemFolderLimitReached; } }
public static bool VerifyAuthorFolders(IFileSystem fileSystem, string virtualRoot) { bool result = false; string originalPath = virtualRoot; string thumbnailPath = virtualRoot + "thumbs/"; string publicPath = virtualRoot + "Public/"; try { if (!fileSystem.FolderExists(originalPath)) { fileSystem.CreateFolder(originalPath); } if (!fileSystem.FolderExists(thumbnailPath)) { fileSystem.CreateFolder(thumbnailPath); } if (!fileSystem.FolderExists(publicPath)) { fileSystem.CreateFolder(publicPath); } result = true; } catch (UnauthorizedAccessException ex) { log.Error("Error creating directories in AuthorHepper.VerifyAuthorFolders", ex); } return(result); }
protected virtual void LoadSettings() { siteRoot = SiteUtils.GetNavigationSiteRoot(); siteSettings = CacheHelper.GetCurrentSiteSettings(); siteID = siteSettings.SiteId; currentUser = SiteUtils.GetCurrentSiteUser(); var moduleSettings = ModuleSettings.GetModuleSettings(moduleID); if (moduleSettings != null) { bigConfig = new BIGConfig(moduleSettings); } FileSystemProvider p = FileSystemManager.Providers[WebConfigSettings.FileSystemProvider]; if (p == null) { log.Error(string.Format(BetterImageGalleryResources.FileSystemProviderNotLoaded, WebConfigSettings.FileSystemProvider)); } fileSystem = p.GetFileSystem(); if (fileSystem == null) { log.Error(string.Format(BetterImageGalleryResources.FileSystemNotLoadedFromProvider, WebConfigSettings.FileSystemProvider)); } // Media Folder mediaRootPath = fileSystem.VirtualRoot; // Gallery Module Folder galleryRootPath = mediaRootPath + "BetterImageGallery/"; // Gallery Folder galleryPath = galleryRootPath + bigConfig.FolderPath.TrimEnd('/'); // Creates the Gallery Module Folder if it doesn't exist if (!fileSystem.FolderExists(galleryRootPath)) { fileSystem.CreateFolder(galleryRootPath); } // Creates the Gallery Module Folder if it doesn't exist if (!fileSystem.FolderExists(galleryPath)) { Error = new BIGErrorResult { Type = "FolderNotFound", Message = BetterImageGalleryResources.FolderNotFound }; } // Creates module thumbnail cache folder if it doesn't exist if (!fileSystem.FolderExists(moduleThumbnailCachePath)) { fileSystem.CreateFolder(moduleThumbnailCachePath); } }
private string CreateDeploymentsDirectoryIfNeeded() { // look in the current directory where the executeable is located // for the "Deployments" directory, if not there then create it: var deployDirectory = Path.Combine(Environment.CurrentDirectory, "Deployments"); _fileSystem.CreateFolder(deployDirectory); return(deployDirectory); }
public void FileSystem_CreateDeleteFolder() { var tempFolderPath = _fileSystem.GetTempFolderPath() + Guid.NewGuid().ToStringNoDashes(); _fileSystem.CreateFolder(tempFolderPath); _fileSystem.FolderExists(tempFolderPath).Should().BeTrue(); _fileSystem.DeleteFolder(tempFolderPath); }
public void CreateFolderAndDeleteFolderTakesAnySlash() { Assert.That(_fileSystem.ListFolders(@"Subfolder1").Count(), Is.EqualTo(1)); _fileSystem.CreateFolder(@"SubFolder1/SubSubFolder2"); _fileSystem.CreateFolder(@"SubFolder1\SubSubFolder3"); Assert.That(_fileSystem.ListFolders(@"Subfolder1").Count(), Is.EqualTo(3)); _fileSystem.DeleteFolder(@"SubFolder1/SubSubFolder2"); _fileSystem.DeleteFolder(@"SubFolder1\SubSubFolder3"); Assert.That(_fileSystem.ListFolders(@"Subfolder1").Count(), Is.EqualTo(1)); }
/// <summary> /// usage: local debugging /// </summary> private MongoDbRunner(IProcessWatcher processWatcher, IPortWatcher portWatcher, IFileSystem fileSystem, IMongoDbProcessStarter processStarter, IMongoBinaryLocator mongoBin, string dataDirectory) { _fileSystem = fileSystem; _port = MongoDbDefaults.DefaultPort; _mongoBin = mongoBin; MakeMongoBinarysExecutable(); ConnectionString = "mongodb://*****:*****@"{0}{1}{2}".Formatted(dataDirectory, System.IO.Path.DirectorySeparatorChar.ToString(), MongoDbDefaults.Lockfile)); _mongoDbProcess = processStarter.Start(_mongoBin.Directory, dataDirectory, _port, true); State = State.Running; }
/// <summary> /// usage: integration tests /// </summary> private MongoDbRunner(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter, IMongoBinaryLocator mongoBin, string dataDirectory = null, bool singleNodeReplSet = false, string additionalMongodArguments = null, ushort singleNodeReplSetWaitTimeout = MongoDbDefaults.SingleNodeReplicaSetWaitTimeout) { _fileSystem = fileSystem; _port = portPool.GetNextOpenPort(); _mongoBin = mongoBin; if (dataDirectory == null) { dataDirectory = CreateTemporaryDataDirectory(); } MakeMongoBinarysExecutable(); ConnectionString = singleNodeReplSet ? "mongodb://127.0.0.1:{0}/?connect=direct&replicaSet=singleNodeReplSet&readPreference=primary".Formatted(_port) : "mongodb://127.0.0.1:{0}/".Formatted(_port); _dataDirectoryWithPort = "{0}_{1}".Formatted(dataDirectory, _port); _fileSystem.CreateFolder(_dataDirectoryWithPort); _fileSystem.DeleteFile("{0}{1}{2}".Formatted(_dataDirectoryWithPort, Path.DirectorySeparatorChar.ToString(), MongoDbDefaults.Lockfile)); _mongoDbProcess = processStarter.Start(_mongoBin.Directory, _dataDirectoryWithPort, _port, singleNodeReplSet, additionalMongodArguments, singleNodeReplSetWaitTimeout); State = State.Running; }
private void btnNewFolder_Click(object sender, EventArgs e) { try { string dir = GetCurrentDirectory(); string path; if (dir.Length > 0) { path = dir + displayPathSeparator + txtNewDirectory.Text; } else { path = txtNewDirectory.Text; } //TODO: if not success show message OpResult result = fileSystem.CreateFolder(path); txtNewDirectory.Text = string.Empty; BindData(); //Page.Response.Redirect(Page.Request.Url.ToString(), false); } catch (UnauthorizedAccessException ex) { lblError.Text = ex.Message; } catch (ArgumentException ex) { lblError.Text = ex.Message; } }
public void StoreSnap(string path, object value) { var snap = JToken.FromObject(value); _fileSystem.CreateFolder(_fileSystem.GetFolderPath(path)); _fileSystem.WriteTextToFile(path, snap.ToString()); }
public static bool CopyFile(this IFileSystem fileSystem, AbsoluteFilePath sourcePath, AbsoluteFilePath targetPath, bool overwriteIfExists = false) { IFile source = fileSystem.GetFile(sourcePath); if (source == null) { return(false); } IFolder targetFolder = fileSystem.CreateFolder(targetPath.Folder); IFile file = targetFolder.GetFile(targetPath.ItemName); if (file != null && !overwriteIfExists) { return(false); } if (file == null) { file = targetFolder.CreateFile(targetPath.ItemName); } var buffer = new byte[512]; int count; using (Stream to = file.OpenToWrite()) { using (Stream from = file.OpenToRead()) { while ((count = from.Read(buffer, 0, buffer.Length)) >= 0) { if (count > 0) { to.Write(buffer, 0, count); } } } } return(true); }
public FileStorage(IFileSystem fileSystem, string basePath) { _storage = fileSystem; _basePath = basePath; _storage.CreateFolder(basePath); }
private void CreateFolder(HttpContext context) { var result = OpResult.Denied; if (fileSystem.CountFolders() <= fileSystem.Permission.MaxFolders) { try { virtualPath = VirtualPathUtility.AppendTrailingSlash(virtualPath); if (OnFolderCreating(virtualPath, ref result)) { result = fileSystem.CreateFolder(virtualPath); } } catch (Exception ex) { log.Error(ex); result = OpResult.Error; } } else { result = OpResult.FolderLimitExceed; } RenderJsonResult(context, result); }
/// <summary> /// usage: local debugging /// </summary> private MongoDbRunner(IProcessWatcher processWatcher, IPortWatcher portWatcher, IFileSystem fileSystem, IMongoDbProcessStarter processStarter, IMongoBinaryLocator mongoBin, int port, string dataDirectory = null, bool singleNodeReplSet = false, string additionalMongodArguments = null) { _fileSystem = fileSystem; _mongoBin = mongoBin; _port = port; MakeMongoBinarysExecutable(); ConnectionString = singleNodeReplSet? "mongodb://127.0.0.1:{0}/?connect=direct&replicaSet=singleNodeReplSet&readPreference=primary".Formatted(_port) : "mongodb://127.0.0.1:{0}/".Formatted(_port); if (processWatcher.IsProcessRunning(MongoDbDefaults.ProcessName) && !portWatcher.IsPortAvailable(_port)) { State = State.AlreadyRunning; return; } if (!portWatcher.IsPortAvailable(_port)) { throw new MongoDbPortAlreadyTakenException("MongoDB can't be started. The TCP port {0} is already taken.".Formatted(_port)); } if (dataDirectory == null) { dataDirectory = CreateTemporaryDataDirectory(); } _fileSystem.CreateFolder(dataDirectory); _fileSystem.DeleteFile("{0}{1}{2}".Formatted(dataDirectory, Path.DirectorySeparatorChar.ToString(), MongoDbDefaults.Lockfile)); _mongoDbProcess = processStarter.Start(_mongoBin.Directory, dataDirectory, _port, true, singleNodeReplSet, additionalMongodArguments); State = State.Running; }
public static Participant Load(IFileSystem fs, string folder) { Check.NotNull(folder, "folder"); if (!fs.Exists(folder)) { fs.CreateFolder(folder); } var path = fs.Combine(folder, "info.json"); if (!fs.Exists(path)) { return(new Participant(fs, folder)); } var result = fs.LoadJson <Participant>(path); result.FileSystem = fs; foreach (var solution in result.Solutions) { solution.FileSystem = fs; solution.Path = solution.LocalSourcePath; } return(result); }
public CodeBase Analyze(MetricsCommandArguments details) { var command = collectionStepFactory.GetStep(details.RepositorySourceType); details.MetricsOutputFolder = fileSystem.MetricsOutputFolder; details.BuildOutputFolder = fileSystem.GetProjectBuildFolder(details.ProjectName); fileSystem.CreateFolder(details.BuildOutputFolder); var metricsResults = command.Run(details); var codeBase = CodeBase.Empty(); foreach (var x in metricsResults) { var filename = x.MetricsFile; var cb = codebaseService.Get(fileSystem.OpenFileStream(filename), x.ParseType); codeBase.Enrich(new CodeGraph(cb.AllInstances)); } var codebase = analyzerFactory.For(details.RepositorySourceType).Analyze(codeBase.AllInstances); codebase.SourceType = details.RepositorySourceType; codebase.Name = details.ProjectName; return(codebase); }
public string StoreData(byte[] data, string extension = null) { var hasher = new SHA256Managed(); hasher.Initialize(); string hash = null; using (hasher) { hash = HexTools.ByteArrayToHexString(hasher.ComputeHash(data)); var targetPath = BuildPath(hash, extension); if (_storage.Exists(targetPath)) { return(null); } var directory = Path.GetDirectoryName(targetPath); _storage.CreateFolder(directory); var file = _storage.Open(targetPath); using (file) { file.Write(data, 0, data.Length); } } return(hash); }
public static string GetDatabasePath(IFileSystem fileSystem, ServiceHost serviceHost) { var databasePath = $"{fileSystem.DataFolderPath()}/{serviceHost}"; fileSystem.CreateFolder(databasePath); return(databasePath); }
public static IFile CreateFile(this IFileSystem fileSystem, AbsoluteFilePath path, string utf8Contents, CollisionStrategy collisionStrategy = CollisionStrategy.FailIfExists) { return(fileSystem.CreateFolder(path.Folder) .CreateFile(path, utf8Contents, collisionStrategy)); }
/// <summary> /// Gets the database path. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="folderName">Name of the folder.</param> /// <returns>System.String.</returns> /// <autogeneratedoc /> public static string GetDatabasePath(IFileSystem fileSystem, string folderName) { var databasePath = $"{fileSystem.DataFolderPath()}/{folderName}"; fileSystem.CreateFolder(databasePath); return(databasePath); }
protected void btnUpload_Click(object sender, EventArgs e) { // as long as javascript is available this code should never execute // because the standard file input ir replaced by javascript and the file upload happens // at the service url /SharedFiles/upload.ashx // this is fallback implementation if (!fileSystem.FolderExists(fileVirtualBasePath)) { fileSystem.CreateFolder(fileVirtualBasePath); } SiteUser siteUser = SiteUtils.GetCurrentSiteUser(); if (siteUser == null) { WebUtils.SetupRedirect(this, Request.RawUrl); return; } if (uploader.HasFile) { SharedFile sharedFile = new SharedFile(); string fileName = Path.GetFileName(uploader.FileName); sharedFile.ModuleId = ModuleId; sharedFile.ModuleGuid = ModuleConfiguration.ModuleGuid; sharedFile.OriginalFileName = fileName; sharedFile.FriendlyName = fileName; sharedFile.SizeInKB = (int)(uploader.FileContent.Length / 1024); sharedFile.FolderId = CurrentFolderId; if (CurrentFolderId > -1) { SharedFileFolder folder = new SharedFileFolder(ModuleId, CurrentFolderId); sharedFile.FolderGuid = folder.FolderGuid; } sharedFile.UploadUserId = siteUser.UserId; sharedFile.UserGuid = siteUser.UserGuid; sharedFile.ContentChanged += new ContentChangedEventHandler(SharedFile_ContentChanged); if (sharedFile.Save()) { string destPath = VirtualPathUtility.Combine(fileVirtualBasePath, sharedFile.ServerFileName); using (Stream s = uploader.FileContent) { fileSystem.SaveFile(destPath, s, IOHelper.GetMimeType(Path.GetExtension(sharedFile.FriendlyName).ToLower()), true); } } } WebUtils.SetupRedirect(this, Request.RawUrl); }
public AnalysisServices(ICollectionStepFactory collectionStepFactory, ICodebaseService codebaseService, IAnalyzerFactory analyzerFactory, IFileSystem fileSystem) { this.collectionStepFactory = collectionStepFactory; this.codebaseService = codebaseService; this.analyzerFactory = analyzerFactory; this.fileSystem = fileSystem; fileSystem.CreateFolder(fileSystem.MetricsOutputFolder); }
private dynamic CreateFolder(string path) { OpResult result = OpResult.FolderLimitExceed; if (fileSystem.CountFolders() < fileSystem.Permission.MaxFolders) { string dir = VirtualPathUtility.GetDirectory(path); string newFolder = dir + CleanFileName(path, "folder"); result = fileSystem.CreateFolder(FilePath(newFolder, false, true)); if (result != OpResult.Succeed) { return(new FileService.ReturnObject(ReturnResult(result))); } } return(new FileService.ReturnObject(ReturnResult(result))); }
public AnalysisServices(ICollectionStepFactory collectionStepFactory, ICodebaseService codebaseService, IAnalyzerFactory analyzerFactory, IFileSystem fileSystem, IYamlFileDeserializer <MetricsCommandArguments> fileDeserializer) { this.collectionStepFactory = collectionStepFactory; this.codebaseService = codebaseService; this.analyzerFactory = analyzerFactory; this.fileSystem = fileSystem; this.fileDeserializer = fileDeserializer; fileSystem.CreateFolder(fileSystem.MetricsOutputFolder); }
public void Exists_With_Slash() { FileSystem.CreateFolder("folder"); FileStream ST = File.Create("SolutionTests.txt"); ST.Close(); var util = new FtpUtilities(); util.Exists("ftp://www.nic.funet.fi/pub/unix/OpenBSD/"); //Authority }
/// <summary> /// usage: integration tests /// </summary> private MongoDbRunner(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter) { _fileSystem = fileSystem; _port = portPool.GetNextOpenPort(); ConnectionString = "mongodb://*****:*****@"{0}\{1}".Formatted(_dataDirectoryWithPort, MongoDbDefaults.Lockfile)); _mongoDbProcess = processStarter.Start(BinariesDirectory, _dataDirectoryWithPort, _port); State = State.Running; }
/// <summary> /// usage: integration tests /// </summary> private MongoDbRunner(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter, string dataDirectory) { _fileSystem = fileSystem; _port = portPool.GetNextOpenPort(); ConnectionString = "mongodb://*****:*****@"{0}\{1}".Formatted(_dataDirectoryWithPort, MongoDbDefaults.Lockfile)); _mongoDbProcess = processStarter.Start(BinariesDirectory, _dataDirectoryWithPort, _port); State = State.Running; }
public GitDeploymentResult Deploy(GitDeploymentTarget gitDeploymentTarget, string pathToGeneratedCode) { var tempPath = getWorkingFolderPath.GetPathToWorkingFolder() + this.GetType().Name + "Temp" + Path.DirectorySeparatorChar + Guid.NewGuid() + Path.DirectorySeparatorChar; fileSystem.CreateFolder(tempPath); CloneTheRepositoryAndGetOnTheDesiredBranch(tempPath, gitDeploymentTarget); fileSystem.CopyFolder(pathToGeneratedCode, tempPath); AddTheNewFilesAndCommitThem(tempPath); ExecuteGitCommand(tempPath, string.Format("git push origin {0}", gitDeploymentTarget.BranchName)); return(null); }
/// <summary> /// usage: integration tests /// </summary> private MongoDbRunner(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter, IMongoBinaryLocator mongoBin, string dataDirectory) { _fileSystem = fileSystem; _port = portPool.GetNextOpenPort(); _mongoBin = mongoBin; MakeMongoBinarysExecutable(); ConnectionString = "mongodb://*****:*****@"{0}{1}{2}".Formatted(_dataDirectoryWithPort, System.IO.Path.DirectorySeparatorChar.ToString(), MongoDbDefaults.Lockfile)); _mongoDbProcess = processStarter.Start(_mongoBin.Directory, _dataDirectoryWithPort, _port); State = State.Running; }
/// <summary> /// usage: local debugging /// </summary> private MongoDbRunner(IProcessWatcher processWatcher, IPortWatcher portWatcher, IFileSystem fileSystem, IMongoDbProcessStarter processStarter) { _fileSystem = fileSystem; _port = MongoDbDefaults.DefaultPort; ConnectionString = "mongodb://*****:*****@"{0}\{1}".Formatted(MongoDbDefaults.DataDirectory, MongoDbDefaults.Lockfile)); _mongoDbProcess = processStarter.Start(BinariesDirectory, MongoDbDefaults.DataDirectory, _port, true); State = State.Running; }
private void LoadSettings() { pageId = WebUtils.ParseInt32FromQueryString("pageid", -1); moduleId = WebUtils.ParseInt32FromQueryString("mid", true, -1); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); store = StoreHelper.GetStore(); if (store == null) { return; } siteUser = SiteUtils.GetCurrentSiteUser(); productGuid = WebUtils.ParseGuidFromQueryString("prod", productGuid); virtualRoot = WebUtils.GetApplicationRoot(); upLoadPath = "~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/webstoreproductfiles/"; teaserFileBasePath = "~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/webstoreproductpreviewfiles/"; AddClassToBody("webstore webstoreproductedit"); FileSystemProvider p = FileSystemManager.Providers[WebConfigSettings.FileSystemProvider]; if (p == null) { log.Error("Could not load file system provider " + WebConfigSettings.FileSystemProvider); return; } fileSystem = p.GetFileSystem(); if (fileSystem == null) { log.Error("Could not load file system from provider " + WebConfigSettings.FileSystemProvider); return; } if (!fileSystem.FolderExists(upLoadPath)) { fileSystem.CreateFolder(upLoadPath); } if (!fileSystem.FolderExists(teaserFileBasePath)) { fileSystem.CreateFolder(teaserFileBasePath); } if (productGuid == Guid.Empty) { return; } productUploader.ServiceUrl = SiteRoot + "/WebStore/upload.ashx?pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString() + "&prod=" + productGuid.ToString() ; productUploader.UploadButtonClientId = btnUpload.ClientID; productUploader.FormFieldClientId = hdnState.ClientID; // not really used but prevents submitting all the form string refreshFunction = "function refresh" + moduleId.ToInvariantString() + " (data, errorsOccurred) { if(errorsOccurred === false) { $('#" + btnSave.ClientID + "').click(); } } "; productUploader.UploadCompleteCallback = "refresh" + moduleId.ToInvariantString(); ScriptManager.RegisterClientScriptBlock( this, this.GetType(), "refresh" + moduleId.ToInvariantString(), refreshFunction, true); teaserUploader.ServiceUrl = SiteRoot + "/WebStore/upload.ashx?type=teaser&pageid=" + pageId.ToInvariantString() + "&mid=" + moduleId.ToInvariantString() + "&prod=" + productGuid.ToString(); teaserUploader.UploadButtonClientId = btnUploadTeaser.ClientID; teaserUploader.FormFieldClientId = hdnState.ClientID; // not really used but prevents submitting all the form teaserUploader.UploadCompleteCallback = "refresh" + moduleId.ToInvariantString(); }
public static bool VerifyGalleryFolders(IFileSystem fileSystem, string virtualRoot) { bool result = false; string originalPath = virtualRoot + "FullSizeImages/"; string webSizeImagePath = virtualRoot + "WebImages/"; string thumbnailPath = virtualRoot + "Thumbnails/"; try { if (!fileSystem.FolderExists(originalPath)) { fileSystem.CreateFolder(originalPath); } if (!fileSystem.FolderExists(webSizeImagePath)) { fileSystem.CreateFolder(webSizeImagePath); } if (!fileSystem.FolderExists(thumbnailPath)) { fileSystem.CreateFolder(thumbnailPath); } result = true; } catch (UnauthorizedAccessException ex) { log.Error("Error creating directories in GalleryHelper.VerifyGalleryFolders", ex); } return result; }