public void Run()
        {
            var writer = new Writers.TextWriter(Console.Out);
            var manager = new JsonManager();
            manager.Subscribe(writer);

            manager.WriteData();
        }
        public void ParseShouldGenerateSpecifiedObject()
        {
            string playerJson = "{\"Name\":\"Mara\",\"Score\":1024}";
            var jsonManager = new JsonManager();

            Player mara = jsonManager.Parse<Player>(playerJson);

            Assert.AreEqual(expected: "Mara", actual: mara.Name);
            Assert.AreEqual(expected: 1024, actual: mara.Score);
        }
Exemplo n.º 3
0
        static void getData()
        {
            dataMapping = new Dictionary <string, ItemData>();
            JObject obj = JsonManager.GetInstance().GetJson("ItemDatas", false);

            foreach (var item in obj)
            {
                if (item.Key != "0")
                {
                    dataMapping.Add(item.Value["Id"].ToString(), JsonManager.GetInstance().DeserializeObject <ItemData>(item.Value.ToString()));
                }
            }
            fetchData();
        }
Exemplo n.º 4
0
        public async System.Threading.Tasks.Task CalanderJsonFeedAsync()
        {
            var httpClient = new HttpClient();
            var result     = await httpClient.GetAsync($"https://{configuration.Account}.churchsuite.co.uk/embed/calendar/json");

            var resultString = await result.Content.ReadAsStringAsync();

            var settings = new JsonSerializerSettings()
            {
                MissingMemberHandling = MissingMemberHandling.Error
            };
            var cleanedResultString = JsonManager.EmptyArraysToNull(resultString);
            var calander            = JsonConvert.DeserializeObject <List <Models.Calendar> >(cleanedResultString, settings);
        }
Exemplo n.º 5
0
        private void OptionsForm_Load(object sender, EventArgs e)
        {
            JsonManager.GetPreferences();
            TopMost = true;

            robloxOnTopCheckBox.Checked  = GlobalVars.RobloxOnTop;
            bloxxerOnTopCheckBox.Checked = GlobalVars.BloxxerOnTop;
            injectExecCheckBox.Checked   = GlobalVars.InjectOnExecution;
            scriptExecCheckBox.Checked   = GlobalVars.ExecutionMessage;
            notifyOption.SelectedIndex   = GlobalVars.ExecutionMessageMethod;
            themeOption.SelectedIndex    = GlobalVars.Theme;
            notifyOption.Enabled         = GlobalVars.ExecutionMessage;
            notifyLabel.ForeColor        = GlobalVars.ExecutionMessage ? SystemColors.Window : SystemColors.ScrollBar;
        }
Exemplo n.º 6
0
    public Monster lookupMonster(int monsterId)
    {
        Monster monster = JsonManager.readJson <Monster>(e_Paths.JSON_MONSTERS);

        //Monster monster = JsonUtility.FromJson<Monster>(File.ReadAllText("C:/Users/Jesper/AppData/LocalLow/Wojon/GameServer/Resources/Visuals/Monster.json"));
        foreach (Monster m in monster.Monsters)
        {
            if (m.id == this.getId())
            {
                return(m);
            }
        }
        return(null);
    }
Exemplo n.º 7
0
        public ActionResult ConvertToJson(string searchText)
        {
            if (PreviousResults.Count < 1)
            {
                return(RedirectToAction("Index"));
            }
            var jsonManager = new JsonManager();
            var json        = jsonManager.SerializeToJson(PreviousResults);
            //new JavaScriptSerializer().Serialize(PreviousResults);
            var fileManager = new FileManager();

            fileManager.SaveToFile(json);
            return(RedirectToAction("Index"));
        }
        public void ToStringRepresentationShouldGenerateCorrectJsonString()
        {
            string playerJson = "{\"Name\":\"Mara\",\"Score\":1024}";
            var jsonManager = new JsonManager();
            var mara = new Player()
            {
                Name = "Mara",
                Score = 1024
            };

            string stringMara = jsonManager.ToStringRepresentation(mara);

            Assert.AreEqual(playerJson, stringMara);
        }
