YAPOG  0.0.1
Yet Another Pokemon Online Game
FileChecker.hpp
Go to the documentation of this file.
1 #ifndef YAPOG_FILECHECKER_HPP
2 # define YAPOG_FILECHECKER_HPP
3 
4 # include <boost/asio.hpp>
5 # include <boost/filesystem.hpp>
6 # include <sstream>
7 # include <vector>
8 # include <SFML/Network.hpp>
10 # include "YAPOG/Macros.hpp"
11 # include "YAPOG/System/IntTypes.hpp"
13 # include "YAPOG/System/IntTypes.hpp"
14 # include "YAPOG/System/IOStream.hpp"
15 # include "YAPOG/System/String.hpp"
16 # include "YAPOG/System/Hash/Md5.hpp"
17 
18 namespace yap
19 {
21  {
23  public:
24  typedef struct MyFile
25  {
26  MyFile (String fn, size_t fs);
27 
29  size_t Filesize;
30  } MyFileType;
31 
32  typedef boost::filesystem::path PathType;
33  typedef std::vector<PathType> VPathType;
36 
37  FileChecker (PathType path);
38  FileChecker (String filename);
39  FileChecker (String filename, String md5, size_t filesize);
40  ~FileChecker ();
41 
42  void SetFilename (String filename);
43  void SetMd5 (String md5);
44  void SetDlEnd (bool dl);
45 
46  String GetFilename ();
47  size_t GetFilesize ();
48  String GetMd5 ();
49  VFilesType GetVfile ();
50  UInt64 GetSizeDownloaded ();
51  UInt16 GetFileDownloaded ();
52  bool GetDlEnd ();
53  VFileType& GetVFileToDl ();
54 
55  void Launch ();
56  void Launch (String sourcepath);
57  void SendFileToDownload (FileChecker* fc);
58  bool Update (FileChecker* fc);
59 
60  private:
61  // Server checking.
62  void GetFileToDownload ();
63  bool Compare (FileChecker* const c, FileChecker* const s);
64  String VectorFind (VFilesType vp, FileChecker* p);
65  bool UpdateFTP (FileChecker* fc);
66  bool LocalUpdate (FileChecker* fc);
67 
72  size_t filesize_;
77  bool dlend_;
78 
80  };
81 } // namespace yap
82 
83 #endif /* FILECHECKER_HPP */