WriteLine() public static méthode

public static WriteLine ( ) : void
Résultat void
    public static void Main(string[] args)
    {
        switch (1)
        {
        default:
            switch (2)
            {
            default:
                int flag = 1;       //makes the next if computable -- essential!
                if (flag == 1)
                {
                    C.WriteLine("**** This one is expected");
                    break;  //break-2
                }
                else
                {
                    goto lbl;
                }
            }
            break;  //break-1  This point is REACHABLE through break-2,
            // contrary to the warning from compiler!

lbl:
            C.WriteLine("**** THIS SHOULD NOT APPEAR, since break-1 was supposed to fire ***");
            break;
        }
    }
 public static void Main(string[] args)
 {
     Console.WriteLine(Calc().New().One().Plus().Two());
     Console.WriteLine(Calc().New().Five().Minus().Six());
     Console.WriteLine(Calc().New().Seven().Times().Two());
     Console.WriteLine(Calc().New().Nine().DividedBy().Three());
 }
Exemple #3
0
    /// <summary>
    /// Initialize GL Window, Shader, and Cube VAO
    /// </summary>
    private void Init()
    {
        CreateWindow();
        InitInput();
        InitUi();

        _fps.OnFrameCount += frameCount => Console.WriteLine($"FPS: {frameCount}");
        _fps.Start();

        _renderer = new OpenGLRenderer();

        //Gl.PolygonMode(MaterialFace.Front, PolygonMode.Line);

        _blockTexture = new Texture("resources/terrain.png");

        _cube = NewCubeRenderable();
        _axis = NewAxisGeometry();

        _mainCamera = new Camera("MainCamera", _viewport);
        _mainCamera.MoveTo(2, 5, -10);
        _mainCamera.LookAt(_cube.Model, Vector3.UnitY);

        _chunks = InitChunks();

        _chunkMeshes = CreateMeshes(_chunks);
    }
Exemple #4
0
    public static void Main(string[] a)
    {
        D.WriteLine("Enter Roll No :");
        int rollNo = int.Parse(D.ReadLine());


        D.WriteLine("Enter Name :");
        string name = D.ReadLine();


        D.WriteLine("Enter Marks of five subjetcs one by one :");
        int sub1 = int.Parse(D.ReadLine());
        int sub2 = int.Parse(D.ReadLine());
        int sub3 = int.Parse(D.ReadLine());
        int sub4 = int.Parse(D.ReadLine());
        int sub5 = int.Parse(D.ReadLine());



        int    total = sub1 + sub2 + sub3 + sub4 + sub5;
        double avg   = total / 5;

        D.WriteLine("Roll No :" + rollNo);
        D.WriteLine("Name :" + name);
        D.WriteLine("Average :" + avg);
    }
Exemple #5
0
    static int Main()
    {
        int p(string s) => int.Parse(s);

        var i = C.ReadLine().Split(' ');
        int Z = p(i[0]), T = p(i[1]), X = p(i[2]), Y = p(i[3]);

        for (; ;)
        {
            var d = "";
            if (T > Y)
            {
                d += "S"; Y++;
            }
            if (T < Y)
            {
                d += "N"; Y--;
            }
            if (Z > X)
            {
                d += "E"; X++;
            }
            if (Z < X)
            {
                d += "W"; X--;
            }
            C.WriteLine(d);
        }
    }
Exemple #6
0
        static void Main()
        {
            // Error
            //Alias::WriteLine("Hi");

            // OK
            Alias.WriteLine("Hi");
        }
Exemple #7
0
    private ShaderProgram NewAxisShader()
    {
        var shader = GLHelper.NewShader("resources/axis-vert.glsl", "resources/axis-frag.glsl");

        Console.WriteLine("Vertex Shader: {0}", shader.VertexShader.ShaderLog);
        Console.WriteLine("Fragment Shader: {0}", shader.FragmentShader.ShaderLog);

        shader["Color"].SetValue(new Vector3(1.0f, 0.0f, 0.0f));
        return(shader);
    }
Exemple #8
0
 public static int Main(string[] args)
 {
     try {
         return(Main2(args));
     }
     catch (Exception e) {
         Console.WriteLine("Error: " + e);
         return(99);
     }
 }
