public void Remove(int fileDescriptor) { if (!fileTable.TryGetValue(fileDescriptor, out Tuple <string, TextReader> value)) { throw new FileTableException("File is not in the file table!"); } value.Item2.Close(); fileTable.Remove(fileDescriptor); positionTable.FreePosition(fileDescriptor); }
public int Evaluate(MyIDictionary <string, int> symbolTable) { if (!symbolTable.TryGetValue(id, out int value)) { throw new ExpressionException("Unassigned variable used!"); } return(value); }
public void Show() { while (true) { PrintMenu(); Console.WriteLine("Input command:"); string key = Console.ReadLine(); if (!commands.TryGetValue(key, out Command command)) { Console.WriteLine("Invalid command provided!"); } else { command.Execute(); } } }