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


C# System.Files类代码示例

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


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

示例1: ResolutionAnalyzer

 public ResolutionAnalyzer(Files.LocatorFile file,
     int interpolationRange, int analyzedSamples)
 {         
     _file = file;
     _interpolationRange = interpolationRange;
     _analyzedSamples = analyzedSamples;
 }
开发者ID:worstward,项目名称:rlviewer,代码行数:7,代码来源:ResolutionAnalyzer.cs

示例2: GetFiles

        public IRestApiType GetFiles()
        {
            try
            {
                RestApiHelper client = new RestApiHelper()
                {
                    EndPoint = _GETUri,
                    Method = RestApiHelper.HttpVerb.GET,
                    GrantedToken = this.GrantedToken,
                    Parameters = "?list=true"
                };
                var json = client.SendRequest();
                var obj = JsonHelper.ParseJson<DropboxRestApiType.File>(json);

                // Convert DropboxRest File.Contents type to RestApi.Files type (IRestApiType)
                Files files = new Files();
                foreach (var f in obj.Contents)
                {
                    files.files.Add(
                        new RestApi.File()
                        {
                            id = f.Revision,
                            filename = f.Path.Replace("/", ""),
                            path = f.Path,
                            size = f.Size
                        }
                    );
                } 
                return files;
            }
            catch (Exception ex)
            {
                throw new Exception("Fail to get all documents, error: " + ExceptionHelper.ExtractAll(ex));
            }
        }
开发者ID:joshuatan,项目名称:CloudDocPicker,代码行数:35,代码来源:DropboxRestApi.cs

示例3: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                FilesBLL bll = new FilesBLL();
                Files f = new Files();
                int id;
                string filePath;
                string fileName;
                id = Convert.ToInt32(Request.QueryString["id"]);
                f.FUrl = bll.GetFileById(id).FUrl;
                f.FRName = bll.GetFileById(id).FRName;
                filePath = Server.MapPath(f.FUrl);//路径
                fileName = f.FRName;//客户端保存的文件名
                FileStream fs = new FileStream(filePath, FileMode.Open);
                byte[] bytes = new byte[(int)fs.Length];
                //以字符流的形式下载文件
                fs.Read(bytes, 0, bytes.Length);
                fs.Close();
                Response.ContentType = "application/octet-stream";
                //通知浏览器下载文件而不是打开
                Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8));
                Response.BinaryWrite(bytes);
                Response.Flush();
                Response.End();

            }
            catch (IOException)
            {

                throw;
            }
        }
开发者ID:Lanseria,项目名称:Limon-Studio,代码行数:33,代码来源:Downloading.aspx.cs

示例4: Create

 public override Behaviors.CrossAppCommunication.PointSharer.MulticastPointSharer Create(Files.LocatorFile file,
     Behaviors.CrossAppCommunication.ICrossAppExchange server, int guid)
 {
     var header = (Headers.Concrete.Rl8.Rl8Header)file.Header;
     return new Behaviors.CrossAppCommunication.PointSharer.MulticastPointSharer(server, guid,
         header.HeaderStruct.rlParams.sx, header.HeaderStruct.rlParams.sy);
 }
开发者ID:worstward,项目名称:rlviewer,代码行数:7,代码来源:Rl8PointSharerFactory.cs

示例5: Aligning

 public Aligning(Files.LocatorFile file, PointSelector.CompressedPointSelectorWrapper selector,
     Behaviors.ImageAligning.IInterpolationProvider rcsProvider,
     Behaviors.ImageAligning.Surfaces.SurfaceType surfaceType, int baseRadius, int layers, double lambda)
 {
     _file = file;
     _selector = selector;
     _surface = Factories.Surface.SurfaceFactory.CreateSurface(_selector, rcsProvider, surfaceType, baseRadius, layers, lambda);
 }
开发者ID:worstward,项目名称:rlviewer,代码行数:8,代码来源:Aligner.cs

示例6: CheckBaExt

        private static bool CheckBaExt(Files.LocatorFile file)
        {
            var rliInfo = file.Header.HeaderInfo.Where(x => x.HeaderName == "РГГ")
                .FirstOrDefault();

            string rhgName = rliInfo.Params.Where(x => x.Item1 == "Имя файла").FirstOrDefault().Item2;

            return Path.GetExtension(rhgName) == ".ba";
        }
开发者ID:worstward,项目名称:rlviewer,代码行数:9,代码来源:NavigationChanger.cs

