Ejemplo n.º 1
0
        public override object Execute(object arg, IAsyncTaskProgress progress)
        {
            EarlyWarningPluginArgument ewArg = (EarlyWarningPluginArgument)arg;
            DeviceDataSource           ds    = ewArg.DeviceDataSource;
            EarlyWarningResult         earlyWarningResult = ewArg.EarlyWarningResult;

            List <DataNode> dataNodes  = ewArg.DataNodes;
            IDataSource     dataSource = ds.DataSource;

            TreeDataSource treeDataSource = dataSource as TreeDataSource;

            if (treeDataSource == null ||
                treeDataSource.TreeNodes.Count < 1)
            {
                return(null);
            }
            foreach (DataNode dataNode in dataNodes)
            {
                //todo 此处dataNode.SensitiveData.CategoryName != "URL"为硬代码
                if (dataNode.SensitiveData.CategoryName != "URL")
                {
                    continue;
                }
                //todo 此处可以直接匹配,书签和历史记录
                foreach (TreeNode treeNode in treeDataSource.TreeNodes)
                {
                    string cmd = string.Format("{1} like '%{2}%'", treeNode.Items.DbTableName, SqliteDbFile.JsonColumnName, dataNode.SensitiveData.Value);
                    IEnumerable <dynamic> result = treeNode.Items.FilterByCmd <dynamic>(cmd);
                    earlyWarningResult.SqlDb.WriteResult(result, treeNode.Items.DbTableName, (Type)treeNode.Type);
                }
            }
            return(null);
        }
 public EarlyWarningPluginArgument(DeviceDataSource deviceDataSource, List <DataNode> dataNodes, EarlyWarningResult earlyWarningResult)
 {
     DeviceDataSource   = deviceDataSource;
     DataNodes          = dataNodes;
     EarlyWarningResult = earlyWarningResult;
 }