public RepoCheck() { jm = new JSONManager(); tb = new OrientTokenBuilder(); tc = new TypeConverter(); ocb = new OrientCommandBuilder(); wm = new WebManager(); wr = new WebResponseReader(); repo = new OrientRepo(jm, tb, tc, ocb, wm, wr); s = new SubUnit(); p = new Person() { Name = "0", GUID = "0", Changed = new DateTime(2017, 01, 01, 00, 00, 00), Created = new DateTime(2017, 01, 01, 00, 00, 00) }; u = new Unit() { Name = "0", GUID = "0", Changed = new DateTime(2017, 01, 01, 00, 00, 00), Created = new DateTime(2017, 01, 01, 00, 00, 00) }; m = new MainAssignment() { Name = "0", GUID = "0", Changed = new DateTime(2017, 01, 01, 00, 00, 00), Created = new DateTime(2017, 01, 01, 00, 00, 00) }; lp = new List <string>(); lu = new List <string>(); }
/// <summary> /// Submit and save all the info for later use /// </summary> public void SubmitInfo() { User myUser = new User() { Name = FormTexts[0].text, Age = int.Parse(FormTexts[1].text), Gender = FormTexts[2].text, Star = FormTexts[3].text, DeviceID = SystemInfo.deviceUniqueIdentifier }; print(myUser.DeviceID + myUser.Name); print(myUser.Name); print(myUser.Gender); string path = Path.Combine(Application.persistentDataPath, "UserInfo.json"); JSONManager.SerializeData(myUser, path); FormPanel.SetActive(false); PlayerPrefs.SetString("name", myUser.Name); PlayerPrefs.Save(); UserInfoCollected?.Invoke(myUser); }
public void send(ApplicationIcon toSend) { toSend.id = AudioSession.getCode(toSend.id); string data = tag + JSONManager.serialize(toSend); connection.send(data); }
private void assetInitialization() { g_ButtonManager = this.GetComponent <ButtonClicking>(); g_JsonManager = this.GetComponent <JSONManager>(); g_SelectedElementTransform = null; g_AnnotationCounter = 0; }
public void handleMessage(string message) { message = message.Substring(Tag.Length); AudioSession session = JSONManager.deserialize <AudioSession>(message).toSessionId(); Main.Instance.audioManager.updateChangedSession(session); }
// Use this for initialization void Start() { if (g_BackgroundImage == null) { g_BackgroundImage = GameObject.Find("BackgroundImage"); if (g_BackgroundImage == null) { Debug.LogError("Could not load background Image"); } } GameObject JsonContainer = GameObject.Find("EventSystem"); if (JsonContainer == null) { Debug.LogError("Could not load Event System"); } #if ENABLE_WINMD_SUPPORT g_JsonManager = JsonContainer.GetComponent <JSONManager>(); onInitiated(); #else g_WebcamTexture = new WebCamTexture(); g_BackgroundImage.GetComponent <Renderer>().material.mainTexture = g_WebcamTexture; g_WebcamTexture.Play(); #endif }
public string Initialize() { List <UserData> InitialList = new List <UserData>(); JSONManager.Serialize(InitialList, Directory.GetCurrentDirectory() + "/DotnetProjectData/UserData.json"); return("Initialized!"); }
public void send(string tag, AudioSession toSend) { toSend = toSend.toCodeId(); toSend.volume = (float)Math.Round(toSend.volume, 2); string data = tag + JSONManager.serialize(toSend); conn.send(data); }
public string Load() { TestData testData = new TestData(); testData = JSONManager.Deserialize <TestData>(Directory.GetCurrentDirectory() + "/DotnetProjectData/cooldata.json"); return(testData.CoolString + " " + testData.CoolInt.ToString()); }
static OrientRepo DefaultManagerInit(string databaseName = null, string hostPort_ = null) { string dbName; string login = ConfigurationManager.AppSettings["orient_login"]; string password = ConfigurationManager.AppSettings["orient_pswd"]; string dbHost = string.Format("{0}:{1}" , ConfigurationManager.AppSettings["OrientDevHost"] , ConfigurationManager.AppSettings["OrientPort"]); if (databaseName == null) { dbName = ConfigurationManager.AppSettings["OrientUnitTestDB"]; } else { dbName = databaseName; } if (hostPort_ == null) { dbHost = string.Format("{0}:{1}" , ConfigurationManager.AppSettings["OrientDevHost"] , ConfigurationManager.AppSettings["OrientPort"]); } else { dbName = hostPort_; } TypeConverter typeConverter = new TypeConverter(); JsonManagers.JSONManager jsonMnager = new JSONManager(); TokenMiniFactory tokenFactory = new TokenMiniFactory(); UrlShemasExplicit UrlShema = new UrlShemasExplicit( new CommandBuilder(tokenFactory, new FormatFactory()) , new FormatFromListGenerator(new TokenMiniFactory()) , tokenFactory, new OrientBodyFactory()); BodyShemas bodyShema = new BodyShemas(new CommandFactory(), new FormatFactory(), new TokenMiniFactory(), new OrientBodyFactory()); UrlShema.AddHost(dbHost); WebResponseReader webResponseReader = new WebResponseReader(); WebRequestManager webRequestManager = new WebRequestManager(); webRequestManager.SetCredentials(new NetworkCredential(login, password)); CommandFactory commandFactory = new CommandFactory(); FormatFactory formatFactory = new FormatFactory(); OrientQueryFactory orientQueryFactory = new OrientQueryFactory(); OrientCLRconverter orientCLRconverter = new OrientCLRconverter(); CommandShemasExplicit commandShema_ = new CommandShemasExplicit(commandFactory, formatFactory, new TokenMiniFactory(), new OrientQueryFactory()); return(new OrientRepo(typeConverter, jsonMnager, tokenFactory, UrlShema, bodyShema, commandShema_ , webRequestManager, webResponseReader, commandFactory, formatFactory, orientQueryFactory, orientCLRconverter)); }
public void FacadeSimpleDictionaryTest() { string json = "\r\n {\r\n \"test1\" : 5,\r\n \"test2\" : 10,\r\n \"test3\" : \"asdf\"\r\n }"; IDictionary dictionaryForJson = JSONManager.getDictionaryForJson(json); Assert.IsTrue(dictionaryForJson.Count == 3); Assert.AreEqual((int)dictionaryForJson["test1"], 5); Assert.AreEqual((int)dictionaryForJson["test2"], 10); Assert.AreEqual((string)dictionaryForJson["test3"], "asdf"); }
public static void JsonManagerCheck() { string hs = "{ \"GUID\": \"542ceb48-8454-11e4-acb0-00c2c66d13b0\", \"Holidays\": [{ \"Position\": \"Главный специалист\", \"Holidays\": [{ \"LeaveType\": \"Основной\", \"Days\": 13 }] }, { \"Position\": \"Ведущий специалист\", \"Holidays\": [{ \"LeaveType\": \"Основной\", \"Days\": 13 }] }] } "; hs = "[ { \"GUID\": \"542ceb48-8454-11e4-acb0-00c2c66d13b0\", \"Position\": \"Главный специалист\", \"Holidays\": [ { \"LeaveType\": \"Основной\", \"Days\": 13 } ] }, { \"GUID\": \"542ceb48-8454-11e4-acb0-00c2c66d13b0\", \"Position\": \"Ведущий специалист\", \"Holidays\": [ { \"LeaveType\": \"Основной\", \"Days\": 0 } ] } ] "; JSONManager jm = new JSONManager(); IEnumerable <List <AdinTce.Holiday> > a = jm.DeserializeFromParentChildren <List <AdinTce.Holiday> >(hs, "Holidays"); }
public void FacadeSimpleListTest() { string json = "[\r\n \"Adam\",\r\n \"Danny\",\r\n \"James\",\r\n \"Justin\"\r\n ]"; IList listForJson = JSONManager.getListForJson(json); Assert.IsTrue(listForJson.Count == 4); Assert.AreEqual((string)listForJson[0], "Adam"); Assert.AreEqual((string)listForJson[1], "Danny"); Assert.AreEqual((string)listForJson[2], "James"); Assert.AreEqual((string)listForJson[3], "Justin"); }
public string Save(string a, int b) { TestData testData = new TestData(); testData.CoolString = a; testData.CoolInt = b; JSONManager.Serialize(testData, Directory.GetCurrentDirectory() + "/DotnetProjectData/cooldata.json"); return("Saved: " + testData); }
public void FacadeDeserializeToTemplatedObject() { string json = "\r\n {\r\n \"title\" : \"First\",\r\n \"name\" : \"First Window\",\r\n \"width\" : 640,\r\n \"height\" : 480\r\n }"; UiWindow uiWindow = null; uiWindow = JSONManager.getTemplatedTypeForJson <UiWindow>(json); Assert.IsNotNull(uiWindow); Assert.AreEqual(uiWindow.title, "First"); Assert.AreEqual(uiWindow.name, "First Window"); Assert.AreEqual(uiWindow.width, 640); Assert.AreEqual(uiWindow.height, 480); }
public void FacadeSerializeWithPrintableFormattingTest() { IDictionary dictionary = new Dictionary <string, object>(); dictionary["rolling"] = "stones"; dictionary["flaming"] = "pie"; dictionary["nine"] = 9; string actual = "\r\n{\r\n \"rolling\" : \"stones\",\r\n \"flaming\" : \"pie\",\r\n \"nine\" : 9\r\n}"; string expected = JSONManager.serializeToJson(dictionary, usePrintableFormatting: true); Assert.AreEqual(expected, actual); }
public void send(AudioSession[] toSend) { AudioSession[] finalSend = new AudioSession[toSend.Length]; for (int i = 0; i < toSend.Length; i++) { toSend[i].volume = (float)Math.Round(toSend[i].volume, 2); finalSend[i] = toSend[i].toCodeId(); } string data = tag + JSONManager.serialize(finalSend); conn.send(data); }
public string GetUser(Guid guid) { DotnetProjectData.UserDataList = JSONManager.Deserialize <List <UserData> >(Directory.GetCurrentDirectory() + "/DotnetProjectData/UserData.json"); if (DotnetProjectData.UserDataList.Find(data => data.UserGUID == guid) != null) { return(DotnetProjectData.UserDataList.Find(data => data.UserGUID == guid).UserName); } else { return("Error: User data does not exist."); } }
//FUNCTIONAL TESTS public static void UOWFunctionalCheck() { //GET CLASS Managers.Manager mngCl = new Managers.Manager("dev_db", null); IOrientRepo rp = mngCl.GetRepo(); GetClass gc = rp.GetClass <Person>("dev_db", null); //Managers.Manager mng = new Managers.Manager(ConfigurationManager.AppSettings["OrientDevDB"],null); Managers.Manager mng = new Managers.Manager(ConfigurationManager.AppSettings["OrientUnitTestDB"], null); Managers.Manager mngSource = new Managers.Manager(ConfigurationManager.AppSettings["OrientSourceDB"], null); PersonUOWs.PersonUOW pu = mng.GetPersonUOW(); NewsUOWs.NewsRealUow nu = mng.GetNewsUOW(); Managers.Manager mngPerson = new Managers.Manager(ConfigurationManager.AppSettings["OrientSourceDB"]); PersonUOWs.PersonUOW personToGetUOW = mngPerson.GetPersonUOW(); POCO.News newsToAdd0 = new News() { GUID = "119", content = "s \"a \"a t " }; POCO.Person newsMaker = pu.SearchByName("Neprintsevia").FirstOrDefault(); POCO.Person likeMaker = pu.SearchByName("Person1").FirstOrDefault(); POCO.Person troubleMaker = pu.SearchByName("Person0").FirstOrDefault(); GETparameters gp = new GETparameters() { offest = 5, published = true, pinned = true, asc = true, author = newsMaker }; JSONManager jm = new JSONManager(); //ABSENT PERSON CHECK Random rnd = new Random(); //News ns = nu.GetNewsByGUID("2370b972-48d4-4e49-95ad-b99ba5382042"); //News ns = nu.GetNewsByGUID("e7bc87ec-f649-4748-b4cb-d2863f780f1c"); //nu.GetNewsByGUID("f7557c27-f889-4aab-91ce-ba15e34e3981"); //News ns = nu.GetNewsByGUID("f7557c27-f889-4aab-91ce-ba15e34e3981"); var a = nu.GetNews(5, null, null); int acc = (int)rnd.Next(0, 10000); Person personAbsent = new Person() { Name = "PersonAbsent", sAMAccountName = "absent" + acc }; string newsContent = "{\"conntent_\":\"news text\",\"name\":\"News name\"}"; }
public static void SaveHighscore(string name, int points) { // Print the highscore highscores.Add(new Highscore(points, name)); highscores.Sort(new HighscoreComparer()); JSONManager.Save("Highscores", highscores); // Reset variables PlayerSpawnPosition = Vector3.zero; playerStats = new PlayerStats(0, 1, 0); // Load main menu SceneManager.LoadScene("MainMenu"); }
public void FacadeMixedNestedTest() { string json = "\r\n {\r\n \"testKey1\":\r\n [\r\n {\r\n \"testB1\" : 6,\r\n \"testB2\" : \"hi\"\r\n },\r\n \"testA2\",\r\n \"testA3\"\r\n ],\r\n\r\n \"testKey2\":\r\n {\r\n \"testB1\" : true,\r\n \"testB2\" : false,\r\n \"testB3\" : null\r\n }\r\n }"; IDictionary dictionaryForJson = JSONManager.getDictionaryForJson(json); Assert.IsTrue(dictionaryForJson != null && dictionaryForJson.Count == 2); IList list = (IList)dictionaryForJson["testKey1"]; Assert.IsTrue(list != null && list.Count == 3); IDictionary dictionary = (IDictionary)list[0]; Assert.IsTrue(dictionary != null && dictionary.Count == 2); Assert.AreEqual(dictionary["testB1"], 6); Assert.AreEqual(dictionary["testB2"], "hi"); }
public new void store(string name, List <Directories> hierarchie = null, bool use_install_folder = false) { hierarchie ??= new List <Directories>(); hierarchie.AddRange(hierVal.AsEnumerable()); base.store(name + endingSol, hierarchie, use_install_folder); string path_o = path_Val; path_Val = CreatePathToFile(out _, name + endingVal, "JSON", hierarchie, use_install_folder); JSONManager.WriteToJsonFile(path_Val, this.ValidationSet, 0); path_Val = path_o; hierarchie.RemoveRange(hierarchie.Count - hierVal.Count, hierVal.Count); }
void Start() { deactivatePlayerCollisions(); uiManager = FindObjectOfType <UIManager>(); transform.position = GameManager.PlayerSpawnPosition; drunkMaluses = JSONManager.Load <Dictionary <GameManager.Drunkness, DrunkMalus> >("DrunkMaluses"); DrunkMalus currentDrunkMalus = drunkMaluses[GameManager.DrunkLevel]; nextKeyRandomizationTime = Time.time + GaussianDistribution.Generate(currentDrunkMalus.keyRandomizationMeanTime, currentDrunkMalus.keyRandomizationVarianceTime); }
public void SaveResourceCatalog() { List <AppResource> list = (TestCatalog = new List <AppResource>()); foreach (KeyValuePair <string, AppResource> item in ResourceCatalog) { if (item.Value.ShouldSaveToCatalog()) { list.Add(item.Value); } } string text = JSONManager.serializeToJson(list); DisneyMobile.CoreUnitySystems.Logger.LogInfo(this, "Resource Catalog Saved : " + text); FileManager.SaveTextFile(AppResource.ResourceSaveLocation, "AppResourceCatalog.txt", text); }
private IEnumerator StartResourceVersionCheck() { if (ResourceVersioncheckInProgress) { } ResourceVersioncheckInProgress = true; string url = GetAMPSAssetListInfoCallURL(); WWW www = new WWW(url); yield return(www); bool noErrors = www.isDone && www.error == null && www.text != null; if (www.error != null) { DisneyMobile.CoreUnitySystems.Logger.LogWarning(this, "DoResourceVersionCheck www.error=" + www.error); ShowAMPSDownloadError("Msg_DownloadFailLong", "UIManagerOz::StartResourceVersionCheck error=" + www.error); noErrors = false; } if (noErrors) { try { AMPSAssetList = JSONManager.getTemplatedTypeForJson <AMPVersionResultData>(www.text); if (AMPSAssetList == null) { DisneyMobile.CoreUnitySystems.Logger.LogFatal(this, "Deserialization AMPS asset list data failed " + url); noErrors = false; } } catch (Exception ex) { Debug.LogError("deserialization exception " + url + " exception=" + ex); ShowAMPSDownloadError("Msg_DownloadFailLong", "UIManagerOz::StartResourceVersionCheck: deserialization exception. url=" + url + " exception=" + ex); noErrors = false; } } if (noErrors) { OnCatalogDownloaded(AMPSAssetList.GetResourceCatalog()); } else { OnCatalogDownloaded(null); } ResourceVersioncheckInProgress = false; }
public void FacadeSerializeToJsonTest() { Dictionary <string, object> dictionary = new Dictionary <string, object>(); Dictionary <string, object> dictionary2 = new Dictionary <string, object>(); List <object> list = new List <object>(); dictionary2.Add("testB1", 7); dictionary2.Add("testB2", "dataB2"); list.Add(5); list.Add("testC"); dictionary.Add("testA1", dictionary2); dictionary.Add("testA2", list); string expected = JSONManager.serializeToJson(dictionary); string actual = "{\"testA1\":{\"testB1\":7,\"testB2\":\"dataB2\"},\"testA2\":[5,\"testC\"]}"; Assert.AreEqual(expected, actual); }
public static bool load(ref FactOrganizer set, bool draw, string name, List<Directories> hierarchie, bool use_install_folder, out Dictionary<string, string> old_to_new) { old_to_new = null; hierarchie ??= new List<Directories>(); hierarchie.AddRange(hierState.AsEnumerable()); string path = CreatePathToFile(out bool loadable, name, "JSON", hierarchie, use_install_folder); hierarchie.RemoveRange(hierarchie.Count - hierState.Count, hierState.Count); if (!loadable) return false; PublicFactOrganizer de_json = JSONManager.ReadFromJsonFile<PublicFactOrganizer>(path); FactOrganizerFromPublic(ref set, de_json, draw, out old_to_new); set.path = path; return true; }
public static bool load(ref SolutionOrganizer set, bool draw, string name, List <Directories> hierarchie = null, bool use_install_folder = false) { hierarchie ??= new List <Directories>(); hierarchie.AddRange(hierVal.AsEnumerable()); string path = CreatePathToFile(out bool loadable, name + endingVal, "JSON", hierarchie, use_install_folder); if (!loadable) { hierarchie.RemoveRange(hierarchie.Count - hierVal.Count, hierVal.Count); return(false); } FactOrganizer save = StageStatic.stage.factState; StageStatic.stage.factState = new SolutionOrganizer(false) as FactOrganizer; loadable = FactOrganizer.load(ref StageStatic.stage.player_record.factState , draw, name + endingSol, hierarchie, use_install_folder, out Dictionary <string, string> old_to_new); if (loadable) { set = (SolutionOrganizer)StageStatic.stage.factState; set.path_Val = path; } StageStatic.stage.factState = save; hierarchie.RemoveRange(hierarchie.Count - hierVal.Count, hierVal.Count); if (!loadable) { return(false); } var JsonTmp = JSONManager.ReadFromJsonFile <List <SubSolution> > (path); foreach (var element in JsonTmp) // Parse and add { element.MasterIDs = new HashSet <string>(element.MasterIDs.Select(k => old_to_new[k])); set.ValidationSet.Add(element); } return(true); }
public void store(string name, List<Directories> hierarchie = null, bool use_install_folder = false, bool force_write = true) { hierarchie ??= new List<Directories>(); hierarchie.AddRange(hierState.AsEnumerable()); string path_o = path; path = CreatePathToFile(out bool exists, name, "JSON", hierarchie, use_install_folder); hierarchie.RemoveRange(hierarchie.Count - hierState.Count, hierState.Count); // note: max depth for "this" is 2, since Fact has non-serilazible member, that is not yet ignored (see Fact.[JasonIgnore] and JSONManager.WriteToJsonFile) // using public dummy class to circumvent deserialiation JsonInheritanceProblem (see todos @PublicFactOrganizer) if(!exists || force_write) JSONManager.WriteToJsonFile(path, new PublicFactOrganizer(this), 0); path = path_o; }
public static bool ShallowLoad(ref Stage set, string path) { if (!System.IO.File.Exists(path)) { return(false); } set = JSONManager.ReadFromJsonFile <Stage>(path); set.path = path; set.hierarchie ??= new List <Directories>(); set.hierarchie.AddRange(hierStage.AsEnumerable()); //if (!set.player_record.load(set.hierarchie)) // set.player_record = new PlayerRecord(set.record_name); set.hierarchie.RemoveRange(set.hierarchie.Count - hierStage.Count, hierStage.Count); return(true); }