public static void ReadRecipeRotations(bool deleteCurrent = false) { if (deleteCurrent && File.Exists("RecipeRotations.db")) { File.Delete("RecipeRotations.db"); } if (File.Exists("RecipeRotations.db")) { DataStream s = new DataStream(File.ReadAllBytes("RecipeRotations.db")); int length = s.ReadS32(); RecipeRotations = new Dictionary <AbstractRecipeInfo, List <RecipeSolutionInfo> >(length); for (ushort i = 0; i < length; i++) { AbstractRecipeInfo info = new AbstractRecipeInfo { Level = s.ReadS32(), RequiredCraftsmanship = s.ReadS32(), RequiredControl = s.ReadS32(), Durability = s.ReadS32(), MaxProgress = s.ReadS32(), MaxQuality = s.ReadS32() }; var ll = s.ReadS32(); RecipeRotations[info] = new List <RecipeSolutionInfo>(ll); for (int j = 0; j < ll; j++) { RecipeSolutionInfo rotation = new RecipeSolutionInfo(); rotation.MinLevel = s.ReadS32(); rotation.MaxCraftsmanship = s.ReadS32(); rotation.MinCraftsmanship = s.ReadS32(); rotation.MinControl = s.ReadS32(); rotation.CP = s.ReadS32(); int l = s.ReadS32(); ushort[] array = new ushort[l]; for (int k = 0; k < l; k++) { array[k] = (ushort)s.ReadU30(); } rotation.Rotation = array; RecipeRotations[info].Add(rotation); } } s.Flush(); s.Close(); } else { RecipeRotations = new Dictionary <AbstractRecipeInfo, List <RecipeSolutionInfo> >(); var sheet = Game.GameData.GetSheet <Recipe>(); int count = sheet.Count; int[] keys = sheet.Keys.ToArray(); for (int i = 0; i < count; i++) { var value = sheet[keys[i]]; AbstractRecipeInfo abstractInfo = AbstractRecipeInfo.GetAbstractData(value); if (!RecipeRotations.ContainsKey(abstractInfo)) { RecipeRotations[abstractInfo] = new List <RecipeSolutionInfo>(); } } WriteRecipeRotations(); } }
public static void RemoveRotation(AbstractRecipeInfo abstractRecipeInfo, RecipeSolutionInfo rotationInfo) { GameData.RecipeRotations[abstractRecipeInfo].Remove(rotationInfo); MainWindow.UpdateRotationsCount(); }