private static string GetEnabledName(FileInfo file) { if (SideloaderModLoader.IsValidZipmodExtension(file.Extension)) { return(SideloaderModInfo.EnabledLocation(file).Name); } else if (PluginLoader.IsValidPluginExtension(file.Extension)) { return(PluginInfo.EnabledLocation(file).Name); } else { return(file.Name); } }
public static void InstallFromUnknownFile(string fileName) { var file = new FileInfo(fileName); Exception toThrow = null; if (SideloaderModLoader.IsValidZipmodExtension(file.Extension)) { try { // This will throw NotSupportedException on hardmods so no need to check it later InstallZipmod(fileName); return; } catch (InvalidDataException ex) { // Not a zipmod toThrow = ex; } } if (PluginLoader.IsValidPluginExtension(file.Extension)) { // If it throws, there's a good reason InstallPlugin(fileName); return; } /* todo fix and reenable * if (ZipFile.IsZipFile(fileName)) * { * InstallFromArchive(fileName); * return; * }*/ if (toThrow != null) { throw toThrow; } throw new InvalidDataException("The file format is not supported, or the file is broken"); }