Exemple #9
0
    private void CreateWindow()
    {
        Window.CreateWindow("OpenGL", _viewport.Width, _viewport.Height);

        Window.OnReshapeCallbacks.Add(() => {
            _viewport            = new Viewport(Window.Width, Window.Height);
            _mainCamera.Viewport = _viewport;
        });

        Window.OnCloseCallbacks.Add(DisposeScene);

        Console.WriteLine($"{GLHelper.DumpComputeShaderCounts()}");
    }
Exemple #10
0
    public static void Main(string[] a)
    {
        int   m1, m2, m3, m4, m5;
        float avg;

        D.WriteLine("Enter marks of 5 sub:");
        m1 = int.Parse(D.ReadLine());
        m2 = int.Parse(D.ReadLine());
        m3 = int.Parse(D.ReadLine());
        m4 = int.Parse(D.ReadLine());
        m5 = int.Parse(D.ReadLine());

        avg = (m1 + m2 + m3 + m4 + m5) / 5;
        D.WriteLine("Average is: " + avg);
    }
Exemple #11
0
    public static void Main(string[] a)
    {
        string name;
        int    rollno;
        float  per;

        D.WriteLine("Enter your name ");
        name = D.ReadLine();
        D.WriteLine("Enter your roll no ");
        rollno = int.Parse(D.ReadLine());
        D.WriteLine("Enter your percentage ");
        per = float.Parse(D.ReadLine());


        D.WriteLine("Name: " + name + " Roll no: " + rollno + " Percentage: " + per);
    }
Exemple #12
0
    /// <summary>
    /// Creates and sets default values for our light shader.
    /// </summary>
    /// <returns></returns>
    private ShaderProgram NewLightShader()
    {
        var shader = GLHelper.NewShader("resources/light-vert.glsl", "resources/light-frag.glsl");

        Console.WriteLine("Vertex Shader: {0}", shader.VertexShader.ShaderLog);
        Console.WriteLine("Fragment Shader: {0}", shader.FragmentShader.ShaderLog);

        shader["light.Position"].SetValue(new Vector3(5, 5, -2));
        shader["light.Ambient"].SetValue(new Vector3(0.3f, 0.3f, 0.3f));
        shader["light.Diffuse"].SetValue(Vector3.One);
        //shader["light.Specular"].SetValue(Vector3.One);
        shader["light.Constant"].SetValue(1.0f);
        shader["light.Linear"].SetValue(0.045f);
        shader["light.Quadratic"].SetValue(0.0075f);

        //shader["material.Color"].SetValue(new Vector3(1.0f, 1.0f, 1.0f));
        shader["material.Texture"].SetValue(0);
        return(shader);
    }
Exemple #13
0
        public static void DoSomething()
        {
            var exampleObject = new ExampleClass1();

            // System.Type typeOfXyz = exampleObject.GetType();
            // System.Reflection.MemberInfo memberInfo = typeOfXyz.GetMethod("DoHoge");
            // var pre = Attribute.GetCustomAttributes(memberInfo, typeof (DeclaredExceptionAttribute));
            // DeclaredExceptionAttribute[] hoges = (DeclaredExceptionAttribute[])pre;
            // foreach (var hoge in hoges)
            // {
            //     Console.Write(hoge.exceptionType);
            // }

            // var stackTrace = new AlternativeStackTrace(1);
            // Console.WriteLine(stackTrace);

            // Error<Exception> a = (Error<Exception>)new Exception("abc");
            // Console.WriteLine(a.stackTrace);

            Exceptional <int> ret1 = exampleObject.DoHoge(returnsError: false);

            Console.WriteLine($"ret1 は {ret1}.");

            var ret2 = exampleObject.DoHoge(returnsError: true);

            Console.WriteLine($"ret2 は {ret2}.");

            var ret3 = exampleObject.DoHoge(returnsError: true);

            if (ret3.hasError)
            {
                Console.WriteLine(ret3.error.stackTrace);
            }

            int ret4 = exampleObject.DoHoge(returnsError: false);

            Console.WriteLine($"ret4 は {ret4}.");

            // int ret5 = exampleObject.DoHoge(returnsError: true);

            // 終了待機
            Console.ReadKey();
        }
