Ejemplo n.º 1
0
        private void UpdateDisplayFntsView()
        {
            if (displayFntsView == null)
            {
                return;
            }
            displayFntsView.Filter = fnt => {
                FNT curfnt = (FNT)fnt;
                for (int i = 0; i < curfnt.entryTable.Count; i++)
                {
                    if (curfnt.entryTable[i].subtitle.ToLower().Contains(TextBox_SearchText.Text.ToLower()))
                    {
                        if (TextBox_SearchAudioFileName.Text == "" || currentAfs == null)
                        {
                            return(true);
                        }

                        var audioId = curfnt.GetEntryAudioID(i);

                        if (audioId == -1)
                        {
                            continue;
                        }

                        if (currentAfs.Files[audioId].Name.Contains(TextBox_SearchAudioFileName.Text.ToLower()))
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            };
            displayFntsView.Refresh();
        }
Ejemplo n.º 2
0
 public FNTEditorVM(FNT fnt)
 {
     this.fnt           = fnt;
     MaxWidth           = fnt.Header.Glyphs.Size1;
     Glyph.ClipGeometry = new RectangleGeometry(new Rect(0, 0, MaxWidth, MaxWidth));
     OpenFont();
 }
Ejemplo n.º 3
0
 private void FNT_Validating(object sender, CancelEventArgs e)
 {
     if (!Regex.Match(FNT.Text, "^[A-Z][a-zA-Z]*$").Success)
     {
         // first name was incorrect
         MessageBox.Show("Please Enter Valid First name");
         FNT.Focus();
         e.Cancel = true;
     }
 }
Ejemplo n.º 4
0
        private void ReadFONT(FNT FNT)
        {
            Height  = FNT.Header.Glyphs.Size1;
            Width   = FNT.Header.Glyphs.Size2;
            Palette = FNT.Palette.Pallete;
            if (FNT.Header.Glyphs.BitsPerPixel == 4)
            {
                PixelFormat = PixelFormats.Indexed4;
            }
            else if (FNT.Header.Glyphs.BitsPerPixel == 8)
            {
                PixelFormat = PixelFormats.Indexed8;
            }
            else
            {
                throw new Exception("ReadFONT Error: unknown PixelFormat");
            }

            var DecList = FNT.Compressed.GetDecompressedData();

            if (FNT.Header.Glyphs.BitsPerPixel == 4)
            {
                ArrayTool.ReverseByteInList(DecList);
            }

            for (int i = 0; i < DecList.Count; i++)
            {
                var Cut = FNT.WidthTable[i] == null ? new VerticalCut(0, (byte)Width) : FNT.WidthTable[i].Value;

                int index = i + 32;
                if (DataList.ContainsKey(index))
                {
                    DataList[index] = DecList[i];
                }
                else
                {
                    DataList.Add(index, DecList[i]);
                }

                if (CutList.ContainsKey(index))
                {
                    CutList[index] = Cut;
                }
                else
                {
                    CutList.Add(index, Cut);
                }
            }
        }
Ejemplo n.º 5
0
        private void ListBox_OpenedFNTS_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ClearUIData();
            if (ListBox_AllFNTS.SelectedIndex == -1)
            {
                ListBox_CurrentFNT.ItemsSource = null;
                return;
            }
            currentFnt = (FNT)ListBox_AllFNTS.SelectedItem;
            ListBox_CurrentFNT.SelectedIndex = -1;
            displayTableListView             = CollectionViewSource.GetDefaultView(currentFnt.entryTable);

            ListBox_CurrentFNT.ItemsSource = displayTableListView;
            UpdateDisplayTableListView();
        }
Ejemplo n.º 6
0
 private void OpenFont(FNT FNT)
 {
     try
     {
         ReadFONT(FNT);
         if (CutList.ContainsKey(32))
         {
             CutList[32] = new VerticalCut(10, 20);
         }
     }
     catch (Exception e)
     {
         //Logging.Write("PersonaEditorLib", e);
     }
 }
Ejemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Filter = "All AquaPlus Font Files|*.fnt";
            if (fd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            Stream Stream = new StreamReader(fd.FileName).BaseStream;

            Font          = new FNT(Stream);
            Glyphs        = Font.GetGlyphs();
            textBox4.Text = (FontSize - (FontSize / 8)) + ",0";
            PreviewText();
        }
Ejemplo n.º 8
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Filter = "All Prototype Font Files|*.fnt;*.pro";
            if (fd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string FN = Path.GetDirectoryName(fd.FileName) + "\\" + Path.GetFileNameWithoutExtension(fd.FileName);

            byte[] FNTD = File.ReadAllBytes(FN + ".fnt");
            byte[] PROD = File.ReadAllBytes(FN + ".pro");

            Font          = new FNT(FNTD, PROD);
            Glyphs        = Font.GetGlyphs();
            textBox4.Text = (FontWidth - (FontWidth / 8)) + ",0";
            PreviewText();
        }
Ejemplo n.º 9
0
        private void ProcessFNTS()
        {
            ClearData();
            if (lastOpenDir == null)
            {
                return;
            }
            String localeSwitcher = ComboBox_LocaleSwitcher.SelectedItem.ToString();

            string[] foundFnts = Directory.GetFiles(lastOpenDir, "*_" + localeSwitcher.Substring(localeSwitcher.Length - 2) + ".fnt", SearchOption.AllDirectories);
            for (int i = 0; i < foundFnts.Length; i++)
            {
                byte[] readFile    = File.ReadAllBytes(foundFnts[i]);
                FNT    newFnt      = FNT.ParseFNTFile(foundFnts[i], ref readFile, lastOpenDir);
                FNT    originalFnt = FNT.ParseFNTFile(foundFnts[i], ref readFile, lastOpenDir);

                openedFnts.Add(newFnt);
                initialFntsOpenedState.Add(originalFnt);
            }
            Button_OpenAFS.IsEnabled    = true;
            displayFntsView             = CollectionViewSource.GetDefaultView(openedFnts);
            ListBox_AllFNTS.ItemsSource = displayFntsView;
        }
Ejemplo n.º 10
0
 public FNTEditorVM(FNT fnt)
 {
     this.fnt = fnt;
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Tries to open a file with the specified data type.
        /// </summary>
        /// <param name="name">Name of file</param>
        /// <param name="data">Data of file</param>
        /// <param name="type">Type of file</param>
        /// <returns>Return ObjectContainer for this file or null if an error occurred.</returns>
        public static GameFile OpenFile(string name, byte[] data, FormatEnum type)
        {
            try
            {
                IGameData Obj;

                if (type == FormatEnum.BIN)
                {
                    Obj = new FileContainer.BIN(data);
                }
                else if (type == FormatEnum.SPR)
                {
                    Obj = new SpriteContainer.SPR(data);
                }
                else if (type == FormatEnum.TMX)
                {
                    Obj = new Sprite.TMX(data);
                }
                else if (type == FormatEnum.BF)
                {
                    Obj = new FileContainer.BF(data, name);
                }
                else if (type == FormatEnum.PM1)
                {
                    Obj = new FileContainer.PM1(data);
                }
                else if (type == FormatEnum.BMD)
                {
                    Obj = new Text.BMD(data);
                }
                else if (type == FormatEnum.PTP)
                {
                    Obj = new Text.PTP(data);
                }
                else if (type == FormatEnum.FNT)
                {
                    Obj = new FNT(data);
                }
                else if (type == FormatEnum.FNT0)
                {
                    Obj = new FNT0(data);
                }
                else if (type == FormatEnum.BVP)
                {
                    Obj = new FileContainer.BVP(name, data);
                }
                else if (type == FormatEnum.TBL)
                {
                    try
                    {
                        Obj = new FileContainer.TBL(data, name);
                    }
                    catch
                    {
                        Obj = new FileContainer.BIN(data);
                    }
                }
                else if (type == FormatEnum.FTD)
                {
                    Obj = new FTD(data);
                }
                else if (type == FormatEnum.DDS)
                {
                    try
                    {
                        Obj = new Sprite.DDS(data);
                    }
                    catch
                    {
                        Obj = new Sprite.DDSAtlus(data);
                    }
                }
                else if (type == FormatEnum.SPD)
                {
                    Obj = new SpriteContainer.SPD(data);
                }
                else
                {
                    Obj = new DAT(data);
                }

                return(new GameFile(name, Obj));
            }
            catch
            {
                return(null);
            }
        }