Ejemplo n.º 1
0
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     Benchmark mark = new Benchmark();
     mark.Begin();
     FileStream mapFile = new FileStream(filename1, FileMode.Create);
     using (mapFile)
     {
         Compiler compiler = new Compiler(mapFile);
         compiler.CompileFromScenario(@"scenarios\multi\headlong\headlong.scnr");
     }
     mark.End();
     MessageBox.Show(string.Format("Done: {0}", mark.Result));
 }
Ejemplo n.º 2
0
 public void Compile(Project project, bool rebuildcaches)
 {
     List<string> filenames = new List<string>(Directory.GetFiles(project.SourceDirectory, String.Format("*{0}", Sunfish.Tag.Path.Extension), SearchOption.AllDirectories));
     project.SourceFiles = new List<string>(filenames);
     //for(int i=0;i<project.SourceFiles.Count;i++)
     //    project.SourceFiles[i] = project.SourceFiles[i].Substring(project.SourceDirectory.Length);
     project.SortSourceFiles();
     Benchmark mark = new Benchmark();
     mark.Begin();
     if (!rebuildcaches && CheckCacheStatus(project)) { LoadCaches(project); }
     else CreateCaches(project);
     CreateMap(project);
     mark.End();
     System.Windows.Forms.MessageBox.Show(String.Format("finished in: {0}", mark.Result), "Solution Compiled");
 }
Ejemplo n.º 3
0
        void WriteStringIdTables()
        {
            Benchmark mark = new Benchmark();
            mark.Begin();

            Pad(file);

            map.Header.StringId128TableAddress = (int)file.Position;

            byte[] blank = new byte[128];
            for (int i = 0; i < map.StringIdNames.Count; i++)
            {
                byte[] buffer = Encoding.UTF8.GetBytes(map.StringIdNames[i]);
                binWriter.Write(buffer);
                binWriter.Write(blank, 0, blank.Length - buffer.Length);
            }

            Pad(file);

            map.Header.StringIdIndexAddress = (int)file.Position;
            map.Header.StringIdCount = map.StringIdNames.Count;

            int start = 0;
            for (int i = 0; i < map.StringIdNames.Count; i++)
            {
                binWriter.Write(start);
                start += Encoding.UTF8.GetByteCount(map.StringIdNames[i]) + 1;
            }

            Pad(file);

            map.Header.StringIdTableAddress = (int)file.Position;
            for (int i = 0; i < map.StringIdNames.Count; i++)
            {
                binWriter.Write(Encoding.UTF8.GetBytes(map.StringIdNames[i]));
                binWriter.Write((byte)0x00);
            }
            map.Header.StringIdTableLength = (int)(file.Position - map.Header.StringIdTableAddress - 1);

            mark.End();
        }