Esempio n. 1
0
        void OnCommandSelected(GenericNodeView nodeView)
        {
            Command command = _commands.Find(c => c.info.name == nodeView.name);

            if (command != null)
            {
                if (command.info.IsComplex())
                {
                    if (!_commandDetailViewBuilders.ContainsKey(command))
                    {
                        _commandDetailViewBuilders[command] = new CommandDetailViewBuilder(command);
                    }

                    LogConsole.PushSubView(_commandDetailViewBuilders[command]);
                }
                else
                {
                    try
                    {
                        command.Execute();
                    }
                    catch (Exception e)
                    {
                        Debug.LogException(e);
                    }

                    if (command.info.shouldCloseAfterExecuted)
                    {
                        LogConsole.CloseAllSubView();
                    }
                }
            }
        }
Esempio n. 2
0
        //static ConsoleColor Background = Console.BackgroundColor;
        //static ConsoleColor Foreground = Console.ForegroundColor;

        internal static void Main2(ConsoleColor? @background, ConsoleColor? @foreground)
        {
            //Factory.ChangeImageConsole(ConsoleColor.Green, ConsoleColor.DarkGreen);
            //Factory.ChangeCodepage(65001);

            LogConsole.Write($"CurrentCodePageInput: {Console.InputEncoding.CodePage}", LogLevel.Warning);
            LogConsole.Write($"CurrentCodePageOutput: {Console.OutputEncoding.CodePage}", LogLevel.Warning);

            Factory.ChangeCodepage(28591);
            LogConsole.Write($"CurrentCodePageInput: {Console.InputEncoding.CodePage}", LogLevel.Warning);
            LogConsole.Write($"CurrentCodePageOutput: {Console.OutputEncoding.CodePage}", LogLevel.Warning);


            LogConsole.Write("Hello World! Привет, мир!");     //вывод строки приветствия на двух языках
            LogConsole.Write($"Уровень {LogLevel.Trace} - трассировка", LogLevel.Trace);
            LogConsole.Write($"Уровень {LogLevel.Debug} - отладка", LogLevel.Debug);
            LogConsole.Write($"Уровень {LogLevel.Information} - информация");
            LogConsole.Write($"Уровень {LogLevel.Warning} - предупреждение", LogLevel.Warning);
            Factory.ChangeCodepage(65001);
            LogConsole.Write($"CurrentCodePageInput: {Console.InputEncoding.CodePage}", LogLevel.Warning);
            LogConsole.Write($"CurrentCodePageOutput: {Console.OutputEncoding.CodePage}", LogLevel.Warning);

            LogConsole.Write($"Уровень {LogLevel.Error} - ошибка", LogLevel.Error);
            LogConsole.Write($"Уровень {LogLevel.Critical} - критическая ошибка", LogLevel.Critical);
            LogConsole.Write($"Уровень {LogLevel.None} - без логирования", LogLevel.None);
        }
Esempio n. 3
0
        private static void Init()
        {
            var player = map.Actors.Single(a => a is Player) as Player;

            var mapConsole     = new MapConsole(game, true, new AStarPathFinder());
            var logConsole     = new LogConsole();
            var messageConsole = new MessageConsole();
            var statusConsole  = new StatusConsole(player);
            var menuConsole    = new MenuConsole(Width, Height);

            var inventory = new InventoryConsole(player);

            var keyboardHandler = new KeyboardHandler(mapConsole, logConsole, messageConsole, player, inventory, menuConsole, game, () => StartGame(rnd));

            var mainConsole = new MainConsole(mapConsole, logConsole, messageConsole, statusConsole, keyboardHandler, inventory);

            mainConsole.Children.Add(mapConsole);
            mainConsole.Children.Add(logConsole);
            mainConsole.Children.Add(messageConsole);
            mainConsole.Children.Add(statusConsole);
            mainConsole.Children.Add(inventory);
            mainConsole.Children.Add(menuConsole);

            SadConsole.Game.Instance.Screen = mainConsole;
        }
Esempio n. 4
0
        public async void Information(LogConsole consoleChannel, ulong emoji, string message)
        {
            DiscordChannel channel;

            switch (consoleChannel)
            {
            case LogConsole.Commands:
                channel = await this.dClient.GetChannelAsync(Channels.Commands).ConfigureAwait(false);

                break;

            case LogConsole.RoleEdits:
                channel = await this.dClient.GetChannelAsync(Channels.RoleEdits).ConfigureAwait(false);

                break;

            case LogConsole.UserInfo:
                channel = await this.dClient.GetChannelAsync(Channels.Console).ConfigureAwait(false);

                break;

            default:
                channel = await this.dClient.GetChannelAsync(Channels.ExceptionReporting).ConfigureAwait(false);

                break;
            }

            await channel.SendMessageAsync($"**[{DateTime.UtcNow}]** {DiscordEmoji.FromGuildEmote(this.dClient, emoji)} {message}").ConfigureAwait(false);
        }
Esempio n. 5
0
    void CheckConflictModule()
    {
        bool hasJoystick = false;

        hasJoystick = HasMonoJoystick;
        if (hasJoystick && HasDualJoystick)
        {
            LogConsole.LogWarning("InputModuleManager", "MonoJoystick,DualJoystick,MonoJoystickSimulator,DualJoystickSimulator,这四种输入模块只能选用一个");
        }
        else if (HasDualJoystick)
        {
            hasJoystick = true;
        }
        if (hasJoystick && HasMonoJoystickSimulator)
        {
            LogConsole.LogWarning("InputModuleManager", "MonoJoystick,DualJoystick,MonoJoystickSimulator,DualJoystickSimulator,这四种输入模块只能选用一个");
        }
        else if (HasMonoJoystickSimulator)
        {
            hasJoystick = true;
        }
        if (hasJoystick && HasDualJoystickSimulator)
        {
            LogConsole.LogWarning("InputModuleManager", "MonoJoystick,DualJoystick,MonoJoystickSimulator,DualJoystickSimulator,这四种输入模块只能选用一个");
        }
        else if (HasDualJoystickSimulator)
        {
            hasJoystick = true;
        }

        if (HasButtonPad && HasButtonPadSimulator)
        {
            LogConsole.LogWarning("InputModuleManager", "ButtonPad,ButtonPadSimulator,这两种输入模块只能选用一个");
        }
    }
Esempio n. 6
0
        public override IEnumerator RunTest()
        {
            IoC.inject.SetSingleton <IPreferences>(PlayerPrefsStore.NewPreferencesUsingPlayerPrefs());
            LogConsole.RegisterForAllLogEvents(this);

            links = gameObject.GetLinkMap();
            links.Get <Button>("ButtonTestJsonLib").SetOnClickAction(delegate {
                TestJsonSerialization().LogOnError();
            });
            links.Get <Button>("ButtonTestPing").SetOnClickAction(delegate {
                StartCoroutine(TestCurrentPing(links.Get <InputField>("IpInput").text));
            });
            links.Get <Button>("ButtonShowToast").SetOnClickAction(delegate {
                Toast.Show("Hello World");
            });
            // Clicking multiple times on a button with an async action will only execute the first click:
            links.Get <Button>("ButtonRunAsyncMethod").SetOnClickAction(async delegate {
                await Task.Delay(2000);
                Toast.Show("Button waited 2 seconds");
            });

            yield return(new WaitForSeconds(0.5f));

            SimulateButtonClickOn("ButtonTestJsonLib");

            yield return(new WaitForSeconds(0.5f));

            SimulateButtonClickOn("ButtonTestPing");
        }
        public void ProcessBytes(Session _Session, ref JArray _Data)
        {
            try
            {
                IncomingPacket IncomingPacket = new IncomingPacket(_Data);

                if (IncomingEvents.ContainsKey(IncomingPacket.opcode))
                {
                    IIncomingPacketEvent Event = IncomingEvents[IncomingPacket.opcode];

                    if (_Session != null)
                    {
                        Event.Invoke(_Session, IncomingPacket);
                    }
                }
                else
                {
                    LogConsole.Show(LogType.ERROR, "[Opcode]: {0}", (ClientOpcode)IncomingPacket.opcode);
                }
            }
            catch (Exception e)
            {
                LogConsole.Show(LogType.DEBUG, "[ProcessByte]: {0}", e.Message);
            }
        }
