Esempio n. 1
0
 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!");
     }
 }
Esempio n. 2
0
 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();
     }
 }
Esempio n. 3
0
 static public void IsVirus(Soft sf)
 {
     if (sf is Bag)
     {
         if (sf is CConficer)
         {
             throw new MaliciousSoftware("CConficer");
         }
         else
         {
             throw new MaliciousSoftware("Incoginto virus");
         }
     }
 }
Esempio n. 4
0
 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);
     }
 }
Esempio n. 5
0
 public void Add(Soft value)
 {
     HardwareExeption.HardwareChrcking(this, value);
     MaliciousSoftware.IsVirus(value);
     software.Add(value);
 }