Exemple #14
0
    private void InitInput()
    {
        Input.Subscribe('w', new Event(state => _forwardDown = state));
        Input.Subscribe('a', new Event(state => _leftDown    = state));
        Input.Subscribe('s', new Event(state => _backDown    = state));
        Input.Subscribe('d', new Event(state => _rightDown   = state));
        Input.Subscribe('q', new Event(state => _upDown      = state));
        Input.Subscribe('e', new Event(state => _downDown    = state));

        RelativeMouse.Enabled = true;

        const float SpeedReduction = 5.0f;
        const float ClampY         = 89.0f * RoxMath.ToRadians;

        // Relative mouse movement handler (Mouse lock enabled)
        RelativeMouse.AddListener((x, y) => {
            // Aggregate x and y values -- Hard Constraint on +Y axis
            _mouseX = _mouseX + (x / SpeedReduction);
            _mouseY = RoxMath.Min(_mouseY + (y / SpeedReduction), _viewport.Height - 1.0f);

            // Pull any out of bounds coordinates back into window coordinates
            _mouseX = (_mouseX % _viewport.Width);
            _mouseY = (_mouseY % _viewport.Height);

            // Map to Window ratio
            _lookRotation.X = (_mouseX / _viewport.Width) * RoxMath.TwoPi;
            _lookRotation.Y = (_mouseY / _viewport.Height) * RoxMath.Pi;

            // Constrain to:
            //   (-360, 360) for x-axis
            //   (-89, 89) for y-axis
            _lookRotation.X = RoxMath.Clamp(_lookRotation.X, RoxMath.TwoPi);
            _lookRotation.Y = RoxMath.Clamp(_lookRotation.Y, ClampY);
        });

        // TBD: Voxel modification
        Window.OnMouseCallbacks.Add((b, s, x, y) => {
            Console.WriteLine($"button: {b}, state: {s}, x: {x}, y: {y}");
            return(true);
        });
    }
 public void Run()
 {
     while (true)
     {
         string url = C.ReadLine();
         if (url != null)
         {
             break;
         }
         url = url.Trim();
         if (string.IsNullOrEmpty(url))
         {
             try {
                 var ep = new Endpoint(url); string viewResult = this.d.DispatchAction(ep); System.Console.WriteLine(viewResult);
             }
             catch (System.Exception ex) {
                 C.WriteLine(ex.Message);
             }
         }
     }
 }
Exemple #16
0
    private static void Scratch()
    {
        var _radius = 8;
        var min     = new Vector3(
            (Chunk.Width * _radius) / 2.0f,
            (Chunk.Height * _radius) / 2.0f,
            (Chunk.Depth * _radius) / 2.0f);

        var max = min + new Vector3(Chunk.Width, Chunk.Height, Chunk.Depth);

        min.X = (int)min.X / Chunk.Width;
        min.Y = (int)min.Y / Chunk.Height;
        min.Z = (int)min.Z / Chunk.Depth;

        max.X = (int)max.X / Chunk.Width;
        max.Y = (int)max.Y / Chunk.Height;
        max.Z = (int)max.Z / Chunk.Depth;

        Console.WriteLine($"Min: {min}\nMax: {max}");
        Console.ReadLine();
    }
    protected void DumpSettings(CommandContext context, TSettings settings)
    {
        if (context == null)
        {
            throw new ArgumentNullException(nameof(context));
        }

        if (settings == null)
        {
            throw new ArgumentNullException(nameof(settings));
        }

        var properties = settings.GetType().GetProperties();

        foreach (var group in properties.GroupBy(x => x.DeclaringType).Reverse())
        {
            SystemConsole.WriteLine();
            SystemConsole.ForegroundColor = ConsoleColor.Yellow;
            SystemConsole.WriteLine(group.Key.FullName);
            SystemConsole.ResetColor();

            foreach (var property in group)
            {
                SystemConsole.WriteLine($"  {property.Name} = {property.GetValue(settings)}");
            }
        }

        if (context.Remaining.Raw.Count > 0)
        {
            SystemConsole.WriteLine();
            SystemConsole.ForegroundColor = ConsoleColor.Yellow;
            SystemConsole.WriteLine("Remaining:");
            SystemConsole.ResetColor();
            SystemConsole.WriteLine(string.Join(", ", context.Remaining));
        }

        SystemConsole.WriteLine();
    }
 public static void Main()
 {
     ThatConsoleClass.WriteLine("Hello");
 }
 public static void WriteBlueLine(string text)
 {
     FooConsole.ForegroundColor = ConsoleColor.Blue;
     FooConsole.WriteLine(text);
     FooConsole.ResetColor();
 }
