المفيد-7

الثلاثاء، 11 أكتوبر 2016

اضافه بسيطه للقونصول سورس Trozena

الاضافه عباره عن تحديد وقت تشغيل او تحميل اي سستم او أمر في الكونصول

أعمل كلاس بأسم Console

ارمي فيه دول 
using System; using System.Collections.Generic; using System.Linq; using System.Text; 

namespace 
TroZenA { 
    public static class 
Console 
    
{ 
        private static 
DateTime NOW = DateTime.Now; 
        private static 
Time32 NOW32 = Time32.Now; 
        public static 
string Title 
        
{ 
            
get 
            
{ 
                return 
System.Console.Title; 
            } 
            
set 
            
{ 
                
System.Console.Title = value; 
            } 
        } 

        public static 
int WindowWidth 
        
{ 
            
get 
            
{ 
                return 
System.Console.WindowWidth; 
            } 
            
set 
            
{ 
                
System.Console.WindowWidth = value; ; 
            } 
        } 

        public static 
int WindowHeight 
        
{ 
            
get 
            
{ 
                return 
System.Console.WindowHeight; 
            } 
            
set 
            
{ 
                
System.Console.WindowHeight = value; 
            } 
        } 


        public static 
void WriteLine(object line, ConsoleColor color = ConsoleColor.Cyan) 
        { 

            if (
line.ToString() == "" || line.ToString() == " ") 
                
System.Console.WriteLine(); 
            else 
            { 
                
System.Console.Write(TimeStamp() + " "); 
                
System.Console.Write(line + "\n"); 
            } 
        } 

        public static 
void WriteLine() 
        { 
            
System.Console.WriteLine(); 
        } 

        public static 
string ReadLine() 
        { 
            return 
System.Console.ReadLine(); 
        } 

        public static 
ConsoleColor BackgroundColor 
        
{ 
            
get 
            
{ 
                return 
System.Console.BackgroundColor; 
            } 
            
set 
            
{ 
                
System.Console.BackgroundColor = value; 
            } 
        } 

        public static 
void Clear() 
        { 
            
System.Console.Clear(); 
        } 

        public static 
string TimeStamp() 
        { 
            return 
"[" + NOW.AddMilliseconds((Time32.Now - NOW32).GetHashCode()).ToString("hh:mm:ss") + "]"; 
        } 
    } 
}

وسيف هيجيلك ايرور في الكود دا
Console.ForegroundColor
هتخليه بالشكل دا
System.Console.ForegroundColor
وابحث عن 
Console.WriteLine("Storages loaded");
المره خليها كدا عشان الشكل العام بس
TroZenA.Console.WriteLine("Storages loaded");

اشخاص شاهدوا الموضوع

0 التعليقات:

إرسال تعليق