Exemplo n.º 1
0
        public async void LoadNcgr()
        {
            DisableCancelAndSave();
            EnableViewComponents();
            string args = SelectedPath.Value;

            LoadedNgcr = await Task.Run(() => NDSImageFactory.LoadNgcr(args));

            if (LoadedNgcr.AllErrors.Count == 0)
            {
                LoadedImage = LoadedNgcr.ConvertedImage.ToImageSource();

                ImageMetaData = new ImageMetadata(
                    LoadedNgcr.ConvertedImage.Width,
                    LoadedNgcr.ConvertedImage.Height,
                    LoadedNgcr.Char.IntensidadeDeBits == 3 ? "4" : "8",
                    LoadedNgcr.ArquivoNclr.Pltt.Paleta.Length / 2);
                Palette = PaletteVisualGenerator.CreateImage(LoadedNgcr.ArquivoNclr.Colors);
            }
            else
            {
                MessageBox.Show($"Alguns erros foram encontrados: {string.Join("\r\n", LoadedNgcr.AllErrors)}");
                LoadedNgcr = null;
            }
        }
Exemplo n.º 2
0
        public async void ExportAllNcgr()
        {
            EnableStatus("Exportando ncgrs...");
            await Task.Run(() => FilePaths.List.Values.ToList().ForEach(arg => NDSImageFactory.LoadNgcr(arg).ExportarImagem()));

            _ = MessageBox.Show("Bgs exportados com sucesso.");
            DisableStatus();
        }
Exemplo n.º 3
0
        public async void LoadBtx()
        {
            string args = SelectedPath.Value;

            Btx = await Task.Run(() => NDSImageFactory.LoadBtx(args));

            if (Btx.Errors.Count > 0)
            {
                MessageBox.Show(string.Join("\r\n", Btx.Errors));
                Btx = null;
            }
        }
Exemplo n.º 4
0
        private void NgcrBatchImport(string[] pngsDirectory)
        {
            foreach (var path in pngsDirectory)
            {
                string arg;
                string ngcrName = $"{path.Split('\\').Last().Replace(".png","").Replace("com_","").Replace("jpn_","")}.ncgr";
                FilePaths.List.TryGetValue(ngcrName, out arg);
                if (arg != null)
                {
                    Ncgr tmpNcgr = NDSImageFactory.LoadNgcr(arg);

                    if (tmpNcgr.Errors.Count == 0)
                    {
                        tmpNcgr.ImportarNgcr.Invoke(path);
                        if (tmpNcgr.Errors.Count == 0)
                        {
                            tmpNcgr.SalvarNCGR(false);
                        }
                        else
                        {
                            ErrorsLog.AddRange(tmpNcgr.Errors);
                        }
                    }
                    else
                    {
                        ErrorsLog.AddRange(tmpNcgr.Errors);
                    }
                }
                else
                {
                    ErrorsLog.Add($"{ngcrName} não encontrado.");
                }
            }

            if (ErrorsLog.Count == 0)
            {
                _ = MessageBox.Show($"Imagens importadas com sucesso.");
            }
            else
            {
                _ = MessageBox.Show($"{string.Join("\r\n", ErrorsLog)}");
                ErrorsLog.Clear();
            }
        }