/// <summary> Creates a <see cref="ConnectionInfo"/> object for the specified vessel from it's antenna modules</summary> private ConnectionInfo(Vessel v, bool powered, bool storm) { // return no connection if there is no ec left if (!powered) { return; } AntennaInfo ai = GetAntennaInfo(v, powered, storm); ec = ai.ec; rate = ai.rate * PreferencesScience.Instance.transmitFactor; linked = ai.linked; strength = ai.strength; target_name = ai.target_name; control_path = ai.control_path; switch (ai.status) { case 0: status = LinkStatus.direct_link; break; case 1: status = LinkStatus.indirect_link; break; case 2: status = LinkStatus.no_link; break; case 3: status = LinkStatus.plasma; break; case 4: status = LinkStatus.storm; break; default: status = LinkStatus.no_link; break; } }
public static LinkDto CreateLink(ILinkRule rule, bool ruleApply, LinkStatus linkStatus) { var linkDto = new LinkDto("link", linkStatus.ToString(), 1); rule.SetLinkTo(ruleApply, linkStatus, linkDto); return(linkDto); }
public TreeViewModel(string name, LinkStatus linkStatus) { Name = name; SetLinkStatus(linkStatus); IsEnabled = true; Children = new List <TreeViewModel>(); }
private void setMasterLinkState(LinkStatus status) { masterLinkStatus = status; if (status == LinkStatus.NOT_CONNECTED) { lableMasterLinkState.Text = "Соединение с MasterNode не установленно"; lableMasterLinkState.ForeColor = Color.Brown; connectToMasterButton.Text = "Подключиться"; connectToMasterButton.Enabled = true; //activateWidgets(false); } else if (status == LinkStatus.CONNECTED) { lableMasterLinkState.Text = String.Format("Соединение с MasterNode [{0}] установлено", masterUri.ToString()); lableMasterLinkState.ForeColor = Color.Green; connectToMasterButton.Text = "Отключиться"; connectToMasterButton.Enabled = true; //activateWidgets(true); } else if (status == LinkStatus.CONNECTING) { lableMasterLinkState.Text = String.Format("Соединение с MasterNode [{0}]...", masterUri.ToString()); lableMasterLinkState.ForeColor = Color.Blue; connectToMasterButton.Enabled = false; } else if (status == LinkStatus.DISCONNECTING) { lableMasterLinkState.Text = "Отключение от MasterNode"; lableMasterLinkState.ForeColor = Color.Blue; connectToMasterButton.Enabled = false; } }
/// <summary> /// Updates the current link status if it has changed and notifies any registered delegates. /// </summary> /// <param name="newStatus">The status the node should now be in.</param> protected void ChangeLinkStatus(LinkStatus newStatus) { ErrorUtilities.VerifyThrow(_status != newStatus, "Attempting to change status to existing status {0}.", _status); CommunicationsUtilities.Trace("Changing link status from {0} to {1}", _status.ToString(), newStatus.ToString()); _status = newStatus; RaiseLinkStatusChanged(_status); }
public void SetLinkStatus(LinkStatus status) { Status = status; switch (Status) { case LinkStatus.Linked: TextColor = new SolidColorBrush(Colors.Gray); break; case LinkStatus.NewItem: TextColor = new SolidColorBrush(Colors.Green); break; case LinkStatus.MissingFromSource: TextColor = new SolidColorBrush(Colors.Red); break; case LinkStatus.MissingFromRecipient: TextColor = new SolidColorBrush(Colors.Red); break; default: TextColor = new SolidColorBrush(Colors.Black); break; } }
private void LinkStatusChanged(INodeEndpoint endpoint, LinkStatus status) { lock (_linkStatusTable) { _linkStatusTable[endpoint] = new LinkStatusContext(Thread.CurrentThread, status); } }
public ConnectionInfo(LinkStatus status, double rate = 0.0, double cost = 0.0) { this.linked = status == LinkStatus.direct_link || status == LinkStatus.indirect_link; this.status = status; this.rate = rate; this.cost = cost; this.path = new List <Vessel>(); }
/// <summary> /// Invokes the OnLinkStatusChanged event in a thread-safe manner. /// </summary> /// <param name="newStatus">The new status of the endpoint link.</param> private void RaiseLinkStatusChanged(LinkStatus newStatus) { if (null != OnLinkStatusChanged) { LinkStatusChangedDelegate linkStatusDelegate = OnLinkStatusChanged; linkStatusDelegate(this, newStatus); } }
/// <summary> /// Constructor /// </summary> /// <param name="config">Configuration structure</param> public LinkLayer(Configuration config) { phy = new PhysicalLayer(config); link_thread = new Thread(LinkThreadTask); status = LinkStatus.IDLE; timer.Interval = 1000; timer.AutoReset = false; timer.Elapsed += TimeoutHandler; }
public ConnectionInfo(LinkStatus status, double rate = 0.0, double cost = 0.0, string target_name = "DSN") { this.linked = status == LinkStatus.direct_link || status == LinkStatus.indirect_link; this.status = status; this.rate = rate; this.cost = cost; this.path = new List <Vessel>(); this.target_name = target_name; }
/// <summary> /// Instantiates an endpoint to act as a client /// </summary> /// <param name="pipeName">The name of the pipe to which we should connect.</param> internal void InternalConstruct(string pipeName) { ErrorUtilities.VerifyThrowArgumentLength(pipeName, nameof(pipeName)); _debugCommunications = (Environment.GetEnvironmentVariable("MSBUILDDEBUGCOMM") == "1"); _status = LinkStatus.Inactive; _asyncDataMonitor = new object(); _sharedReadBuffer = InterningBinaryReader.CreateSharedBuffer(); _packetStream = new MemoryStream(); _binaryWriter = new BinaryWriter(_packetStream); #if FEATURE_PIPE_SECURITY && FEATURE_NAMED_PIPE_SECURITY_CONSTRUCTOR if (!NativeMethodsShared.IsMono) { SecurityIdentifier identifier = WindowsIdentity.GetCurrent().Owner; PipeSecurity security = new PipeSecurity(); // Restrict access to just this account. We set the owner specifically here, and on the // pipe client side they will check the owner against this one - they must have identical // SIDs or the client will reject this server. This is used to avoid attacks where a // hacked server creates a less restricted pipe in an attempt to lure us into using it and // then sending build requests to the real pipe client (which is the MSBuild Build Manager.) PipeAccessRule rule = new PipeAccessRule(identifier, PipeAccessRights.ReadWrite, AccessControlType.Allow); security.AddAccessRule(rule); security.SetOwner(identifier); _pipeServer = new NamedPipeServerStream ( pipeName, PipeDirection.InOut, 1, // Only allow one connection at a time. PipeTransmissionMode.Byte, PipeOptions.Asynchronous | PipeOptions.WriteThrough, PipeBufferSize, // Default input buffer PipeBufferSize, // Default output buffer security, HandleInheritability.None ); } else #endif { _pipeServer = new NamedPipeServerStream ( pipeName, PipeDirection.InOut, 1, // Only allow one connection at a time. PipeTransmissionMode.Byte, PipeOptions.Asynchronous | PipeOptions.WriteThrough, PipeBufferSize, // Default input buffer PipeBufferSize // Default output buffer ); } }
public virtual BOLinkStatus MapEFToBO( LinkStatus ef) { var bo = new BOLinkStatus(); bo.SetProperties( ef.Id, ef.Name); return(bo); }
public virtual LinkStatus MapBOToEF( BOLinkStatus bo) { LinkStatus efLinkStatus = new LinkStatus(); efLinkStatus.SetProperties( bo.Id, bo.Name); return(efLinkStatus); }
public void MapModelToEntity() { var mapper = new DALLinkStatusMapper(); ApiLinkStatusServerRequestModel model = new ApiLinkStatusServerRequestModel(); model.SetProperties("A"); LinkStatus response = mapper.MapModelToEntity(1, model); response.Name.Should().Be("A"); }
public virtual ApiLinkStatusServerResponseModel MapEntityToModel( LinkStatus item) { var model = new ApiLinkStatusServerResponseModel(); model.SetProperties(item.Id, item.Name); return(model); }
/// <summary> /// Callback invoked when the link status of the endpoint has changed. /// </summary> /// <param name="endpoint">The endpoint whose status has changed.</param> /// <param name="status">The new link status.</param> private void InProcNodeEndpoint_OnLinkStatusChanged(INodeEndpoint endpoint, LinkStatus status) { if (status == LinkStatus.Active) { // We don't verify this outside of the 'if' because we don't care about the link going down, which will occur // after we have cleared the inProcNodeEndpoint due to shutting down the node. ErrorUtilities.VerifyThrow(endpoint == _inProcNodeEndpoint, "Received link status event for a node other than our peer."); _endpointConnectedEvent.Set(); } }
public void MapEntityToModel() { var mapper = new DALLinkStatusMapper(); LinkStatus item = new LinkStatus(); item.SetProperties(1, "A"); ApiLinkStatusServerResponseModel response = mapper.MapEntityToModel(item); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
/// <summary> /// Instantiates an endpoint to act as a client /// </summary> /// <param name="pipeName">The name of the pipe to which we should connect.</param> internal void InternalConstruct(string pipeName) { ErrorUtilities.VerifyThrowArgumentLength(pipeName, nameof(pipeName)); _debugCommunications = (Environment.GetEnvironmentVariable("MSBUILDDEBUGCOMM") == "1"); _status = LinkStatus.Inactive; _asyncDataMonitor = new object(); _sharedReadBuffer = InterningBinaryReader.CreateSharedBuffer(); _pipeServer = NamedPipeUtil.CreateNamedPipeServer(pipeName, PipeBufferSize, PipeBufferSize); }
public void MapBOToEF() { var mapper = new DALLinkStatusMapper(); var bo = new BOLinkStatus(); bo.SetProperties(1, "A"); LinkStatus response = mapper.MapBOToEF(bo); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
public virtual LinkStatus MapModelToEntity( int id, ApiLinkStatusServerRequestModel model ) { LinkStatus item = new LinkStatus(); item.SetProperties( id, model.Name); return(item); }
public void MapEFToBO() { var mapper = new DALLinkStatusMapper(); LinkStatus entity = new LinkStatus(); entity.SetProperties(1, "A"); BOLinkStatus response = mapper.MapEFToBO(entity); response.Id.Should().Be(1); response.Name.Should().Be("A"); }
public async Task <FolderAssociation> AddFolderToSyncAsync(StorageFolder folder, DavItem remoteFolderItem, bool allowInstantUpload = false) { StorageApplicationPermissions.FutureAccessList.Add(folder); var properties = await folder.Properties.RetrievePropertiesAsync(new List <string> { "System.DateModified" }); FolderAssociation fa = new FolderAssociation { IsActive = true, LocalFolderId = 0, RemoteFolderId = 0, SyncDirection = SyncDirection.FullSync, LastSync = DateTime.MinValue }; if (allowInstantUpload) { fa.SyncDirection = SyncDirection.UploadOnly; fa.SupportsInstantUpload = true; } FolderAssociationTableModel.GetDefault().InsertItem(fa); fa = FolderAssociationTableModel.GetDefault().GetLastInsertItem(); BaseItem li = new LocalItem { IsCollection = true, LastModified = ((DateTimeOffset)properties["System.DateModified"]).LocalDateTime, EntityId = folder.Path, Association = fa, }; var testFolder = await StorageFolder.GetFolderFromPathAsync(folder.Path); if (testFolder.Path != folder.Path) { li.EntityId = testFolder.Path; } ItemTableModel.GetDefault().InsertItem(li); li = ItemTableModel.GetDefault().GetLastInsertItem(); remoteFolderItem.Association = fa; ItemTableModel.GetDefault().InsertItem(remoteFolderItem); var ri = ItemTableModel.GetDefault().GetLastInsertItem(); fa.RemoteFolderId = ri.Id; fa.LocalFolderId = li.Id; FolderAssociationTableModel.GetDefault().UpdateItem(fa, fa.Id); var link = new LinkStatus(li, ri); LinkStatusTableModel.GetDefault().InsertItem(link); return(fa); }
public void MapEntityToModelList() { var mapper = new DALLinkStatusMapper(); LinkStatus item = new LinkStatus(); item.SetProperties(1, "A"); List <ApiLinkStatusServerResponseModel> response = mapper.MapEntityToModel(new List <LinkStatus>() { { item } }); response.Count.Should().Be(1); }
public async Task <ApiLinkStatusResponseModel> ByName(string name) { LinkStatus record = await this.LinkStatusRepository.ByName(name); if (record == null) { return(null); } else { return(this.BolLinkStatusMapper.MapBOToModel(this.DalLinkStatusMapper.MapEFToBO(record))); } }
private async Task <bool> BeUniqueByName(ApiLinkStatusRequestModel model, CancellationToken cancellationToken) { LinkStatus record = await this.linkStatusRepository.ByName(model.Name); if (record == null || (this.existingRecordId != default(int) && record.Id == this.existingRecordId)) { return(true); } else { return(false); } }
public HostLink(Flow flow, GoLabeledLink link) { if (!flow.IsLocalA) { Status = LinkStatus.OutLocal; } else if (!flow.IsLocalB) { Status = LinkStatus.LocalOut; } Link = link; Flows.Add(flow); }
public async virtual Task <ApiLinkStatusServerResponseModel> ByName(string name) { LinkStatus record = await this.LinkStatusRepository.ByName(name); if (record == null) { return(null); } else { return(this.DalLinkStatusMapper.MapEntityToModel(record)); } }
public virtual async Task <ApiLinkStatusServerResponseModel> Get(int id) { LinkStatus record = await this.LinkStatusRepository.Get(id); if (record == null) { return(null); } else { return(this.DalLinkStatusMapper.MapEntityToModel(record)); } }
/// <summary> /// Instantiates a Node and initializes it to unconnected. /// </summary> /// <param name="commMode">The communications mode for this endpoint.</param> /// <param name="host">The component host.</param> private NodeEndpointInProc(EndpointMode commMode, IBuildComponentHost host) { ErrorUtilities.VerifyThrowArgumentNull(host, "host"); _status = LinkStatus.Inactive; _mode = commMode; _componentHost = host; if (commMode == EndpointMode.Asynchronous) { _asyncDataMonitor = new object(); } }
public Link(string id1, string id2, LinkStatus status, LinkKind kind, long timestamp) { if (String.CompareOrdinal(id1, id2) < 0) { Id1 = id1; Id2 = id2; } else { Id1 = id2; Id2 = id1; } Status = status; Kind = kind; Timestamp = timestamp; }
public Link(EventQueueProcessor eqp, string name, Node src, Node dest, double rate, double prop_delay, Int64 buffer_size) { this.eqp = eqp; this.src = src; this.dest = dest; this.rate = rate; this.name = name; this.prop_delay = prop_delay; this.buffer_size = buffer_size; this.lStatus = new LinkStatus(); this.lStatus.link = this; this.lStatus.dropped_packets = 0; this.lStatus.delivered_packets = 0; this.is_transmitting = false; this.buffer = new Queue<Packet>(); }
/// <summary> /// Updates the current link status if it has changed and notifies any registered delegates. /// </summary> /// <param name="newStatus">The status the node should now be in.</param> private void ChangeLinkStatus(LinkStatus newStatus) { ErrorUtilities.VerifyThrow(_status != newStatus, "Attempting to change status to existing status {0}.", _status); _status = newStatus; RaiseLinkStatusChanged(_status); }
public Link(string id1, string id2, LinkStatus status, LinkKind kind) : this(id1, id2, status, kind, CurrentTimeMillis()) { }
/// <summary> /// Reads all static xbox information that will remain constant throughout a session. /// </summary> private void GetXboxInformation() { // xbox video encoder type if (CallAddressEx(Kernel.HalReadSMBusValue, null, true, SMBusDevices.VideoEncoderXcalibur, VideoEncoderCommand.Detect, 0, scratchBuffer) == 0) videoEncoderType = VideoEncoder.Xcalibur; else if (CallAddressEx(Kernel.HalReadSMBusValue, null, true, SMBusDevices.VideoEncoderConnexant, VideoEncoderCommand.Detect, 0, scratchBuffer) == 0) videoEncoderType = VideoEncoder.Connexant; else if (CallAddressEx(Kernel.HalReadSMBusValue, null, true, SMBusDevices.VideoEncoderFocus, VideoEncoderCommand.Detect, 0, scratchBuffer) == 0) videoEncoderType = VideoEncoder.Focus; else videoEncoderType = VideoEncoder.Unknown; // xbox version info CallAddressEx(Kernel.HalReadSMBusValue, null, false, SMBusDevices.PIC, PICCommand.Version, 0, scratchBuffer); CallAddressEx(Kernel.HalReadSMBusValue, null, false, SMBusDevices.PIC, PICCommand.Version, 0, scratchBuffer + 1); CallAddressEx(Kernel.HalReadSMBusValue, null, false, SMBusDevices.PIC, PICCommand.Version, 0, scratchBuffer + 2); string code = ASCIIEncoding.ASCII.GetString(GetMemory(scratchBuffer, 3)); switch (code) { case "01D": case "D01": case "1D0": case "0D1": version = "Xbox Development Kit"; break; case "P01": version = "Xbox v1.0"; break; case "P05": version = "Xbox v1.1"; break; case "P11": case "1P1": case "11P": if (videoEncoderType == VideoEncoder.Focus) version = "1.4"; else version = "Xbox v1.2/1.3"; break; case "P2L": version = "Xbox v1.6"; break; case "B11": case "DBG": version = "Xbox Debug Kit"; break; // green default: version = code + ": Unknown Xbox"; break; } // processor information SetMemory(ScriptBufferAddress, Util.StringToHexBytes("B8010000000FA2A300000100B80000DB02C21000")); SendCommand("crashdump"); uint eax = GetUInt32(0x10000); processorInformation.Stepping = eax & 0xf; processorInformation.Model = (eax >> 4) & 0xf; processorInformation.Family = (eax >> 8) & 0xf; if (processorInformation.Model == 11) cpuFrequency = "1.48 GHz"; // DreamX console else if (processorInformation.Model == 8 && processorInformation.Stepping == 6) cpuFrequency = "1.00 GHz"; // Intel Pentium III Coppermine else cpuFrequency = "733.33 MHz"; // hardware info uint ver = GetUInt32(Kernel.HardwareInfo); string vstr = Convert.ToString(ver, 16).PadLeft(8, '0'); string vstr2 = Util.HexBytesToString(GetMemory(Kernel.HardwareInfo + 4, 2)).Insert(2, " "); hardwareInfo = vstr + " " + vstr2; macAddress = BitConverter.ToString(eeprom, 0x40, 6).Replace('-', ':'); serialNumber = Convert.ToUInt64(ASCIIEncoding.ASCII.GetString(eeprom, 0x34, 12)); lanKey = GetMemory(Kernel.XboxLANKey, 16); signatureKey = GetMemory(Kernel.XboxSignatureKey, 16); eepromKey = GetMemory(Kernel.XboxEEPROMKey, 16); hardDriveKey = GetMemory(Kernel.XboxHDKey, 16); byte[] hdModelInfo = GetMemory(Kernel.HalDiskModelNumber, 40); uint unk1 = BitConverter.ToUInt32(hdModelInfo, 0); uint index = BitConverter.ToUInt32(hdModelInfo, 4); hardDriveModel = ASCIIEncoding.ASCII.GetString(hdModelInfo, 8, 32).Trim().Replace("\0", ""); byte[] hdSerialInfo = GetMemory(Kernel.HalDiskSerialNumber, 32); unk1 = BitConverter.ToUInt32(hdSerialInfo, 0); index = BitConverter.ToUInt32(hdSerialInfo, 4); hardDriveSerial = ASCIIEncoding.ASCII.GetString(hdSerialInfo, 8, 16).Trim().Replace("\0", ""); alternateSignatureKeys = new byte[16][]; byte[] keyData = GetMemory(Kernel.XboxAlternateSignatureKeys, 256); for (int i = 0; i < 16; i++) { alternateSignatureKeys[i] = new byte[16]; Buffer.BlockCopy(keyData, i * 16, alternateSignatureKeys[i], 0, 16); } StringBuilder krnlStr = new StringBuilder(); byte[] krnlVersion = GetMemory(Kernel.XboxKrnlVersion, 8); krnlStr.AppendFormat("{0}.{1}.{2}.{3}", BitConverter.ToUInt16(krnlVersion, 0), BitConverter.ToUInt16(krnlVersion, 2), BitConverter.ToUInt16(krnlVersion, 4), BitConverter.ToUInt16(krnlVersion, 6) ); kernelVersion = new Version(krnlStr.ToString()); SendCommand("modules"); modules = new List<ModuleInfo>(); string line = ReceiveSocketLine(); while (line[0] != '.') { ModuleInfo module = new ModuleInfo(); module.Sections = new List<ModuleSection>(); List<object> info = Util.ExtractResponseInformation(line); module.Name = (string)info[0]; module.BaseAddress = (uint)info[1]; module.Size = (uint)info[2]; module.Checksum = (uint)info[3]; module.TimeStamp = Util.TimeStampToUniversalDateTime((uint)info[4]); modules.Add(module); line = ReceiveSocketLine(); } foreach (ModuleInfo module in modules) { SendCommand("modsections name={0}", module.Name); line = ReceiveSocketLine(); while (line[0] != '.') { ModuleSection modSection = new ModuleSection(); List<object> info = Util.ExtractResponseInformation(line); modSection.Name = (string)info[0]; modSection.Base = (uint)info[1]; modSection.Size = (uint)info[2]; modSection.Index = (uint)info[3]; modSection.Flags = (uint)info[4]; module.Sections.Add(modSection); line = ReceiveSocketLine(); } } string hex = SendCommand("altaddr").Message.Substring(7); titleIP = new IPAddress(Util.StringToHexBytes(hex)); linkStatus = (LinkStatus)CallAddressEx(Kernel.PhyGetLinkState, null, true, 0); // Attempt to load title/game info. Will throw exception if we are in Debug Dash try { getTitleInformation(); } catch { } }
/// <summary> /// Invokes the OnLinkStatusChanged event in a thread-safe manner. /// </summary> /// <param name="newStatus">The new status of the endpoint link.</param> private void RaiseLinkStatusChanged(LinkStatus newStatus) { if (null != OnLinkStatusChanged) { LinkStatusChangedDelegate linkStatusDelegate = (LinkStatusChangedDelegate)OnLinkStatusChanged.Clone(); linkStatusDelegate(this, newStatus); } }
public LinkStatusContext(Thread thread, LinkStatus status) { this.thread = thread; this.status = status; }
/// <summary> /// Event handler for the node endpoint's LinkStatusChanged event. /// </summary> private void OnLinkStatusChanged(INodeEndpoint endpoint, LinkStatus status) { switch (status) { case LinkStatus.ConnectionFailed: case LinkStatus.Failed: _shutdownReason = NodeEngineShutdownReason.ConnectionFailed; _shutdownEvent.Set(); break; case LinkStatus.Inactive: break; default: break; } }
/// <summary> /// Instantiates an endpoint to act as a client /// </summary> /// <param name="pipeName">The name of the pipe to which we should connect.</param> internal void InternalConstruct(string pipeName) { ErrorUtilities.VerifyThrowArgumentLength(pipeName, "pipeName"); _debugCommunications = (Environment.GetEnvironmentVariable("MSBUILDDEBUGCOMM") == "1"); _status = LinkStatus.Inactive; _asyncDataMonitor = new object(); _sharedReadBuffer = InterningBinaryReader.CreateSharedBuffer(); SecurityIdentifier identifier = WindowsIdentity.GetCurrent().Owner; PipeSecurity security = new PipeSecurity(); // Restrict access to just this account. We set the owner specifically here, and on the // pipe client side they will check the owner against this one - they must have identical // SIDs or the client will reject this server. This is used to avoid attacks where a // hacked server creates a less restricted pipe in an attempt to lure us into using it and // then sending build requests to the real pipe client (which is the MSBuild Build Manager.) PipeAccessRule rule = new PipeAccessRule(identifier, PipeAccessRights.ReadWrite, AccessControlType.Allow); security.AddAccessRule(rule); security.SetOwner(identifier); _pipeServer = new NamedPipeServerStream ( pipeName, PipeDirection.InOut, 1, // Only allow one connection at a time. PipeTransmissionMode.Byte, PipeOptions.Asynchronous | PipeOptions.WriteThrough, PipeBufferSize, // Default input buffer PipeBufferSize, // Default output buffer security, HandleInheritability.None ); }
void ILinkStatusListener.OnStateChange(LinkStatus value) { }
private void Initialize(string xboxIP) { // establish debug session connection = new TcpClient(); connection.SendTimeout = 250; connection.ReceiveTimeout = 250; connection.ReceiveBufferSize = 0x100000 * 3; // todo: check on this connection.SendBufferSize = 0x100000 * 3; connection.NoDelay = true; connection.Connect(xboxIP, 731); connected = Ping(100); // make sure it is successful if (connected) { // make sure they are using the current xbdm.dll v7887 debugMonitorVersion = new Version(SendCommand("dmversion").Message); if (DebugMonitorVersion != new Version("1.00.7887.1")) { Disconnect(); // unsafe to proceed, so disconnect... throw new ApiException("Must use our hacked xbdm.dll v1.00.7887.1 before connecting"); } // check correct module entrypoint SendCommand("modules"); modules = new List<ModuleInfo>(); string line = ReceiveSocketLine(); while (line[0] != '.') { ModuleInfo module = new ModuleInfo(); module.Sections = new List<ModuleSection>(); var info = Util.ExtractResponseInformation(line); module.Name = (string)info[0]; module.BaseAddress = Convert.ToUInt32(info[1]); if (module.Name == "xbdm.dll" && module.BaseAddress != 0xB0000000) throw new Exception("You seem to be most likely running the Complex v4627 Debug Bios. YeloDebug is not compatible with this bios."); module.Size = (uint)info[2]; module.Checksum = (uint)info[3]; module.TimeStamp = Util.TimeStampToUniversalDateTime((uint)info[4]); modules.Add(module); line = ReceiveSocketLine(); } foreach (ModuleInfo module in modules) { SendCommand("modsections name=\"{0}\"", module.Name); List<string> response = ReceiveMultilineResponseList(); foreach (string r in response) { ModuleSection modSection = new ModuleSection(); var info = Util.ExtractResponseInformation(r); modSection.Name = (string)info[0]; modSection.Base = Convert.ToUInt32(info[1]); modSection.Size = Convert.ToUInt32(info[2]); modSection.Index = Convert.ToUInt32(info[3]); modSection.Flags = Convert.ToUInt32(info[4]); module.Sections.Add(modSection); } } // register our notification session if (notificationSessionEnabled) RegisterNotificationSession(notificationPort); // must have for our shitty setmem hack to work ;P CreateFile("E:\\fUkM$DeVs", FileMode.Create); //initialize main components - order specific!!! MemoryStream = new XboxMemoryStream(this); MemoryStream.SafeMode = true; MemoryReader = new BinaryReader(MemoryStream); MemoryWriter = new BinaryWriter(MemoryStream); kernel = new XboxKernel(this); History = new XboxHistory(this); Gamepad = new XboxGamepad(this); eeprom = ReadEEPROM(); // get xbox production information ProductionInfo pInfo = new ProductionInfo(); string serial = ASCIIEncoding.ASCII.GetString(eeprom, 0x34, 12); switch (serial[11]) { case '2': pInfo.Country = "Mexico"; break; case '3': pInfo.Country = "Hungary"; break; case '5': pInfo.Country = "China"; break; case '6': pInfo.Country = "Taiwan"; break; default: pInfo.Country = "Unknown"; break; } pInfo.LineNumber = Convert.ToUInt32(serial.Substring(0, 1)); pInfo.Week = Convert.ToUInt32(serial.Substring(8, 2)); pInfo.Year = Convert.ToUInt32("200" + serial[7]); productionInfo = pInfo; // xbox video encoder type if (CallAddressEx(Kernel.HalReadSMBusValue, null, true, SMCDevices.VideoEncoderXcalibur, VideoEncoderCommand.Detect, 0, History.ScratchBuffer) == 0) videoEncoderType = VideoEncoder.Xcalibur; else if (CallAddressEx(Kernel.HalReadSMBusValue, null, true, SMCDevices.VideoEncoderConnexant, VideoEncoderCommand.Detect, 0, History.ScratchBuffer) == 0) videoEncoderType = VideoEncoder.Connexant; else if (CallAddressEx(Kernel.HalReadSMBusValue, null, true, SMCDevices.VideoEncoderFocus, VideoEncoderCommand.Detect, 0, History.ScratchBuffer) == 0) videoEncoderType = VideoEncoder.Focus; else videoEncoderType = VideoEncoder.Unknown; // processor information SetMemory(XboxHistory.ScriptBufferAddress, Util.HexStringToBytes("B8010000000FA2A300000100B80000DB02C21000")); SendCommand("crashdump"); uint eax = GetUInt32(0x10000); processor.Stepping = eax & 0xf; processor.Model = (eax >> 4) & 0xf; processor.Family = (eax >> 8) & 0xf; if (processor.Model == 11) { processor.Identification = "1.48 GHz Intel Tualatin Celeron (DreamX)"; } else if (processor.Model == 8 && processor.Stepping == 6) { processor.Identification = "1.00 GHz Intel Pentium III Coppermine"; } else { processor.Identification = "733.33 MHz Intel Pentium III"; } // hardware info uint ver = GetUInt32(Kernel.HardwareInfo); string vstr = Convert.ToString(ver, 16).PadLeft(8, '0'); string vstr2 = Util.HexBytesToString(GetMemory(Kernel.HardwareInfo + 4, 2)).Insert(2, " "); hardwareInfo = vstr + " " + vstr2; macAddress = BitConverter.ToString(eeprom, 0x40, 6).Replace('-', ':'); serialNumber = Convert.ToUInt64(ASCIIEncoding.ASCII.GetString(eeprom, 0x34, 12)); lanKey = GetMemory(Kernel.XboxLANKey, 16); signatureKey = GetMemory(Kernel.XboxSignatureKey, 16); eepromKey = GetMemory(Kernel.XboxEEPROMKey, 16); hardDriveKey = GetMemory(Kernel.XboxHDKey, 16); byte[] hdModelInfo = GetMemory(Kernel.HalDiskModelNumber, 40); uint unk1 = BitConverter.ToUInt32(hdModelInfo, 0); uint index = BitConverter.ToUInt32(hdModelInfo, 4); hardDriveModel = ASCIIEncoding.ASCII.GetString(hdModelInfo, 8, 32).Trim().Replace("\0", ""); byte[] hdSerialInfo = GetMemory(Kernel.HalDiskSerialNumber, 32); unk1 = BitConverter.ToUInt32(hdSerialInfo, 0); index = BitConverter.ToUInt32(hdSerialInfo, 4); hardDriveSerial = ASCIIEncoding.ASCII.GetString(hdSerialInfo, 8, 16).Trim().Replace("\0", ""); alternateSignatureKeys = new byte[16][]; byte[] keyData = GetMemory(Kernel.XboxAlternateSignatureKeys, 256); for (int i = 0; i < 16; i++) { alternateSignatureKeys[i] = new byte[16]; Buffer.BlockCopy(keyData, i * 16, alternateSignatureKeys[i], 0, 16); } StringBuilder krnlStr = new StringBuilder(); byte[] krnlVersion = GetMemory(Kernel.XboxKrnlVersion, 8); krnlStr.AppendFormat("{0}.{1}.{2}.{3}", BitConverter.ToUInt16(krnlVersion, 0), BitConverter.ToUInt16(krnlVersion, 2), BitConverter.ToUInt16(krnlVersion, 4), BitConverter.ToUInt16(krnlVersion, 6) ); kernelVersion = new Version(krnlStr.ToString()); try { // OPTIONAL - will fail on some boxes that return "not debuggable" error processID = Convert.ToUInt32(SendCommand("getpid").Message.Substring(6), 16); SendCommand("xbeinfo running"); xbeInfo = new XbeInfo(); line = ReceiveSocketLine(); XbeInfo.TimeStamp = Util.TimeStampToUniversalDateTime((uint)Util.GetResponseInfo(line, 0)); XbeInfo.Checksum = (uint)Util.GetResponseInfo(line, 1); line = ReceiveSocketLine(); XbeInfo.LaunchPath = (string)Util.GetResponseInfo(line, 0); ReceiveSocketLine(); // '.' } catch { } try { string hex = SendCommand("altaddr").Message.Substring(7); titleIP = new IPAddress(Util.HexStringToBytes(hex)); } catch { } linkStatus = (LinkStatus)CallAddressEx(Kernel.PhyGetLinkState, null, true, 0); MemoryStream.SafeMode = false; } else throw new NoConnectionException("Unable to connect."); }