oiegrjoergojeroigjoeirgjoer
This commit is contained in:
@@ -3,8 +3,9 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Net.Sockets;
|
||||
using System.Timers;
|
||||
using static Jobini;
|
||||
//using static Jobini;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@@ -16,11 +17,12 @@ var app = builder.Build();
|
||||
string filePath = "Setting.txt";
|
||||
string scoreDbPath = "Score.txt";
|
||||
|
||||
//iniŬ<69><C5AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>س<EFBFBD><D8B3><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> Ȯ<><C8AE><EFBFBD>ڴ<EFBFBD> txt<78><74> <20><><EFBFBD><EFBFBD><EFBFBD>Ѱ<EFBFBD> <20><><EFBFBD>̾<EFBFBD><CCBE><EFBFBD>
|
||||
Jobini settingini = new(filePath);
|
||||
Jobini scoreDBini = new(scoreDbPath);
|
||||
|
||||
//Dictionary<string, string> settingValues = [];
|
||||
//Dictionary<string, int> scoreDB = [];
|
||||
Dictionary<string, string> scoreDB = [];
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (!app.Environment.IsDevelopment())
|
||||
@@ -29,24 +31,29 @@ if (!app.Environment.IsDevelopment())
|
||||
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
}
|
||||
//csp<73>̽<EFBFBD> <20><><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> csp<73><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ȣ <20><>ü<EFBFBD><C3BC> <20>Ⱥ<EFBFBD><C8BA><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>°<EFBFBD><C2B0><EFBFBD> cspüũ<C3BC><C5A9> <20><><EFBFBD><EFBFBD><EFBFBD>ִµ<D6B4>
|
||||
//<2F><EFBFBD><D7B7><EFBFBD> <20><EFBFBD><EEB6BB> <20><>ħ?
|
||||
//<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϰ<EFBFBD> <20><><EFBFBD>ѱ<EFBFBD><D1B1><EFBFBD>?
|
||||
//app.Use(async (context, next) =>
|
||||
//{
|
||||
// context.Response.Headers.Append("Content-Security-Policy", "base-uri 'self'; default-src 'self'; img-src data: https:; object-src 'none'; script-src 'self'; style-src 'self'; upgrade-insecure-requests;");
|
||||
// await next();
|
||||
//});
|
||||
|
||||
//Dictionary<string, int> scoreDB= [];
|
||||
//scoreDB = [];
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD>
|
||||
app.MapPost("submit", (string name, int score) =>
|
||||
{
|
||||
|
||||
var dbKey = scoreDBini.IniRead(name);
|
||||
if (dbKey != null)
|
||||
if (dbKey != null)//scoreDB.ContainsKey(name))
|
||||
{
|
||||
int value = int.Parse(dbKey);
|
||||
if (value < score)
|
||||
|
||||
if (value < score)//scoreDB[name] < score)
|
||||
{
|
||||
//scoreDB[name ] = score;
|
||||
scoreDBini.IniWrite(name, score.ToString());
|
||||
}
|
||||
return Results.Ok(new { Message = "A" });
|
||||
@@ -62,24 +69,25 @@ app.MapPost("submit", (string name, int score) =>
|
||||
List<int> weekArrow = [];
|
||||
|
||||
//weekly Jobs (dbReset, WeekArrowGen...)
|
||||
System.Timers.Timer resetTimer = new System.Timers.Timer(1000); // 10000ms = 10 seconds => 1week = ?ms mol ra si bal
|
||||
System.Timers.Timer resetTimer = new(10000); // 10000ms = 10 seconds => 1week = ?ms mol ra si bal
|
||||
resetTimer.Elapsed += (sender, e) =>
|
||||
{
|
||||
TimeOnly curTime = new(DateTime.Now.Hour, DateTime.Now.Minute);
|
||||
TimeOnly tarTime = new(0, 0); //<2F>Ƹ<EFBFBD> <20><><EFBFBD><EFBFBD> 12<31><32>?
|
||||
if (System.TimeOnly.Equals(curTime, tarTime))
|
||||
{
|
||||
weekArrow.Clear();
|
||||
}
|
||||
//TimeOnly curTime = new(DateTime.Now.Hour, DateTime.Now.Minute);
|
||||
//TimeOnly tarTime = new(0, 0); //<2F>Ƹ<EFBFBD> <20><><EFBFBD><EFBFBD> 12<31><32>?
|
||||
//if (System.TimeOnly.Equals(curTime, tarTime))
|
||||
//{
|
||||
// weekArrow.Clear();
|
||||
//}
|
||||
//weekArrow.Clear();
|
||||
// Log reset actio
|
||||
var logger = app.Services.GetRequiredService<ILogger<Program>>();
|
||||
logger.LogInformation("doWeekJobs");
|
||||
//logger.LogInformation("doWeekJobs");
|
||||
|
||||
// Clear the scoreDB
|
||||
scoreDBini.Clear();
|
||||
weekArrow.Clear();
|
||||
Random random = new();
|
||||
for (int i = 0; i < random.NextInt64(int.Parse(scoreDBini.NotNullableiniRead("minArrowNum")), int.Parse(scoreDBini.NotNullableiniRead("maxArrowNum"))); i++)
|
||||
for (int i = 0; i < random.NextInt64(int.Parse(settingini.NotNullableiniRead("minArrowNum","10")), int.Parse(settingini.NotNullableiniRead("maxArrowNum","30"))/*10,30*/); i++)
|
||||
{
|
||||
int rngNum = (int)random.NextInt64(0, 4);
|
||||
weekArrow.Add(rngNum/*(int)random.NextInt64(0, 4)*/);
|
||||
@@ -87,16 +95,16 @@ resetTimer.Elapsed += (sender, e) =>
|
||||
}
|
||||
|
||||
};
|
||||
Random random = new();
|
||||
for (int i = 0; i < random.NextInt64(int.Parse(scoreDBini.NotNullableiniRead("minArrowNum")), int.Parse(scoreDBini.NotNullableiniRead("maxArrowNum"))); i++)
|
||||
{
|
||||
int rngNum = (int)random.NextInt64(0, 4);
|
||||
weekArrow.Add(rngNum/*(int)random.NextInt64(0, 4)*/);
|
||||
//logger.LogInformation(rngNum.ToString());
|
||||
}//<2F>ڱ<EFBFBD> <20>ڽ<EFBFBD><DABD><EFBFBD> <20>а<EFBFBD><D0B0>ִٰ<D6B4> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><EFBFBD><EEB6BB> <20>Ƶ鿩<C6B5><E9BFA9><EFBFBD><EFBFBD>?
|
||||
//Random random = new();
|
||||
//for (int i = 0; i < random.NextInt64(10,30/*int.Parse(scoreDBini.NotNullableiniRead("minArrowNum")), int.Parse(scoreDBini.NotNullableiniRead("maxArrowNum"))*/); i++)
|
||||
//{
|
||||
// int rngNum = (int)random.NextInt64(0, 4);
|
||||
// weekArrow.Add(rngNum/*(int)random.NextInt64(0, 4)*/);
|
||||
// //logger.LogInformation(rngNum.ToString());
|
||||
//}//<2F>ڱ<EFBFBD> <20>ڽ<EFBFBD><DABD><EFBFBD> <20>а<EFBFBD><D0B0>ִٰ<D6B4> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><> <20><EFBFBD><EEB6BB> <20>Ƶ鿩<C6B5><E9BFA9><EFBFBD><EFBFBD>? => resetTimer<65><72> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>尡 <20>ƴ<EFBFBD> <20>ٸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>忡<EFBFBD><E5BFA1> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵٴ<D1B4> ī<><C4AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
resetTimer.Start();
|
||||
//<2F><><EFBFBD>ϵ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
app.MapGet("/", () => scoreDBini.ReadDictionary);
|
||||
app.MapGet("/", () => /*scoreDB);*/scoreDB = scoreDBini.ReadDictionary());//scoreDBini.ReadDictionary);
|
||||
|
||||
app.MapGet("WeekArrow", () => weekArrow
|
||||
);
|
||||
@@ -112,4 +120,5 @@ app.UseRouting();
|
||||
|
||||
app.MapRazorPages();
|
||||
|
||||
app.Run("http://localhost:5000");
|
||||
//<2F>̹<EFBFBD>minio<69><6F><EFBFBD><EFBFBD> 8000~8001<30><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
app.Run("http://localhost:8004");
|
||||
|
||||
Reference in New Issue
Block a user