Forex_Strategy_Builder.Indicator_Compilation_Manager.LoadSourceFile C# (CSharp) Метод

LoadSourceFile() публичный Метод

Reads the source code from file contents.
public LoadSourceFile ( string pathToIndicator, string &errorLoadSourceFile ) : string
pathToIndicator string
errorLoadSourceFile string
Результат string
        public string LoadSourceFile(string pathToIndicator, out string errorLoadSourceFile)
        {
            string result = string.Empty;

            if (!File.Exists(pathToIndicator))
            {
                errorLoadSourceFile = "ERROR The source file does not exist: " + Path.GetFileName(pathToIndicator);
                return result;
            }

            try
            {
                using (System.IO.StreamReader sr = new System.IO.StreamReader(pathToIndicator))
                {
                    result = sr.ReadToEnd();
                    sr.Close();
                }
            }
            catch
            {
                errorLoadSourceFile = "ERROR Cannot read the file: " + Path.GetFileName(pathToIndicator);
                return result;
            }

            errorLoadSourceFile = string.Empty;
            return result;
        }