public GitDiffViewModel(IDbObjectText DbObjectText, IIDEProvider IDE, IGitAPI Git, IWarnings Warnings, ISettings Settings) { _DbObjectText = DbObjectText; IDiffText DiffText = Git.GitDiff(DbObjectText); FillDocument(DiffText); CurrentBranch = Git.GetCurrentBranch(); CurrentDataBase = IDE.GetDatabaseConnection(); ObjectDescrName = DbObjectText.DescriptionName; ObjectFullPath = DbObjectText.GetRawFilePath(); if (Settings.UnexpectedBranch) { UnexpectedBranch = Warnings.IsBranchUnexsepted(CurrentBranch, true); } if (Settings.UnexpectedServer) { UnexpectedServer = Warnings.IsServerUnexsepted(CurrentDataBase, true); } SaveTextCommand = NinjectCore.Get <CommandSaveTextToRepository>(); LoadTextCommand = NinjectCore.Get <CommandLoadTextFromRepository>(); ButtonsClassicStyle = Settings.ClassicButtonsPosition; }
private void SaveText() { if (_DbObjectText == null) { _DbObjectText = _IDEProvider.GetDbObject <IDbObjectText>(); } else { _DbObjectText.DirectoriesChecks(); } if (_BranchName == null) { _BranchName = _GitAPI.GetCurrentBranch(); } if (_Warnings.IsBranchUnexsepted(_BranchName)) { return; } string FilePath = _DbObjectText.GetRawFilePath(); Seri.Log.Here().Debug("FilePath={0}", FilePath); File.WriteAllText(FilePath, _DbObjectText.Text, _DbObjectText.GetSaveEncoding()); _IDEProvider.SetStatusMessage($"Объект БД сохранён в: {FilePath}"); }