/// <summary> /// Creates a new No Change editor, which displays the text in the NewGenFile of the file passed to it. /// </summary> /// <param name="textFileInfo">The text file to display.</param> public ucNoChangeEditor(FileInformation <string> textFileInfo) { InitializeComponent(); if (textFileInfo == null) { throw new InvalidOperationException("Cannot initialise the NoChangeEditor with a null TextFileInformation object."); } //if (textFileInfo.CurrentDiffResult.DiffType != TypeOfDiff.ExactCopy) //{ // throw new Exception("This control is only inteneded to be used for files no changes."); //} IProjectFile <string> file = textFileInfo.MergedFileExists ? textFileInfo.MergedFile : textFileInfo.UserFile; if (file == null || file.HasContents == false) { if (textFileInfo.NewGenFile == null || textFileInfo.NewGenFile.HasContents == false) { throw new InvalidOperationException("The user and newly generated file do not exist, so the control has nothing to display."); } file = textFileInfo.NewGenFile; } syntaxEditor.Text = file.GetContents(); syntaxEditor.Document.Language = SyntaxEditorHelper.GetSyntaxLanguageFromFileName(textFileInfo.RelativeFilePath); warningLabel.MaximumSize = new System.Drawing.Size(Size.Width, 0); warningLabel.Text = ""; }
public void Reset(IProjectFile<string> file, TemplateContentLanguage language) { if (file.HasContents == false) throw new ArgumentException("file must have contents"); this.file = file; editor.Text = file.GetContents(); editor.Document.Language = SyntaxEditorHelper.GetDynamicLanguage(language); errorTreeList.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; Reparse(); }
public void Reset(IProjectFile <string> file, TemplateContentLanguage language) { if (file.HasContents == false) { throw new ArgumentException("file must have contents"); } this.file = file; editor.Text = file.GetContents(); editor.Document.Language = SyntaxEditorHelper.GetDynamicLanguage(language); errorTreeList.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; Reparse(); }
private static List<string> ExtractFileToStringList(IProjectFile<string> file) { return new List<string>(Common.Utility.StandardizeLineBreaks(file.GetContents(), Common.Utility.LineBreaks.Unix).Split('\n')); }