public void racerwritetofile(BoatsRacing racer, string path) { using (StreamWriter sw = System.IO.File.AppendText(@path + @"\Race List.txt")) { sw.WriteLine("{0}, {1}, {2}", racer.name, racer.boatName, racer.boatNumber); } }
public static Dictionary <string, BoatsRacing> loadRaceFile(Dictionary <string, BoatsRacing> raceDictionary, string path) { StreamReader reader = System.IO.File.OpenText(@path + @"\Race List.txt"); string line; while ((line = reader.ReadLine()) != null) { string[] items = line.Split(char.Parse(", ")); Console.WriteLine("{0}, {1}, {2}", items[0], items[1], items[2]); BoatsRacing boat1 = new BoatsRacing(items[0], items[1], int.Parse(items[2])); raceDictionary.Add(items[0], boat1); } reader.Close(); return(raceDictionary); }
public static BoatsRacing converter5(Boatsold boat) { BoatsRacing racer1 = new BoatsRacing(boat.name, boat.boat5, boat.boatNumber5); return(racer1); }
public static void SQLremoveboat(Boatsold boats, BoatsRacing boat) { /* * if (boats.name == boat.name) * { * boats.noOfBoats = boats.noOfBoats - 1; * LoadFullSQL.SQLremove(false, boats.name); * if (boats.boat1 == boat.boatName) * { * if (boats.noOfBoats == 1) * { * boats.boat1 = ""; * boats.boatNumber1 = 0; * } * else if (boats.noOfBoats == 2) * { * boats.boat1 = boats.boat2; * boats.boat2 = ""; * boats.boatNumber1 = boats.boatNumber2; * boats.boatNumber2 = 0; * } * else if (boats.noOfBoats == 3) * { * boats.boat1 = boats.boat3; * boats.boat3 = ""; * boats.boatNumber1 = boats.boatNumber3; * boats.boatNumber3 = 0; * } * else if (boats.noOfBoats == 4) * { * boats.boat1 = boats.boat4; * boats.boat4 = ""; * boats.boatNumber1 = boats.boatNumber4; * boats.boatNumber4 = 0; * } * else if (boats.noOfBoats == 5) * { * boats.boat1 = boats.boat5; * boats.boat5 = ""; * boats.boatNumber1 = boats.boatNumber5; * boats.boatNumber5 = 0; * } * * } * else if (boats.boat2 == boat.boatName) * { * if (boats.noOfBoats == 2) * { * boats.boat2 = ""; * boats.boatNumber2 = 0; * } * else if (boats.noOfBoats == 3) * { * boats.boat2 = boats.boat3; * boats.boat3 = ""; * boats.boatNumber2 = boats.boatNumber3; * boats.boatNumber3 = 0; * } * else if (boats.noOfBoats == 4) * { * boats.boat2 = boats.boat4; * boats.boat4 = ""; * boats.boatNumber2 = boats.boatNumber4; * boats.boatNumber4 = 0; * } * else if (boats.noOfBoats == 5) * { * boats.boat2 = boats.boat5; * boats.boat5 = ""; * boats.boatNumber2 = boats.boatNumber5; * boats.boatNumber5 = 0; * } * * * } * * else if (boats.boat3 == boat.boatName) * { * if (boats.noOfBoats == 3) * { * boats.boat3 = ""; * boats.boatNumber3 = 0; * } * else if (boats.noOfBoats == 4) * { * boats.boat3 = boats.boat4; * boats.boat4 = ""; * boats.boatNumber3 = boats.boatNumber4; * boats.boatNumber4 = 0; * } * else if (boats.noOfBoats == 5) * { * boats.boat3 = boats.boat5; * boats.boat5 = ""; * boats.boatNumber3 = boats.boatNumber5; * boats.boatNumber5 = 0; * } * * } * else if (boats.boat4 == boat.boatName) * { * if (boats.noOfBoats == 4) * { * boats.boat4 = ""; * boats.boatNumber4 = 0; * } * else if (boats.noOfBoats == 5) * { * boats.boat4 = boats.boat5; * boats.boat5 = ""; * boats.boatNumber4 = boats.boatNumber5; * boats.boatNumber5 = 0; * } * * } * else if (boats.boat5 == boat.boatName) * { * boats.boat5 = ""; * boats.boatNumber5 = 0; * * } * * LoadFullSQL.SQLAddboat(boats.name, boats.noOfBoats, boats.boat1, boats.boatNumber1); * LoadFullSQL.SQLAddboat(boats.name, boats.noOfBoats, boats.boat2, boats.boatNumber2); * LoadFullSQL.SQLAddboat(boats.name, boats.noOfBoats, boats.boat3, boats.boatNumber3); * LoadFullSQL.SQLAddboat(boats.name, boats.noOfBoats, boats.boat4, boats.boatNumber4); * LoadFullSQL.SQLAddboat(boats.name, boats.noOfBoats, boats.boat5, boats.boatNumber5); * } */ }