Skip to content

Commit

Permalink
Версия 1.8.1
Browse files Browse the repository at this point in the history
Изменения:
- Изменён сайт для определения IP, что помогло решить проблему полного отказа работоспособности приложения в России
- Библиотека Newtonsoft.Json обновлена до версии 13.0.1
- Теперь данные передаются по https-соединениям
- Улучшения интерфейса, мелкие правки кода
  • Loading branch information
Zalexanninev15 committed Apr 5, 2021
1 parent 7898be6 commit 9bd7337
Show file tree
Hide file tree
Showing 56 changed files with 74,241 additions and 186,999 deletions.
2 changes: 1 addition & 1 deletion Source/About.Designer.cs

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

24 changes: 12 additions & 12 deletions Source/Main.Designer.cs

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

12 changes: 6 additions & 6 deletions Source/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,12 @@ public Form1()

private void Form1_Load(object sender, EventArgs e)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
try
{
host = Dns.GetHostName();
WebClient client = new WebClient();
ip = client.DownloadString("http://api.ipify.org");
ip = client.DownloadString("https://icanhazip.com/");
materialSingleLineTextField1.Text = host;
materialSingleLineTextField2.Text = ip;
materialSingleLineTextField3.Text = Dns.GetHostByName(host).AddressList[0].ToString();
Expand All @@ -145,7 +146,7 @@ private void MaterialRaisedButton1_Click(object sender, EventArgs e)
{
host = Dns.GetHostName();
WebClient client = new WebClient();
ip = client.DownloadString("http://api.ipify.org");
ip = client.DownloadString("https://icanhazip.com/");
materialSingleLineTextField1.Text = host;
materialSingleLineTextField2.Text = ip;
materialSingleLineTextField3.Text = Dns.GetHostByName(host).AddressList[0].ToString();
Expand Down Expand Up @@ -225,15 +226,14 @@ public static string GeoInfo(string IP)
{
try
{
string url = "http://free.ipwhois.io/json/" + IP + "?lang=ru";
string url = "https://free.ipwhois.io/json/" + IP + "?lang=ru";
var request = WebRequest.Create(url);
using (WebResponse wrs = request.GetResponse())
using (Stream stream = wrs.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
{
string json = reader.ReadToEnd();
var obj = JObject.Parse(json);
string ip = (string)obj["ip"];
string type = (string)obj["type"];
string continent = (string)obj["continent"];
string country = (string)obj["country"];
Expand All @@ -250,10 +250,10 @@ public static string GeoInfo(string IP)
string latitude = (string)obj["latitude"];
string longitude = (string)obj["longitude"];
string isp = (string)obj["isp"];
return ("IP: " + ip + "\nТип IP адреса: " + type + "\nКонтинент: " + continent + "\nСтрана: " + country + "\nКод страны: " + country_code + "\nСтолица страны: " + country_capital + "\nРегион/область: " + region + "\nГород: " + city + "\nШирота: " + latitude + "\nДолгота: " + longitude + "\nИнтернет-провайдер: " + isp + "\nЧасовой пояс: " + timezone + "\nВремя по Гринвичу: " + timezone_gmt + "\nВалюта: " + currency + "\nКод валюты: " + currency_code + "\nОбозначение валюты: " + currency_symbol + "\nКурс валюты: " + currency_rates);
return ("Тип IP адреса: " + type + "\nКонтинент: " + continent + "\nСтрана: " + country + "\nКод страны: " + country_code + "\nСтолица страны: " + country_capital + "\nРегион/область: " + region + "\nГород: " + city + "\nШирота: " + latitude + "\nДолгота: " + longitude + "\nИнтернет-провайдер: " + isp + "\nЧасовой пояс: " + timezone + "\nВремя по Гринвичу: " + timezone_gmt + "\nВалюта: " + currency + "\nКод валюты: " + currency_code + "\nОбозначение валюты: " + currency_symbol + "\nКурс валюты: " + currency_rates);
}
}
catch { return "Сервис не отвечает :( \nПовторите попытку позже."; }
}
}
}
}
4 changes: 2 additions & 2 deletions Source/MyIP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<Reference Include="MaterialSkin, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\MaterialSkin.0.2.1\lib\MaterialSkin.dll</HintPath>
</Reference>
<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 Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
10 changes: 5 additions & 5 deletions Source/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("MyIP")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("Приложение для определения вашего имени в локальной сети, IP в локальной сети и IP в сети Интернет под Windows.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Zalexanninev15")]
[assembly: AssemblyProduct("MyIP")]
[assembly: AssemblyCopyright("Copyright © 2019-2020, Zalexanninev15")]
[assembly: AssemblyTrademark("MyIP (2019-2020)")]
[assembly: AssemblyCopyright("Copyright © 2019-2021, Zalexanninev15")]
[assembly: AssemblyTrademark("MyIP (2019-2021)")]
[assembly: AssemblyCulture("")]

// Параметр ComVisible со значением FALSE делает типы в сборке невидимыми
Expand All @@ -32,5 +32,5 @@
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.8.0.0")]
[assembly: AssemblyFileVersion("1.8.0.0")]
[assembly: AssemblyVersion("1.8.1.0")]
[assembly: AssemblyFileVersion("1.8.1.0")]
2 changes: 1 addition & 1 deletion Source/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MaterialSkin" version="0.2.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
</packages>
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 9bd7337

Please sign in to comment.