Example #1
0
        public static bool Testing_SetupDatabase(string host, int port, string adminUser, string adminPwd, string user, string pwd, string projectName)
        {
            AssetServer.AdminSetCredentials(host, port, adminUser, adminPwd);
            MaintDatabaseRecord[] array = AssetServer.AdminRefreshDatabases();
            if (array == null)
            {
                return(false);
            }
            MaintDatabaseRecord[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                MaintDatabaseRecord maintDatabaseRecord = array2[i];
                if (maintDatabaseRecord.name == projectName)
                {
                    AssetServer.AdminDeleteDB(projectName);
                }
            }
            if (AssetServer.AdminCreateDB(projectName) == 0)
            {
                return(false);
            }
            string databaseName = AssetServer.GetDatabaseName(host, adminUser, adminPwd, port.ToString(), projectName);

            if (!AssetServer.AdminSetUserEnabled(databaseName, user, user, string.Empty, 1))
            {
                return(false);
            }
            ASEditorBackend.Testing_SetActiveDatabase(host, port, projectName, databaseName, user, pwd);
            return(true);
        }