public string IDProperty_Add_Succeed(params int[] enums) { IDProperty property = new IDProperty(); foreach (var item in enums) { property.AddID(item); } return(property.ToString()); }
protected void UpdateFileName() { String newName = @"\" + TypeProperty + "_" + ColonyIDProperty.ToString("D2") + "_" + IDProperty.ToString("D4") + "_" + StateProperty + ".ant"; System.IO.File.Move(FullPathProperty, LocationProperty + newName); FullPathProperty = (LocationProperty + newName); }
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(); } } }
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) { } } }
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(); } } }
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()); }