/// <summary> /// Runs the RINGS algorithm on a small directory. /// </summary> /// <param name="args"></param> public static void t4Main(string[] args) { string t = "<drive name = \"C:\">\n" + "<directory name = \"d0\"> </directory>" + "<directory name = \"d0\"> </directory>" + "<directory name = \"d1\">Unauthorized</directory>" + "<directory name = \"d2\"><file name = \"file2\"></file><directory name = \"file3\"></directory></directory>" + "</drive>"; Tag r = XMLReaderToTree.extractTreeFromXML(XmlReader.Create(new StringReader(t))); printTagAndChildren(r, 0); Console.ReadKey(); CircleNode layout = RINGS.MakeLayout(r, 350); Console.WriteLine("Circles:"); Circle tempC; Console.ReadKey(); RINGSForm f = (new RINGSForm(700, 700)); f.Show(); f.DrawAllCircles(layout); Console.ReadKey(); //Console.WriteLine("Saving image"); //f.Refresh(); //f.drawToFile(@"C:\Users\Emad\Desktop\fileSystem.png"); Console.ReadKey(); }
public static void evaluateFig2Complete() { Tag r = XMLReaderToTree.extractDirectory( @"C:\Users\Emad\Dropbox\DTU\Bachelor projekt\File system screenshots\RINGS-fig2-complete.xml", ""); int drawingSize = 8000; Console.WriteLine("Loaded tree."); CircleNode layout = RINGS.MakeLayout(r, drawingSize); Console.WriteLine("Created layout:"); using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\Emad\Dropbox\DTU\Bachelor projekt\Drawing algorithms\Evaluations\evaluations-Fig2Complete.txt", false)) { file.WriteLine("File size\tStaticness\tValue/size distance"); double[][] eval = evaluateLayout(layout); for (int i = 0; i < 6; i++) { for (int j = 0; j < 3; j++) { file.Write(eval[j][i]); file.Write("\t"); } file.Write("\n"); } } Console.Write("DONE"); Console.ReadLine(); }
public static void t6Main(String[] args) { Tag r = XMLReaderToTree.extractDirectory( @"C:\Users\Emad\Dropbox\DTU\Bachelor projekt\report\file-systems\many-equal-files.xml", ""); //printTagAndChildren(r, 0); int drawingSize = 100; Console.WriteLine("Loaded tree."); CircleNode layout = RINGS.MakeLayout(r, drawingSize); Console.WriteLine("Created layout."); RINGSForm f = new RINGSForm(drawingSize * 2, drawingSize * 2); f.Show(); f.DrawAllCircles(layout); f.drawToFile(@"C:\Users\Emad\Dropbox\DTU\Bachelor projekt\report\file-systems\many-equal-files" + "-master.png"); Console.ReadLine(); }
/// <summary> /// Loads the system creenshot and runs the RINGS algorithm, saving the result /// in a PNG file. /// </summary> /// <param name="args"></param> public static void t5Main(string[] args) { Tag r = XMLReaderToTree.extractDirectory( @"C:\Users\Emad\Dropbox\DTU\Bachelor projekt\File system screenshots\FS SS 15-03-16.xml", ""); //printTagAndChildren(r, 0); int drawingSize = 8000; Console.WriteLine("Loaded tree."); CircleNode layout = RINGS.MakeLayout(r, drawingSize); Console.WriteLine("Created layout."); RINGSForm f = new RINGSForm(drawingSize * 2, drawingSize * 2); f.Show(); f.DrawAllCircles(layout); f.drawToFile(@"C:\Users\Emad\Dropbox\DTU\Bachelor projekt\File system screenshots\FS SS 15-03-16.png"); Console.ReadLine(); }
public static void evaluateScreenshots() { string screenshotPath = @"C:\Users\Emad\Dropbox\DTU\Bachelor projekt\File system screenshots"; string[] screenshots = new string[] { "FS SS 15-03-16", "FS SS MOM", "FS SS ZEINA", "FS SS STAT", "FS SS BABA" }; int drawingSize = 8000; Tag r; CircleNode[] layouts = new CircleNode[screenshots.Length]; double[][][] evaluations = new double[screenshots.Length][][]; for (int i = 0; i < screenshots.Length; i++) { r = XMLReaderToTree.extractDirectory( screenshotPath + "\\" + screenshots[i] + ".xml", ""); layouts[i] = RINGS.MakeLayout(r, drawingSize); evaluations[i] = evaluateLayout(layouts[i]); } double[][] compiledEvaluation = new double[3][]; for (int i = 0; i < compiledEvaluation.Length; i++) { compiledEvaluation[i] = new double[6]; } for (int i = 0; i < compiledEvaluation.Length; i++) { for (int j = 0; j < compiledEvaluation[0].Length; j++) { double sum = 0; for (int k = 0; k < evaluations.Length; k++) { sum += evaluations[k][i][j]; } compiledEvaluation[i][j] = sum / evaluations.Length; } } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\Emad\Dropbox\DTU\Bachelor projekt\Drawing algorithms\Evaluations\evaluations-master-all.txt", false)) { file.WriteLine("File size\tStaticness\tValue/size distance"); for (int i = 0; i < compiledEvaluation[0].Length; i++) { for (int j = 0; j < compiledEvaluation.Length; j++) { file.Write(compiledEvaluation[j][i]); file.Write("\t"); } file.Write("\n"); } } Console.Write("DONE"); Console.ReadLine(); }