Beispiel #1
0
        IResourceData ReadSerializedObject(uint endPos, UserResourceType type)
        {
            var serializedData = reader.ReadBytes((int)(endPos - reader.Position));
            var res            = createResourceDataDelegate?.Invoke(resourceDataFactory, type, serializedData);

            return(res ?? resourceDataFactory.CreateSerialized(serializedData, type));
        }
Beispiel #2
0
        /// <summary>
        /// Creates a user type. If the type already exists, the existing value is returned.
        /// </summary>
        /// <param name="fullName">Full name of type</param>
        /// <param name="useFullName">Use <paramref name="fullName"/> without converting it to a
        /// type in an existing assembly reference</param>
        /// <returns></returns>
        UserResourceType CreateUserResourceType(string fullName, bool useFullName)
        {
            if (dict.TryGetValue(fullName, out var type))
            {
                return(type);
            }

            var newFullName = useFullName ? fullName : GetRealTypeFullName(fullName);

            type              = new UserResourceType(newFullName, ResourceTypeCode.UserTypes + dict.Count);
            dict[fullName]    = type;
            dict[newFullName] = type;
            return(type);
        }
Beispiel #3
0
 /// <summary>
 /// Creates serialized data
 /// </summary>
 /// <param name="value">Serialized data</param>
 /// <param name="type">Type of serialized data</param>
 /// <returns></returns>
 public BinaryResourceData CreateSerialized(byte[] value, UserResourceType type) => new BinaryResourceData(CreateUserResourceType(type.Name, true), value);
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="type">User resource type</param>
 public UserResourceData(UserResourceType type) => this.type = type;