예제 #1
0
파일: Printer.cs 프로젝트: SergeiWal/OOTP
 virtual public void IAmPrinting(Soft sft)
 {
     if (sft is Game)
     {
         Console.WriteLine("This soft is Game!");
         if (sft is Sapper)
         {
             Console.WriteLine("And this soft is Sapper!");
         }
         Console.WriteLine(sft.ToString());
     }
     else if (sft is TextProcessor)
     {
         Console.WriteLine("This soft is TextProcessor!");
         if (sft is Word)
         {
             Console.WriteLine("And this soft is Word!");
         }
         Console.WriteLine(sft.ToString());
     }
     else if (sft is Bag)
     {
         Console.WriteLine("This soft is Virus!");
         if (sft is CConficer)
         {
             Console.WriteLine("And this soft is CConficer!");
         }
         Console.WriteLine(sft.ToString());
     }
     else
     {
         throw new ApplicationException("This soft is undefined!");
     }
 }
예제 #2
0
파일: Error.cs 프로젝트: SergeiWal/OOTP
 static public void HardwareChrcking(Computer pc, Soft sf)
 {
     if (pc.Hard.Memory < sf.Memory)
     {
         throw new HardwareExeption();
     }
     if (pc.Hard.RAM < sf.RAM)
     {
         throw new HardwareExeption();
     }
 }
예제 #3
0
파일: Error.cs 프로젝트: SergeiWal/OOTP
 static public void IsVirus(Soft sf)
 {
     if (sf is Bag)
     {
         if (sf is CConficer)
         {
             throw new MaliciousSoftware("CConficer");
         }
         else
         {
             throw new MaliciousSoftware("Incoginto virus");
         }
     }
 }
예제 #4
0
파일: Soft.cs 프로젝트: SergeiWal/OOTP
 public override bool Equals(object obj)
 {
     if (obj is Soft && obj != null)
     {
         Soft temp = (Soft)obj;
         if (temp.Name == this.Name && temp.Type == this.Type)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
예제 #5
0
 public void Add(Soft value)
 {
     HardwareExeption.HardwareChrcking(this, value);
     MaliciousSoftware.IsVirus(value);
     software.Add(value);
 }