Ejemplo n.º 1
0
        //protected virtual void CloseBackingStore()
        //{
        //    if (_profileBackingStore != null)
        //        _profileBackingStore.Stop();
        //}

        protected override void Dispose(bool finalize)
        {
            try
            {
                StartIfNotStarted();

                Clear();
                if (_condition)
                {
                    if (_name != ChoProfile.GLOBAL_PROFILE_NAME && _name != ChoProfile.NULL_PROFILE_NAME)
                    {
                        Write(String.Format("}} [{0}] <---{1}", Convert.ToString(DateTime.Now - _startTime), Environment.NewLine), _indent);
                    }
                }

                Flush();

                if (_registered)
                {
                    ChoProfile.Unregister(this);
                }

                //CloseBackingStore();
            }
            catch (Exception ex)
            {
                ChoTrace.Write(ex);
            }
            finally
            {
                IsDisposed = true;
            }
        }
Ejemplo n.º 2
0
        protected override void Dispose(bool finalize)
        {
            if (!finalize)
            {
                return;
            }

            try
            {
                Clear();
                if (!DelayedStartProfile || (DelayedStartProfile && Started))
                {
                    if (TraceOnDispose)
                    {
                        if (Condition)
                        {
                            string msg = Environment.NewLine + ToString().Indent(Indent - 1);
                            if (!String.IsNullOrEmpty(FilePath))
                            {
                                //if (Mode == ChoProfileIntializationAction.Roll)
                                //    ChoBufferProfile.RollNWriteLine(FilePath, msg);
                                //else if (Mode == ChoProfileIntializationAction.Truncate)
                                //    ChoBufferProfile.CleanNWriteLine(FilePath, msg);
                                //else
                                //    ChoBufferProfile.WriteLine(FilePath, msg);
                            }
                            else if (TextWriter != null)
                            {
                                TextWriter.Write(msg);
                                TextWriter.Flush();
                            }
                            else
                            {
                                ChoTrace.WriteIf(Condition, ChoStackTrace.GetStackFrame(GetType()), msg);
                            }
                        }
                    }
                    //else if (OuterProfile != null)
                    //    OuterProfile.Append(ToString());
                }

                //ChoProfile.Unregister(CanDispose);

                //if (!finalize)
                //    GC.SuppressFinalize(this);
            }
            catch (Exception ex)
            {
                ChoTrace.Write(ex);
            }
            finally
            {
                IsDisposed = true;
            }
            ChoProfile.Unregister(this);
        }
Ejemplo n.º 3
0
        public static void Write(string format, params object[] args)
        {
            IChoProfile profile = GetDefaultContext(new StackFrame(1));

            if (profile != null)
            {
                profile.AppendIf(true, String.Format(format, args));
            }
            else
            {
                ChoTrace.Write(String.Format(format, args));
            }
        }
Ejemplo n.º 4
0
        public static void Write(string msg)
        {
            IChoProfile profile = GetDefaultContext(new StackFrame(1));

            if (profile != null)
            {
                profile.AppendIf(true, msg);
            }
            else
            {
                ChoTrace.Write(msg);
            }
        }
Ejemplo n.º 5
0
        protected override void Dispose(bool finalize)
        {
            try
            {
                StartIfNotStarted();

                Clear();
                if (_condition)
                {
                    Write(String.Format("}} [{0}] <---{1}", Convert.ToString(DateTime.Now - _startTime), Environment.NewLine), _indent);
                }

                Flush();
                CloseBackingStore();
            }
            catch (Exception ex)
            {
                ChoTrace.Write(ex);
            }
            finally
            {
                IsDisposed = true;
            }
        }