Пример #1
0
 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");
             }
         }
     }
 }
Пример #2
0
 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");
 }
Пример #3
0
 /// <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 + "!");
     }
 }
Пример #4
0
 /// <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 + "!" );
   }
 }
Пример #5
0
    protected override void OnSourceInitialized(EventArgs e)
    {
        _db = EdDatabases.OpenWinapi();
        if (!tName.Text.NE())
        {
            _TextChanged();
        }

        base.OnSourceInitialized(e);
    }
Пример #6
0
    /// <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 + "!");
        }
    }
Пример #7
0
    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;
    }
Пример #8
0
    /// <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 + "!" );
      }
    }
Пример #9
0
        /// <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 + "!");
            }
        }
Пример #10
0
 /// <summary>
 /// Creates new instance of SQLiteBase class with no database attached.
 /// </summary>
 public SQLiteDatabase()
 {
   db = null;
 }
Пример #11
0
 /// <summary>
 /// Creates new instance of SQLiteBase class with no database attached.
 /// </summary>
 public SQLiteDatabase()
 {
     db = null;
 }
Пример #12
0
            /// <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));
            }
Пример #13
0
 private void save2SQL()
 {
     sqlite tmp = new sqlite();
     tmp.saveLogin(account, password);
 }
Пример #14
0
    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;
    }
Пример #15
0
 protected override void OnClosed(EventArgs e)
 {
     _db?.Dispose();
     _db = null;
     base.OnClosed(e);
 }
Пример #16
0
 /// <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)