Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Iswenzz committed Dec 18, 2022
2 parents e0b6c69 + 0e023d0 commit 97b897e
Show file tree
Hide file tree
Showing 47 changed files with 1,964 additions and 1,123 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(CMAKE_C_FLAGS "-m32 -Wall -O1 -s -mtune=core2 -Wno-unused-result")
set(CMAKE_SHARED_LINKER_FLAGS "-m32 -s -shared -static-libgcc -static-libstdc++")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_STATIC_LIBRARY_PREFIX "")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -DWIN32_LEAN_AND_MEAN)

# CPack
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
Expand All @@ -22,6 +22,7 @@ conan_basic_setup()
# Tests
include(CTest)
add_executable(gsclib.Tests)
add_dependencies(gsclib.Tests gsclib.Static)
target_link_libraries(gsclib.Tests PUBLIC ${CONAN_LIBS} gsclib.Static)
add_test(NAME Tests COMMAND gsclib.Tests)

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
[![CodeFactor](https://img.shields.io/codefactor/grade/github/Iswenzz/gsclib?label=codefactor&logo=codefactor)](https://www.codefactor.io/repository/github/iswenzz/gsclib)
[![License](https://img.shields.io/github/license/Iswenzz/gsclib?color=blue&logo=gitbook&logoColor=white)](https://github.com/Iswenzz/gsclib/blob/master/LICENSE)

``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.
``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.

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

## Building (Linux)
_Pre-Requisites:_
1. Edit plugin_handle.h and recompile your server:
1. Edit plugin_handle.h then recompile the server with an empty obj directory:
```c
#define MAX_SCRIPTFUNCTIONS 256
```
Expand Down
4 changes: 2 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

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

requires = (
"CGSC/1.1.1",
"CGSC/1.2.0",
"cwalk/1.2.5",
"greatest/1.5.0",
"libmysqlclient/8.0.17",
Expand Down
22 changes: 11 additions & 11 deletions docs/curl.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,37 @@ CURL_Version();
```
<hr>

#### ``CURL_AddHeader(<commands>)``
#### ``CURL_AddHeader(<request>, <commands>)``
Set CURL Header for the next requests.

```c
CURL_AddHeader("Accept: application/json");
CURL_AddHeader("Content-Type: application/json");
CURL_AddHeader("RNFR libcurl.dll,RNTO test.dll");
CURL_AddHeader("rename libcurl.dll test.dll");
CURL_AddHeader(request, "Accept: application/json");
CURL_AddHeader(request, "Content-Type: application/json");
CURL_AddHeader(request, "RNFR libcurl.dll,RNTO test.dll");
CURL_AddHeader(request, "rename libcurl.dll test.dll");
```
<hr>
#### ``CURL_HeaderCleanup()``
#### ``CURL_HeaderCleanup(<request>)``
Clean header set by CURL_AddHeader.
```c
CURL_HeaderCleanup();
CURL_HeaderCleanup(request);
```
<hr>

#### ``CURL_AddOpt(<option>, <value>)``
#### ``CURL_AddOpt(<request>, <option>, <value>)``
Add a CURL Option for the next request.

```c
CURL_AddOpt(47, 1);
CURL_AddOpt(request, 47, 1);
```
<hr>
#### ``CURL_OptCleanup()``
#### ``CURL_OptCleanup(<request>)``
Clean all CURL Option added by CURL_AddOpt.
```c
CURL_OptCleanup();
CURL_OptCleanup(request);
```
<hr>
47 changes: 39 additions & 8 deletions docs/ftp.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# FTP/FTPS/SFTP

### :warning: **Requests are not thread safe, you'll need your own scripts in GSC !**
### WARNING: **Requests are not thread safe, you'll need your own scripts in GSC to handle one request at a time !**

## Example
```c
request = FTP_Init();
FTP_PostFile(request, "temp/test.txt", "get.txt");

while (AsyncStatus(request) <= 1)
wait 0.05;

FTP_Free(request);
```
#### ``SFTP_Connect(<host>, <user>, <password>, <port>)``
Connect to an SFTP server, the connection can be closed with FTP_Close.
Expand All @@ -26,28 +37,48 @@ FTP_Close();
```
<hr>

#### ``FTP_Shell()``
#### ``FTP_Init()``
Initialize a FTP request.
The request should be freed when done using FTP_Free.

```c
request = FTP_Init();
```
<hr>

#### ``FTP_Free(<request>)``
Initialize a FTP request.

```c
FTP_Free(request);
```
<hr>
#### ``FTP_Shell(<request>)``
Execute a command to the FTP/FTPS/SFTP server.
The commands should be set with CURL_AddHeader.
```c
CURL_AddHeader("rename libcurl.dll test.dll");
FTP_Shell();
request = FTP_Init();
CURL_AddHeader(request, "rename libcurl.dll test.dll");
FTP_Shell(request);
```
<hr>

#### ``FTP_PostFile(<filepath>, <uploadfilepath>)``
#### ``FTP_PostFile(<request>, <filepath>, <uploadfilepath>)``
Upload a file to the FTP/FTPS/SFTP server.

```c
FTP_PostFile("libcurl.dll", "/user/libcurl.dll");
request = FTP_Init();
FTP_PostFile(request, "libcurl.dll", "/user/libcurl.dll");
```
<hr>
#### ``FTP_GetFile(<filepath>, <downloadfilepath>)``
#### ``FTP_GetFile(<request>, <filepath>, <downloadfilepath>)``
Download a file from the FTP/FTPS/SFTP server.
```c
FTP_GetFile("test.dll", "/user/test.dll");
request = FTP_Init();
FTP_GetFile(request, "test.dll", "/user/test.dll");
```
<hr>
72 changes: 72 additions & 0 deletions docs/http.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# HTTP

### WARNING: **Requests are not thread safe, you'll need your own scripts in GSC to handle one request at a time !**

## Example
```c
json = "{\"login\":\"login\",\"password\":\"password\"}";
url = "http://httpbin.org/post";

request = HTTP_Init();
CURL_AddHeader(request, "Accept: application/json,Content-Type: application/json");
HTTP_Post(request, json, url);

while (AsyncStatus(request) <= 1)
wait 0.05;

response = HTTP_Response(request);
HTTP_Free(request);
```
#### ``HTTP_Init()``
Initialize an HTTP request.
The request should be freed when done using HTTP_Free.
```c
request = HTTP_Init();
```
<hr>

#### ``HTTP_Free(<request>)``
Free the HTTP request.

```c
HTTP_Free(request);
```
<hr>
#### ``HTTP_GetFile(<request>, <filepath>, <url>)``
Save a file from HTTP url.
```c
request = HTTP_Init();
HTTP_GetFile(request, "test/version.txt", "https://iswenzz.com:1337/speedrun_app/version.txt");
```
<hr>

#### ``HTTP_PostFile(<request>, <filepath>, <url>)``
Upload a file to HTTP url.

```c
request = HTTP_Init();
HTTP_PostFile(request, "test/version.txt", "http://httpbin.org/post");
```
<hr>
#### ``HTTP_GetString(<request>, <url>)``
Get a string from HTTP url.
```c
request = HTTP_Init();
HTTP_GetString(request, "http://httpbin.org/get");
```
<hr>

#### ``HTTP_PostString(<request>, <string>, <url>)``
Post a string to HTTP url.

```c
request = HTTP_Init();
HTTP_PostString(request, "{\"login\":\"login\",\"password\":\"password\"}", "http://httpbin.org/post");
```
<hr>
35 changes: 0 additions & 35 deletions docs/https.md

This file was deleted.

Loading

0 comments on commit 97b897e

Please sign in to comment.