Esempio n. 1
0
        JObject ISavable.Save()
        {
            var result = new JObjectCollection();

            // Add the CustomName field in the JSON stream with the name CustomName
            result.Add("CustomName", CustomName);

            // As CustomInArray is an array, it must be saved as a Json Array. First we'll create one. The add method will then return it to us so we can add stuff to it
            var customIntArrayObject = result.Add("CustomIntArray", new JObjectArray());

            // Add each element in the CustomInArray to our Json Array
            foreach (var item in CustomIntArray) {
                customIntArrayObject.Add(item);
            }

            // Return the newly constructed
            return result;
        }
Esempio n. 2
0
File: Song.cs Progetto: Tuputi/DDA
        public JObject JsonSave()
        {
            var result = new JObjectCollection();
            result.Add("DisplayName", DisplayName);
            result.Add("StepListName", StepListName);
            result.Add("ArtistName", ArtistName);
            result.Add("SongName", SongName);
            result.Add("MusicName", MusicName);
            result.Add("Difficulty", (int)Difficulty);
            result.Add("BeatsPerSecond", BeatsPerSecond);
            result.Add("SongLength", SongLength);
            result.Add("Snapping", (int)Snapping);

            var notesJObject = new JObjectArray();
            result.Add("Notes", notesJObject);
            foreach (var note in SongNotes) {
                notesJObject.Add(note.JsonSave());
            }

            return result;
        }