Beispiel #1
0
        public void Read(TProtocol iprot)
        {
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 10:
                    if (field.Type == TType.Map)
                    {
                        {
                            MapFileData = new Dictionary <int, EventControlData>();
                            TMap _map30 = iprot.ReadMapBegin();
                            for (int _i31 = 0; _i31 < _map30.Count; ++_i31)
                            {
                                int _key32;
                                EventControlData _val33;
                                _key32 = iprot.ReadI32();
                                _val33 = new EventControlData();
                                _val33.Read(iprot);
                                MapFileData[_key32] = _val33;
                            }
                            iprot.ReadMapEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 10:
         if (field.Type == TType.Map) {
           {
             MapFileData = new Dictionary<int, EventControlData>();
             TMap _map30 = iprot.ReadMapBegin();
             for( int _i31 = 0; _i31 < _map30.Count; ++_i31)
             {
               int _key32;
               EventControlData _val33;
               _key32 = iprot.ReadI32();
               _val33 = new EventControlData();
               _val33.Read(iprot);
               MapFileData[_key32] = _val33;
             }
             iprot.ReadMapEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
 public static void SaveEventControlDataMap(EventControlDataMap fileDataMap, int gameID, EventControlData fileData)
 {
     //Init Data Map
     if (fileDataMap == null || fileDataMap.MapFileData == null)
     {
         fileDataMap = new EventControlDataMap();
         fileDataMap.MapFileData = new Dictionary<int, EventControlData>();
     }
     //Init Data
     if (fileData == null || fileData.EventConfig == null)
     {
         fileData = new EventControlData();
         fileData.EventConfig = new Dictionary<string, EventConfig>();
     }
     //Save Data
     if (fileDataMap.MapFileData.ContainsKey(gameID))
     {
         fileDataMap.MapFileData[gameID] = fileData;
     }
     else
     {
         fileDataMap.MapFileData.Add(gameID, fileData);
     }
     //Save File
     byte[] data = ThriftSerialize.Serialize(fileDataMap);
     FileUtils.WriteByteFile(GetEventControDataPath(), data);
 }