Esempio n. 8
0
        void Start()
        {
            LogConsole.RegisterForAllLogEvents(this);

            links = gameObject.GetLinkMap();
            links.Get <Button>("ButtonTestJsonLib").SetOnClickAction(delegate { TestJsonSerialization(); });
            links.Get <Button>("ButtonTestPing").SetOnClickAction(delegate {
                StartCoroutine(TestCurrentPing(links.Get <InputField>("IpInput").text));
            });
            var img = links.Get <Image>("Image1");

            img.type           = Image.Type.Simple;
            img.preserveAspect = true;
            links.Get <Button>("ButtonLoadImage1").SetOnClickAction(delegate {
                var t = Log.MethodEntered("ButtonLoadImage1");
                StartCoroutine(DownloadTexture2D(new Uri(url), new Response <Texture2D>().WithResultCallback(texture2d => {
                    img.sprite = texture2d.ToSprite();
                    Log.MethodDone(t);
                })));
            });
            links.Get <Button>("ButtonLoadImage2").SetOnClickAction(delegate {
                var t = Log.MethodEntered("ButtonLoadImage2");
                StartCoroutine(DownloadBytes(new Uri(url), new Response <byte[]>().WithResultCallback(async downloadedBytes => {
                    var texture2d = await ImageHelper.ToTexture2D(downloadedBytes);
                    img.sprite    = texture2d.ToSprite();
                    Log.MethodDone(t);
                })));
            });
        }
        //write output to log
        //couldbe used in the future to incorporate a log file
        private void WriteToLog(string value)
        {
            string dateTimeFormat = string.Format("{0:yyyy-MM-dd:HH-mm-ss}", DateTime.Now);

            LogConsole.AppendText(string.Format("{0}     {1}{2}", dateTimeFormat, value, "\n"));
            File.AppendAllText("Lab2.log", string.Format("{0}     {1}{2}", dateTimeFormat, value, "\n"));
        }
Esempio n. 10
0
    public static void BuildAllAssetbundlesCustom()
    {
        // 确保路径存在
        IOUtil.MakeSurePath(EditorConstants.ASSETBUNDLE_ABSOLUTE_PATH);
        AssetBundleBuild[] buildMap = new AssetBundleBuild[1];
        //string[] joystickAssets = new string[2];
        //joystickAssets[0] = "Assets/UITexture/Joystick/摇杆_底.png";
        //joystickAssets[1] = "Assets/UITexture/Joystick/摇杆_钮.png";
        string[] joystickAssets = new string[1];
        joystickAssets[0]              = "Assets/#Project/SFX/Prefab_Finished/new_Action/0_Player/ck";
        buildMap[0].assetNames         = joystickAssets;
        buildMap[0].assetBundleName    = AssetDatabase.GetImplicitAssetBundleName("Assets/#Project/SFX/Prefab_Finished/new_Action/0_Player/ck");
        buildMap[0].assetBundleVariant = AssetDatabase.GetImplicitAssetBundleVariantName("Assets/#Project/SFX/Prefab_Finished/new_Action/0_Player/ck");
#if UNITY_STANDALONE_WIN
        AssetBundleManifest manifest = null;
#if USE_64BIT
        manifest = BuildPipeline.BuildAssetBundles(EditorConstants.ASSETBUNDLE_RELATIVE_PATH, buildMap, BuildAssetBundleOptions.ChunkBasedCompression, BuildTarget.StandaloneWindows64);
#else
        manifest = BuildPipeline.BuildAssetBundles(EditorConstants.ASSETBUNDLE_RELATIVE_PATH, buildMap, BuildAssetBundleOptions.ChunkBasedCompression, BuildTarget.StandaloneWindows);
#endif
        string[]      assetbundles = manifest.GetAllAssetBundles();
        StringBuilder sb           = new StringBuilder();
        foreach (string assetbundle in assetbundles)
        {
            sb.AppendLine(assetbundle + ":" + manifest.GetAssetBundleHash(assetbundle).ToString());
        }
        LogConsole.Log(Tag.Builder, sb.ToString());
        uint crc;
        BuildPipeline.GetCRCForAssetBundle(EditorConstants.ASSETBUNDLE_RELATIVE_PATH + "sfx_ck", out crc);
        LogConsole.Log(Tag.Builder, crc);
#elif UNITY_ANDROID
#elif UNITY_IOS
#endif
    }
