Пример #1
0
        private SQLiteManager GetDb()
        {
            UseDatabase   udb = GetComponent <UseDatabase>();
            SQLiteManager db  = null;

            try {
                db = new SQLiteManager(udb.GetDatabaseFilePath());
            } catch (Exception e) {
                udb.UnselectBinary();
                Debug.LogException(e);
                throw e;
            }
            return(db);
        }
Пример #2
0
        /// <summary>
        /// Try to connect to the local database
        /// </summary>
        /// <returns>Is it success?</returns>
        public bool Test()
        {
            UseDatabase udb    = GetComponent <UseDatabase>();
            string      dbFile = udb.GetDatabaseFilePath();

            if (dbFile.Length == 0)
            {
                Debug.LogError("No database file selected, please assign in the inspector window!");
                return(false);
            }
            try {
                new SQLiteManager(dbFile);
                return(true);
            } catch (Exception e) {
                udb.UnselectBinary();
                Debug.LogException(e);
            }
            return(false);
        }