本文整理汇总了C#中IFileSystem.CreateFolder方法的典型用法代码示例。如果您正苦于以下问题:C# IFileSystem.CreateFolder方法的具体用法?C# IFileSystem.CreateFolder怎么用?C# IFileSystem.CreateFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFileSystem
的用法示例。
在下文中一共展示了IFileSystem.CreateFolder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MongoDbRunner
/// <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://localhost:{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));
}
_fileSystem.CreateFolder(dataDirectory);
_fileSystem.DeleteFile(@"{0}{1}{2}".Formatted(dataDirectory, System.IO.Path.DirectorySeparatorChar.ToString(), MongoDbDefaults.Lockfile));
_mongoDbProcess = processStarter.Start(_mongoBin.Directory, dataDirectory, _port, true);
State = State.Running;
}
示例2: MongoDbRunner
/// <summary>
/// usage: integration tests
/// </summary>
private MongoDbRunner(IPortPool portPool, IFileSystem fileSystem, IMongoDbProcessStarter processStarter, string dataDirectory)
{
_fileSystem = fileSystem;
_port = portPool.GetNextOpenPort();
ConnectionString = "mongodb://localhost:{0}/".Formatted(_port);
_dataDirectoryWithPort = "{0}_{1}".Formatted(dataDirectory, _port);
_fileSystem.CreateFolder(_dataDirectoryWithPort);
_fileSystem.DeleteFile(@"{0}\{1}".Formatted(_dataDirectoryWithPort, MongoDbDefaults.Lockfile));
_mongoDbProcess = processStarter.Start(BinariesDirectory, _dataDirectoryWithPort, _port);
State = State.Running;
}
示例3: MongoDbRunner
/// <summary>
/// usage: local debugging
/// </summary>
private MongoDbRunner(IProcessWatcher processWatcher, IPortWatcher portWatcher, IFileSystem fileSystem, IMongoDbProcessStarter processStarter)
{
_fileSystem = fileSystem;
_port = MongoDbDefaults.DefaultPort;
ConnectionString = "mongodb://localhost:{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));
}
_fileSystem.CreateFolder(MongoDbDefaults.DataDirectory);
_fileSystem.DeleteFile(@"{0}\{1}".Formatted(MongoDbDefaults.DataDirectory, MongoDbDefaults.Lockfile));
_mongoDbProcess = processStarter.Start(BinariesDirectory, MongoDbDefaults.DataDirectory, _port, true);
State = State.Running;
}
示例4: LoadSettings
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();
}
示例5: VerifyGalleryFolders
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;
}