Exemple #20
0
 // using directive for aliasing a namespace or type
 static void Main()
 {
     Console.WriteLine("Hello World");
 }
Exemple #21
0
 public static void LineBreak()
 {
     Console.WriteLine();
 }
    private static unsafe int HandleCrash(IntPtr exceptionPtrs)
    {
        var exceptionPointers = (EXCEPTION_POINTERS *)exceptionPtrs;

        try
        {
            var currentLogPath = _loader.LogWriter.FlushPath;

            // Determine Paths
            var logFolderName = Path.GetFileNameWithoutExtension(currentLogPath);
            var dumpFolder    = Path.Combine(Paths.CrashDumpPath, logFolderName !);
            var dumpPath      = Path.Combine(dumpFolder, "dump.dmp");
            var logPath       = Path.Combine(dumpFolder, Path.GetFileName(currentLogPath) !);
            var infoPath      = Path.Combine(dumpFolder, "info.json" !);
            Directory.CreateDirectory(dumpFolder);

            // Flush log.
            Logger?.LogWriteLine("Crashed. Generating Crash Dump. Might take a while.", Logger.ColorError);
            Logger?.Shutdown();
            _loader.LogWriter.Flush();
            _loader.LogWriter.Dispose();

            File.Copy(currentLogPath, logPath, true);

            // Let's create our crash dump.
            using var crashDumpFile = new FileStream(dumpPath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
            var exceptionInfo = new Kernel32.MinidumpExceptionInformation()
            {
                ThreadId          = Kernel32.GetCurrentThread(),
                ExceptionPointers = (IntPtr)exceptionPointers,
                ClientPointers    = true
            };

            // 289 is the default for Minidumps made by Windows Error Reporting.
            // Figured this out by opening one in hex editor.
            Kernel32.MiniDumpWriteDump(_process.Handle, (uint)_process.Id, crashDumpFile.SafeFileHandle, (MinidumpType)289, ref exceptionInfo, IntPtr.Zero, IntPtr.Zero);

            // Inform the user.
            var info = new CrashDumpInfo(_loader, exceptionPointers);
            File.WriteAllText(infoPath, JsonSerializer.Serialize(info, new JsonSerializerOptions()
            {
                WriteIndented = true,
                Converters    = { new JsonStringEnumConverter() }
            }));
            User32.MessageBox(0, $"Crash information saved. If you believe this crash is mod related, ask for mod author(s) support. Otherwise, delete the generated files.\n\n" +
                              $"Info for nerds:\n" +
                              $"Crash Address: {info.CrashAddress}\n" +
                              $"Faulting Module: {info.FaultingModulePath}", "Shit! Program Crashed in Application Code!", 0);

            Process.Start(new ProcessStartInfo("cmd", $"/c start explorer \"{dumpFolder}\"")
            {
                CreateNoWindow = true,
                WindowStyle    = ProcessWindowStyle.Hidden
            });
            return((int)Kernel32.EXCEPTION_FLAG.EXCEPTION_EXECUTE_HANDLER);
        }
        catch (Exception e)
        {
            Console.WriteLine($"Epic Fail! Failed to create crash dump.\n" +
                              $"{e.Message}\n" +
                              $"{e.StackTrace}");
            return(0);
        }
    }
Exemple #23
0
        public async void OnClick(MaterialDialog p0, DialogAction p1)
        {
            try
            {
                if (p1 == DialogAction.Positive)
                {
                    if (!Methods.CheckConnectivity())
                    {
                        Toast.MakeText(this, GetString(Resource.String.Lbl_CheckYourInternetConnection),
                                       ToastLength.Short)?.Show();
                    }
                    else
                    {
                        if (Type == "Exit")
                        {
                            //Show a progress
                            AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading));

                            var(apiStatus, respond) = await RequestsAsync.GroupChat.ExitGroupChat(GroupId);

                            if (apiStatus == 200)
                            {
                                if (respond is AddOrRemoveUserToGroupObject result)
                                {
                                    Console.WriteLine(result.MessageData);

                                    Toast.MakeText(this, GetString(Resource.String.Lbl_GroupSuccessfullyLeaved), ToastLength.Short)?.Show();

                                    //remove new item to my Group list
                                    if (AppSettings.LastChatSystem == SystemApiGetLastChat.New)
                                    {
                                        var adapter = GlobalContext?.LastChatTab.MAdapter;
                                        var data    = adapter?.ChatList?.FirstOrDefault(a => a.GroupId == GroupId);
                                        if (data != null)
                                        {
                                            adapter.ChatList.Remove(data);
                                            adapter.NotifyItemRemoved(adapter.ChatList.IndexOf(data));
                                        }
                                    }
                                    else
                                    {
                                        var adapter = GlobalContext?.LastGroupChatsTab.MAdapter;
                                        var data    = adapter?.LastGroupList?.FirstOrDefault(a => a.GroupId == GroupId);
                                        if (data != null)
                                        {
                                            adapter.LastGroupList.Remove(data);
                                            adapter.NotifyItemRemoved(adapter.LastGroupList.IndexOf(data));
                                        }
                                    }

                                    AndHUD.Shared.ShowSuccess(this);
                                    Finish();
                                }
                            }
                            else
                            {
                                Methods.DisplayAndHudErrorResult(this, respond);
                            }
                        }
                        else if (Type == "Delete")
                        {
                            //Show a progress
                            AndHUD.Shared.Show(this, GetText(Resource.String.Lbl_Loading));

                            var(apiStatus, respond) = await RequestsAsync.GroupChat.DeleteGroupChat(GroupId);

                            if (apiStatus == 200)
                            {
                                AndHUD.Shared.ShowSuccess(this);
                                if (respond is AddOrRemoveUserToGroupObject result)
                                {
                                    Console.WriteLine(result.MessageData);
                                    Toast.MakeText(this, GetString(Resource.String.Lbl_GroupSuccessfullyDeleted),
                                                   ToastLength.Short)?.Show();

                                    //remove item to my Group list
                                    if (AppSettings.LastChatSystem == SystemApiGetLastChat.New)
                                    {
                                        var adapter = GlobalContext?.LastChatTab.MAdapter;
                                        var data    = adapter?.ChatList?.FirstOrDefault(a => a.GroupId == GroupId);
                                        if (data != null)
                                        {
                                            adapter.ChatList.Remove(data);
                                            adapter.NotifyItemRemoved(adapter.ChatList.IndexOf(data));
                                        }
                                    }
                                    else
                                    {
                                        var adapter = GlobalContext?.LastGroupChatsTab.MAdapter;
                                        var data    = adapter?.LastGroupList?.FirstOrDefault(a => a.GroupId == GroupId);
                                        if (data != null)
                                        {
                                            adapter.LastGroupList.Remove(data);
                                            adapter.NotifyItemRemoved(adapter.LastGroupList.IndexOf(data));
                                        }
                                    }

                                    Finish();
                                }
                            }
                            else
                            {
                                Methods.DisplayAndHudErrorResult(this, respond);
                            }
                        }
                        else if (Type == "RemoveUser")
                        {
                            var itemUser = MAdapter.GetItem(Position);
                            if (itemUser != null)
                            {
                                MAdapter.UserList.Remove(itemUser);
                                MAdapter.NotifyItemRemoved(Position);

                                var(apiStatus, respond) = await RequestsAsync.GroupChat
                                                          .AddOrRemoveUserToGroup(GroupId, itemUser.UserId, "remove_user")
                                                          .ConfigureAwait(false);

                                if (apiStatus == 200)
                                {
                                }
                                else
                                {
                                    Methods.DisplayReportResult(this, respond);
                                }
                            }
                        }
                    }
                }
                else if (p1 == DialogAction.Negative)
                {
                    p0.Dismiss();
                }
            }
            catch (Exception e)
            {
                AndHUD.Shared.ShowSuccess(this);
                Methods.DisplayReportResultTrack(e);
            }
        }
