Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Commit 6660ad5

Browse files
authored
Merge pull request #51 from spewu/master
Target netstandard 1.3
2 parents d26005f + 2e7d43d commit 6660ad5

20 files changed

+226
-532
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
root = true
2+
3+
[*.cs]
4+
charset = utf-8
5+
indent_style = tab

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ ClientBin
102102
~$*
103103
*.dbmdl
104104
Generated_Code #added for RIA/Silverlight projects
105+
_NCrunch*
106+
*.ncrunch
105107

106108
# Backup & report files from converting an old project file to a newer
107109
# Visual Studio version. Backup files are not needed, because we have

Analytics.NET.sln

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 2013
4-
VisualStudioVersion = 12.0.30501.0
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26430.13
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Analytics", "Analytics\Analytics.csproj", "{E79E6240-4954-41D0-BCE4-573B800EF006}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analytics", "Analytics\Analytics.csproj", "{A386CF02-D902-4B22-90A8-E828093E3AA4}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{5FF5800A-DB9C-4E5A-8DD2-7AD661487F33}"
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{6AE99FF7-EECF-4639-B6B1-3E7CF1CC3048}"
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C316F1BB-6C70-4DEB-BC04-5664C39313F3}"
11+
ProjectSection(SolutionItems) = preProject
12+
.editorconfig = .editorconfig
13+
.gitignore = .gitignore
14+
EndProjectSection
915
EndProject
1016
Global
1117
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1218
Debug|Any CPU = Debug|Any CPU
1319
Release|Any CPU = Release|Any CPU
1420
EndGlobalSection
1521
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16-
{E79E6240-4954-41D0-BCE4-573B800EF006}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17-
{E79E6240-4954-41D0-BCE4-573B800EF006}.Debug|Any CPU.Build.0 = Debug|Any CPU
18-
{E79E6240-4954-41D0-BCE4-573B800EF006}.Release|Any CPU.ActiveCfg = Release|Any CPU
19-
{E79E6240-4954-41D0-BCE4-573B800EF006}.Release|Any CPU.Build.0 = Release|Any CPU
20-
{5FF5800A-DB9C-4E5A-8DD2-7AD661487F33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21-
{5FF5800A-DB9C-4E5A-8DD2-7AD661487F33}.Debug|Any CPU.Build.0 = Debug|Any CPU
22-
{5FF5800A-DB9C-4E5A-8DD2-7AD661487F33}.Release|Any CPU.ActiveCfg = Release|Any CPU
23-
{5FF5800A-DB9C-4E5A-8DD2-7AD661487F33}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{A386CF02-D902-4B22-90A8-E828093E3AA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{A386CF02-D902-4B22-90A8-E828093E3AA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{A386CF02-D902-4B22-90A8-E828093E3AA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{A386CF02-D902-4B22-90A8-E828093E3AA4}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{6AE99FF7-EECF-4639-B6B1-3E7CF1CC3048}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{6AE99FF7-EECF-4639-B6B1-3E7CF1CC3048}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{6AE99FF7-EECF-4639-B6B1-3E7CF1CC3048}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{6AE99FF7-EECF-4639-B6B1-3E7CF1CC3048}.Release|Any CPU.Build.0 = Release|Any CPU
2430
EndGlobalSection
2531
GlobalSection(SolutionProperties) = preSolution
2632
HideSolutionNode = FALSE

Analytics/Analytics.csproj

Lines changed: 7 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,12 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
43
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<ProjectGuid>{E79E6240-4954-41D0-BCE4-573B800EF006}</ProjectGuid>
8-
<OutputType>Library</OutputType>
9-
<AppDesignerFolder>Properties</AppDesignerFolder>
10-
<RootNamespace>Segment</RootNamespace>
11-
<AssemblyName>Analytics.NET</AssemblyName>
12-
<FileAlignment>512</FileAlignment>
13-
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
4+
<TargetFramework>netstandard1.3</TargetFramework>
145
</PropertyGroup>
15-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16-
<DebugSymbols>True</DebugSymbols>
17-
<DebugType>full</DebugType>
18-
<Optimize>False</Optimize>
19-
<OutputPath>bin\Debug\</OutputPath>
20-
<DefineConstants>DEBUG;TRACE</DefineConstants>
21-
<ErrorReport>prompt</ErrorReport>
22-
<WarningLevel>4</WarningLevel>
23-
</PropertyGroup>
24-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25-
<Optimize>True</Optimize>
26-
<OutputPath>bin\Release\</OutputPath>
27-
<DefineConstants>TRACE</DefineConstants>
28-
<ErrorReport>prompt</ErrorReport>
29-
<WarningLevel>4</WarningLevel>
30-
</PropertyGroup>
31-
<ItemGroup>
32-
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
33-
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>
34-
<Private>True</Private>
35-
</Reference>
36-
<Reference Include="System" />
37-
<Reference Include="System.Core" />
38-
<Reference Include="System.Runtime.Serialization" />
39-
<Reference Include="System.ServiceModel.Web" />
40-
<Reference Include="System.Web" />
41-
<Reference Include="System.Web.Extensions" />
42-
<Reference Include="System.Data.DataSetExtensions" />
43-
<Reference Include="System.Data" />
44-
<Reference Include="System.Xml" />
45-
</ItemGroup>
46-
<ItemGroup>
47-
<Compile Include="Client.cs" />
48-
<Compile Include="Defaults.cs" />
49-
<Compile Include="Exception\BadParameter.cs" />
50-
<Compile Include="Exception\NotInitializedException.cs" />
51-
<Compile Include="Logger.cs" />
52-
<Compile Include="Model\BaseAction.cs" />
53-
<Compile Include="Model\Batch.cs" />
54-
<Compile Include="Model\Context.cs" />
55-
<Compile Include="Model\Identify.cs" />
56-
<Compile Include="Model\Properties.cs" />
57-
<Compile Include="Model\Traits.cs" />
58-
<Compile Include="Request\IRequestHandler.cs" />
59-
<Compile Include="Analytics.cs" />
60-
<Compile Include="Properties\AssemblyInfo.cs" />
61-
<Compile Include="Stats\Statistics.cs" />
62-
<Compile Include="Model\Providers.cs" />
63-
<Compile Include="Model\Alias.cs" />
64-
<Compile Include="Constants.cs" />
65-
<Compile Include="Flush\IFlushHandler.cs" />
66-
<Compile Include="Flush\AsyncFlushHandler.cs" />
67-
<Compile Include="Flush\BlockingQueue.cs" />
68-
<Compile Include="Request\BlockingRequestHandler.cs" />
69-
<Compile Include="Flush\BlockingFlushHandler.cs" />
70-
<Compile Include="Flush\IBatchFactory.cs" />
71-
<Compile Include="Flush\SimpleBatchFactory.cs" />
72-
<Compile Include="Model\Options.cs" />
73-
<Compile Include="Model\Dict.cs" />
74-
<Compile Include="Config.cs" />
75-
<Compile Include="Model\Group.cs" />
76-
<Compile Include="Model\Page.cs" />
77-
<Compile Include="Model\Screen.cs" />
78-
</ItemGroup>
79-
<ItemGroup>
80-
<Compile Include="Model\Track.cs" />
81-
</ItemGroup>
6+
827
<ItemGroup>
83-
<None Include="History.md" />
84-
<None Include="Analytics.nuspec" />
85-
<None Include="packages.config" />
8+
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
9+
<PackageReference Include="System.Threading.Thread" Version="4.3.0" />
8610
</ItemGroup>
87-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
88-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
89-
Other similar extension points exist, see Microsoft.Common.targets.
90-
<Target Name="BeforeBuild">
91-
</Target>
92-
<Target Name="AfterBuild">
93-
</Target>
94-
-->
95-
<ItemGroup />
11+
9612
</Project>

Analytics/Client.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Globalization;
4-
using System.Text;
5-
3+
using System.Threading.Tasks;
64
using Segment.Flush;
7-
using Segment.Request;
8-
using Segment.Exception;
95
using Segment.Model;
6+
using Segment.Request;
107
using Segment.Stats;
118

129
namespace Segment
@@ -648,7 +645,7 @@ public void Dispose()
648645

649646
private void Enqueue(BaseAction action)
650647
{
651-
_flushHandler.Process(action);
648+
_flushHandler.Process(action).GetAwaiter().GetResult();
652649

653650
this.Statistics.Submitted = Statistics.Increment(this.Statistics.Submitted);
654651
}

Analytics/Flush/AsyncFlushHandler.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Net;
4-
using System.Runtime.Serialization.Json;
5-
using System.IO;
1+
using System.Collections.Generic;
62
using System.Threading;
7-
8-
using Segment;
9-
using Segment.Request;
3+
using System.Threading.Tasks;
104
using Segment.Model;
11-
using Segment.Exception;
5+
using Segment.Request;
126

137
namespace Segment.Flush
148
{
@@ -71,7 +65,7 @@ internal AsyncFlushHandler(IBatchFactory batchFactory,
7165
_flushingThread.Start();
7266
}
7367

74-
public void Process(BaseAction action)
68+
public async Task Process(BaseAction action)
7569
{
7670
int size = _queue.Count;
7771

@@ -166,7 +160,7 @@ private void Loop()
166160
});
167161

168162
// make the request here
169-
_requestHandler.MakeRequest(batch);
163+
_requestHandler.MakeRequest(batch).GetAwaiter().GetResult();
170164

171165
// mark the current batch as null
172166
current = new List<BaseAction>();

Analytics/Flush/BlockingFlushHandler.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Net;
4-
using System.Runtime.Serialization.Json;
5-
using System.IO;
6-
using System.Threading;
7-
8-
using Segment;
9-
using Segment.Request;
1+
using System.Collections.Generic;
2+
using System.Threading.Tasks;
103
using Segment.Model;
11-
using Segment.Exception;
4+
using Segment.Request;
125

136
namespace Segment.Flush
147
{
@@ -32,10 +25,10 @@ internal BlockingFlushHandler(IBatchFactory batchFactory,
3225
this._requestHandler = requestHandler;
3326
}
3427

35-
public void Process(BaseAction action)
28+
public async Task Process(BaseAction action)
3629
{
3730
Batch batch = _batchFactory.Create(new List<BaseAction>() { action });
38-
_requestHandler.MakeRequest(batch);
31+
await _requestHandler.MakeRequest(batch).ConfigureAwait(false);
3932
}
4033

4134
/// <summary>

Analytics/Flush/IFlushHandler.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
using System;
2-
1+
using System;
2+
using System.Threading.Tasks;
33
using Segment.Model;
4-
using Segment.Request;
54

65
namespace Segment.Flush
76
{
@@ -14,12 +13,11 @@ public interface IFlushHandler : IDisposable
1413
/// Validates an action and begins the process of flushing it to the server
1514
/// </summary>
1615
/// <param name="action">Action.</param>
17-
void Process(BaseAction action);
16+
Task Process(BaseAction action);
1817

1918
/// <summary>
2019
/// Blocks until all processing messages are flushed to the server
2120
/// </summary>
2221
void Flush();
2322
}
2423
}
25-

Analytics/History.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11

2+
X.X.X / June 20, 2017
3+
=================
4+
* now targeting netstandard 1.3
5+
26
2.0.1 / July 1, 2015
37
=================
48
* anonymous id fixes
@@ -18,4 +22,4 @@
1822

1923
1.2.0 / May 16, 2014
2024
=================
21-
* updating to spec v1
25+
* updating to spec v1

Analytics/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 34 deletions
This file was deleted.

Analytics/Request/BatchState.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)