/// <summary>
        /// Add to query provider
        /// </summary>
        /// <param name="Database">Database object</param>
        public void AddToQueryProvider(IDatabase Database)
        {
            Mapping <ClassType> Map = SQLHelper.Map <ClassType>(TableName, IDProperty.Chain(x => x.FieldName), IDProperty.Chain(x => x.AutoIncrement), Database.Chain(x => x.Name));

            ((IProperty <ClassType>)IDProperty).Chain(x => x.AddToQueryProvider(Database, Map));
            foreach (IProperty Property in Properties)
            {
                ((IProperty <ClassType>)Property).AddToQueryProvider(Database, Map);
            }
        }
        public string IDProperty_Add_Succeed(params int[] enums)
        {
            IDProperty property = new IDProperty();

            foreach (var item in enums)
            {
                property.AddID(item);
            }

            return(property.ToString());
        }
Exemple #3
0
        protected void UpdateFileName()
        {
            String newName = @"\" + TypeProperty + "_" + ColonyIDProperty.ToString("D2") + "_" + IDProperty.ToString("D4") + "_" + StateProperty + ".ant";

            System.IO.File.Move(FullPathProperty, LocationProperty + newName);
            FullPathProperty = (LocationProperty + newName);
        }
Exemple #4
0
 public Queen(int id, int colonyID, String location, bool loaded = false)
     : base(QUEEN_START_HEALTH, QUEEN_START_HUNGER, id, colonyID, 0, location, AntType.Queen)
 {
     TypeProperty        = AntType.Queen;
     CarryingProperty    = Carrying.Food;
     CarryAmountProperty = 10000;
     LocationProperty    = location;
     FullPathProperty    = LocationProperty + @"\" + TypeProperty + "_" + ColonyIDProperty.ToString("D2") + "_" + IDProperty.ToString("D4") + "_" + StateProperty + ".ant";
     StateProperty       = State.Standby;
     if (!File.Exists(FullPathProperty) && loaded == false)
     {
         // Create a file to write to.
         using (StreamWriter sw = File.CreateText(FullPathProperty))
         {
             sw.WriteLine("Type:" + this.TypeProperty);
             sw.WriteLine("Health:" + this.HealthProperty);
             sw.WriteLine("Hunger:" + this.HungerProperty);
             sw.Close();
         }
     }
 }
Exemple #5
0
        override public void Move()// The ant finds a suitable folder to enter, sets it to 'destination' then moves itself there.
        {
            //not used by queen unless being carried by another ant.

            if (DestinationProperty != "")
            {
                //Set current location to previouslocation property.

                try
                {
                    PreviousLocationProperty = LocationProperty;

                    File.Move(FullPathProperty, DestinationProperty + @"\" + TypeProperty + "_" + ColonyIDProperty.ToString("D2") + "_" + IDProperty.ToString("D4") + "_" + StateProperty + ".ant");
                    LocationProperty = DestinationProperty;
                    FullPathProperty = DestinationProperty + @"\" + TypeProperty + "_" + ColonyIDProperty.ToString("D2") + "_" + IDProperty.ToString("D4") + "_" + StateProperty + ".ant";
                }
                catch (UnauthorizedAccessException err)
                {
                }
            }
        }
Exemple #6
0
 public object ID(object target)
 {
     return(IDProperty.GetValue(target, null));
 }
 set => SetValue(IDProperty, value);
Exemple #8
0
        public Egg(int id, int colonyID, String location, bool loaded = false)
            : base(1000, 0, id, colonyID, 0, location, AntType.Egg)
        {
            this.TypeProperty  = AntType.Egg;
            this.StateProperty = State.Standby;
            //create file
            this.LocationProperty = location;
            this.FullPathProperty = LocationProperty + @"\" + TypeProperty + "_" + ColonyIDProperty.ToString("D2") + "_" + IDProperty.ToString("D4") + "_" + StateProperty + ".ant";
            if (!File.Exists(FullPathProperty) && loaded == false)
            {
                // Create a file to write to.
                using (StreamWriter sw = File.CreateText(FullPathProperty))
                {
                    sw.WriteLine("Type:" + this.TypeProperty);
                    sw.WriteLine("Health:" + this.HealthProperty);

                    sw.Close();
                }
            }
        }
Exemple #9
0
        public Larvae(int id, int colonyID, String location, bool loaded = false)
            : base(1000, 0, id, colonyID, 0, location, AntType.Larvae)
        {
            this.StateProperty = State.Standby;
            //delete old egg from colony array
            //might be a usefull find function.
            this.LocationProperty = location;
            this.FullPathProperty = LocationProperty + @"\" + TypeProperty + "_" + ColonyIDProperty.ToString("D2") + "_" + IDProperty.ToString("D4") + "_" + StateProperty + ".ant";
            if (!File.Exists(FullPathProperty) && loaded == false)
            {
                // Create a file to write to.
                using (StreamWriter sw = File.CreateText(FullPathProperty))
                {
                    sw.WriteLine("Type:" + this.TypeProperty);
                    sw.WriteLine("Health:" + this.HealthProperty);
                    sw.Close();
                }
            }



            for (int a = 0; a < AntFarmForm.antHills[this.ColonyIDProperty].ants.Count; a++)
            {
                if (MyAnthillProperty.ants[a] != null && MyAnthillProperty.ants[a].IDProperty == id && MyAnthillProperty.ants[a].TypeProperty == AntType.Egg)
                {
                    MyAnthillProperty.ants[a] = this;
                }
            }
        }
        public string IDProperty_Structure_Succeed(params long[] ids)
        {
            IDProperty property = new IDProperty(ids);

            return(property.ToString());
        }
Exemple #11
0
 get => (int)GetValue(IDProperty); set => SetValue(IDProperty, value);