Пример #1
0
        private void DecompileDefaultProperties(TextBuilder result)
        {
            result.Append("defaultproperties\n{\n").PushIndent();
            var            defaultsExport = _defaults.Resolve();
            UnPropertyList propertyList   = Package.ReadPropertyList(defaultsExport, this);

            foreach (UnProperty prop in propertyList.Properties)
            {
                var name = prop.Name;
                if (name.StartsWith("__") && name.EndsWith("__Delegate"))
                {
                    name = name.Substring(2, name.Length - 2 - 10);
                }
                if (prop.Value is UnPropertyArray)
                {
                    var array = (UnPropertyArray)prop.Value;
                    for (int i = 0; i < array.Count; i++)
                    {
                        result.Indent().Append(name).Append("(").Append(i).Append(")=")
                        .Append(ValueToString(array [i], array.ElementType)).NewLine();
                    }
                }
                else
                {
                    result.Indent().Append(name).Append("=").Append(ValueToString(prop.Value, prop.Type)).NewLine();
                }
            }
            foreach (UnExport export in defaultsExport.Children)
            {
                result.Indent().Append("// child object " + export.ObjectName + " of type " + export.ClassName).NewLine();
            }
            result.Append("}").NewLine().PopIndent();
        }
Пример #2
0
        private string StructToString(UnPropertyList value)
        {
            if (value == null)
            {
                return("?");
            }
            var result = value.Properties.Aggregate("", (s, prop) => s + "," + prop.Name + "=" + ValueToString(prop.Value, prop.Type));

            return("(" + (result.Length > 0 ? result.Substring(1) : result) + ")");
        }