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


C# FileInfoBase.Delete方法代码示例

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


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

示例1: SmartDeleteFile

 private void SmartDeleteFile(FileInfoBase fileToDelete)
 {
     TryFileFuncAndMoveFileOnFailure(() =>
     {
         fileToDelete.Delete();
         return null;
     }, fileToDelete.FullName);
 }
开发者ID:kostrse,项目名称:KuduSync.NET,代码行数:8,代码来源:KuduSync.cs

示例2: CreateFileDeleteResponse

 protected virtual Task<HttpResponseMessage> CreateFileDeleteResponse(FileInfoBase info)
 {
     // Generate file response
     try
     {
         using (Stream fileStream = GetFileDeleteStream(info))
         {
             info.Delete();
         }
         HttpResponseMessage successResponse = Request.CreateResponse(HttpStatusCode.OK);
         return Task.FromResult(successResponse);
     }
     catch (Exception e)
     {
         // Could not delete the file
         Tracer.TraceError(e);
         HttpResponseMessage notFoundResponse = Request.CreateErrorResponse(HttpStatusCode.NotFound, e);
         return Task.FromResult(notFoundResponse);
     }
 }
开发者ID:jeddawson,项目名称:kudu,代码行数:20,代码来源:VfsControllerBase.cs

示例3: Remux


//.........这里部分代码省略.........
                var name2 = name + ".stage2" + outputFile.Extension;
                var workingAreaStage1File = fileSystem.FileInfo.FromFileName(fileSystem.Path.Combine(workingArea.FullName, name1));
                var workingAreaStage2File = fileSystem.FileInfo.FromFileName(fileSystem.Path.Combine(workingArea.FullName, name2));

                // Working variables.
                var maps = new StringBuilder();
                var codecs = new StringBuilder();
                var outputStreamIndex = 0;

                // Copy video streams.
                var h264 = videoStreams.Where(stream => stream.Codec == MediaStreamsExtractor.CodecType.H264).ToList();
                if(h264.Any())
                {
                    h264.Where(stream => stream.Codec == MediaStreamsExtractor.CodecType.H264).ToList().ForEach(stream => MakeCopyStream(stream, maps, codecs, outputStreamIndex++));
                }
                else
                {
                    LogError("Unable to find h264 stream. Will not remux.");
                    return;
                }

                // Copy or transcode aac 2 channel audio streams.
                var acc2Channel = audioStreams.Where(stream => stream.Codec == MediaStreamsExtractor.CodecType.AAC && stream.Channels == 2).ToList();
                if(acc2Channel.Any())
                {
                    acc2Channel.ForEach(stream => MakeCopyStream(stream, maps, codecs, outputStreamIndex++));
                }
                else
                {
                    // Transcode aac 2 channel audio stream from all available audio streams.
                    audioStreams.ForEach(stream =>
                    {
                        maps.AppendFormat(" -map 0:{0} ", stream.Id);
                        codecs.AppendFormat(" -c:{0} aac -ac:a 2 ", outputStreamIndex++);
                    });
                }

                // Copy or transcode higher quality audio stream if possible.
                var ac36Channel = audioStreams.Where(stream => stream.Codec == MediaStreamsExtractor.CodecType.AC3 && stream.Channels == 6).ToList();
                var dts = audioStreams.Where(stream => stream.Codec == MediaStreamsExtractor.CodecType.DTS).ToList();

                // Copy ac3 6 channel streams if exists.
                if(ac36Channel.Any())
                {
                    ac36Channel.ForEach(stream => MakeCopyStream(stream, maps, codecs, outputStreamIndex++));
                }
                else if(dts.Any())
                {
                    // Transcode ac3 6 channel audio streams from dts streams.
                    dts.ForEach(stream =>
                    {
                        maps.AppendFormat(" -map 0:{0} ", stream.Id);
                        codecs.AppendFormat(" -c:{0} ac3 -ac:a 6 ", outputStreamIndex++);
                    });
                }

                // Copy dts streams if exists.
                dts.ForEach(stream => MakeCopyStream(stream, maps, codecs, outputStreamIndex++));

                // Transcode in subtitles if exists.
                subtitleStreams.ForEach(stream =>
                {
                    maps.AppendFormat(" -map 0:{0} ", stream.Id);
                    codecs.AppendFormat(" -c:{0} mov_text ", outputStreamIndex++);
                });

                // Mov atom detils.
                var movFlags = "";
                if(string.Compare(outputFile.Extension, ".m4v", System.StringComparison.OrdinalIgnoreCase)==0
                   || string.Compare(outputFile.Extension, ".mp4", System.StringComparison.OrdinalIgnoreCase)==0)
                {
                    movFlags = " -movflags faststart ";
                }

                // Remux.
                var remuxArguments = string.Format("-i \"{0}\" -y -strict experimental {1} {2} {3} \"{4}\"", inputFile.FullName, maps, codecs, movFlags, workingAreaStage1File.FullName);
                LogOutput("Running FFmpeg with arguments {0}", remuxArguments);
                External.Run(External.Application.FFmpeg, remuxArguments, StdOut, StdErr);

                // Optimise tracks.
                var sublerArguments = string.Format ("-source \"{0}\" -dest \"{1}\" -optimize -itunesfriendly", workingAreaStage1File.FullName, workingAreaStage2File.FullName);
                LogOutput("Running Subler to optimize track with arguments {0}", sublerArguments);
                External.Run(External.Application.SublerCLI, sublerArguments, StdOut, StdErr);

                // Delete stage1 file.
                LogOutput("Deleting workingAreaFile1 {0}", workingAreaStage1File.FullName);
                workingAreaStage1File.Delete();

                // Delete output file if it already exists.
                if(outputFile.Exists)
                {
                    LogOutput("Output file {0} already exists. Will delete.", outputFile.FullName);
                    outputFile.Delete();
                }

                // Move stage 2 file to output file location.
                LogOutput("Moving newly created remux file {0} to output file location {1}.", workingAreaStage2File.FullName, outputFile.FullName);
                workingAreaStage2File.MoveTo(outputFile.FullName);
            };
        }
开发者ID:dipeshc,项目名称:MediaPod,代码行数:101,代码来源:Remux.cs


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