/// <summary> /// Get All MProfileInfo from mojang server and local /// </summary> public static MProfileMetadata[] GetProfileMetadatas(Minecraft mc) { var list = new List <MProfileMetadata>(GetProfileMetadatasFromLocal(mc)); foreach (var item in GetProfileMetadatasFromWeb()) { if (!list.Contains(item)) { list.Add(item); } } return(list.ToArray()); }
/// <summary> /// Get All MProfileInfo from local /// </summary> public static MProfileMetadata[] GetProfileMetadatasFromLocal(Minecraft mc) { var dirs = new DirectoryInfo(mc.Versions).GetDirectories(); var arr = new List <MProfileMetadata>(dirs.Length); foreach (var dir in dirs) { var filepath = Path.Combine(dir.FullName, dir.Name + ".json"); if (!File.Exists(filepath)) { continue; } var info = new MProfileMetadata(); info.IsWeb = false; info.Name = dir.Name; info.Path = filepath; info.Type = "local"; info.MType = MProfileType.Custom; arr.Add(info); } return(arr.ToArray()); }
public MForge(Minecraft mc) { this.Minecraft = mc; }