コード例 #1
0
        /// <summary>
        /// 将DataSource转换为Bcp格式的文件保存,返回保存的文件名(C:\data\137-673536061-510000-010000-1499824452-00001.zip)
        /// </summary>
        /// <param name="dataPool"></param>
        /// <param name="destPath">目标文件夹,比如C:\data\</param>
        public string ConverterToBcpFile(DataReportPluginArgument arg, string destPath)
        {
            List <BcpTable> lstBcpTable = ReadAndFilterBcpConfigure(arg.DataPool);
            DataSet         ds          = new DataSet();

            ds.Tables.AddRange(ConvertToBasicTable(arg));   //添加基本信息表

            foreach (var bcpTable in lstBcpTable)
            {
                IDataSource dataSource = arg.DataPool.FirstOrDefault(im => im.PluginInfo.Name.Trim() == bcpTable.AppName.Trim());

                try
                {
                    List <BcpNode> lstBcpNodes = new List <BcpNode>();
                    var            xml         = CreateXmlTree(dataSource, lstBcpNodes); //创建xml树形结构,并将数据集转换为Datatable
                    DataTable      dt          = BulidBcpTable(bcpTable, lstBcpNodes, xml);
                    if (dt != null)
                    {
                        if (!ds.Tables.Contains(dt.TableName))
                        {
                            ds.Tables.Add(dt);
                        }
                        else
                        {
                            ds.Tables[dt.TableName].Merge(dt);      //如果已经存在该表则合并,比如将QQ的好友列表和微信的好友列表合并为一张表
                        }
                    }
                }
                catch
                {
                }
            }

            return(SaveBcpTables(ds, destPath));
        }
コード例 #2
0
ファイル: BcpReportPlugin.cs プロジェクト: uvbs/M_Y_P_F_P_R_O
 protected override void Initialize(DataReportPluginArgument arg, IAsyncTaskProgress progress)
 {
     if (!Directory.Exists(arg.ReportPath))
     {
         Directory.CreateDirectory(arg.ReportPath);
     }
 }
コード例 #3
0
        protected override void Initialize(DataReportPluginArgument arg, IAsyncTaskProgress progress)
        {
            DataReportPluginInfo plugin = (DataReportPluginInfo)PluginInfo;

            if (plugin.Modules.Count == 0)
            {
                throw new Exception("Modules is null");
            }
            _module = plugin.Modules.FirstOrDefault(m => m.Name == arg.ReportModuleName) ?? plugin.Modules[0]; //默认使用第一个模板
            if (!Directory.Exists(arg.ReportPath))
            {
                Directory.CreateDirectory(arg.ReportPath);
            }
            BaseUtility.Helper.FileHelper.CopyDirectory(_module.ZipTempDirectory, arg.ReportPath);      //拷贝模板文件目录
        }
コード例 #4
0
ファイル: BcpReportPlugin.cs プロジェクト: uvbs/M_Y_P_F_P_R_O
 protected override string ExportCompleted(DataReportPluginArgument arg, IAsyncTaskProgress progress)
 {
     return(_bcpPath);
 }
コード例 #5
0
ファイル: BcpReportPlugin.cs プロジェクト: uvbs/M_Y_P_F_P_R_O
 protected override void ExportData(DataReportPluginArgument arg, IAsyncTaskProgress progress)
 {
     _bcpPath = new DataSourceToBcpConverter().ConverterToBcpFile(arg, arg.ReportPath);
 }
コード例 #6
0
 protected override string ExportCompleted(DataReportPluginArgument arg, IAsyncTaskProgress progress)
 {
     return(Path.Combine(arg.ReportPath, _module.MainFile ?? ""));
 }
コード例 #7
0
 protected override void ExportFile(DataReportPluginArgument arg, IAsyncTaskProgress progress)
 {
 }
コード例 #8
0
 protected override void ExportData(DataReportPluginArgument arg, IAsyncTaskProgress progress)
 {
     new DataSourceToJsonConverter().ConverterToJsonFile(arg, Path.Combine(arg.ReportPath, "data"));    //在data目录下生成json文件
 }
コード例 #9
0
 /// <summary>
 /// 将DataSource转换为Json格式的文件保存
 /// </summary>
 /// <param name="dataPool"></param>
 /// <param name="destPath">目标文件夹,比如C:\data\</param>
 public void ConverterToJsonFile(DataReportPluginArgument arg, string destPath)
 {
     CreateDeviceInfo(arg.DeviceInfo, destPath);
     CreateCollectionInfo(arg.CollectionInfo, destPath);
     CreateJson(arg.DataPool, destPath);
 }
