/// <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>
        private UserResourceType CreateUserResourceType(string fullName, bool useFullName)
        {
            UserResourceType type;

            if (dict.TryGetValue(fullName, out 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);
        }
Example #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="type">User resource type</param>
 /// <param name="data">Raw serialized data</param>
 public BinaryResourceData(UserResourceType type, byte[] data)
     : base(type)
 {
     this.data = data;
 }
 /// <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)
 {
     return(new BinaryResourceData(CreateUserResourceType(type.Name, true), value));
 }
Example #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="type">User resource type</param>
 public UserResourceData(UserResourceType type)
 {
     this.type = type;
 }