// -- Get Command // Rename Command -- /// <summary> /// Renames a SQLite table name. /// </summary> /// <param name="table">Table to rename.</param> /// <param name="renameTo">Name to change to.</param> public static void Rename(this ISQLiteTable table, string renameTo) { renameCommand.ExecuteOnTable = table; renameCommand.NewTableName = renameTo; renameCommand.Execute(); }
public SQLiteResourceWorldEditorModel(ISQLiteTable locatedInTable, int worldId, int resourceTypeId, int xpos, int ypos) : base(locatedInTable) { WorldId = worldId; ResourceTypeId = resourceTypeId; Xpos = xpos; Ypos = ypos; }
public SQLiteTileWorldEditorModel(ISQLiteTable locatedInTable, int worldId, int tileTypeId, int xpos, int ypos) : base(locatedInTable) { WorldId = worldId; TileTypeId = tileTypeId; Xpos = xpos; Ypos = ypos; }
private void InstantiateTables() { UnitTable = new SQLiteTable <SQLiteUnitModel>("UnitTable", provider); UnitTypeTable = new SQLiteTable <SQLiteUnitTypeModel>("UnitTypeTable", provider); CanBuildUnitTable = new SQLiteTable <SQLiteCanBuildUnitModel>("CanBuildUnitTable", provider); UnitGotPassiveTable = new SQLiteTable <SQLiteUnitGotPassiveModel>("UnitGotPassiveTable", provider); UnitWorldEditorTable = new SQLiteTable <SQLiteUnitWorldEditorModel>("UnitWorldEditorTable", provider); UnitTypeWorldEditorTable = new SQLiteTable <SQLiteUnitTypeWorldEditorModel>("UnitTypeWorldEditorTable", provider); BuildingTable = new SQLiteTable <SQLiteBuildingModel>("BuildingTable", provider); BuildingTypeTable = new SQLiteTable <SQLiteBuildingTypeModel>("BuildingTypeTable", provider); CanBuildPassiveTable = new SQLiteTable <SQLiteCanBuildPassiveModel>("CanBuildPassiveTable", provider); BuildingGotPassiveTable = new SQLiteTable <SQLiteBuildingGotPassiveModel>("BuildingGotPassiveTable", provider); DoodadWorldEditorTable = new SQLiteTable <SQLiteDoodadWorldEditorModel>("DoodadWorldEditorTable", provider); DoodadTypeWorldEditorTable = new SQLiteTable <SQLiteDoodadTypeWorldEditorModel>("DoodadTypeWorldEditorTable", provider); ResourceWorldEditorTable = new SQLiteTable <SQLiteResourceWorldEditorModel>("ResourceWorldEditorTable", provider); ResourceTypeWorldEditorTable = new SQLiteTable <SQLiteResourceTypeWorldEditorModel>("ResourceTypeWorldEditorTable", provider); TileWorldEditorTable = new SQLiteTable <SQLiteTileWorldEditorModel>("TileWorldEditorTable", provider); BuildingWorldEditorTable = new SQLiteTable <SQLiteBuildingWorldEditorModel>("BuildingWorldEditorTable", provider); TileTypeWorldEditorTable = new SQLiteTable <SQLiteTileTypeWorldEditorModel>("TileTypeWorldEditorTable", provider); WorldEditorTable = new SQLiteTable <SQLiteWorldEditorModel>("WorldEditorTable", provider); CampaignChapterTable = new SQLiteTable <SQLiteCampaignChapterModel>("CampaignChapterTable", provider); FactionTable = new SQLiteTable <SQLiteFactionModel>("FactionTable", provider); PassiveTable = new SQLiteTable <SQLitePassiveModel>("PassiveTable", provider); StatsTable = new SQLiteTable <SQLiteStatsModel>("StatsTable", provider); ProjectileTypeTable = new SQLiteTable <SQLiteProjectileTypeModel>("ProjectileTypeTable", provider); }
public SQLiteDoodadWorldEditorModel(ISQLiteTable locatedInTable, int worldId, int doodadTypeId, int xpos, int ypos) : base(locatedInTable) { WorldId = worldId; DoodadTypeId = doodadTypeId; Xpos = xpos; Ypos = ypos; }
private static void UpdateRow(ISQLiteTable table, int[] ids, Dictionary <PropertyInfo, object> updatedData) { updateCommand.ExecuteOnTable = table; updateCommand.Ids = ids; updateCommand.UpdatedData = updatedData; updateCommand.Execute(); }
// -- Insert Command // Insert Multiple Command -- /// <summary> /// Inserts a list of rows into a SQLite table. /// </summary> /// <param name="table">Table to insert rows to.</param> /// <param name="rows">List of rows to insert.</param> public static void InsertMultiple(this ISQLiteTable table, List <ISQLiteRow> rows) { insertMultipleCommand.ExecuteOnTable = table; insertMultipleCommand.ResultRows = rows; insertMultipleCommand.Execute(); }
public SQLiteBuildingModel(ISQLiteTable locatedInTable, int factionId, int buildingTypeId, int projectileTypeId, int statsId, string name) : base(locatedInTable) { FactionId = factionId; BuildingTypeId = buildingTypeId; ProjectileTypeId = projectileTypeId; StatsId = statsId; Name = name; }
public SQLiteUnitModel(ISQLiteTable locatedInTable, int factionId, int unitTypeId, int projectileTypeId, int statsId, string name) : base(locatedInTable) { FactionId = factionId; UnitTypeId = unitTypeId; ProjectileTypeId = projectileTypeId; StatsId = statsId; Name = name; }
private static void DeleteRow(ISQLiteTable table, PropertyInfo property, object data) { deleteCommand.Column = property; deleteCommand.Data = data; deleteCommand.ExecuteOnTable = table; deleteCommand.Execute(); }
public SQLiteBuildingWorldEditorModel(ISQLiteTable locatedInTable, int worldId, int buildingTypeId, int team, int faction, int xpos, int ypos) : base(locatedInTable) { WorldId = worldId; BuildingTypeId = buildingTypeId; Team = team; Faction = faction; Xpos = xpos; Ypos = ypos; }
public SQLiteUnitWorldEditorModel(ISQLiteTable locatedInTable, int worldId, int unitTypeId, int team, int faction, int xpos, int ypos) : base(locatedInTable) { WorldId = worldId; UnitTypeId = unitTypeId; Team = team; Faction = faction; Xpos = xpos; Ypos = ypos; }
// -- Update Command // Command Methods -- private static ISQLiteRow InsertRow(ISQLiteTable table, ISQLiteRow row, bool unique) { insertCommand.ExecuteOnTable = table; insertCommand.IsUnique = unique; insertCommand.RowToInsert = row; insertCommand.Execute(); return(row); }
public SQLitePassiveModel(ISQLiteTable locatedInTable, int percentId, int flatId, float buildTime, string name, string description, string displayImageName, string displayIconName) : base(locatedInTable) { PercentId = percentId; FlatId = flatId; BuildTime = buildTime; Name = name; Description = description; DisplayImageName = displayImageName; DisplayIconName = displayIconName; }
private void InstantiateRepositories() { ISQLiteTable[] unitReposTables = new ISQLiteTable[] { Singletons.TableContainerSingleton.UnitTable, Singletons.TableContainerSingleton.FactionTable, Singletons.TableContainerSingleton.StatsTable }; UnitRepository = new SQLiteRepository(unitReposTables); }
private static List <ISQLiteRow> GetRow(ISQLiteTable table, PropertyInfo property, object data) { getCommand.Column = property; getCommand.Data = data; getCommand.ExecuteOnTable = table; getCommand.Execute(); return(getCommand.ResultRows); }
/// <summary> /// Maps rows from a SQLite database. /// </summary> /// <param name="reader">Reads from the SQLite database.</param> /// <param name="readFromTable">SQLite Table to read from.</param> /// <returns>Return a list of rows from a SQLite database.</returns> public List <ISQLiteRow> MapRowsFromReader(IDataReader reader, ISQLiteTable readFromTable) { List <ISQLiteRow> result = new List <ISQLiteRow>(); while (reader.Read()) { ISQLiteRow row = CreateRow(reader); row.LocatedInTable = readFromTable; result.Add(row); } return(result); }
public SQLiteStatsModel(ISQLiteTable locatedInTable, int foodCost, int goldCost, int woodCost, int stoneCost, float buildTime, int health, int damage, int armor, float speed, int range, int gatheringAmount, float gatheringSpeed, int gatheringCapacity) : base(locatedInTable) { FoodCost = foodCost; GoldCost = goldCost; WoodCost = woodCost; StoneCost = stoneCost; BuildTime = buildTime; Health = health; Damage = damage; Armor = armor; Speed = speed; Range = range; GatheringAmount = gatheringAmount; GatheringSpeed = gatheringSpeed; GatheringCapacity = gatheringCapacity; }
public SQLiteTileTypeWorldEditorModel(ISQLiteTable locatedInTable, int tileType) : base(locatedInTable) { TileType = tileType; }
public SQLiteCanBuildUnitModel(ISQLiteTable locatedInTable, int unitId, int buildingId) : base(locatedInTable) { UnitId = unitId; BuildingId = buildingId; }
// -- Delete Command // Get Command -- /// <summary> /// Gets a row from a SQLite table. /// </summary> /// <param name="table">Table to get row from.</param> /// <param name="id">Id to find.</param> /// <returns>Returns found row.</returns> public static ISQLiteRow Get(this ISQLiteTable table, int id) { return(GetRow(table, typeof(SQLiteRowBase).GetProperty("Id"), id).First()); }
public SQLiteDoodadTypeWorldEditorModel(ISQLiteTable locatedInTable, int doodadType) : base(locatedInTable) { DoodadType = doodadType; }
/// <summary> /// Gets a row from a SQLite table. /// </summary> /// <param name="table">Table to get row from.</param> /// <param name="property">Search in property/column</param> /// <param name="data">Search for data.</param> /// <returns>Returns found row.</returns> public static ISQLiteRow Get(this ISQLiteTable table, PropertyInfo property, object data) { return(GetRow(table, property, data).First()); }
/// <summary> /// Deletes row from SQLite table. /// </summary> /// <param name="table">Table to delete from.</param> /// <param name="property">Search in property/column</param> /// <param name="data">Search for data.</param> public static void Delete(this ISQLiteTable table, PropertyInfo property, object data) { DeleteRow(table, property, data); }
/// <summary> /// Gets multiple rows from a SQLite table. /// </summary> /// <param name="table">Table to get row from.</param> /// <param name="property">Search in property/column</param> /// <param name="data">Search for data.</param> /// <returns>Returns list of found rows.</returns> public static List <ISQLiteRow> GetMultiple(this ISQLiteTable table, PropertyInfo property, object data) { return(GetRow(table, property, data)); }
// -- Insert Multiple Command // Delete Command -- /// <summary> /// Deletes row from SQLite table. /// </summary> /// <param name="table">Table to delete from.</param> /// <param name="id">Delete by Id.</param> public static void Delete(this ISQLiteTable table, int id) { DeleteRow(table, typeof(SQLiteRowBase).GetProperty("Id"), id); }
/// <summary> /// Get all rows from a SQLite table. /// </summary> /// <param name="table">Table to get rows from.</param> /// <returns>Returns a list of all rows.</returns> public static List <ISQLiteRow> GetAll(this ISQLiteTable table) { return(GetRow(table, null, null)); }
/// <summary> /// Inserts a row into a SQLite table. /// </summary> /// <param name="table">Table to insert row to.</param> /// <param name="row">Row to insert.</param> /// <param name="unique">Defines if the row is unique or not.</param> /// <returns>Returns row.</returns> public static ISQLiteRow Insert(this ISQLiteTable table, ISQLiteRow row, bool unique) { return(InsertRow(table, row, unique)); }
// Insert Command -- /// <summary> /// Inserts a row into a SQLite table. /// </summary> /// <param name="table">Table to insert row to.</param> /// <param name="row">Row to insert.</param> /// <returns>Returns row.</returns> public static ISQLiteRow Insert(this ISQLiteTable table, ISQLiteRow row) { return(InsertRow(table, row, false)); }
/// <summary> /// Updates a row in a SQLite table. /// </summary> /// <param name="table">Table to update in.</param> /// <param name="ids">Ids of rows to update.</param> /// <param name="updatedData">Updates all found rows with the given properties/columns with the paired value.</param> public static void Update(this ISQLiteTable table, int[] ids, params KeyValuePair <PropertyInfo, object>[] updatedData) { UpdateRow(table, ids, updatedData.ToDictionary(pair => pair.Key, pair => pair.Value)); }