public static void ProcessGameFile(ObservableCollection <V1.Game> V1Games, ObservableCollection <V1.GameData> V1GameDatas) { //New format instancing ObservableCollection <V2.Game> Games = new ObservableCollection <V2.Game>(); V2.Game game = new V2.Game(); //Foreach source game foreach (V1.Game v1game in V1Games) { if (v1game.ID == 1) { game.ID = 1; game.APIGameName = v1game.GameName; game.Name = v1game.Name; game.GameAPICategories = new ObservableCollection <V2.GameAPICategory>(); game.GameElementFamilies = new ObservableCollection <GameElementFamily>(); //Parsing game's GameAPICategories foreach (V1.GameModType gmt in v1game.GameModTypes) { if (gmt.ID != -1) { V2.GameAPICategory GameAPICategory = new V2.GameAPICategory() { APICategoryName = gmt.APIName, ID = gmt.ID, LibraryFolderName = gmt.LibraryFolder, Name = gmt.Name, GameAPISubCategories = new ObservableCollection <GameAPISubCategory>() }; //Parsing Categories' SubCategories foreach (Category cat in gmt.Categories) { if (cat.ID != -1 && cat.ID != 0) { V2.GameAPISubCategory gameAPISubCategory = new V2.GameAPISubCategory() { ID = cat.ID, APISubCategoryID = cat.APICategory, APISubCategoryName = cat.Name }; GameAPICategory.GameAPISubCategories.Add(gameAPISubCategory); } } game.GameAPICategories.Add(GameAPICategory); } } //Parsing game's GameData foreach (V1.GameData gd in V1GameDatas) { if (gd.GameID == 1) { //Parsing Game Element Families foreach (GameDataCategory gdc in gd.Categories) { GameElementFamily Family = new GameElementFamily() { ID = gdc.ID, Name = gdc.Name, GameElements = new ObservableCollection <GameElement>() }; //Parsing Game Elements foreach (GameDataItem gdi in gdc.Items) { GameElement Element = new GameElement() { ID = gdi.ID, Name = gdi.Name, GameFolderName = gdi.Attributes[0].Value, isDLC = gdi.Attributes[1].Value.Contains("True") }; Family.GameElements.Add(Element); } game.GameElementFamilies.Add(Family); } } } } } Games.Add(game); JSonHelper.SaveGamesFile(Games); }