Example #1
0
 public bool IsMapProtected(string fileName)
 {
     using (StormLibWrapper.MpqArchive mapArchive = new StormLibWrapper.MpqArchive(fileName))
     {
         return(IsMapProtected(mapArchive));
     }
 }
Example #2
0
 public void ExtractGalaxyScriptFileTo(MapInfo mapInfo, string extractToPath)
 {
     using (StormLibWrapper.MpqArchive mapArchive = new StormLibWrapper.MpqArchive(mapInfo.CachePath))
     {
         mapArchive.ExtractFile("MapScript.galaxy", extractToPath);
     }
 }
Example #3
0
 private string GetDocumentHeader(FileInfo mpqFile)
 {
     using (StormLibWrapper.MpqArchive archive = new StormLibWrapper.MpqArchive(mpqFile.FullName))
     {
         using (StormLibWrapper.MpqInternalFile documentHeaderFile = archive.OpenFile("DocumentHeader"))
         {
             return(documentHeaderFile.ReadFile());
         }
     }
 }
Example #4
0
 private string GetGalaxyScriptCode(FileInfo mpqFile)
 {
     using (StormLibWrapper.MpqArchive archive = new StormLibWrapper.MpqArchive(mpqFile.FullName))
     {
         using (StormLibWrapper.MpqInternalFile galaxyScriptFile = archive.OpenFile("MapScript.galaxy"))
         {
             return(galaxyScriptFile.ReadFile());
         }
     }
 }
Example #5
0
 public void UnprotectMap(string fileName)
 {
     using (StormLibWrapper.MpqArchive mapArchive = new StormLibWrapper.MpqArchive(fileName, false))
     {
         if (IsMapProtected(mapArchive))
         {
             UnprotectMap(mapArchive);
         }
     }
 }
Example #6
0
 private void UnprotectMap(StormLibWrapper.MpqArchive mapArchive)
 {
     if (!IsMapProtected(mapArchive))
     {
         throw new MapNotProtectedException(); //TODO: Handle thrown exception
     }
     if (!mapArchive.FileExists(FILE_COMPONENTLIST))
     {
         mapArchive.CreateFile(FILE_COMPONENTLIST, Properties.Resources.ComponentList);
     }
     if (!mapArchive.FileExists(FILE_TRIGGERS))
     {
         mapArchive.CreateFile(FILE_TRIGGERS, Properties.Resources.Triggers);
     }
     if (!mapArchive.FileExists(FILE_TRIGGERSVERSION))
     {
         mapArchive.CreateFile(FILE_TRIGGERSVERSION, Properties.Resources.Triggersversion);
     }
 }
Example #7
0
 public bool IsMapProtected(StormLibWrapper.MpqArchive mapArchive)
 {
     return(!mapArchive.FileExists(FILE_COMPONENTLIST) ||
            !mapArchive.FileExists(FILE_TRIGGERS) ||
            !mapArchive.FileExists(FILE_TRIGGERSVERSION));
 }