초기 커밋.
This commit is contained in:
95
lck_cl_data_solution/RiotKeyChecker/Form1.Designer.cs
generated
Normal file
95
lck_cl_data_solution/RiotKeyChecker/Form1.Designer.cs
generated
Normal file
@@ -0,0 +1,95 @@
|
||||
namespace RiotKeyChecker
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.listBox1 = new System.Windows.Forms.ListBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(482, 41);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(212, 91);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "데이터 요청";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(104, 12);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(590, 23);
|
||||
this.textBox1.TabIndex = 1;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(11, 15);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(87, 15);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "라이엇 키 입력";
|
||||
//
|
||||
// listBox1
|
||||
//
|
||||
this.listBox1.FormattingEnabled = true;
|
||||
this.listBox1.ItemHeight = 15;
|
||||
this.listBox1.Location = new System.Drawing.Point(12, 141);
|
||||
this.listBox1.Name = "listBox1";
|
||||
this.listBox1.Size = new System.Drawing.Size(682, 289);
|
||||
this.listBox1.TabIndex = 3;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(707, 450);
|
||||
this.Controls.Add(this.listBox1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Name = "Form1";
|
||||
this.Text = "Riot Key Checker";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button button1;
|
||||
private TextBox textBox1;
|
||||
private Label label1;
|
||||
private ListBox listBox1;
|
||||
}
|
||||
}
|
||||
139
lck_cl_data_solution/RiotKeyChecker/Form1.cs
Normal file
139
lck_cl_data_solution/RiotKeyChecker/Form1.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json;
|
||||
using System.Net;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization;
|
||||
|
||||
namespace RiotKeyChecker
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
listBox1.Items.Clear();
|
||||
GameListUpdateWorker(true);
|
||||
}
|
||||
|
||||
|
||||
internal const string 라이엇_게임리스트_REQUEST_URL = "https://raw-stats-api.ewp.gg/livestatsRaw/v1/";
|
||||
|
||||
internal Dictionary<string, string> GameListUpdateWorker(bool isTest)
|
||||
{
|
||||
|
||||
//string bufRequestURL = DEFINE.라이엇_게임리스트_REQUEST_URL + (isTest ? "platformGames" : "esportsGames") + "?state=in_progress";;
|
||||
string bufRequestURL = 라이엇_게임리스트_REQUEST_URL + (isTest ? "platformGames" : "esportsGames") + "?state=in_progress"; ;
|
||||
//string bufRequestURL = DEFINE.라이엇_게임리스트_REQUEST_URL + "esportsGames" + "?state=finished"; ;
|
||||
string result = null;
|
||||
|
||||
///20210809 SSL접속문제로 인해 서버인증기능을 끈 부분을 추가한다 이거 이래도 되나?
|
||||
//ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
|
||||
|
||||
///가져온 URL에 맞춰 리퀘스트를 만든다.
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(bufRequestURL);
|
||||
req.Method = "GET";
|
||||
WebHeaderCollection hd = new WebHeaderCollection();
|
||||
|
||||
hd.Add("x-api-key:" + textBox1.Text);
|
||||
|
||||
req.Headers = hd;
|
||||
WebResponse rsp = null;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
rsp = req.GetResponse();
|
||||
|
||||
|
||||
///가져온 데이터를 문자열화 하고, Bson형태로 파싱해서 리턴한다.
|
||||
using (var reader = new StreamReader(rsp.GetResponseStream()))
|
||||
{
|
||||
result = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
MessageBox.Show(ex.ToString());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
IEnumerable<BsonValue> bufGameList = null;
|
||||
|
||||
List<string> updateRoomList = new List<string>();
|
||||
|
||||
Dictionary<String, string> rtnValue = new Dictionary<string, string>();
|
||||
|
||||
///가져온 데이터가 null이 아니라면 데이터를 Game단위(Document)로 짤라서 Enumarable화 하고, 아니면 빈 결과를 리턴한다.
|
||||
if (result != null)
|
||||
{
|
||||
bufGameList = BsonSerializer.Deserialize<BsonArray>(result).Select(p => p.AsBsonDocument);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//가져온 데이터에서 방제와 플랫폼게임ID를 파싱해서 KV페어로 만든다.
|
||||
foreach (BsonValue item in bufGameList)
|
||||
{
|
||||
string bufString = "";
|
||||
|
||||
///20210615테스트할부분 방을 새로만든부분이 있을경우 Document 순서에서 나중에 들어오므로 과거에 들어왔던 데이터를 버린다.
|
||||
///혹시 모르니 안버린다.
|
||||
//if (rtnValue.ContainsValue(item["gameName"].ToString()))
|
||||
//{
|
||||
// rtnValue.Remove(rtnValue.FirstOrDefault(x => x.Value == item["gameName"].ToString()).Key);
|
||||
//}
|
||||
|
||||
if (isTest)
|
||||
{
|
||||
rtnValue.Add(item["platformGameId"].ToString(), item["gameName"].ToString());
|
||||
|
||||
bufString = item["platformGameId"].ToString() + "_" + item["gameName"].ToString();
|
||||
|
||||
updateRoomList.Add(bufString);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
BsonDocument itemDocument = item.AsBsonDocument["platformGames"].AsBsonArray.Last().ToBsonDocument();
|
||||
|
||||
rtnValue.Add(itemDocument["platformGameId"].ToString(), itemDocument["gameName"].ToString());
|
||||
|
||||
bufString = itemDocument["platformGameId"].ToString() + "_" + itemDocument["gameName"].ToString();
|
||||
|
||||
updateRoomList.Add(bufString);
|
||||
}
|
||||
|
||||
#if (DEBUG)
|
||||
{
|
||||
Console.WriteLine(bufString);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
///완성된 방 정보를 UI에 업데이트한다.
|
||||
///
|
||||
this.Invoke(new MethodInvoker(() => {
|
||||
|
||||
foreach (string item in updateRoomList)
|
||||
{
|
||||
listBox1.Items.Add(item);
|
||||
}
|
||||
|
||||
}));
|
||||
|
||||
return rtnValue;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
60
lck_cl_data_solution/RiotKeyChecker/Form1.resx
Normal file
60
lck_cl_data_solution/RiotKeyChecker/Form1.resx
Normal file
@@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
17
lck_cl_data_solution/RiotKeyChecker/Program.cs
Normal file
17
lck_cl_data_solution/RiotKeyChecker/Program.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace RiotKeyChecker
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
||||
15
lck_cl_data_solution/RiotKeyChecker/RiotKeyChecker.csproj
Normal file
15
lck_cl_data_solution/RiotKeyChecker/RiotKeyChecker.csproj
Normal file
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MongoDB.Bson" Version="2.12.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user