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


C# IFile类代码示例

本文整理汇总了C#中IFile的典型用法代码示例。如果您正苦于以下问题:C# IFile类的具体用法?C# IFile怎么用?C# IFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IFile类属于命名空间,在下文中一共展示了IFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Import

        public override void Import(IFile fileSystem, string rootPath)
        {
            string folderPath = GetFolder(rootPath);

            string fileFullPath = System.IO.Path.Combine(folderPath, GetExportedFilename());
            content = fileSystem.ReadBinary(fileFullPath);
        }
开发者ID:FrankNine,项目名称:Heartache,代码行数:7,代码来源:WholeChunk.cs

示例2: ExploreFile

 public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
 {
     if ((psiFile.Language.Is<JavaScriptLanguage>() && !psiFile.Language.Is<JavaScriptWinRTLanguage>()) && (psiFile.GetProject() != null))
     {
         psiFile.ProcessDescendants(new JasmineFileExplorer(myFactory, consumer, psiFile, interrupted, myJavaScriptDependencyManager.GetTransitiveDependencies(psiFile.GetSourceFile())));
     }
 }
开发者ID:sergeyt,项目名称:karma-resharper,代码行数:7,代码来源:JasmineTestFileExplorer.cs

示例3: FileStream

        public FileStream(IFile file)
        {
            if (file == null)
                throw new ArgumentNullException("file");

            File = file;
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:7,代码来源:FileStream.cs

示例4: CreateModelReference

 public static ModelReference CreateModelReference(IFile file)
 {
     var model = LoadModel(file);
     var reference = new ModelReference(file.FullPathName, model);
     References.Add(reference);
     return reference;
 }
开发者ID:KonstantinUb,项目名称:sledge,代码行数:7,代码来源:ModelProvider.cs

示例5: Suite

        public Suite(IFile systemFile)
        {
            System = Path.GetFileNameWithoutExtension(systemFile.FullPath);
            SystemFile = systemFile;

            LastRun = DateTime.MinValue;
        }
开发者ID:dolittle,项目名称:Forseti,代码行数:7,代码来源:Suite.cs

示例6: Compile

        public string Compile(string source, IFile sourceFile)
        {
            lock (_lock)
            {
                rootDirectory = sourceFile.Directory;
                Initialize();

                StartRecordingOpenedFiles();
                dependentFileList.Add(sourceFile.FullPath);

                try
                {
                    var compilerOptions = GetCompilerOptions(sourceFile);
                    return (string)sassCompiler.compile(source, compilerOptions);
                }
                catch (Exception e)
                {
                    // Provide more information for SassSyntaxErrors
                    if (e.Message == "Sass::SyntaxError")
                    {
                        throw CreateSassSyntaxError(sourceFile, e);
                    }
                    else
                    {
                        throw;
                    }
                }
                finally
                {
                    StopRecordingOpenedFiles();
                }
            }
        }
开发者ID:ryansroberts,项目名称:cassette,代码行数:33,代码来源:SassCompiler.cs

示例7: SetUp

        public void SetUp()
        {
            _file = MockRepository.GenerateMock<IFile>();
            _recentActivities = new RecentActivities(_file);

            _recentActivities.Update(FIRST_ACTIVITY);
        }
开发者ID:archnaut,项目名称:sandbox,代码行数:7,代码来源:RecentActivitiesFixtures.cs

示例8: UncompressedPackage

        public UncompressedPackage(IPackageRepository source,
                                   IFile originalPackageFile,
                                   IDirectory wrapCacheDirectory)
        {
            Check.NotNull(source, "source");
            if (originalPackageFile == null || originalPackageFile.Exists == false)
            {
                IsValid = false;
                return;
            }
            _originalPackageFile = originalPackageFile;
            BaseDirectory = wrapCacheDirectory;
            // get the descriptor file inside the package

            Source = source;
            var wrapDescriptor = wrapCacheDirectory.Files("*.wrapdesc").SingleOrDefault();

            if (wrapDescriptor == null)
            {
                IsValid = false;
                return;
            }

            var versionFile = wrapCacheDirectory.GetFile("version");
            _descriptor = new PackageDescriptorReader().Read(wrapDescriptor);
            _semver = _descriptor.SemanticVersion ?? _descriptor.Version.ToSemVer();
            if (_semver == null)
                _semver = versionFile.Exists ? versionFile.ReadString().ToSemVer() : null;

            IsValid = string.IsNullOrEmpty(Name) == false && _semver != null;
            if (IsValid)
                Identifier = new PackageIdentifier(Name, _semver);
        }
开发者ID:simonlaroche,项目名称:openwrap,代码行数:33,代码来源:UncompressedPackage.cs

示例9: Compile

        public string Compile(string lessSource, IFile sourceFile)
        {
            Trace.Source.TraceInformation("Compiling {0}", sourceFile.FullPath);
            lock (engine)
            {
                currentFiles.Clear();

                var result = CompileImpl(lessSource, sourceFile);
                if (result.Css != null)
                {
                    Trace.Source.TraceInformation("Compiled {0}", sourceFile.FullPath);
                    return result.Css;
                }
                else
                {
                    var message = string.Format(
                        "Less compile error in {0}:\r\n{1}",
                        sourceFile.FullPath,
                        result.ErrorMessage
                    );
                    Trace.Source.TraceEvent(TraceEventType.Critical, 0, message);
                    throw new LessCompileException(message);
                }
            }
        }
开发者ID:JamesTryand,项目名称:cassette,代码行数:25,代码来源:LessCompiler.cs

示例10: ExploreFile

        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (psiFile.Language.Name != "CSHARP" && psiFile.Language.Name != "VBASIC")
                return;

            psiFile.ProcessDescendants(new XunitFileExplorer(provider, psiFile.GetSourceFile().ToProjectFile(), consumer, interrupted));
        }
