CompareStrings() public static méthode

public static CompareStrings ( string x, string y, uint uCompareType ) : bool
x string
y string
uCompareType uint
Résultat bool
        private static bool IsMatchEnvironmentVar(EcasCondition c, EcasContext ctx)
        {
            string strName      = EcasUtil.GetParamString(c.Parameters, 0, true);
            uint   uCompareType = EcasUtil.GetParamEnum(c.Parameters, 1,
                                                        EcasUtil.StdStringCompareEquals, EcasUtil.StdStringCompare);
            string strValue = EcasUtil.GetParamString(c.Parameters, 2, true);

            if (string.IsNullOrEmpty(strName) || (strValue == null))
            {
                return(false);
            }

            try
            {
                string strVar = Environment.GetEnvironmentVariable(strName);
                if (strVar == null)
                {
                    return(false);
                }

                return(EcasUtil.CompareStrings(strVar, strValue, uCompareType));
            }
            catch (Exception) { Debug.Assert(false); }

            return(false);
        }
        private static bool IsMatchString(EcasCondition c, EcasContext ctx)
        {
            string str          = EcasUtil.GetParamString(c.Parameters, 0, true);
            uint   uCompareType = EcasUtil.GetParamEnum(c.Parameters, 1,
                                                        EcasUtil.StdStringCompareEquals, EcasUtil.StdStringCompare);
            string strValue = EcasUtil.GetParamString(c.Parameters, 2, true);

            if ((str == null) || (strValue == null))
            {
                return(false);
            }

            return(EcasUtil.CompareStrings(str, strValue, uCompareType));
        }
        private static bool IsMatchTextEvent(EcasEvent e, EcasContext ctx)
        {
            uint uCompareType = EcasUtil.GetParamEnum(e.Parameters, 0,
                                                      EcasUtil.StdStringCompareEquals, EcasUtil.StdStringCompare);

            string strFilter = EcasUtil.GetParamString(e.Parameters, 1, true);

            if (string.IsNullOrEmpty(strFilter))
            {
                return(true);
            }

            string strCurFile = EcasUtil.GetParamString(ctx.Event.Parameters, 0);

            if (string.IsNullOrEmpty(strCurFile))
            {
                return(false);
            }

            return(EcasUtil.CompareStrings(strCurFile, strFilter, uCompareType));
        }
Exemple #4
0
        private static bool IsMatchTextEvent(EcasEvent e, EcasContext ctx)
        {
            uint uCompareType = EcasUtil.GetParamEnum(e.Parameters, 0,
                                                      EcasUtil.StdStringCompareEquals, EcasUtil.StdStringCompare);

            string strFilter = EcasUtil.GetParamString(e.Parameters, 1, true);

            if (string.IsNullOrEmpty(strFilter))
            {
                return(true);
            }

            string str = ctx.Properties.Get <string>(EcasProperty.Text);

            if (str == null)
            {
                Debug.Assert(false); return(false);
            }

            return(EcasUtil.CompareStrings(str, strFilter, uCompareType));
        }
Exemple #5
0
        private static bool IsMatchIocDbEvent(EcasEvent e, EcasContext ctx)
        {
            uint uCompareType = EcasUtil.GetParamEnum(e.Parameters, 0,
                                                      EcasUtil.StdStringCompareEquals, EcasUtil.StdStringCompare);

            string strFilter = EcasUtil.GetParamString(e.Parameters, 1, true);

            if (string.IsNullOrEmpty(strFilter))
            {
                return(true);
            }

            // Must prefer IOC (e.g. for SavingDatabaseFile)
            IOConnectionInfo ioc = ctx.Properties.Get <IOConnectionInfo>(
                EcasProperty.IOConnectionInfo);

            if (ioc == null)
            {
                PwDatabase pd = ctx.Properties.Get <PwDatabase>(EcasProperty.Database);
                if (pd == null)
                {
                    Debug.Assert(false); return(false);
                }

                ioc = pd.IOConnectionInfo;
            }
            if (ioc == null)
            {
                Debug.Assert(false); return(false);
            }
            string strCurFile = ioc.Path;

            if (string.IsNullOrEmpty(strCurFile))
            {
                return(false);
            }

            return(EcasUtil.CompareStrings(strCurFile, strFilter, uCompareType));
        }