-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstartupinfo.cpp
More file actions
65 lines (51 loc) · 2.23 KB
/
startupinfo.cpp
File metadata and controls
65 lines (51 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (c) 2025 tudify
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include <iostream>
#include <fstream>
#include <string>
// worlds least hardcoded JSON fetcher
// if you're seeing this, its too late. you've seen too much. RUN
using namespace std;
string getValueFromJson(const string& json, const string& key) {
string pattern = "\"" + key + "\"";
size_t keyPos = json.find(pattern);
if (keyPos == string::npos) return "";
size_t colonPos = json.find(":", keyPos);
if (colonPos == string::npos) return "";
size_t quoteStart = json.find("\"", colonPos + 1);
if (quoteStart == string::npos) return "";
size_t quoteEnd = json.find("\"", quoteStart + 1);
if (quoteEnd == string::npos) return "";
return json.substr(quoteStart + 1, quoteEnd - quoteStart - 1);
}
int main() {
ifstream file("info.json");
if (!file.is_open()) {
cout << "Could not open info.json\n";
return 1;
}
string json((istreambuf_iterator<char>(file)),
istreambuf_iterator<char>());
string version = getValueFromJson(json, "version");
string name = getValueFromJson(json, "name");
string ide = getValueFromJson(json, "ide");
string engine = getValueFromJson(json, "engine");
if (version.empty()) version = "Unknown";
if (name.empty()) name = "Unknown App";
if (ide.empty()) ide = "Unknown IDE";
if (engine.empty()) engine = "Unknown Engine";
cout << name << " " << version << " initialising..." << endl;
cout << "Engine: " << engine << endl;
cout << "Development IDE: " << ide << endl;
cout << "This project is made by volunteers. Please don’t steal our code!" << endl;
cout << "initialised. Waiting for Qt..." << endl;
return 0;
}