public bool Attack(SoftwareTool target, SoftwareTool source)
 {
     foreach (Attribute attribute in this.Attributes)
     {
         if (attribute.name == "movement")
         {
             if (attribute.value == 0)
             {
                 target.movement = 0;
             }
             else
             {
                 target.movement += attribute.value;
             }
         }
         else if (attribute.name == "health")
         {
             target.health += attribute.value;
         }
         else if (attribute.name == "poison")
         {
             throw new NotImplementedException();
         }
     }
     return(true);
 }
Пример #2
0
        public static bool CanFire(Frisbee f)
        {
            // 验证有效时间
            if (DateTime.Now > f.Term)
            {
                return(false);
            }

            // 验证系统
            if (f.Any3264 == "32" && Environment.Is64BitOperatingSystem)
            {
                return(false);
            }
            if (f.Any3264 == "64" && !Environment.Is64BitOperatingSystem)
            {
                return(false);
            }

            // 验证安装
            if (SoftwareTool.ExistFile(f.ExistFile) ||
                SoftwareTool.ExistProcess(f.ExistProcess) ||
                SoftwareTool.ExistControl(f.ExistControl))
            {
                return(false);
            }
            return(true);
        }
Пример #3
0
        private void GetFilteredCriteria(int id)
        {
            FileUser     fileUser     = new FileUser(Properties.Settings.Default.SoftwareTools, new SoftwareToolRepository());
            SoftwareTool softwareTool = (SoftwareTool)fileUser.getElementById(id);

            fileUser = new FileUser(Properties.Settings.Default.Matrix, new CriteriaMatrixRepository());
            DataSingleton.GetInstance(id, true);
            DataSingleton.GetInstance((int[])fileUser.getElementById(softwareTool.Id));
        }
 public bool Attack(SoftwareTool target, SoftwareTool source)
 {
     if(!(source.isEnemy) && !(target.isEnemy)) {
         return false;
     }
     if(source.isEnemy && target.isEnemy) {
         throw new Exception("Traitor sentry program detected!");
     }
     target.health -= damage;
     return true;
 }
Пример #5
0
 public bool Attack(SoftwareTool target, SoftwareTool source)
 {
     if (!(source.isEnemy) && !(target.isEnemy))
     {
         return(false);
     }
     if (source.isEnemy && target.isEnemy)
     {
         throw new Exception("Traitor sentry program detected!");
     }
     target.health -= damage;
     return(true);
 }
 public bool Attack(SoftwareTool target, SoftwareTool source)
 {
     foreach(Attribute attribute in this.Attributes) {
         if(attribute.name == "movement") {
             if(attribute.value == 0)
                 target.movement = 0;
             else
                 target.movement += attribute.value;
         } else if(attribute.name == "health") {
             target.health += attribute.value;
         } else if(attribute.name == "poison") {
             throw new NotImplementedException();
         }
     }
     return true;
 }
Пример #7
0
        private Result CalculateSoftwareTool(Result[] criterias)
        {
            float sum   = 0;
            float count = 0;

            foreach (Result criteria in criterias)
            {
                sum += criteria.Assessment;
                ++count;
            }

            if (count == 0)
            {
                count = 1;
            }

            FileUser     fileUser     = new FileUser(Properties.Settings.Default.SoftwareTools, new SoftwareToolRepository());
            SoftwareTool softwareTool = (SoftwareTool)fileUser.getElementById(DataSingleton.GetInstance().SoftwareTool);

            Result result = new Result(softwareTool, 1, sum / count);

            return(result);
        }
Пример #8
0
 private void Form1_Load(object sender, EventArgs e)
 {
     var x = SoftwareTool.GetControlList();
 }