-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- V 0.93.05; License and terms of use; Usage statistics via MySQL dat…
…abase as server - License and data collection notice now in DialogInitial (Github issue #27) - Localization strings updated, clearly must accept terms of service - Server connection (via MySQL) implemented for sending usage statistics (Github issue #28) - Tested and debugged ... set to run in BackgroundWorker
- Loading branch information
Showing
13 changed files
with
233 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Net.Sockets; | ||
using System.Net.NetworkInformation; | ||
using System.Text; | ||
|
||
using MySql.Data.MySqlClient; | ||
|
||
namespace II.Server { | ||
|
||
public partial class Connection { | ||
|
||
private MySqlConnection connection; | ||
|
||
public Connection() { | ||
connection = new MySqlConnection ( | ||
String.Format ("SERVER={0};DATABASE={1};UID={2};PASSWORD={3};", | ||
accessServer, accessDatabase, accessUid, accessPassword)); | ||
} | ||
|
||
private bool Open () { | ||
try { | ||
connection.Open(); | ||
return true; | ||
} | ||
catch (MySqlException e) { | ||
// When handling errors, you can your application's response based on the error number. | ||
// The two most common error numbers when connecting are as follows: | ||
// 0: Cannot connect to server. | ||
// 1045: Invalid user name and/or password. | ||
return false; | ||
} | ||
} | ||
|
||
private bool Close () { | ||
try { | ||
connection.Close (); | ||
return true; | ||
} catch (MySqlException e) { | ||
return false; | ||
} | ||
} | ||
|
||
public void UsageStatistics_Send () { | ||
try { | ||
string macAddress = "", | ||
ipAddress = ""; | ||
|
||
NetworkInterface nInterface = NetworkInterface.GetAllNetworkInterfaces ().Where ( | ||
(o) => (o.NetworkInterfaceType == NetworkInterfaceType.Ethernet || o.NetworkInterfaceType == NetworkInterfaceType.Wireless80211) | ||
&& o.OperationalStatus == OperationalStatus.Up) | ||
.First (); | ||
if (nInterface != null) { | ||
macAddress = nInterface.GetPhysicalAddress ().ToString (); | ||
ipAddress = nInterface.GetIPProperties ().UnicastAddresses.Where ( | ||
(a) => a.Address.AddressFamily == AddressFamily.InterNetwork) | ||
.Select (a => a.Address.ToString ()).First (); | ||
} | ||
|
||
MySqlCommand c = connection.CreateCommand (); | ||
c.CommandText = "INSERT INTO usage_statistics(timestamp, ii_version, client_os, client_ip, client_mac, client_user) " + | ||
"VALUES(?timestamp, ?ii_version, ?client_os, ?client_ip, ?client_mac, ?client_user)"; | ||
c.Parameters.Add ("?timestamp", MySqlDbType.VarChar).Value = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); | ||
c.Parameters.Add ("?ii_version", MySqlDbType.VarChar).Value = Utility.Version; | ||
c.Parameters.Add ("?client_os", MySqlDbType.VarChar).Value = Environment.OSVersion.VersionString; | ||
c.Parameters.Add ("?client_ip", MySqlDbType.VarChar).Value = ipAddress; | ||
c.Parameters.Add ("?client_mac", MySqlDbType.VarChar).Value = macAddress; | ||
c.Parameters.Add ("?client_user", MySqlDbType.VarChar).Value = Environment.UserName; | ||
|
||
connection.Open (); | ||
c.ExecuteNonQuery (); | ||
connection.Close (); | ||
} catch (MySqlException e) { | ||
connection.Close (); | ||
} | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<Window x:Class="II_Windows.DialogInitial" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:II_Windows" | ||
mc:Ignorable="d" | ||
Title="Select Language and Agree to Terms" | ||
Name="dlgLanguage" | ||
Icon="{StaticResource Icon_Infirmary}" | ||
WindowStartupLocation="CenterScreen" | ||
MinHeight="150" MinWidth="275" SizeToContent="WidthAndHeight"> | ||
|
||
<Window.Resources> | ||
<Style x:Key="grpBorder" TargetType="{x:Type Border}"> | ||
<Setter Property="BorderBrush" Value="Black" /> | ||
<Setter Property="BorderThickness" Value="0, 0, 0, 1" /> | ||
</Style> | ||
</Window.Resources> | ||
|
||
|
||
<Grid HorizontalAlignment="Center" Margin="15, 10"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="10" /> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="Auto" /> | ||
</Grid.RowDefinitions> | ||
|
||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*" /> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Label Name="lblChooseLanguage" | ||
Grid.Column="0" Grid.Row="0" | ||
Padding="5,2" Margin="5" | ||
VerticalAlignment="Center" HorizontalAlignment="Center"/> | ||
|
||
<ComboBox Name="cmbLanguages" | ||
Grid.Column="0" Grid.Row="1" | ||
Padding="5,2,5,5" Margin="5" | ||
HorizontalAlignment="Stretch"/> | ||
|
||
<Border Style="{StaticResource grpBorder}" | ||
Grid.Column="0" Grid.Row="2" /> | ||
|
||
<Label Name="lblAgreeTerms" | ||
Grid.Column="0" Grid.Row="3" | ||
Padding="5,5,5,2" VerticalAlignment="Center" HorizontalAlignment="Center"> | ||
|
||
<TextBlock Name="txtAgreeTerms" TextWrapping="Wrap" /> | ||
</Label> | ||
|
||
<Label Name="lblTermsUri" | ||
Grid.Column="0" Grid.Row="4" | ||
Padding="5,2" VerticalAlignment="Center" HorizontalAlignment="Center"> | ||
<Hyperlink | ||
NavigateUri="http://www.infirmary-integrated.com/license-and-data-collection/" | ||
RequestNavigate="Hyperlink_RequestNavigate"> | ||
http://www.infirmary-integrated.com/license-and-data-collection/ | ||
</Hyperlink> | ||
</Label> | ||
|
||
<Button Name="btnContinue" | ||
Grid.Column="0" Grid.Row="5" | ||
Padding="5,2" Margin="5" Background="White" | ||
HorizontalAlignment="Stretch" | ||
Click="OnClick_Continue" /> | ||
|
||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters