示例#1
0
文件: GUI.cs 项目: AinTunez/MegaTAE
 public GUI()
 {
     InitializeComponent();
     UTIL.Init(this);
 }
示例#2
0
文件: GUI.cs 项目: AinTunez/MegaTAE
        public void LoadANIBND(string path, bool isSekiro)
        {
            TaeListBox.DataSource = null;
            ANIBND   = null;
            FilePath = null;
            IsSekiro = isSekiro;

            try
            {
                ANIBND   = BND4.Read(path);
                FilePath = Path.GetFullPath(path);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                UTIL.LogException("Error loading ANIBND", ex);
            }

            if (ANIBND == null || FilePath == null)
            {
                return;
            }

            if (!File.Exists(path + ".bak"))
            {
                File.Copy(path, path + ".bak");
            }
            var tae3_list = new List <TAE3Handler>();
            var tae4_list = new List <TAE4Handler>();

            foreach (var file in ANIBND.Files.Where(f => f.Name.EndsWith(".tae") && f.Bytes.Length > 0))
            {
                if (isSekiro)
                {
                    var t = new TAE4Handler(file);
                    if (t.IsValid)
                    {
                        tae4_list.Add(new TAE4Handler(file));
                    }
                }
                else
                {
                    var t = new TAE3Handler(file);
                    if (t.IsValid)
                    {
                        tae3_list.Add(new TAE3Handler(file));
                    }
                }
            }


            void refreshList()
            {
                if (TaeListBox.InvokeRequired)
                {
                    TaeListBox.Invoke(new MethodInvoker(refreshList));
                }
                else
                {
                    if (isSekiro)
                    {
                        TaeListBox.DataSource = tae4_list;
                    }
                    else
                    {
                        TaeListBox.DataSource = tae3_list;
                    }
                    if (TaeListBox.Items.Count > 0)
                    {
                        TaeListBox.SelectedIndex = 0;
                    }
                }
            }

            refreshList();
        }