-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ab2b57
commit 4aec6b8
Showing
10 changed files
with
214 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
// Используйте IntelliSense, чтобы узнать о возможных атрибутах. | ||
// Наведите указатель мыши, чтобы просмотреть описания существующих атрибутов. | ||
// Для получения дополнительной информации посетите: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "g++.exe - Сборка и отладка активного файла", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "C:\\msys64\\mingw64\\bin", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe", | ||
"setupCommands": [ | ||
{ | ||
"description": "Включить автоматическое форматирование для gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
} | ||
], | ||
"preLaunchTask": "C/C++: g++.exe сборка активного файла" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
{ | ||
"files.associations": { | ||
"ostream": "cpp", | ||
"string": "cpp", | ||
"iostream": "cpp", | ||
"cctype": "cpp", | ||
"clocale": "cpp", | ||
"cmath": "cpp", | ||
"csetjmp": "cpp", | ||
"csignal": "cpp", | ||
"cstdarg": "cpp", | ||
"cstddef": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"ctime": "cpp", | ||
"cwchar": "cpp", | ||
"cwctype": "cpp", | ||
"any": "cpp", | ||
"array": "cpp", | ||
"atomic": "cpp", | ||
"bit": "cpp", | ||
"*.tcc": "cpp", | ||
"bitset": "cpp", | ||
"cfenv": "cpp", | ||
"charconv": "cpp", | ||
"chrono": "cpp", | ||
"cinttypes": "cpp", | ||
"codecvt": "cpp", | ||
"compare": "cpp", | ||
"complex": "cpp", | ||
"concepts": "cpp", | ||
"condition_variable": "cpp", | ||
"coroutine": "cpp", | ||
"cstdint": "cpp", | ||
"cuchar": "cpp", | ||
"deque": "cpp", | ||
"forward_list": "cpp", | ||
"list": "cpp", | ||
"map": "cpp", | ||
"set": "cpp", | ||
"unordered_map": "cpp", | ||
"unordered_set": "cpp", | ||
"vector": "cpp", | ||
"exception": "cpp", | ||
"algorithm": "cpp", | ||
"functional": "cpp", | ||
"iterator": "cpp", | ||
"memory": "cpp", | ||
"memory_resource": "cpp", | ||
"numeric": "cpp", | ||
"optional": "cpp", | ||
"random": "cpp", | ||
"ratio": "cpp", | ||
"regex": "cpp", | ||
"string_view": "cpp", | ||
"system_error": "cpp", | ||
"tuple": "cpp", | ||
"type_traits": "cpp", | ||
"utility": "cpp", | ||
"fstream": "cpp", | ||
"future": "cpp", | ||
"initializer_list": "cpp", | ||
"iomanip": "cpp", | ||
"iosfwd": "cpp", | ||
"istream": "cpp", | ||
"limits": "cpp", | ||
"mutex": "cpp", | ||
"new": "cpp", | ||
"numbers": "cpp", | ||
"ranges": "cpp", | ||
"scoped_allocator": "cpp", | ||
"shared_mutex": "cpp", | ||
"span": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"stop_token": "cpp", | ||
"streambuf": "cpp", | ||
"thread": "cpp", | ||
"typeindex": "cpp", | ||
"typeinfo": "cpp", | ||
"valarray": "cpp", | ||
"variant": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"tasks": [ | ||
{ | ||
"type": "cppbuild", | ||
"label": "C/C++: g++.exe сборка активного файла", | ||
"command": "C:\\msys64\\mingw64\\bin\\g++.exe", | ||
"args": [ | ||
"-g", | ||
"${file}", | ||
"-o", | ||
"${fileDirname}\\${fileBasenameNoExtension}.exe" | ||
], | ||
"options": { | ||
"cwd": "C:\\msys64\\mingw64\\bin" | ||
}, | ||
"problemMatcher": [ | ||
"$gcc" | ||
], | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"detail": "Задача создана отладчиком." | ||
} | ||
], | ||
"version": "2.0.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <bits/stdc++.h> | ||
#include "Update.hpp" | ||
|
||
#define VERSION 2 | ||
|
||
int main(int argc, char * argv[]) | ||
{ | ||
update(argc, argv, "https://raw.githubusercontent.com/Purpursarkans/update/main/version", VERSION, "Example"); | ||
|
||
std::cout << "all update" << std::endl; | ||
|
||
system("pause"); | ||
|
||
return 0; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#ifndef UPDATE_HPP | ||
#define UPDATE_HPP | ||
|
||
#include <bits/stdc++.h> | ||
|
||
void update(int argc, char *argv[], std::string sVersionUrl, int sVersionI, std::string exeName) | ||
{ | ||
static std::string exeNameCopy = exeName + "2"; | ||
|
||
for (int i = 1; i < argc; i++) | ||
{ | ||
std::string temp = argv[i]; | ||
if (temp == "-u") | ||
{ | ||
std::string copy_ = "copy " + exeNameCopy + ".exe " + exeName + ".exe /Y"; | ||
system(copy_.c_str()); | ||
|
||
std::string start = "start cmd /C \"" + exeName + ".exe -d\""; | ||
system(start.c_str()); | ||
exit(0); | ||
} | ||
else if (temp == "-d") | ||
{ | ||
std::string remove_ = exeNameCopy + ".exe"; | ||
while (remove(remove_.c_str())) {} | ||
|
||
std::string start = "start " + exeName + ".exe"; | ||
system(start.c_str()); | ||
exit(0); | ||
} | ||
} | ||
|
||
std::string downloadVersion = "curl -o version -L " + sVersionUrl; | ||
system(downloadVersion.c_str()); | ||
|
||
std::ifstream rFile("version"); | ||
std::string versionS; | ||
std::string downloadUrl; | ||
std::getline(rFile, versionS); | ||
std::getline(rFile, downloadUrl); | ||
int versionI = std::stoi(versionS); | ||
|
||
rFile.close(); | ||
remove("version"); | ||
|
||
if (versionI > sVersionI) | ||
{ | ||
std::cout << "Need update" << std::endl; | ||
std::cout << "Start update" << std::endl; | ||
|
||
std::string curl = "curl -o " + exeNameCopy + ".exe " + "-L " + downloadUrl + " && start cmd /C \"" + exeNameCopy + ".exe -u\""; | ||
system(curl.c_str()); | ||
exit(0); | ||
} | ||
} | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
2 | ||
https://github.com/Purpursarkans/update/blob/main/update.exe?raw=true | ||
https://github.com/Purpursarkans/update/blob/main/Example.exe?raw=true |