diff --git a/Gallery.cs b/Gallery.cs index b0d5913..937db50 100644 --- a/Gallery.cs +++ b/Gallery.cs @@ -4,10 +4,28 @@ namespace Gallery // Class Gallery Here are informations about the current random stored public class Gallery{ public int Gallery_id { get; set; } - public Gallery(int gallery_id){ + public string Tags_Section { get; set; } + public Gallery(int gallery_id, string HttpGalleryString){ Gallery_id = gallery_id; + Tags_Section = Tags(HttpGalleryString); } + + public string Tags(string HttpGalleryString){ + + int index_of_tags = HttpGalleryString.IndexOf("Tags:"); + int index_of_artists = HttpGalleryString.IndexOf("Artists:"); + string tags_section = ""; + + for (int i = index_of_tags; i < index_of_artists; i++){ + tags_section += HttpGalleryString[i]; + } + + return tags_section; + } + } + + + } -} diff --git a/Program.cs b/Program.cs index cc325bf..f229867 100644 --- a/Program.cs +++ b/Program.cs @@ -3,46 +3,41 @@ using System.Threading.Tasks; using System.Net.Http; using System.Net.Http.Headers; using System.IO; +using Gallery; -namespace rhentai -{ - class Program - { +namespace rhentai{ + + // Program class + class Program{ + + // Creating a HttpClient private static readonly HttpClient client = new HttpClient(); - + + // Main function static async Task Main(string[] args){ - await ProcessRepositories(); + + // Get Result from HttpGetGallery + string HttpGalleryString = await HttpGetGallery(); + + string variable = new Gallery.Gallery(1,HttpGalleryString).Tags_Section; + + Console.Write(variable); } - private static async Task ProcessRepositories(){ + + // + private static async Task HttpGetGallery(){ + // Create Task client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json")); - // client.DefaultRequestHeaders.Add("User-Agent", ".NET Foundation Repository Reporter"); - var stringTask = client.GetStringAsync("https://nhentai.net/random/"); - var msg = await stringTask; - - //Console.Write(msg); - - await File.WriteAllTextAsync("output.txt", msg); - - var fileRead = File.ReadAllTextAsync("output.txt"); - - var textread = await fileRead; - int index_tags_start = textread.IndexOf("Tags:"); - int index_tags_end = textread.IndexOf("Artists:"); - - string filteredoutput = ""; - - for (int i = index_tags_start; i < index_tags_end; i++){ - filteredoutput += textread[i]; - } - - Console.Write(filteredoutput); - + // Return Task Result + return (await stringTask).ToString(); } + + } } diff --git a/README.md b/README.md index 41faaa6..9940147 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ # rhentai + diff --git a/bin/Debug/net5.0/ref/rhentai.dll b/bin/Debug/net5.0/ref/rhentai.dll index e1b45d0..c267fe8 100644 Binary files a/bin/Debug/net5.0/ref/rhentai.dll and b/bin/Debug/net5.0/ref/rhentai.dll differ diff --git a/bin/Debug/net5.0/rhentai.dll b/bin/Debug/net5.0/rhentai.dll index 0f9d412..6d9e116 100644 Binary files a/bin/Debug/net5.0/rhentai.dll and b/bin/Debug/net5.0/rhentai.dll differ diff --git a/bin/Debug/net5.0/rhentai.pdb b/bin/Debug/net5.0/rhentai.pdb index 56a55fb..9034aae 100644 Binary files a/bin/Debug/net5.0/rhentai.pdb and b/bin/Debug/net5.0/rhentai.pdb differ diff --git a/obj/Debug/net5.0/ref/rhentai.dll b/obj/Debug/net5.0/ref/rhentai.dll index e1b45d0..c267fe8 100644 Binary files a/obj/Debug/net5.0/ref/rhentai.dll and b/obj/Debug/net5.0/ref/rhentai.dll differ diff --git a/obj/Debug/net5.0/rhentai.csproj.CoreCompileInputs.cache b/obj/Debug/net5.0/rhentai.csproj.CoreCompileInputs.cache index 2c37423..28c196b 100644 --- a/obj/Debug/net5.0/rhentai.csproj.CoreCompileInputs.cache +++ b/obj/Debug/net5.0/rhentai.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -dbcbf6bb51b27451db101b7859889f98f56ebf31 +b33c1e170e7280d0cab6abdd3208808f440527cb diff --git a/obj/Debug/net5.0/rhentai.dll b/obj/Debug/net5.0/rhentai.dll index 0f9d412..6d9e116 100644 Binary files a/obj/Debug/net5.0/rhentai.dll and b/obj/Debug/net5.0/rhentai.dll differ diff --git a/obj/Debug/net5.0/rhentai.pdb b/obj/Debug/net5.0/rhentai.pdb index 56a55fb..9034aae 100644 Binary files a/obj/Debug/net5.0/rhentai.pdb and b/obj/Debug/net5.0/rhentai.pdb differ diff --git a/output.txt b/output.txt index 52e3f8d..4a6edad 100644 --- a/output.txt +++ b/output.txt @@ -2,30 +2,30 @@ -Akuma to no Love Love Kyoudou Seikatsu Ch. 1 » nhentai: hentai doujinshi and manga

[Mameko] Akuma to no Love Love Kyoudou Seikatsu Ch. 1 (COMIC Reboot Vol. 07) [Chinese] [路过的骑士汉化组] [Digital]

[まめこ] 悪魔とのラブラブ共同性活 第1話 (コミックリブート Vol.07) [中国翻訳] [DL版]

Post a comment

or to post a comment.