private void auto_login() { sqlDB = new sqlite(); if (!sqlDB.isfileExist()) { sqlDB.createSQL(); changeScene("Login"); } else { sqlDB.updateSQL(); sqlDB.loadUserfromDB(); if (user.getAccount() == "" || user.getAccount() == null) //空的 { changeScene("Login"); } else { if (connect.isConnect()) { //See if is correct act & psd StartCoroutine(doLogin()); } else { changeScene("Login"); } } } }
public void logout() { sqlite sql = new sqlite(); User user = GameObject.Find("/User").GetComponent<User>(); sql.LogoutClr(); user.LogoutClr(); DontDestroyOnLoad(GameObject.Find("/User")); SceneManager.LoadScene("Login"); }
/// <summary> /// Opens database. /// </summary> /// <param name="DatabaseName">Name of database file</param> public void OpenDatabase(String DatabaseName) { // opens database if (CSSQLite.sqlite3_open(DatabaseName, ref db) != CSSQLite.SQLITE_OK) { // if there is some error, database pointer is set to 0 and exception is throws db = null; throw new Exception("Error with opening database " + DatabaseName + "!"); } }
/// <summary> /// Opens database. /// </summary> /// <param name="DatabaseName">Name of database file</param> public void OpenDatabase( String DatabaseName ) { // opens database if ( csSQLite.sqlite3_open( DatabaseName, ref db ) != csSQLite.SQLITE_OK ) { // if there is some error, database pointer is set to 0 and exception is throws db = null; throw new Exception( "Error with opening database " + DatabaseName + "!" ); } }
protected override void OnSourceInitialized(EventArgs e) { _db = EdDatabases.OpenWinapi(); if (!tName.Text.NE()) { _TextChanged(); } base.OnSourceInitialized(e); }
/// <summary> /// Opens database. /// </summary> /// <param name="DatabaseName">Name of database file</param> public void OpenDatabase (String DatabaseName, bool readOnly) { // opens database int flags = (readOnly) ? csSQLite.SQLITE_OPEN_READONLY : csSQLite.SQLITE_OPEN_READWRITE | csSQLite.SQLITE_OPEN_CREATE; if (csSQLite.sqlite3_open_v2(DatabaseName, ref db, flags, null) != csSQLite.SQLITE_OK) { // if there is some error, database pointer is set to 0 and exception is throws db = null; throw new Exception("Error with opening database " + DatabaseName + "!"); } }
private void Awake() { _Instance = this; // 오늘날짜 + 현재시간 date = DateTime.Now.ToString("yyyy년 MM월 dd일 HH시 mm분 ss초"); date = SqlFormat(date); userID = SqlFormat("유저아이디2"); // 나중에 로그인 구현시 Column 클래스로 만들어서 그때 객체화하기 gameID = SqlFormat("21arrow"); // 각자 게임 이름에 맞게 변경 maxScore = 0; MaxScore_Text.text = "최고점수 : " + maxScore; }
/// <summary> /// Opens database. /// </summary> /// <param name="DatabaseName">Name of database file</param> public void OpenDatabase( String DatabaseName ) { // opens database if ( #if NET_35 Sqlite3.Open #else Sqlite3.sqlite3_open #endif ( DatabaseName, out db ) != Sqlite3.SQLITE_OK ) { // if there is some error, database pointer is set to 0 and exception is throws db = null; throw new Exception( "Error with opening database " + DatabaseName + "!" ); } }
/// <summary> /// Opens database. /// </summary> /// <param name="DatabaseName">Name of database file</param> public void OpenDatabase(String DatabaseName) { // opens database if ( #if NET_35 Sqlite3.Open #else Sqlite3.sqlite3_open #endif (DatabaseName, out db) != Sqlite3.SQLITE_OK) { // if there is some error, database pointer is set to 0 and exception is throws db = null; throw new Exception("Error with opening database " + DatabaseName + "!"); } }
/// <summary> /// Creates new instance of SQLiteBase class with no database attached. /// </summary> public SQLiteDatabase() { db = null; }
/// <summary> /// Creates documentation provider for assembly <i>asmPath</i>. /// Returns null if its xml file does not exist. /// Returns _DocumentationProvider if xml file is big and found or successfully created and successfully loaded database for it. /// Else returns _XmlFileDocumentationProvider. /// </summary> public static DocumentationProvider Create(string asmPath) { if (s_d.TryGetValue(asmPath, out var dp)) { return(dp); } var xmlPath = Path.ChangeExtension(asmPath, "xml"); if (!filesystem.getProperties(xmlPath, out var px)) { return(null); } if (px.Size >= 10_000) { var md5 = new Hash.MD5Context(); md5.Add(xmlPath.Lower()); var dbPath = folders.ThisAppTemp + md5.Hash.ToString() + ".db"; try { if (!filesystem.getProperties(dbPath, out var pd) || pd.LastWriteTimeUtc != px.LastWriteTimeUtc) { //Debug_.Print($"creating db: {asmPath} -> {dbPath}"); filesystem.delete(dbPath); using (var d = new sqlite(dbPath)) { using var trans = d.Transaction(); d.Execute("CREATE TABLE doc (name TEXT PRIMARY KEY, xml TEXT)"); using var statInsert = d.Statement("INSERT INTO doc VALUES (?, ?)"); var xr = XmlUtil.LoadElem(xmlPath); foreach (var e in xr.Descendants("member")) { var name = e.Attr("name"); //remove <remarks> and <example>. foreach (var v in e.Descendants("remarks").ToArray()) { v.Remove(); } foreach (var v in e.Descendants("example").ToArray()) { v.Remove(); } using var reader = e.CreateReader(); reader.MoveToContent(); var xml = reader.ReadInnerXml(); //print.it(name, xml); statInsert.BindAll(name, xml).Step(); statInsert.Reset(); } trans.Commit(); d.Execute("VACUUM"); } File.SetLastWriteTimeUtc(dbPath, px.LastWriteTimeUtc); } var db = new sqlite(dbPath, SLFlags.SQLITE_OPEN_READONLY); //never mind: we don't dispose it on process exit s_d[asmPath] = dp = new _DocumentationProvider { _db = db }; return(dp); } catch (Exception ex) { Debug_.Print(ex.ToStringWithoutStack()); } } //return XmlDocumentationProvider.CreateFromFile(xmlPath); //no, need XML with root element. return(new _XmlFileDocumentationProvider(xmlPath)); }
private void save2SQL() { sqlite tmp = new sqlite(); tmp.saveLogin(account, password); }
private IEnumerator doJBLogin() { string url = connect.getURL()+ "/login/login.php"; // isSucess = false; WWWForm form = new WWWForm(); form.AddField("act", account.text); form.AddField("psd", password.text); form.AddField("hash", connect.getHash()); byte[] rawData = form.data; WWW www = new WWW(url,rawData); yield return www; // check for errors if (www.error == null) { string temp = www.text; Debug.Log("temp:"+temp+" num:"+temp.Length); Debug.Log(www.text); if (temp.Length == 5) //success login { //Load User All Information user.setAccount(account.text); user.loadAllfromServer(); //save account & password sqlite tmp_s = new sqlite(); tmp_s.saveLogin(account.text, password.text); //upload the login time StartCoroutine(logLoginTime()); hint.text = ""; //change scence lanimation.changeScence(); //earse all return stack ar.eraseAllValue(); //ar.changeSenceAnimator("/Menu"); } else//帳密有誤 { hint.text = "帳密有誤"; } } else { hint.text = "請檢查裝置連線"; Debug.Log("WWW Error: " + www.error); } //isSucess = false; }
protected override void OnClosed(EventArgs e) { _db?.Dispose(); _db = null; base.OnClosed(e); }
/// <summary> /// Calls sqlite3_prepare16_v3. /// </summary> /// <param name="db"></param> /// <param name="sql">Single SQL statement.</param> /// <param name="persistent">Use flag SQLITE_PREPARE_PERSISTENT.</param> /// <exception cref="SLException">Failed.</exception> /// <exception cref="NotSupportedException">sql contains more than single SQL statement.</exception> public sqliteStatement(sqlite db !!, string sql, bool persistent = false)