public bool MoveNext() { var nextStr = client.GetStringAsync("/").GetAwaiter().GetResult(); _current = JsonConvert.DeserializeObject <SlaveData>(nextStr); return(true); }
public SlaveManager(string arg, int x, int y) { visuals = new List <Visual>(); this._x = x; this._y = y; length = getLength(x, y); mappedFile = MemoryMappedFile.CreateNew(arg, length); displayData = new SlaveData(); displayData.foreColors = new ConsoleColor[x, y]; displayData.backColors = new ConsoleColor[x, y]; displayData.characters = new char[x, y]; //just for now for (int xl = 0; xl < 10; xl++) { for (int yl = 0; yl < 10; yl++) { displayData.foreColors[xl, yl] = ConsoleColor.Red; displayData.backColors[xl, yl] = ConsoleColor.Red; displayData.characters[xl, yl] = arg.ToCharArray()[0]; } } ProcessStartInfo processStartInfo = new ProcessStartInfo { FileName = "RhythmThing.exe", CreateNoWindow = false, UseShellExecute = true, Arguments = $"{arg} {x} {y}" }; _accessor = mappedFile.CreateViewAccessor(); pipe = new NamedPipeServerStream(arg); _slaveProcess = Process.Start(processStartInfo); pipe.WaitForConnection(); _writer = new StreamWriter(pipe); _writer.AutoFlush = true; _aliveWindows.Add(this); }