Skip to content

Commit a9cd92f

Browse files
authored
Merge pull request #11 from Phil-DS/V2
Update to V2
2 parents 8c0aa58 + 1bb86cb commit a9cd92f

File tree

1,069 files changed

+18458
-152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,069 files changed

+18458
-152
lines changed

Project_Riolu/DataFetch.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Drawing;
34
using System.IO;
45
using System.Linq;
56
using System.Text;
@@ -9,6 +10,17 @@ namespace Project_Riolu
910
{
1011
public class DataFetch
1112
{
13+
public static Image getSprite(ushort id,int form)
14+
{
15+
try
16+
{
17+
return (Image)Properties.Resources.ResourceManager.GetObject("_" + id);
18+
}catch(Exception e)
19+
{
20+
return (Image)Properties.Resources.ResourceManager.GetObject("_0");
21+
}
22+
}
23+
1224
public static string getSpecies(ushort ID,int form)
1325
{
1426

Project_Riolu/Export.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
using System;
3+
using System.IO;
4+
using System.Net;
5+
using System.Text;
6+
using System.Web;
7+
8+
class Export
9+
{
10+
public static String exportToPokepaste(string title, string author, string notes, string data)
11+
{
12+
/*
13+
* url:
14+
* - title: string for Title
15+
* - author: string for Author
16+
* - notes: string for Notes
17+
* - paste: the showdown paste
18+
*/
19+
ServicePointManager.Expect100Continue = true;
20+
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
21+
22+
byte[] url = Encoding.UTF8.GetBytes("title=" + HttpUtility.UrlPathEncode(title) + "&author=" + HttpUtility.UrlPathEncode(author) + "&notes=" + HttpUtility.UrlPathEncode(notes) + "&paste=" + HttpUtility.UrlPathEncode(data));
23+
24+
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://pokepast.es/create");
25+
26+
request.Method = "POST";
27+
request.ContentType = "application/x-www-form-urlencoded";
28+
request.ContentLength = url.Length;
29+
30+
Console.WriteLine(url);
31+
32+
using (Stream stream = request.GetRequestStream())
33+
{
34+
stream.Write(url, 0, url.Length);
35+
}
36+
37+
using (WebResponse response = request.GetResponse())
38+
{
39+
try
40+
{
41+
return response.ResponseUri.AbsoluteUri;
42+
}catch(Exception e)
43+
{
44+
Console.WriteLine(e.ToString());
45+
return "";
46+
}
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)