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

Commit

Permalink
Merge pull request #51 from spewu/master
Browse files Browse the repository at this point in the history
Target netstandard 1.3
  • Loading branch information
f2prateek authored Jul 4, 2017
2 parents d26005f + 2e7d43d commit 6660ad5
Show file tree
Hide file tree
Showing 20 changed files with 226 additions and 532 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
root = true

[*.cs]
charset = utf-8
indent_style = tab
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ ClientBin
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects
_NCrunch*
*.ncrunch

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have
Expand Down
30 changes: 18 additions & 12 deletions Analytics.NET.sln
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30501.0
# Visual Studio 15
VisualStudioVersion = 15.0.26430.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Analytics", "Analytics\Analytics.csproj", "{E79E6240-4954-41D0-BCE4-573B800EF006}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analytics", "Analytics\Analytics.csproj", "{A386CF02-D902-4B22-90A8-E828093E3AA4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{5FF5800A-DB9C-4E5A-8DD2-7AD661487F33}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{6AE99FF7-EECF-4639-B6B1-3E7CF1CC3048}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C316F1BB-6C70-4DEB-BC04-5664C39313F3}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E79E6240-4954-41D0-BCE4-573B800EF006}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E79E6240-4954-41D0-BCE4-573B800EF006}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E79E6240-4954-41D0-BCE4-573B800EF006}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E79E6240-4954-41D0-BCE4-573B800EF006}.Release|Any CPU.Build.0 = Release|Any CPU
{5FF5800A-DB9C-4E5A-8DD2-7AD661487F33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5FF5800A-DB9C-4E5A-8DD2-7AD661487F33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5FF5800A-DB9C-4E5A-8DD2-7AD661487F33}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5FF5800A-DB9C-4E5A-8DD2-7AD661487F33}.Release|Any CPU.Build.0 = Release|Any CPU
{A386CF02-D902-4B22-90A8-E828093E3AA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A386CF02-D902-4B22-90A8-E828093E3AA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A386CF02-D902-4B22-90A8-E828093E3AA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A386CF02-D902-4B22-90A8-E828093E3AA4}.Release|Any CPU.Build.0 = Release|Any CPU
{6AE99FF7-EECF-4639-B6B1-3E7CF1CC3048}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6AE99FF7-EECF-4639-B6B1-3E7CF1CC3048}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6AE99FF7-EECF-4639-B6B1-3E7CF1CC3048}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6AE99FF7-EECF-4639-B6B1-3E7CF1CC3048}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
98 changes: 7 additions & 91 deletions Analytics/Analytics.csproj
Original file line number Diff line number Diff line change
@@ -1,96 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E79E6240-4954-41D0-BCE4-573B800EF006}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Segment</RootNamespace>
<AssemblyName>Analytics.NET</AssemblyName>
<FileAlignment>512</FileAlignment>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFramework>netstandard1.3</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel.Web" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Client.cs" />
<Compile Include="Defaults.cs" />
<Compile Include="Exception\BadParameter.cs" />
<Compile Include="Exception\NotInitializedException.cs" />
<Compile Include="Logger.cs" />
<Compile Include="Model\BaseAction.cs" />
<Compile Include="Model\Batch.cs" />
<Compile Include="Model\Context.cs" />
<Compile Include="Model\Identify.cs" />
<Compile Include="Model\Properties.cs" />
<Compile Include="Model\Traits.cs" />
<Compile Include="Request\IRequestHandler.cs" />
<Compile Include="Analytics.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Stats\Statistics.cs" />
<Compile Include="Model\Providers.cs" />
<Compile Include="Model\Alias.cs" />
<Compile Include="Constants.cs" />
<Compile Include="Flush\IFlushHandler.cs" />
<Compile Include="Flush\AsyncFlushHandler.cs" />
<Compile Include="Flush\BlockingQueue.cs" />
<Compile Include="Request\BlockingRequestHandler.cs" />
<Compile Include="Flush\BlockingFlushHandler.cs" />
<Compile Include="Flush\IBatchFactory.cs" />
<Compile Include="Flush\SimpleBatchFactory.cs" />
<Compile Include="Model\Options.cs" />
<Compile Include="Model\Dict.cs" />
<Compile Include="Config.cs" />
<Compile Include="Model\Group.cs" />
<Compile Include="Model\Page.cs" />
<Compile Include="Model\Screen.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Model\Track.cs" />
</ItemGroup>

