├── FNFDataAPI ├── FNFDataAPI.csproj ├── FNFDataAPI.sln ├── FNFDataAPI │ ├── FNFDataAPI.csproj │ ├── FridayNightFunkin │ │ ├── FNFSong.cs │ │ └── Json │ │ │ ├── Note.cs │ │ │ └── Song.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── FNFDataAPITests │ ├── FNFDataAPITests.csproj │ ├── Program.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── FridayNightFunkin │ ├── FNFSong.cs │ └── Json │ │ ├── Note.cs │ │ └── Song.cs ├── Properties │ └── AssemblyInfo.cs └── packages.config └── README.md /FNFDataAPI/FNFDataAPI.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {92B6EAF5-F48B-4EA6-BBE6-EFB03D3B5C59} 8 | Library 9 | Properties 10 | FNFDataAPI 11 | FNFDataAPI 12 | v4.8 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll 37 | True 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /FNFDataAPI/FNFDataAPI.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FNFDataAPI", "FNFDataAPI\FNFDataAPI.csproj", "{92B6EAF5-F48B-4EA6-BBE6-EFB03D3B5C59}" 4 | EndProject 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FNFDataAPITests", "FNFDataAPITests\FNFDataAPITests.csproj", "{FBB66A59-9108-4E4B-B220-4F154BAD595B}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Any CPU = Debug|Any CPU 10 | Release|Any CPU = Release|Any CPU 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {92B6EAF5-F48B-4EA6-BBE6-EFB03D3B5C59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 14 | {92B6EAF5-F48B-4EA6-BBE6-EFB03D3B5C59}.Debug|Any CPU.Build.0 = Debug|Any CPU 15 | {92B6EAF5-F48B-4EA6-BBE6-EFB03D3B5C59}.Release|Any CPU.ActiveCfg = Release|Any CPU 16 | {92B6EAF5-F48B-4EA6-BBE6-EFB03D3B5C59}.Release|Any CPU.Build.0 = Release|Any CPU 17 | {FBB66A59-9108-4E4B-B220-4F154BAD595B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 18 | {FBB66A59-9108-4E4B-B220-4F154BAD595B}.Debug|Any CPU.Build.0 = Debug|Any CPU 19 | {FBB66A59-9108-4E4B-B220-4F154BAD595B}.Release|Any CPU.ActiveCfg = Release|Any CPU 20 | {FBB66A59-9108-4E4B-B220-4F154BAD595B}.Release|Any CPU.Build.0 = Release|Any CPU 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /FNFDataAPI/FNFDataAPI/FNFDataAPI.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {92B6EAF5-F48B-4EA6-BBE6-EFB03D3B5C59} 8 | Library 9 | Properties 10 | FNFDataAPI 11 | FNFDataAPI 12 | v4.7.2 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll 37 | True 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /FNFDataAPI/FNFDataAPI/FridayNightFunkin/FNFSong.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using FridayNightFunkin.Json; 5 | using Newtonsoft.Json; 6 | 7 | namespace FridayNightFunkin 8 | { 9 | public class FNFSong 10 | { 11 | private Song.Root dataRoot { get; } 12 | public List Sections { get; set; } 13 | 14 | public string SongName 15 | { 16 | get => dataRoot.song.SongSong; 17 | set => dataRoot.song.SongSong = value; 18 | } 19 | 20 | public long Bpm 21 | { 22 | get => dataRoot.song.Bpm; 23 | set => dataRoot.song.Bpm = value; 24 | } 25 | 26 | public long Speed 27 | { 28 | get => dataRoot.song.Speed; 29 | set => dataRoot.song.Speed = value; 30 | } 31 | 32 | public bool NeedVoices 33 | { 34 | get => dataRoot.song.NeedsVoices; 35 | set => dataRoot.song.NeedsVoices = value; 36 | } 37 | 38 | public string Player1 39 | { 40 | get => dataRoot.song.Player1; 41 | set => dataRoot.song.Player1 = value; 42 | } 43 | 44 | public string Player2 45 | { 46 | get => dataRoot.song.Player2; 47 | set => dataRoot.song.Player2 = value; 48 | } 49 | 50 | public FNFSong(string songPath) 51 | { 52 | dataRoot= JsonConvert.DeserializeObject(File.ReadAllText(songPath)); 53 | Sections = new List(); 54 | foreach (Note n in dataRoot.song.Notes) 55 | { 56 | Sections.Add(new FNFSection(n)); 57 | } 58 | } 59 | 60 | public void SaveSong(string savePath) 61 | { 62 | Console.WriteLine("Compiling song..."); 63 | for (int i = 0; i < dataRoot.song.Notes.Length; i++) 64 | { 65 | Console.WriteLine("Section " + i); 66 | FNFSection section = Sections[i]; 67 | Note n = dataRoot.song.Notes[i]; 68 | n.Bpm = Bpm; 69 | for (int ii = 0; ii < section.Notes.Count; ii++) 70 | { 71 | FNFNote note = section.Notes[ii]; 72 | Console.WriteLine("Compiling note " + ii); 73 | n.sectionNotes[ii] = note.ConvertToNote(); 74 | } 75 | dataRoot.song.Notes[i] = n; 76 | } 77 | Console.WriteLine("Compiled! Saving to " + savePath); 78 | File.WriteAllText(savePath, JsonConvert.SerializeObject(dataRoot)); 79 | } 80 | 81 | public class FNFSection 82 | { 83 | private Note dataNote { get; } 84 | public List Notes { get; set; } 85 | public bool MustHitSection { get => dataNote.MustHitSection; set => dataNote.MustHitSection = value; } 86 | 87 | public FNFNote ModifyNote(FNFNote toModify, FNFNote newProperties) 88 | { 89 | if (toModify == null) 90 | throw new Exception("ToModify is null."); 91 | int index = Notes.IndexOf(toModify); 92 | dataNote.sectionNotes[index] = newProperties.ConvertToNote(); 93 | Notes[index] = newProperties; 94 | return newProperties; 95 | } 96 | 97 | public void AddNote(FNFNote newNote) 98 | { 99 | if (newNote == null) 100 | throw new Exception("NewNote is null."); 101 | dataNote.sectionNotes.Add(newNote.ConvertToNote()); 102 | Notes.Add(newNote); 103 | } 104 | 105 | public void RemoveNote(FNFNote removeNote) 106 | { 107 | if (removeNote == null) 108 | throw new Exception("RemoveNote is null."); 109 | List toRemove = null; 110 | foreach (List n in dataNote.sectionNotes) 111 | { 112 | if (n[0] != removeNote.ConvertToNote()[0] && n[1] != removeNote.ConvertToNote()[1]) 113 | continue; 114 | toRemove = n; 115 | } 116 | if (toRemove == null) 117 | throw new Exception("Note not found!"); 118 | dataNote.sectionNotes.Remove(toRemove); 119 | Notes.Remove(removeNote); 120 | } 121 | 122 | public FNFSection(Note prvDataNote) 123 | { 124 | if (prvDataNote == null) 125 | throw new Exception("Song Root is null."); 126 | dataNote = prvDataNote; 127 | Notes = new List(); 128 | foreach (List n in dataNote.sectionNotes) 129 | { 130 | Notes.Add(new FNFNote(n[0],n[1],n[2])); 131 | } 132 | } 133 | } 134 | 135 | public class FNFNote 136 | { 137 | public List ConvertToNote() 138 | { 139 | List list = new List(); 140 | list.Add(Time); 141 | list.Add((decimal)Type); 142 | list.Add(Length); 143 | return list; 144 | } 145 | 146 | public FNFNote(decimal time, decimal noteType, decimal length) 147 | { 148 | Time = time; 149 | Type = (NoteType)noteType; 150 | Length = length; 151 | } 152 | 153 | public decimal Time { get; set; } // Time in milliseconds 154 | public NoteType Type { get; set; } // Type of note, left, down, up, right, etc. 155 | public decimal Length { get; set; } // Length of note, for holding sliders. 156 | } 157 | 158 | public enum NoteType 159 | { 160 | Left = 0, 161 | Down = 1, 162 | Up = 2, 163 | Right = 3, 164 | RLeft = 4, 165 | RDown = 5, 166 | RUp = 6, 167 | RRight = 7 168 | } 169 | } 170 | } -------------------------------------------------------------------------------- /FNFDataAPI/FNFDataAPI/FridayNightFunkin/Json/Note.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Newtonsoft.Json; 3 | 4 | namespace FridayNightFunkin.Json 5 | { 6 | public class Note 7 | { 8 | [JsonProperty("mustHitSection")] 9 | public bool MustHitSection { get; set; } 10 | 11 | [JsonProperty("typeOfSection")] 12 | public long TypeOfSection { get; set; } 13 | 14 | [JsonProperty("lengthInSteps")] 15 | public long LengthInSteps { get; set; } 16 | 17 | [JsonProperty("sectionNotes")] 18 | public List> sectionNotes { get; set; } 19 | 20 | [JsonProperty("bpm", NullValueHandling = NullValueHandling.Ignore)] 21 | public long? Bpm { get; set; } 22 | 23 | [JsonProperty("changeBPM", NullValueHandling = NullValueHandling.Ignore)] 24 | public bool? ChangeBpm { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /FNFDataAPI/FNFDataAPI/FridayNightFunkin/Json/Song.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using Newtonsoft.Json; 4 | 5 | namespace FridayNightFunkin.Json 6 | { 7 | public class Song 8 | { 9 | public class Root { 10 | public Song song { get; set; } 11 | public int bpm { get; set; } 12 | public int sections { get; set; } 13 | public List notes { get; set; } 14 | } 15 | 16 | public Song(string player2, string player1, long speed, bool voices, string songName, long bpm) 17 | { 18 | Player1 = player1; 19 | Player2 = player2; 20 | Speed = speed; 21 | NeedsVoices = voices; 22 | SongSong = songName; 23 | Bpm = bpm; 24 | } 25 | 26 | [JsonProperty("player2")] 27 | public string Player2 { get; set; } 28 | 29 | [JsonProperty("player1")] 30 | public string Player1 { get; set; } 31 | 32 | [JsonProperty("speed")] 33 | public long Speed { get; set; } 34 | 35 | [JsonProperty("needsVoices")] 36 | public bool NeedsVoices { get; set; } 37 | 38 | [JsonProperty("sectionLengths")] 39 | public object[] SectionLengths { get; set; } 40 | 41 | [JsonProperty("song")] 42 | public string SongSong { get; set; } 43 | 44 | [JsonProperty("notes")] 45 | public Note[] Notes { get; set; } 46 | 47 | [JsonProperty("bpm")] 48 | public long Bpm { get; set; } 49 | 50 | [JsonProperty("sections")] 51 | public long Sections { get; set; } 52 | 53 | public static Root LoadSong(string filePath) 54 | { 55 | return JsonConvert.DeserializeObject(File.ReadAllText(filePath)); 56 | } 57 | 58 | } 59 | } -------------------------------------------------------------------------------- /FNFDataAPI/FNFDataAPI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("FNFDataAPI")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("FNFDataAPI")] 12 | [assembly: AssemblyCopyright("Copyright © 2020")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("92B6EAF5-F48B-4EA6-BBE6-EFB03D3B5C59")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /FNFDataAPI/FNFDataAPI/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /FNFDataAPI/FNFDataAPITests/FNFDataAPITests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {FBB66A59-9108-4E4B-B220-4F154BAD595B} 8 | Exe 9 | Properties 10 | FNFDataAPITests 11 | FNFDataAPITests 12 | v4.7.2 13 | 512 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | {92b6eaf5-f48b-4ea6-bbe6-efb03d3b5c59} 47 | FNFDataAPI 48 | 49 | 50 | 51 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /FNFDataAPI/FNFDataAPITests/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using FridayNightFunkin; 3 | using FridayNightFunkin.Json; 4 | 5 | namespace FNFDataAPITests 6 | { 7 | internal class Program 8 | { 9 | public static void Main(string[] args) 10 | { 11 | Console.WriteLine("Song Directory:"); 12 | string dir = Console.ReadLine(); 13 | Console.WriteLine("TEST 1 - LOADING"); 14 | try 15 | { 16 | FNFSong song = new FNFSong(dir); 17 | Console.WriteLine("Song Name: " + song.SongName); 18 | Console.WriteLine("Song BPM: " + song.Bpm); 19 | Console.WriteLine("Song Speed: " + song.Speed); 20 | Console.WriteLine("Sections: " + song.Sections.Count); 21 | Console.WriteLine("TEST 1 - COMPLETE"); 22 | Console.WriteLine("TEST 2 - SECTIONS & NOTES"); 23 | FNFSong.FNFNote noteToModify = null; 24 | FNFSong.FNFSection sectionToModify = null; 25 | foreach (FNFSong.FNFSection section in song.Sections) 26 | { 27 | Console.WriteLine("Section: " + section.MustHitSection + "\nNotes: " + section.Notes.Count); 28 | if (section.Notes.Count == 0) 29 | continue; 30 | foreach (FNFSong.FNFNote note in section.Notes) 31 | { 32 | if (noteToModify == null) 33 | { 34 | noteToModify = note; // select the first note to be modified 35 | sectionToModify = section; 36 | } 37 | 38 | Console.WriteLine("Note: " + note.Type + "\nTime: " + note.Time + "\nLength: " + note.Length); 39 | 40 | } 41 | } 42 | Console.WriteLine("TEST 2 - COMPLETE"); 43 | Console.WriteLine("TEST 3 - ADDING/REMOVING/MODIFYING NOTES"); 44 | noteToModify = sectionToModify.ModifyNote(noteToModify, new FNFSong.FNFNote(noteToModify.Time, (decimal)FNFSong.NoteType.Left, 35)); 45 | sectionToModify.AddNote(new FNFSong.FNFNote(noteToModify.Time += 1000,(decimal) FNFSong.NoteType.Right, 75)); 46 | sectionToModify.RemoveNote(sectionToModify.Notes[3]); // the first section with less than 4 notes will fail this. 47 | Console.WriteLine("TEST 3 - COMPLETE"); 48 | Console.WriteLine("TEST 4 - COMPILE"); 49 | song.SaveSong("compiledSong.json"); 50 | Console.WriteLine("TEST 5 - COMPLETE"); 51 | Console.WriteLine("END"); 52 | } 53 | catch (Exception e) 54 | { 55 | Console.WriteLine("FAILED TESTS.\n" + e); 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /FNFDataAPI/FNFDataAPITests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("FNFDataAPITests")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("FNFDataAPITests")] 12 | [assembly: AssemblyCopyright("Copyright © 2020")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("FBB66A59-9108-4E4B-B220-4F154BAD595B")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /FNFDataAPI/FridayNightFunkin/FNFSong.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using FridayNightFunkin.Json; 6 | using Newtonsoft.Json; 7 | 8 | namespace FridayNightFunkin 9 | { 10 | public class FNFSong 11 | { 12 | private Song.Root dataRoot { get; } 13 | public List Sections { get; set; } 14 | 15 | public string SongName 16 | { 17 | get => dataRoot.song.SongSong; 18 | set => dataRoot.song.SongSong = value; 19 | } 20 | 21 | public long Bpm 22 | { 23 | get => dataRoot.song.Bpm; 24 | set => dataRoot.song.Bpm = value; 25 | } 26 | 27 | public long Speed 28 | { 29 | get => dataRoot.song.Speed; 30 | set => dataRoot.song.Speed = value; 31 | } 32 | 33 | public bool NeedVoices 34 | { 35 | get => dataRoot.song.NeedsVoices; 36 | set => dataRoot.song.NeedsVoices = value; 37 | } 38 | 39 | public string Player1 40 | { 41 | get => dataRoot.song.Player1; 42 | set => dataRoot.song.Player1 = value; 43 | } 44 | 45 | public string Player2 46 | { 47 | get => dataRoot.song.Player2; 48 | set => dataRoot.song.Player2 = value; 49 | } 50 | 51 | public FNFSong(string songPath) 52 | { 53 | dataRoot= JsonConvert.DeserializeObject(File.ReadAllText(songPath)); 54 | Sections = new List(); 55 | foreach (Note n in dataRoot.song.Notes) 56 | { 57 | Sections.Add(new FNFSection(n)); 58 | } 59 | } 60 | 61 | public FNFSong() 62 | { 63 | dataRoot = new Song.Root(); 64 | dataRoot.bpm = 0; 65 | dataRoot.notes = new List(); 66 | dataRoot.sections = 0; 67 | dataRoot.song = new Song("dad", "bf",1,false,"noAduio",0); 68 | dataRoot.song.Notes = new List(); 69 | } 70 | 71 | public void AddSection(FNFSection section) 72 | { 73 | // reset sections but keep them lol 74 | Note n = new Note(); 75 | 76 | n.Bpm = Bpm; 77 | n.ChangeBpm = false; 78 | n.LengthInSteps = 16; 79 | n.MustHitSection = section.MustHitSection; 80 | n.TypeOfSection = 0; 81 | n.sectionNotes = new List>(); 82 | 83 | foreach(FNFNote note in section.Notes) 84 | n.sectionNotes.Add(note.ConvertToNote()); 85 | Sections.Add(section); 86 | dataRoot.song.Notes.Add(n); 87 | } 88 | 89 | public void SaveSong(string savePath) 90 | { 91 | Console.WriteLine("Compiling song with " + Sections.Count + " sections."); 92 | for (int i = 0; i < dataRoot.song.Notes.Count; i++) 93 | { 94 | try 95 | { 96 | Console.WriteLine("Section " + i); 97 | FNFSection section = Sections[i]; 98 | dataRoot.song.Notes[i] = section.dataNote; 99 | 100 | } 101 | catch (Exception e) 102 | { 103 | Console.WriteLine("Failed on section " + i + "\n" + e); 104 | } 105 | } 106 | Console.WriteLine("Compiled! Saving to " + savePath); 107 | File.WriteAllText(savePath, JsonConvert.SerializeObject(dataRoot)); 108 | } 109 | 110 | public class FNFSection 111 | { 112 | public Note dataNote { get; } 113 | public List Notes { get; set; } 114 | public bool MustHitSection { get => dataNote.MustHitSection; set => dataNote.MustHitSection = value; } 115 | 116 | public FNFNote ModifyNote(FNFNote toModify, FNFNote newProperties) 117 | { 118 | if (toModify == null) 119 | throw new Exception("ToModify is null."); 120 | int index = Notes.IndexOf(toModify); 121 | dataNote.sectionNotes[index] = newProperties.ConvertToNote(); 122 | Notes[index] = newProperties; 123 | return newProperties; 124 | } 125 | 126 | public void AddNote(FNFNote newNote) 127 | { 128 | if (newNote == null) 129 | throw new Exception("NewNote is null."); 130 | dataNote.sectionNotes.Add(newNote.ConvertToNote()); 131 | Notes.Add(newNote); 132 | } 133 | 134 | public void RemoveNote(FNFNote removeNote) 135 | { 136 | if (removeNote == null) 137 | throw new Exception("RemoveNote is null."); 138 | List toRemove = null; 139 | foreach (List n in dataNote.sectionNotes) 140 | { 141 | if (n[0] != removeNote.ConvertToNote()[0] && n[1] != removeNote.ConvertToNote()[1]) 142 | continue; 143 | toRemove = n; 144 | } 145 | if (toRemove == null) 146 | throw new Exception("Note not found!"); 147 | dataNote.sectionNotes.Remove(toRemove); 148 | Notes.Remove(removeNote); 149 | } 150 | 151 | public FNFSection(Note prvDataNote) 152 | { 153 | if (prvDataNote == null) 154 | throw new Exception("Song Root is null."); 155 | dataNote = prvDataNote; 156 | Notes = new List(); 157 | foreach (List n in dataNote.sectionNotes) 158 | { 159 | Notes.Add(new FNFNote(n[0],n[1],n[2])); 160 | } 161 | } 162 | } 163 | 164 | public class FNFNote 165 | { 166 | public List ConvertToNote() 167 | { 168 | List list = new List(); 169 | list.Add(Time); 170 | list.Add((decimal)Type); 171 | list.Add(Length); 172 | return list; 173 | } 174 | 175 | public FNFNote(decimal time, decimal noteType, decimal length) 176 | { 177 | Time = time; 178 | Type = (NoteType)noteType; 179 | Length = length; 180 | } 181 | 182 | public decimal Time { get; set; } // Time in milliseconds 183 | public NoteType Type { get; set; } // Type of note, left, down, up, right, etc. 184 | public decimal Length { get; set; } // Length of note, for holding sliders. 185 | } 186 | 187 | public enum NoteType 188 | { 189 | Left = 0, 190 | Down = 1, 191 | Up = 2, 192 | Right = 3, 193 | RLeft = 4, 194 | RDown = 5, 195 | RUp = 6, 196 | RRight = 7 197 | } 198 | } 199 | } -------------------------------------------------------------------------------- /FNFDataAPI/FridayNightFunkin/Json/Note.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Newtonsoft.Json; 3 | 4 | namespace FridayNightFunkin.Json 5 | { 6 | public class Note 7 | { 8 | [JsonProperty("mustHitSection")] 9 | public bool MustHitSection { get; set; } 10 | 11 | [JsonProperty("typeOfSection")] 12 | public long TypeOfSection { get; set; } 13 | 14 | [JsonProperty("lengthInSteps")] 15 | public long LengthInSteps { get; set; } 16 | 17 | [JsonProperty("sectionNotes")] 18 | public List> sectionNotes { get; set; } 19 | 20 | [JsonProperty("bpm", NullValueHandling = NullValueHandling.Ignore)] 21 | public long? Bpm { get; set; } 22 | 23 | [JsonProperty("changeBPM", NullValueHandling = NullValueHandling.Ignore)] 24 | public bool? ChangeBpm { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /FNFDataAPI/FridayNightFunkin/Json/Song.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using Newtonsoft.Json; 4 | 5 | namespace FridayNightFunkin.Json 6 | { 7 | public class Song 8 | { 9 | public class Root { 10 | public Song song { get; set; } 11 | public int bpm { get; set; } 12 | public int sections { get; set; } 13 | public List notes { get; set; } 14 | } 15 | 16 | public Song(string player2, string player1, long speed, bool voices, string songName, long bpm) 17 | { 18 | Player1 = player1; 19 | Player2 = player2; 20 | Speed = speed; 21 | NeedsVoices = voices; 22 | SongSong = songName; 23 | Bpm = bpm; 24 | } 25 | 26 | [JsonProperty("player2")] 27 | public string Player2 { get; set; } 28 | 29 | [JsonProperty("player1")] 30 | public string Player1 { get; set; } 31 | 32 | [JsonProperty("speed")] 33 | public long Speed { get; set; } 34 | 35 | [JsonProperty("needsVoices")] 36 | public bool NeedsVoices { get; set; } 37 | 38 | [JsonProperty("sectionLengths")] 39 | public object[] SectionLengths { get; set; } 40 | 41 | [JsonProperty("song")] 42 | public string SongSong { get; set; } 43 | 44 | [JsonProperty("notes")] 45 | public List Notes { get; set; } 46 | 47 | [JsonProperty("bpm")] 48 | public long Bpm { get; set; } 49 | 50 | [JsonProperty("sections")] 51 | public long Sections { get; set; } 52 | 53 | public static Root LoadSong(string filePath) 54 | { 55 | return JsonConvert.DeserializeObject(File.ReadAllText(filePath)); 56 | } 57 | 58 | } 59 | } -------------------------------------------------------------------------------- /FNFDataAPI/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("FNFDataAPI")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("FNFDataAPI")] 12 | [assembly: AssemblyCopyright("Copyright © 2020")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("92B6EAF5-F48B-4EA6-BBE6-EFB03D3B5C59")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /FNFDataAPI/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FNFDataAPI 2 | A C# API for Friday Night Funkin's JSON files. With this API you can modify anything in the JSON files. Including attributes of the song, like speed, bpm, and players, and even modify notes, add notes, and remove them! 3 | 4 | # Usage 5 | **THIS IS A DEVELOPER TOOL** this isn't for people who don't code, so don't try to use it if you have no idea how to code in C#. Please don't make issues about "how to use????" cuz i'll just close them. 6 | 7 | 8 | To use this you must include the [latest release's dll](https://github.com/KadeDev/FNFDataAPI/releases/latest) in your C# project. 9 | 10 | 11 | To get an example on how this is used, please look at the [TESTS project](https://github.com/KadeDev/FNFDataAPI/blob/main/FNFDataAPI/FNFDataAPITests/Program.cs#L9) for a good example on how it works. 12 | 13 | 14 | # Libarys used 15 | [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) 16 | --------------------------------------------------------------------------------