Esempio n. 11
0
        public override IEnumerator RunTest()
        {
            LogConsole.RegisterForAllLogEvents(this);

            links = gameObject.GetLinkMap();
            var img = links.Get <Image>("Image1");

            img.type           = Image.Type.Simple;
            img.preserveAspect = true;
            links.Get <Button>("ButtonLoadImage1").SetOnClickAction(delegate {
                var t = Log.MethodEntered("ButtonLoadImage1");
                StartCoroutine(DownloadTexture2D(new Uri(GetUrl()), new Response <Texture2D>().WithResultCallback(texture2d => {
                    img.sprite = texture2d.ToSprite();
                    Log.MethodDone(t);
                })));
            });
            links.Get <Button>("ButtonLoadImage2").SetOnClickAction(delegate {
                var t = Log.MethodEntered("ButtonLoadImage2");
                StartCoroutine(DownloadBytes(new Uri(GetUrl()), new Response <byte[]>().WithResultCallback(async downloadedBytes => {
                    var texture2d = await ImageLoaderUnity.ToTexture2D(downloadedBytes);
                    img.sprite    = texture2d.ToSprite();
                    Log.MethodDone(t);
                })));
            });
            links.Get <Button>("ButtonLoadImage3").SetOnClickAction(async delegate {
                var t = Log.MethodEntered("ButtonLoadImage3");
                Texture2D loadedImage = await links.Get <Image>("Image2").LoadFromUrl(GetUrl());
                Log.MethodDone(t);
                Toast.Show($"The loaded texture has the size: {loadedImage.width}x{loadedImage.height} pixels");
            });

            yield return(null);
        }
