diff options
author | daniel-Jones <daniel@danieljon.es> | 2016-07-22 11:43:37 +0930 |
---|---|---|
committer | daniel-Jones <daniel@danieljon.es> | 2016-07-22 11:43:37 +0930 |
commit | 0b6f9e4af8f1ab695a193fabdb32b6219223c455 (patch) | |
tree | 54765e0b37d700206b66ba479d80a6d4995907e8 /parse_file.cpp | |
parent | b9224cb9de71995b9f89787d47b98f9bbb188d58 (diff) | |
download | csgo_stats-0b6f9e4af8f1ab695a193fabdb32b6219223c455.tar.gz csgo_stats-0b6f9e4af8f1ab695a193fabdb32b6219223c455.zip |
Added parsing functions for both steam and csgo data, added testing displays on the UI etc
Diffstat (limited to 'parse_file.cpp')
-rw-r--r-- | parse_file.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/parse_file.cpp b/parse_file.cpp new file mode 100644 index 0000000..b939a7d --- /dev/null +++ b/parse_file.cpp @@ -0,0 +1,49 @@ +#include "parse_file.h" + +parse_file::parse_file() +{ + +} + +QString parse_file::parse_user_data(QString option, QString split) +{ + /* + * this function parses the userdata.dat file for info on the users steam account + */ + QFile file("userdata.dat"); + if (file.open(QIODevice::ReadOnly)) + { + QTextStream in(&file); + while (!in.atEnd()) + { + QString line = in.readLine(); + if (line.contains(option)) + return line.split(split)[1].replace("\"", "").replace(",", ""); + } + file.close(); + } + return "null"; +} + +QString parse_file::parse_csgo_data(QString option) +{ + /* + * this function parses csgodata.dat for stats + */ + QFile file("csgodata.dat"); + if (file.open(QIODevice::ReadOnly)) + { + QTextStream in(&file); + while (!in.atEnd()) + { + QString line = in.readLine(); + if (line.contains(option)) + { + line = in.readLine(); + return line.split(": ")[1]; + } + } + file.close(); + } + return "null"; +} |