Beispiel #1
0
 public void method_2()
 {
     for (int i = 0; i < (this.list_0.Count - 1); i++)
     {
         IMessageTypeRoom room  = this.list_0[i];
         KeyScope         scope = new KeyScope(room.StartKey, room.MaxKeyValue);
         for (int j = i + 1; j < this.list_0.Count; j++)
         {
             IMessageTypeRoom room2 = this.list_0[j];
             if (scope.Intersect(new KeyScope(room2.StartKey, room2.MaxKeyValue)))
             {
                 throw new Exception(string.Format("MessageType Conflicted between [{0}] and [{1}] !", room.GetType(), room2.GetType()));
             }
         }
     }
     foreach (IMessageTypeRoom room in this.list_0)
     {
         Type   t = room.GetType();
         string classSimpleName = TypeHelper.GetClassSimpleName(t);
         foreach (PropertyInfo info in t.GetProperties(BindingFlags.Public | BindingFlags.Instance))
         {
             if ((info.CanWrite && (info.PropertyType == typeof(int))) && (info.Name != "StartKey"))
             {
                 int    key  = (int)info.GetValue(room, null);
                 string str2 = string.Format("{0}.{1}", classSimpleName, info.Name);
                 lock (this.idictionary_0)
                 {
                     this.idictionary_0.Remove(key);
                     this.idictionary_0.Add(key, str2);
                 }
             }
         }
     }
     if (this.class141_0 != null)
     {
         foreach (IMessageTypeRoom room3 in this.list_0)
         {
             foreach (int num5 in room3.PushKeyList)
             {
                 this.class141_0.method_9(num5);
             }
         }
     }
 }
        /// <summary>
        /// Conflict 判断各个MessageType的ServiceKey设置是否发生冲突
        /// </summary>
        public bool Conflict()
        {
            if (this.messageTypeRoomList.Count < 2)
            {
                return(false);
            }

            for (int i = 0; i < this.messageTypeRoomList.Count - 1; i++)
            {
                IMessageTypeRoom outterMsgType = this.messageTypeRoomList[i];
                for (int j = i + 1; j < this.messageTypeRoomList.Count; j++)
                {
                    IMessageTypeRoom innerMsgType = this.messageTypeRoomList[j];
                    if (outterMsgType.KeyScope.Intersect(innerMsgType.KeyScope))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }