Skip to content

Commit

Permalink
Updated to 0.9, https, code cleanup, revert error text parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
aberus committed Dec 28, 2018
1 parent d63fd06 commit 333ea02
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 57 deletions.
Binary file added Assets/Logo_128x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added Assets/StackOverflow-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 1 addition & 6 deletions StackOverflowQuickLaunch/Browser.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EnvDTE;
using EnvDTE;

namespace Aberus.StackOverflowQuickLaunch
{
Expand Down
11 changes: 5 additions & 6 deletions StackOverflowQuickLaunch/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand All @@ -12,10 +11,10 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Aleksander Berus")]
[assembly: AssemblyProduct("Stack Overflow Quick Launch Search Provider")]
[assembly: AssemblyCopyright("Copyright © Aleksander Berus 2014-2018")]
[assembly: AssemblyCopyright("Copyright © Aleksander Berus 2014-2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: NeutralResourcesLanguage("en-US")]

Expand All @@ -28,8 +27,8 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.8.0.0")]
[assembly: AssemblyFileVersion("0.8.0.0")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]



Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion StackOverflowQuickLaunch/StackOverflowQuickLaunch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Resource Include="Resources\StackOverflowSearchErrorListCommand.png" />
<VSCTCompile Include="StackOverflowQuickLaunchPackage.vsct">
<ResourceName>Menus.ctmenu</ResourceName>
</VSCTCompile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Aberus.StackOverflowQuickLaunch
[PackageRegistration(UseManagedResourcesOnly = true)]
// This attribute is used to register the information needed to show this package
// in the Help/About dialog of Visual Studio.
[InstalledProductRegistration("#110", "#112", "0.7.0", IconResourceID = 400)]
[InstalledProductRegistration("#110", "#112", "0.9.0", IconResourceID = 400)]
// Declare the package guid
[Guid(GuidList.guidStackOverflowQuickLaunchQuickLaunchPkgString)]
// Declare a global search provider supported by this package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@

using System;
using System.ComponentModel.Design;
using System.Globalization;
using System.Net;
using System.Text.RegularExpressions;
using EnvDTE80;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;

namespace Aberus.StackOverflowQuickLaunch
{
Expand Down Expand Up @@ -99,10 +97,10 @@ private void MenuItemCallback(object sender, EventArgs e)
if (selected != null && selected.TryGetValue("text", out object text))
{
string description = (string)text;
description = Regex.Replace(description, "\\s'.*'\\s", " ", RegexOptions.IgnoreCase);
description = Regex.Replace(description, "'.*'", "''", RegexOptions.IgnoreCase);

string searchQuery = selected.TryGetValue("errorcode", out object code) ? $"{code}: {description}" : description;
string url = "http://stackoverflow.com/search?q=" + WebUtility.UrlEncode(searchQuery);
string url = "https://stackoverflow.com/search?q=" + WebUtility.UrlEncode(searchQuery);
Browser.Open(url,
((StackOverflowQuickLaunchPackage)package).OptionPage.OpenInInternalBrowser,
((StackOverflowQuickLaunchPackage)package).OptionPage.OpenInNewTab);
Expand Down
4 changes: 1 addition & 3 deletions StackOverflowQuickLaunch/StackOverflowSearchItemResult.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Diagnostics;
using Microsoft.VisualStudio.Shell.Interop;
using EnvDTE;
using Microsoft.VisualStudio.Shell.Interop;

namespace Aberus.StackOverflowQuickLaunch
{
Expand Down
2 changes: 0 additions & 2 deletions StackOverflowQuickLaunch/StackOverflowSearchResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ public static T ToEnum<T>(this string value) where T : struct, IConvertible
return default(T);
}



public static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);

/// <summary>
Expand Down
7 changes: 3 additions & 4 deletions StackOverflowQuickLaunch/StackOverflowSearchTask.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
Expand Down Expand Up @@ -56,7 +55,7 @@ protected async override void OnStartSearch()
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
}
))
using (var response = await client.GetAsync("http://api.stackexchange.com/2.2/search/excerpts?order=desc&pagesize=" + pageSize + "&sort=" + sortQuery + "&site=stackoverflow&q=" + WebUtility.UrlEncode(SearchQuery.SearchString.Trim()), cancellationSource.Token))
using (var response = await client.GetAsync("https://api.stackexchange.com/2.2/search/excerpts?order=desc&pagesize=" + pageSize + "&sort=" + sortQuery + "&site=stackoverflow&q=" + WebUtility.UrlEncode(SearchQuery.SearchString.Trim()), cancellationSource.Token))
using (var receiveStream = await response.Content.ReadAsStreamAsync())
{
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(StackOverflowSearchResult));
Expand Down Expand Up @@ -105,7 +104,7 @@ protected async override void OnStartSearch()
var itemResult = new StackOverflowSearchItemResult(
(results[itemIndex].ItemType == ItemType.Question ? "Q: " : "A: ") + WebUtility.HtmlDecode(results[itemIndex].Title),
FormatExcerpt(WebUtility.HtmlDecode(results[itemIndex].Excerpt)).Trim(),
"http://stackoverflow.com/questions/" + results[itemIndex].QuestionId,
"https://stackoverflow.com/questions/" + results[itemIndex].QuestionId,
new WinFormsIconUIObject(Resources.StackOverflow),
searchProvider);

Expand All @@ -126,7 +125,7 @@ protected async override void OnStartSearch()
SearchCallback.ReportResult(this,
new StackOverflowSearchItemResult("Search Online on Stack Overflow for '" + SearchQuery.SearchString + "'",
string.Empty,
"http://stackoverflow.com/search?q=" + WebUtility.UrlEncode(SearchQuery.SearchString.Trim()),
"https://stackoverflow.com/search?q=" + WebUtility.UrlEncode(SearchQuery.SearchString.Trim()),
null,
searchProvider));

Expand Down
60 changes: 30 additions & 30 deletions StackOverflowQuickLaunch/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="63E411F1-E531-44E8-8689-16B34600CF25" Version="0.8.0" Language="en-US" Publisher="Aleksander Berus" />
<DisplayName>Stack Overflow Quick Launch Search Provider</DisplayName>
<Description xml:space="preserve">A Quick Launch search provider for searching Stack Overflow in Visual Studio</Description>
<MoreInfo>https://github.com/aberus/StackOverflowQuickLaunch</MoreInfo>
<License>License.txt</License>
<Icon>Resources\Logo_128x.png</Icon>
<PreviewImage>Resources\Preview_200x.png</PreviewImage>
</Metadata>
<Installation InstalledByMsi="false">
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="11.0" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="12.0" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="14.0" />
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="12.0" />
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="14.0" />
<InstallationTarget Id="Microsoft.VisualStudio.IntegratedShell" Version="14.0" />
<InstallationTarget Version="15.0" Id="Microsoft.VisualStudio.Enterprise" />
<InstallationTarget Version="15.0" Id="Microsoft.VisualStudio.Pro" />
<InstallationTarget Version="15.0" Id="Microsoft.VisualStudio.Community" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
<Dependency Id="Microsoft.VisualStudio.MPF.11.0" DisplayName="Visual Studio MPF 11.0" d:Source="Installed" Version="[11.0,14.0)" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0.26208.0,16.0)" DisplayName="Visual Studio core editor" />
</Prerequisites>
<Metadata>
<Identity Id="63E411F1-E531-44E8-8689-16B34600CF25" Version="0.9.0" Language="en-US" Publisher="Aleksander Berus" />
<DisplayName>Stack Overflow Quick Launch Search Provider</DisplayName>
<Description xml:space="preserve">A Quick Launch search provider for searching Stack Overflow in Visual Studio</Description>
<MoreInfo>https://github.com/aberus/StackOverflowQuickLaunch</MoreInfo>
<License>License.txt</License>
<Icon>Resources\Logo_128x.png</Icon>
<PreviewImage>Resources\Preview_200x.png</PreviewImage>
</Metadata>
<Installation InstalledByMsi="false">
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="11.0" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="12.0" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="14.0" />
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="12.0" />
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="14.0" />
<InstallationTarget Id="Microsoft.VisualStudio.IntegratedShell" Version="14.0" />
<InstallationTarget Id="Microsoft.VisualStudio.Enterprise" Version="15.0" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="15.0" />
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="15.0" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
<Dependency Id="Microsoft.VisualStudio.MPF.11.0" DisplayName="Visual Studio MPF 11.0" d:Source="Installed" Version="[11.0,14.0)" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0.26208.0,16.0)" DisplayName="Visual Studio core editor" />
</Prerequisites>
</PackageManifest>

0 comments on commit 333ea02

Please sign in to comment.