コード例 #1
0
        private void BindTextures(string directory, TPKBlock tpk)
        {
            string current = String.Empty;

            try
            {
                foreach (var file in Directory.GetFiles(directory))
                {
                    current = file;
                    var name    = Path.GetFileNameWithoutExtension(file);
                    var key     = name.BinHash();
                    var texture = tpk.FindTexture(key, KeyType.BINKEY);

                    if (texture is null)
                    {
                        tpk.AddTexture(name, file);
                    }
                    else if (this._type == eImportType.synchronize)
                    {
                        texture.Reload(file);
                    }
                    else if (this._type == eImportType.@override)
                    {
                        tpk.RemoveTexture(key, KeyType.BINKEY);
                        tpk.AddTexture(name, file);
                    }
                }
            }
            catch (Exception e)
            {
                var error = e.GetLowestMessage();
                error = $"Texture {current} : {error}";
                throw new Exception(error);
            }
        }
コード例 #2
0
ファイル: TPKEditor.cs プロジェクト: NFSTools/Binary
 public TPKEditor(TPKBlock TPK, uint key)
 {
     this.TPK      = TPK;
     this._texture = this.TPK.FindTexture(key, eKeyType.BINKEY);
     this.InitializeComponent();
     this.BackImage.Controls.Add(this.PreviewImage);
     this.PreviewImage.Location  = new Point(0, 0);
     this.PreviewImage.BackColor = Color.FromArgb(0, 0, 0, 0);
 }
コード例 #3
0
 public TextureEditor(TPKBlock tpk, string path)
 {
     this.InitializeComponent();
     this.TPK        = tpk;
     this._tpkpath   = path;
     this._openforms = new List <Form>();
     this.Commands   = new List <string>();
     this.Text       = $"{this.TPK.CollectionName} Editor";
     this.TexEditorImage.BackColor             = Color.FromArgb(0, 0, 0, 0);
     this.TexEditorImage.BorderStyle           = BorderStyle.FixedSingle;
     this.TexEditorImage.Width                 = this.panel1.Width;
     this.TexEditorImage.Height                = this.panel1.Height;
     this.TexEditorListView.Columns[^ 1].Width = -2;