开发者ID:Eskat0n,项目名称:ReSharper.XUnitTestRunner,代码行数:7,代码来源:XUnitTestFileExplorer.cs

示例11: Post

 public OperationResult Post(IFile file)
 {
     return new OperationResult.SeeOther
         {
             RedirectLocation = typeof(UploadedFile).CreateUri(new { id = this.ReceiveStream(file.ContentType, file.OpenStream()) })
         };
 }
开发者ID:endjin,项目名称:openrasta-stable,代码行数:7,代码来源:UploadedFileHandler.cs

示例12: ReplaceLegacyControlTags

        private static void ReplaceLegacyControlTags(IFile file)
        {
            var contents = file.Contents;

            var regex = new Regex
                (@"(<%@\s*?Register\s+?TagPrefix="")(.+?)(""\s+?Namespace="".+?""\s+?Assembly="")(Subtext.Web.Controls)(""\s*?%>)"
                , RegexOptions.IgnoreCase | RegexOptions.Multiline
                );

            var newContent = regex.Replace(contents, delegate(Match m)
            {
                if (m.Groups[2].Value.Equals("st", StringComparison.CurrentCultureIgnoreCase))
                {
                    return string.Empty;
                }
                var sb = new StringBuilder();

                sb.Append(m.Groups[1].Value);
                sb.Append(m.Groups[2].Value);
                sb.Append(m.Groups[3].Value);
                sb.Append("Subtext.Web");
                sb.Append(m.Groups[5].Value);

                return sb.ToString();
            });

            if (contents != newContent)
            {
                var stream = new StreamWriter(file.OpenWrite());
                stream.Write(newContent);
                stream.Close();
            }
        }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:33,代码来源:SkinUpgrader.cs

示例13: DecryptToStream

        public void DecryptToStream(IFile file, Stream outputStream)
        {
            if (file == null)
                throw new ArgumentNullException(nameof(file));
            if (outputStream == null)
                throw new ArgumentNullException(nameof(outputStream));

            //Read IV
            int ivSize = _encryptionProvider.BlockSize / 8;
            byte[] iv = new byte[ivSize];
            using (Stream fileData = file.Read())
            {
                fileData.Seek(0, SeekOrigin.Begin);
                fileData.Read(iv, 0, iv.Length);

                //Write decrypted data
                byte[] key = _key.GenerateBlock(_encryptionProvider.BlockSize);
                ICryptoTransform decryptor = _encryptionProvider.CreateDecryptor(key, iv);

                using (var cryptoStream = new CryptoStream(fileData, decryptor, CryptoStreamMode.Read))
                {
                    cryptoStream.CopyTo(outputStream);
                }
            }
        }
开发者ID:AdrianLThomas,项目名称:altCrypt,代码行数:25,代码来源:StreamEncryptor.cs

示例14: AddFile

        /// <summary>
        /// Adds a <see cref="IFile"/> to the current <see cref="IDirectory"/>.
        /// </summary>
        public void AddFile(IFile file)
        {
            if (_files.Contains(file)) return;

            file.Directory = this;
            _files.Add(file);
        }
开发者ID:jimmah,项目名称:tridion-less-tbb,代码行数:10,代码来源:VirtualDirectory.cs

示例15: Read

 public PackageDescriptor Read(IFile filePath)
 {
     if (!filePath.Exists)
         return null;
     IOException ioException = null;
     int tries = 0;
     while (tries < FILE_READ_RETRIES)
     {
         try
         {
             using (var fileStream = filePath.OpenRead())
             {
                 var descriptor = Read(fileStream);
                 if (descriptor.Name == null)
                     descriptor.Name = PackageNameUtility.GetName(filePath.NameWithoutExtension);
                 return descriptor;
             }
         }
         catch (IOException ex)
         {
             ioException = ex;
             tries++;
             Thread.Sleep(FILE_READ_RETRIES_WAIT);
             continue;
         }
     }
     throw ioException;
 }
开发者ID:adymitruk,项目名称:openwrap,代码行数:28,代码来源:PackageDescriptorReaderWriter.cs


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