Skip to content

Commit

Permalink
[+] User analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyadanli committed Nov 13, 2017
1 parent 0a3dcde commit f4aff39
Show file tree
Hide file tree
Showing 12 changed files with 448 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ bld/
[Ll]og/

# Mine
Tmp/
Tmp/
/packages/
6 changes: 6 additions & 0 deletions PasteEx/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
<setting name="callUpgrade" serializeAs="String">
<value>True</value>
</setting>
<setting name="guid" serializeAs="String">
<value />
</setting>
<setting name="lastBootTime" serializeAs="String">
<value />
</setting>
</PasteEx.Properties.Settings>
</userSettings>
</configuration>
42 changes: 42 additions & 0 deletions PasteEx/Client.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using PasteEx.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PasteEx
{
public class Client
{
public static string GUID;

public static void Start()
{
Task.Run(() =>
{
try
{
DateTime last = Properties.Settings.Default.lastBootTime;
DateTime now = DateTime.Now;
int day = now.Day - last.Day;
if (day < 17) { return; }
GUID = Device.Value();
string oldGUID = Properties.Settings.Default.guid;
if (oldGUID != GUID)
{
LCHelper.Record();
Properties.Settings.Default.guid = GUID;
}
Properties.Settings.Default.lastBootTime = now;
Properties.Settings.Default.Save();
}
catch(Exception ex)
{
Logger.Error(ex);
}
});
}
}
}
3 changes: 2 additions & 1 deletion PasteEx/Data.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using PasteEx.Util;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
Expand Down
6 changes: 5 additions & 1 deletion PasteEx/PasteEx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Management" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Expand All @@ -76,7 +77,10 @@
<Compile Include="FormSetting.Designer.cs">
<DependentUpon>FormSetting.cs</DependentUpon>
</Compile>
<Compile Include="Logger.cs" />
<Compile Include="Client.cs" />
<Compile Include="Util\Device.cs" />
<Compile Include="Util\LCHelper.cs" />
<Compile Include="Util\Logger.cs" />
<Compile Include="MySettingsProvider.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
6 changes: 5 additions & 1 deletion PasteEx/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using PasteEx.Util;
using System;
using System.Windows.Forms;

namespace PasteEx
Expand All @@ -22,6 +23,9 @@ static void Main(string[] args)

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

Client.Start();

if (args.Length > 0)
{
string command = args[0];
Expand Down
23 changes: 23 additions & 0 deletions PasteEx/Properties/Settings.Designer.cs

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

6 changes: 6 additions & 0 deletions PasteEx/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@
<Setting Name="callUpgrade" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="guid" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="lastBootTime" Type="System.DateTime" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
1 change: 1 addition & 0 deletions PasteEx/RightMenu.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Win32;
using PasteEx.Util;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down
Loading

0 comments on commit f4aff39

Please sign in to comment.