Skip to content
This repository has been archived by the owner on Aug 30, 2022. It is now read-only.
/ PadoruLib Public archive

C# Library for retrieving images from my Padoru collection

License

Notifications You must be signed in to change notification settings

shadow578/PadoruLib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PadoruLib

C# Library for retrieving images from my Padoru collection
The JSON Format is described here.

What is this?

This is a small & simple library to make it easier to work with my padoru-padoru repo.

What is Padoru?

A Meme in the Anime- Community. See here.

Why?

  • Because its almost Padoru- Time :P
  • I was bored
  • I couldn't find a (good) collection of padoru images

How To Use

  • Add the Library to your Project.
  • Create a instance of the PadoruClient
  • Initialize the Padoru Collection using PadoruClient.LoadCollection()
  • Get Padoru Entries using GetEntries(), GetRandomEntry(), and GetEntriesWhen()
  • Download the Image using PadoruEntry.GetImage()

...Or As Example Code

static async Task PadoruExample()
{
    //create client
    PadoruClient padoru = new PadoruClient();

    //load a padoru collection
    await padoru.LoadCollection(COLLECTION_URL);

    //create a variable to hold the desired padoru entry
    PadoruEntry myPadoru;

    //get a random padoru
    myPadoru = await padoru.GetRandomEntry();

    //get the first padoru in the collection
    myPadoru = (await padoru.GetEntries()).First();

    //get the first male padoru in the collection
    myPadoru = (await padoru.GetEntriesWhere((p) => !p.IsFemale)).First();

    //download the padoru image data
    byte[] padoruData = await myPadoru.GetImageData();

    //create image from the loaded data
    Image padoruImg;
    using (MemoryStream padoruDataStream = new MemoryStream(padoruData))
    {
        padoruImg = Image.FromStream(padoruDataStream);
    }

    //save the image
    padoruImg?.Save("./random-padoru.png");

    //dispose loaded image
    padoruImg?.Dispose();
}

Disclaimer

  • This Program is by no means written with best- practices in mind. I teached programming to myself, so many things will be badly and/or oddly in design
  • English isn't my main language. Expect spelling and grammar errors in everything I write.
  • This Program is only intended for private (= non- commercial) use. Used Librarys may not be OK to use in a commercial context.
  • Feel free to use this code to learn programming yourself. Just keep in mind that you're not learning from a pro.
  • If you use (part of) this code in something useful, please consider menitoning me (and this repo) in some way.