public void AddInstance(Instance instance) { Directory.CreateDirectory(GetInstancePath(instance)); var instanceXml = GetInstancePath(instance) + GetInstanceConfigFile(); if (!File.Exists(instanceXml)) { XmlHelper.WriteConfig(instanceXml, instance); _instances.Add(instance); } else { Console.WriteLine("Er bestaat al een instance in deze folder."); } }
public static void GetFile(Instance instance) { Directory.CreateDirectory(GetCachePath()); var file = GetCachePath() + instance.Version.Version + ".jar"; if (!File.Exists(file)) { var fileStruct = new FileDownload() { Name = instance.Version.Version + ".jar", Url = instance.Version.GetClientUrl(), DownloadFileCompleted = DownloadFileCompleted}; if (DownloadInProgress.ContainsKey(fileStruct)) { var value = DownloadInProgress[fileStruct]; value.Add(instance); DownloadInProgress[fileStruct] = value; } else { var instances = new List<Instance> {instance}; DownloadInProgress.Add(fileStruct, instances); Manager.GetSingleton.DownloadManager.Files.Enqueue(fileStruct); } } }
public static void SetupStructure(Instance instance) { Directory.CreateDirectory(GetInstancePath(instance) + Manager.GetSingleton.ConfigurationManager.Configuration.MinecraftFolderPath); }
public void DeleteInstance(Instance instance) { Directory.Delete(GetInstancePath(instance), true); _instances.Remove(instance); }
private static string GetInstancePath(Instance instance) { return instance.InstanceLocation.Path + instance.Name + "/"; }