<ItemGroup>
<None Include="History.md" />
<None Include="Analytics.nuspec" />
<None Include="packages.config" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="System.Threading.Thread" Version="4.3.0" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ItemGroup />

</Project>
9 changes: 3 additions & 6 deletions Analytics/Client.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;

using System.Threading.Tasks;
using Segment.Flush;
using Segment.Request;
using Segment.Exception;
using Segment.Model;
using Segment.Request;
using Segment.Stats;

namespace Segment
Expand Down Expand Up @@ -648,7 +645,7 @@ public void Dispose()

private void Enqueue(BaseAction action)
{
_flushHandler.Process(action);
_flushHandler.Process(action).GetAwaiter().GetResult();

this.Statistics.Submitted = Statistics.Increment(this.Statistics.Submitted);
}
Expand Down
16 changes: 5 additions & 11 deletions Analytics/Flush/AsyncFlushHandler.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Runtime.Serialization.Json;
using System.IO;
using System.Collections.Generic;
using System.Threading;

using Segment;
using Segment.Request;
using System.Threading.Tasks;
using Segment.Model;
using Segment.Exception;
using Segment.Request;

namespace Segment.Flush
{
Expand Down Expand Up @@ -71,7 +65,7 @@ internal AsyncFlushHandler(IBatchFactory batchFactory,
_flushingThread.Start();
}

public void Process(BaseAction action)
public async Task Process(BaseAction action)
{
int size = _queue.Count;

Expand Down Expand Up @@ -166,7 +160,7 @@ private void Loop()
});

// make the request here
_requestHandler.MakeRequest(batch);
_requestHandler.MakeRequest(batch).GetAwaiter().GetResult();

// mark the current batch as null
current = new List<BaseAction>();
Expand Down
17 changes: 5 additions & 12 deletions Analytics/Flush/BlockingFlushHandler.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Runtime.Serialization.Json;
using System.IO;
using System.Threading;

using Segment;
using Segment.Request;
using System.Collections.Generic;
using System.Threading.Tasks;
using Segment.Model;
using Segment.Exception;
using Segment.Request;

namespace Segment.Flush
{
Expand All @@ -32,10 +25,10 @@ internal BlockingFlushHandler(IBatchFactory batchFactory,
this._requestHandler = requestHandler;
}

public void Process(BaseAction action)
public async Task Process(BaseAction action)
{
Batch batch = _batchFactory.Create(new List<BaseAction>() { action });
_requestHandler.MakeRequest(batch);
await _requestHandler.MakeRequest(batch).ConfigureAwait(false);
}

/// <summary>
Expand Down
8 changes: 3 additions & 5 deletions Analytics/Flush/IFlushHandler.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;

using System;
using System.Threading.Tasks;
using Segment.Model;
using Segment.Request;

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

/// <summary>
/// Blocks until all processing messages are flushed to the server
/// </summary>
void Flush();
}
}

6 changes: 5 additions & 1 deletion Analytics/History.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

X.X.X / June 20, 2017
=================
* now targeting netstandard 1.3

2.0.1 / July 1, 2015
=================
* anonymous id fixes
Expand All @@ -18,4 +22,4 @@

1.2.0 / May 16, 2014
=================
* updating to spec v1
* updating to spec v1
34 changes: 0 additions & 34 deletions Analytics/Properties/AssemblyInfo.cs

This file was deleted.

26 changes: 0 additions & 26 deletions Analytics/Request/BatchState.cs

This file was deleted.

Loading

0 comments on commit 6660ad5

Please sign in to comment.