public override PlayerTable OnLogin(LoginData userData) { List <PlayerTable> playerTables = PlayerTableInstance.GetActorList(); for (int i = 0; i < playerTables.Count; i++) { if (playerTables[i].PlayerName == userData.UserName) { return(playerTables[i]); } } PlayerTable playerTable = new PlayerTable() { }; playerTable.DataID = PlayerTableInstance.Count <= 0 ? 10000 : PlayerTableInstance.GetLastItme().DataID + 1; playerTable.PlayerName = userData.UserName; playerTable.Password = userData.Password; playerTable.ActorTable_DataID = userData.ActorTable_DataID; SQLiteConnection connection = DataBaseHelperExtend.GetDefaultDataBaseConnnect(); connection.Insert(playerTable); return(playerTable); }
public TableManager() { var connection = DataBaseHelperExtend.GetDefaultDataBaseConnnect(); var collection = connection.Table <T>(); foreach (var item in collection) { tableList.Add(item); } }
public string GetExpresionResult(string tableName) { SQLiteConnection connection = DataBaseHelperExtend.GetDefaultDataBaseConnnect(); List <CodeFormat> codeList = new List <CodeFormat>(); ICodeFormatManager formatManager = new CodeFormatManager(); ISQLToSharp sqlReplace = new SQLToSharp(); foreach (var item in connection.GetTableInfo(tableName)) { string CodeType = string.Format("{0}", sqlReplace.ReplaceSQLType(item.ColumnType)); CodeFormat codeFormat = new CodeFormat() { CodeTypeName = item.Name, CodeType = CodeType }; formatManager.Add(codeFormat); } string finalResult = formatManager.GetCodeResult(); return(finalResult); }
public static void GenerateCode() { string sql = "SELECT * FROM sqlite_master where type='table' AND tbl_name != 'sqlite_sequence'"; SQLiteConnection connection = DataBaseHelperExtend.GetDefaultDataBaseConnnect(); List <TableView> tableViews = connection.Query <TableView>(sql); string templematePath = string.Format("{0}/Helper/Templemate/TableTemplate.txt", Application.dataPath); string templemateStr = File.ReadAllText(templematePath); WriteCodeToFile codeWrite = new WriteCodeToFile(); IRegularExpressionHelper regularExpressionHelper = new TableStructHelper(); foreach (TableView item in tableViews) { string code = regularExpressionHelper.GetExpresionResult(item.tbl_name); string replaceClassName = templemateStr.Replace("#SCRIPTNAME#", item.name); string finalCode = replaceClassName.Replace("#CodeList#", code); string finalSourcePath = string.Format("{0}/DataBaseCode/{1}.cs", Application.dataPath, item.tbl_name); codeWrite.WriteToFile(finalSourcePath, finalCode); } }