Permalink
Browse files

NAntContrib + build-changes

  • Loading branch information...
1 parent 0472497 commit ee54be0470cfc7186091c7566a0ac4513d124a8a @Alxandr committed Nov 9, 2012
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+ </startup>
+</configuration>
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("SpotiFire.Server")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("SpotiFire.Server")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("686b4ad6-1bfa-414f-ac6b-af86e31bb41a")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,80 @@
+<?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')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{EFEF4D47-AD58-41B6-80A9-D98A35FC3B5E}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>SpotiFire.Server</RootNamespace>
+ <AssemblyName>SpotiFire.Server</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <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' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup>
+ <StartupObject />
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Gate">
+ <HintPath>..\packages\Gate.0.20\lib\net40\Gate.dll</HintPath>
+ </Reference>
+ <Reference Include="Owin">
+ <HintPath>..\packages\Owin.0.5\lib\net40\Owin.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Net.Http.WebRequest" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Startup.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\SpotiFire.LibSpotify\SpotiFire.LibSpotify.vcxproj">
+ <Project>{3a193712-4ae2-4b7a-9adf-139d3213e34b}</Project>
+ <Name>SpotiFire.LibSpotify</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\SpotiFire.SpotifyLib\SpotiFire.SpotifyLib.csproj">
+ <Project>{cbf5614b-af79-4228-8265-7dc2baf9a626}</Project>
+ <Name>SpotiFire.SpotifyLib</Name>
+ </ProjectReference>
+ </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>
+ -->
+</Project>
@@ -0,0 +1,35 @@
+using Owin;
+using Gate;
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Linq;
+using System.Net.Http;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace SpotiFire.Server
+{
+ public class Startup
+ {
+ public void Configuration(IAppBuilder builder)
+ {
+ builder
+ .Map("/signalr", SignalRConfiguration)
+ .UseGate((Func<Request, Response, Task>)GetFile);
+ }
+
+ private async Task GetFile(Request request, Response response)
+ {
+
+ }
+
+ private void SignalRConfiguration(IAppBuilder builder)
+ {
+
+ }
+ }
+}
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Gate" version="0.20" targetFramework="net45" />
+ <package id="Owin" version="0.5" targetFramework="net45" />
+</packages>
@@ -8,9 +8,9 @@
[assembly: AssemblyTitle("SpotiFire")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyCompany("Alxandr Productions")]
[assembly: AssemblyProduct("SpotiFire")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[assembly: AssemblyCopyright("Copyright © Alxandr Productions 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -88,64 +88,68 @@ public static AwaitHelper.AwaitableAwaiter<PlaylistContainer> GetAwaiter(this Pl
return AwaitHelper.GetAwaiter<PlaylistContainer>(pc);
}
- // Load made a task
- private readonly static List<Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>> waiting = new List<Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>>();
- private static bool running = false;
- private static Task<IAsyncLoaded> Load(this IAsyncLoaded loadable)
+ private readonly static List<Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>> _waiting = new List<Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>>();
+ private readonly static Timer _timer = new Timer(_timer_Tick, new List<Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>>(), Timeout.Infinite, 100);
+ private volatile static bool _running = false;
+
+ private static void _timer_Tick(object _state)
{
- Action start = () =>
+ List<Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>> waiting = (List<Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>>)_state;
+ lock (_waiting)
+ {
+ if (_waiting.Count > 0)
+ {
+ waiting.AddRange(_waiting);
+ _waiting.Clear();
+ }
+ }
+
+ if (waiting.Count > 0)
{
- running = true;
- ThreadPool.QueueUserWorkItem(delegate
+ for (var i = 0; i < waiting.Count; i++)
{
- while (true)
+ var w = waiting[i];
+ if (w.Item1.IsLoaded && w.Item1.IsReady)
{
- Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>[] l;
- Thread.Sleep(100);
- lock (waiting)
- l = waiting.ToArray();
-
- HashSet<Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>> r = new HashSet<Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>>();
-
- foreach (var i in l)
- if (i.Item1.IsLoaded && i.Item1.IsReady)
- {
- i.Item2.SetResult(i.Item1);
- r.Add(i);
- }
-
- lock (waiting)
- {
- waiting.RemoveAll(e => r.Contains(e));
- if (waiting.Count == 0)
- {
- running = false;
- break;
- }
- }
+ w.Item2.SetResult(w.Item1);
+ waiting.RemoveAt(i);
+ i--;
}
- });
- };
+ }
+ }
+ else
+ {
+ lock (_waiting)
+ {
+ if (_waiting.Count == 0)
+ {
+ _timer.Change(Timeout.Infinite, 100);
+ _running = false;
+ }
+ }
+ }
+ }
+ // Load made a task
+ private static Task<IAsyncLoaded> Load(this IAsyncLoaded loadable)
+ {
TaskCompletionSource<IAsyncLoaded> tcs = new TaskCompletionSource<IAsyncLoaded>();
if (loadable.IsLoaded && loadable.IsReady)
+ {
tcs.SetResult(loadable);
- else if (running)
- lock (waiting)
- if (running)
- waiting.Add(new Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>(loadable, tcs));
- else
- {
- waiting.Add(new Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>(loadable, tcs));
- start();
- }
+ }
else
- lock (waiting)
+ {
+ lock (_waiting)
{
- waiting.Add(new Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>(loadable, tcs));
- start();
+ _waiting.Add(new Tuple<IAsyncLoaded, TaskCompletionSource<IAsyncLoaded>>(loadable, tcs));
+ if (!_running)
+ {
+ _running = true;
+ _timer.Change(0, 100);
+ }
}
-
+ }
return tcs.Task;
}
Oops, something went wrong.

0 comments on commit ee54be0

Please sign in to comment.