Exemple #1
0
                private static void BuildCharMapFromIso(Stream iso, out GenericCharMap outCharmap, out IList <Glyph> customGlyphs)
                {
                    var rootDirEnt   = DirectoryEntry.GetPsxDirectoryEntries(iso, FFTText.PsxRootDirEntSector, 1);
                    var charMapEntry = rootDirEnt.Find(d => d.Filename == FFTText.PsxCharmapFileName);

                    System.Diagnostics.Debug.Assert(charMapEntry.Sector == FFTText.PsxCharmapSector);
                    var charmapBytes = PsxIso.GetBlock(iso, new PsxIso.KnownPosition((PsxIso.Sectors)FFTText.PsxCharmapSector, 0,
                                                                                     (int)charMapEntry.Size));
                    Dictionary <int, string> myCharmap = new Dictionary <int, string>();

                    using (MemoryStream memStream = new MemoryStream(charmapBytes))
                        using (TextReader reader = new StreamReader(memStream, Encoding.UTF8))
                        {
                            // Get header line
                            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;
                }
Exemple #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);
        }
Exemple #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);
        }