예제 #1
0
        public ModLoaderManager(IMinecraftInstance mcInstnace)
        {
            mcInstance = mcInstnace;
            modLoaders = new List <ModLoaderInfo>();
            ModLoaders = modLoaders.AsReadOnly();

            compatibleSchemata = InstalationSchemas.Where(s => s.IsCompatible(mcInstnace)).ToArray();
            foreach (IModLoaderHandler handler in compatibleSchemata)
            {
                handler.DetectModLoaders(mcInstnace, modLoaders);
            }

            Logger.Debug($"Detected mod loaders for instance {mcInstnace.GetType()} with name {mcInstance.Name}: {JsonConvert.SerializeObject(ModLoaders, Formatting.Indented)}");
        }
예제 #2
0
파일: IAdapter.cs 프로젝트: Filipsi/Packsly
 public override bool IsCompatible(IMinecraftInstance instance)
 {
     return(instance.GetType() == typeof(TInstance));
 }
예제 #3
0
        public void Install(string name, string version)
        {
            IModLoaderHandler schema = compatibleSchemata.FirstOrDefault(s => s.IsCompatible(name));

            if (schema == null)
            {
                throw new InvalidOperationException($"No modloader installation schema compatible with modloader with name '{name}' for minecraft instance type '{mcInstance.GetType().FullName}' found!");
            }

            schema.Install(mcInstance, name, version);
            modLoaders.Add(new ModLoaderInfo(name, version));
        }
예제 #4
0
 public bool IsCompatible(IMinecraftInstance instance)
 => instance.GetType() == typeof(T);