- Add AngleSharp NuGet package version 1.1.2 to csproj for HTML parsing - Introduce DomQueryClass helper method using AngleSharp to extract elements by CSS class name - Replace XPath-based node selection in get_rants with DomQueryClass targeting "rantlist-title-text" - Update Program.cs to await RunIt task and add a 100-iteration loop around rant fetching - Add transform string concatenation utility method to Program class
53 lines
984 B
C#
53 lines
984 B
C#
// See https://aka.ms/new-console-template for more information
|
|
|
|
using Gtk;
|
|
|
|
using System;
|
|
using System.Net.Http;
|
|
using System.Threading.Tasks;
|
|
|
|
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace drnetapi {
|
|
partial class Program {
|
|
|
|
public static string transform(string tr){
|
|
return tr + tr;
|
|
}
|
|
|
|
|
|
static async Task Main(string[] args){
|
|
Application.Init();
|
|
|
|
var window = new Window("My TEst");
|
|
window.SetDefaultSize(320,240);
|
|
window.DeleteEvent += (o,e) => Application.Quit();
|
|
|
|
var bgtask = RunIt();
|
|
|
|
window.ShowAll();
|
|
|
|
|
|
|
|
Application.Run();
|
|
|
|
await bgtask;
|
|
}
|
|
|
|
|
|
static async Task RunIt()
|
|
{
|
|
for(int i = 0; i < 100; i++){
|
|
//Thread.Sleep(1000);
|
|
string result = await DrApi.get_rants("https://devrant.com/feed/recent").ConfigureAwait(false);
|
|
|
|
Console.WriteLine(result);
|
|
}
|
|
|
|
}
|
|
};
|
|
|
|
|
|
};
|