项目需求

asp.net core 读取log目录下的.log文件,.log文件的内容如下:

xxx.log

------------------------------------------begin---------------------------------
写入时间:2018-09-11 17:01:48
userid=1000
golds=10
-------------------------------------------end---------------------------------

一个 begin end 为一组,同一个.log文件里 userid 相同的,取写入时间最大一组值,所需结果如下:

UserID   Golds   RecordDate
1001 20 2018/9/11 17:10:48
1000 20 2018/9/11 17:11:48
1003 30 2018/9/11 17:12:48
1002 10 2018/9/11 18:01:48 1001 20 2018/9/12 17:10:48
1000 30 2018/9/12 17:12:48
1002 10 2018/9/12 18:01:48

项目结构

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPEAAAEjCAIAAABsKHDOAAAejklEQVR4nO2d/28exZnA+3+UAlG967yOY+IkxElKwRWXlEvgfYE6nCqCQigQJ6Wo131R6QlHdy2lJik0VaxtlAoqKp1bGdtKhLa4vnAG5J7StGpLtT1ZpzuVtm9MRBDqm+/xF3w/zH55ZnZmd9/ddWZn/FgfRW/23Z3dd97Pzju7O888nzIME0F04lPSjwBBigWdRnQDnUZ0A51GdIN1ejr1n/RDRxAu6DSiG4U7XXeajhW+hn+uXeVsUrVdx4o7RMtpunYt/mOkWWdZqNqu4HPx1oGVc6Op2m4zfu8W/XWRP6cufEv8ncqF43Sl0pmIyOmq7fqflRhWs11SjzXbde0qx+BEpw2j7kTrLthT63VtOa5d9f71y/e/wYQjicBxukYdmWtXUzttOU3H8v6N2WnVdj3VfNuSD7tqu03Hhhv6e2yynz34ygCWw2zor+l9dmltCo9Cna7arlOnK6XuuHaVqim/IninPqlWYaMAGw9vX55DzJcKfI1CDik4sLoT/3W2DOd4wl3HOU32nnQMVdsNq7TZdB1HuDuwSVMsX1Agp5nwjyTJafq1ZBKcbjdXt5urV69ek8Zpi+1q1EgNesuDSgl1NA3QTnObcNHZn9BMN8XNBvl6gi8pVKQosjpNqoWuHG4l04XH7M4vlmrIa7ZLVw50mqoKcHal6XvwvZcA6/Sjjz7abq4OhB564rVT3z3z5D3fCBbG9j3qT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idppSNf7Bs8ka7aBLUKzTwtoANlsw6LjJfszkcExA7kgzOU7Li8JK058WBV8lOS0Mu4pk6OJ3CUAgVqoAMCZZY5MTl97ajpjlMbVhVm3Xdb0eCHnNnk5UwBunotgyi4s0k+O0vCisdNeI/KucRKdNeHFDX83UbJcJ7koIxEoRAMYmawzL514jinbEXx5fG/Q8UtTNzbCT5joOv53mlllcpBmO90B0A51GdAOdRnQDnUZ0A51GdAOdRnQDnUZ0A51GdCOv02UJV0EQn7xOlygKC0EM08jvdLMcUViazTaL5KEAp+VFYS1/MBWiIAU4bUiLwlr+YCpEQYpx2pAThZUtmIoQLIeD0SKbc4ak1Z2ma1vecj/MJDKwnd1LlhgkJBvFOC0pCitrMJVw0HAkOIoThgSMJzaHk/JHE3DlikFCslGA0xKjsMJGsKVgKmFwB2fIeaRlhbF0otfcvZt6Z7sqD8Xc95AUhZU1mCql0/wwpDxOhweJZi8feZ2WGoWVOZgqru/BPSVAGFKS0ys121V5yOu01CisHMFUYZcieo1IlRYJQ0rv9MrKdlUecLwHpqHXjZXpdM12BfdGEPVZmU5TN55RaM1YqU4j+oJOI7qBTiO6gU4juoFOI7qBsVuIbmDsFqIb6sZumfC5N46dQALUjd1ixiEJ5oRNAMcSaYiysVtVf2J6CnQaUTh2i5prPlgSBgkYiQmgXCqoAAahsEkb4js5GKBVLtSN3QoCAdnp+EN9kxNAgfXFTlM5JTBAq/SoG7vl4TWK3nBkti+RkAAqndOidBOGgQFaZUTd2C1I0A9hHE1KALUsTodrotlSUDZ2q2q7YahIEG/CpldLSgDFOO0pyKwfxKSEyzFAq8SoG7sF+xV0+qlmmLo4Enkl6Jy4dhUUyK7vOHQHBgO0Sg2O94gH21r1QKfjQafVA52OB51WD3Qa0Q10GtENdBrRDXQa0Q10GtGN/wevzdqy6YyGYgAAAABJRU5ErkJggg==" alt="" />

