protected void ConnectUsingCurrentSettings() { Console.WriteLine($"\n[INFO] Connecting to <{MFilesSettings.Server}> server..."); bool isValidCredentials = TryConnect(); if (!isValidCredentials) { Console.WriteLine($"[ERROR] Something wrong connecting to <{MFilesSettings.Server}> server...\n"); return; } Console.WriteLine($"[INFO] Successfully connected to <{MFilesSettings.Server}> server..."); Vaults = MFilesServerApp.GetOnlineVaults(); VaultOnServer vaultOnServer = null; bool isUsingVaultGuid = !string.IsNullOrWhiteSpace(MFilesSettings.VaultGUID); string vaultGuidName = isUsingVaultGuid ? MFilesSettings.VaultGUID : MFilesSettings.VaultName; if (isUsingVaultGuid) { vaultOnServer = Vaults.GetVaultByGUID(vaultGuidName); MFilesSettings.VaultName = vaultOnServer.Name; } else { vaultOnServer = Vaults.GetVaultByName(vaultGuidName); } Console.WriteLine($"[INFO] Connecting to <{MFilesSettings.VaultName}> vault..."); Vault = vaultOnServer.LogIn(); Console.WriteLine($"[INFO] Successfully connected to <{MFilesSettings.VaultName}> vault..."); }
private void btn_Extract_Click(object sender, EventArgs e) { if (list_Vaults.SelectedIndex != -1) { var itemName = list_Vaults.SelectedItem.ToString(); VaultOnServer selectedVault = null; foreach (VaultOnServer item in _vaults) { if (item.Name == itemName) { selectedVault = item; break; } } try { ExtractResult exResult = null; LoggedInVaultHolder.LoggedInVault = selectedVault.LogIn(); DialogResult result = folderBrowserDialog1.ShowDialog(); if (result == DialogResult.OK) { string folderName = folderBrowserDialog1.SelectedPath; Cursor.Current = Cursors.WaitCursor; exResult = ApplicationHelper.ExtractVault(folderName, LoggedInVaultHolder.LoggedInVault); Cursor.Current = Cursors.Default; var sb = new StringBuilder(); sb.AppendLine("Succesfully Extracted!"); sb.AppendLine("Event Handlers: " + exResult.EventHandlersCount.ToString()); sb.AppendLine("State Actions: " + exResult.StateActionCount.ToString()); sb.AppendLine("State Triggers: " + exResult.TriggerCount.ToString()); sb.AppendLine("Conditions: " + exResult.ConditionCount.ToString()); sb.AppendLine("Automatic Numbering: " + exResult.NumberingCount.ToString()); sb.AppendLine("Calculated Values: " + exResult.CalculatedValuesCount.ToString()); sb.AppendLine("Validations: " + exResult.ValidationsCount.ToString()); sb.AppendLine("Applications: " + exResult.ApplicationsCount.ToString()); MessageBox.Show(sb.ToString(), "M-Files Code Extractor", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception Ex) { MessageBox.Show("Seçilen kütüphaneye bağlanılamadı;\n" + Ex.Message.Substring(0, Ex.Message.IndexOf("\r\n\r\n")), "M-Files Code Extractor", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Lütfen bir kütüphane seçiniz.", "M-Files Code Extractor", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }