protected void Button1_Click(object sender, EventArgs e) { if (IsPostBack) { bool fileOK = false; string path = Server.MapPath("~/UploadedImages/"); string fileExtension = ""; if (FileUpload1.HasFile) { fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower(); string[] allowedExtensions = { ".xml", ".txt", ".csv" }; for (int i = 0; i < allowedExtensions.Length; i++) { if (fileExtension == allowedExtensions[i]) { fileOK = true; } } } FileDisplay initFileDisplay = new FileDisplay(); // Use the appropriate processor to read the file if (fileOK == true) { if (fileExtension == ".xml") { FileProcessor.ProcessorXmlFile(FileUpload1); initFileDisplay.GetEmployees(); } else if (fileExtension == ".txt") { FileProcessor.ProcessorTxtFile(FileUpload1); initFileDisplay.GetEmployees(); } else if (fileExtension == ".csv") { FileProcessor.ProcessorCsvFile(FileUpload1); initFileDisplay.GetEmployees(); } } else { Label1.Text = "Cannot accept files of this type."; } } }
public RealtimeBenchmark(bool showGUI, int threads) { IDisplay display = /*showGUI ? new FastDisplay() :*/ new FileDisplay(false); UI.printInfo(UI.Module.BENCH, "Preparing benchmarking scene ..."); // settings parameter("threads", threads); // spawn regular priority threads parameter("threads.lowPriority", false); parameter("resolutionX", 512); parameter("resolutionY", 512); parameter("aa.min", -3); parameter("aa.max", 0); parameter("depths.diffuse", 1); parameter("depths.reflection", 1); parameter("depths.refraction", 0); parameter("bucket.order", "hilbert"); parameter("bucket.size", 32); options(SunflowAPI.DEFAULT_OPTIONS); // camera Point3 eye = new Point3(30, 0, 10.967f); Point3 target = new Point3(0, 0, 5.4f); Vector3 up = new Vector3(0, 0, 1); parameter("transform", Matrix4.lookAt(eye, target, up)); parameter("fov", 45.0f); camera("camera", "pinhole"); parameter("camera", "camera"); options(SunflowAPI.DEFAULT_OPTIONS); // geometry createGeometry(); // this first render is not timed, it caches the acceleration data // structures and tesselations so they won't be // included in the main timing UI.printInfo(UI.Module.BENCH, "Rendering warmup frame ..."); render(SunflowAPI.DEFAULT_OPTIONS, display); // now disable all output - and run the benchmark UI.set(null); Timer t = new Timer(); t.start(); float phi = 0; int frames = 0; while (phi < 4 * Math.PI) { eye.x = 30 * (float)Math.Cos(phi); eye.y = 30 * (float)Math.Sin(phi); phi += (float)(Math.PI / 30); frames++; // update camera parameter("transform", Matrix4.lookAt(eye, target, up)); camera("camera", null); render(SunflowAPI.DEFAULT_OPTIONS, display); } t.end(); UI.set(new ConsoleInterface()); UI.printInfo(UI.Module.BENCH, "Benchmark results:"); UI.printInfo(UI.Module.BENCH, " * Average FPS: {0,6:0.00", frames / t.seconds()); UI.printInfo(UI.Module.BENCH, " * Total time: {0}", t); }