Ejemplo n.º 1
0
        //Load a glyphics file, precompute rectangles and append them to codeString as speedy cache
        public static void PreSerializeGlyphicsFile(string filename)
        {
            CodeList codes = GlyToCodes(filename);

            foreach (Code t in codes)
            {
                string code = t.codeString;

                if (code.Contains("*"))
                {
                    code = code.Split('*')[0];
                }

                Grid grid = CodeConverter.TokensToGrid(CodeConverter.CodeToTokens(new Code(code)));

                if (grid != null)
                {
                    RectList rectSet         = GridConverter.GridToRects(grid);
                    string   serializedRects = RectConverter.RectsToSerializedRects(rectSet).SerializedData;
                    code         = code + serializedRects;
                    t.codeString = code;
                }
            }
            CodesToGly(filename, codes);
        }
Ejemplo n.º 2
0
 //Load archetypes from a file
 public static bool LoadArchetypes(string filename)
 {
     using (var file = new System.IO.StreamReader(filename))
     {
         string line;
         while ((line = file.ReadLine()) != null)
         {
             Grid grid = CodeConverter.TokensToGrid(CodeConverter.CodeToTokens(new Code(line)));
             if (grid != null)
             {
                 GridLibrary.GridList.AddGrid(grid);
             }
         }
     }
     return(false);
 }
Ejemplo n.º 3
0
 public static TokenList CodeToTokens(Code rasterCode)
 {
     return(CodeConverter.CodeToTokens(rasterCode));
 }