disk-info-helper

selenium-helper (Not fully tested)

sync-helper (Not fully tested)
This commit is contained in:
2025-06-23 11:16:17 -07:00
parent e50a90f0fc
commit 97797fc440
15 changed files with 807 additions and 23 deletions

View File

@ -0,0 +1,51 @@
using Nancy;
using Nancy.Extensions;
namespace File_Watcher.NancyModules;
public class SyncModule : NancyModule
{
public SyncModule()
{
Get("/bob/v1/sync/", _ =>
{
string? result;
try
{
string query = Request.Url.Query;
IDictionary<string, IEnumerable<string>> collection = Nancy.Helpers.HttpUtility.ParseQueryString(query).ToDictionary();
result = collection is null ? "null" : collection.ToString();
}
catch (Exception ex)
{
result = ex.Message;
}
return result;
});
Post("/bob/v1/sync/", _ =>
{
string result;
// Notification notification;
// ILog log = LogManager.GetLogger(typeof(SyncModule));
// log.Info($"Enter-{nameof(Post)}");
try
{
string body = Request.Body.AsString();
DynamicDictionary form = Request.Form;
Dictionary<string, object> keyValuePairs = form.ToDictionary();
string reply = Helpers.SyncHelper.GetReply(body, keyValuePairs);
result = reply;
}
catch (Exception ex)
{
// log.Fatal($"Exception-{nameof(Post)}{Environment.NewLine}{ex.Message}{Environment.NewLine}{Environment.NewLine}{ex.StackTrace}");
result = ex.Message;
throw;
}
// log.Info($"Return-{nameof(Post)}");
return result;
});
}
}