private static void Testing_Invoke(string klass, string method, params object[] prms) { try { AppDomain currentDomain = AppDomain.CurrentDomain; Assembly[] assemblies = currentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Assembly assembly = assemblies[i]; if (assembly.GetName().Name != "UnityEditor" && assembly.GetName().Name != "UnityEngine") { Type[] typesFromAssembly = AssemblyHelper.GetTypesFromAssembly(assembly); for (int j = 0; j < typesFromAssembly.Length; j++) { Type type = typesFromAssembly[j]; if (type.Name == klass) { type.InvokeMember(method, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, prms); } } } } } catch (Exception ex) { if (ex.InnerException != null && ex.InnerException.GetType() == typeof(ExitGUIException)) { throw ex; } ASEditorBackend.Testing_Invoke(AssetServer.GetString("s_ExceptionHandlerClass"), AssetServer.GetString("s_ExceptionHandlerFunction"), new object[] { ex }); } }
private static void Testing_Invoke(string klass, string method, params object[] prms) { try { foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { if (assembly.GetName().Name != "UnityEditor" && assembly.GetName().Name != "UnityEngine") { foreach (System.Type type in AssemblyHelper.GetTypesFromAssembly(assembly)) { if (type.Name == klass) { type.InvokeMember(method, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.InvokeMethod, (Binder)null, (object)null, prms); } } } } } catch (Exception ex) { if (ex.InnerException != null && ex.InnerException.GetType() == typeof(ExitGUIException)) { throw ex; } ASEditorBackend.Testing_Invoke(AssetServer.GetString("s_ExceptionHandlerClass"), AssetServer.GetString("s_ExceptionHandlerFunction"), (object)ex); } }
private void DoShowProjects() { int result = 0x29ed; string serverAddress = this.serverAddress; if (serverAddress.IndexOf(":") > 0) { int.TryParse(serverAddress.Substring(serverAddress.IndexOf(":") + 1), out result); serverAddress = serverAddress.Substring(0, serverAddress.IndexOf(":")); } AssetServer.AdminSetCredentials(serverAddress, result, this.userName, this.password); MaintDatabaseRecord[] recordArray = AssetServer.AdminRefreshDatabases(); if (recordArray != null) { this.projectsList = new string[recordArray.Length]; for (int i = 0; i < recordArray.Length; i++) { this.projectsList[i] = recordArray[i].name; } this.projectsLv.totalRows = recordArray.Length; this.GetDefaultPListConfig(); this.plc["Maint Server"] = serverAddress; this.plc["Maint UserName"] = this.userName; this.plc["Maint port number"] = this.port; this.plc.Save(); ASEditorBackend.SetPassword(serverAddress, this.userName, this.password); ASEditorBackend.AddUser(this.serverAddress, this.userName); } else { this.projectsLv.totalRows = 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); }
public ASHistoryWindow(EditorWindow parent) { float[] relativeSizes = new float[] { 30f, 70f }; int[] minSizes = new int[] { 60, 100 }; this.m_HorSplit = new SplitterState(relativeSizes, minSizes, null); this.m_ScrollPos = Vector2.zero; this.m_RowHeight = 0x10; this.m_HistoryControlID = -1; this.m_ChangesetSelectionIndex = -1; this.m_AssetSelectionIndex = -1; this.m_ChangeLogSelectionRev = -1; this.m_Rev1ForCustomDiff = -1; this.m_ChangeLogSelectionGUID = string.Empty; this.m_ChangeLogSelectionAssetName = string.Empty; this.m_SelectedPath = string.Empty; this.m_SelectedGUID = string.Empty; this.m_DropDownMenuItems = new GUIContent[] { EditorGUIUtility.TextContent("Show History"), emptyGUIContent, EditorGUIUtility.TextContent("Compare to Local"), EditorGUIUtility.TextContent("Compare Binary to Local"), emptyGUIContent, EditorGUIUtility.TextContent("Compare to Another Revision"), EditorGUIUtility.TextContent("Compare Binary to Another Revision"), emptyGUIContent, EditorGUIUtility.TextContent("Download This File") }; this.m_DropDownChangesetMenuItems = new GUIContent[] { EditorGUIUtility.TextContent("Revert Entire Project to This Changeset") }; this.m_FileViewWin = new ASHistoryFileView(); this.m_ParentWindow = parent; ASEditorBackend.SettingsIfNeeded(); if (Selection.objects.Length != 0) { this.m_FileViewWin.SelType = ASHistoryFileView.SelectionType.Items; } }
public static void Testing_DummyConflictResolutionFunction(string[] conflicting) { ASEditorBackend.Testing_Invoke(ASEditorBackend.s_TestingConflictResClass, ASEditorBackend.s_TestingConflictResFunction, new object[] { conflicting }); }
private void DoShowProjects() { int num = 10733; string text = this.serverAddress; if (text.IndexOf(":") > 0) { int.TryParse(text.Substring(text.IndexOf(":") + 1), out num); text = text.Substring(0, text.IndexOf(":")); } AssetServer.AdminSetCredentials(text, num, this.userName, this.password); MaintDatabaseRecord[] array = AssetServer.AdminRefreshDatabases(); if (array != null) { this.projectsList = new string[array.Length]; for (int i = 0; i < array.Length; i++) { this.projectsList[i] = array[i].name; } this.projectsLv.totalRows = array.Length; this.GetDefaultPListConfig(); this.plc["Maint Server"] = text; this.plc["Maint UserName"] = this.userName; this.plc["Maint port number"] = this.port; this.plc.Save(); ASEditorBackend.SetPassword(text, this.userName, this.password); ASEditorBackend.AddUser(this.serverAddress, this.userName); } else { this.projectsLv.totalRows = 0; } }
private void ContextMenuClick(object userData, string[] options, int selected) { if ((bool)userData && selected == 0) { selected = 1; } switch (selected) { case 0: this.DoShowDiff(this.GetGUID()); break; case 1: ASEditorBackend.DoAS(); ASEditorBackend.ASWin.ShowHistory(); break; case 2: if (!ASEditorBackend.SettingsIfNeeded()) { Debug.Log("Asset Server connection for current project is not set up"); } if (EditorUtility.DisplayDialog("Discard changes", "Are you sure you want to discard local changes of selected asset?", "Discard", "Cancel")) { AssetServer.DoUpdateWithoutConflictResolutionOnNextTick(new string[] { this.GetGUID() }); } break; } }
private static void Testing_DummyCallback(bool success) { ASEditorBackend.Testing_Invoke(AssetServer.GetAndRemoveString("s_TestingClass"), AssetServer.GetAndRemoveString("s_TestingFunction"), new object[] { success }); }
internal static bool IsAssetServerSetUp() { if (InternalEditorUtility.HasTeamLicense()) { return(ASEditorBackend.SettingsAreValid()); } return(false); }
public ASHistoryWindow(EditorWindow parent) { this.m_ParentWindow = parent; ASEditorBackend.SettingsIfNeeded(); if (Selection.objects.Length != 0) { this.m_FileViewWin.SelType = ASHistoryFileView.SelectionType.Items; } }
public bool DoUpdate(bool afterResolvingConflicts) { AssetServer.RemoveMaintErrorsFromConsole(); if (ASEditorBackend.SettingsIfNeeded()) { this.showingConflicts = false; AssetServer.SetAfterActionFinishedCallback("ASEditorBackend", "CBReinitOnSuccess"); AssetServer.DoUpdateOnNextTick(!afterResolvingConflicts, "ShowASConflictResolutionsWindow"); } return(true); }
private static void ShowVersionControl() { if (EditorSettings.externalVersionControl == ExternalVersionControl.AssetServer) { ASEditorBackend.DoAS(); } else { EditorWindow.GetWindow <WindowPending>(); } }
private void ClearConfig() { if (EditorUtility.DisplayDialog("Clear Configuration", "Are you sure you want to disconnect from Asset Server project and clear all configuration values?", "Clear", "Cancel")) { this.plc = new PListConfig("Library/ServerPreferences.plist"); this.plc.Clear(); this.plc.Save(); this.LoadConfig(); this.projectsLv.totalRows = 0; ASEditorBackend.InitializeMaintBinding(); this.resetKeyboardControl = true; } }
private void GetUserAndPassword() { string user = ASEditorBackend.GetUser(this.serverAddress); if (user != string.Empty) { this.userName = user; } user = ASEditorBackend.GetPassword(this.serverAddress, user); if (user != string.Empty) { this.password = user; } }
private void GetUserAndPassword() { string user = ASEditorBackend.GetUser(this.serverAddress); if (user != string.Empty) { this.userName = user; } string password = ASEditorBackend.GetPassword(this.serverAddress, user); if (!(password != string.Empty)) { return; } this.password = password; }
public static bool InitializeMaintBinding() { PListConfig pListConfig = new PListConfig("Library/ServerPreferences.plist"); string text = pListConfig["Maint UserName"]; string text2 = pListConfig["Maint Server"]; string text3 = pListConfig["Maint project name"]; string text4 = pListConfig["Maint database name"]; string text5 = pListConfig["Maint port number"]; int timeout; if (!int.TryParse(pListConfig["Maint Timeout"], out timeout)) { timeout = 5; } bool result; if (text2.Length == 0 || text3.Length == 0 || text4.Length == 0 || text.Length == 0) { AssetServer.SetProjectName(""); result = false; } else { AssetServer.SetProjectName(string.Format("{0} @ {1}", text3, text2)); string connectionString = string.Concat(new string[] { "host='", text2, "' user='******' password='******' dbname='", text4, "' port='", text5, "' sslmode=disable ", pListConfig["Maint Connection Settings"] }); AssetServer.Initialize(text, connectionString, timeout); result = true; } return(result); }
private void LoadConfig() { PListConfig pListConfig = new PListConfig("Library/ServerPreferences.plist"); this.serverAddress = pListConfig["Maint Server"]; this.userName = pListConfig["Maint UserName"]; this.port = pListConfig["Maint port number"]; this.projectName = pListConfig["Maint project name"]; this.password = ASEditorBackend.GetPassword(this.serverAddress, this.userName); if (this.port != string.Empty && this.port != 10733.ToString()) { this.serverAddress = this.serverAddress + ":" + this.port; } this.serversList = InternalEditorUtility.GetEditorSettingsList("ASServer", 20); this.serversLv.totalRows = this.serversList.Length; if (ArrayUtility.Contains <string>(this.serversList, this.serverAddress)) { this.serversLv.row = ArrayUtility.IndexOf <string>(this.serversList, this.serverAddress); } }
private void DoConnect() { AssetServer.RemoveMaintErrorsFromConsole(); int result = 0x29ed; string serverAddress = this.serverAddress; if (serverAddress.IndexOf(":") > 0) { int.TryParse(serverAddress.Substring(serverAddress.IndexOf(":") + 1), out result); serverAddress = serverAddress.Substring(0, serverAddress.IndexOf(":")); } this.port = result.ToString(); string str2 = AssetServer.GetDatabaseName(serverAddress, this.userName, this.password, this.port, this.projectName); this.GetDefaultPListConfig(); this.plc["Maint Server"] = serverAddress; this.plc["Maint UserName"] = this.userName; this.plc["Maint database name"] = str2; this.plc["Maint port number"] = this.port; this.plc["Maint project name"] = this.projectName; this.plc.Save(); if (ArrayUtility.Contains <string>(this.serversList, this.serverAddress)) { ArrayUtility.Remove <string>(ref this.serversList, this.serverAddress); } ArrayUtility.Insert <string>(ref this.serversList, 0, this.serverAddress); ASEditorBackend.AddUser(this.serverAddress, this.userName); ASEditorBackend.SetPassword(this.serverAddress, this.userName, this.password); InternalEditorUtility.SaveEditorSettingsList("ASServer", this.serversList, 20); if (str2 != string.Empty) { ASEditorBackend.InitializeMaintBinding(); this.parentWin.Reinit(); GUIUtility.ExitGUI(); } else { this.parentWin.NeedsSetup = true; this.parentWin.Repaint(); } }
internal static bool IsAssetServerSetUp() { return(InternalEditorUtility.HasPro() && ASEditorBackend.SettingsAreValid()); }
public static bool InitializeMaintBinding() { PListConfig plistConfig = new PListConfig("Library/ServerPreferences.plist"); string str1 = plistConfig["Maint UserName"]; string server = plistConfig["Maint Server"]; string str2 = plistConfig["Maint project name"]; string str3 = plistConfig["Maint database name"]; string str4 = plistConfig["Maint port number"]; int result; if (!int.TryParse(plistConfig["Maint Timeout"], out result)) { result = 5; } if (server.Length == 0 || str2.Length == 0 || (str3.Length == 0 || str1.Length == 0)) { AssetServer.SetProjectName(string.Empty); return(false); } AssetServer.SetProjectName(string.Format("{0} @ {1}", (object)str2, (object)server)); string connectionString = "host='" + server + "' user='******' password='******' dbname='" + str3 + "' port='" + str4 + "' sslmode=disable " + plistConfig["Maint Connection Settings"]; AssetServer.Initialize(str1, connectionString, result); return(true); }
internal static bool IsAssetServerSetUp() => (InternalEditorUtility.HasTeamLicense() && ASEditorBackend.SettingsAreValid());
public static bool SettingsIfNeeded() { return(ASEditorBackend.InitializeMaintBinding()); }