示例#1
0
        public void LoadFromData(string propertyName)
        {
            if (!Guid.TryParse(propertyName, out serializedId))
            {
                throw new Exception("Invalid ID, can't deserialize.");
            }

            string propertiesString = string.Empty;

            if (!Loader.GetUserPropString(propertyName, ref propertiesString))
            {
                return;
            }

            string[] properties = propertiesString.Split(s_PropertySeparator);

            if (properties.Length < 4)
            {
                throw new Exception("Invalid number of properties, can't deserialize.");
            }

            // set dirty explicitly just before we start loading, set to false when loading is done
            // if any exception is thrown, it will have a correct value
            IsDirty = true;

            name = properties[0];
            if (!int.TryParse(properties[1], out ticksStart))
            {
                throw new Exception("Failed to parse FrameStart property.");
            }
            if (!int.TryParse(properties[2], out ticksEnd))
            {
                throw new Exception("Failed to parse FrameEnd property.");
            }

            IsDirty = false;
        }