Exemplo n.º 9
0
 public static void CreateSingleton(GameManager GameManager)
 {
     if (!instance)
     {
         GameObject container = new GameObject();
         container.name   = "JsonManager";
         instance         = container.AddComponent <JsonManager>();
         GameManager.Json = instance;
     }
     else
     {
         Debug.Log("MapManager가 이미 존재합니다");
     }
 }
Exemplo n.º 10
0
        public ActionResult ImportFromJson()
        {
            var fileManager = new FileManager();
            var jsonString  = fileManager.LoadFile();
            var jsonManager = new JsonManager();
            var jsonResult  = jsonManager.DeserializeJson(jsonString);
            var model       = new SearchCriteria()
            {
                SearchResults = jsonResult
            };

            PreviousResults = jsonResult;
            return(RedirectToAction("Index", model));
        }
Exemplo n.º 11
0
 public static void LoadData()
 {
     try
     {
         var list = JsonManager.LoadJsonArray <JDebugCommandData>("JsonData", "DebugCommand");
         foreach (var data in list)
         {
             dataMap[data.ID] = data;
         }
     }
     catch (Exception ex)
     {
     }
 }
Exemplo n.º 12
0
        public void GetAllUsersUsername(Action <string> OnMultipleActionsEnd = null, List <UserDB> usersList = null)
        {
            //Little non-sense example to show how Recursive petitions works

            usersList = new List <UserDB>();
            //First get all users
            this.GetAllUsers((allUsersResult) =>
            {
                if (WebResponse.isResultOk(allUsersResult))
                {
                    //Convert it from array to List to follow the method signature
                    string multipleUsersString = WebResponse.GetResponseInfo(allUsersResult);
                    UserDB[] usersArray        = JsonManager.DeserializeFromJsonArray <UserDB>(multipleUsersString);

                    foreach (UserDB user in usersArray)
                    {
                        usersList.Add(user);
                    }

                    //HERE STARTS THE RECURSIVE PETITIONS
                    bool isAllOk = true;
                    int i        = 0;
                    foreach (UserDB user in usersList)
                    {
                        this.GetUserInfoFromID((userInfoResult) =>
                        {
                            if (WebResponse.isResultOk(userInfoResult))
                            {
                                string userString = WebResponse.GetResponseInfo(userInfoResult);
                                UserDB auxUserDB  = JsonManager.DeserializeFromJson <UserDB>(userString);

                                ExampleDBController.s_Instance.AddUsernameToList(auxUserDB);
                            }
                            else
                            {
                                isAllOk = false;
                            }

                            //Check if it's the last petition, and dispatch the end event of the global result
                            i++;
                            if (i == usersList.Count)
                            {
                                string generalResult = (isAllOk) ? WebResponse.OK : WebResponse.ERROR;
                                OnMultipleActionsEnd(generalResult);
                            }
                        }, user.UserID);
                    }
                }
            });
        }
Exemplo n.º 13
0
    public static void LoadSettings()
    {
        string src = Path.Combine(Environment.CurrentDirectory, "BlazeEngine");

        src += "\\data.json";
        if (!File.Exists(src))
        {
            SaveSettings();
            ConSole.Print(ConsoleColor.Red, "[Config] Not found!", "Creating file!");
            return;
        }
        settings = JsonManager.Reader(src);
        LoadDefaultSettings();
        ConSole.Print(ConsoleColor.Green, "[Config] Found! File loaded!");
    }
Exemplo n.º 14
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app.UseOpenApi();
            app.UseSwaggerUi3(c => {
                c.DefaultModelsExpandDepth = -1;
            });

            app.UseMvc();

            JsonManager.InitializeDatabase();
        }
        private void LoadJsonDataInDatabase(ModelBuilder modelBuilder)
        {
            var jsonManager = new JsonManager(modelBuilder);

            //try
            //{
            jsonManager.RegisterJson <User>("users.json");
            jsonManager.RegisterJson <IdentityUserRole <string> >("userRoles.json");
            jsonManager.RegisterJson <IdentityRole>("roles.json");
            //}
            //catch (Exception)
            //{
            //    return;
            //}
        }
