Connect() public method

public Connect ( string host, int port ) : Stream
host string
port int
return Stream
Esempio n. 1
0
        static void Main(string[] args)
        {
            using (var streamProvider = new PipBoyStreamProvider(DebugSettings.DumpTcpStream ? DebugSettings.TcpDumpFile : null))
            {
                var stream = DebugSettings.UseTcp
                    ? streamProvider.Connect(DebugSettings.Host, DebugSettings.Port)
                    : streamProvider.ReadFile(DebugSettings.InputFile);

                using (stream)
                {
                    ReadStream(stream);
                }
            }

            if (Debugger.IsAttached)
            {
                Console.WriteLine("finished");
                Console.ReadLine();
            }
        }
Esempio n. 2
0
        public static void Dump(Options options)
        {
            using (var streamProvider = new PipBoyStreamProvider(options.RawFile))
            {
                Stream stream;

                if (options.Host != null)
                {
                    stream = streamProvider.Connect(options.Host, options.Port);
                }
                else if (options.InputFile != null)
                {
                    stream = streamProvider.ReadFile(options.InputFile);
                }
                else
                {
                    throw new ArgumentException();
                }

                using (stream)
                {
                    var dumper = new Dumper(options.GameobjectsFile);
                    var dumpThread = new Thread(_ => dumper.Dump(stream));
                    dumpThread.Start();

                    Console.WriteLine("Dump running... press key to exit");
                    while (dumpThread.IsAlive && !Console.KeyAvailable)
                    {
                        Thread.Sleep(100);
                    }
                    dumper.SignalStop();
                    dumpThread.Join();
                }
            }
        }