static private CreateConnection ( ) : |
||
Résultat |
private static void Insert(DataTable varTexPath) { using (var conn = CacheManager.CreateConnection()) { insert.Connection = conn; conn.Open(); using (var t = conn.BeginTransaction()) { for (var i = 0; i < varTexPath.Rows.Count; i++) { int texPath = (int)varTexPath.Rows[i]["ID"]; for (var j = 1; j < varTexPath.Columns.Count; j++) { int raceID = 1 + Int32.Parse(varTexPath.Columns[j].ColumnName); // Add 1 to the column number to get RaceID int texFolder = (int)(short)varTexPath.Rows[i][j]; InsertRow(raceID, texPath, texFolder); } } t.Commit(); } insert.Connection = null; } }
private static void Insert(DataTable actorclass_graphic, DataTable actorclass, DataTable displayEn) { using (var conn = CacheManager.CreateConnection()) { insert.Connection = conn; conn.Open(); using (var t = conn.BeginTransaction()) { for (var i = 0; i < actorclass_graphic.Rows.Count; i++) { var row = actorclass_graphic.Rows[i]; var data = Actor.FromDataRow(row); var actorClassRow = actorclass.Select("ID = " + data.ID.ToString()); if (actorClassRow.Length == 0) { continue; } var displayEnRow = displayEn.Select("ID = " + actorClassRow[0]["5"]); if (displayEnRow.Length == 0) { continue; } data.Name = (string)displayEnRow[0]["1"]; InsertRow(data); } t.Commit(); } insert.Connection = null; } }
public static void Insert(VarEquip row) { using (var conn = CacheManager.CreateConnection()) { insert.Connection = conn; conn.Open(); InsertRow(row); insert.Connection = null; } }
private static void InsertRange(List <Actor> rows) { using (var conn = CacheManager.CreateConnection()) { insert.Connection = conn; conn.Open(); using (var t = conn.BeginTransaction()) { rows.ForEach(x => InsertRow(x)); t.Commit(); } insert.Connection = null; } }
public static void FillCache() { string path = Path.Combine(Properties.Settings.Default.GameDirectory, cmnFilePath); var cmnFile = DatDigger.Sections.SectionLoader.OpenFile(path); var eqp = cmnFile.FindChild <DatDigger.Sections.Model.EquipParamSection>(); using (var conn = CacheManager.CreateConnection()) { insert.Connection = conn; conn.Open(); using (var trans = conn.BeginTransaction()) { eqp.EquipParams.ForEach(x => InsertRow(x)); trans.Commit(); } insert.Connection = null; } }
public static void Insert(System.Data.DataTable dt) { using (var conn = CacheManager.CreateConnection()) { insert.Connection = conn; conn.Open(); using (var t = conn.BeginTransaction()) { for (var i = 0; i < dt.Rows.Count; i++) { var row = dt.Rows[i]; var data = VarEquip.FromDataRow(row); InsertRow(data); } t.Commit(); } insert.Connection = null; } }
public static EquipParam GetById(int modelId) { EquipParam result = null; using (var conn = CacheManager.CreateConnection()) { using (var cmd = conn.CreateCommand()) { cmd.CommandText = "SELECT * FROM EquipParams WHERE ID = @ID"; cmd.Parameters.AddWithValue("@ID", modelId); conn.Open(); using (var reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) { if (reader.Read()) { result = EquipParam.FromDataReader(reader); } } } } return(result); }
public static int GetTextureFolderId(int texPath, int race) { if (texPath == 0) { return(race); } int result = 1; using (var conn = CacheManager.CreateConnection()) { conn.Open(); using (var cmd = conn.CreateCommand()) { cmd.CommandText = @"SELECT TexFolder FROM TexturePath WHERE RaceID = @RaceID AND TexPath = @TexPath"; cmd.Parameters.AddWithValue("@RaceID", race); cmd.Parameters.AddWithValue("@TexPath", texPath); result = System.Convert.ToInt32(cmd.ExecuteScalar()); } } return(result); }
public static ReadOnlyCollection <Actor> SearchByName(string search) { search = "%" + search + "%"; List <Actor> result = new List <Actor>(); using (var conn = CacheManager.CreateConnection()) { using (var cmd = conn.CreateCommand()) { cmd.CommandText = "SELECT * FROM Actors WHERE Name LIKE @search ORDER BY Name ASC LIMIT 200"; cmd.Parameters.AddWithValue("@search", search); conn.Open(); using (var reader = cmd.ExecuteReader(CommandBehavior.SingleResult)) { while (reader.Read()) { result.Add(Actor.FromDataReader(reader)); } } } } return(result.AsReadOnly()); }