コード例 #10
0
        /// <summary>
        /// 生成BCP包所需的采集信息表和设备信息表
        /// </summary>
        /// <param name="info"></param>
        /// <param name="device"></param>
        /// <returns></returns>
        private DataTable[] ConvertToBasicTable(DataReportPluginArgument arg)
        {
            string departNo         = arg.CollectionInfo?.CollectLocationCode ?? "";
            string principalNo      = arg.CollectionInfo?.CollectorCertificateCode.GetStrictLength(6, '0') ?? "";
            string acqtime          = arg.CollectionInfo?.CollectTime ?? "";
            string manufacturerCode = arg.CollectionInfo?.ManufacturerCode ?? "";
            string imei             = arg.DeviceInfo?.IMEI ?? "";

            _acquisitionTargetNumber = $"{departNo}{principalNo}{acqtime}{manufacturerCode}{imei}".GetStrictLength(57, '0');    //采集目标编号,唯一

            List <DataTable> tables = new List <DataTable>();

            if (arg.CollectionInfo != null)
            {
                var       info      = arg.CollectionInfo;
                DataTable infoTable = new DataTable();
                infoTable.TableName = "WA_MFORENSICS_010100";
                infoTable.Columns.Add("I050008");
                infoTable.Columns.Add("C010010");
                infoTable.Columns.Add("G020013");
                infoTable.Columns.Add("B010001");
                infoTable.Columns.Add("B030004");
                infoTable.Columns.Add("B030005");
                infoTable.Columns.Add("H010014");
                infoTable.Columns.Add("E020012");
                infoTable.Columns.Add("B010028");
                infoTable.Columns.Add("G020032");
                infoTable.Columns.Add("I050001");
                infoTable.Columns.Add("I050003");
                infoTable.Columns.Add("I050002");
                DataRow row = infoTable.NewRow();
                row["I050008"] = _acquisitionTargetNumber;
                row["C010010"] = info.ManufacturerName;
                row["G020013"] = info.ManufacturerCode;
                row["B010001"] = info.HolderName;
                row["B030004"] = info.HolderCertificateType;
                row["B030005"] = info.HolderCertificateCode;
                row["H010014"] = new BcpConverter().XlyUTC(info.CollectTime, null);
                row["E020012"] = info.CollectorName;
                row["B010028"] = info.CollectorCertificateCode;
                row["G020032"] = info.CollectLocationCode;
                row["I050001"] = info.CaseCode;
                row["I050003"] = info.CaseType;
                row["I050002"] = info.CaseName;
                infoTable.Rows.Add(row);
                tables.Add(infoTable);
            }

            if (arg.DeviceInfo != null)
            {
                var       device      = arg.DeviceInfo;
                DataTable deviceTable = new DataTable();
                deviceTable.TableName = "WA_MFORENSICS_010200";
                deviceTable.Columns.Add("I050008");
                deviceTable.Columns.Add("C010001");
                deviceTable.Columns.Add("C050001");
                deviceTable.Columns.Add("C040002");
                deviceTable.Columns.Add("C040006");
                deviceTable.Columns.Add("C010010");
                deviceTable.Columns.Add("C010003");
                deviceTable.Columns.Add("C010009");
                DataRow row1 = deviceTable.NewRow();
                row1["I050008"] = _acquisitionTargetNumber;
                row1["C010001"] = device.Name;
                row1["C050001"] = device.IMEI;
                row1["C040002"] = device.Mac;
                row1["C040006"] = device.BloothMac;
                row1["C010010"] = device.Manufacture;
                row1["C010003"] = device.Model;
                row1["C010009"] = device.FeatureDescription;
                deviceTable.Rows.Add(row1);
                tables.Add(deviceTable);
            }

            return(tables.ToArray());
        }
コード例 #11
0
 /// <summary>
 /// 导出完成,返回导出后的文件或文件夹路径
 /// </summary>
 /// <param name="arg"></param>
 /// <param name="progress"></param>
 protected virtual string ExportCompleted(DataReportPluginArgument arg, IAsyncTaskProgress progress)
 {
     return(null);
 }
コード例 #12
0
 /// <summary>
 /// 导出文件
 /// </summary>
 /// <param name="arg"></param>
 /// <param name="progress"></param>
 protected virtual void ExportFile(DataReportPluginArgument arg, IAsyncTaskProgress progress)
 {
 }
コード例 #13
0
 /// <summary>
 /// 导出前初始化操作
 /// </summary>
 /// <param name="arg"></param>
 /// <param name="progress"></param>
 protected virtual void Initialize(DataReportPluginArgument arg, IAsyncTaskProgress progress)
 {
 }