Exemplo n.º 1
0
        private void SetSelectedFieldModified()
        {
            AssetInfoDataGridItem gridItem = GetGridItem();

            gridItem.Modified = "*";
            //because avalonia won't let us update manually .-.
            dataGridItems.Add(new AssetInfoDataGridItem());
            dataGridItems.RemoveAt(dataGridItems.Count - 1);
        }
Exemplo n.º 2
0
        private AssetTypeValueField GetSelectedFieldReplaced()
        {
            AssetInfoDataGridItem gridItem = GetGridItem();
            long id = gridItem.PathID;

            if (newAssetDatas.ContainsKey(id))
            {
                return(am.GetExtAssetNewData(assetsFile, gridItem.FileID, gridItem.PathID, newAssetDatas[id]).instance.GetBaseField());
            }
            else
            {
                return(am.GetExtAsset(assetsFile, gridItem.FileID, gridItem.PathID).instance.GetBaseField());
            }
        }
Exemplo n.º 3
0
        private async void BtnViewData_Click(object?sender, Avalonia.Interactivity.RoutedEventArgs e)
        {
            if (await FailIfNothingSelected())
            {
                return;
            }

            AssetInfoDataGridItem gridItem = GetGridItem();

            if (gridItem.Size > 500000)
            {
                var bigFileBox = MessageBoxManager
                                 .GetMessageBoxCustomWindow(new MessageBoxCustomParams
                {
                    Style             = Style.Windows,
                    ContentHeader     = "Warning",
                    ContentMessage    = "The asset you are about to open is very big and may take a lot of time and memory.",
                    ButtonDefinitions = new[] {
                        new ButtonDefinition {
                            Name = "Continue anyway", Type = ButtonType.Colored
                        },
                        new ButtonDefinition {
                            Name = "Cancel", Type = ButtonType.Default
                        }
                    }
                });
                string result = await bigFileBox.Show();

                if (result == "Cancel")
                {
                    return;
                }
            }

            AssetTypeValueField field = GetSelectedFieldReplaced();
            DataWindow          data  = new DataWindow(field);

            data.Show();
        }
Exemplo n.º 4
0
        private AssetTypeValueField GetSelectedField()
        {
            AssetInfoDataGridItem gridItem = GetGridItem();

            return(am.GetExtAsset(assetsFile, gridItem.FileID, gridItem.PathID).instance.GetBaseField());
        }
Exemplo n.º 5
0
        private AssetFileInfoEx GetSelectedInfo()
        {
            AssetInfoDataGridItem gridItem = GetGridItem();

            return(am.GetExtAsset(assetsFile, gridItem.FileID, gridItem.PathID).info);
        }
Exemplo n.º 6
0
        private ObservableCollection <AssetInfoDataGridItem> MakeDataGridItems()
        {
            dataGridItems = new ObservableCollection <AssetInfoDataGridItem>();

            bool usingTypeTree = assetsFile.file.typeTree.hasTypeTree;

            foreach (AssetFileInfoEx info in assetsFile.table.assetFileInfo)
            {
                string name;
                string container;
                string type;
                int    fileId;
                long   pathId;
                int    size;
                string modified;

                ClassDatabaseType cldbType = AssetHelper.FindAssetClassByID(am.classFile, info.curFileType);
                name      = AssetHelper.GetAssetNameFast(assetsFile.file, am.classFile, info); //handles both cldb and typetree
                container = string.Empty;
                fileId    = 0;
                pathId    = info.index;
                size      = (int)info.curFileSize;
                modified  = "";

                if (usingTypeTree)
                {
                    Type_0D ttType = assetsFile.file.typeTree.unity5Types[info.curFileTypeOrIndex];
                    if (ttType.typeFieldsEx.Length != 0)
                    {
                        type = ttType.typeFieldsEx[0].GetTypeString(ttType.stringTable);
                    }
                    else
                    {
                        if (cldbType != null)
                        {
                            type = cldbType.name.GetString(am.classFile);
                        }
                        else
                        {
                            type = $"0x{info.curFileType:X8}";
                        }
                    }
                }
                else
                {
                    if (cldbType != null)
                    {
                        type = cldbType.name.GetString(am.classFile);
                    }
                    else
                    {
                        type = $"0x{info.curFileType:X8}";
                    }
                }

                if (info.curFileType == 0x01)
                {
                    name = $"GameObject {name}";
                }
                if (name == string.Empty)
                {
                    name = "Unnamed asset";
                }

                var item = new AssetInfoDataGridItem()
                {
                    Name      = name,
                    Container = container,
                    Type      = type,
                    TypeID    = info.curFileType,
                    FileID    = fileId,
                    PathID    = pathId,
                    Size      = size,
                    Modified  = modified
                };

                dataGridItems.Add(item);
            }
            return(dataGridItems);
        }