예제 #1
0
        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);
        }
예제 #2
0
        public int Evaluate(MyIDictionary <string, int> symbolTable)
        {
            if (!symbolTable.TryGetValue(id, out int value))
            {
                throw new ExpressionException("Unassigned variable used!");
            }

            return(value);
        }
예제 #3
0
        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();
                }
            }
        }