Ejemplo n.º 1
0
        public static void Start(InstructionSet set)
        {
            if (s_IsStarted)
            {
                return;
            }

            AppRootHelper.SetAppDomainBase();

            CpuSettings.FallbackSet = set;

            s_IsStarted = true;

            Directory.CreateDirectory(SourceDirectory);
            Directory.CreateDirectory(OutputDirectory);
            Directory.CreateDirectory(InternalDirectory);

            EventManager.RegisterDefaultHandlers();

            Logger.OnLogReceive += (tag, msg) => Console.WriteLine($"[{tag}]{msg}");

            //Set Linker Export Flag
            //Useful for Debugging and Required for DLR Wrapper.
            LinkerSettings settings = SettingsManager.GetSettings <LinkerSettings>();

            settings.ExportLinkerInfo = true;
            SettingsManager.SaveSettings(settings);
        }
Ejemplo n.º 2
0
        private static void Main(string[] args)
        {
            if (args.Contains("--root"))
            {
                int i = args.ToList().IndexOf("--root");
                AppRootHelper.SetCustomBase(Path.GetFullPath(args[i + 1]));
                List <string> a = new List <string>(args);
                a.RemoveRange(i, 2);
                args = a.ToArray();
            }
            else
            {
                AppRootHelper.
                SetAppDomainBase();     // Hack to be able to use the .netstandard libs in unity AND as console app.
            }

            VisConsole.RunConsole(args);
        }
Ejemplo n.º 3
0
        private static void Main(string[] args)
        {
            Dictionary <string, Command> cmds = new Dictionary <string, Command>();

            AppRootHelper.SetAppDomainBase();
            Logger.OnLogReceive += (x, y) => Console.WriteLine($"[{x}] {y}");
            int port = args.Length > 0 ? int.Parse(args[0]) : 42069;
            LocalNetworkNode     node     = new LocalNetworkNode();
            NetworkTunnelService tService = new NetworkTunnelService(node, port);

            cmds.Add(
                "dns-names",
                new Command(
                    "dns-names",
                    (s) => ListDnsNames(node.DNSAdapter),
                    "Lists all known hostnames",
                    0
                    )
                );

            cmds.Add(
                "adapters",
                new Command("adapters", (s) => ListAdapterNames(node), "Lists all known adatpers", 0)
                );

            cmds.Add(
                "ports",
                new Command(
                    "ports",
                    (s) => ListAdapterPorts(node, s[0]),
                    "Lists all Ports of the Adapter specified by partical or complete GUID",
                    1
                    )
                );

            cmds.Add("clear", new Command("clear", (s) => Console.Clear(), "Clears the Console", 0));

            cmds.Add(
                "tunnels",
                new Command(
                    "tunnels",
                    (s) => ListActiveTunnels(tService),
                    "Lists all Active Tunnel Connections",
                    0
                    )
                );

            cmds.Add(
                "dns-rem",
                new Command(
                    "dns-rem",
                    (s) => ClearDNSName(node.DNSAdapter, s),
                    "Removes all specified DNS Names",
                    0
                    )
                );

            tService.Start();
            Thread.Sleep(1000);
            string cmd = null;

            Console.WriteLine("Type 'help' to display a list of commands.");

            while (true)
            {
                Console.Write("visnet> ");
                cmd = Console.ReadLine();

                if (cmd.ToLower() == "help")
                {
                    Console.WriteLine("Commands: ");
                    Console.WriteLine("\texit => Exits visnet");
                    Console.WriteLine("\thelp => Displays this Help Text");

                    foreach (KeyValuePair <string, Command> kvp in cmds)
                    {
                        Console.WriteLine("\t{0} => {1}", kvp.Key, kvp.Value.HelpText);
                    }
                }
                else if (cmd.ToLower() == "exit")
                {
                    break;
                }

                string[] ar = cmd.Split(' ', StringSplitOptions.RemoveEmptyEntries);

                if (ar.Length == 0 || !cmds.ContainsKey(ar[0]))
                {
                    Console.WriteLine("Invalid Command: " + cmd);
                }
                else
                {
                    Command command = cmds[ar[0]];

                    if (!command.TryExecute(ar.Skip(1).ToArray()))
                    {
                        Console.WriteLine("Command Failed.");
                    }
                }
            }

            node.UnloadNode();
            tService.Stop();
        }