예제 #1
0
 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.");
     }
 }
예제 #2
0
        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);
                }                
            }
        }
예제 #3
0
 public static void SetupStructure(Instance instance)
 {
     Directory.CreateDirectory(GetInstancePath(instance) + Manager.GetSingleton.ConfigurationManager.Configuration.MinecraftFolderPath);
 }
예제 #4
0
 public void DeleteInstance(Instance instance)
 {
     Directory.Delete(GetInstancePath(instance), true);
     _instances.Remove(instance);
 }
예제 #5
0
 private static string GetInstancePath(Instance instance)
 {
     return instance.InstanceLocation.Path + instance.Name + "/";
 }