private void SendVersionIsCurrent() { PropertyBag bag = new PropertyBag(); PacketGenericMessage p = (PacketGenericMessage)CreatePacket((int)PacketType.PacketGenericMessage, (byte)GenericMessageType.VersionIsCurrent, false, false); p.Parms = bag; p.NeedsDeliveryAck = true; Send(p); SetTimer(500);// KillConnection("User is current. Disconnecting."); }
private void RequestClientSpec() { PropertyBag bag = new PropertyBag(); PacketGenericMessage p = (PacketGenericMessage)CreatePacket((int)PacketType.PacketGenericMessage, 878787, false, false); p.Parms = bag; p.NeedsDeliveryAck = false; if (PatchServerProcess.Instance.CaptureCPU) { bag.SetProperty("cpu", true); } if (PatchServerProcess.Instance.CaptureDrives) { bag.SetProperty("drives", true); } if (PatchServerProcess.Instance.CaptureGPU) { bag.SetProperty("gpu", true); } if (PatchServerProcess.Instance.CaptureMainboard) { bag.SetProperty("mainboard", true); } if (PatchServerProcess.Instance.CaptureOS) { bag.SetProperty("os", true); } if (PatchServerProcess.Instance.CaptureRAM) { bag.SetProperty("ram", true); } Send(p); }
public void OnGetLatestVersion(INetworkConnection con, Packet nmsg) { PacketGenericMessage packet = nmsg as PacketGenericMessage; string version = packet.Parms.GetStringProperty("CurrentVersion"); try { double curVersion = double.Parse(version); int idx = PatchServerProcess.Patches.IndexOfKey(curVersion); if (idx == -1) { Log1.Logger("Server").Info("User reported being at version number [" + version + "]. Version not known as per Versions.txt. Dropping user connection."); KillConnection("Unknown current version."); return; } if (!m_SentPatchNotes) { PropertyBag bag = new PropertyBag(); bag.SetProperty("notes", 1, PatchServerProcess.PatchNotes); PacketGenericMessage p = (PacketGenericMessage)CreatePacket((int)PacketType.PacketGenericMessage, (int)GenericMessageType.Notes, false, false); p.Parms = bag; p.NeedsDeliveryAck = true; Send(p); m_SentPatchNotes = true; } if (idx == (PatchServerProcess.Patches.Count - 1)) { // if the server is configured to collect client spec data, then we do it right before we tell the client they're current. // if not, just send the iscurrent message now. if (ShouldCollectClientSpecs()) { RequestClientSpec(); } else { SendVersionIsCurrent(); } return; } // get next patch in line idx++; FileInfo fi = PatchServerProcess.Patches.Values[idx]; try { double newVersion = PatchServerProcess.Patches.Keys[idx]; SendFileStream(fi, newVersion.ToString()); } catch (Exception se) { Log1.Logger("Patcher").Error("Error sending patch to " + RemoteEndPoint.ToString(), se); } } catch (Exception e) { KillConnection("Malformed patch request. " + e.Message); return; } // we only send one patch file. let client process that file, then call us back for next file. if (Transit.NumAcksWaitingFor < 1) { KillConnection("Patch sent."); } else { SetTimer(500); } }