コード例 #1
0
ファイル: CDraw.cs プロジェクト: SirJosh3917/CP
 /// <summary>
 /// Refreshes the screen to apply any changes made.
 /// </summary>
 /// <returns>True if it went well, false if not.</returns>
 public bool Refresh()
 {
     return(KernalHandle.WriteConsoleOutput(h, buf,
                                            new CP.KernalHandle.Coord()
     {
         X = 80, Y = 25
     },
                                            new CP.KernalHandle.Coord()
     {
         X = 0, Y = 0
     },
                                            ref rect));
 }
コード例 #2
0
ファイル: CDraw.cs プロジェクト: SirJosh3917/CP
        public CDraw()
        {
            if (!_gen)
            {
                GeneratedCDraw = this;
                _gen           = true;
            }
            else
            {
                this.h    = GeneratedCDraw.h;
                this.buf  = GeneratedCDraw.buf;
                this.rect = GeneratedCDraw.rect;
            }

            Console.SetBufferSize(80, 25);
            Console.SetWindowSize(80, 25);
            h = KernalHandle.CreateFile("CONOUT$", 0x40000000, 2, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero);

            if (h.IsInvalid)
            {
                Console.WriteLine("h.IsInvalid is invalid. Please restart the application.");
                throw new Exception("h.IsInvalid");
            }
        }