public ModFile(string filePath) { path = filePath; fileName = Path.GetFileNameWithoutExtension(filePath); type = ModType.getTypeFromExtension(filePath); var dir = Path.GetDirectoryName(filePath); var descFile = dir + "\\" + fileName + ".desc"; if (File.Exists(descFile)) { readDescriptionFile(descFile); } }
public void changeModState() { type = ModType.getOppositeType(type); if (isDisabled()) { File.Move(path, path + ".disabled"); path += ".disabled"; } else { var newPath = path.Substring(0, path.Length - ".disabled".Length); File.Move(path, newPath); path = newPath; } }
public static ModType getOppositeType(ModType type) { if (type == null) { return(UNKNOWN); } if (type == SCRIPT) { return(DISABLED_SCRIPT); } if (type == PACKAGE) { return(DISABLED_PACKAGE); } if (type == DISABLED_SCRIPT) { return(SCRIPT); } if (type == DISABLED_PACKAGE) { return(PACKAGE); } return(UNKNOWN); }