Esempio n. 1
0
        internal void Layout(ICTextMeasure measure, float contentWidth, float maxWidth)
        {
            if (this.IsPlain)
            {
                if (this.level == CLogLevel.Exception)
                {
                    CStackTraceLine[] stackLines = this.data as CStackTraceLine[];
                    if (stackLines == null && this.stackTrace != null)
                    {
                        stackLines = CEditorStackTrace.ParseStackTrace(this.stackTrace);
                        this.data  = stackLines;
                    }

                    LayoutException(measure, stackLines, maxWidth);
                }
                else
                {
                    LayoutPlain(measure, maxWidth);
                }
            }
            else if (this.IsTable)
            {
                string[] table = this.Table;
                CAssert.IsNotNull(table);

                LayoutTable(measure, table, contentWidth, maxWidth);
            }
            else
            {
                throw new NotImplementedException("Unexpected entry type");
            }
        }
Esempio n. 2
0
        public static T Cast <T>(object obj) where T : class
        {
            CAssert.IsNotNull(obj);
            CAssert.IsInstanceOfType <T>(obj);

            return(obj as T);
        }
Esempio n. 3
0
        protected virtual void RegisterCommandNotifications()
        {
            // cvar value changed
            m_notificationCenter.Register(CCommandNotifications.CVarValueChanged, delegate(CNotification n)
            {
                bool manual = n.Get <bool>(CCommandNotifications.KeyManualMode);

                CVar cvar = n.Get <CVar>(CCommandNotifications.CVarValueChangedKeyVar);
                CAssert.IsNotNull(cvar);

                OnCVarValueChanged(cvar, manual);
            });

            // binding changed
            m_notificationCenter.Register(CCommandNotifications.CBindingsChanged, delegate(CNotification n)
            {
                bool manual = n.Get <bool>(CCommandNotifications.KeyManualMode);
                OnCBindingsChanged(manual);
            });

            // alias changed
            m_notificationCenter.Register(CCommandNotifications.CAliasesChanged, delegate(CNotification n)
            {
                bool manual = n.Get <bool>(CCommandNotifications.KeyManualMode);
                OnCAliasesChanged(manual);
            });
        }
        private void PostCallback(CTimer timer)
        {
            CNotification notification = timer.userData as CNotification;

            CAssert.IsNotNull(notification);

            PostImmediately(notification);
        }
Esempio n. 5
0
        public static List <MethodInfo> ListMethods(List <MethodInfo> outList, Type type, CMethodsFilter filter, BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static)
        {
            CAssert.IsNotNull(type, "Type is null");

            MethodInfo[] methods = type.GetMethods(flags);

            if (filter == null)
            {
                outList.AddRange(methods);
                return(outList);
            }

            foreach (MethodInfo m in methods)
            {
                if (filter(m))
                {
                    outList.Add(m);
                }
            }
            return(outList);
        }