コード例 #1
0
        /// <summary>
        /// Deserialize the specified serializedValue.
        /// </summary>
        /// <param name='_serializedValue'>
        /// Serialized value.
        /// </param>
        private void Deserialize(string _serializedValue)
        {
            Properties = new Dictionary <string, TGSerializedProperty>();

            string[] type = _serializedValue.Split("-".ToCharArray());

            if (type.Length == 2)
            {
                TGObjectType = type[0];

                string[] parts = type[1].Split("|".ToCharArray());

                foreach (string part in parts)
                {
                    TGSerializedProperty property = new TGSerializedProperty(part);

                    Properties.Add(property.PropertyName, property);
                }
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(TGObjectType + "-");

            foreach (KeyValuePair <string, TGSerializedProperty> kvp in Properties)
            {
                TGSerializedProperty property = kvp.Value;

                sb.Append(property);
                sb.Append("|");
            }

            if (Properties.Count > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }

            return(sb.ToString());
        }