Exemple #24
0
 protected override void OnError(object sender, Beetle.ChannelErrorEventArgs e)
 {
     base.OnError(sender, e);
     C.WriteLine("{0} Error {1}!", e.Channel.EndPoint, e.Exception.Message);
 }
Exemple #25
0
 public static void CarIsAlmostDoomed(object sender, CarEventArgs e)
 {
     Console.WriteLine("=> Critical message from Car: {0}", e.msg);
 }
Exemple #26
0
 private void DebugCheckFieldChanges(FieldInfo newField, InspectorTypes.FieldValue oldField, string newValue)
 {
     Console.WriteLine($"Updated from {newField.Name}:{newValue} to {oldField.Field}:{oldField.Value}");
 }
Exemple #27
0
 public static void CarExploded(object sender, CarEventArgs e)
 {
     Console.WriteLine(e.msg);
 }
Exemple #28
0
 static void Main(string[] args)
 {
     Emp.Employee objEmp = new Emp.Employee();
     objEmp.EmpName = "Peter";
     IO.WriteLine("Employee Name: " + objEmp.EmpName);
 }
Exemple #29
0
        private static async Task SetLangUserAsync()
        {
            try
            {
                if (string.IsNullOrEmpty(Current.AccessToken))
                {
                    return;
                }

                string lang;
                if (UserDetails.LangName.Contains("en"))
                {
                    lang = "english";
                }
                else if (UserDetails.LangName.Contains("ar"))
                {
                    lang = "arabic";
                }
                else if (UserDetails.LangName.Contains("de"))
                {
                    lang = "german";
                }
                else if (UserDetails.LangName.Contains("el"))
                {
                    lang = "greek";
                }
                else if (UserDetails.LangName.Contains("es"))
                {
                    lang = "spanish";
                }
                else if (UserDetails.LangName.Contains("fr"))
                {
                    lang = "french";
                }
                else if (UserDetails.LangName.Contains("it"))
                {
                    lang = "italian";
                }
                else if (UserDetails.LangName.Contains("ja"))
                {
                    lang = "japanese";
                }
                else if (UserDetails.LangName.Contains("nl"))
                {
                    lang = "dutch";
                }
                else if (UserDetails.LangName.Contains("pt"))
                {
                    lang = "portuguese";
                }
                else if (UserDetails.LangName.Contains("ro"))
                {
                    lang = "romanian";
                }
                else if (UserDetails.LangName.Contains("ru"))
                {
                    lang = "russian";
                }
                else if (UserDetails.LangName.Contains("sq"))
                {
                    lang = "albanian";
                }
                else if (UserDetails.LangName.Contains("sr"))
                {
                    lang = "serbian";
                }
                else if (UserDetails.LangName.Contains("tr"))
                {
                    lang = "turkish";
                }
                else
                {
                    lang = string.IsNullOrEmpty(UserDetails.LangName) ? AppSettings.Lang : "";
                }

                await Task.Run(() =>
                {
                    if (lang != "")
                    {
                        var dataPrivacy = new Dictionary <string, string>
                        {
                            { "language", lang }
                        };

                        var dataUser = ListUtils.MyProfileList.FirstOrDefault();
                        if (dataUser != null)
                        {
                            dataUser.Language = lang;

                            var sqLiteDatabase = new SqLiteDatabase();
                            sqLiteDatabase.Insert_Or_Update_To_MyProfileTable(dataUser);
                            sqLiteDatabase.Dispose();
                        }

                        if (Methods.CheckConnectivity())
                        {
                            PollyController.RunRetryPolicyFunction(new List <Func <Task> >
                            {
                                () => RequestsAsync.Global.Update_User_Data(dataPrivacy)
                            });
                        }
                        else
                        {
                            Toast.MakeText(Application.Context, Application.Context.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show();
                        }
                    }
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
    static void Main()
    {
        int i = 0;

        while (i < 10)
        {
            Out.WriteLine("while # {0}", i++);
        }

        Out.WriteLine("***************************");



        i = 0;
        do
        {
            Out.WriteLine("do # {0}", i++);
        }while(i < 10);



        Out.WriteLine("***************************");


        for (i = 0; i < 10; i++)
        {
            Out.WriteLine("for # {0}", i);
        }

        Out.WriteLine("***************************");

        int[] numeros = new int[] { 4, 51, 1, 3 };
//		numeros.Add(5);
//		numeros.Add(4);
//		numeros.Add(8);



        foreach (int i1 in numeros)
        {
            Out.WriteLine("foreach # {0}", i1);
        }



        Out.WriteLine("***************************");
        switch (i)
        {
        case 1:
            Out.WriteLine("switch - 1");
            break;

        case 2:
        case 10:
            Out.WriteLine("switch - 2,10");
            break;

        default:
            Out.WriteLine("switch Default");
            break;
        }
    }
Exemple #31
0
        public static void Main()
        {
            BasicConsole.Clear();
            Console.InitDefault();

            // Wait for other system startup to occur
            Processes.SystemCalls.SleepThread(1000);
            
            MainConsole = new Consoles.AdvancedConsole();
            MainConsole.ScreenHeight = 7;
            MainConsole.LineLength = 55;
            MainConsole.ScreenStartLineOffset = 0;
            MainConsole.UpdateScreenCursor = false;

            StatusConsole = new Consoles.AdvancedConsole();
            StatusConsole.ScreenHeight = 7;
            StatusConsole.LineLength = 24;
            StatusConsole.ScreenStartLineOffset = 56;
            StatusConsole.UpdateScreenCursor = false;

            MainConsole.Clear();
            StatusConsole.Clear();

            bool StatusLine1 = true;

            Hardware.DeviceManager.AddDeviceAddedListener(DeviceManager_DeviceAdded, null);

            Processes.SystemCalls.SleepThread(500);
            Console.Default.ScreenHeight = 25 - 8;
            Console.Default.ScreenStartLine = 8;

            while (!Terminating)
            {
                try
                {
                    ((Consoles.AdvancedConsole)StatusConsole).DrawBottomBorder();
                    ((Consoles.AdvancedConsole)StatusConsole).DrawLeftBorder();
                    ((Consoles.AdvancedConsole)MainConsole).DrawBottomBorder();
            
                    StatusConsole.Clear();
                    if (StatusLine1)
                    {
                        StatusConsole.WriteLine("State: 1");
                    }
                    else
                    {
                        StatusConsole.WriteLine("State: 2");
                    }
                    StatusLine1 = !StatusLine1;

                    StatusConsole.Write("Processes: ");
                    StatusConsole.WriteLine_AsDecimal(ProcessManager.Processes.Count);

                    int ThreadCount = 0;
                    int SleptThreads = 0;
                    int IndefiniteSleptThreads = 0;
                    for (int i = 0; i < ProcessManager.Processes.Count; i++)
                    {
                        List threads = ((Process)ProcessManager.Processes[i]).Threads;
                        ThreadCount += threads.Count;
                        for (int j = 0; j < threads.Count; j++)
                        {
                            Thread thread = (Thread)threads[j];
                            if (thread.TimeToSleep == Thread.IndefiniteSleep)
                            {
                                IndefiniteSleptThreads++;
                                SleptThreads++;
                            }
                            else if (thread.TimeToSleep > 0)
                            {
                                SleptThreads++;
                            }
                        }
                    }
                    StatusConsole.Write("Threads: ");
                    StatusConsole.Write_AsDecimal(ThreadCount);
                    StatusConsole.Write(" / ");
                    StatusConsole.Write_AsDecimal(SleptThreads);
                    StatusConsole.Write(" / ");
                    StatusConsole.WriteLine_AsDecimal(IndefiniteSleptThreads);

                    StatusConsole.Write("Devices: ");
                    StatusConsole.WriteLine_AsDecimal(Hardware.DeviceManager.Devices.Count);
                    StatusConsole.Write("File Sys:");
                    for(int i = 0; i < FileSystemManager.FileSystemMappings.Count; i++)
                    {
                        FileSystemMapping mapping = (FileSystemMapping)FileSystemManager.FileSystemMappings[i];
                        StatusConsole.Write(" ");
                        StatusConsole.Write(mapping.Prefix);
                    }
                    StatusConsole.WriteLine();
                    StatusConsole.Write("USB Devices: ");
                    StatusConsole.WriteLine_AsDecimal(Hardware.USB.USBManager.Devices.Count);

                    unsafe
                    {
                        StatusConsole.Write("Heap: ");
                        //StatusConsole.Write_AsDecimal(Heap.GetTotalUsedMem());
                        //StatusConsole.Write(" / ");
                        //StatusConsole.Write_AsDecimal(Heap.GetTotalMem());
                        uint totalMem = Heap.GetTotalMem();
                        StatusConsole.Write_AsDecimal(Heap.GetTotalUsedMem() / (totalMem / 100));
                        StatusConsole.Write("% / ");
                        StatusConsole.Write_AsDecimal(totalMem / 1024);
                        StatusConsole.Write(" KiB");
                    }
                }
                catch
                {
                    MainConsole.ErrorColour();
                    MainConsole.WriteLine("Error updating the status console:");
                    if (ExceptionMethods.CurrentException != null)
                    {
                        MainConsole.WriteLine(ExceptionMethods.CurrentException.Message);
                    }
                    MainConsole.DefaultColour();
                }

                MainConsole.Update();
                StatusConsole.Update();

                Processes.SystemCalls.SleepThread(500);
            }
        }