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


C# FileInfo.Where方法代码示例

本文整理汇总了C#中System.IO.FileInfo.Where方法的典型用法代码示例。如果您正苦于以下问题:C# FileInfo.Where方法的具体用法?C# FileInfo.Where怎么用?C# FileInfo.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.FileInfo的用法示例。


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

示例1: recuperaNomeDoArquivo

        private static string recuperaNomeDoArquivo(string identificadorImagem, FileInfo[] arquivos)
        {
            var arquivosComIdentificador =
                arquivos.Where(fi => fi.Name.Contains(identificadorImagem));

            if (arquivosComIdentificador.ToList<FileInfo>().Count == 0) {
                throw new Exception(String.Format(
                    "Nenhum arquivo com o identificador {0} no nome. Não consigo identificar qual deve receber os metadados.",
                    identificadorImagem));
            }

            if (arquivosComIdentificador.ToList<FileInfo>().Count > 1) {
                throw new Exception(String.Format(
                    "Mais de um arquivo com o identificador {0} no nome. Não consigo identificar qual deve receber os metadados.",
                    identificadorImagem));
            }

            return arquivosComIdentificador.ToList<FileInfo>()[0].Name;
        }
开发者ID:eliassouza,项目名称:Imago,代码行数:19,代码来源:Processador.cs

示例2: ShowFileParsingInfo

        private static void ShowFileParsingInfo(ITextExtractor textExtractor, FileInfo[] files)
        {
            PrintFilesList("Found the following files:", files);

            var timer = new Stopwatch();
            timer.Start();
            var parsableFiles = files.Where(f => textExtractor.IsParseable(f.FullName)).ToArray();
            timer.Stop();
            Console.WriteLine("{0}{0}Processed in {1}{0}{0}", Environment.NewLine, timer.Elapsed);

            PrintFilesList("Parsable files:", parsableFiles);

            var unparsableFiles = files.Where(f => textExtractor.IsParseable(f.FullName) == false).ToArray();
            PrintFilesList("Unparsable files:", unparsableFiles);
        }
开发者ID:JoakimBrannstrom,项目名称:TextExtractor,代码行数:15,代码来源:Program.cs

示例3: CompileWMSETfile

 private void CompileWMSETfile(FileInfo[] sections, string countyLiteral)
 {
     byte[] buffer = new byte [sections.Sum(fi => (int) fi.Length) + 49*4];
     uint[] sizes = new uint[48];
     for (int i = 1; i <= 48; i++)
     {
         int i1 = i;
         FileInfo[] f =
             sections.Where(a => Path.GetFileName(a.FullName) == $"wmset{countyLiteral}.Section{i1}").ToArray();
         sizes[i - 1] = (uint) f[0].Length;
         uint globalLocation = 49*4;
         for (int k = 0; k != i-1; k++)
             globalLocation += sizes[k];
         byte[] temp = BitConverter.GetBytes(globalLocation);
         Array.Copy(temp, 0, buffer,(i-1)*4, 4);
         temp = File.ReadAllBytes(f[0].FullName);
         Array.Copy(temp, 0, buffer, globalLocation, temp.Length);
     }
     SaveFileDialog sfd = new SaveFileDialog
     {
         Filter = $"wmset{countyLiteral}.obj|wmset{countyLiteral}.obj",
         Title = $"Save compiled wmset{countyLiteral} file!"
     };
     if (sfd.ShowDialog() == DialogResult.OK) File.WriteAllBytes(sfd.FileName, buffer);
     else return;
     Console.WriteLine($"WMSET: Succesfully saved {sfd.FileName} file");
 }
开发者ID:MaKiPL,项目名称:FF8-Rinoa-s-Toolset,代码行数:27,代码来源:SharpGLForm.cs


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