1 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 /// Name:         Ed2kHash Class
3 ///
4 /// Purpose:      aMule ed2k link creator
5 ///
6 /// Author:       ThePolish <thepolish@vipmail.ru>
7 ///
8 /// Copyright (c) 2004-2011 ThePolish ( thepolish@vipmail.ru )
9 ///
10 /// Copyright (c) 2004-2011 Marcelo Roberto Jimenez ( phoenix@amule.org )
11 ///
12 /// This program is free software; you can redistribute it and/or modify
13 /// it under the terms of the GNU General Public License as published by
14 /// the Free Software Foundation; either version 2 of the License, or
15 /// (at your option) any later version.
16 ///
17 /// This program is distributed in the hope that it will be useful,
18 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
19 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 /// GNU General Public License for more details.
21 ///
22 /// You should have received a copy of the GNU General Public License
23 /// along with this program; if not, write to the
24 /// Free Software Foundation, Inc.,
25 /// 51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
26 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
27 
28 #ifndef _ED2KHASH_H
29 #define _ED2KHASH_H
30 
31 
32 #include <wx/filename.h>
33 
34 #include "md4.h"
35 
36 class Ed2kHash:public MD4
37   {
38   private:
39 
40     wxArrayString m_ed2kArrayOfHashes;
41     wxString m_filename;
42     uint64_t m_fileSize;
43 
44   protected:
45 
46     /// Strip all non-alphanumeric characters of a filename string
47     wxString CleanFilename(const wxString& filename);
48 
49   public:
50     /// Constructor
51     Ed2kHash ();
52 
53     /// Destructor
54     ~Ed2kHash ();
55 
56     /// Set Ed2k hash from a file
57     bool SetED2KHashFromFile(const wxFileName& filename, MD4Hook hook);
58 
59     /// Set Ed2k hash from a file
60     bool SetED2KHashFromFile(const wxString& filename, MD4Hook hook);
61 
62     /// Get Ed2k Array of hashes
63     wxArrayString GetED2KHash();
64 
65     /// Get Ed2k link
66     wxString GetED2KLink(const bool addPartHashes=false, const wxArrayString* arrayOfUrls = NULL);
67   };
68 
69 #endif /* _ED2KHASH_H */
70 
71 // File_checked_for_headers
72