Esempio n. 12
0
        private void ComListing()
        {
            try
            {
                using (var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_PnPEntity WHERE Caption like '%(COM%'"))
                {
                    var portnames = SerialPort.GetPortNames();
                    var ports     = searcher.Get().Cast <ManagementBaseObject>().ToList().Select(p => p["Caption"].ToString());

                    var portList = portnames.Select(n => n + " - " + ports.FirstOrDefault(s => s.Contains(n + ")"))).ToList();

                    foreach (string s in portList)
                    {
                        LogConsole.AppendText(s + Environment.NewLine);

                        //LogUpdate(s, 10);
                    }

                    /*
                     * foreach (string s in portList)
                     * {
                     *  LogConsole.AppendText(s.Substring(s.IndexOf("(")+1, s.IndexOf(")") - s.IndexOf("(")-1) + Environment.NewLine);
                     *  //LogUpdate(s, 10);
                     * }
                     */
                }
            }
            catch (ManagementException e)
            {
                MessageBox.Show(e.Message);
            }
        }
Esempio n. 13
0
        private void ReceiverReplyParse(string data, int index)
        {
            char[] charsToTrim = { '\r', '\n' };
            try
            {
                switch (Int32.Parse(data[6].ToString()))
                {
                case 0:     //receiver name
                    LogConsole.AppendText(DateTime.Now.ToString() + " Channel " + index + " Receiver name: " + data.Substring(8) + Environment.NewLine);
                    receiver_model[index] = data.Substring(8).TrimEnd(charsToTrim);
                    break;

                case 1:     //FW ver
                    LogConsole.AppendText(DateTime.Now.ToString() + " Channel " + index + " FW version: " + data.Substring(8) + Environment.NewLine);
                    receiver_FW[index] = data.Substring(8).TrimEnd(charsToTrim);
                    break;

                case 2:     //Receiver ID
                    LogConsole.AppendText(DateTime.Now.ToString() + " Channel " + index + " Receiver ID: " + data.Substring(8) + Environment.NewLine);
                    receiver_ID[index] = data.Substring(8).TrimEnd(charsToTrim);
                    break;

                default:
                    LogConsole.AppendText(DateTime.Now.ToString() + " Channel " + index + " " + data + Environment.NewLine);
                    break;
                }
            }
            catch (Exception ex)
            {
                LogConsole.AppendText(DateTime.Now.ToString() + " Channel " + index + ex.Message + Environment.NewLine);
            }
        }
Esempio n. 14
0
        public bool IsPixel(int a, int b)
        {
            bool t = false;

            try
            {
                if (0 > a || a >= w || 0 > b || b >= h)
                {
                    t = false;
                }
                else
                {
                    int count = 4 * (b * w + a) + 3;
                    if (count <= this.data_array.Length)
                    {
                        int ddd = this.data_array[count];
                        if (0 < ddd)
                        {
                            t = true;
                        }
                    }
                }
            }
            catch (Exception ep)
            {
                LogConsole.Show(LogType.ERROR, ep.ToString());
            }

            return(t);
        }
Esempio n. 15
0
        public override IEnumerator RunTest()
        {
            LogConsole.RegisterForAllLogEvents(this);

            DataStore <MyDataModel> store = new DataStore <MyDataModel>(Reducers.MainReducer, initialModel);

            var map = gameObject.GetLinkMap();

            Task showForm1 = map.Get <Button>("ShowForm1").SetOnClickAction(async delegate {
                MyFormPresenter presenter   = new MyFormPresenter();
                presenter.targetView        = gameObject.GetViewStack().ShowView("Ui16_MyForm1");
                presenter.simulateUserInput = simulateUserInput;
                await presenter.LoadModelIntoView(store);
            });

            Task showForm2 = map.Get <Button>("ShowForm2").SetOnClickAction(async delegate {
                MyFormPresenter presenter   = new MyFormPresenter();
                presenter.targetView        = gameObject.GetViewStack().ShowView("Ui16_MyForm1");
                presenter.simulateUserInput = simulateUserInput;
                var fork = store.NewFork();
                await presenter.LoadModelIntoView(fork);
                fork.ApplyMutationsBackToOriginalStore();
                ShowFormCompletedDebugInfos(fork);
            });

            if (simulateUserInput)
            {
                SimulateButtonClickOn("ShowForm1");
                yield return(showForm1.AsCoroutine());

                SimulateButtonClickOn("ShowForm2");
                yield return(showForm2.AsCoroutine());
            }
        }
Esempio n. 16
0
        public void Update()
        {
            try
            {
                double[] dp;
                bool     found = false;
                e = new ShotEventArgs();
                int tim = 0;
                for (int i = 0; i < 3000; i += 30)
                {
                    dp = GetPosAtTime(i);

                    if (ground.IsPixel((int)dp[0], (int)dp[1]) == true)
                    {
                        //e.User = user;
                        e.angle = (int)ang;
                        e.cx    = (int)dp[0];
                        e.cy    = (int)dp[1];
                        e.look  = look;
                        e.power = (int)power;
                        e.xb    = (int)xb;
                        e.yb    = (int)yb;
                        e.xf    = (int)x;
                        e.yf    = (int)y;
                        e.ax    = (int)ax;
                        e.ay    = (int)ay;
                        e.col   = true;
                        e.time  = i;
                        found   = true;
                        Shot(this, e);
                        ground.AddGroundHole((int)dp[0], (int)dp[1], 36, 40);
                        break;
                    }
                    tim = i;
                }
                if (!found)
                {
                    //e.User = user;
                    e.angle = (int)ang;
                    e.cx    = 0;
                    e.cy    = 0;
                    e.look  = look;
                    e.power = (int)power;
                    e.xb    = (int)xb;
                    e.yb    = (int)yb;
                    e.xf    = (int)x;
                    e.yf    = (int)y;
                    e.ax    = (int)ax;
                    e.ay    = (int)ay;
                    e.col   = false;
                    e.time  = tim;
                    Shot(this, e);
                }
            }
            catch (Exception ex)
            {
                LogConsole.Show(LogType.ERROR, ex.ToString());
            }
        }
Esempio n. 17
0
 //自定义Error
 static public void LogError(object message, string customType)
 {
     if (EnableLog)
     {
         //TTLoger.LogError(string.Format("message:{0} customType:{1}", message, customType));
     }
     LogConsole.LogError(message, customType);
 }
Esempio n. 18
0
 public Engine()
 {
     this.reader          = new Reader();
     this.logConsole      = new LogConsole();
     this.MainLogger      = new MainLogger();
     this.appenderFactory = new AppenderFactory();
     this.logFactory      = new LogFactory();
 }
Esempio n. 19
0
 static public void LogWarning(object message, string customType)
 {
     if (EnableLog)
     {
         LogConsole.LogWarning(message, customType);
         //Debug.LogWarning(string.Format("message:{0} customType:{1}", message, customType));
     }
 }
Esempio n. 20
0
        public static LogBase DefaultLog(string name)
        {
            var rollingFileLog = new LogRollingFile(name);
            var consoleLog     = new LogConsole(new LogConsoleOptions(-1400, 0, 1400, 500));

            rollingFileLog.AddPipe(consoleLog);
            return(rollingFileLog);
        }
Esempio n. 21
0
 static public void Log(object message, string customType, Color col)
 {
     if (EnableLog)
     {
         Debug.Log(string.Format("message:{0} customType:{1}", message, customType));
     }
     LogConsole.Log(message, customType, col);
 }
Esempio n. 22
0
        void Init()
        {
            if (Platform.IsMicrosoft)
            {
                HasAdminRights = new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
            }

            IsWindowsService = Platform.IsMicrosoft && !Environment.UserInteractive;
            if (IsWindowsService)
            {
                // no log console + service run
                if (!HasAdminRights)
                {
                    throw new NotSupportedException("Service requires administration rights!");
                }

                LogSystem = new LogEventLog(EventLog, ServiceName);
            }
            else
            {
                CommandlineArguments = Arguments.FromEnvironment();

                // commandline run or linux daemon ?
                if (!CommandlineArguments.IsOptionPresent("daemon"))
                {
                    // no daemon -> log console
                    LogConsole       = LogConsole.Create();
                    LogConsole.Title = ServiceName + " v" + VersionInfo.InformalVersion;
                    if (CommandlineArguments.IsOptionPresent("debug"))
                    {
                        LogConsole.Level = LogLevel.Debug;
                    }

                    if (CommandlineArguments.IsOptionPresent("verbose"))
                    {
                        LogConsole.Level = LogLevel.Verbose;
                    }

                    if (LogConsole.Level < LogLevel.Information)
                    {
                        LogConsole.ExceptionMode = LogExceptionMode.Full;
                    }
                }

                // on unix do syslog
                LogSystem = LogConsole;
                if (Platform.Type == PlatformType.Linux)
                {
                    LogSystem = LogSyslog.Create();
                }
            }

            if (LogSystem != null)
            {
                LogSystem.ExceptionMode = LogExceptionMode.Full;
            }
            log.LogInfo("Service <cyan>{0}<default> initialized!", ServiceName);
        }
Esempio n. 23
0
        public void LogConsoleWritesToConsole()
        {
            const string cInputString = "test";
            LogConsole   logConsole   = new LogConsole();

            logConsole.Output("test");

            Assert.AreEqual(cInputString, GetOutputString());
        }
Esempio n. 24
0
        public void LogConsoleWritesLineToConsole()
        {
            const string cInputString = "test";
            LogConsole   logConsole   = new LogConsole();

            logConsole.OutputLine("test");

            Assert.AreEqual(cInputString + Environment.NewLine, GetOutputString());
        }
Esempio n. 25
0
        /// <summary>
        /// The threadmethod for the Command-Interpreter
        /// </summary>
        private void ListenerMethod()
        {
            while (true)
            {
                HttpListenerContext output;
                try
                {
                    output = commandListener.GetContext();
                }
                catch
                {
                    break;
                }
                var response = output.Response;

                string sourceString = FilterCommandString(output.Request.Url.ToString());
                string message      = string.Empty;

                if (!ConsoleCommandWords.IsLogConsoleCommand(sourceString))
                {
                    string cleanSourceString = Command.CleanupGetString(sourceString);
                    string command           = string.Empty;
                    try
                    {
                        command = Command.ReformatCommandString(cleanSourceString);
                        ICommand parsedCommand = CommandParser.Parse(command);
                        if (parsedCommand == null)
                        {
                            message = "PARSER_ERROR";
                            LogConsole.ThrowParseError("PARSER_ERROR", sourceString);
                        }
                        else
                        {
                            cmdQueue.Enqueue(parsedCommand);
                            message = CommandExecutor.ExecuteCommand(cmdQueue.Dequeue());
                        }
                    }
                    catch
                    {
                        message = "PARSER_ERROR";
                        LogConsole.ThrowParseError("PARSER_ERROR", sourceString);
                    }
                }
                else
                {
                    message = "FORBIDDEN";
                    LogConsole.ThrowParseError("FORBIDDEN", sourceString);
                }
                response.ContentType = new System.Net.Mime.ContentType("text/plain").ToString();
                response.StatusCode  = Actions.ResolveToHttpStatusCode(message);

                byte[] byteCode = System.Text.Encoding.UTF8.GetBytes(message);
                response.OutputStream.Write(byteCode, 0, byteCode.Length);
                response.OutputStream.Flush();
                response.OutputStream.Close();
            }
        }
Esempio n. 26
0
 public override IEnumerator RunTest()
 {
     LogConsole.RegisterForAllLogEvents(this);
     for (int i = 0; i < 20; i++)
     {
         LogConsole.GetLogConsole(this).AddToLog(LogEntry.d("Log event " + i));
         yield return(new WaitForSeconds(0.5f));
     }
 }
Esempio n. 27
0
 void Playlist_PlaylistEmpty()
 {
     LogConsole.Break();
     LogConsole.Write("No more Tracks on Playlist: " + this.Id);
     this.Playlist.CurrentTrack = null;
     this.MediaServer.Pause();
     Thread.Sleep(5);
     this.MediaServer.ClearBuffer();
 }
Esempio n. 28
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        DisplayScriptField();

        if (GUILayout.Button("ceshi"))
        {
            LogConsole.Log(allStates.arraySize);
            for (int i = 0; i < allStates.arraySize; ++i)
            {
                SerializedProperty elem = allStates.GetArrayElementAtIndex(i);
                LogConsole.Log(elem.name + " " + elem.type);
                while (elem.Next(true))
                {
                    LogConsole.Log(elem.name + " " + elem.type);
                }
            }
        }

        EditorGUILayout.LabelField("allStates");
        int count = allStates.arraySize;

        for (int i = 0; i < count; ++i)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(10f);
            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField("element " + i);
            SerializedProperty elem = allStates.GetArrayElementAtIndex(i);
            if (target.allStates[i] is BaseState)
            {
                BaseState state = target.allStates[i] as BaseState;
                state.s = EditorGUILayout.TextField("s = ", state.s);
            }
            if (target.allStates[i] is AdvancedState)
            {
                AdvancedState state = target.allStates[i] as AdvancedState;
                state.i = EditorGUILayout.IntField("i = ", state.i);
            }
            if (target.allStates[i] is AnotherState)
            {
                AnotherState state = target.allStates[i] as AnotherState;
                state.f = EditorGUILayout.FloatField("f = ", state.f);
            }
            if (target.allStates[i] is AnotherAdvancedState)
            {
                AnotherAdvancedState state = target.allStates[i] as AnotherAdvancedState;
                state.b = EditorGUILayout.Toggle("b = ", state.b);
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
        }

        serializedObject.ApplyModifiedProperties();
    }
