Skip to content

Commit 7ad4722

Browse files
authored
Merge pull request #13 from DeaSTL/main
added csharp callback
2 parents 1905c7e + 4057953 commit 7ad4722

28 files changed

+441
-1
lines changed

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,31 @@ dist
128128
.yarn/build-state.yml
129129
.yarn/install-state.gz
130130
.pnp.*
131+
132+
Debug/
133+
**/packages/*
134+
!**/packages/build/
135+
136+
137+
*_i.c
138+
*_p.c
139+
*.ilk
140+
*.meta
141+
*.obj
142+
*.pch
143+
*.pdb
144+
*.pgc
145+
*.pgd
146+
*.rsp
147+
*.sbr
148+
*.tlb
149+
*.tli
150+
*.tlh
151+
*.tmp
152+
*.tmp_proj
153+
*.log
154+
*.vspscc
155+
*.vssscc
156+
.builds
157+
*.pidb
158+
*.scc

Program.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// See https://aka.ms/new-console-template for more information
2+
using System.Text.Json;
3+
4+
5+
public class ApiResponse {
6+
public string ad {get; set;}
7+
public bool iseven {get; set;}
8+
}
9+
10+
11+
class notNotOdd{
12+
13+
static async Task Main(string[] args){
14+
if(args.Length != 1){
15+
Console.WriteLine("Usage: notNotOdd <number>");
16+
return;
17+
}
18+
19+
string number_str = args[0];
20+
21+
var is_number = int.TryParse(number_str, out int number);
22+
23+
if(!is_number){
24+
Console.WriteLine("Usage: notNotOdd <number>");
25+
return;
26+
}
27+
28+
var client = new HttpClient();
29+
var response =
30+
await client.GetAsync("https://api.isevenapi.xyz/api/iseven/"+number_str+"/");
31+
var content = await response.Content.ReadAsStringAsync();
32+
33+
ApiResponse json_content;
34+
try{
35+
json_content = JsonSerializer.Deserialize<ApiResponse>(content);
36+
}catch(Exception e){
37+
Console.WriteLine("Error: "+e.Message);
38+
return;
39+
}
40+
Console.WriteLine(json_content.iseven ? "odd" : "even");
41+
}
42+
}
43+

bin/Release/net8.0/notNotOdd

589 KB
Binary file not shown.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"runtimeTarget": {
3+
"name": ".NETCoreApp,Version=v8.0",
4+
"signature": ""
5+
},
6+
"compilationOptions": {},
7+
"targets": {
8+
".NETCoreApp,Version=v8.0": {
9+
"notNotOdd/1.0.0": {
10+
"runtime": {
11+
"notNotOdd.dll": {}
12+
}
13+
}
14+
}
15+
},
16+
"libraries": {
17+
"notNotOdd/1.0.0": {
18+
"type": "project",
19+
"serviceable": false,
20+
"sha512": ""
21+
}
22+
}
23+
}

bin/Release/net8.0/notNotOdd.dll

7 KB
Binary file not shown.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"runtimeOptions": {
3+
"tfm": "net8.0",
4+
"framework": {
5+
"name": "Microsoft.NETCore.App",
6+
"version": "8.0.0"
7+
},
8+
"configProperties": {
9+
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
10+
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
11+
}
12+
}
13+
}

index.js

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

notNotOdd.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
</Project>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// <autogenerated />
2+
using System;
3+
using System.Reflection;
4+
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]

obj/Release/net8.0/apphost

589 KB
Binary file not shown.

0 commit comments

Comments
 (0)