示例7: HasBaRhgSource

        /// <summary>
        /// Checks if RLI has .ba RHG as its source
        /// </summary>
        /// <param name="rliFile">Rli to check</param>
        /// <returns></returns>
        public static bool HasBaRhgSource(Files.LocatorFile rliFile)
        {
            if (rliFile == null)
            {
                return false;
            }

            return CheckBaExt(rliFile);
        }
开发者ID:worstward,项目名称:rlviewer,代码行数:14,代码来源:NavigationChanger.cs

示例8: StatisticsForm

        public StatisticsForm(Files.LocatorFile file, Behaviors.AreaSelector.AreaSelector areaSelector)
        {
            InitializeComponent();
         
            var dgv = FormsHelper.GetDataGrid(this, "Параметр", "Значение");
            this.Controls.Add(dgv);

            var statsInfo = GetStatistics(file, areaSelector);
            ShowInfo(statsInfo, dgv);
        }
开发者ID:worstward,项目名称:rlviewer,代码行数:10,代码来源:StatisticsForm.cs

示例9: Open

        public static bool Open(Files file)
        {
            if (File.Exists(file.ToString() + ".pdf"))
            {
                Process.Start(file.ToString() + ".pdf");
                return true;
            }

            return false;
        }
开发者ID:BBraunRussia,项目名称:RegionalReport,代码行数:10,代码来源:MyFile.cs

示例10: CopyScript

        void CopyScript(string rootPath, Files.File scriptFile)
        {
            var target = rootPath + scriptFile;
            var script = scriptFile.ReadAllText();
				//File.ReadAllText(scriptFile);

            var dir = Path.GetDirectoryName(target);
            if (!Directory.Exists(dir))
                Directory.CreateDirectory(dir);

            File.WriteAllText(target, script, Encoding.ASCII);
        }
开发者ID:edgarbjorntvedt,项目名称:Forseti,代码行数:12,代码来源:PageGenerator.cs

示例11: AddLogMessage

 public static void AddLogMessage(DataType dataType, Files.FileOperationResult fileResult, bool isSave)
 {
     //自動バックアップを開始します
     //[読込]config : 成功 (2015/6/1 13:12:05)
     //[保存]config : 成功 (2015/6/1 13:12:07)
     //[保存]Material : 失敗 ErrorReason (2015/6/1 13:12:75)
     string mode = isSave ? "保存" : "読込";
     string issuccess = fileResult.IsSuccess ? "成功" : "失敗";
     string str = string.Format("[{0}]{1} : {2} {3} ({4})",
         mode, dataType.ToString(), issuccess,
         fileResult.ErrorReason, DateTime.Now.ToString());
     LogMessage.Add(str);
 }
开发者ID:CoRelaxuma,项目名称:HoppoAlpha,代码行数:13,代码来源:LogSystem.cs

示例12: ResampleImage

        public override byte[] ResampleImage(Files.LocatorFile file, System.Drawing.Rectangle area)
        {
            float[] image = new float[area.Width * area.Height];

            float[] imageArea = file.GetArea(area).ToArea<float>(file.Header.BytesPerSample);

            int toInclusiveX = area.Location.X + area.Width;
            toInclusiveX = toInclusiveX > file.Width ? file.Width : toInclusiveX;

            int toInclusiveY = area.Location.Y + area.Height;
            toInclusiveY = toInclusiveY > file.Height ? file.Height : toInclusiveY;
            int counter = 0;

            var rcsSolution = GetRcsSolution(area);
            var amplitudeSolution = GetAmplitudeSolution(area);

            Parallel.For(area.Location.X, toInclusiveX, (i, loopState) =>
            {
                for (int j = area.Location.Y; j < toInclusiveY; j++)
                {

                    var oldAmplVal = imageArea[(j - area.Y) * area.Width + (i - area.X)];
                    var newAmplVal = (float)amplitudeSolution[i - area.X, j - area.Y];
                    var newRcsVal = (float)rcsSolution[i - area.X, j - area.Y];
                    var diff = oldAmplVal / newAmplVal * newRcsVal;

                    diff = diff < 0 ? 0 : diff;
                    image[(j - area.Location.Y) * area.Width + (i - area.Location.X)] = diff;
                }

                System.Threading.Interlocked.Increment(ref counter);
                OnProgressReport((int)(counter / Math.Ceiling((double)(toInclusiveX - area.Location.X)) * 100));

                if (OnCancelWorker())
                {
                    loopState.Break();
                }

            });

            if (Cancelled)
            {
                return null;
            }

            byte[] imageB = new byte[image.Length * 4];

            Buffer.BlockCopy(image, 0, imageB, 0, imageB.Length);

            return imageB;
        }
