Пример #1
0
        bool Save()
        {
            if (IsChanged)
            {
                var result = MessageBox.Show("Save changed?", "Save", MessageBoxButton.YesNoCancel, MessageBoxImage.Question, MessageBoxResult.Yes);

                if (result == MessageBoxResult.Yes)
                {
                    var enc = Static.EncodingManager.GetPersonaEncoding(Static.FontManager.GetPersonaFontName(_FontSelect));
                    if (enc.Tag == "Empty")
                    {
                        PersonaEditorLib.PersonaEncoding.PersonaEncoding personaEncoding = new PersonaEditorLib.PersonaEncoding.PersonaEncoding();
                        foreach (var a in GlyphList)
                        {
                            if (a.Char.Length > 0)
                            {
                                personaEncoding.Add(a.Index, a.Char[0]);
                            }
                        }

                        personaEncoding.SaveFNTMAP(Path.Combine(Static.FontManager.sourcedir, Static.FontManager.GetPersonaFontName(_FontSelect) + ".FNTMAP"));
                    }
                    else
                    {
                        foreach (var a in GlyphList)
                        {
                            if (a.Char.Length > 0)
                            {
                                enc.Add(a.Index, a.Char[0]);
                            }
                        }
                        enc.SaveFNTMAP(enc.FilePath);
                        Static.EncodingManager.Update(Static.FontManager.GetPersonaFontName(_FontSelect));
                    }
                }
                else if (result == MessageBoxResult.Cancel)
                {
                    return(false);
                }

                IsChanged = false;
                return(true);
            }
            else
            {
                return(true);
            }
        }