Exemple #1
0
        public static bool IsFileNameMatch(this DBLaneDeletionDirectiveView me, string fn)
        {
            if (string.IsNullOrEmpty(me.filename))
            {
                return(false);
            }

            switch (me.MatchMode)
            {
            case DBMatchMode.RegExp:
                return(System.Text.RegularExpressions.Regex.IsMatch(fn, me.filename));

            case DBMatchMode.ShellGlobs:
                foreach (string glob in me.filename.Split(' '))
                {
                    if (string.IsNullOrEmpty(glob))
                    {
                        continue;
                    }

                    if (System.Text.RegularExpressions.Regex.IsMatch(fn, FileUtilities.GlobToRegExp(glob)))
                    {
                        return(true);
                    }
                }
                return(false);

            case DBMatchMode.Exact:
                return(fn == me.filename);

            default:
                return(false);
            }
        }
    private void AddDeletionDirectiveRow(DBLaneDeletionDirectiveView directive)
    {
        TableRow row;
        int      index = tblDeletionDirective.Rows.Count - 2;

        row = Utils.CreateTableRow(
            directive.name,
            directive.filename,
            ((DBMatchMode)directive.match_mode).ToString(),
            ((DBDeleteCondition)directive.condition).ToString(),
            directive.x.ToString(),
            Utils.CreateLinkButton("lnkEnableDirective" + directive.id.ToString(), directive.enabled ? "True" : "False", directive.enabled ? "disableDeletionDirective" : "enableDeletionDirective", directive.id.ToString(), btn_Command),
            Utils.CreateLinkButton("lnkUnlinkDirective" + directive.id.ToString(), "Unlink", "unlinkDeletionDirective", directive.id.ToString() + ";" + index.ToString(), btn_Command),
            Utils.CreateLinkButton("lnkDeleteDirective" + directive.id.ToString(), "Delete", "deleteDeletionDirective", directive.file_deletion_directive_id.ToString() + ";" + directive.id + ";" + index.ToString(), btn_Command)
            );
        tblDeletionDirective.Rows.AddAt(index, row);
    }