Example #1
0
 public void OnAfterDeserialize()
 {
     if (bytes != null)
     {
         logs = ProtoBufSerializer.DeserializeFromBytes <LogCollection>(bytes);
     }
 }
Example #2
0
        public void OnAfterDeserialize()
        {
            var container = ProtoBufSerializer.DeserializeFromBytes <PropertyDataContainer>(dataBytes);

            foreach (var property in GetType().GetProperties())
            {
                foreach (var attribute in property.GetCustomAttributes(true))
                {
                    if (attribute is Config)
                    {
                        switch (property.PropertyType.Name)
                        {
                        case "Int32":
                            if (container.intDict.ContainsKey(property.Name))
                            {
                                property.SetValue(this, container.intDict[property.Name], null);
                            }
                            break;

                        case "Single":
                            if (container.floatDict.ContainsKey(property.Name))
                            {
                                property.SetValue(this, container.floatDict[property.Name], null);
                            }
                            break;

                        case "String":
                            if (container.stringDict.ContainsKey(property.Name))
                            {
                                property.SetValue(this, container.stringDict[property.Name], null);
                            }
                            break;

                        case "Boolean":
                            if (container.boolDict.ContainsKey(property.Name))
                            {
                                property.SetValue(this, container.boolDict[property.Name], null);
                            }
                            break;
                        }
                    }
                }
            }
        }