idTech4.Text.idLexer.LoadMemory C# (CSharp) Method

LoadMemory() public method

Load a script from the given memory and a specified line offset, so source strings extracted from a file can still refer to proper line numbers in the file.
public LoadMemory ( string text, string name, int startLine ) : bool
text string
name string
startLine int
return bool
		public bool LoadMemory(string text, string name, int startLine)
		{
			if(this.IsLoaded == true)
			{
				idConsole.Error("idLexer.LoadMemory: another script is already loaded");
				return false;
			}

			_fileName = name;
			_fileTime = DateTime.Now;
			_buffer = text;
			_length = text.Length;

			_scriptPosition = 0;
			_lastScriptPosition = 0;
			_endPosition = _buffer.Length;

			_tokenAvailable = false;
			_line = startLine;
			_lastLine = startLine;
			_allocated = false;
			_loaded = true;

			return true;
		}

Same methods

idLexer::LoadMemory ( string text, string name ) : bool

Usage Example

		public Texture2D ParseImageProgram(string source, ref DateTime timeStamp, ref TextureDepth depth)
		{
			_lexer = new idLexer(LexerOptions.NoFatalErrors | LexerOptions.NoStringConcatination | LexerOptions.NoStringEscapeCharacters | LexerOptions.AllowPathNames);
			_lexer.LoadMemory(source, source);

			return ParseImageProgram(ref timeStamp, ref depth, false);
		}
All Usage Examples Of idTech4.Text.idLexer::LoadMemory