Esempio n. 29
0
        public string Execute()
        {
            User newUser = UserManager.CreateUser(this.Parameters[0]);

            LogConsole.WriteLine("// EXECUTED " + this.CommandWord + " " + this.Parameters[0] + " //");
            LogConsole.WriteLine("// NEW USER: UID/GID " + " ::: " + newUser.UserId + " / " + newUser.GoogleId + " //");
            LogConsole.Break();

            return(newUser.UserId);
        }
        public async Task InitializeAsync()
        {
            using (var session = _performanceProfiler.CreateSession())
            {
                await RestoreAppearanceAsync();

                LogConsole.Initialize();
                session.LogWithPerformance("Application started");
            }
        }
Esempio n. 31
0
	    	void StartLog() 
	    	{
	    		logConsole = new LogConsole();
	    		logConsole.Show();
	    		//Console.WriteLine("file: "+logFilePath+Path.DirectorySeparatorChar+logFileName);
	    		logFile = File.AppendText(logFilePath+Path.DirectorySeparatorChar+logFileName);
	    		logFile.WriteLine();
	    		string logStartLine = "* "
	              +System.DateTime.Now.ToShortDateString()
	              +" - "
	              +System.DateTime.Now.ToShortTimeString()
	              +" * Log started for "
	              +Assembly.GetExecutingAssembly().GetName().Name.ToString()
	              +" v."
	              +Assembly.GetExecutingAssembly().GetName().Version.ToString();
				
	    		#if DEBUG
					logStartLine += " (debug build)";
				#else 
					logStartLine += " (release build)";
				#endif
				
				WriteLogLine(logStartLine);
	    	}