Ejemplo n.º 1
0
                private static void BuildCharMapFromIso( Stream iso, PspIso.PspIsoInfo info, out GenericCharMap outCharmap, out IList<Glyph> customGlyphs )
                {
                    var usrDirEnt = DirectoryEntry.GetPspDirectoryEntries( iso, info, PspIso.Sectors.PSP_GAME_USRDIR, 1 );
                    var charMapEntry = usrDirEnt.Find( d => d.Filename == FFTText.PspCharmapFileName );
                    System.Diagnostics.Debug.Assert( charMapEntry.Sector == info[PspIso.Sectors.PSP_GAME_USRDIR_CHARMAP] );
                    var charmapBytes = PspIso.GetBlock( iso, info, new PspIso.KnownPosition(
                         PspIso.Sectors.PSP_GAME_USRDIR_CHARMAP, 0, (int)charMapEntry.Size ) ).ToArray();

                    Dictionary<int, string> myCharMap = new Dictionary<int, string>();
                    using(MemoryStream memStream = new MemoryStream(charmapBytes))
                    using (TextReader reader = new StreamReader( memStream, Encoding.UTF8 ))
                    {
                        reader.ReadLine();

                        string currentLine = string.Empty;
                        while ((currentLine = reader.ReadLine()) != null)
                        {
                            string[] cols = currentLine.Split( '\t' );
                            int index = int.Parse( cols[0], System.Globalization.NumberStyles.HexNumber );
                            myCharMap[index] = cols[1];
                        }
                    }

                    outCharmap = new NonDefaultCharMap( myCharMap );
                    customGlyphs = null;
                }
Ejemplo n.º 2
0
 public static GenericCharMap GenerateCharMap( IEnumerable<KeyValuePair<int, string>> table )
 {
     GenericCharMap map = new NonDefaultCharMap();
     foreach ( var kvp in table )
     {
         map[kvp.Key] = kvp.Value;
     }
     return map;
 }
Ejemplo n.º 3
0
        public static GenericCharMap GenerateCharMap( IEnumerable<KeyValuePair<int, string>> table )
        {
            Dictionary<int, string> b = new Dictionary<int, string>();
            foreach (var kvp in table)
            {
                b[kvp.Key] = kvp.Value;
            }

            GenericCharMap map = new NonDefaultCharMap( b );

            return map;
        }