public void method_23(string string_0, int int_3, byte[] byte_0, int fragmentSize, int int_5) { if ((((byte_0 != null) && (byte_0.Length != 0)) && (string_0 != null)) && this.iuserManager_0.IsUserOnLine(string_0)) { if (fragmentSize == 0) { throw new ArgumentException("Value of fragmentSize must be greater than 0."); } int num2 = Interlocked.Increment(ref this.int_2); int num3 = byte_0.Length / fragmentSize; if ((byte_0.Length % fragmentSize) > 0) { num3++; } for (int i = 0; i < num3; i++) { byte[] dst = null; if (i < (num3 - 1)) { dst = new byte[fragmentSize]; } else { dst = new byte[byte_0.Length - (i * fragmentSize)]; } Buffer.BlockCopy(byte_0, i * fragmentSize, dst, 0, dst.Length); BlobFragmentContract body = new BlobFragmentContract(num2, int_3, i, dst, i == (num3 - 1)); IMessageHandler interface2 = this.interface9_0.imethod_4 <BlobFragmentContract>("_0", int_5, body, string_0); this.interface40_0.SendMessage(interface2, string_0, ActionTypeOnChannelIsBusy.Continue); } } }
public void BroadcastBlob(string groupID, int broadcastType, byte[] blobContent, int fragmentSize) { if (fragmentSize <= 0) { throw new ArgumentException("Value of fragmentSize must be greater than 0."); } List <string> groupMembers = this.igroupManager_0.GetGroupMembers(groupID); if ((groupMembers != null) && (groupMembers.Count != 0)) { int num3 = Interlocked.Increment(ref this.int_0); int num2 = blobContent.Length / fragmentSize; if ((blobContent.Length % fragmentSize) > 0) { num2++; } for (int i = 0; i < num2; i++) { byte[] dst = null; if (i < (num2 - 1)) { dst = new byte[fragmentSize]; } else { dst = new byte[blobContent.Length - (i * fragmentSize)]; } Buffer.BlockCopy(blobContent, i * fragmentSize, dst, 0, dst.Length); BlobFragmentContract body = new BlobFragmentContract(num3, broadcastType, i, dst, i == (num2 - 1)); IMessageHandler interface2 = this.interface9_0.imethod_4 <BlobFragmentContract>("_0", this.object_0.BroadcastBlob, body, groupID); this.interface40_0.PostMessage(interface2, groupMembers, ActionTypeOnChannelIsBusy.Continue); } } }
public Information method_1(string string_0, string string_1, BlobFragmentContract blobFragmentContract_0) { if ((blobFragmentContract_0.BlobID == 1) && (blobFragmentContract_0.FragmentIndex == 0)) { this.OnUserOffline(string_0); } if ((blobFragmentContract_0.FragmentIndex == 0) && blobFragmentContract_0.IsLast) { return(new Information(string_0, string_1, blobFragmentContract_0.InformationType, blobFragmentContract_0.Fragment)); } string id = this.Format(string_0, blobFragmentContract_0.BlobID); Contract class2 = this.safeDictionary_0.Get(id); if (class2 == null) { class2 = new Contract(blobFragmentContract_0.BlobID, string_0, string_1, blobFragmentContract_0.InformationType); this.safeDictionary_0.Add(id, class2); } Information information = class2.GetInformation(blobFragmentContract_0); if (information != null) { this.safeDictionary_0.Remove(id); } return(information); }
private void HandleMessage(IMessageHandler interface37_0) { BinaryInformationContract contract; if ((interface37_0.Header.MessageType == this.object_0.InformationBySend) || (interface37_0.Header.MessageType == this.object_0.InformationByPost)) { contract = this.interface9_0.imethod_1 <BinaryInformationContract>(interface37_0); this.icustomizeHandler_0.HandleInformation(interface37_0.Header.UserID, contract.InformationType, contract.Content); } else if ((interface37_0.Header.MessageType == this.object_0.BlobInformation) || (interface37_0.Header.MessageType == this.object_0.BlobByRapidEngine)) { BlobFragmentContract contract3 = this.interface9_0.imethod_1 <BlobFragmentContract>(interface37_0); Information information = this.class76_0.method_1(interface37_0.Header.UserID, interface37_0.Header.DestUserID, contract3); if (information != null) { if (interface37_0.Header.MessageType == this.object_0.BlobInformation) { this.icustomizeHandler_0.HandleInformation(interface37_0.Header.UserID, information.InformationType, information.Content); } else if (this.Event_0 != null) { BlobAndTagContract contract4 = CompactPropertySerializer.Default.Deserialize <BlobAndTagContract>(information.Content, 0); this.Event_0(interface37_0.Header.UserID, information.InformationType, contract4.Message, contract4.Tag); } } } else { IHeader interface2; IMessageHandler interface3; if (interface37_0.Header.MessageType == this.object_0.InformationNeedAck) { interface2 = this.interface9_0.imethod_7(interface37_0.Header); interface2.MessageType = this.object_0.Ack; interface3 = this.interface9_0.imethod_2 <Class110>(interface2, null); this.interface40_0.imethod_0(interface3, ActionTypeOnChannelIsBusy.Continue); contract = this.interface9_0.imethod_1 <BinaryInformationContract>(interface37_0); this.icustomizeHandler_0.HandleInformation(interface37_0.Header.UserID, contract.InformationType, contract.Content); } else if (interface37_0.Header.MessageType == this.object_0.Request) { interface2 = this.interface9_0.imethod_7(interface37_0.Header); interface2.MessageType = this.object_0.Response; contract = this.interface9_0.imethod_1 <BinaryInformationContract>(interface37_0); BinaryInformationContract body = null; try { body = new BinaryInformationContract(this.icustomizeHandler_0.HandleQuery(interface37_0.Header.UserID, contract.InformationType, contract.Content)); } finally { interface3 = this.interface9_0.imethod_2 <BinaryInformationContract>(interface2, body); this.interface40_0.PostMessage(interface3, interface37_0.Header.UserID, ActionTypeOnChannelIsBusy.Continue); } } } }
private void method_7(string string_1, int int_0, byte[] byte_0, int int_1, ChannelMode channelMode_0, int int_2) { if ((byte_0 != null) && (byte_0.Length != 0)) { if (int_1 <= 0) { throw new ArgumentException("Value of fragmentSize must be greater than 0."); } if (string_1 == null) { string_1 = "_0"; } int num3 = Interlocked.Increment(ref this.eycfKeykKx); int num2 = byte_0.Length / int_1; if ((byte_0.Length % int_1) > 0) { num2++; } for (int i = 0; i < num2; i++) { if (!(this.interface31_0.Connected.Value || (channelMode_0 == ChannelMode.ByP2PChannel))) { throw new Exception("The connection to server is interrupted !"); } byte[] dst = null; if (i < (num2 - 1)) { dst = new byte[int_1]; } else { dst = new byte[byte_0.Length - (i * int_1)]; } Buffer.BlockCopy(byte_0, i * int_1, dst, 0, dst.Length); BlobFragmentContract body = new BlobFragmentContract(num3, int_0, i, dst, i == (num2 - 1)); IMessageHandler interface2 = this.interface9_0.imethod_4 <BlobFragmentContract>(this.string_0, int_2, body, string_1); bool flag = true; if ((string_1 == "_0") || (channelMode_0 == ChannelMode.TransferByServer)) { flag = this.interface31_0.imethod_0(interface2, false, ActionTypeOnChannelIsBusy.Continue); } else if (channelMode_0 == ChannelMode.P2PChannelFirst) { flag = this.interface31_0.Send(interface2, false, ActionTypeOnChannelIsBusy.Continue); } else { flag = this.interface31_0.SendByP2PChannel(interface2, ActionTypeOnNoP2PChannel.Discard, false, string_1, ActionTypeOnChannelIsBusy.Continue); } if (!flag) { throw new Exception("The connection is interrupted !"); } } } }
public Information GetInformation(BlobFragmentContract blobFragmentContract_0) { lock (this.object_0) { if (blobFragmentContract_0.IsLast) { this.int_0 = blobFragmentContract_0.FragmentIndex; } this.safeDictionary_0.Add(blobFragmentContract_0.FragmentIndex, blobFragmentContract_0); return(this.GetInformation()); } }
public Information AddFragment(BlobFragmentContract fragment) { lock (this.locker) { if (fragment.IsLast) { this.lastFragmentIndex = fragment.FragmentIndex; } this.fragmentDictionary.Add(fragment.FragmentIndex, fragment); return this.ConstructBlob(); } }
public void BroadcastBlob(string groupID, int broadcastType, byte[] blobContent, string tag, int fragmentSize) { if (fragmentSize <= 0) { throw new ArgumentException("Value of fragmentSize must be greater than 0."); } BlobAndTagContract contract2 = new BlobAndTagContract(blobContent, tag); byte[] src = CompactPropertySerializer.Default.Serialize <BlobAndTagContract>(contract2); int num3 = Interlocked.Increment(ref this.int_0); int num2 = src.Length / fragmentSize; if ((src.Length % fragmentSize) > 0) { num2++; } for (int i = 0; i < num2; i++) { if (!this.interface31_0.Connected.Value) { throw new Exception("The connection to server is interrupted !"); } byte[] dst = null; if (i < (num2 - 1)) { dst = new byte[fragmentSize]; } else { dst = new byte[src.Length - (i * fragmentSize)]; } Buffer.BlockCopy(src, i * fragmentSize, dst, 0, dst.Length); BlobFragmentContract body = new BlobFragmentContract(num3, broadcastType, i, dst, i == (num2 - 1)); IMessageHandler interface2 = this.interface9_0.imethod_4 <BlobFragmentContract>(this.string_0, this.contactsMessageTypeRoom_0.BroadcastBlob, body, groupID); if (!this.interface31_0.imethod_0(interface2, false, ActionTypeOnChannelIsBusy.Continue)) { throw new Exception("The connection to server is interrupted !"); } } }
public IMessageHandler ProcessMessage(IMessageHandler interface37_0) { string str; UserContract contract2; if (interface37_0.Header.MessageType == this.object_0.ContactsConnectedNotify) { contract2 = this.interface9_0.imethod_1 <UserContract>(interface37_0); this.ContactsOutter_0.OnContactsConnected(contract2.UserID); return(null); } if (interface37_0.Header.MessageType == this.object_0.ContactsOfflineNotify) { contract2 = this.interface9_0.imethod_1 <UserContract>(interface37_0); this.ContactsOutter_0.OnContactsOffline(contract2.UserID); return(null); } if (interface37_0.Header.MessageType == this.object_0.BroadcastByServer) { BroadcastContract contract = this.interface9_0.imethod_1 <BroadcastContract>(interface37_0); str = (interface37_0.Header.UserID == "_0") ? null : interface37_0.Header.UserID; this.ContactsOutter_0.OnBroadcastReceived(str, contract.GroupID, contract.InformationType, contract.Content, contract.Tag); return(null); } if (interface37_0.Header.MessageType == this.object_0.BroadcastBlob) { str = NetServer.IsServerUser(interface37_0.Header.UserID) ? null : interface37_0.Header.UserID; string destUserID = interface37_0.Header.DestUserID; BlobFragmentContract contract4 = this.interface9_0.imethod_1 <BlobFragmentContract>(interface37_0); Information information = this.class76_0.method_1(interface37_0.Header.UserID, interface37_0.Header.DestUserID, contract4); if (information != null) { BlobAndTagContract contract3 = CompactPropertySerializer.Default.Deserialize <BlobAndTagContract>(information.Content, 0); this.ContactsOutter_0.OnBroadcastReceived(str, destUserID, information.InformationType, contract3.Message, contract3.Tag); } return(null); } return(null); }
public void HandleInformation(string sourceUserID, int informationType, byte[] information) { if (informationType == this.groupInfoTypes.SomeoneJoinGroupNotify) { GroupNotifyContract contract = CompactPropertySerializer.Default.Deserialize <GroupNotifyContract>(information, 0); this.groupOutter.SomeoneJoinGroupNotify(contract.GroupID, contract.MemberID); return; } if (informationType == this.groupInfoTypes.SomeoneQuitGroupNotify) { GroupNotifyContract contract = CompactPropertySerializer.Default.Deserialize <GroupNotifyContract>(information, 0); this.groupOutter.SomeoneQuitGroupNotify(contract.GroupID, contract.MemberID); return; } if (informationType == this.groupInfoTypes.GroupmateOfflineNotify) { UserContract contract = CompactPropertySerializer.Default.Deserialize <UserContract>(information, 0); this.groupOutter.GroupmateOfflineNotify(contract.UserID); return; } if (informationType == this.groupInfoTypes.Broadcast || informationType == this.groupInfoTypes.BroadcastByServer) { BroadcastContract contract = CompactPropertySerializer.Default.Deserialize <BroadcastContract>(information, 0); string broadcasterID = contract.BroadcasterID == NetServer.SystemUserID ? null : contract.BroadcasterID; this.groupOutter.OnBroadcast(broadcasterID, contract.GroupID, contract.InformationType, contract.Content); return; } if (informationType == this.groupInfoTypes.BroadcastBlob || informationType == this.groupInfoTypes.BroadcastBlobByServer) { BlobFragmentContract contract = CompactPropertySerializer.Default.Deserialize <BlobFragmentContract>(information, 0); Information info = this.blobReceiver.Receive(contract.SourceUserID, contract.DestUserID, contract); if (info != null) { string broadcasterID = contract.SourceUserID == NetServer.SystemUserID ? null : contract.SourceUserID; this.groupOutter.OnBroadcastBlob(broadcasterID, info.DestID, info.InformationType, info.Content); } } }
public IMessageHandler ProcessMessage(IMessageHandler interface37_0) { string str; UserContract contract3; if (interface37_0.Header.MessageType == this.object_0.GroupmateConnectedNotify) { contract3 = this.interface9_0.imethod_1 <UserContract>(interface37_0); this.class19_0.GroupmateConnectedNotify(contract3.UserID); return(null); } if (interface37_0.Header.MessageType == this.object_0.GroupmateOfflineNotify) { contract3 = this.interface9_0.imethod_1 <UserContract>(interface37_0); this.class19_0.GroupmateOfflineNotify(contract3.UserID); return(null); } if (interface37_0.Header.MessageType == this.object_0.BroadcastByServer) { BroadcastContract contract2 = this.interface9_0.imethod_1 <BroadcastContract>(interface37_0); str = (interface37_0.Header.UserID == "_0") ? null : interface37_0.Header.UserID; this.class19_0.method_6(str, contract2.GroupID, contract2.InformationType, contract2.Content); return(null); } if (interface37_0.Header.MessageType == this.object_0.BroadcastBlob) { str = NetServer.IsServerUser(interface37_0.Header.UserID) ? null : interface37_0.Header.UserID; string destUserID = interface37_0.Header.DestUserID; BlobFragmentContract contract = this.interface9_0.imethod_1 <BlobFragmentContract>(interface37_0); Information information = this.class76_0.method_1(interface37_0.Header.UserID, interface37_0.Header.DestUserID, contract); if (information != null) { this.class19_0.method_6(str, destUserID, information.InformationType, information.Content); } return(null); } return(null); }
public void BroadcastBlob(string groupID, int broadcastType, byte[] blobContent, string tag, int fragmentSize) { if (fragmentSize <= 0) { throw new ArgumentException("Value of fragmentSize must be greater than 0."); } List <string> groupMemberList = this.icontactsManager_0.GetGroupMemberList(groupID); if ((groupMemberList != null) && (groupMemberList.Count != 0)) { BlobAndTagContract contract = new BlobAndTagContract(blobContent, tag); byte[] src = CompactPropertySerializer.Default.Serialize <BlobAndTagContract>(contract); int num2 = Interlocked.Increment(ref this.int_0); int num3 = src.Length / fragmentSize; if ((src.Length % fragmentSize) > 0) { num3++; } for (int i = 0; i < num3; i++) { byte[] dst = null; if (i < (num3 - 1)) { dst = new byte[fragmentSize]; } else { dst = new byte[src.Length - (i * fragmentSize)]; } Buffer.BlockCopy(src, i * fragmentSize, dst, 0, dst.Length); BlobFragmentContract body = new BlobFragmentContract(num2, broadcastType, i, dst, i == (num3 - 1)); IMessageHandler interface2 = this.interface9_0.imethod_4 <BlobFragmentContract>("_0", this.object_0.BroadcastBlob, body, groupID); this.interface40_0.PostMessage(interface2, groupMemberList, ActionTypeOnChannelIsBusy.Continue); } } }
public Information Receive(string sourceID, string destID ,BlobFragmentContract fragment) { if (fragment.BlobID == 1 && fragment.FragmentIndex == 0 ) //可能是掉线重新登录过 { this.OnUserOffline(sourceID); } if (fragment.FragmentIndex == 0 && fragment.IsLast) { return new Information(sourceID, destID, fragment.InformationType, fragment.Fragment); } string id = this.ConstructID(sourceID, fragment.BlobID); Blob blob = this.blobManager.Get(id); if (blob == null) { blob = new Blob(fragment.BlobID, sourceID, destID, fragment.InformationType); this.blobManager.Add(id, blob); } Information info = blob.AddFragment(fragment); if (info != null) { this.blobManager.Remove(id); } return info; }
public void BroadcastBlob(string groupID, int broadcastType, byte[] blobInfo, int fragmentSize, BroadcastChannelMode broadcastChannelMode) { if (blobInfo == null || blobInfo.Length == 0) { return; } if (fragmentSize == 0) { throw new ArgumentException("Value of fragmentSize must be greater than 0."); } if (blobInfo.Length <= fragmentSize) { this.Broadcast(groupID, broadcastType, blobInfo, ActionTypeOnChannelIsBusy.Continue, broadcastChannelMode); return; } int messageType = broadcastChannelMode == BroadcastChannelMode.AllTransferByServer ? this.groupInfoTypes.BroadcastBlobByServer : this.groupInfoTypes.BroadcastBlob; int blobID = System.Threading.Interlocked.Increment(ref this.maxBlobID); int count = blobInfo.Length / fragmentSize; if (blobInfo.Length % fragmentSize > 0) { count += 1; } if (broadcastChannelMode == BroadcastChannelMode.AllTransferByServer) { #region AllTransferByServer for (int i = 0; i < count; i++) { byte[] fragment = null; if (i < count - 1) { fragment = new byte[fragmentSize]; } else { fragment = new byte[blobInfo.Length - i * fragmentSize]; } Buffer.BlockCopy(blobInfo, i * fragmentSize, fragment, 0, fragment.Length); BlobFragmentContract contract = new BlobFragmentContract(this.currentUserID, blobID, broadcastType, i, fragment, i == count - 1, groupID); byte[] info = CompactPropertySerializer.Default.Serialize(contract); this.rapidPassiveEngine.CustomizeOutter.Send(null, messageType, info, true, ActionTypeOnChannelIsBusy.Continue); } #endregion } else if (broadcastChannelMode == BroadcastChannelMode.P2PChannelFirst) { #region P2PChannelFirst SortedArray <string> passiveGroupmates = this.SafeGetGroupMembers(groupID); if (passiveGroupmates == null) { return; } for (int i = 0; i < count; i++) { bool allP2P = true; byte[] fragment = null; if (i < count - 1) { fragment = new byte[fragmentSize]; } else { fragment = new byte[blobInfo.Length - i * fragmentSize]; } Buffer.BlockCopy(blobInfo, i * fragmentSize, fragment, 0, fragment.Length); BlobFragmentContract contract = new BlobFragmentContract(this.currentUserID, blobID, broadcastType, i, fragment, i == count - 1, groupID); byte[] info = CompactPropertySerializer.Default.Serialize(contract); foreach (string memberID in passiveGroupmates.GetAll()) { if (memberID == this.currentUserID) { continue; } if (this.rapidPassiveEngine.P2PController.IsP2PChannelExist(memberID)) { this.rapidPassiveEngine.CustomizeOutter.SendByP2PChannel(memberID, messageType, info, ActionTypeOnNoP2PChannel.Discard, true, ActionTypeOnChannelIsBusy.Continue); } else { allP2P = false; } } if (!allP2P) //如果有一个在线用户没有P2P,则经过服务器中转。 { this.rapidPassiveEngine.CustomizeOutter.Send(null, messageType, info, true, ActionTypeOnChannelIsBusy.Continue); } } #endregion } else //AllByP2PChannel { #region AllByP2PChannel SortedArray <string> passiveGroupmates = this.SafeGetGroupMembers(groupID); if (passiveGroupmates == null) { return; } for (int i = 0; i < count; i++) { byte[] fragment = null; if (i < count - 1) { fragment = new byte[fragmentSize]; } else { fragment = new byte[blobInfo.Length - i * fragmentSize]; } Buffer.BlockCopy(blobInfo, i * fragmentSize, fragment, 0, fragment.Length); BlobFragmentContract contract = new BlobFragmentContract(this.currentUserID, blobID, broadcastType, i, fragment, i == count - 1, groupID); byte[] info = CompactPropertySerializer.Default.Serialize(contract); foreach (string memberID in passiveGroupmates.GetAll()) { if (memberID == this.currentUserID) { continue; } if (this.rapidPassiveEngine.P2PController.IsP2PChannelExist(memberID)) { this.rapidPassiveEngine.CustomizeOutter.SendByP2PChannel(memberID, messageType, info, ActionTypeOnNoP2PChannel.Discard, true, ActionTypeOnChannelIsBusy.Continue); } } } #endregion } }
public IMessageHandler ProcessMessage(IMessageHandler interface37_0) { string str; IHeader interface3; IMessageHandler interface4; BinaryInformationContract contract3; if ((interface37_0.Header.MessageType == this.object_0.InformationBySend) || (interface37_0.Header.MessageType == this.object_0.InformationByPost)) { contract3 = this.interface9_0.imethod_1 <BinaryInformationContract>(interface37_0); str = NetServer.IsServerUser(interface37_0.Header.UserID) ? null : interface37_0.Header.UserID; this.icustomizeHandler_0.HandleInformation(str, contract3.InformationType, contract3.Content); return(null); } if ((interface37_0.Header.MessageType == this.object_0.BlobInformation) || (interface37_0.Header.MessageType == this.object_0.BlobByRapidEngine)) { BlobFragmentContract contract2 = this.interface9_0.imethod_1 <BlobFragmentContract>(interface37_0); Information information = this.class76_0.method_1(interface37_0.Header.UserID, interface37_0.Header.DestUserID, contract2); if (information != null) { str = NetServer.IsServerUser(interface37_0.Header.UserID) ? null : interface37_0.Header.UserID; if (interface37_0.Header.MessageType == this.object_0.BlobInformation) { this.icustomizeHandler_0.HandleInformation(str, information.InformationType, information.Content); } else if (this.Event_0 != null) { BlobAndTagContract contract = CompactPropertySerializer.Default.Deserialize <BlobAndTagContract>(information.Content, 0); this.Event_0(str, information.InformationType, contract.Message, contract.Tag); } } return(null); } if (interface37_0.Header.MessageType == this.object_0.InformationNeedAck) { interface3 = this.interface9_0.imethod_7(interface37_0.Header); interface3.MessageType = this.object_0.Ack; interface4 = this.interface9_0.imethod_2 <Class110>(interface3, null); this.interface31_0.Send(interface4, false, ActionTypeOnChannelIsBusy.Continue); contract3 = this.interface9_0.imethod_1 <BinaryInformationContract>(interface37_0); str = NetServer.IsServerUser(interface37_0.Header.UserID) ? null : interface37_0.Header.UserID; this.icustomizeHandler_0.HandleInformation(str, contract3.InformationType, contract3.Content); return(null); } if (interface37_0.Header.MessageType == this.object_0.Request) { interface3 = this.interface9_0.imethod_7(interface37_0.Header); interface3.MessageType = this.object_0.Response; contract3 = this.interface9_0.imethod_1 <BinaryInformationContract>(interface37_0); BinaryInformationContract body = null; try { str = NetServer.IsServerUser(interface37_0.Header.UserID) ? null : interface37_0.Header.UserID; body = new BinaryInformationContract(this.icustomizeHandler_0.HandleQuery(str, contract3.InformationType, contract3.Content)); } finally { interface4 = this.interface9_0.imethod_2 <BinaryInformationContract>(interface3, body); this.interface31_0.Send(interface4, true, ActionTypeOnChannelIsBusy.Continue); } return(null); } if (interface37_0.Header.MessageType == this.object_0.GetClientTimeRequest) { interface3 = this.interface9_0.imethod_7(interface37_0.Header); interface3.MessageType = this.object_0.GetClientTimeResponse; ResGetTimeContract contract4 = new ResGetTimeContract(DateTime.Now); return(this.interface9_0.imethod_2 <ResGetTimeContract>(interface3, contract4)); } return(null); }
public IMessageHandler ProcessMessage(IMessageHandler interface37_0) { string destUserID; List <string> groupMemberList; IHeader interface3; if (interface37_0.Header.MessageType == this.object_0.GetContracts) { ReqContactsContract contract4 = this.interface9_0.imethod_1 <ReqContactsContract>(interface37_0); List <string> users = new List <string>(); if (this.icontactsManager_0 != null) { users = this.icontactsManager_0.GetContacts(interface37_0.Header.UserID); if (contract4.JustOnline) { users = this.ginterface8_0.SelectOnlineUserFrom(users); } } ResContactsContract body = new ResContactsContract(users); interface3 = this.interface9_0.imethod_7(interface37_0.Header); return(this.interface9_0.imethod_2 <ResContactsContract>(interface3, body)); } if (interface37_0.Header.MessageType == this.object_0.GetGroupMembers) { GroupContract contract7 = this.interface9_0.imethod_1 <GroupContract>(interface37_0); groupMemberList = this.icontactsManager_0.GetGroupMemberList(contract7.GroupID); GroupmatesContract contract = null; if (groupMemberList != null) { List <string> online = new List <string>(); List <string> offline = new List <string>(); foreach (string str2 in groupMemberList) { if (this.iuserManager_0.IsUserOnLine(str2)) { online.Add(str2); } else { offline.Add(str2); } } contract = new GroupmatesContract(online, offline); } interface3 = this.interface9_0.imethod_7(interface37_0.Header); return(this.interface9_0.imethod_2 <GroupmatesContract>(interface3, contract)); } if (interface37_0.Header.MessageType == this.object_0.BroadcastByServer) { bool flag1 = interface37_0.Header.MessageType == this.object_0.BroadcastByServer; destUserID = interface37_0.Header.DestUserID; BroadcastContract contract2 = this.interface9_0.imethod_1 <BroadcastContract>(interface37_0); if (this.BroadcastReceived != null) { this.BroadcastReceived(interface37_0.Header.UserID, destUserID, contract2.InformationType, contract2.Content, contract2.Tag); } groupMemberList = this.icontactsManager_0.GetGroupMemberList(destUserID); if (groupMemberList != null) { BroadcastInformation information = new BroadcastInformation(interface37_0.Header.UserID, destUserID, contract2.InformationType, contract2.Content, contract2.Tag); foreach (string str3 in groupMemberList) { if (str3 != interface37_0.Header.UserID) { if (this.ginterface8_0.IsUserOnLine(str3)) { this.interface40_0.PostMessage(interface37_0, str3, contract2.ActionTypeOnChannelIsBusy); } else if (this.BroadcastFailed != null) { this.BroadcastFailed(str3, information); } } } } return(null); } if (interface37_0.Header.MessageType == this.object_0.BroadcastBlob) { destUserID = interface37_0.Header.DestUserID; if (this.bool_4 && (this.BroadcastReceived != null)) { BlobFragmentContract contract5 = this.interface9_0.imethod_1 <BlobFragmentContract>(interface37_0); Information information2 = this.class76_0.method_1(interface37_0.Header.UserID, destUserID, contract5); if (information2 != null) { BlobAndTagContract contract6 = CompactPropertySerializer.Default.Deserialize <BlobAndTagContract>(information2.Content, 0); this.BroadcastReceived(interface37_0.Header.UserID, destUserID, contract5.InformationType, contract6.Message, contract6.Tag); } } groupMemberList = this.icontactsManager_0.GetGroupMemberList(destUserID); if (groupMemberList != null) { foreach (string str3 in groupMemberList) { if (str3 != interface37_0.Header.UserID) { this.interface40_0.PostMessage(interface37_0, str3, ActionTypeOnChannelIsBusy.Continue); } } } return(null); } return(null); }
public void HandleInformation(string sourceUserID, int informationType, byte[] information) { if (informationType == this.groupInfoTypes.P2PChannelOpen) { P2PChannelReportContract contract = CompactPropertySerializer.Default.Deserialize <P2PChannelReportContract>(information, 0); this.p2PChannelManager.Register(sourceUserID, contract.DestUserID); return; } if (informationType == this.groupInfoTypes.P2PChannelClose) { P2PChannelReportContract contract = CompactPropertySerializer.Default.Deserialize <P2PChannelReportContract>(information, 0); this.p2PChannelManager.Unregister(sourceUserID, contract.DestUserID); return; } if (informationType == this.groupInfoTypes.Join) { GroupContract contract = CompactPropertySerializer.Default.Deserialize <GroupContract>(information, 0); this.dynamicGroupManager.JoinGroup(contract.GroupID, sourceUserID); return; } if (informationType == this.groupInfoTypes.DestroyGroup) { GroupContract contract = CompactPropertySerializer.Default.Deserialize <GroupContract>(information, 0); this.dynamicGroupManager.DestroyGroup(sourceUserID, contract.GroupID); return; } if (informationType == this.groupInfoTypes.QuitGroup) { GroupContract contract = CompactPropertySerializer.Default.Deserialize <GroupContract>(information, 0); this.dynamicGroupManager.QuitGroup(contract.GroupID, sourceUserID); return; } if (informationType == this.groupInfoTypes.Fire) { RecruitOrFireContract contract = CompactPropertySerializer.Default.Deserialize <RecruitOrFireContract>(information, 0); this.dynamicGroupManager.QuitGroup(contract.GroupID, contract.MemberID); return; } if (informationType == this.groupInfoTypes.Broadcast || informationType == this.groupInfoTypes.BroadcastByServer) { bool transfer = informationType == this.groupInfoTypes.BroadcastByServer; BroadcastContract contract = CompactPropertySerializer.Default.Deserialize <BroadcastContract>(information, 0); string groupID = contract.GroupID; if (this.BroadcastReceived != null) { this.BroadcastReceived(sourceUserID, groupID, contract.InformationType, contract.Content); } List <string> members = this.dynamicGroupManager.GetGroupMembers(groupID); if (members != null) { foreach (string memberID in members) { bool useP2PChannel = transfer ? false : this.p2PChannelManager.IsP2PChannelExist(sourceUserID, memberID); if (memberID != sourceUserID && !useP2PChannel) { this.customizeController.Send(memberID, informationType, information, true, contract.ActionTypeOnChannelIsBusy); } } } return; } if (informationType == this.groupInfoTypes.BroadcastBlob || informationType == this.groupInfoTypes.BroadcastBlobByServer) { BlobFragmentContract contract = CompactPropertySerializer.Default.Deserialize <BlobFragmentContract>(information, 0); if (this.BroadcastReceived != null) { Information info = this.blobReceiver.Receive(sourceUserID, contract.DestUserID, contract); if (info != null) { this.BroadcastReceived(sourceUserID, contract.DestUserID, info.InformationType, info.Content); } } bool transfer = informationType == this.groupInfoTypes.BroadcastBlobByServer; List <string> members = this.dynamicGroupManager.GetGroupMembers(contract.DestUserID); if (members != null) { foreach (string memberID in members) { bool useP2PChannel = transfer ? false : this.p2PChannelManager.IsP2PChannelExist(sourceUserID, memberID); if (memberID != sourceUserID && !useP2PChannel) { this.customizeController.Send(memberID, informationType, information, true, ActionTypeOnChannelIsBusy.Continue); } } } return; } }
public IMessageHandler ProcessMessage(IMessageHandler interface37_0) { List <string> groupMembers; string destUserID; if (interface37_0.Header.MessageType == this.object_0.GetGroupMembers) { GroupContract contract4 = this.interface9_0.imethod_1 <GroupContract>(interface37_0); groupMembers = this.igroupManager_0.GetGroupMembers(contract4.GroupID); GroupmatesContract body = null; if (groupMembers != null) { List <string> online = new List <string>(); List <string> offline = new List <string>(); foreach (string str in groupMembers) { if (this.iuserManager_0.IsUserOnLine(str)) { online.Add(str); } else { offline.Add(str); } } body = new GroupmatesContract(online, offline); } IHeader interface3 = this.interface9_0.imethod_7(interface37_0.Header); return(this.interface9_0.imethod_2 <GroupmatesContract>(interface3, body)); } if (interface37_0.Header.MessageType == this.object_0.BroadcastByServer) { bool flag1 = interface37_0.Header.MessageType == this.object_0.BroadcastByServer; destUserID = interface37_0.Header.DestUserID; BroadcastContract contract2 = this.interface9_0.imethod_1 <BroadcastContract>(interface37_0); if (this.BroadcastReceived != null) { this.BroadcastReceived(interface37_0.Header.UserID, destUserID, contract2.InformationType, contract2.Content); } groupMembers = this.igroupManager_0.GetGroupMembers(destUserID); if (groupMembers != null) { foreach (string str2 in groupMembers) { if (str2 != interface37_0.Header.UserID) { this.interface40_0.PostMessage(interface37_0, str2, contract2.ActionTypeOnChannelIsBusy); } } } return(null); } if (interface37_0.Header.MessageType == this.object_0.BroadcastBlob) { destUserID = interface37_0.Header.DestUserID; if (this.bool_4 && (this.BroadcastReceived != null)) { BlobFragmentContract contract3 = this.interface9_0.imethod_1 <BlobFragmentContract>(interface37_0); Information information = this.class76_0.method_1(interface37_0.Header.UserID, destUserID, contract3); if (information != null) { this.BroadcastReceived(interface37_0.Header.UserID, destUserID, contract3.InformationType, information.Content); } } groupMembers = this.igroupManager_0.GetGroupMembers(destUserID); if (groupMembers != null) { foreach (string str2 in groupMembers) { if (str2 != interface37_0.Header.UserID) { this.interface40_0.PostMessage(interface37_0, str2, ActionTypeOnChannelIsBusy.Continue); } } } return(null); } return(null); }