开发者ID:worstward,项目名称:rlviewer,代码行数:51,代码来源:RbfSurface.cs

示例13: Create

 public static Behaviors.ImageMirroring.Abstract.ImageMirrorer Create(Files.LocatorFile sourceFile)
 {
     switch (sourceFile.Properties.Type)
     {
         case FileType.brl4:
             return new Behaviors.ImageMirroring.Concrete.Brl4ImageMirrorer(sourceFile);
         case FileType.rl4:
             return new Behaviors.ImageMirroring.Concrete.Rl4ImageMirrorer(sourceFile);
         case FileType.rl8:
             return new Behaviors.ImageMirroring.Concrete.Rl8ImageMirrorer(sourceFile);
         default:
             throw new NotImplementedException("Image mirrorer");
     }
 }
开发者ID:worstward,项目名称:rlviewer,代码行数:14,代码来源:ImageMirrorerFactory.cs

示例14: GetStatistics

        private IEnumerable<Tuple<string, string>> GetStatistics(Files.LocatorFile file, Behaviors.AreaSelector.AreaSelector areaSelector)
        {
            var maxSample = file.GetMaxSample(
                            new Rectangle(areaSelector.Area.Location.X, areaSelector.Area.Location.Y,
                            areaSelector.Area.Width, areaSelector.Area.Height));

            var minSample = file.GetMinSample(
                    new Rectangle(areaSelector.Area.Location.X, areaSelector.Area.Location.Y,
                    areaSelector.Area.Width, areaSelector.Area.Height));

            var maxSampleLoc = file.GetMaxSampleLocation(
                new Rectangle(areaSelector.Area.Location.X, areaSelector.Area.Location.Y,
                    areaSelector.Area.Width, areaSelector.Area.Height));

            var minSampleLoc = file.GetMinSampleLocation(
                new Rectangle(areaSelector.Area.Location.X, areaSelector.Area.Location.Y,
                    areaSelector.Area.Width, areaSelector.Area.Height));

            var avgSample = file.GetAvgSample(
                new Rectangle(areaSelector.Area.Location.X, areaSelector.Area.Location.Y,
                    areaSelector.Area.Width, areaSelector.Area.Height));


            List<Tuple<string, string>> statistics = new List<Tuple<string, string>>()
                {
                    new Tuple<string, string>("Имя файла", System.IO.Path.GetFileName(file.Properties.FilePath)),
                    new Tuple<string, string>("X1", areaSelector.Area.Location.X.ToString()),
                    new Tuple<string, string>("Y1", areaSelector.Area.Location.Y.ToString()),
                    new Tuple<string, string>("X2", (areaSelector.Area.Location.X + areaSelector.Area.Width).ToString()),
                    new Tuple<string, string>("Y2", (areaSelector.Area.Location.Y + areaSelector.Area.Height).ToString()),
                    new Tuple<string, string>("Ширина фрагмента", areaSelector.Area.Width.ToString()),
                    new Tuple<string, string>("Высота фрагмента", areaSelector.Area.Height.ToString()),
                    new Tuple<string, string>("Максимальная амплитуда", maxSample.ToString()),
                    new Tuple<string, string>("Xmax", maxSampleLoc.X.ToString()),
                    new Tuple<string, string>("Ymax", maxSampleLoc.Y.ToString()),
                    new Tuple<string, string>("Минимальная амплитуда", minSample.ToString()),
                    new Tuple<string, string>("Xmin", minSampleLoc.X.ToString()),
                    new Tuple<string, string>("Ymin", minSampleLoc.Y.ToString()),
                    new Tuple<string, string>("Средняя амплитуда", avgSample.ToString())
                };

            return statistics;
        }
开发者ID:worstward,项目名称:rlviewer,代码行数:43,代码来源:StatisticsForm.cs

示例15: GetFactory

 public static AreaSizeCalcFactory GetFactory(Files.FileProperties properties)
 {
     switch (properties.Type)
     {
         case FileType.brl4:
             return new Concrete.Brl4SizeCalcFactory();
         case FileType.rl4:
             return new Concrete.Rl4SizeCalcFactory();
         case FileType.raw:
             return new Concrete.RawSizeCalcFactory();
         case FileType.r:
             return new Concrete.RSizeCalcFactory();
         case FileType.k:
             return new Concrete.KSizeCalcFactory();
         case FileType.rl8:
             return new Concrete.Rl8SizeCalcFactory();
         default:
             throw new NotSupportedException("Unsupported file format");
     }
 }
开发者ID:worstward,项目名称:rlviewer,代码行数:20,代码来源:AreaSizeCalcFactory.cs


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