static void Main(string[] args) { Console.Title = "Irony Console Sample"; Console.WriteLine("Irony Console Sample."); Console.WriteLine(""); Console.WriteLine("Select a grammar to load:"); Console.WriteLine(" 1. Expression Evaluator"); Console.WriteLine(" 2. mini-Python"); Console.WriteLine(" Or press any other key to exit."); Console.WriteLine(""); Console.Write("?"); var choice = Console.ReadLine(); Grammar grammar; switch (choice) { case "1": grammar = new ExpressionEvaluatorGrammar(); break; case "2": grammar = new MiniPython.MiniPythonGrammar(); break; default: return; } Console.Clear(); var commandLine = new CommandLine(grammar); commandLine.Run(); }
public BenchmarkStartup() { Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo(_culture); #region Start REST, WebDAV and WebAdmin services, send GraphDS notification var GraphDB = new SonesGraphDB(null, true, new CultureInfo(_culture)); #region Configure PlugIns // Plugins are loaded by the GraphDS with their according PluginDefinition and only if they are listed // below - there is no auto-discovery for plugin types in GraphDS (!) #region Query Languages // the GQL Query Language Plugin needs the GraphDB instance as a parameter List<PluginDefinition> QueryLanguages = new List<PluginDefinition>(); Dictionary<string, object> GQL_Parameters = new Dictionary<string, object>(); GQL_Parameters.Add("GraphDB", GraphDB); QueryLanguages.Add(new PluginDefinition("sones.gql", GQL_Parameters)); #endregion #endregion GraphDSPlugins PluginsAndParameters = new GraphDSPlugins(myIGraphQLPlugins: QueryLanguages); _dsServer = new GraphDS_Server(GraphDB, PluginsAndParameters); #region pre-configure REST Service Dictionary<string, object> RestParameter = new Dictionary<string, object>(); RestParameter.Add("IPAddress", IPAddress.Any); RestParameter.Add("Port", _listeningPort); RestParameter.Add("Username", _userName); RestParameter.Add("Password", _password); _dsServer.StartService("sones.RESTService", RestParameter); #endregion _dsServer.StartService("sones.RESTService", RestParameter); #endregion #region start grammar and console Grammar benchmarkGrammar = new BenchmarkGrammar(_dsServer, _listeningPort, _userName, _password); var commandLine = new CommandLine(benchmarkGrammar); commandLine.Run(); #endregion _dsServer.Shutdown(null); }