Skip to content

Commit

Permalink
Merge pull request #35 from AcK77/master
Browse files Browse the repository at this point in the history
Cleanup emuGUIibo
  • Loading branch information
XorTroll authored Aug 3, 2019
2 parents a6279ca + c6ac790 commit 4a1b6e0
Show file tree
Hide file tree
Showing 12 changed files with 1,534 additions and 1,369 deletions.
Binary file modified emuGUIibo/Screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
83 changes: 45 additions & 38 deletions emuGUIibo/emuGUIibo/AmiiboAPI.cs
Original file line number Diff line number Diff line change
@@ -1,69 +1,76 @@
using System;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows.Forms;
using Newtonsoft.Json.Linq;

namespace emuGUIibo
{
public class Amiibo
{
public string AmiiboName { get; set; }

public string SeriesName { get; set; }

public string AmiiboName { get; set; }
public string SeriesName { get; set; }
public string CharacterName { get; set; }

public string ImageURL { get; set; }

public string AmiiboId { get; set; }
public string ImageURL { get; set; }
public string AmiiboId { get; set; }
}

public static class AmiiboAPI
static class AmiiboAPI
{
public static List<Amiibo> QueryAllAmiibos()
private const string AMIIBO_API_URL = "https://www.amiiboapi.com/api/amiibo/";

public static List<string> AmiiboSeries = new List<string>();
public static List<Amiibo> AllAmiibo = new List<Amiibo>();

public static bool GetAllAmiibos()
{
var list = new List<Amiibo>();
try
{
var raw = new WebClient().DownloadString("https://www.amiiboapi.com/api/amiibo/");
var json = JObject.Parse(raw);
foreach (var amiibo in json["amiibo"])
JObject json = JObject.Parse(new WebClient().DownloadString(AMIIBO_API_URL));

foreach (JToken amiibo in json["amiibo"])
{
var name = amiibo["name"].ToString();
var series = amiibo["amiiboSeries"].ToString();
var character = amiibo["character"].ToString();
var image = amiibo["image"].ToString();
var idhead = amiibo["head"].ToString();
var idtail = amiibo["tail"].ToString();
list.Add(new Amiibo { AmiiboName = name, SeriesName = series, CharacterName = character, ImageURL = image, AmiiboId = idhead + idtail });
if (AmiiboSeries.Where(serie => serie == amiibo["amiiboSeries"].ToString()).Count() == 0)
{
AmiiboSeries.Add(amiibo["amiiboSeries"].ToString());
}

AllAmiibo.Add(new Amiibo { AmiiboName = amiibo["name"].ToString(),
SeriesName = amiibo["amiiboSeries"].ToString(),
CharacterName = amiibo["character"].ToString(),
ImageURL = amiibo["image"].ToString(),
AmiiboId = amiibo["head"].ToString()
+ amiibo["tail"].ToString()
});
}
MessageBox.Show("Amiibo API was accessed. Amiibo list was loaded.");

return true;
}
catch
{
MessageBox.Show("Unable to download amiibo list from amiibo API.");
return false;
}
return list;
}

public static char MakeRandomHexChar(Random R)
public static char MakeRandomHexChar(Random random)
{
string hexchars = "0123456789ABCDEF";
int randidx = R.Next(0, hexchars.Length - 1);
return hexchars[randidx];
string hexChars = "0123456789ABCDEF";
int randomIndex = random.Next(0, hexChars.Length - 1);

return hexChars[randomIndex];
}

public static string MakeRandomHexString(int Length)
public static string MakeRandomHexString(int length)
{
string hex = "";
Random r = new Random();
for(int i = 0; i < Length; i++)
string hexString = "";
Random random = new Random();

for (int i = 0; i < length; i++)
{
hex += MakeRandomHexChar(r);
hexString += MakeRandomHexChar(random);
}
return hex;

return hexString;
}
}
}
}
108 changes: 0 additions & 108 deletions emuGUIibo/emuGUIibo/Form1.cs

This file was deleted.

10 changes: 2 additions & 8 deletions emuGUIibo/emuGUIibo/Program.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace emuGUIibo
{
static class Program
{
/// <summary>
/// Punto de entrada principal para la aplicación.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
Application.Run(new mainForm());
}
}
}
}
88 changes: 50 additions & 38 deletions emuGUIibo/emuGUIibo/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4a1b6e0

Please sign in to comment.