Skip to content

Commit

Permalink
Adding a fix for the start issue and also commit a change to the prob…
Browse files Browse the repository at this point in the history
…lem with concurrent searches.
  • Loading branch information
blastdan committed Jul 13, 2015
1 parent 53da5d0 commit 4edcb00
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 2 deletions.
149 changes: 148 additions & 1 deletion Wox.Plugin.Choco/Service References/ChocoReference/Reference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//------------------------------------------------------------------------------

// Original file name:
// Generation date: 3/19/2015 12:04:31 AM
// Generation date: 2015-07-12 6:33:04 PM
namespace Wox.Plugin.Choco.ChocoReference
{

Expand Down Expand Up @@ -569,6 +569,111 @@ public string ProjectUrl
partial void OnProjectUrlChanging(string value);
partial void OnProjectUrlChanged();
/// <summary>
/// There are no comments for Property ProjectSourceUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string ProjectSourceUrl
{
get
{
return this._ProjectSourceUrl;
}
set
{
this.OnProjectSourceUrlChanging(value);
this._ProjectSourceUrl = value;
this.OnProjectSourceUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _ProjectSourceUrl;
partial void OnProjectSourceUrlChanging(string value);
partial void OnProjectSourceUrlChanged();
/// <summary>
/// There are no comments for Property PackageSourceUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string PackageSourceUrl
{
get
{
return this._PackageSourceUrl;
}
set
{
this.OnPackageSourceUrlChanging(value);
this._PackageSourceUrl = value;
this.OnPackageSourceUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _PackageSourceUrl;
partial void OnPackageSourceUrlChanging(string value);
partial void OnPackageSourceUrlChanged();
/// <summary>
/// There are no comments for Property DocsUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string DocsUrl
{
get
{
return this._DocsUrl;
}
set
{
this.OnDocsUrlChanging(value);
this._DocsUrl = value;
this.OnDocsUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _DocsUrl;
partial void OnDocsUrlChanging(string value);
partial void OnDocsUrlChanged();
/// <summary>
/// There are no comments for Property MailingListUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string MailingListUrl
{
get
{
return this._MailingListUrl;
}
set
{
this.OnMailingListUrlChanging(value);
this._MailingListUrl = value;
this.OnMailingListUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _MailingListUrl;
partial void OnMailingListUrlChanging(string value);
partial void OnMailingListUrlChanged();
/// <summary>
/// There are no comments for Property BugTrackerUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string BugTrackerUrl
{
get
{
return this._BugTrackerUrl;
}
set
{
this.OnBugTrackerUrlChanging(value);
this._BugTrackerUrl = value;
this.OnBugTrackerUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _BugTrackerUrl;
partial void OnBugTrackerUrlChanging(string value);
partial void OnBugTrackerUrlChanged();
/// <summary>
/// There are no comments for Property ReportAbuseUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
Expand Down Expand Up @@ -611,6 +716,48 @@ public string ReleaseNotes
partial void OnReleaseNotesChanging(string value);
partial void OnReleaseNotesChanged();
/// <summary>
/// There are no comments for Property PackageStatus in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string PackageStatus
{
get
{
return this._PackageStatus;
}
set
{
this.OnPackageStatusChanging(value);
this._PackageStatus = value;
this.OnPackageStatusChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _PackageStatus;
partial void OnPackageStatusChanging(string value);
partial void OnPackageStatusChanged();
/// <summary>
/// There are no comments for Property PackageSubmittedStatus in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string PackageSubmittedStatus
{
get
{
return this._PackageSubmittedStatus;
}
set
{
this.OnPackageSubmittedStatusChanging(value);
this._PackageSubmittedStatus = value;
this.OnPackageSubmittedStatusChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _PackageSubmittedStatus;
partial void OnPackageSubmittedStatusChanging(string value);
partial void OnPackageSubmittedStatusChanged();
/// <summary>
/// There are no comments for Property RequireLicenseAcceptance in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@
<Property Name="PackageHashAlgorithm" Type="Edm.String" Nullable="true" />
<Property Name="PackageSize" Type="Edm.Int64" Nullable="false" />
<Property Name="ProjectUrl" Type="Edm.String" Nullable="true" />
<Property Name="ProjectSourceUrl" Type="Edm.String" Nullable="true" />
<Property Name="PackageSourceUrl" Type="Edm.String" Nullable="true" />
<Property Name="DocsUrl" Type="Edm.String" Nullable="true" />
<Property Name="MailingListUrl" Type="Edm.String" Nullable="true" />
<Property Name="BugTrackerUrl" Type="Edm.String" Nullable="true" />
<Property Name="ReportAbuseUrl" Type="Edm.String" Nullable="true" />
<Property Name="ReleaseNotes" Type="Edm.String" Nullable="true" />
<Property Name="PackageStatus" Type="Edm.String" Nullable="true" />
<Property Name="PackageSubmittedStatus" Type="Edm.String" Nullable="true" />
<Property Name="RequireLicenseAcceptance" Type="Edm.Boolean" Nullable="false" />
<Property Name="Summary" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationSummary" m:FC_ContentKind="text" m:FC_KeepInContent="false" />
<Property Name="Tags" Type="Edm.String" Nullable="true" />
Expand Down
16 changes: 15 additions & 1 deletion Wox.Plugin.Choco/Web.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.Services.Client;
Expand Down Expand Up @@ -123,6 +124,10 @@ private class Downloader : IDisposable
private bool downloadSuccessful = false;
private bool disposed;

public bool downloadStarted = false;
public static ConcurrentDictionary<string, Downloader> CurrentlyDownloading = new ConcurrentDictionary<string, Downloader>();


private Downloader(WebClient client, DownloadFileInformation information)
{
this.information = information;
Expand All @@ -142,13 +147,22 @@ public static Downloader Run(DownloadFileInformation information)
{
var client = new WebClient();
var downloader = new Downloader(client, information);
downloader.Download();
downloader = Downloader.CurrentlyDownloading.GetOrAdd(information.FilePath, downloader);

if(!downloader.downloadStarted)
{
downloader.downloadStarted = true;
downloader.Download();
}

return downloader;
}

public Downloader Wait()
{
this.waitHandle.WaitOne(new TimeSpan(0, 0, 30));
var me = this;
Downloader.CurrentlyDownloading.TryRemove(this.DownloadFileStatus.FilePath, out me);
return this;
}

Expand Down
4 changes: 4 additions & 0 deletions Wox.Plugin.Choco/Wox.Plugin.Choco.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
<Reference Include="System.Data.Services.Client" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Threading, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\TaskParallelLibrary.1.0.2856.0\lib\Net35\System.Threading.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
Expand Down
1 change: 1 addition & 0 deletions Wox.Plugin.Choco/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="TaskParallelLibrary" version="1.0.2856.0" targetFramework="net35" />
<package id="Wox.Plugin" version="1.1.1.426" targetFramework="net45" />
</packages>

0 comments on commit 4edcb00

Please sign in to comment.