Snai.File.FileOperation  Asp.net core 2.0 网站

项目实现

新建Snai.File解决方案,在解决方案下新建一个名Snai.File.FileOperation Asp.net core 2.0 空网站

把log日志文件拷备到项目下

修改Startup类的ConfigureServices()方法,注册访问本地文件所需的服务,到时在中间件中通过构造函数注入添加到中间件,这样就可以在一个地方控制文件的访问路径(也就是应用程序启动的时候)

public void ConfigureServices(IServiceCollection services)
{
  services.AddSingleton<IFileProvider>(new PhysicalFileProvider(Directory.GetCurrentDirectory()));
}

新建 Middleware 文件夹,在 Middleware下新建 Entity 文件夹,新建 UserGolds.cs 类,用来保存读取的日志内容,代码如下

namespace Snai.File.FileOperation.Middleware.Entity
{
    public class UserGolds
    {
        public UserGolds()
        {
            RecordDate = new DateTime(1970, 01, 01);
            UserID = 0;
            Golds = 0;
        }         public DateTime RecordDate { get; set; }
        public int UserID { get; set; }
        public int Golds { get; set; }
    }
}

在 Middleware 下新建 FileProviderMiddleware.cs 中间件类,用于读取 log 下所有日志文件内容,并整理成所需的内容格式,代码如下

namespace Snai.File.FileOperation.Middleware
{
    public class FileProviderMiddleware
    {
        private readonly RequestDelegate _next;
        private readonly IFileProvider _fileProvider;         public FileProviderMiddleware(RequestDelegate next, IFileProvider fileProvider)
        {
            _next = next;
            _fileProvider = fileProvider;
        }         public async Task Invoke(HttpContext context)
        {
            var output = new StringBuilder("");
            //ResolveDirectory(output, "", "");
            ResolveFileInfo(output, "log", ".log");             await context.Response.WriteAsync(output.ToString());
        }         //读取目录下所有文件内容
        private void ResolveFileInfo(StringBuilder output, string path, string suffix)
        {
            output.AppendLine("UserID    Golds    RecordDate");             IDirectoryContents dir = _fileProvider.GetDirectoryContents(path);
            foreach (IFileInfo item in dir)
            {
                if (item.IsDirectory)
                {
                    ResolveFileInfo(output,
                        item.PhysicalPath.Substring(Directory.GetCurrentDirectory().Length),
                        suffix);
                }
                else
                {
                    if (item.Name.Contains(suffix))
                    {
                        var userList = new List<UserGolds>();
                        var user = new UserGolds();                         IFileInfo file = _fileProvider.GetFileInfo(path + "\\" + item.Name);                         using (var stream = file.CreateReadStream())
                        {
                            using (var reader = new StreamReader(stream))
                            {
                                string content = reader.ReadLine();                                 while (content != null)
                                {
                                    if (content.Contains("begin"))
                                    {
                                        user = new UserGolds();
                                    }
                                    if (content.Contains("写入时间"))
                                    {
                                        DateTime recordDate;
                                        string strRecordDate = content.Substring(content.IndexOf(":") + 1).Trim();
                                        if (DateTime.TryParse(strRecordDate, out recordDate))
                                        {
                                            user.RecordDate = recordDate;
                                        }
                                    }                                     if (content.Contains("userid"))
                                    {
                                        int userID;
                                        string strUserID = content.Substring(content.LastIndexOf("=") + 1).Trim();
                                        if (int.TryParse(strUserID, out userID))
                                        {
                                            user.UserID = userID;
                                        }
                                    }                                     if (content.Contains("golds"))
                                    {
                                        int golds;
                                        string strGolds = content.Substring(content.LastIndexOf("=") + 1).Trim();
                                        if (int.TryParse(strGolds, out golds))
                                        {
                                            user.Golds = golds;
                                        }
                                    }                                     if (content.Contains("end"))
                                    {
                                        var userMax = userList.FirstOrDefault(u => u.UserID == user.UserID);
                                        if (userMax == null || userMax.UserID <= 0)
                                        {
                                            userList.Add(user);
                                        }
                                        else if (userMax.RecordDate < user.RecordDate)
                                        {
                                            userList.Remove(userMax);
                                            userList.Add(user);
                                        }
                                    }                                     content = reader.ReadLine();
                                }
                            }
                        }                         if (userList != null && userList.Count > 0)
                        {
                            foreach (var golds in userList.OrderBy(u => u.RecordDate))
                            {
                                output.AppendLine(golds.UserID.ToString() + "    " + golds.Golds + "    " + golds.RecordDate);
                            }                             output.AppendLine("");
                        }
                    }
                }
            }
        }         //读取目录下所有文件名
        private void ResolveDirectory(StringBuilder output, string path, string prefix)
        {
            IDirectoryContents dir = _fileProvider.GetDirectoryContents(path);
            foreach (IFileInfo item in dir)
            {
                if (item.IsDirectory)
                {
                    output.AppendLine(prefix + "[" + item.Name + "]");                     ResolveDirectory(output,
                        item.PhysicalPath.Substring(Directory.GetCurrentDirectory().Length),
                        prefix + "    ");
                }
                else
                {
                    output.AppendLine(path + prefix + item.Name);
                }
            }
        }
    }     public static class UseFileProviderExtensions
    {
        public static IApplicationBuilder UseFileProvider(this IApplicationBuilder app)
        {
            return app.UseMiddleware<FileProviderMiddleware>();
        }
    }
}

