static void JSON4() { string JSONString = "{\"st\tring\": \"\t\t\\t\u1234\"}"; Console.WriteLine($"Input: {JSONString}"); ReadJSON readJSON = new ReadJSON(); Dictionary <string, object> obj = readJSON.Parser(JSONString); Stopwatch sw = new Stopwatch(); sw.Start(); readJSON.Parser(JSONString); sw.Stop(); Console.WriteLine($"所用时间:{sw.ElapsedMilliseconds} ms"); Console.WriteLine("{"); Console.WriteLine($"\t\"st\tring\":\"{obj["st\tring"]}\""); Console.WriteLine("}"); Console.WriteLine($"转换为字符串:{WriteJSON.Write(obj)}"); sw.Start(); for (int i = 0; i < 100; ++i) { readJSON.Parser(JSONString); } sw.Stop(); Console.WriteLine($"一百次所用时间:{sw.ElapsedMilliseconds} ms"); Console.ReadKey(); }
static void JSON2() { string JSONString = "{\" Array\":[ \"字符串\", false], \"number\": " + "\n\n\n\t\r123, \"dgfsrfe\": null}"; Console.WriteLine($"Input: {JSONString}"); ReadJSON readJSON = new ReadJSON(); Dictionary <string, object> obj = readJSON.Parser(JSONString); Stopwatch sw = new Stopwatch(); sw.Start(); readJSON.Parser(JSONString); sw.Stop(); Console.WriteLine($"所用时间:{sw.ElapsedMilliseconds} ms"); Console.WriteLine("{"); Console.WriteLine("\t\" Array\": ["); Console.WriteLine($"\t\t\"{((List<object>)obj[" Array"])[0]}\","); Console.WriteLine($"\t\t{((List<object>)obj[" Array"])[1]},"); Console.WriteLine("\t],"); Console.WriteLine($"\t\"number\":{obj["number"]},"); Console.WriteLine($"\t\"dgfsrfe\":{obj["dgfsrfe"] ?? "null"}"); Console.WriteLine("}"); Console.WriteLine($"转换为字符串:{WriteJSON.Write(obj)}"); sw.Start(); for (int i = 0; i < 100; ++i) { readJSON.Parser(JSONString); } sw.Stop(); Console.WriteLine($"一百次所用时间:{sw.ElapsedMilliseconds} ms"); Console.ReadKey(); }
/// <summary> /// Create holograms representing sounds in real world based on information from microphones /// </summary> public void generateSoundObjects() { //If there are objects to parse, then we continue if (objs != null) { //lists of all sounds, loudness values, and first frame IDs List <Vector3> soundLocations = objs.getPositions(); List <double> loudnessValues = objs.getLoudness(); List <int> firstFrameIDs = objs.getFirstFrameIDs(); //Loop through all sounds and loudness values for (int i = 0; i < soundLocations.Count; i++) { Vector3 pos = soundLocations[i]; double loudness = loudnessValues[i]; int firstFrameID = firstFrameIDs[i]; //A sphere will not be created unless there is enough noise coming from that position if (loudness > soundThreshold) { if (!checkForSound(firstFrameID)) { createSphere(pos, firstFrameID); } } } //Remove all elements in the JSON list objs = null; } }
private static void SendEmail() { List <UserEmailPojo> listEmail = ReadJSON.GetListEmail(FileUtil.fileEmailJSONPath); StringBuilder logFile = new StringBuilder(); logFile.Append("*******Start SendEmail*******"); logFile.AppendLine(); foreach (UserEmailPojo currentUser in listEmail) { String username = currentUser.Username; String email = currentUser.Email; Boolean emailSent = EmailUtil.SendEmailToUsers(GetComposedMessage(username), email, "New Planning for " + DateUtil.getNextMonthEnglishLanguage()); if (emailSent) { logFile.AppendLine(); logFile.Append("Username= "******"Email= " + currentUser.Email); logFile.AppendLine(); logFile.Append("Date= " + DateTime.Now); logFile.AppendLine(); } } logFile.AppendLine(); logFile.Append("*******End SendEmail*******"); using (StreamWriter file = new StreamWriter(FileUtil.logFile, false)) { file.WriteLine(logFile.ToString()); } }
void Start() { ReadJson = new ReadJSON(); WriteJson = new WriteJSON(); ReadTarGzip = new ReadTARGZIP(); WriteTarGzip = new WriteTARGZIP(); }
static void JSON3() { string JSONString = "[true]"; Console.WriteLine($"Input: {JSONString}"); ReadJSON readJSON = new ReadJSON(); List <object> obj = readJSON.Parser(JSONString); Stopwatch sw = new Stopwatch(); sw.Start(); readJSON.Parser(JSONString); sw.Stop(); Console.WriteLine($"所用时间:{sw.ElapsedMilliseconds} ms"); Console.WriteLine("["); Console.WriteLine($"\t{obj[0]}"); Console.WriteLine("]"); Console.WriteLine($"转换为字符串:{WriteJSON.Write(obj)}"); sw.Start(); for (int i = 0; i < 100; ++i) { readJSON.Parser(JSONString); } sw.Stop(); Console.WriteLine($"一百次所用时间:{sw.ElapsedMilliseconds} ms"); Console.ReadKey(); }
public static void startSendSMS() { listOfRecipients = ReadJSON.getListProgramming(FileUtil.filePathJSONProgramming); if (listOfRecipients != null) { if (listOfRecipients != null && listOfRecipients.Count != 0) { foreach (VideoproiectiePojo currentRecipient in listOfRecipients) { String serviceResponse = SendSmsAPI.SendSMSToRecipient(currentRecipient); //mesaje in eventViewer de succes respectiv eroare. if (serviceResponse.Contains("\"status\":\"success\"")) { String notification = "SMS trimis cu succes catre " + currentRecipient.Username + " la nr tel " + currentRecipient.PhoneNumber + " " + " In data de " + DateTime.Now; LogMessage.PrintEventMessage(notification); EmailUtil.SendEmailToAdministrator(notification, "Notification sending SMS"); } else { HandlerErrorsUtil.handlerErrorFromService(serviceResponse); } } } else { HandlerErrorsUtil.handlerWarningFromFileJSON(1); } } else { HandlerErrorsUtil.handlerWarningFromFileJSON(2); } }
/* * [HttpGet] * [Route("api/MobileDiamond")] * implementation for mobile */ //public responseForMobile GetDiamondsForMobile(String shape, decimal fromSize, decimal toSize) //{ // return new responseForMobile(GetResponse(shape, fromSize, toSize)); //} /** * the main function that get the arguments and return the proper diamonds collection * */ private response GetResponse(String shape, decimal fromSize, decimal toSize) { response response = new response(); if (fromSize > toSize) { response.Errors.Error_code = 0; response.Errors.Massage = "Illegal size. from is bigger than to"; return(response); } if (!legal_shape.Contains(shape)) { response.Errors.Error_code = 1; response.Errors.Massage = "Illegal shape: " + shape; return(response); } IList <Diamond> diamondCollection = ReadJSON.PageLoad(); foreach (Diamond d in diamondCollection) { if (d.Shape.Equals(shape) && fromSize <= d.Weight && d.Weight <= toSize) { response.Data.Diamonds.Add(d); } } return(response); }
void Update() { if (Input.GetMouseButtonUp(0) || Input.GetKeyDown(KeyCode.Space)) { //ClearClearedCoordinates(); //SortCoordinates(); //foreach (Vector3 pos in superCleanedCoordinates) { // Instantiate(prefab, new Vector3(pos.x, 0.2f, pos.z), Quaternion.identity); //} List <Vector3> points = ClearCoordinates.Points(ReadJSON.pointsV3(jsonFileName), radius); firstObject = Instantiate(prefab, points[0], Quaternion.identity); secondObject = Instantiate(prefab, points[1], Quaternion.LookRotation(points[1] - points[0], Vector3.up)); for (byte i = 2; i < points.Count; i++) { Instantiate(prefab, points[i], Quaternion.LookRotation(points[i] - points[i - 1], Vector3.up)); //transform.LookAt(superCleanedCoordinates[i - 1] } firstObject.transform.LookAt(secondObject.transform); Debug.Log("Points built: " + points.Count); } }
static void Main(string[] args) { string output; ReadJSON readJSON = new ReadJSON(); //readJSON.FilePath = "C:\\Source\\TakeHomeTestCheetah\\data.json"; readJSON.FilePath = AppDomain.CurrentDomain.BaseDirectory + "data.json"; readJSON.ReadJsonFile(); output = readJSON.RecepientsSelected; Console.Write(output); }
private void Awake() { if (_instance == null) { _instance = this; } else { Debug.LogError("AN INSTANCE ALREADY EXISTS"); } ReadJSON.StartReadingJSON(); }
///<summary> ///Receives the data from the server and puts it into objs ///</summary> IEnumerator WaitForRequest(WWW www) { yield return(www); // check for errors if (www.error == null) { objs = new ReadJSON(www.text); } else { Debug.Log("WWW Error: " + www.error); } }
void Start() { List <Vector3> points = ClearCoordinates.Points(ReadJSON.pointsV3(jsonFileName), radius); firstObject = Instantiate(prefab, points[0], Quaternion.identity); secondObject = Instantiate(prefab, points[1], Quaternion.LookRotation(points[1] - points[0], Vector3.up)); for (int i = 2; i < points.Count; i++) { Instantiate(prefab, points[i], Quaternion.LookRotation(points[i] - points[i - 1], Vector3.up)); //transform.LookAt(superCleanedCoordinates[i - 1] } firstObject.transform.LookAt(secondObject.transform); }
public static string getPhoneNumberForSpecificUser(String username) { if (username != null && username != "") { List <PhoneNumberPojo> phoneNumberList = ReadJSON.getPhoneNumberList(FileUtil.filePathPhoneNumber); foreach (PhoneNumberPojo currentReg in phoneNumberList) { if (currentReg.Username == username) { return(currentReg.PhoneNumber); } } } return(null); }
protected virtual void Init() { _outline = GetComponent <Outline>(); if (_outline != null) { _outline.enabled = false; _outline.OutlineMode = Outline.Mode.OutlineVisible; } _player = ReInput.players.GetPlayer(0); if (interactionLabel != "") { _interactionName = ReadJSON.GetCorrectTextInteraction(interactionLabel); } OptionScreen.OnUpdate += UpdateInteractionName; }
void InitGame() { boardScript = GetComponent <BoardManager>(); rooms = new List <Room>(); // for new game empty rooms int[][] randLvls = LevelGenerator.Instance.GenerateLevel(difficulty); List <Room> possibleRooms = new List <Room>(); for (int i = 1; i <= numOfLevels; i++) { possibleRooms.Add(ReadJSON.loadRoomWithId(i)); } List <Room> possibleBossRooms = new List <Room>(); for (int i = 1; i <= numOfBossLevels; i++) { Room b = ReadJSON.loadBossRoomWithId(i); b.isBoss = true; possibleBossRooms.Add(b); } List <Room> possibleKeyRooms = new List <Room>(); for (int i = 1; i <= numOfKeyLevels; i++) { possibleKeyRooms.Add(ReadJSON.loadKeyRoomWithId(i)); } for (int x = 0; x < randLvls.Length; x++) { for (int y = 0; y < randLvls[x].Length; y++) { RoomType type = (RoomType)randLvls[x][y]; Room r = null; switch (type) { case RoomType.Spawn: List <Room> spawnList = new List <Room>(); spawnList.Add(ReadJSON.loadRoomWithId(0)); r = findFittingRoom(randLvls, spawnList, x, y); break; case RoomType.Normal: r = findFittingRoom(randLvls, possibleRooms, x, y); break; case RoomType.Bonus: r = findFittingRoom(randLvls, possibleRooms, x, y); //TODO throw not implemented exception ;) break; case RoomType.Boss: r = findFittingRoom(randLvls, possibleBossRooms, x, y); break; case RoomType.Key: r = findFittingRoom(randLvls, possibleKeyRooms, x, y); break; case RoomType.Trap: r = findFittingRoom(randLvls, possibleRooms, x, y); //TODO throw not implemented exception ;) break; } if (r != null) { r.x = x; r.y = y; r.cleared = false; rooms.Add(r); } Debug.Log(rooms); } } if (player == null) { player = Instantiate(playerPrefab, new Vector3(7, 7, 0f), Quaternion.identity) as GameObject; } player.GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f); //reset color of sprite renderer HealthScript hs = player.GetComponent <HealthScript>(); hs.hp = playerLives; addScore(0); hasKey = false; LoadLevelWithCoords(7, 7, true); enabled = true; }
void Start() { List <Vector3> points = ClearForDungeon.Points(ReadJSON.pointsV3(jsonFileName), radius); if (points[1].x > points[0].x) { Instantiate(rightOpen, points[0], Quaternion.identity); } else if (points[1].x < points[0].x) { Instantiate(leftOpen, points[0], Quaternion.identity); } else if (points[1].z > points[0].z) { Instantiate(topOpen, points[0], Quaternion.identity); } else { Instantiate(bottomOpen, points[0], Quaternion.identity); } for (int i = 1; i < points.Count - 1; i++) { //Instantiate(testPrefab, points[i], Quaternion.identity); //if ((points[i].x > points[i - 1].x && points[i].x < points[i + 1].x) || // (points[i].x < points[i - 1].x && points[i].x > points[i + 1].x)) { // Instantiate(leftRightOpen, points[i], Quaternion.identity); //} //else if ((points[i].z > points[i - 1].z && points[i].z < points[i + 1].z) || // (points[i].z < points[i - 1].z && points[i].z > points[i + 1].z)) { // Instantiate(topBottomOpen, points[i], Quaternion.identity); //} if (points[i].x > points[i - 1].x) { if (points[i].x < points[i + 1].x) { Instantiate(leftRightOpen, points[i], Quaternion.identity); } else if (points[i].z > points[i + 1].z) { Instantiate(bottomLeftOpen, points[i], Quaternion.identity); } else { Instantiate(leftTopOpen, points[i], Quaternion.identity); } } else if (points[i].x < points[i - 1].x) { if (points[i].x > points[i + 1].x) { Instantiate(leftRightOpen, points[i], Quaternion.identity); } else if (points[i].z > points[i + 1].z) { Instantiate(rightBottomOpen, points[i], Quaternion.identity); } else { Instantiate(topRightOpen, points[i], Quaternion.identity); } } else if (points[i].z > points[i - 1].z) { if (points[i].x > points[i + 1].x) { Instantiate(bottomLeftOpen, points[i], Quaternion.identity); } else if (points[i].x < points[i + 1].x) { Instantiate(rightBottomOpen, points[i], Quaternion.identity); } else { Instantiate(topBottomOpen, points[i], Quaternion.identity); } } else { if (points[i].x > points[i + 1].x) { Instantiate(leftTopOpen, points[i], Quaternion.identity); } else if (points[i].x < points[i + 1].x) { Instantiate(topRightOpen, points[i], Quaternion.identity); } else if (points[i].z > points[i + 1].z) { Instantiate(topBottomOpen, points[i], Quaternion.identity); } } } if (points[points.Count - 1].x > points[points.Count - 2].x) { Instantiate(leftOpen, points[points.Count - 1], Quaternion.identity); } else if (points[points.Count - 1].x < points[points.Count - 2].x) { Instantiate(rightOpen, points[points.Count - 1], Quaternion.identity); } else if (points[points.Count - 1].z > points[points.Count - 2].z) { Instantiate(bottomOpen, points[points.Count - 1], Quaternion.identity); } else { Instantiate(topOpen, points[points.Count - 1], Quaternion.identity); } }
void UpdateInteractionName() { _interactionName = ReadJSON.GetCorrectTextInteraction(interactionLabel); }
private int GetScore() { return(ReadJSON.Read(scoreJsonPath).gameResult); }