2 // This file is part of the aMule Project.
4 // Copyright (c) 2003-2008 aMule Team ( admin@amule.org / http://www.amule.org )
5 // Copyright (c) 2002-2008 Merkur ( devs@emule-project.net / http://www.emule-project.net )
7 // Any parts of this program derived from the xMule, lMule or eMule project,
8 // or contributed by third-party developers are copyrighted by their
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 of the License, or
14 // (at your option) any later version.
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License
22 // along with this program; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 // The backtrace functions contain modified code from libYaMa, (c) Venkatesha Murthy G.
27 // You can check libYaMa at http://personal.pavanashree.org/libyama/
29 #include <tags/FileTags.h>
31 #include <wx/filename.h> // Needed for wxFileName
32 #include <wx/log.h> // Needed for wxLogNull
35 #include "config.h" // Needed for a number of defines
38 #include <wx/stdpaths.h> // Do_not_auto_remove
39 #include <common/StringFunctions.h>
40 #include <common/ClientVersion.h>
41 #include <common/MD5Sum.h>
42 #include <common/Path.h>
45 #include "BitVector.h" // Needed for BitVector
47 #include "OtherFunctions.h" // Interface declarations
58 wxString
GetMuleVersion()
60 wxString
ver(wxT(VERSION
));
62 ver
+= wxT(" compiled with ");
65 // Figure out the wx build-type
66 #if defined(__WXGTK20__)
68 #elif defined(__WXGTK__)
70 // 2.9 has different builds for OSX: Carbon and Cocoa
71 #elif defined(__WXOSX_CARBON__)
72 ver
+= wxT("wxOSX Carbon");
73 #elif defined(__WXOSX_COCOA__)
74 ver
+= wxT("wxOSX Cocoa");
75 // different Cocoa port, "not been updated very actively since beginning 2008"
76 #elif defined(__WXCOCOA__)
77 ver
+= wxT("wxCocoa");
79 #elif defined(__WXMAC__)
81 #elif defined(__WXMSW__) && defined(__VISUALC__)
82 ver
+= wxT("wxMSW VC");
83 #elif defined(__WXMSW__)
87 ver
+= wxString::Format(wxT(" v%d.%d.%d"), wxMAJOR_VERSION
, wxMINOR_VERSION
, wxRELEASE_NUMBER
);
90 ver
+= wxT(" (Debugging)");
94 ver
+= wxString::Format( wxT(" (Snapshot: %s)"), wxT(SVNDATE
));
101 // Formats a filesize in bytes to make it suitable for displaying
102 wxString
CastItoXBytes( uint64 count
)
106 return wxString::Format( wxT("%u "), (unsigned)count
) + wxPLURAL("byte", "bytes", count
) ;
107 else if (count
< 1048576)
108 return wxString::Format( wxT("%u "), (unsigned)count
>> 10) + _("kB") ;
109 else if (count
< 1073741824)
110 return wxString::Format( wxT("%.2f "), (float)(uint32
)count
/1048576) + _("MB") ;
111 else if (count
< 1099511627776LL)
112 return wxString::Format( wxT("%.3f "), (float)((uint32
)(count
/1024))/1048576) + _("GB") ;
114 return wxString::Format( wxT("%.3f "), (float)count
/1099511627776LL) + _("TB") ;
118 wxString
CastItoIShort(uint64 count
)
122 return wxString::Format(wxT("%u"), (uint32
)count
);
123 else if (count
< 1000000)
124 return wxString::Format(wxT("%.0f"),(float)(uint32
)count
/1000) + _("k") ;
125 else if (count
< 1000000000)
126 return wxString::Format(wxT("%.2f"),(float)(uint32
)count
/1000000) + _("M") ;
127 else if (count
< 1000000000000LL)
128 return wxString::Format(wxT("%.2f"),(float)((uint32
)(count
/1000))/1000000) + _("G") ;
130 return wxString::Format(wxT("%.2f"),(float)count
/1000000000000LL) + _("T");
134 wxString
CastItoSpeed(uint32 bytes
)
137 return wxString::Format(wxT("%u "), bytes
) + wxPLURAL("byte/sec", "bytes/sec", bytes
);
138 else if (bytes
< 1048576)
139 return wxString::Format(wxT("%.2f "), bytes
/ 1024.0) + _("kB/s");
141 return wxString::Format(wxT("%.2f "), bytes
/ 1048576.0) + _("MB/s");
145 // Make a time value in seconds suitable for displaying
146 wxString
CastSecondsToHM(uint32 count
, uint16 msecs
)
150 return wxString::Format(
151 wxT("%02u %s"), count
, _("secs"));
153 return wxString::Format(
155 (count
+ ((float)msecs
/1000)), _("secs"));
157 } else if (count
< 3600) {
158 return wxString::Format(
163 } else if (count
< 86400) {
164 return wxString::Format(
170 return wxString::Format(
171 wxT("%u %s %02u:%02u %s"),
174 (count
% 86400)/3600,
181 // Examines a filename and determines the filetype
182 FileType
GetFiletype(const CPath
& filename
)
184 // FIXME: WTF do we have two such functions in the first place?
185 switch (GetED2KFileTypeID(filename
)) {
186 case ED2KFT_AUDIO
: return ftAudio
;
187 case ED2KFT_VIDEO
: return ftVideo
;
188 case ED2KFT_IMAGE
: return ftPicture
;
189 case ED2KFT_PROGRAM
: return ftProgram
;
190 case ED2KFT_DOCUMENT
: return ftText
;
191 case ED2KFT_ARCHIVE
: return ftArchive
;
192 case ED2KFT_CDIMAGE
: return ftCDImage
;
193 default: return ftAny
;
198 // Returns the (translated) description assosiated with a FileType
199 wxString
GetFiletypeDesc(FileType type
, bool translated
)
206 return wxT("Videos");
218 return _("Archives");
220 return wxT("Archives");
225 return _("CD-Images");
227 return wxT("CD-Images");
232 return _("Pictures");
234 return wxT("Pictures");
246 return _("Programs");
248 return wxT("Programs");
261 // Returns the Typename, examining the extention of the given filename
263 wxString
GetFiletypeByName(const CPath
& filename
, bool translated
)
265 return GetFiletypeDesc(GetFiletype(filename
), translated
);
269 // Return the text associated with a rating of a file
270 wxString
GetRateString(uint16 rate
)
273 case 0: return _("Not rated");
274 case 1: return _("Invalid / Corrupt / Fake");
275 case 2: return _("Poor");
276 case 3: return _("Fair");
277 case 4: return _("Good");
278 case 5: return _("Excellent");
279 default: return _("Not rated");
285 * Return the size in bytes of the given size-type
287 * @param type The type (as an int) where: 0 = Byte, 1 = KB, 2 = MB, 3 = GB
289 * @return The amount of Bytes the provided size-type represents
291 * Values over GB aren't handled since the amount of Bytes 1TB represents
292 * is over the uint32 capacity
294 uint32
GetTypeSize(uint8 type
)
296 enum {Bytes
, KB
, MB
, GB
};
300 case Bytes
: size
= 1; break;
301 case KB
: size
= 1024; break;
302 case MB
: size
= 1048576; break;
303 case GB
: size
= 1073741824; break;
304 default: size
= -1; break;
310 // Base16 chars for encode an decode functions
311 static wxChar base16Chars
[17] = wxT("0123456789ABCDEF");
312 static wxChar base32Chars
[33] = wxT("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");
313 #define BASE16_LOOKUP_MAX 23
314 static wxChar base16Lookup
[BASE16_LOOKUP_MAX
][2] = {
341 // Returns a BASE16 encoded byte array
344 // buffer: Pointer to byte array
345 // bufLen: Lenght of buffer array
348 // wxString object with BASE16 encoded byte array
349 wxString
EncodeBase16(const unsigned char* buffer
, unsigned int bufLen
)
353 for(unsigned int i
= 0; i
< bufLen
; ++i
) {
354 Base16Buff
+= base16Chars
[buffer
[i
] >> 4];
355 Base16Buff
+= base16Chars
[buffer
[i
] & 0xf];
362 // Decodes a BASE16 string into a byte array
365 // base16Buffer: String containing BASE16
366 // base16BufLen: Lenght BASE16 coded string's length
369 // buffer: byte array containing decoded string
370 unsigned int DecodeBase16(const wxString
&base16Buffer
, unsigned int base16BufLen
, byte
*buffer
)
372 if (base16BufLen
& 1) {
375 unsigned int ret
= base16BufLen
>> 1;
376 memset( buffer
, 0, ret
);
377 for(unsigned int i
= 0; i
< base16BufLen
; ++i
) {
378 int lookup
= toupper(base16Buffer
[i
]) - wxT('0');
379 // Check to make sure that the given word falls inside a valid range
380 byte word
= (lookup
< 0 || lookup
>= BASE16_LOOKUP_MAX
) ?
381 0xFF : base16Lookup
[lookup
][1];
382 unsigned idx
= i
>> 1;
383 buffer
[idx
] = (i
& 1) ? // odd or even?
384 (buffer
[idx
] | word
) : (word
<< 4);
391 // Returns a BASE32 encoded byte array
394 // buffer: Pointer to byte array
395 // bufLen: Lenght of buffer array
398 // wxString object with BASE32 encoded byte array
399 wxString
EncodeBase32(const unsigned char* buffer
, unsigned int bufLen
)
402 unsigned int i
, index
;
405 for(i
= 0, index
= 0; i
< bufLen
;) {
406 // Is the current word going to span a byte boundary?
408 word
= (buffer
[i
] & (0xFF >> index
));
409 index
= (index
+ 5) % 8;
411 if (i
< bufLen
- 1) {
412 word
|= buffer
[i
+ 1] >> (8 - index
);
416 word
= (buffer
[i
] >> (8 - (index
+ 5))) & 0x1F;
417 index
= (index
+ 5) % 8;
422 Base32Buff
+= (char) base32Chars
[word
];
429 // Decodes a BASE32 string into a byte array
432 // base32Buffer: String containing BASE32
433 // base32BufLen: Lenght BASE32 coded string's length
436 // buffer: byte array containing decoded string
439 unsigned int DecodeBase32(const wxString
&base32Buffer
, unsigned int base32BufLen
, unsigned char *buffer
)
441 size_t nInputLen
= base32Buffer
.Length();
442 uint32 nDecodeLen
= (nInputLen
* 5) / 8;
443 if ((nInputLen
* 5) % 8 > 0) {
446 if (base32BufLen
== 0) {
449 if (nDecodeLen
> base32BufLen
) {
455 for (size_t i
= 0; i
< nInputLen
; ++i
)
457 if (base32Buffer
[i
] >= wxT('A') && base32Buffer
[i
] <= wxT('Z')) {
458 nBits
|= ( base32Buffer
[i
] - wxT('A') );
460 else if (base32Buffer
[i
] >= wxT('a') && base32Buffer
[i
] <= wxT('z')) {
461 nBits
|= ( base32Buffer
[i
] - wxT('a') );
463 else if (base32Buffer
[i
] >= wxT('2') && base32Buffer
[i
] <= wxT('7')) {
464 nBits
|= ( base32Buffer
[i
] - wxT('2') + 26 );
471 *buffer
++ = (byte
)( nBits
>> (nCount
- 8) );
484 * Base64 encoding/decoding command line filter
486 * Copyright (c) 2002-2008 Matthias Gaertner
487 * Adapted to use wxWidgets by
488 * Copyright (c) 2005-2008 Marcelo Roberto Jimenez ( phoenix@amule.org )
491 static const wxString
to_b64(
492 /* 0000000000111111111122222222223333333333444444444455555555556666 */
493 /* 0123456789012345678901234567890123456789012345678901234567890123 */
494 wxT("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"));
497 /* Option variables */
498 static bool g_fUseCRLF
= false;
499 static unsigned int g_nCharsPerLine
= 72;
500 static wxString strHeaderLine
;
503 wxString
EncodeBase64(const char *pbBufferIn
, unsigned int bufLen
)
505 wxString pbBufferOut
;
508 if( !strHeaderLine
.IsEmpty() ) {
509 strHeader
= wxT("-----BEGIN ") + strHeaderLine
+ wxT("-----");
511 strHeader
+= wxT("\r");
513 strHeader
+= wxT("\n");
516 unsigned long nDiv
= ((unsigned long)bufLen
) / 3;
517 unsigned long nRem
= ((unsigned long)bufLen
) % 3;
518 unsigned int NewLineSize
= g_fUseCRLF
? 2 : 1;
520 // Allocate enough space in the output buffer to speed up things
522 strHeader
.Len() * 2 + // header/footer
523 (bufLen
* 4) / 3 + 1 + // Number of codes
524 nDiv
* NewLineSize
+ // Number of new lines
525 (nRem
? 1 : 0) * NewLineSize
); // Last line
526 pbBufferOut
= strHeader
;
528 unsigned long nChars
= 0;
529 const unsigned char *pIn
= (unsigned char*)pbBufferIn
;
531 pbBufferOut
+= to_b64
[ (pIn
[0] >> 2) & 0x3f];
532 pbBufferOut
+= to_b64
[((pIn
[0] << 4) & 0x30) | ((pIn
[1] >> 4) & 0xf)];
533 pbBufferOut
+= to_b64
[((pIn
[1] << 2) & 0x3c) | ((pIn
[2] >> 6) & 0x3)];
534 pbBufferOut
+= to_b64
[ pIn
[2] & 0x3f];
538 if( nChars
>= g_nCharsPerLine
&& g_nCharsPerLine
!= 0 ) {
541 pbBufferOut
+= wxT("\r");
543 pbBufferOut
+= wxT("\n");
548 pbBufferOut
+= to_b64
[ (pIn
[0] >> 2) & 0x3f];
549 pbBufferOut
+= to_b64
[((pIn
[0] << 4) & 0x30) | ((pIn
[1] >> 4) & 0xf)];
550 pbBufferOut
+= to_b64
[ (pIn
[1] << 2) & 0x3c];
551 pbBufferOut
+= wxT("=");
553 if( nChars
>= g_nCharsPerLine
&& g_nCharsPerLine
!= 0 ) {
556 pbBufferOut
+= wxT("\r");
558 pbBufferOut
+= wxT("\n");
562 pbBufferOut
+= to_b64
[ (pIn
[0] >> 2) & 0x3f];
563 pbBufferOut
+= to_b64
[ (pIn
[0] << 4) & 0x30];
564 pbBufferOut
+= wxT("=");
565 pbBufferOut
+= wxT("=");
567 if( nChars
>= g_nCharsPerLine
&& g_nCharsPerLine
!= 0 ) {
570 pbBufferOut
+= wxT("\r");
572 pbBufferOut
+= wxT("\n");
580 pbBufferOut
+= wxT("\r");
582 pbBufferOut
+= wxT("\n");
586 if( !strHeaderLine
.IsEmpty() ) {
587 pbBufferOut
= wxT("-----END ") + strHeaderLine
+ wxT("-----");
589 pbBufferOut
+= wxT("\r");
591 pbBufferOut
+= wxT("\n");
598 unsigned int DecodeBase64(const wxString
&base64Buffer
, unsigned int base64BufLen
, unsigned char *buffer
)
600 int z
= 0; // 0 Normal, 1 skip MIME separator (---) to end of line
601 unsigned int nData
= 0;
604 if (base64BufLen
== 0) {
609 for(unsigned int j
= 0; j
< base64BufLen
; ++j
) {
610 wxChar c
= base64Buffer
[j
];
611 wxChar bits
= wxT('z');
617 else if(c
>= wxT('A') && c
<= wxT('Z')) {
620 else if(c
>= wxT('a') && c
<= wxT('z')) {
621 bits
= c
- wxT('a') + (wxChar
)26;
623 else if(c
>= wxT('0') && c
<= wxT('9')) {
624 bits
= c
- wxT('0') + (wxChar
)52;
626 else if(c
== wxT('+')) {
629 else if(c
== wxT('/')) {
632 else if(c
== wxT('-')) {
635 else if(c
== wxT('=')) {
641 // Skips anything that was not recognized
642 // as a base64 valid char ('y' or 'z')
643 if (bits
< (wxChar
)64) {
646 buffer
[i
+0] = (bits
<< 2) & 0xfc;
649 buffer
[i
+0] |= (bits
>> 4) & 0x03;
650 buffer
[i
+1] = (bits
<< 4) & 0xf0;
653 buffer
[i
+1] |= (bits
>> 2) & 0x0f;
654 buffer
[i
+2] = (bits
<< 6) & 0xc0;
657 buffer
[i
+2] |= bits
& 0x3f;
667 // Syntax error or buffer was empty
679 // Returns the text assosiated with a category type
680 wxString
GetCatTitle(AllCategoryFilter cat
)
683 case acfAll
: return _("all");
684 case acfAllOthers
: return _("all others");
685 case acfIncomplete
: return _("Incomplete");
686 case acfCompleted
: return _("Completed");
687 case acfWaiting
: return _("Waiting");
688 case acfDownloading
: return _("Downloading");
689 case acfErroneous
: return _("Erroneous");
690 case acfPaused
: return _("Paused");
691 case acfStopped
: return _("Stopped");
692 case acfVideo
: return _("Video");
693 case acfAudio
: return _("Audio");
694 case acfArchive
: return _("Archive");
695 case acfCDImages
: return _("CD-Images");
696 case acfPictures
: return _("Pictures");
697 case acfText
: return _("Text");
698 case acfActive
: return _("Active");
699 default: return wxT("?");
704 typedef std::map
<wxString
, EED2KFileTypeClass
> SED2KFileTypeMap
;
705 typedef SED2KFileTypeMap::value_type SED2KFileTypeMapElement
;
706 static SED2KFileTypeMap ED2KFileTypesMap
;
709 class CED2KFileTypes
{
713 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".669"), ED2KFT_AUDIO
)); // 8 channel tracker module
714 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".aac"), ED2KFT_AUDIO
)); // Advanced Audio Coding File
715 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ac3"), ED2KFT_AUDIO
)); // Audio Codec 3 File
716 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".aif"), ED2KFT_AUDIO
)); // Audio Interchange File Format
717 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".aifc"), ED2KFT_AUDIO
)); // Audio Interchange File Format
718 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".aiff"), ED2KFT_AUDIO
)); // Audio Interchange File Format
719 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".amf"), ED2KFT_AUDIO
)); // DSMI Advanced Module Format
720 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".amr"), ED2KFT_AUDIO
)); // Adaptive Multi-Rate Codec File
721 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ams"), ED2KFT_AUDIO
)); // Extreme Tracker Module
722 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ape"), ED2KFT_AUDIO
)); // Monkey's Audio Lossless Audio File
723 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".au"), ED2KFT_AUDIO
)); // Audio File (Sun, Unix)
724 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".aud"), ED2KFT_AUDIO
)); // General Audio File
725 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".audio"), ED2KFT_AUDIO
)); // General Audio File
726 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".cda"), ED2KFT_AUDIO
)); // CD Audio Track
727 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".dbm"), ED2KFT_AUDIO
));
728 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".dmf"), ED2KFT_AUDIO
)); // Delusion Digital Music File
729 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".dsm"), ED2KFT_AUDIO
)); // Digital Sound Module
730 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".dts"), ED2KFT_AUDIO
)); // DTS Encoded Audio File
731 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".far"), ED2KFT_AUDIO
)); // Farandole Composer Module
732 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".flac"), ED2KFT_AUDIO
)); // Free Lossless Audio Codec File
733 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".it"), ED2KFT_AUDIO
)); // Impulse Tracker Module
734 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".m1a"), ED2KFT_AUDIO
)); // MPEG-1 Audio File
735 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".m2a"), ED2KFT_AUDIO
)); // MPEG-2 Audio File
736 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".m4a"), ED2KFT_AUDIO
)); // MPEG-4 Audio File
737 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mdl"), ED2KFT_AUDIO
)); // DigiTrakker Module
738 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".med"), ED2KFT_AUDIO
)); // Amiga MED Sound File
739 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mid"), ED2KFT_AUDIO
)); // MIDI File
740 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".midi"), ED2KFT_AUDIO
)); // MIDI File
741 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mka"), ED2KFT_AUDIO
)); // Matroska Audio File
742 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mod"), ED2KFT_AUDIO
)); // Amiga Music Module File
743 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mol"), ED2KFT_AUDIO
));
744 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mp1"), ED2KFT_AUDIO
)); // MPEG-1 Audio File
745 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mp2"), ED2KFT_AUDIO
)); // MPEG-2 Audio File
746 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mp3"), ED2KFT_AUDIO
)); // MPEG-3 Audio File
747 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mpa"), ED2KFT_AUDIO
)); // MPEG Audio File
748 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mpc"), ED2KFT_AUDIO
)); // Musepack Compressed Audio File
749 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mpp"), ED2KFT_AUDIO
));
750 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mtm"), ED2KFT_AUDIO
)); // MultiTracker Module
751 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".nst"), ED2KFT_AUDIO
)); // NoiseTracker
752 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ogg"), ED2KFT_AUDIO
)); // Ogg Vorbis Compressed Audio File
753 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".okt"), ED2KFT_AUDIO
)); // Oktalyzer Module (Amiga)
754 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".psm"), ED2KFT_AUDIO
)); // Protracker Studio Module
755 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ptm"), ED2KFT_AUDIO
)); // PolyTracker Module
756 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ra"), ED2KFT_AUDIO
)); // Real Audio File
757 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".rmi"), ED2KFT_AUDIO
)); // MIDI File
758 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".s3m"), ED2KFT_AUDIO
)); // Scream Tracker 3 Module
759 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".snd"), ED2KFT_AUDIO
)); // Audio File (Sun, Unix)
760 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".stm"), ED2KFT_AUDIO
)); // Scream Tracker 2 Module
761 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ult"), ED2KFT_AUDIO
)); // UltraTracker
762 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".umx"), ED2KFT_AUDIO
)); // Unreal Music Package
763 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".wav"), ED2KFT_AUDIO
)); // WAVE Audio File
764 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".wma"), ED2KFT_AUDIO
)); // Windows Media Audio File
765 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".wow"), ED2KFT_AUDIO
)); // Grave Composer audio tracker
766 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".xm"), ED2KFT_AUDIO
)); // Fasttracker 2 Extended Module
768 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".3g2"), ED2KFT_VIDEO
)); // 3GPP Multimedia File
769 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".3gp"), ED2KFT_VIDEO
)); // 3GPP Multimedia File
770 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".3gp2"), ED2KFT_VIDEO
)); // 3GPP Multimedia File
771 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".3gpp"), ED2KFT_VIDEO
)); // 3GPP Multimedia File
772 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".asf"), ED2KFT_VIDEO
)); // Advanced Systems Format (MS)
773 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".amv"), ED2KFT_VIDEO
)); // Anime Music Video File
774 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".asf"), ED2KFT_VIDEO
)); // Advanced Systems Format File
775 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".avi"), ED2KFT_VIDEO
)); // Audio Video Interleave File
776 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".bik"), ED2KFT_VIDEO
)); // BINK Video File
777 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".divx"), ED2KFT_VIDEO
)); // DivX-Encoded Movie File
778 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".dvr-ms"),ED2KFT_VIDEO
)); // Microsoft Digital Video Recording
779 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".flc"), ED2KFT_VIDEO
)); // FLIC Video File
780 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".fli"), ED2KFT_VIDEO
)); // FLIC Video File
781 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".flic"), ED2KFT_VIDEO
)); // FLIC Video File
782 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".flv"), ED2KFT_VIDEO
)); // Flash Video File
783 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".hdmov"), ED2KFT_VIDEO
)); // High-Definition QuickTime Movie
784 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ifo"), ED2KFT_VIDEO
)); // DVD-Video Disc Information File
785 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".m1v"), ED2KFT_VIDEO
)); // MPEG-1 Video File
786 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".m2t"), ED2KFT_VIDEO
)); // MPEG-2 Video Transport Stream
787 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".m2ts"), ED2KFT_VIDEO
)); // MPEG-2 Video Transport Stream
788 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".m2v"), ED2KFT_VIDEO
)); // MPEG-2 Video File
789 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".m4b"), ED2KFT_VIDEO
)); // MPEG-4 Video File
790 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".m4v"), ED2KFT_VIDEO
)); // MPEG-4 Video File
791 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mkv"), ED2KFT_VIDEO
)); // Matroska Video File
792 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mov"), ED2KFT_VIDEO
)); // QuickTime Movie File
793 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".movie"), ED2KFT_VIDEO
)); // QuickTime Movie File
794 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mp1v"), ED2KFT_VIDEO
)); // QuickTime Movie File
795 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mp2v"), ED2KFT_VIDEO
)); // MPEG-1 Video File
796 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mp4"), ED2KFT_VIDEO
)); // MPEG-2 Video File
797 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mpe"), ED2KFT_VIDEO
)); // MPEG-4 Video File
798 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mpeg"), ED2KFT_VIDEO
)); // MPEG Video File
799 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mpg"), ED2KFT_VIDEO
)); // MPEG Video File
800 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mps"), ED2KFT_VIDEO
)); // MPEG Video File
801 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mpv"), ED2KFT_VIDEO
)); // MPEG Video File
802 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mpv1"), ED2KFT_VIDEO
)); // MPEG-1 Video File
803 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mpv2"), ED2KFT_VIDEO
)); // MPEG-2 Video File
804 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ogm"), ED2KFT_VIDEO
)); // Ogg Media File
805 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".pva"), ED2KFT_VIDEO
)); // MPEG Video File
806 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".qt"), ED2KFT_VIDEO
)); // QuickTime Movie
807 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ram"), ED2KFT_VIDEO
)); // Real Audio Media
808 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ratdvd"),ED2KFT_VIDEO
)); // RatDVD Disk Image
809 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".rm"), ED2KFT_VIDEO
)); // Real Media File
810 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".rmm"), ED2KFT_VIDEO
)); // Real Media File
811 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".rmvb"), ED2KFT_VIDEO
)); // Real Video Variable Bit Rate File
812 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".rv"), ED2KFT_VIDEO
)); // Real Video File
813 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".rv9"), ED2KFT_VIDEO
));
814 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".smil"), ED2KFT_VIDEO
)); // SMIL Presentation File
815 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".smk"), ED2KFT_VIDEO
)); // Smacker Compressed Movie File
816 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".swf"), ED2KFT_VIDEO
)); // Macromedia Flash Movie
817 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".tp"), ED2KFT_VIDEO
)); // Video Transport Stream File
818 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ts"), ED2KFT_VIDEO
)); // Video Transport Stream File
819 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".vid"), ED2KFT_VIDEO
)); // General Video File
820 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".video"), ED2KFT_VIDEO
)); // General Video File
821 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".vivo"), ED2KFT_VIDEO
)); // VivoActive Video File
822 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".vob"), ED2KFT_VIDEO
)); // DVD Video Object File
823 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".vp6"), ED2KFT_VIDEO
)); // TrueMotion VP6 Video File
824 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".wm"), ED2KFT_VIDEO
)); // Windows Media Video File
825 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".wmv"), ED2KFT_VIDEO
)); // Windows Media Video File
826 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".xvid"), ED2KFT_VIDEO
)); // Xvid-Encoded Video File
828 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".bmp"), ED2KFT_IMAGE
)); // Bitmap Image File
829 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".dcx"), ED2KFT_IMAGE
)); // FAXserve Fax Document
830 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".emf"), ED2KFT_IMAGE
)); // Enhanced Windows Metafile
831 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".gif"), ED2KFT_IMAGE
)); // Graphical Interchange Format File
832 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ico"), ED2KFT_IMAGE
)); // Icon File
833 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".jfif"), ED2KFT_IMAGE
)); // JPEG File Interchange Format
834 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".jpe"), ED2KFT_IMAGE
)); // JPEG Image File
835 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".jpeg"), ED2KFT_IMAGE
)); // JPEG Image File
836 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".jpg"), ED2KFT_IMAGE
)); // JPEG Image File
837 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".pct"), ED2KFT_IMAGE
)); // PICT Picture File
838 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".pcx"), ED2KFT_IMAGE
)); // Paintbrush Bitmap Image File
839 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".pic"), ED2KFT_IMAGE
)); // PICT Picture File
840 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".pict"), ED2KFT_IMAGE
)); // PICT Picture File
841 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".png"), ED2KFT_IMAGE
)); // Portable Network Graphic
842 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".psd"), ED2KFT_IMAGE
)); // Photoshop Document
843 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".psp"), ED2KFT_IMAGE
)); // Paint Shop Pro Image File
844 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".tga"), ED2KFT_IMAGE
)); // Targa Graphic
845 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".tif"), ED2KFT_IMAGE
)); // Tagged Image File
846 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".tiff"), ED2KFT_IMAGE
)); // Tagged Image File
847 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".wmf"), ED2KFT_IMAGE
)); // Windows Metafile
848 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".wmp"), ED2KFT_IMAGE
)); // Windows Media Photo File
849 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".xif"), ED2KFT_IMAGE
)); // ScanSoft Pagis Extended Image Format File
850 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".xpm"), ED2KFT_IMAGE
)); // X-Windows Pixmap
852 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".7z"), ED2KFT_ARCHIVE
)); // 7-Zip Compressed File
853 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ace"), ED2KFT_ARCHIVE
)); // WinAce Compressed File
854 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".alz"), ED2KFT_ARCHIVE
)); // ALZip Archive
855 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".arc"), ED2KFT_ARCHIVE
)); // Compressed File Archive
856 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".arj"), ED2KFT_ARCHIVE
)); // ARJ Compressed File Archive
857 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".bz2"), ED2KFT_ARCHIVE
)); // Bzip Compressed File
858 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".cab"), ED2KFT_ARCHIVE
)); // Cabinet File
859 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".cbr"), ED2KFT_ARCHIVE
)); // Comic Book RAR Archive
860 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".cbz"), ED2KFT_ARCHIVE
)); // Comic Book ZIP Archive
861 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".gz"), ED2KFT_ARCHIVE
)); // Gnu Zipped File
862 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".hqx"), ED2KFT_ARCHIVE
)); // BinHex 4.0 Encoded File
863 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".lha"), ED2KFT_ARCHIVE
)); // LHARC Compressed Archive
864 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".lzh"), ED2KFT_ARCHIVE
)); // LZH Compressed File
865 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".msi"), ED2KFT_ARCHIVE
)); // Microsoft Installer File
866 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".pak"), ED2KFT_ARCHIVE
)); // PAK (Packed) File
867 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".par"), ED2KFT_ARCHIVE
)); // Parchive Index File
868 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".par2"), ED2KFT_ARCHIVE
)); // Parchive 2 Index File
869 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".rar"), ED2KFT_ARCHIVE
)); // WinRAR Compressed Archive
870 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".sea"), ED2KFT_ARCHIVE
)); // Self-Extracting Archive (Mac)
871 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".sit"), ED2KFT_ARCHIVE
)); // Stuffit Archive
872 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".sitx"), ED2KFT_ARCHIVE
)); // Stuffit X Archive
873 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".tar"), ED2KFT_ARCHIVE
)); // Consolidated Unix File Archive
874 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".tbz2"), ED2KFT_ARCHIVE
)); // Tar BZip 2 Compressed File
875 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".tgz"), ED2KFT_ARCHIVE
)); // Gzipped Tar File
876 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".uc2"), ED2KFT_ARCHIVE
)); // UltraCompressor 2 Archive
877 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".xpi"), ED2KFT_ARCHIVE
)); // Mozilla Installer Package
878 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".z"), ED2KFT_ARCHIVE
)); // Unix Compressed File
879 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".zip"), ED2KFT_ARCHIVE
)); // Zipped File
881 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".bat"), ED2KFT_PROGRAM
)); // Batch File
882 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".cmd"), ED2KFT_PROGRAM
)); // Command File
883 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".com"), ED2KFT_PROGRAM
)); // COM File
884 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".exe"), ED2KFT_PROGRAM
)); // Executable File
885 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".hta"), ED2KFT_PROGRAM
)); // HTML Application
886 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".js"), ED2KFT_PROGRAM
)); // Java Script
887 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".jse"), ED2KFT_PROGRAM
)); // Encoded Java Script
888 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".msc"), ED2KFT_PROGRAM
)); // Microsoft Common Console File
889 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".vbe"), ED2KFT_PROGRAM
)); // Encoded Visual Basic Script File
890 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".vbs"), ED2KFT_PROGRAM
)); // Visual Basic Script File
891 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".wsf"), ED2KFT_PROGRAM
)); // Windows Script File
892 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".wsh"), ED2KFT_PROGRAM
)); // Windows Scripting Host File
894 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".bin"), ED2KFT_CDIMAGE
)); // CD Image
895 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".bwa"), ED2KFT_CDIMAGE
)); // BlindWrite Disk Information File
896 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".bwi"), ED2KFT_CDIMAGE
)); // BlindWrite CD/DVD Disc Image
897 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".bws"), ED2KFT_CDIMAGE
)); // BlindWrite Sub Code File
898 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".bwt"), ED2KFT_CDIMAGE
)); // BlindWrite 4 Disk Image
899 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ccd"), ED2KFT_CDIMAGE
)); // CloneCD Disk Image
900 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".cue"), ED2KFT_CDIMAGE
)); // Cue Sheet File
901 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".dmg"), ED2KFT_CDIMAGE
)); // Mac OS X Disk Image
902 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".dmz"), ED2KFT_CDIMAGE
));
903 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".img"), ED2KFT_CDIMAGE
)); // Disk Image Data File
904 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".iso"), ED2KFT_CDIMAGE
)); // Disc Image File
905 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mdf"), ED2KFT_CDIMAGE
)); // Media Disc Image File
906 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".mds"), ED2KFT_CDIMAGE
)); // Media Descriptor File
907 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".nrg"), ED2KFT_CDIMAGE
)); // Nero CD/DVD Image File
908 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".sub"), ED2KFT_CDIMAGE
)); // Subtitle File
909 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".toast"), ED2KFT_CDIMAGE
)); // Toast Disc Image
911 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".chm"), ED2KFT_DOCUMENT
)); // Compiled HTML Help File
912 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".css"), ED2KFT_DOCUMENT
)); // Cascading Style Sheet
913 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".diz"), ED2KFT_DOCUMENT
)); // Description in Zip File
914 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".doc"), ED2KFT_DOCUMENT
)); // Document File
915 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".dot"), ED2KFT_DOCUMENT
)); // Document Template File
916 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".hlp"), ED2KFT_DOCUMENT
)); // Help File
917 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".htm"), ED2KFT_DOCUMENT
)); // HTML File
918 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".html"), ED2KFT_DOCUMENT
)); // HTML File
919 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".nfo"), ED2KFT_DOCUMENT
)); // Warez Information File
920 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".pdf"), ED2KFT_DOCUMENT
)); // Portable Document Format File
921 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".pps"), ED2KFT_DOCUMENT
)); // PowerPoint Slide Show
922 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ppt"), ED2KFT_DOCUMENT
)); // PowerPoint Presentation
923 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".ps"), ED2KFT_DOCUMENT
)); // PostScript File
924 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".rtf"), ED2KFT_DOCUMENT
)); // Rich Text Format File
925 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".text"), ED2KFT_DOCUMENT
)); // General Text File
926 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".txt"), ED2KFT_DOCUMENT
)); // Text File
927 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".wri"), ED2KFT_DOCUMENT
)); // Windows Write Document
928 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".xls"), ED2KFT_DOCUMENT
)); // Microsoft Excel Spreadsheet
929 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".xlt"), ED2KFT_DOCUMENT
)); // Microsoft Excel Template
930 ED2KFileTypesMap
.insert(SED2KFileTypeMapElement(wxT(".xml"), ED2KFT_DOCUMENT
)); // XML File
935 // get the list initialized *before* any code is accessing it
936 CED2KFileTypes theED2KFileTypes
;
938 EED2KFileType
GetED2KFileTypeID(const CPath
& fileName
)
940 const wxString ext
= fileName
.GetExt().Lower();
945 SED2KFileTypeMap::iterator it
= ED2KFileTypesMap
.find(wxT(".") + ext
);
946 if (it
!= ED2KFileTypesMap
.end()) {
947 return it
->second
.GetType();
954 // Retuns the ed2k file type term which is to be used in server searches
955 wxString
GetED2KFileTypeSearchTerm(EED2KFileType iFileID
)
957 if (iFileID
== ED2KFT_AUDIO
) return ED2KFTSTR_AUDIO
;
958 if (iFileID
== ED2KFT_VIDEO
) return ED2KFTSTR_VIDEO
;
959 if (iFileID
== ED2KFT_IMAGE
) return ED2KFTSTR_IMAGE
;
960 if (iFileID
== ED2KFT_DOCUMENT
) return ED2KFTSTR_DOCUMENT
;
961 if (iFileID
== ED2KFT_PROGRAM
) return ED2KFTSTR_PROGRAM
;
962 // NOTE: Archives and CD-Images are published with file type "Pro"
963 if (iFileID
== ED2KFT_ARCHIVE
) return ED2KFTSTR_PROGRAM
;
964 if (iFileID
== ED2KFT_CDIMAGE
) return ED2KFTSTR_PROGRAM
;
966 return wxEmptyString
;
970 // Returns a file type which is used eMule internally only, examining the extention of the given filename
971 wxString
GetFileTypeByName(const CPath
& fileName
)
973 EED2KFileType iFileType
= GetED2KFileTypeID(fileName
);
975 case ED2KFT_AUDIO
: return ED2KFTSTR_AUDIO
;
976 case ED2KFT_VIDEO
: return ED2KFTSTR_VIDEO
;
977 case ED2KFT_IMAGE
: return ED2KFTSTR_IMAGE
;
978 case ED2KFT_DOCUMENT
: return ED2KFTSTR_DOCUMENT
;
979 case ED2KFT_PROGRAM
: return ED2KFTSTR_PROGRAM
;
980 case ED2KFT_ARCHIVE
: return ED2KFTSTR_ARCHIVE
;
981 case ED2KFT_CDIMAGE
: return ED2KFTSTR_CDIMAGE
;
982 default: return wxEmptyString
;
987 // Retuns the ed2k file type integer ID which is to be used for publishing+searching
988 EED2KFileType
GetED2KFileTypeSearchID(EED2KFileType iFileID
)
991 case ED2KFT_AUDIO
: return ED2KFT_AUDIO
;
992 case ED2KFT_VIDEO
: return ED2KFT_VIDEO
;
993 case ED2KFT_IMAGE
: return ED2KFT_IMAGE
;
994 case ED2KFT_DOCUMENT
: return ED2KFT_DOCUMENT
;
995 case ED2KFT_PROGRAM
: return ED2KFT_PROGRAM
;
996 // NOTE: Archives and CD-Images are published+searched with file type "Pro"
997 // NOTE: If this gets changed, the function 'GetED2KFileTypeSearchTerm' also needs to get updated!
998 case ED2KFT_ARCHIVE
: return ED2KFT_PROGRAM
;
999 case ED2KFT_CDIMAGE
: return ED2KFT_PROGRAM
;
1000 default: return ED2KFT_ANY
;
1006 * Dumps a buffer to a wxString
1008 wxString
DumpMemToStr(const void *buff
, int n
, const wxString
& msg
, bool ok
)
1010 const unsigned char *p
= (const unsigned char *)buff
;
1011 int lines
= (n
+ 15)/ 16;
1014 // Allocate aproximetly what is needed
1015 result
.Alloc( ( lines
+ 1 ) * 80 );
1016 if ( !msg
.IsEmpty() ) {
1017 result
+= msg
+ wxT(" - ok=") + ( ok
? wxT("true, ") : wxT("false, ") );
1020 result
+= wxString::Format( wxT("%d bytes\n"), n
);
1021 for ( int i
= 0; i
< lines
; ++i
) {
1023 result
+= wxString::Format( wxT("%08x "), i
* 16 );
1025 // Show two columns of hex-values
1026 for ( int j
= 0; j
< 2; ++j
) {
1027 for ( int k
= 0; k
< 8; ++k
) {
1028 int pos
= 16 * i
+ 8 * j
+ k
;
1031 result
+= wxString::Format( wxT("%02x "), p
[pos
] );
1039 // Show a column of ascii-values
1040 for ( int k
= 0; k
< 16; ++k
) {
1041 int pos
= 16 * i
+ k
;
1044 if ( isspace( p
[pos
] ) ) {
1046 } else if ( !isgraph( p
[pos
] ) ) {
1049 result
+= (wxChar
)p
[pos
];
1055 result
+= wxT("|\n");
1064 * Dumps a buffer to stdout
1066 void DumpMem(const void *buff
, int n
, const wxString
& msg
, bool ok
)
1068 printf("%s\n", (const char*)unicode2char(DumpMemToStr( buff
, n
, msg
, ok
)) );
1073 // Dump mem in dword format
1074 void DumpMem_DW(const uint32
*ptr
, int count
)
1076 for(int i
= 0; i
< count
; i
++) {
1077 printf("%08x ", ptr
[i
]);
1078 if ( (i
% 4) == 3) printf("\n");
1084 wxString
GetConfigDir(const wxString
&configFileBase
)
1087 static wxString configPath
;
1089 if (configPath
.IsEmpty()) {
1090 // "Portable aMule" - Use aMule from an external USB drive
1091 // Check for ./config/amule.conf (or whatever gets passed as configFile)
1092 // and use this configuration if found
1093 const wxString configDir
= JoinPaths(wxFileName::GetCwd(), wxT("config"));
1094 const wxString configFile
= JoinPaths(configDir
, configFileBase
);
1096 if (CPath::DirExists(configDir
) && CPath::FileExists(configFile
)) {
1097 AddLogLineN(CFormat(_("Using config dir: %s")) % configDir
);
1099 configPath
= configDir
;
1101 configPath
= wxStandardPaths::Get().GetUserDataDir();
1104 configPath
+= wxFileName::GetPathSeparator();
1111 /*************************** Locale specific stuff ***************************/
1114 # define SETWINLANG(LANG, SUBLANG)
1116 # define SETWINLANG(LANG, SUBLANG) \
1117 info.WinLang = LANG; \
1118 info.WinSublang = SUBLANG;
1121 #define CUSTOMLANGUAGE(wxid, iso, winlang, winsublang, dir, desc) \
1122 info.Language = wxid; \
1123 info.CanonicalName = wxT(iso); \
1124 info.LayoutDirection = dir; \
1125 info.Description = wxT(desc); \
1126 SETWINLANG(winlang, winsublang) \
1127 wxLocale::AddLanguage(info);
1129 void InitCustomLanguages()
1131 wxLanguageInfo info
;
1133 #if !wxCHECK_VERSION(2, 9, 0)
1134 CUSTOMLANGUAGE(wxLANGUAGE_ASTURIAN
, "ast", 0, 0, wxLayout_LeftToRight
, "Asturian");
1139 void InitLocale(wxLocale
& locale
, int language
)
1141 locale
.Init(language
, wxLOCALE_LOAD_DEFAULT
);
1143 #if defined(__WXMAC__) || defined(__WXMSW__)
1144 locale
.AddCatalogLookupPathPrefix(JoinPaths(wxStandardPaths::Get().GetDataDir(), wxT("locale")));
1146 locale
.AddCatalog(wxT(PACKAGE
));
1150 int StrLang2wx(const wxString
& language
)
1152 // get rid of possible encoding and modifier
1153 wxString
lang(language
.BeforeFirst('.').BeforeFirst('@'));
1155 if (!lang
.IsEmpty()) {
1156 const wxLanguageInfo
*lng
= wxLocale::FindLanguageInfo(lang
);
1158 int langID
= lng
->Language
;
1159 // Traditional Chinese: original Chinese, used in Taiwan, Hong Kong and Macau.
1160 // Simplified Chinese: simplified Chinese characters used in Mainland China since 1950s, and in some other places such as Singapore and Malaysia.
1162 // Chinese (Traditional) contains zh_TW, zh_HK and zh_MO (but there are differences in some words).
1163 // Because of most Traditional Chinese user are in Taiwan, zh_TW becomes the representation of Traditional Chinese.
1164 // Chinese (Simplified) contains zh_CN, zh_SG and zh_MY. In the same reason, zh_CN becomes the representation of Simplified Chinese.
1165 // (see http://forum.amule.org/index.php?topic=13208.msg98043#msg98043 )
1167 // wx maps "Traditional Chinese" to "Chinese" however. This must me corrected:
1168 if (langID
== wxLANGUAGE_CHINESE
) {
1169 langID
= wxLANGUAGE_CHINESE_TRADITIONAL
;
1173 return wxLANGUAGE_DEFAULT
;
1176 return wxLANGUAGE_DEFAULT
;
1181 wxString
wxLang2Str(const int lang
)
1183 if (lang
!= wxLANGUAGE_DEFAULT
) {
1184 const wxLanguageInfo
*lng
= wxLocale::GetLanguageInfo(lang
);
1186 return lng
->CanonicalName
;
1188 return wxEmptyString
;
1191 return wxEmptyString
;
1195 /*****************************************************************************/
1197 wxString
GetPassword() {
1198 wxString pass_plain
;
1201 pass_plain
= char2unicode(getpass("Enter password for mule connection: "));
1203 //#warning This way, pass enter is not hidden on windows. Bad thing.
1206 printf("Enter password for mule connection: \n");
1208 fgets(temp_str
, 512, stdin
);
1209 temp_str
[strlen(temp_str
)-1] = '\0';
1210 pass_plain
= char2unicode(temp_str
);
1212 wxCHECK2(password
.Decode(MD5Sum(pass_plain
).GetHash()), /* Do nothing. */ );
1213 // MD5 hash for an empty string, according to rfc1321.
1214 if (password
.Encode() == wxT("D41D8CD98F00B204E9800998ECF8427E")) {
1215 printf("No empty password allowed.\n");
1216 return GetPassword();
1220 return password
.Encode();
1224 const uint8
BitVector::s_posMask
[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
1225 const uint8
BitVector::s_negMask
[] = {0xFE, 0xFD, 0xFB, 0xF7, 0xEF, 0xDF, 0xBF, 0x7F};
1227 // File_checked_for_headers