It is currently 16 Apr 2024, 08:55
   
Text Size

DotP2013 (and 2012) Card Lister

Moderator: CCGHQ Admins

DotP2013 (and 2012) Card Lister

Postby thefiremind » 15 Dec 2012, 14:17

I made a small utility that generates a list of English card names starting from the CARDS directory of your custom WAD. It's made for DotP2013 but it should work also for DotP2012 if needed.
Just drag and drop the CARDS directory onto the executable, and wait for it to finish. You'll find a list.txt file (together with the CARDS directory you dragged) that you'll be able to post here if you want to let people know about which cards your mod contains.

This is the C++ source:
Code: Select all
#include <stdio.h>
#include <dirent.h>

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main(int argc, char* argv[])
{
   string line;
   string filename;
   const string to_search = "<LOCALISED_TEXT LanguageCode=\"en-US\"><![CDATA[";
   size_t found, start, end;
   DIR *d;
   struct dirent *dir;
   if (argc > 1)
   {
      d = opendir(argv[1]);
      if (d)
      {
         ofstream dest(".\\list.txt");
         while ((dir = readdir(d)) != NULL)
         {
            filename = argv[1];
            filename += "\\";
            filename += dir->d_name;
            cout << filename << endl;
            ifstream source(filename.c_str());
            if (source.is_open() && dest.is_open())
            {
               found = -1;
               while (source.good() && found == -1)
               {
                  getline(source, line);
                  found = line.find(to_search);
                  if (found != -1)
                  {
                     start = found+to_search.length();
                     end = line.find("]", start);
                     dest << line.substr(start, end-start) << endl;
                  }
               }
               source.close();
            }
         }
         dest.close();
         delete dir;
         delete d;
      }
   }
   else
      cout << "You need to specify a directory as argument." << endl;
   return 0;
}
(Yes I know, almost no error handling, but I wrote it really quickly... :oops: Feel free to improve it if you have a C++ environment at hand. :wink:)
Attachments
DotPCardList.zip
(99.6 KiB) Downloaded 618 times
< Former DotP 2012/2013/2014 modder >
Currently busy with life...
User avatar
thefiremind
Programmer
 
Posts: 3515
Joined: 07 Nov 2011, 10:55
Has thanked: 118 times
Been thanked: 721 times

Return to Utilities

Who is online

Users browsing this forum: No registered users and 16 guests


Who is online

In total there are 16 users online :: 0 registered, 0 hidden and 16 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 16 guests

Login Form