Exemplo n.º 16
0
 private static string GetPath()
 {
     if (Directory.Exists(f_gameSettings))
     {
         if (Directory.GetFiles(f_gameSettings).Length > 0)
         {
             return(JsonManager.GetFilePath(AssetDatabase.LoadAssetAtPath <SaveLoadScriptable>(f_gameSettings + "SaveLoadSettings.asset").filePath));
         }
         return(JsonManager.GetFilePath(FilePath.GameDataPath));
     }
     else
     {
         return(JsonManager.GetFilePath(FilePath.GameDataPath));
     }
 }
Exemplo n.º 17
0
        private void InitPreferences()
        {
            JsonManager.GetPreferences();

            if (!TopMost)
            {
                TopMost = GlobalVars.BloxxerOnTop;
            }

            Process[] roblox = Process.GetProcessesByName("RobloxPlayerBeta");
            if (roblox.Length == 1)
            {
                SetWindowPos(roblox[0].MainWindowHandle, (GlobalVars.RobloxOnTop ? HWND_TOPMOST : HWND_NOTOPMOST), 0, 0, 0, 0, TOPMOST_FLAGS);
            }
        }
Exemplo n.º 18
0
        public void JsonManager_LoadRepository_IsCorrect()
        {
            var itemsExpected = new FakeJsonCollection().Collection.ToArray();

            var repositoryAct = new JsonManager(Path.Combine(pathToFolder, "fake_source_json_act.json"));

            var itemsAct = repositoryAct.Load().ToArray();

            Assert.IsTrue(itemsExpected.Length == itemsAct.Length);

            for (var i = 0; i < itemsAct.Length; i++)
            {
                Assert.IsTrue(itemsExpected[i].Equals(itemsAct[i]));
            }
        }
Exemplo n.º 19
0
    void LoadSuc(WWW www)
    {
        Debug.Log(www.text);
        var data = JsonManager.GetSfzSucData(www.text);

        Debug.Log(data.detail);
        if (data.result == 1)
        {
            CheckIdComplete();
        }
        else
        {
            UIManagers.Instance.EnqueueTip(data.detail);
        }
    }
Exemplo n.º 20
0
    // Use this for initialization
    void Start()
    {
        List <RoleData> roleDatas = new List <RoleData>();

        roleDatas.Add(JsonManager.GetInstance().GetMapping <RoleData>("RoleDatas", PlayerPrefs.GetString("FightEditorTestRoleId0")));
        roleDatas.Add(JsonManager.GetInstance().GetMapping <RoleData>("RoleDatas", PlayerPrefs.GetString("FightEditorTestRoleId1")));
        roleDatas.Add(JsonManager.GetInstance().GetMapping <RoleData>("RoleDatas", PlayerPrefs.GetString("FightEditorTestRoleId2")));
        roleDatas.Add(JsonManager.GetInstance().GetMapping <RoleData>("RoleDatas", PlayerPrefs.GetString("FightEditorTestRoleId3")));
        for (int i = 0; i < roleDatas.Count; i++)
        {
            roleDatas[i].MakeJsonToModel();
        }
        Messenger.Broadcast <RoleData, string>(NotifyTypes.CreateTestBattle, roleDatas[0], PlayerPrefs.GetString("FightEditorCurrentId"));
        RoleInfoPanelCtrl.Show(roleDatas);
    }
Exemplo n.º 21
0
    private static void SaveRecipeJson()
    {
        List <Recipe> recipes = new List <Recipe>();

        recipes.Add(new Recipe(new Dictionary <string, int>()
        {
            ["RottenApple"] = 2, ["Larva"] = 1
        }, "Apple"));
        recipes.Add(new Recipe(new Dictionary <string, int>()
        {
            ["Boar"] = 2, ["Larva"] = 1
        }, "Steak"));

        JsonManager.SaveJson(recipes);
    }
Exemplo n.º 22
0
    void Start()
    {
        string reader = JsonManager.ReadJsonFromFilePath(UnityHelper.LocalFilePath + "Web/", "PointMap.json");

        if (!string.IsNullOrEmpty(reader))
        {
            Debug.Log("reader不为空=====" + reader);
            pointData = JsonMapper.ToObject <PointClass>(reader);
            AddToLinkList(pointData);
        }
        else
        {
            Debug.Log("reader为空=====" + reader);
        }
    }
