Skip to content

Commit 97b897e

Browse files
committed
Merge branch 'dev'
2 parents e0b6c69 + 0e023d0 commit 97b897e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1964
-1123
lines changed

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set(CMAKE_C_FLAGS "-m32 -Wall -O1 -s -mtune=core2 -Wno-unused-result")
77
set(CMAKE_SHARED_LINKER_FLAGS "-m32 -s -shared -static-libgcc -static-libstdc++")
88
set(CMAKE_SHARED_LIBRARY_PREFIX "")
99
set(CMAKE_STATIC_LIBRARY_PREFIX "")
10-
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
10+
add_definitions(-D_CRT_SECURE_NO_WARNINGS -DWIN32_LEAN_AND_MEAN)
1111

1212
# CPack
1313
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
@@ -22,6 +22,7 @@ conan_basic_setup()
2222
# Tests
2323
include(CTest)
2424
add_executable(gsclib.Tests)
25+
add_dependencies(gsclib.Tests gsclib.Static)
2526
target_link_libraries(gsclib.Tests PUBLIC ${CONAN_LIBS} gsclib.Static)
2627
add_test(NAME Tests COMMAND gsclib.Tests)
2728

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
[![CodeFactor](https://img.shields.io/codefactor/grade/github/Iswenzz/gsclib?label=codefactor&logo=codefactor)](https://www.codefactor.io/repository/github/iswenzz/gsclib)
55
[![License](https://img.shields.io/github/license/Iswenzz/gsclib?color=blue&logo=gitbook&logoColor=white)](https://github.com/Iswenzz/gsclib/blob/master/LICENSE)
66

7-
``gsclib`` acts as a standard library extension for the Call of Duty 4 scripting language. The features this library provides consists of an FTP/FTPS/SFTP client, an HTTP/HTTPS client, Regular Expression (PCRE2) support, Language Integrated Query (Linq) support, a MySQL connector for databases, casting/type conversion/fmt and other type utilities, ZIP files, and much more. More detailed information on each feature can be found in the documentation section.
7+
``gsclib`` acts as a standard library extension for the Call of Duty 4 scripting language. The features this library provides consists of an FTP/FTPS/SFTP client, an HTTP/HTTPS client, Regular Expression (PCRE2) support, Language Integrated Query (Linq) support, a MySQL connector for databases, casting/type conversion/fmt and other type utilities, ZIP files, async workers, and much more. More detailed information on each feature can be found in the documentation section.
88

99
## Features & Documentation
10-
* [HTTP/HTTPS client](https://github.com/Iswenzz/gsclib/blob/master/docs/https.md)
10+
* [HTTP/HTTPS client](https://github.com/Iswenzz/gsclib/blob/master/docs/http.md)
1111
* [FTP/FTPS/SFTP client](https://github.com/Iswenzz/gsclib/blob/master/docs/ftp.md)
1212
* [Regular expression (PCRE2)](https://github.com/Iswenzz/gsclib/blob/master/docs/regex.md)
1313
* [Language Integrated Query (Linq)](https://github.com/Iswenzz/gsclib/blob/master/docs/linq.md)
@@ -24,7 +24,7 @@ In order to use this library, just download the archived file down below, and ex
2424

2525
## Building (Linux)
2626
_Pre-Requisites:_
27-
1. Edit plugin_handle.h and recompile your server:
27+
1. Edit plugin_handle.h then recompile the server with an empty obj directory:
2828
```c
2929
#define MAX_SCRIPTFUNCTIONS 256
3030
```

conanfile.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
class gsclib(ConanFile):
44
name = "gsclib"
5-
version = "1.2.0"
5+
version = "1.3.0"
66
license = "LICENCE"
77
url = "https://github.com/Iswenzz/gsclib"
88
description = "gsclib acts as a standard library extension for the Call of Duty 4 scripting language."
99

1010
requires = (
11-
"CGSC/1.1.1",
11+
"CGSC/1.2.0",
1212
"cwalk/1.2.5",
1313
"greatest/1.5.0",
1414
"libmysqlclient/8.0.17",

docs/curl.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,37 @@ CURL_Version();
88
```
99
<hr>
1010

11-
#### ``CURL_AddHeader(<commands>)``
11+
#### ``CURL_AddHeader(<request>, <commands>)``
1212
Set CURL Header for the next requests.
1313

1414
```c
15-
CURL_AddHeader("Accept: application/json");
16-
CURL_AddHeader("Content-Type: application/json");
17-
CURL_AddHeader("RNFR libcurl.dll,RNTO test.dll");
18-
CURL_AddHeader("rename libcurl.dll test.dll");
15+
CURL_AddHeader(request, "Accept: application/json");
16+
CURL_AddHeader(request, "Content-Type: application/json");
17+
CURL_AddHeader(request, "RNFR libcurl.dll,RNTO test.dll");
18+
CURL_AddHeader(request, "rename libcurl.dll test.dll");
1919
```
2020
<hr>
2121
22-
#### ``CURL_HeaderCleanup()``
22+
#### ``CURL_HeaderCleanup(<request>)``
2323
Clean header set by CURL_AddHeader.
2424
2525
```c
26-
CURL_HeaderCleanup();
26+
CURL_HeaderCleanup(request);
2727
```
2828
<hr>
2929

30-
#### ``CURL_AddOpt(<option>, <value>)``
30+
#### ``CURL_AddOpt(<request>, <option>, <value>)``
3131
Add a CURL Option for the next request.
3232

3333
```c
34-
CURL_AddOpt(47, 1);
34+
CURL_AddOpt(request, 47, 1);
3535
```
3636
<hr>
3737
38-
#### ``CURL_OptCleanup()``
38+
#### ``CURL_OptCleanup(<request>)``
3939
Clean all CURL Option added by CURL_AddOpt.
4040
4141
```c
42-
CURL_OptCleanup();
42+
CURL_OptCleanup(request);
4343
```
4444
<hr>

docs/ftp.md

+39-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# FTP/FTPS/SFTP
22

3-
### :warning: **Requests are not thread safe, you'll need your own scripts in GSC !**
3+
### WARNING: **Requests are not thread safe, you'll need your own scripts in GSC to handle one request at a time !**
4+
5+
## Example
6+
```c
7+
request = FTP_Init();
8+
FTP_PostFile(request, "temp/test.txt", "get.txt");
9+
10+
while (AsyncStatus(request) <= 1)
11+
wait 0.05;
12+
13+
FTP_Free(request);
14+
```
415
516
#### ``SFTP_Connect(<host>, <user>, <password>, <port>)``
617
Connect to an SFTP server, the connection can be closed with FTP_Close.
@@ -26,28 +37,48 @@ FTP_Close();
2637
```
2738
<hr>
2839

29-
#### ``FTP_Shell()``
40+
#### ``FTP_Init()``
41+
Initialize a FTP request.
42+
The request should be freed when done using FTP_Free.
43+
44+
```c
45+
request = FTP_Init();
46+
```
47+
<hr>
48+
49+
#### ``FTP_Free(<request>)``
50+
Initialize a FTP request.
51+
52+
```c
53+
FTP_Free(request);
54+
```
55+
<hr>
56+
57+
#### ``FTP_Shell(<request>)``
3058
Execute a command to the FTP/FTPS/SFTP server.
3159
The commands should be set with CURL_AddHeader.
3260
3361
```c
34-
CURL_AddHeader("rename libcurl.dll test.dll");
35-
FTP_Shell();
62+
request = FTP_Init();
63+
CURL_AddHeader(request, "rename libcurl.dll test.dll");
64+
FTP_Shell(request);
3665
```
3766
<hr>
3867

39-
#### ``FTP_PostFile(<filepath>, <uploadfilepath>)``
68+
#### ``FTP_PostFile(<request>, <filepath>, <uploadfilepath>)``
4069
Upload a file to the FTP/FTPS/SFTP server.
4170

4271
```c
43-
FTP_PostFile("libcurl.dll", "/user/libcurl.dll");
72+
request = FTP_Init();
73+
FTP_PostFile(request, "libcurl.dll", "/user/libcurl.dll");
4474
```
4575
<hr>
4676
47-
#### ``FTP_GetFile(<filepath>, <downloadfilepath>)``
77+
#### ``FTP_GetFile(<request>, <filepath>, <downloadfilepath>)``
4878
Download a file from the FTP/FTPS/SFTP server.
4979
5080
```c
51-
FTP_GetFile("test.dll", "/user/test.dll");
81+
request = FTP_Init();
82+
FTP_GetFile(request, "test.dll", "/user/test.dll");
5283
```
5384
<hr>

docs/http.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# HTTP
2+
3+
### WARNING: **Requests are not thread safe, you'll need your own scripts in GSC to handle one request at a time !**
4+
5+
## Example
6+
```c
7+
json = "{\"login\":\"login\",\"password\":\"password\"}";
8+
url = "http://httpbin.org/post";
9+
10+
request = HTTP_Init();
11+
CURL_AddHeader(request, "Accept: application/json,Content-Type: application/json");
12+
HTTP_Post(request, json, url);
13+
14+
while (AsyncStatus(request) <= 1)
15+
wait 0.05;
16+
17+
response = HTTP_Response(request);
18+
HTTP_Free(request);
19+
```
20+
21+
#### ``HTTP_Init()``
22+
Initialize an HTTP request.
23+
The request should be freed when done using HTTP_Free.
24+
25+
```c
26+
request = HTTP_Init();
27+
```
28+
<hr>
29+
30+
#### ``HTTP_Free(<request>)``
31+
Free the HTTP request.
32+
33+
```c
34+
HTTP_Free(request);
35+
```
36+
<hr>
37+
38+
#### ``HTTP_GetFile(<request>, <filepath>, <url>)``
39+
Save a file from HTTP url.
40+
41+
```c
42+
request = HTTP_Init();
43+
HTTP_GetFile(request, "test/version.txt", "https://iswenzz.com:1337/speedrun_app/version.txt");
44+
```
45+
<hr>
46+
47+
#### ``HTTP_PostFile(<request>, <filepath>, <url>)``
48+
Upload a file to HTTP url.
49+
50+
```c
51+
request = HTTP_Init();
52+
HTTP_PostFile(request, "test/version.txt", "http://httpbin.org/post");
53+
```
54+
<hr>
55+
56+
#### ``HTTP_GetString(<request>, <url>)``
57+
Get a string from HTTP url.
58+
59+
```c
60+
request = HTTP_Init();
61+
HTTP_GetString(request, "http://httpbin.org/get");
62+
```
63+
<hr>
64+
65+
#### ``HTTP_PostString(<request>, <string>, <url>)``
66+
Post a string to HTTP url.
67+
68+
```c
69+
request = HTTP_Init();
70+
HTTP_PostString(request, "{\"login\":\"login\",\"password\":\"password\"}", "http://httpbin.org/post");
71+
```
72+
<hr>

docs/https.md

-35
This file was deleted.

0 commit comments

Comments
 (0)