private void RecursiveTreeLoad(AssetTypeValueField atvf, PGProperty node, AssetFileInfoEx info, string category, int depth)
        {
            if (atvf.childrenCount == 0)
            {
                return;
            }
            foreach (AssetTypeValueField atvfc in atvf.pChildren)
            {
                if (atvfc == null)
                {
                    return;
                }
                object         value = "";
                EnumValueTypes evt;
                if (atvfc.GetValue() != null)
                {
                    evt = atvfc.GetValue().GetValueType();
                    if (evt != EnumValueTypes.ValueType_None)
                    {
                        if (1 <= (int)evt && (int)evt <= 12)
                        {
                            value = atvfc.GetValue().AsString();

                            PGProperty prop = new PGProperty(atvfc.GetName(), value);
                            prop.category = category;
                            SetSelectedStateIfSelected(info, prop);
                            node.Add(prop);
                            RecursiveTreeLoad(atvfc, prop, info, category, depth + 1);
                        }
                        else if (evt == EnumValueTypes.ValueType_Array ||
                                 evt == EnumValueTypes.ValueType_ByteArray)
                        {
                            PGProperty childProps = new PGProperty("child", null, $"[size: {atvfc.childrenCount}]");
                            PGProperty prop       = new PGProperty(atvfc.GetName(), childProps, $"[size: {atvfc.childrenCount}]");
                            prop.category = category;
                            SetSelectedStateIfSelected(info, prop);
                            node.Add(prop);
                            RecursiveTreeLoad(atvfc, childProps, info, category, depth + 1);
                        }
                    }
                }
                else
                {
                    PGProperty childProps = new PGProperty("child");
                    PGProperty prop       = new PGProperty(atvfc.GetName(), childProps);
                    prop.category = category;
                    SetSelectedStateIfSelected(info, prop);
                    node.Add(prop);
                    RecursiveTreeLoad(atvfc, childProps, info, category, depth + 1);
                }
            }
        }
        private void PopulateDataGrid(AssetTypeValueField atvf, PGProperty node, AssetFileInfoEx info, string category, bool arrayChildren = false)
        {
            if (atvf.childrenCount == 0)
            {
                return;
            }

            string arraySingular = string.Empty;

            if (arrayChildren && atvf.childrenCount > 0)
            {
                arraySingular = plurServ.Singularize(atvf.children[0].templateField.name);
            }

            for (int i = 0; i < atvf.childrenCount; i++)
            {
                AssetTypeValueField atvfc = atvf.children[i];
                if (atvfc == null)
                {
                    return;
                }

                string key;
                if (!arrayChildren)
                {
                    key = atvfc.GetName();
                }
                else
                {
                    key = $"{arraySingular}[{i}]";
                }

                EnumValueTypes evt;
                if (atvfc.GetValue() != null)
                {
                    evt = atvfc.GetValue().GetValueType();
                    if (evt != EnumValueTypes.None)
                    {
                        if (1 <= (int)evt && (int)evt <= 12)
                        {
                            string     value = atvfc.GetValue().AsString();
                            PGProperty prop  = new PGProperty(key, value);
                            prop.category = category;
                            SetSelectedStateIfSelected(info, prop);
                            node.Add(prop);
                            PopulateDataGrid(atvfc, prop, info, category);
                        }
                        else if (evt == EnumValueTypes.Array ||
                                 evt == EnumValueTypes.ByteArray)
                        {
                            PGProperty childProps = new PGProperty("child", null, $"[size: {atvfc.childrenCount}]");
                            PGProperty prop       = new PGProperty(key, childProps, $"[size: {atvfc.childrenCount}]");
                            prop.category = category;
                            SetSelectedStateIfSelected(info, prop);
                            node.Add(prop);
                            PopulateDataGrid(atvfc, childProps, info, category, true);
                        }
                    }
                }
                else
                {
                    PGProperty childProps;
                    if (atvfc.childrenCount == 2)
                    {
                        AssetTypeValueField fileId = atvfc.children[0];
                        AssetTypeValueField pathId = atvfc.children[1];
                        string fileIdName          = fileId.templateField.name;
                        string fileIdType          = fileId.templateField.type;
                        string pathIdName          = pathId.templateField.name;
                        string pathIdType          = pathId.templateField.type;
                        if (fileIdName == "m_FileID" && fileIdType == "int" &&
                            pathIdName == "m_PathID" && pathIdType == "SInt64")
                        {
                            int  fileIdValue = fileId.GetValue().AsInt();
                            long pathIdValue = pathId.GetValue().AsInt64();
                            childProps = new PGProperty("child", "", $"[fileid: {fileIdValue}, pathid: {pathIdValue}]");
                        }
                        else
                        {
                            childProps = new PGProperty("child", "");
                        }
                    }
                    else
                    {
                        childProps = new PGProperty("child", "");
                    }
                    PGProperty prop = new PGProperty(key, childProps);
                    prop.category = category;
                    SetSelectedStateIfSelected(info, prop);
                    node.Add(prop);
                    PopulateDataGrid(atvfc, childProps, info, category);
                }
            }
        }
 private void RecursiveTreeLoad(AssetTypeValueField atvf, PGProperty node, AssetFileInfoEx info, string category, int depth)
 {
     if (atvf.childrenCount == 0)
     {
         return;
     }
     foreach (AssetTypeValueField atvfc in atvf.children)
     {
         if (atvfc == null)
         {
             return;
         }
         EnumValueTypes evt;
         if (atvfc.GetValue() != null)
         {
             evt = atvfc.GetValue().GetValueType();
             if (evt != EnumValueTypes.ValueType_None)
             {
                 if (1 <= (int)evt && (int)evt <= 12)
                 {
                     string     value = atvfc.GetValue().AsString();
                     PGProperty prop  = new PGProperty(atvfc.GetName(), value);
                     prop.category = category;
                     SetSelectedStateIfSelected(info, prop);
                     node.Add(prop);
                     RecursiveTreeLoad(atvfc, prop, info, category, depth + 1);
                 }
                 else if (evt == EnumValueTypes.ValueType_Array ||
                          evt == EnumValueTypes.ValueType_ByteArray)
                 {
                     PGProperty childProps = new PGProperty("child", null, $"[size: {atvfc.childrenCount}]");
                     PGProperty prop       = new PGProperty(atvfc.GetName(), childProps, $"[size: {atvfc.childrenCount}]");
                     prop.category = category;
                     SetSelectedStateIfSelected(info, prop);
                     node.Add(prop);
                     RecursiveTreeLoad(atvfc, childProps, info, category, depth + 1);
                 }
             }
         }
         else
         {
             PGProperty childProps;
             if (atvfc.childrenCount == 2)
             {
                 AssetTypeValueField fileId = atvfc.children[0];
                 AssetTypeValueField pathId = atvfc.children[1];
                 string fileIdName          = fileId.templateField.name;
                 string fileIdType          = fileId.templateField.type;
                 string pathIdName          = pathId.templateField.name;
                 string pathIdType          = pathId.templateField.type;
                 if (fileIdName == "m_FileID" && fileIdType == "int" &&
                     pathIdName == "m_PathID" && pathIdType == "SInt64")
                 {
                     int  fileIdValue = fileId.GetValue().AsInt();
                     long pathIdValue = pathId.GetValue().AsInt64();
                     childProps = new PGProperty("child", "", $"[fileid: {fileIdValue}, pathid: {pathIdValue}]");
                 }
                 else
                 {
                     childProps = new PGProperty("child", "");
                 }
             }
             else
             {
                 childProps = new PGProperty("child", "");
             }
             PGProperty prop = new PGProperty(atvfc.GetName(), childProps);
             prop.category = category;
             SetSelectedStateIfSelected(info, prop);
             node.Add(prop);
             RecursiveTreeLoad(atvfc, childProps, info, category, depth + 1);
         }
     }
 }