Beispiel #1
0
 public bool IsMapProtected(string fileName)
 {
     using (StormLibWrapper.MpqArchive mapArchive = new StormLibWrapper.MpqArchive(fileName))
     {
         return(IsMapProtected(mapArchive));
     }
 }
Beispiel #2
0
 public void ExtractGalaxyScriptFileTo(MapInfo mapInfo, string extractToPath)
 {
     using (StormLibWrapper.MpqArchive mapArchive = new StormLibWrapper.MpqArchive(mapInfo.CachePath))
     {
         mapArchive.ExtractFile("MapScript.galaxy", extractToPath);
     }
 }
Beispiel #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());
         }
     }
 }
Beispiel #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());
         }
     }
 }
Beispiel #5
0
 public void UnprotectMap(string fileName)
 {
     using (StormLibWrapper.MpqArchive mapArchive = new StormLibWrapper.MpqArchive(fileName, false))
     {
         if (IsMapProtected(mapArchive))
         {
             UnprotectMap(mapArchive);
         }
     }
 }
Beispiel #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);
     }
 }
Beispiel #7
0
 public bool IsMapProtected(StormLibWrapper.MpqArchive mapArchive)
 {
     return(!mapArchive.FileExists(FILE_COMPONENTLIST) ||
            !mapArchive.FileExists(FILE_TRIGGERS) ||
            !mapArchive.FileExists(FILE_TRIGGERSVERSION));
 }