Manalink PlayDeck Sorter v0.1a
Well, this took a couple of months longer than I expected. ^_^
Edit: v0.1a added choice of returning PlayDecks when exiting, added line numbers to "Rarity.pdv", and centered the NoticeBox in the WindowFrame.
- Code: Select all
Manalink PlayDeck Sorter v0.1a
written in Liberty BASIC 4.04
for the CCGHQ Manalink Forums
by CirothUngol March 21, 2013
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
The Manalink PlayDeck Sorter is a small utility that sorts PlayDeck.dck
files into the Manalink \PlayDeck\ folder. It allows you to find PlayDecks
either by searching for content (DeckName, Description, Comments, CardName,
CardQty, etc.) or by availability in a given Expansion or Expansions.
It also allows you to view newly-sorted PlayDecks, load the viewed PlayDeck
file into NotePad, or you can double-click it to automatically load it
into Manalink's DeckBuilder. The PDSorter can even run "Magic.exe" when you
exit... so you can go play with all those decks you just sorted!
How to start:
-------------
Copy the "PlayDeckSorter.exe" executable file in or near your Manalink
Installation Folder. It first searches the current folder and tree for
"Rarity.dat" (the only resource file it currently uses) to identify the
Program Folder. If not found, it will jump up one directory and search again.
When it identifies a new "Rarity.dat", it will create a "Rarity.pdv" file
containing Expansion Names and Card Expansion/Rarity info. It then creates
the small "PDLoader" executable if it doesn't already exist in the Manalink
Program Folder (see below). All of this can take a minute or two the first
time you run the app, but it should load rather quickly after that.
The folder structure:
---------------------
The PDSorter then looks in the \PlayDeck\ folder for its own \_PDSorter\
folder, creating it if needed. If the \_PDSorter\ folder is empty, all of
the decks in the \PlayDeck\ folder will be moved there, making the \PlayDeck\
folder ready for sorting. Likewise, if the \PlayDeck\ folder is empty when
you exit PDSorter, you will have the choice of returning all of the decks
in the \PDSorter\ folder back where they came from... just in case you change
your mind and want to play Random Duel with way too many PlayDecks again. ^_^
If there are PlayDecks in both the \PlayDeck\ and \_PDSorter\ folder when
running or exiting the app, then no PlayDecks are moved.
The PDSorter will also recursively search the \PlayDeck\ folder tree for
all "*.dck" files, and allow you to choose either the \_PDSorter\ folder
or all other folders as the PlayDeck source... but not both. A notice is
given if any duplicate FileNames are found, with an option to view a list
of duplicate DeckNames and their folders in a seperate window.
Where it looks for matches:
---------------------------
The PDSorter only searches for matching files from within SubFolders
contained inside of the \PlayDeck\ folder. It then copies any matching
files into the \PlayDeck\ folder for playing or viewing with DeckBuilder.
This is a one-way trip. The only time the app moves files from the main
\PlayDeck\ folder into a SubFolder is when it's first executed and the
\_PDSorter\ SubFolder is empty. Otherwise, it never copies FROM the
\PlayDeck\ folder, it always copies TO the \PlayDeck\ folder. This keeps
your DataBase of PlayDecks safe while allowing you to clear the \PlayDeck\
folder with impunity any time you'd like to change the mix of the decks
you're playing with.
"Use Expnsn" Button:
--------------------
The app opens on the "Expansion" page. You can select Expansions by double-
clicking them on the left-pane to move them to the right-pane. Click the
"Sort Decks" button to search for PlayDecks containg only cards from the
selected Expansions and copy them into the \PlayDecks\ folder.
"Use Search" Button:
--------------------
You can click the "Use Search" button to switch to the "Search" page. Here
you may search PlayDecks by any of the Header contents, as well as CardName
and/or CardQty. Use the "Any/All" button as a logical OR/AND. If "Match Any"
is selected, then PlayDecks are matched on any content from any of the
search fields. If "Match All" is selected, then PlayDecks are only matched
if they contain all of the content from all of the search fields. You can
search for multi-word strings by enclosing them in double-quotes. Click the
"Sort Decks" button to start the search. Any matching decks will be copied
into the \PlayDeck\ folder.
"View Decks" Button:
--------------------
This button is only active if there are currently PlayDecks sorted into
the \PlayDeck\ folder. Click it to switch to the "View" page. All sorted
PlayDecks are listed on the left-pane. Highlight a DeckName using either
the arrow keys or a single mouse click to view it on the right-pane.
Double-clicking the right pane will open the displayed PlayDeck with
NotePad. Double-clicking the DeckName on the left-pane will automatically
open the PlayDeck with Manalink's DeckBuilder.
"Clear Decks" Button:
---------------------
This button appears only when the "View" page is active. Click it to
remove all of the files from the \PlayDeck\ folder and start over. If
you clear the PlayDecks before exiting the app, then all of the decks
in the \_PDSorter\ folder will be returned to the \PlayDeck\ Folder.
"Truncate PlayDeck Names" CheckBox:
-----------------------------------
Manalink will load and use PlayDecks with names longer than 28 characters,
but DeckBuilder will not. If you'd like to view the sorted PlayDecks with
DeckBuilder, then you may select this CheckBox to automatically limit
the name of copied PlayDecks to 28 characters. If necessary, PDSorter will
automatically number and rename PlayDecks to prevent them from overwriting
each other due to the truncation.
"Run MAGIC.EXE on Exit" CheckBox:
---------------------------------
Just what it says. If selected, Manalink will run when you exit the app.
"Exact Match Only" CheckBox:
----------------------------
Only useful when using the "Search" page. If selected, PlayDecks must match
the search string exactly to be copied into the \PlayDeck\ folder.
"Use PDSorter Folder" CheckBox:
-------------------------------
If selected, then only the \_PDSorter\ SubFolder is searched for matches.
If not selected, then only SubFolders that aren't the \_PDSorter\ SubFolder
are searched for matches.
PDLoader.exe
------------
This is a tiny CommandLine app written in AutoIt 3. It's automatically
generated by PDSorter and must be located in the Manalink Program Folder
to operate correctly. It will automatically run DeckBuilder and load the
PlayDeck Name given as the first parameter. The DeckName must match exactly.
Double-quotes must be used if the DeckName contains any spaces.
It will also run "Magic.exe" if the first parameter is "Start_Magic".
So...
-----
Wanna play only Tempest Block?
How about anything up to Ice Age?
Modern... or Extended?
All of this info is available in "Rarity.dat". You can search your decks
for compatibility and they'll be copied directly to the \PlayDeck\ folder.
Wanna play nothing but Red?
How about only Black\Green decks?
All Artifact... or 5 Color?
If you've previously used the Manalink PlayDeck Analyser with "Rebuild Color
Decriptions" selected to scan your PlayDecks, then these searches are easy.
Acknowledgements:
-----------------
The Manalink PlayDeck Sorter was written using LibertyBASIC v4.04 and compiled
to executable using Liberty BASIC Booster v1.87.
The PlayDeck Loader was written in and compiled by AutoIt v3.3.8.1.
All thanx to Mok, without whom none of this would be possible.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
Edit: v0.1a added choice of returning PlayDecks when exiting, added line numbers to "Rarity.pdv", and centered the NoticeBox in the WindowFrame.