public MongoDbFixture() { var options = OptionsHelper.GetOptions <MongoDbOptions>("mongo"); _client = new MongoClient(options.ConnectionString); _databaseName = options.Database; _database = _client.GetDatabase(_databaseName); //InitializeMongo(); }
public MongoDbFixture(string collectionName) { var options = OptionsHelper.GetOptions <MongoDbOptions>("mongo"); _client = new MongoClient(options.ConnectionString); _databaseName = options.Database; _collectionName = collectionName; _database = _client.GetDatabase(_databaseName); //InitializeMongo(); _collection = _database.GetCollection <TEntity>(_collectionName); }
public OptionsDialog(DTE dte) { InitializeComponent(); _dte = dte; _options = OptionsHelper.GetOptions(dte); ConnectionStringTextBox.Text = _options.Connection; DbTypeComboBox.Items.AddRange(Enum.GetNames(typeof(DbEnum))); DbTypeComboBox.Text = _options.DbType.ToString(); }
private void ProjectItemsEvents_ItemRemoved(ProjectItem projectItem) { if (OptionsHelper.GetOptions().OnItemRemovedRemoveFromSVN) { var filePath = projectItem.Properties?.Item("FullPath").Value; if (string.IsNullOrEmpty(filePath)) { return; } CommandHelper.StartProcess(_tortoiseProc, $"/command:remove /path:\"{filePath}\" /closeonend:0"); } }
private async Task ProjectItemsEvents_ItemRemoved_Async(AfterRemoveProjectItemEventArgs obj) { var options = await OptionsHelper.GetOptions(); if (!options.OnItemRemovedRemoveFromSVN) { return; } foreach (var item in obj.ProjectItemRemoves) { await CommandHelper.RunTortoiseSvnFileCommand("remove", filePath : item.RemovedItemName); } }
private async Task ProjectItemsEvents_ItemAdded_Async(IEnumerable <SolutionItem> solutionItems) { var options = await OptionsHelper.GetOptions(); if (!options.OnItemAddedAddToSVN) { return; } foreach (var item in solutionItems) { await CommandHelper.RunTortoiseSvnFileCommand("add", filePath : item.FullPath); } }
public static async Task RunTortoiseSvnCommand(string command, string args = "") { var solutionDir = await GetRepositoryRoot(); if (string.IsNullOrEmpty(solutionDir)) { return; } var tortoiseProc = FileHelper.GetTortoiseSvnProc(); var options = await OptionsHelper.GetOptions(); var closeOnEnd = options.CloseOnEnd ? 1 : 0; await StartProcess(tortoiseProc, $"/command:{command} /path:\"{solutionDir}\" {args} /closeonend:{closeOnEnd}"); }
private void ProjectItemsEvents_ItemRenamed(ProjectItem projectItem, string oldName) { if (OptionsHelper.GetOptions().OnItemRenamedRenameInSVN) { var newFilePath = projectItem.Properties?.Item("FullPath").Value; if (string.IsNullOrEmpty(newFilePath)) { return; } var oldFilePath = Path.Combine(Path.GetDirectoryName(newFilePath), oldName); // Temporarily rename the new file to the old file File.Move(newFilePath, oldFilePath); // So that we can svn rename it properly CommandHelper.StartProcess(FileHelper.GetSvnExec(), $"mv {oldFilePath} {newFilePath}"); } }
public static async Task RunTortoiseSvnFileCommand(string command, string args = "", string filePath = "") { if (string.IsNullOrEmpty(filePath)) { filePath = await FileHelper.GetPath(); } if (string.IsNullOrEmpty(filePath)) { return; } var tortoiseProc = FileHelper.GetTortoiseSvnProc(); var options = await OptionsHelper.GetOptions(); var closeOnEnd = options.CloseOnEnd ? 1 : 0; await StartProcess(tortoiseProc, $"/command:{command} /path:\"{filePath}\" {args} /closeonend:{closeOnEnd}"); }
public RabbitMqFixture() { var options = OptionsHelper.GetOptions <RabbitMqOptions>("rabbitMq"); var connectionFactory = new ConnectionFactory { HostName = options.HostNames?.FirstOrDefault( ), VirtualHost = options.VirtualHost, Port = options.Port, UserName = options.Username, Password = options.Password, UseBackgroundThreadsForIO = true, DispatchConsumersAsync = true, Ssl = new SslOption() }; var connection = connectionFactory.CreateConnection(); _channel = connection.CreateModel(); }
private async Task ProjectItemsEvents_ItemRenamedAsync(AfterRenameProjectItemEventArgs obj) { var options = await OptionsHelper.GetOptions(); if (!options.OnItemRenamedRenameInSVN) { return; } for (var i = 0; i < obj.ProjectItemRenames.Length - 1; i++) { var newPath = obj.ProjectItemRenames[i].SolutionItem.FullPath; var oldPath = obj.ProjectItemRenames[i].OldName; // Temporarily rename the new file to the old file File.Move(newPath, oldPath); // So that we can svn rename it properly await CommandHelper.StartProcess(FileHelper.GetSvnExec(), $"mv {oldPath} {newPath}"); } }
public OptionsModel GetModel() { return(OptionsHelper.GetOptions(this)); }
public static async Task <string> GetRepositoryRoot(string path = "") { try { // Override any logic with the solution specific Root Folder setting var options = await OptionsHelper.GetOptions(); if (!string.IsNullOrEmpty(options.RootFolder)) { return(options.RootFolder); } // Try to find the current working folder, either by open document or by open solution if (string.IsNullOrEmpty(path)) { var solution = await VS.Solutions.GetCurrentSolutionAsync(); var documentView = await VS.Documents.GetActiveDocumentViewAsync(); if (!string.IsNullOrEmpty(solution?.FullPath)) { path = Path.GetDirectoryName(solution.FullPath); } else if (!string.IsNullOrEmpty(documentView?.Document?.FilePath)) { path = Path.GetDirectoryName(documentView.Document.FilePath); } } // No solution or file open, we have no way of determining repository root. // Fail silently. if (string.IsNullOrEmpty(path)) { return(string.Empty); } var proc = new Process { StartInfo = new ProcessStartInfo { FileName = "cmd.exe", Arguments = $"/c cd /D \"{path}\" && \"{FileHelper.GetSvnExec()}\" info --show-item wc-root", UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true } }; proc.Start(); var errors = string.Empty; while (!proc.StandardError.EndOfStream) { errors += await proc.StandardError.ReadLineAsync(); } while (!proc.StandardOutput.EndOfStream) { options.RootFolder = await proc.StandardOutput.ReadLineAsync(); } await OptionsHelper.SaveOptions(options); if (string.IsNullOrEmpty(options.RootFolder)) { await ShowMissingSolutionDirMessage(); } return(options.RootFolder); } catch (Exception e) { LogHelper.Log(e); } await ShowMissingSolutionDirMessage(); return(string.Empty); }
private OptionsModel GetModel() { return(OptionsHelper.GetOptions(this)); }
public static string GetRepositoryRoot(string path = "") { var svnInfo = string.Empty; try { // Override any logic with the solution specific Root Folder setting OptionsHelper.Dte = Dte; var rootFolder = OptionsHelper.GetOptions().RootFolder; if (!string.IsNullOrEmpty(rootFolder)) { return(rootFolder); } // Try to found the current working folder, either by open document or by open solution if (string.IsNullOrEmpty(path)) { if (!string.IsNullOrEmpty(Dte.Solution.FileName)) { path = Path.GetDirectoryName(Dte.Solution.FullName); } else if (Dte.ActiveDocument != null) { path = Path.GetDirectoryName(Dte.ActiveDocument.FullName); } } var proc = new Process { StartInfo = new ProcessStartInfo { FileName = "cmd.exe", Arguments = $"/c cd /D \"{path}\" && \"{FileHelper.GetSvnExec()}\" info", UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true } }; proc.Start(); while (!proc.StandardOutput.EndOfStream) { var line = proc.StandardOutput.ReadLine(); LogHelper.Log($"SvnInfo: {line}"); svnInfo += line; if (line?.StartsWith("Working Copy Root Path:") ?? false) { rootFolder = line.Substring(24); } } while (!proc.StandardError.EndOfStream) { var line = proc.StandardError.ReadLine(); svnInfo += line; LogHelper.Log($"SvnInfo: {line}"); } var options = OptionsHelper.GetOptions(); options.RootFolder = rootFolder; OptionsHelper.SaveOptions(options); if (string.IsNullOrEmpty(rootFolder)) { ShowMissingSolutionDirMessage(); } return(rootFolder); } catch (Exception e) { LogHelper.Log(svnInfo, e); } ShowMissingSolutionDirMessage(); return(string.Empty); }