CClock – Extend of CFile class to work with the .setÂ
Installation
- Put FileSet.mqh into your IncludeFiles folder
- Put Test.set into your Files folder
- Put FileSet Test.mqh into your Scripts folder
- Use one of the samples that shows the usage
Inputs
- FileName : the filename of the .set file
Methods
 Â
  int              Open(const string file_name,const int open_flags);
 Â
  int              Count(void);
  bool              ContainsKey(string key);
 Â
  template<typename TValue>
  bool              TryGetValue(const string key, TValue &value);
  bool              TryGetValue(const string key, string &value);
Usage
#include <FilesFileSet.mqh>
CFileSet FileSet;
void OnStart()
  {
  FileSet.Open("Test.set",FILE_READ|FILE_SHARE_READ);
  char test_char;
  if(FileSet.TryGetValue("InpTestChar",test_char))
      Print(test_char);
  short test_short;
  if(FileSet.TryGetValue("InpTestShort",test_short))
      Print(test_short);
  int test_int;
  if(FileSet.TryGetValue("InpTestInteger",test_int))
      Print(test_int);
  long test_long;
  if(FileSet.TryGetValue("InpTestLong",test_long))
      Print(test_long);
  float test_float;
  if(FileSet.TryGetValue("InpTestFloat",test_float))
      Print(test_float);
  double test_double;
  if(FileSet.TryGetValue("InpTestDouble",test_double))
      Print(test_double);
  string test_string;
  if(FileSet.TryGetValue("InpTestString",test_string))
      Print(test_string);
  bool test_bool;
  if(FileSet.TryGetValue("InpTestBool",test_bool))
      Print(test_bool);
  datetime test_datetime;
  if(FileSet.TryGetValue("InpTestDatetime",test_datetime))
      Print(TimeToString(test_datetime,TIME_DATE|TIME_SECONDS));
  color test_color;
  if(FileSet.TryGetValue("InpTestColor",test_color))
      Print(ColorToString(test_color,true));
  ENUM_TEST test_enum;
  if(FileSet.TryGetValue("InpTestEnum",test_enum))
      Print(EnumToString(test_enum));
  FileSet.Close();
  }
It should show the below result with the sample file (Test.set)
2021.05.31 05:09:27.546 FileSet Test (EURUSD,H1)Â Â Â Â Â Â Â Â 97
2021.05.31 05:09:27.548 FileSet Test (EURUSD,H1)Â Â Â Â Â Â Â Â 32767
2021.05.31 05:09:27.548 FileSet Test (EURUSD,H1)Â Â Â Â Â Â Â Â 2147483647
2021.05.31 05:09:27.548 FileSet Test (EURUSD,H1)Â Â Â Â Â Â Â Â 9223372036854775807
2021.05.31 05:09:27.548 FileSet Test (EURUSD,H1)Â Â Â Â Â Â Â Â 1.00001
2021.05.31 05:09:27.548 FileSet Test (EURUSD,H1)Â Â Â Â Â Â Â Â 2.225073858507201e-308
2021.05.31 05:09:27.548 FileSet Test (EURUSD,H1)Â Â Â Â Â Â Â Â This is InpTestString
2021.05.31 05:09:27.548 FileSet Test (EURUSD,H1)Â Â Â Â Â Â Â Â false
2021.05.31 05:09:27.548 FileSet Test (EURUSD,H1)Â Â Â Â Â Â Â Â 2000.01.01 00:00:00
2021.05.31 05:09:27.548 FileSet Test (EURUSD,H1)Â Â Â Â Â Â Â Â clrBlack
2021.05.31 05:09:27.548 FileSet Test (EURUSD,H1)Â Â Â Â Â Â Â Â TEST3