上面有两个方法 ResolveFileInfo()和ResolveDirectory()

ResolveFileInfo()  读取目录下所有文件内容,也就是需求所用的方法

ResolveDirectory() 读取目录下所有文件名,是输出目录下所有目录和文件名,不是需求所需但也可以用

修改Startup类的Configure()方法,在app管道中使用文件中间件服务

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
  if (env.IsDevelopment())
  {
    app.UseDeveloperExceptionPage();
  }   app.UseFileProvider();
  
  app.Run(async (context) =>
  {
    await context.Response.WriteAsync("Hello World!");
  });
}

到此所有代码都已编写完成

启动运行项目,得到所需结果,页面结果如下

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAARUAAAEJCAIAAAA1mCRVAAAgAElEQVR4nO2d21MbV57H9ee4ylXwsLVVO7WzVVtb+7JP64dlZmcopWZ3bjuZndTW7gyViWOMsY0tOw7OODFxLo7jOA7GMgjbYHMxxgiDuISruAsQQiAkJO4BJCbRPrTU3ef0Oae7D+puNfw+9Xuwm+5zfjrnfPtc+vSvHVt734OBgfGZI7p1AAYGxmegHzAwfnOsbB2AgYHxmWNl80CXBaM7k6HEcGBlaGa5f3Kxf3JxaGZ5OLAyGUoEozt6UwMDs7U5IpsHWiy8npwIJfonw4MzkanwejC2E07sLW+kljdS4cReMPbdVHh9KBDpm1ycCCXC60mNyYKB2do06WcqvN4/FR4LrobX9tjd2fJ6cmIh3jcZnggllkBFYEfdVPQTXk8OBSLDsyuqypFbeG1vdD42FIgsru1b/gvBwIwzx/LmAc2Cq9/1Ty9NhBLLm6nI1oEuW95MTYTWGl8Pe9oGHr8aAgM7kuZY3jggWiix3zuxOBVeP4w6A8ubw9OLe/vJvwLAUYSqn8GZyPhC/PAd3MRCYjK48v3336cB4MjhWNo4UNp4aG1gJrK8kcrJGHFoNroUXTfC+1gsZkSyAKARgn4WEvs944uh+J4WbfhGAr3+OfY5i4n9ganwXvKvOffe7/fnPE0A0A5B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AgB/QDwDwA/oBAH5APwDAD+gHAPgB/QAAP6AfAOAH9AMA/IB+AIAf0A8A8AP6AQB+QD8AwM//A53KxJSBg9KbAAAAAElFTkSuQmCC" alt="" />

Github源码地址:https://github.com/Liu-Alan/Snai.File

博客地址:http://snaill.net/post/7

