ICSharpCode.TextEditor.TextEditorControlBase.LoadFile C# (CSharp) Method

LoadFile() public method

public LoadFile ( string fileName ) : void
fileName string
return void
		public void LoadFile(string fileName)
		{
			LoadFile(fileName, true, true);
		}
		

Same methods

TextEditorControlBase::LoadFile ( string fileName, Stream stream, bool autoLoadHighlighting, bool autodetectEncoding ) : void
TextEditorControlBase::LoadFile ( string fileName, bool autoLoadHighlighting, bool autodetectEncoding ) : void

Usage Example

 public void loadSourceCodeFileIntoTextEditor(String fileToLoad, TextEditorControlBase tecTargetTextEditor)
 {
     fileToLoad = tryToResolveFileLocation(fileToLoad, this);
     //this.okThreadSync(delegate
     //ExtensionMethods.invokeOnThread((Control)this, () =>
     tecSourceCode.invokeOnThread(
         () =>
             {
                 try
                 {
                     partialFileViewMode = false;
                     lbPartialFileView.Visible = false;
                     tecSourceCode.Visible = true;
                     long iCurrentFileSize = Files_WinForms.getFileSize(fileToLoad);
                     if (iCurrentFileSize > (iMaxFileSize*1024))
                     {
                         PublicDI.log.error("File to load is too big: max is {0}k, this file is {1}k : {2}",
                                      iMaxFileSize,
                                      iCurrentFileSize/1024, fileToLoad);
                         loadPartialFileView(fileToLoad);
                     }
                     else
                     {
                         if (fileToLoad.extension(".h2"))
                         {
                             setPathToFileLoaded(fileToLoad);
                             setDocumentContents(H2.load(fileToLoad).SourceCode, fileToLoad, false);
                             setDocumentHighlightingStrategy("aa.cs");
                         }
                         else
                         {
                             tecTargetTextEditor.LoadFile(fileToLoad);
                         }
                         if (fileToLoad.extension(".o2"))
                         {
                             var realFileTypeToload = Path.GetFileNameWithoutExtension(fileToLoad);
                             tecSourceCode.Document.HighlightingStrategy =
                                 HighlightingStrategyFactory.CreateHighlightingStrategyForFile(realFileTypeToload);
                         }
                         lbSourceCode_UnsavedChanges.Visible = false;
                         btSaveFile.Enabled = false;
                         eFileOpen(fileToLoad);
                     }
                 }
                 catch (Exception ex)
                 {
                     PublicDI.log.error("in loadSourceCodeFileIntoTextEditor: {0}", ex.Message);
                 }
                 return default(object);
             });
 }