Ejemplo n.º 1
0
 protected override void PopulateView()
 {
     foreach (int file in Resource.EnumerateFiles())
     {
         Nodes.Add(( TreeNode )ResourceWrapperFactory.GetResourceWrapper($"Sound{file:D2}.adx", Resource.OpenFile(file)));
     }
 }
Ejemplo n.º 2
0
 protected override void PopulateView()
 {
     for (var i = 0; i < Resource.Entries.Count; i++)
     {
         Nodes.Add((TreeNode)ResourceWrapperFactory.GetResourceWrapper($"MessageScript{i:0000}", new MemoryStream(Resource.Entries[i].Data)));
     }
 }
Ejemplo n.º 3
0
 protected override void PopulateView()
 {
     foreach (var file in Resource.EnumerateFiles())
     {
         Nodes.Add(( TreeNode )ResourceWrapperFactory.GetResourceWrapper(file, Resource.OpenFile(file)));
     }
 }
Ejemplo n.º 4
0
        protected override void PopulateView()
        {
            if (mElementNameProvider != null)
            {
                for (var i = 0; i < Resource.Count; i++)
                {
                    var    res  = Resource[i];
                    string name = mElementNameProvider.Invoke(res, i);

                    Nodes.Add((TreeNode)ResourceWrapperFactory.GetResourceWrapper(name, res));
                }
            }
        }
Ejemplo n.º 5
0
        protected override void Initialize()
        {
            CommonContextMenuOptions = CommonContextMenuOptions.Export | CommonContextMenuOptions.Replace | CommonContextMenuOptions.Add |
                                       CommonContextMenuOptions.Move | CommonContextMenuOptions.Rename | CommonContextMenuOptions.Delete;

            RegisterFileExportAction(SupportedFileType.RwTextureDictionaryNode, (res, path) => res.Save(path));
            RegisterCustomAction("Export All", Keys.None, (o, s) =>
            {
                using (FolderBrowserDialog dialog = new FolderBrowserDialog())
                {
                    dialog.ShowNewFolderButton = true;

                    if (dialog.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }

                    foreach (var texture in Resource.Textures)
                    {
                        var path   = Path.Combine(dialog.SelectedPath, Path.ChangeExtension(texture.Name, "png"));
                        var bitmap = texture.GetBitmap();

                        bitmap.Save(path);
                    }
                }
            });
            RegisterFileReplaceAction(SupportedFileType.RwTextureDictionaryNode, (res, path) => (RwTextureDictionaryNode)RwNode.Load(path));
            RegisterFileAddAction(SupportedFileType.RwTextureNativeNode, DefaultFileAddAction);
            RegisterFileAddAction(SupportedFileType.Bitmap, (path, wrap) =>
            {
                var resWrap = (BitmapWrapper)ResourceWrapperFactory.GetResourceWrapper(path);
                var name    = Path.GetFileNameWithoutExtension(path);
                wrap.Nodes.Add(new RwTextureNativeNodeWrapper(new RwTextureNativeNode(name, resWrap.Resource)));
            });
            RegisterRebuildAction(wrap =>
            {
                var textureDictionary = new RwTextureDictionaryNode();

                foreach (RwTextureNativeNodeWrapper textureNodeWrapper in Nodes)
                {
                    textureDictionary.Textures.Add(textureNodeWrapper.Resource);
                }

                return(textureDictionary);
            });
        }