NewtonJosn 추가
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -33,6 +33,9 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@@ -59,6 +62,7 @@
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="WebServices\BitthumbWerServices.cs" />
|
||||
<Compile Include="WebServices\WebConnection.cs" />
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
@@ -72,6 +76,7 @@
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
||||
146
Million/WebServices/BitthumbWerServices.cs
Normal file
146
Million/WebServices/BitthumbWerServices.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Million.WebServices
|
||||
{
|
||||
public class BitthumbWerServices
|
||||
{
|
||||
private string m_sAPI_URL = "https://api.bithumb.com";
|
||||
private string m_sAPI_Key = "f248c48ba6e8f68a2993e7036aed3d13";
|
||||
private string m_sAPI_Secret = "75eed1ee3ed5d8b09050e54609767f53";
|
||||
private string sParams = "order_currency=BTC&payment_currency=KRW";
|
||||
|
||||
public BitthumbWerServices(string sAPI_Key, string sAPI_Secret)
|
||||
{
|
||||
this.m_sAPI_Key = sAPI_Key;
|
||||
this.m_sAPI_Secret = sAPI_Secret;
|
||||
}
|
||||
|
||||
|
||||
private string ByteToString(byte[] rgbyBuff)
|
||||
{
|
||||
string sHexStr = "";
|
||||
|
||||
|
||||
for (int nCnt = 0; nCnt < rgbyBuff.Length; nCnt++)
|
||||
{
|
||||
sHexStr += rgbyBuff[nCnt].ToString("x2"); // Hex format
|
||||
}
|
||||
|
||||
return (sHexStr);
|
||||
}
|
||||
|
||||
|
||||
private byte[] StringToByte(string sStr)
|
||||
{
|
||||
byte[] rgbyBuff = Encoding.UTF8.GetBytes(sStr);
|
||||
|
||||
return (rgbyBuff);
|
||||
}
|
||||
|
||||
|
||||
private long MicroSecTime()
|
||||
{
|
||||
long nEpochTicks = 0;
|
||||
long nUnixTimeStamp = 0;
|
||||
long nNowTicks = 0;
|
||||
long nowMiliseconds = 0;
|
||||
string sNonce = "";
|
||||
DateTime DateTimeNow;
|
||||
|
||||
|
||||
nEpochTicks = new DateTime(1970, 1, 1).Ticks;
|
||||
DateTimeNow = DateTime.UtcNow;
|
||||
nNowTicks = DateTimeNow.Ticks;
|
||||
nowMiliseconds = DateTimeNow.Millisecond;
|
||||
|
||||
nUnixTimeStamp = ((nNowTicks - nEpochTicks) / TimeSpan.TicksPerSecond);
|
||||
|
||||
sNonce = nUnixTimeStamp.ToString() + nowMiliseconds.ToString("D03");
|
||||
|
||||
return (Convert.ToInt64(sNonce));
|
||||
}
|
||||
|
||||
|
||||
private string Hash_HMAC(string sKey, string sData)
|
||||
{
|
||||
byte[] rgbyKey = Encoding.UTF8.GetBytes(sKey);
|
||||
|
||||
|
||||
using (var hmacsha512 = new HMACSHA512(rgbyKey))
|
||||
{
|
||||
hmacsha512.ComputeHash(Encoding.UTF8.GetBytes(sData));
|
||||
|
||||
return (ByteToString(hmacsha512.Hash));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public JObject xcoinApiCall(string sEndPoint, string sParams, ref string sRespBodyData)
|
||||
{
|
||||
string sAPI_Sign = "";
|
||||
string sPostData = sParams;
|
||||
string sHMAC_Key = "";
|
||||
string sHMAC_Data = "";
|
||||
string sResult = "";
|
||||
long nNonce = 0;
|
||||
HttpStatusCode nCode = 0;
|
||||
|
||||
|
||||
sPostData += "&endpoint=" + Uri.EscapeDataString(sEndPoint);
|
||||
|
||||
try
|
||||
{
|
||||
HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(this.m_sAPI_URL + sEndPoint);
|
||||
byte[] rgbyData = Encoding.ASCII.GetBytes(sPostData);
|
||||
|
||||
|
||||
nNonce = MicroSecTime();
|
||||
|
||||
sHMAC_Key = this.m_sAPI_Secret;
|
||||
sHMAC_Data = sEndPoint + (char)0 + sPostData + (char)0 + nNonce.ToString();
|
||||
sResult = Hash_HMAC(sHMAC_Key, sHMAC_Data);
|
||||
sAPI_Sign = Convert.ToBase64String(StringToByte(sResult));
|
||||
|
||||
Request.Headers.Add("Api-Key", this.m_sAPI_Key);
|
||||
Request.Headers.Add("Api-Sign", sAPI_Sign);
|
||||
Request.Headers.Add("Api-Nonce", nNonce.ToString());
|
||||
|
||||
Request.Method = "POST";
|
||||
Request.ContentType = "application/x-www-form-urlencoded";
|
||||
Request.ContentLength = rgbyData.Length;
|
||||
|
||||
using (var stream = Request.GetRequestStream())
|
||||
{
|
||||
stream.Write(rgbyData, 0, rgbyData.Length);
|
||||
}
|
||||
|
||||
var Response = (HttpWebResponse)Request.GetResponse();
|
||||
|
||||
sRespBodyData = new StreamReader(Response.GetResponseStream()).ReadToEnd();
|
||||
|
||||
return (JObject.Parse(sRespBodyData));
|
||||
}
|
||||
catch (WebException webEx)
|
||||
{
|
||||
using (HttpWebResponse Response = (HttpWebResponse)webEx.Response)
|
||||
{
|
||||
nCode = Response.StatusCode;
|
||||
|
||||
using (StreamReader reader = new StreamReader(Response.GetResponseStream()))
|
||||
{
|
||||
sRespBodyData = reader.ReadToEnd();
|
||||
|
||||
return (JObject.Parse(sRespBodyData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
}
|
||||
}
|
||||
4
Million/packages.config
Normal file
4
Million/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
|
||||
</packages>
|
||||
BIN
packages/Newtonsoft.Json.12.0.3/.signature.p7s
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/.signature.p7s
vendored
Normal file
Binary file not shown.
20
packages/Newtonsoft.Json.12.0.3/LICENSE.md
vendored
Normal file
20
packages/Newtonsoft.Json.12.0.3/LICENSE.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2007 James Newton-King
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
BIN
packages/Newtonsoft.Json.12.0.3/Newtonsoft.Json.12.0.3.nupkg
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/Newtonsoft.Json.12.0.3.nupkg
vendored
Normal file
Binary file not shown.
BIN
packages/Newtonsoft.Json.12.0.3/lib/net20/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/net20/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
10298
packages/Newtonsoft.Json.12.0.3/lib/net20/Newtonsoft.Json.xml
vendored
Normal file
10298
packages/Newtonsoft.Json.12.0.3/lib/net20/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/net35/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/net35/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
9446
packages/Newtonsoft.Json.12.0.3/lib/net35/Newtonsoft.Json.xml
vendored
Normal file
9446
packages/Newtonsoft.Json.12.0.3/lib/net35/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/net40/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/net40/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
9646
packages/Newtonsoft.Json.12.0.3/lib/net40/Newtonsoft.Json.xml
vendored
Normal file
9646
packages/Newtonsoft.Json.12.0.3/lib/net40/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/net45/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/net45/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
11262
packages/Newtonsoft.Json.12.0.3/lib/net45/Newtonsoft.Json.xml
vendored
Normal file
11262
packages/Newtonsoft.Json.12.0.3/lib/net45/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.0/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.0/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
10950
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.0/Newtonsoft.Json.xml
vendored
Normal file
10950
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.0/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.3/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.3/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
11072
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.3/Newtonsoft.Json.xml
vendored
Normal file
11072
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.3/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/netstandard2.0/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/netstandard2.0/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
11237
packages/Newtonsoft.Json.12.0.3/lib/netstandard2.0/Newtonsoft.Json.xml
vendored
Normal file
11237
packages/Newtonsoft.Json.12.0.3/lib/netstandard2.0/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/portable-net40+sl5+win8+wp8+wpa81/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/portable-net40+sl5+win8+wp8+wpa81/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
9010
packages/Newtonsoft.Json.12.0.3/lib/portable-net40+sl5+win8+wp8+wpa81/Newtonsoft.Json.xml
vendored
Normal file
9010
packages/Newtonsoft.Json.12.0.3/lib/portable-net40+sl5+win8+wp8+wpa81/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/portable-net45+win8+wp8+wpa81/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/portable-net45+win8+wp8+wpa81/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
10950
packages/Newtonsoft.Json.12.0.3/lib/portable-net45+win8+wp8+wpa81/Newtonsoft.Json.xml
vendored
Normal file
10950
packages/Newtonsoft.Json.12.0.3/lib/portable-net45+win8+wp8+wpa81/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/packageIcon.png
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/packageIcon.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
Reference in New Issue
Block a user