Exemplo n.º 23
0
        public static string GetForceInfo(HttpClient2 client)
        {
            string outputstr            = client.DownloadBytearr2(GlobalVal.ServerURL + "/root/gateway.action?command=player@getForceInfo", string.Empty, false);
            webAction_createrole action = (webAction_createrole)JsonManager.JsonToObject(outputstr, typeof(webAction_createrole));

            Reward jiangli = action.action.data.reward;

            /*魏:1 蜀:2 吴:3*/
            outputstr = client.Post_retbyte2(GlobalVal.ServerURL + "/root/gateway.action?command=player@setPlayerForce",
                                             string.Empty, "forceId=" + jiangli.forceId);

            Console.WriteLine(outputstr);

            return(outputstr);
        }
Exemplo n.º 24
0
    public void LoadPushJson()
    {
        string reader = JsonManager.ReadJsonFromFilePath(UnityHelper.LocalFilePath + "Push/" + PublicAttribute.AreaId + "/", "content.json");

        if (reader != null)
        {
            Debug.Log("reader不为空=====" + reader);
            pushPointClass = JsonMapper.ToObject <PushPointClass>(reader);
            AddToList(pushPointClass);
        }
        else
        {
            Debug.Log("reader为空=====" + reader);
        }
    }
Exemplo n.º 25
0
 private void btnAbrir_Click(object sender, EventArgs e)
 {
     if (!centroDeAtencion.AbrirNegocio)
     {
         this.centroDeAtencion.AbrirNegocio = true;
         this.btnAbrir.Text = "Cerrar Negocio";
     }
     else
     {
         this.centroDeAtencion.AbrirNegocio = false;
         this.btnAbrir.Text = "Abrir Negocio";
         //Guardar centro de atencion
         JsonManager <CentroDeAtencion> .Guardar(centroDeAtencion);
     }
 }
Exemplo n.º 26
0
    public static void SaveItemJson()
    {
        List <Food> foodList = new List <Food>();

        foodList.Add(new Food("Bread", 3));
        foodList.Add(new Food("Apple", 1));
        foodList.Add(new Food("Steak", 5));

        JsonManager.SaveJson(foodList);

        List <Sacrifice> sacrificeList = new List <Sacrifice>();

        sacrificeList.Add(new Sacrifice("RottenApple", 1, 1));
        sacrificeList.Add(new Sacrifice("Larva", 2, 2));
        sacrificeList.Add(new Sacrifice("Boar", 4, 3));

        JsonManager.SaveJson(sacrificeList);

        List <MeleeWeapon> meleeWeaponList = new List <MeleeWeapon>();

        meleeWeaponList.Add(new MeleeWeapon("GiantSword", 3, 0.4f));
        meleeWeaponList.Add(new MeleeWeapon("Knife", 1, 0.2f));
        meleeWeaponList.Add(new MeleeWeapon("DoubleAxe", 5, 0.6f));
        meleeWeaponList.Add(new MeleeWeapon("Hatchet", 5, 0.6f));

        JsonManager.SaveJson(meleeWeaponList);

        List <RangedWeapon> rangedWeaponList = new List <RangedWeapon>();

        rangedWeaponList.Add(new RangedWeapon("MiniSpear", "MiniSpear", new List <Vector2>()
        {
            new Vector2(1, 0)
        }, 0.3f));
        rangedWeaponList.Add(new RangedWeapon("LargeSpear", "LargeSpear", new List <Vector2>()
        {
            new Vector2(1, 0)
        }, 0.6f));
        rangedWeaponList.Add(new RangedWeapon("Staff", "FireBolt", new List <Vector2>()
        {
            new Vector2(1, 0), new Vector2(0, 1)
        }, 0.5f));
        rangedWeaponList.Add(new RangedWeapon("Wand", "FireBolt", new List <Vector2>()
        {
            new Vector2(1, 0), new Vector2(0, 1), new Vector2(1, 1)
        }, 0.7f));

        JsonManager.SaveJson(rangedWeaponList);
    }
