Can somebody please add a new function call “get-text” to the FileFunctions class?

 

Example:

[Function("get-text")]

public string GetText(string fileName)

{

  string text = "";

 

  if (File.Exists(fileName))

     text = GetTextFromFile(fileName);

 

  return text;

}

 

private static string GetTextFromFile(string fileName)

{

  string text = "";

 

  if (File.Exists(fileName))

     text = GetTextFromFile(new FileStream(fileName, FileMode.Open, FileAccess.Read));

 

  return text;

}

 

private static string GetTextFromFile(System.IO.Stream fileStream)

{

  string text = "";

 

  using(StreamReader reader = new StreamReader(fileStream))

  {

     text = reader.ReadToEnd();

  }

  fileStream.Close();

 

  return text; 

}

 

Devin Grant

Automation Tech Lead

TEL:  1-248-449-2135

FAX:  1-248-449-2021

[EMAIL PROTECTED]

autodesk®

 

Reply via email to