コード例 #1
0
        private void LoadComponentData(PGProperty root, AssetTypeValueField baseField, AssetFileInfoEx info, int index, int size)
        {
            string className = AssetHelper.FindAssetClassByID(helper.classFile, info.curFileType)
                               .name.GetString(helper.classFile);
            AssetTypeValueField targetBaseField = baseField;

            if (className == "MonoBehaviour")
            {
                if (AssetUtils.AllDependenciesLoaded(helper, inst))
                {
                    className += $" ({GetClassName(helper, inst, targetBaseField)})";
                    string managedPath = Path.Combine(Path.GetDirectoryName(inst.path), "Managed");
                    if (Directory.Exists(managedPath))
                    {
                        targetBaseField = helper.GetMonoBaseFieldCached(inst, info, managedPath);
                    }
                }
                else if (!firstTimeMBMessage)
                {
                    firstTimeMBMessage = true;
                    MessageBox.Show("Can't display MonoBehaviour data until dependencies are loaded", "Assets View");
                }
            }
            string category = new string('\t', size - index) + className;

            PopulateDataGrid(targetBaseField, root, info, category);
        }
コード例 #2
0
 private void updateDependenciesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (currentFile == null)
     {
         MessageBox.Show("No current file selected!", "Assets View");
         return;
     }
     if (!AssetUtils.AllDependenciesLoaded(helper, currentFile))
     {
         DialogResult res = MessageBox.Show(
             "Load all referenced dependencies?",
             "Assets View",
             MessageBoxButtons.YesNo);
         if (res == DialogResult.No)
         {
             return;
         }
         helper.LoadAssetsFile(currentFile.stream, currentFile.path, true);
         UpdateDependencies();
     }
     else
     {
         MessageBox.Show(
             "All dependencies already loaded.",
             "Assets View");
     }
 }
コード例 #3
0
        public static AssetTypeValueField GetField(long id, out string className)
        {
            className = "";
            string             path       = DirctoryPath;
            AssetsManager      helper     = AssetsManager;
            ClassDatabaseFile  classFile  = helper.classFile;
            AssetsFileInstance correctAti = AssetsFileInstance;
            AssetFileInfoEx    info       = correctAti.table.GetAssetInfo(id);

            if (info == null)
            {
                Console.WriteLine($"path_id:{id} is not found,maybe in other file");
                return(null);
            }

            ClassDatabaseType   classType = AssetHelper.FindAssetClassByID(classFile, info.curFileType);
            string              typeName  = classType.name.GetString(classFile);
            AssetTypeValueField baseField = helper.GetATI(correctAti.file, info).GetBaseField();

            className = AssetHelper.FindAssetClassByID(helper.classFile, info.curFileType)
                        .name.GetString(helper.classFile);
            AssetTypeValueField targetBaseField = baseField;

            if (className == "MonoBehaviour")
            {
                if (AssetUtils.AllDependenciesLoaded(helper, correctAti))
                {
                    className += $"--{GetClassName(helper, correctAti, targetBaseField)}--{targetBaseField[3].value.AsString().TrimEnd('\0')}--";
                    string managedPath = Path.Combine(Path.GetDirectoryName(correctAti.path), "Managed");
                    if (Directory.Exists(managedPath))
                    {
                        targetBaseField = helper.GetMonoBaseFieldCached(correctAti, info, managedPath);
                    }
                }
                else
                {
                    MessageBox.Show("Can't display MonoBehaviour data until dependencies are loaded", "Assets View");
                    return(null);
                }
            }
            else
            {
                className += "--";
            }
            return(targetBaseField);
        }
コード例 #4
0
        private void exportAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var inst = IEManager.AssetsFileInstance;

            if (!AssetUtils.AllDependenciesLoaded(helper, currentFile))
            {
                MessageBox.Show("未加载依赖文件");
                return;
            }

            foreach (var item in inst.table.GetLookupBase())
            {
                string typeName = IEManager.GetTypeName(item.Key);
                if (typeName == "MonoBehaviour")
                {
                    ExportAssets(item.Key);
                }
            }
            MessageBox.Show("导出成功");
        }
コード例 #5
0
ファイル: StartScreen.cs プロジェクト: usnail/AssetsTools.NET
 private void updateListInformationToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (currentFile == null)
     {
         MessageBox.Show("No current file selected!", "Assets View");
         return;
     }
     if (!AssetUtils.AllDependenciesLoaded(helper, currentFile))
     {
         DialogResult res = MessageBox.Show(
             "You haven't loaded all dependencies for this file. Load now?",
             "Assets View",
             MessageBoxButtons.YesNo);
         if (res == DialogResult.No)
         {
             return;
         }
         helper.LoadAssetsFile(currentFile.stream, currentFile.path, true);
         UpdateDependencies();
     }
 }
コード例 #6
0
        /// <summary>
        /// 导入整个文件夹的mono
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void imporDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!AssetUtils.AllDependenciesLoaded(helper, currentFile))
            {
                MessageBox.Show("未加载依赖文件");
                return;
            }

            IEManager.InputStr = fileIDTextBox.Text;
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title = "选择要覆盖的Aseets";
            string targetFileName = "";

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                if (currentFile == null)
                {
                    return;
                }
                if (assetList.SelectedCells.Count > 0)
                {
                    var    selRow   = assetList.SelectedRows[0];
                    string typeName = (string)selRow.Cells[2].Value;
                    if (typeName == "Folder")
                    {
                        string dirName = (string)selRow.Cells[1].Value;
                        ChangeDirectory(dirName);
                        return;
                    }
                    else
                    {
                        targetFileName = ofd.FileName;
                    }
                }
            }
            else
            {
                return;
            }

            OpenFileDialog ofd2 = new OpenFileDialog
            {
                CheckFileExists = false,
                FileName        = "[选择文件夹]",
                Title           = "选择要导入的文件夹"
            };

            if (ofd2.ShowDialog() == DialogResult.OK)
            {
                string dirName = Path.GetDirectoryName(ofd2.FileName);
                if (Directory.Exists(dirName))
                {
                    ImportUtils.ImportAssets(dirName, targetFileName);
                    MessageBox.Show("导入成功");
                }
                else
                {
                    MessageBox.Show("文件夹不存在.", "Assets View");
                }
            }
        }