internal void UpdateProfileWithoutTriggerUpdate(DateTime profileDateModified, string profileDisplayName, MeshProfileStatus profileStatus, string profileStatusMessage) { _profileDateModified = profileDateModified; _profileDisplayName = profileDisplayName; _profileStatus = profileStatus; _profileStatusMessage = profileStatusMessage; }
public MeshNetworkPacketProfile(BinaryReader bR) : base(MeshNetworkPacketType.Profile) { _profileDateModified = bR.ReadDate(); _profileDisplayName = Encoding.UTF8.GetString(bR.ReadBytes(bR.ReadByte())); _profileStatus = (MeshProfileStatus)bR.ReadByte(); _profileStatusMessage = Encoding.UTF8.GetString(bR.ReadBytes(bR.ReadByte())); }
public MeshNetworkPacketProfile(DateTime profileDateModified, string profileDisplayName, MeshProfileStatus profileStatus, string profileStatusMessage) : base(MeshNetworkPacketType.Profile) { _profileDateModified = profileDateModified; _profileDisplayName = profileDisplayName; _profileStatus = profileStatus; _profileStatusMessage = profileStatusMessage; }
private void ShowDetails(string name, string userId, MeshProfileStatus status, string statusMessage, byte[] image) { //name { //name icon if (name.Length > 0) { labIcon.Text = name.Substring(0, 1).ToUpper(); int x = name.LastIndexOf(" ", StringComparison.CurrentCultureIgnoreCase); if (x > 0) { labIcon.Text += name.Substring(x + 1, 1).ToUpper(); } else if (name.Length > 1) { labIcon.Text += name.Substring(1, 1).ToLower(); } } else { labIcon.Text = ""; } labIcon.BackColor = Color.FromArgb(102, 153, 255); txtDisplayName.Text = name; } //userid txtUserId.Text = userId; //status txtStatusMessage.Text = statusMessage; if (status == MeshProfileStatus.None) { status = MeshProfileStatus.Active; } cmbStatus.SelectedIndex = ((byte)status - 1); //image icon if ((image != null) && (image.Length > 0)) { using (MemoryStream mS = new MemoryStream(image)) { _profileImage = Image.FromStream(mS); picIcon.Image = _profileImage; } picIcon.Visible = true; labIcon.Visible = false; } }
public void UpdateProfile(string profileDisplayName, MeshProfileStatus profileStatus, string profileStatusMessage) { _profileDateModified = DateTime.UtcNow; _profileDisplayName = profileDisplayName; _profileStatus = profileStatus; _profileStatusMessage = profileStatusMessage; //trigger profile update broadcast messages and UI events lock (_networks) { foreach (KeyValuePair <BinaryNumber, MeshNetwork> network in _networks) { network.Value.ProfileTriggerUpdate(false); } } }
private void ShowDetails(string name, string userId, MeshProfileStatus status, string statusMessage, byte[] image) { if (!_peer.IsSelfPeer) { labIcon.Cursor = Cursors.Default; picIcon.Cursor = Cursors.Default; } //name { //name icon if (name.Length > 0) { labIcon.Text = name.Substring(0, 1).ToUpper(); int x = name.LastIndexOf(" ", StringComparison.CurrentCultureIgnoreCase); if (x > 0) { labIcon.Text += name.Substring(x + 1, 1).ToUpper(); } else if (name.Length > 1) { labIcon.Text += name.Substring(1, 1).ToLower(); } } else { labIcon.Text = ""; } if ((_peer == null) || _peer.IsOnline) { labIcon.BackColor = Color.FromArgb(102, 153, 255); } else { labIcon.BackColor = Color.Gray; } labName.Text = name; } //status labStatus.Text = statusMessage; switch (status) { case MeshProfileStatus.Inactive: labStatus.Text = "(Inactive) " + labStatus.Text; break; case MeshProfileStatus.Busy: labStatus.Text = "(Busy) " + labStatus.Text; break; } //image icon if ((image != null) && (image.Length > 0)) { using (MemoryStream mS = new MemoryStream(image)) { _profileImage = Image.FromStream(mS); picIcon.Image = _profileImage; } picIcon.Visible = true; labIcon.Visible = false; } }
private void InitMeshNode(BinaryReader bR, TorController torController) { switch (bR.ReadByte()) //version { case 1: _type = (MeshNodeType)bR.ReadByte(); _privateKey = bR.ReadBuffer(); _supportedCiphers = (SecureChannelCipherSuite)bR.ReadByte(); // _userId = new BinaryNumber(bR.BaseStream); // _localServicePort = bR.ReadUInt16(); _downloadFolder = bR.ReadShortString(); // _profileDateModified = bR.ReadDate(); _profileDisplayName = bR.ReadShortString(); _profileStatus = (MeshProfileStatus)bR.ReadByte(); _profileStatusMessage = bR.ReadShortString(); // _profileImageDateModified = bR.ReadDate(); _profileDisplayImage = bR.ReadBuffer(); // _ipv4BootstrapDhtNodes = new EndPoint[bR.ReadInt32()]; for (int i = 0; i < _ipv4BootstrapDhtNodes.Length; i++) { _ipv4BootstrapDhtNodes[i] = EndPointExtension.Parse(bR); } _ipv6BootstrapDhtNodes = new EndPoint[bR.ReadInt32()]; for (int i = 0; i < _ipv6BootstrapDhtNodes.Length; i++) { _ipv6BootstrapDhtNodes[i] = EndPointExtension.Parse(bR); } _torBootstrapDhtNodes = new EndPoint[bR.ReadInt32()]; for (int i = 0; i < _torBootstrapDhtNodes.Length; i++) { _torBootstrapDhtNodes[i] = EndPointExtension.Parse(bR); } // _enableUPnP = bR.ReadBoolean(); _allowInboundInvitations = bR.ReadBoolean(); _allowOnlyLocalInboundInvitations = bR.ReadBoolean(); // if (bR.ReadBoolean()) { _proxy = new NetProxy((NetProxyType)bR.ReadByte(), bR.ReadShortString(), bR.ReadUInt16(), (bR.ReadBoolean() ? new NetworkCredential(bR.ReadShortString(), bR.ReadShortString()) : null)); } // _appData = bR.ReadBuffer(); //start connection manager _connectionManager = new ConnectionManager(this, torController); // int networkCount = bR.ReadInt32(); for (int i = 0; i < networkCount; i++) { MeshNetwork network = new MeshNetwork(_connectionManager, bR); _networks.Add(network.NetworkId, network); } InitAnnounceTimer(); break; default: throw new InvalidDataException("MeshNode format version not supported."); } }