private static void Main(string[] args) { Console.WriteLine("Начало работы"); _ = ParserXML.GetInstance(Path.Combine(Environment.CurrentDirectory, "Example.xml")).GetJsonFile(); Console.WriteLine("Конец работы, нажми любую кнопку"); _ = Console.ReadKey(); }
// Use this for initialization void Awake() { levels = new Dictionary <string, List <GameObject> >(); ParserXML parse = new ParserXML(); parse.LoadFile("LevelsInfo"); Dictionary <string, Dictionary <string, int> > levelParse = parse.GetAllLevels(); Dictionary <string, Dictionary <string, int> > .KeyCollection levelParseKeys = levelParse.Keys; mainLevelsName = new string[levelParseKeys.Count]; int i = 0; foreach (string main in levelParse.Keys) { mainLevelsName[i] = main; ++i; string[] mainYlevels = new string[(levelParse[main].Keys).Count]; (levelParse[main].Keys).CopyTo(mainYlevels, 0); levels[main] = new List <GameObject>(); CreateLevels(main, mainYlevels); } }
public void InitData() { ParserXML parse = new ParserXML(); parse.LoadFile("LevelsInfo"); levels.Clear(); levels = parse.GetAllLevels(); }
public override void ejecutarTests(List<Test> tests) { string projectFolder = MultiPlayer.Instance.getUser().getPathProyecto(); string pathResult=projectFolder ; string pathToUnity = "C:\\Archivos de Programa\\Unity\\Editor"; string command ="Unity.exe -quit -batchmode -projectPath " +projectFolder + " -executeMethod UnityTest.Batch.RunUnitTests"; if (tests.Count > 0) { command = command + " -filter="; foreach (Test t in tests) command = command + t.getClase () + "." + t.getMetodo () + ","; command = command.Remove (command.Length - 1); } /*SFSObject param = new SFSObject(); param.PutUtfString("comando",command); MultiPlayer.Instance.getSmartFox().Send(new ExtensionRequest("ejecutar",param));*/ StreamWriter sw = new StreamWriter("test.bat"); sw.WriteLine("cd " + pathToUnity); sw.WriteLine("del " + projectFolder + "\\UnitTestResults.xml"); sw.WriteLine(command); sw.Close(); Process myProcess = new Process(); myProcess.StartInfo.FileName = "test.bat"; myProcess.StartInfo.CreateNoWindow = true; #if UNITY_STANDALONE_WIN myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; #endif myProcess.Start (); myProcess.WaitForExit (); string path = projectFolder + "\\UnitTestResults.xml"; ParserXML parser = new ParserXML (path); List<EjecucionTest> info = parser.getParsing(); foreach (Test t in tests) { string nombre = t.getClase() + "." + t.getMetodo(); foreach(EjecucionTest i in info){ if(i.getName().Equals(nombre)){ i.setIdTest(t.getIdTest()); i.setFechaHora(System.DateTime.Now); switch (i.getEstado()) { case "Success": t.setEstado("EXITO"); break; case "Failure": t.setEstado("FALLO"); break; } t.setInfoTest(i); } } } }
/// <summary> /// Gets the letter grade. /// Where 1 - A, 2 - B, 3 - C, 4 - D /// </summary> /// <returns>1-4</returns> /// <param name="levelName">Level name.</param> /// <param name="counter">Counter.</param> public static int getLetterGrade(string levelName, int counter) { ParserXML parse = new ParserXML(); parse.LoadFile("LevelsInfo"); int[] grades = parse.GetValueNode(levelName); nextLevel = parse.next; for (int i = 0; i < grades.Length; i++) { if (grades[i] >= counter) { return(i + 1); } } return(-1); }
public ActionResult Import(HttpPostedFileBase postedFile) { if (postedFile != null) { //string path = Server.MapPath("~/Uploads/"); //if (!Directory.Exists(path)) //{ // Directory.CreateDirectory(path); //} //postedFile.SaveAs(path + Path.GetFileName(postedFile.FileName)); //ViewBag.Message = "File uploaded successfully."; XDocument d = new XDocument(); try { d = XDocument.Load(postedFile.InputStream); } catch (FileNotFoundException) { TempData["alertMessage"] = "Файл не может быть быть прочтен."; return(RedirectToAction("Index", "Home")); } catch (XmlException ex) { TempData["alertMessage"] = "Файл содержит ошибку в синтаксисе XML. " + ex.Message; return(RedirectToAction("Index", "Home")); } if (!CheckValidation(d)) { return(RedirectToAction("Index", "Home")); } string message = ParserXML.ParseXML(d); TempData["alertMessage"] = message; return(RedirectToAction("Index", "Home")); } TempData["alertMessage"] = "Файл не был загружен."; return(RedirectToAction("Index", "Home")); }
// What to do when the user opens a file private void openFileHandler(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = ""; dialog.Title = "Open file..."; ParserXML parser = new ParserXML(); if (dialog.ShowDialog() == DialogResult.OK) { shapes = parser.ParseFromFile(dialog.FileName); this.Refresh(); } }