Esempio n. 1
0
        bool InitPlatform(int capacity, int trim)
        {
            try
            {
                if (platform == null)
                {
                    trim = Math.Min(trim, capacity); // can't trim more that we have

                    platform = CreatePlatform(capacity, trim);
                    if (platform != null)
                    {
                        Application.logMessageReceived += delegate(string message, string stackTrace, LogType type) {
                            platform.OnLogMessageReceived(message, stackTrace, type);
                        };

                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.LogError("Can't init " + Constants.PluginName + ": " + e.Message);
            }

            return(false);
        }
 void InitPlatform(int capacity)
 {
     if (platform == null)
     {
         platform = CreatePlatform(capacity);
         if (platform != null)
         {
             Application.logMessageReceivedThreaded += delegate(string message, string stackTrace, LogType type) {
                 platform.OnLogMessageReceived(message, stackTrace, type);
             };
         }
     }
 }
Esempio n. 3
0
 void DispatchMessages()
 {
     if (m_queuedMessages != null)
     {
         lock (m_queuedMessages)
         {
             while (m_queuedMessages.Count > 0)
             {
                 var info = m_queuedMessages.Dequeue();
                 m_platform.OnLogMessageReceived(info.message, info.stackTrace, info.type);
             }
         }
     }
 }
Esempio n. 4
0
        bool InitPlatform(int capacity, int trim)
        {
            try
            {
                if (m_platform == null)
                {
                    trim = Math.Min(trim, capacity); // can't trim more that we have

                    m_platform = CreatePlatform(capacity, trim);
                    if (m_platform != null)
                    {
                        registry.registryDelegate = m_platform;

                        m_queuedMessages = new Queue <MessageInfo>();
                        int mainThreadId = Thread.CurrentThread.ManagedThreadId;

                        Application.logMessageReceivedThreaded += delegate(string message, string stackTrace, LogType type)
                        {
                            message = m_removeRichTextTags ? StringUtils.RemoveRichTextTags(message) : message;
                            if (Thread.CurrentThread.ManagedThreadId == mainThreadId)
                            {
                                m_platform.OnLogMessageReceived(message, stackTrace, type);
                            }
                            else
                            {
                                QueueMessage(message, stackTrace, type);
                            }
                        };

                        // resolve variables
                        CVarResolver.ResolveVariables();

                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                Log.e(e, "Can't init platform");
            }

            return(false);
        }
        bool InitPlatform(int capacity, int trim)
        {
            try
            {
                if (m_platform == null)
                {
                    trim = Math.Min(trim, capacity); // can't trim more that we have

                    m_platform = CreatePlatform(capacity, trim);
                    if (m_platform != null)
                    {
                        m_queuedMessages = new Queue <MessageInfo>();
                        int mainThreadId = Thread.CurrentThread.ManagedThreadId;

                        Application.logMessageReceivedThreaded += delegate(string message, string stackTrace, LogType type)
                        {
                            message = m_removeRichTextTags ? StringUtils.RemoveRichTextTags(message) : message;
                            if (Thread.CurrentThread.ManagedThreadId == mainThreadId)
                            {
                                m_platform.OnLogMessageReceived(message, stackTrace, type);
                            }
                            else
                            {
                                QueueMessage(message, stackTrace, type);
                            }
                        };

                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.LogError("Can't init " + Constants.PluginName + ": " + e.Message);
            }

            return(false);
        }
Esempio n. 6
0
        bool InitPlatform(int capacity, int trim)
        {
            try
            {
                if (platform == null)
                {
                    trim = Math.Min(trim, capacity); // can't trim more that we have

                    platform = CreatePlatform(capacity, trim);
                    if (platform != null)
                    {
                        Application.logMessageReceived += delegate(string message, string stackTrace, LogType type) {
                            platform.OnLogMessageReceived(message, stackTrace, type);
                        };

                        return true;
                    }
                }
            }
            catch (Exception e)
            {
                Debug.LogError("Can't init " + Constants.PluginName + ": " + e.Message);
            }

            return false;
        }
Esempio n. 7
0
        bool InitPlatform(int capacity, int trim)
        {
            try
            {
                if (m_platform == null)
                {
                    trim = Math.Min(trim, capacity); // can't trim more that we have

                    m_platform = CreatePlatform(capacity, trim);
                    if (m_platform != null)
                    {
                        m_queuedMessages = new Queue<MessageInfo>();
                        int mainThreadId = Thread.CurrentThread.ManagedThreadId;

                        Application.logMessageReceivedThreaded += delegate(string message, string stackTrace, LogType type)
                        {
                            message = m_removeRichTextTags ? StringUtils.RemoveRichTextTags(message) : message;
                            if (Thread.CurrentThread.ManagedThreadId == mainThreadId)
                            {
                                m_platform.OnLogMessageReceived(message, stackTrace, type);
                            }
                            else
                            {
                                QueueMessage(message, stackTrace, type);
                            }
                        };

                        return true;
                    }
                }
            }
            catch (Exception e)
            {
                Debug.LogError("Can't init " + Constants.PluginName + ": " + e.Message);
            }

            return false;
        }