.net core 读取本地指定目录下的文件的更多相关文章

  1. iOS案例:读取指定目录下的文件列表

    // // main.m // 读取指定目录下的文件列表 // // Created by Apple on 15/11/24. // Copyright © 2015年 Apple. All rig ...

  2. socket实现两台FTP服务器指定目录下的文件转移(不依赖第三方jar包)

    通过socket实现两台FTP服务器指定目录下的文件转移,其中包含了基础了ftp文件列表显示.上传和下载.这里仅供学习用,需掌握的点有socket.ftp命令.文件流读取转换等 完整代码如下: Ftp ...

  3. python实现指定目录下批量文件的单词计数:并发版本

    在 文章 <python实现指定目录下批量文件的单词计数:串行版本>中, 总体思路是: A. 一次性获取指定目录下的所有符合条件的文件 -> B. 一次性获取所有文件的所有文件行 - ...

  4. linux find-在指定目录下查找文件

    推荐:更多Linux 文件查找和比较 命令关注:linux命令大全 find命令用来在指定目录下查找文件.任何位于参数之前的字符串都将被视为欲查找的目录名.如果使用该命令时,不设置任何参数,则find ...

  5. PHP 获取指定目录下所有文件(包含子目录)

    PHP 获取指定目录下所有文件(包含子目录) //glob — 寻找与模式匹配的文件路径 $filter_dir = array('CVS', 'templates_c', 'log', 'img', ...

  6. PHP 批量获取指定目录下的文件列表(递归,穿透所有子目录)

    //调用 $dir = '/Users/xxx/www'; $exceptFolders = array('view','test'); $exceptFiles = array('BaseContr ...

  7. 文件名命工具类(将指定目录下的文件的type类型的文件,进行重命名,命名后的文件将去掉type)

    import java.io.File; /** * <b>function:</b> 文件命名工具类 * @author hoojo * @createDate 2012-5 ...

  8. linux --> 删除指定目录下所有文件

    删除指定目录下所有文件 代码样例: ///////////////////////////////////////////////////// //Name: DeleteFile //Purpose ...

  9. C# 获取指定目录下所有文件信息

    /// <summary> /// 返回指定目录下所有文件信息 /// </summary> /// <param name="strDirectory&quo ...

随机推荐

  1. 学习C++50条忠告

    1.把C++当成一门新的语言学习: 2.看<Thinking In C++>,不要看<C++变成死相>: 3.看<The C++ Programming Language ...

  2. c语言定义函数指针和typedef简写

    二种方法来定义函数指针 #include<stdio.h> #include<stdlib.h> #include<Windows.h> int add(int a ...

  3. maven打包部署到私服

    转载地址:http://blog.csdn.net/stormragewang/article/details/43407471 心得 apache的开源maven插件对我们使用maven进行打包,发 ...

  4. Spring框架的Bean管理的配置文件方式

    1. id属性和name属性的区别 * id -- Bean起个名字,在约束中采用ID的约束,唯一 * 取值要求:必须以字母开始,可以使用字母.数字.连字符.下划线.句话.冒号 id:不能出现特殊字符 ...

  5. 3D文件压缩库——Draco简析

    3D文件压缩库——Draco简析 今年1月份时,google发布了名为“Draco”的3D图形开源压缩库,下载了其代码来看了下,感觉虽然暂时用不到,但还是有前途的,故简单做下分析. 注:Draco 代 ...

  6. vue2.0 element学习

    1,bootstrap和vue2.0结合使用 vue文件搭建好后,引入jquery和bootstrap 我采用的方式为外部引用 在main.js内部直接导入 用vue-cli直接安装jquery和bo ...

  7. 在 Microsoft Dynamics 365 Online中如何调试Plugins in

    How to debug plugins in Microsoft Dynamics 365 Online 调试方式请查阅https://www.linkedin.com/pulse/how-debu ...

  8. Java WebService 知识点汇总

    java webservice 获取传入IP axis.jar    servlet.jar MessageContext mMsgContext = MessageContext.getCurren ...

  9. Loadrunner12.5-同一个网址通过vugen不能打开,但是直接在ie11中就可以打开

    一:录制选项修改成“WinINet级别数据”,重新录制就可以成功打开网页了. 注:运行时设置--首选项--高级--“使用WinINet回放而非套接字(仅限Windows)”需要勾选上:否则录制脚本结束 ...

  10. iOS.AddFont

    为iOS App 添加定制字体 http://www.developers-life.com/how-to-include-ttf-fonts-to-ios-app.html http://blog. ...