Exemplo n.º 27
0
    public void NewPlayer()
    {
        PlayerPrefs.DeleteAll();

        JsonManager.SetInitialDataJson();
        JsonManager.SerializeSettings();

        SaveSystem.LastScene = "Intro";

        SceneManager.LoadScene("Intro", LoadSceneMode.Single);

        SaveSystem.wasLoaded = true;

        // Para evitar que se noten los cambios de audio bruscamente
        SoundManager.BackgroundMusic.mute = true;
    }
Exemplo n.º 28
0
        protected override void Initialize()
        {
            Window.Position     = new Point(0, 0);
            Window.IsBorderless = true;
            JsonManager <Settings> json = new JsonManager <Settings>();

            Settings        = json.Load("settings.json");
            Log             = new Log("Log", Settings.LogPath);
            Camera          = new Camera(GraphicsDevice, Settings.CameraWidth, Settings.CameraHeight);
            GraphicsDisplay = new GraphicsDisplay(graphics, Window, Camera);
            GraphicsDisplay.SetResolution(Settings.ScreenWidth, Settings.ScreenHeight);
            Log.WriteLine("====> Starting Launcher.");
            Log.WriteLine("====> Initialization complete.");
            ValidateSettings();
            base.Initialize();
        }
Exemplo n.º 29
0
        public static void LevantarDatos()
        {
            //Cargar Clientes

            JsonManager.LoadJson(ClientesArchivo);
            Clientes = JsonConvert.DeserializeObject <List <Cliente> >(JsonManager.JsonString);

            //Cargar Administradores
            JsonManager.LoadJson(AdministradoresArchivo);
            Administradores = JsonConvert.DeserializeObject <List <Administrador> >(JsonManager.JsonString);

            //Cargar Dispositivos

            JsonManager.LoadJson(DispositivosArchivo);
            Dispositivos = JsonConvert.DeserializeObject <List <Dispositivo> >(JsonManager.JsonString);
        }
Exemplo n.º 30
0
    void Awake()
    {
        treeName = Application.dataPath + @"\" + treeName;
        dataName = Application.dataPath + @"\" + dataName;

        data = new DataTable();

        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
    }
Exemplo n.º 31
0
        public HomeController(IOptions <Config> options, IOptions <ModuleContainer> moduleOptions, JsonManager <SiteData> siteDataManager)
        {
            Options         = options.Value;
            ModuleConfig    = moduleOptions.Value;
            SiteDataManager = siteDataManager;

            if (SiteDataManager.JsonObject.UsersLoggedIn == null)
            {
                SiteDataManager.JsonObject.UsersLoggedIn = new List <string>();
            }

            if (SiteDataManager.JsonObject.VisitorAddresses == null)
            {
                SiteDataManager.JsonObject.VisitorAddresses = new List <string>();
            }
        }
Exemplo n.º 32
0
            /// <summary>
            /// 구조체 전송
            /// </summary>
            /// <typeparam name="T"></typeparam>
            /// <param name="msgType"></param>
            /// <param name="obj"></param>
            public void Send <T>(int msgType, T obj)
            {
                byte[] data = JsonManager.ObjectToBytes(obj);

                Header header = new Header(msgType, data.Length);

                byte[] head = JsonManager.ObjectToBytes(header);

                // 최종 전송할 패킷(헤더 + 데이터) 바이트화
                byte[] packet = new byte[head.Length + data.Length];
                Buffer.BlockCopy(head, 0, packet, 0, head.Length);
                Buffer.BlockCopy(data, 0, packet, head.Length, data.Length);

                // _socket.BeginSend(packet, 0, packet.Length, 0, new AsyncCallback(SendCallback), _socket);
                _socket.Send(packet, packet.Length, SocketFlags.None);
            }
Exemplo n.º 33
0
        void writeDataToJson()
        {
            JObject writeJson = new JObject();
            int     index     = 0;

            foreach (SkillData data in dataMapping.Values)
            {
                if (index == 0)
                {
                    index++;
                    writeJson["0"] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
                }
                writeJson[data.Id] = JObject.Parse(JsonManager.GetInstance().SerializeObjectDealVector(data));
            }
            Base.CreateFile(Application.dataPath + "/Resources/Data/Json", "Skills.json", DESStatics.StringEncoder(JsonManager.GetInstance().SerializeObject(writeJson), JsonManager.DecderKey));
        }