Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 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;
     }
 }
Exemplo n.º 3
0
 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);
 }