当前位置: 首页>>代码示例>>C#>>正文


C# IFileSystem.CreateFolder方法代码示例

本文整理汇总了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;
        }
开发者ID:JohannesHoppe,项目名称:Mongo2Go,代码行数:30,代码来源:MongoDbRunner.cs

示例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;
        }
开发者ID:Silv3rcircl3,项目名称:Mongo2Go,代码行数:17,代码来源:MongoDbRunner.cs

示例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;
        }
开发者ID:srasch,项目名称:Mongo2Go,代码行数:27,代码来源:MongoDbRunner.cs

示例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();
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:77,代码来源:AdminProductEdit.aspx.cs

示例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;
        }
开发者ID:joedavis01,项目名称:mojoportal,代码行数:34,代码来源:GalleryHelper.cs


注:本文中的IFileSystem.CreateFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。