v9.8.2018.0605   由DataReader直接映射实体列表,以支持netstandard的MySql和SQLite,且提升性能
大石头 authored at 2018-06-05 00:45:23
2.22 KiB
X
@using System.Diagnostics;
@using System.Collections;
@using System.Reflection;
@using System.Runtime.Versioning;
@using NewLife.Common;
@{
    Layout = NewLife.Cube.Setting.Current.Layout;

    ViewBag.Title = "进程模块";
    var Act = ViewBag.Act;

    var asm = Assembly.GetExecutingAssembly();
    var att = asm.GetCustomAttribute<TargetFrameworkAttribute>();
    var ver = att.FrameworkDisplayName ?? att.FrameworkName;

    var isAll = String.Equals("All", Request["Mode"], StringComparison.OrdinalIgnoreCase);

    var process = Process.GetCurrentProcess();
    var list = new List<ProcessModule>();
    foreach (ProcessModule item in process.Modules)
    {
        if (isAll || item.FileVersionInfo.CompanyName != "Microsoft Corporation") { list.Add(item); }
    }
}
<table class="table table-bordered table-hover table-striped table-condensed">
    <tr>
        <th colspan="7">
            进程模块(@process.ProcessName , PID=@process.Id )
            @if (!isAll)
                {
                <text>(<a href="?Mode=All">完整</a>,仅用户):</text>
                }
                else
                {
                <text>(完整,<a href="?Mode=OnlyUser">仅用户</a>):</text>
                }
        </th>
    </tr>
    <tr>
        <th>
            模块名称
        </th>
        <th>
            公司名称
        </th>
        <th>
            产品名称
        </th>
        <th>
            描述
        </th>
        <th>
            版本
        </th>
        <th>
            大小
        </th>
        <th>
            路径
        </th>
    </tr>
    @foreach (ProcessModule item in list)
    {
        <tr>
            <td>
                @item.ModuleName
            </td>
            <td>
                @item.FileVersionInfo.CompanyName
            </td>
            <td>
                @item.FileVersionInfo.ProductName
            </td>
            <td>
                @item.FileVersionInfo.FileDescription
            </td>
            <td>
                @item.FileVersionInfo.FileVersion
            </td>
            <td>
                @item.ModuleMemorySize
            </td>
            <td>
                @item.FileName
            </td>
        </tr>
    }
</table>