Esempio n. 1
0
        public readonly BoolDel Method; /* method to use if substring matches */

        public Among(string s, int substringI, int result, BoolDel linkMethod)
        {
            SSize      = s.Length;
            S          = s.ToCharArray();
            SubstringI = substringI;
            Result     = result;
            Method     = linkMethod;
        }
Esempio n. 2
0
        public static bool Code(string sLabel, string sSubCat, string sDependencies, double dArg1, double dArg2, double ttime, BoolDel fnCode)
        {
            string fn   = MethodBase.GetCurrentMethod().Name;
            Type   type = typeof(TimeThis);

            try
            {
                if (null == sLabel)
                {
                    StackTrace   st     = new StackTrace();
                    StackFrame[] frames = st.GetFrames();
                    if (frames.Length > 0)
                    {
                        sLabel = frames[0].GetMethod().Name + "()";
                    }
                    if (frames.Length > 1)
                    {
                        sSubCat = frames[1].GetMethod().Name + "()";
                    }
                }
                Stopwatch sw = new Stopwatch();
                sw.Start();
                DateTime TaskStart = DateTime.Now;
                fnCode();
                sw.Stop();
                Record(TaskStart, Kinds.CodeBlock, sLabel, sSubCat, sDependencies, dArg1, dArg2, sw.Elapsed.TotalMilliseconds, 0, 0, ttime);
                return(true);
            }
            catch (Exception exc)
            {
                Util.HandleExc(type, fn, exc);
                return(false);
            }
        }