Beispiel #1
0
			private bool LoadFile(FileInfo file) {
				try {
					StreamReader sr = file.OpenText();
					LinkedList ll = new LinkedList();
					try {
						while (sr.Peek() != -1) {
							ll.AddFirst(sr.ReadLine());
						}
					} finally {
						sr.Close();
					}
					string[] strs = new String[ll.Count];
					int i = 0;
					while (!ll.IsEmpty()) {
						strs[i] = (ll.RemoveLast() as String);
						i++;
					}
					Subroutine sub;
					try {
						sub = new Subroutine(strs, file.Name);                        
					} catch (LineSyntaxException ex) {
						InterprEnvironment.Instance.CurrentConsole.PrintLn(ex.Message + " в функции " + ex.Function + "[] в строке " + ex.Line);
						return false;
					} catch (SyntaxErrorException ex) {
                        InterprEnvironment.Instance.CurrentConsole.PrintLn(ex.Message + " в " + file.Name);
						return false;
					}                    
					Set(file.Name, sub);
				} catch {
                    throw new OtherException("ќшибка в методе Environment.Load()");
				}
				return true;
			}