Example #1
0
        private void OnGUI()
        {
            if (!Active)
            {
                return;
            }
            AllRect.ConsoleRect = GUILayout.Window(WindowID.CONSOLE, AllRect.ConsoleRect, (id) =>
            {
                GUILayout.BeginHorizontal();
                logBuffer.ShowLog     = GUILayout.Toggle(logBuffer.ShowLog, "Log");
                logBuffer.ShowWaring  = GUILayout.Toggle(logBuffer.ShowWaring, "Warning");
                logBuffer.ShowError   = GUILayout.Toggle(logBuffer.ShowError, "Error");
                logBuffer.WriteToFile = GUILayout.Toggle(logBuffer.WriteToFile, "Write2File");
                GUILayout.EndHorizontal();

                ScrollPosition = GUILayout.BeginScrollView(ScrollPosition);
                GUILayout.Label(logBuffer.ToString(), AllGUIStyle.DEFAULT_LABEL);
                GUILayout.EndScrollView();


                GUILayout.BeginHorizontal();
                if (GUILayout.Button("Clr"))
                {
                    logBuffer.Clear();
                }
                if (GUILayout.Button("Close"))
                {
                    Active = false;
                }
                GUILayout.EndHorizontal();


                GUI.DragWindow(new Rect(0, 0, AllRect.ConsoleRect.width, 20));
            }, "Console", AllGUIStyle.DEFAULT_WINDOW);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="isClearLogBuffer"></param>
        public void Start(bool isClearLogBuffer)
        {
            IsCancelled = false;
            ThreadStart ts = null;

            if (!_isLogging)
            {
                if (ts == null)
                {
                    ts = delegate()
                    {
                        try
                        {
                            if (isClearLogBuffer)
                            {
                                ClearLogBuffer();
                            }
                            _isLogging = true;
                            //AdbHelper.Instance.RunCatLog(AndroidDebugBridge.SocketAddress, _device, string.Format("{0}{1}", LOG_PATH, _logBuffer.ToString().ToLower()), _L_Receiver);
                            //AdbHelper.Instance.RunCatLog(AndroidDebugBridge.SocketAddress, _device, _logBuffer.ToString().ToLower(), _L_Receiver);
                            this.RunCatLog(AndroidDebugBridge.SocketAddress, _device, string.Format("{0}{1}", LOG_PATH, _logBuffer.ToString().ToLower()));
                        }
                        catch (ThreadAbortException)
                        {
                            Thread.ResetAbort();
                        }
                        catch (Exception)
                        {
                        }
                        finally
                        {
                            _isLogging = false;
                        }
                    };
                }

                Thread logger = new Thread(ts)
                {
                    IsBackground = true
                };
                logger.Start();
            }
        }