Compare commits
2 Commits
31a6e23db8
...
d8fd9ab03f
Author | SHA1 | Date | |
---|---|---|---|
d8fd9ab03f | |||
a2eac0a4ca |
226
.gitignore
vendored
Normal file
226
.gitignore
vendored
Normal file
@ -0,0 +1,226 @@
|
|||||||
|
# The following command works for downloading when using Git for Windows:
|
||||||
|
# curl -LOf http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
|
||||||
|
#
|
||||||
|
# Download this file using PowerShell v3 under Windows with the following comand:
|
||||||
|
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
|
||||||
|
#
|
||||||
|
# or wget:
|
||||||
|
# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Rr]elease/
|
||||||
|
x64/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
# build folder is nowadays used for build scripts and should not be ignored
|
||||||
|
#build/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/packages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/packages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/packages/repositories.config
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
*.ncrunch*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.Publish.xml
|
||||||
|
|
||||||
|
# Windows Azure Build Output
|
||||||
|
csx
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Windows Store app package directory
|
||||||
|
AppPackages/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
*.Cache
|
||||||
|
ClientBin/
|
||||||
|
[Ss]tyle[Cc]op.*
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
modulesbin/
|
||||||
|
tempbin/
|
||||||
|
|
||||||
|
# EPiServer Site file (VPP)
|
||||||
|
AppData/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file to a newer
|
||||||
|
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
|
||||||
|
# vim
|
||||||
|
*.txt~
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# Temp files when opening LibreOffice on ubuntu
|
||||||
|
.~lock.*
|
||||||
|
|
||||||
|
# svn
|
||||||
|
.svn
|
||||||
|
|
||||||
|
# CVS - Source Control
|
||||||
|
**/CVS/
|
||||||
|
|
||||||
|
# Remainings from resolving conflicts in Source Control
|
||||||
|
*.orig
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
**/App_Data/*.mdf
|
||||||
|
**/App_Data/*.ldf
|
||||||
|
**/App_Data/*.sdf
|
||||||
|
|
||||||
|
|
||||||
|
#LightSwitch generated files
|
||||||
|
GeneratedArtifacts/
|
||||||
|
_Pvt_Extensions/
|
||||||
|
ModelManifest.xml
|
||||||
|
|
||||||
|
# =========================
|
||||||
|
# Windows detritus
|
||||||
|
# =========================
|
||||||
|
|
||||||
|
# Windows image file caches
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# OS generated files #
|
||||||
|
Icon?
|
||||||
|
|
||||||
|
# Mac desktop service store files
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# SASS Compiler cache
|
||||||
|
.sass-cache
|
||||||
|
|
||||||
|
# Visual Studio 2014 CTP
|
||||||
|
**/*.sln.ide
|
||||||
|
|
||||||
|
# Visual Studio temp something
|
||||||
|
.vs/
|
||||||
|
|
||||||
|
# dotnet stuff
|
||||||
|
project.lock.json
|
||||||
|
|
||||||
|
# VS 2015+
|
||||||
|
*.vc.vc.opendb
|
||||||
|
*.vc.db
|
||||||
|
|
||||||
|
# Rider
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# Output folder used by Webpack or other FE stuff
|
||||||
|
**/node_modules/*
|
||||||
|
**/wwwroot/*
|
||||||
|
|
||||||
|
# SpecFlow specific
|
||||||
|
*.feature.cs
|
||||||
|
*.feature.xlsx.*
|
||||||
|
*.Specs_*.html
|
||||||
|
|
||||||
|
# UWP Projects
|
||||||
|
AppPackages/
|
||||||
|
|
||||||
|
#####
|
||||||
|
# End of core ignore list, below put you custom 'per project' settings (patterns or path)
|
||||||
|
#####
|
226
src/.gitignore
vendored
Normal file
226
src/.gitignore
vendored
Normal file
@ -0,0 +1,226 @@
|
|||||||
|
# The following command works for downloading when using Git for Windows:
|
||||||
|
# curl -LOf http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
|
||||||
|
#
|
||||||
|
# Download this file using PowerShell v3 under Windows with the following comand:
|
||||||
|
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
|
||||||
|
#
|
||||||
|
# or wget:
|
||||||
|
# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Rr]elease/
|
||||||
|
x64/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
# build folder is nowadays used for build scripts and should not be ignored
|
||||||
|
#build/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/packages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/packages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/packages/repositories.config
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
*.ncrunch*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.Publish.xml
|
||||||
|
|
||||||
|
# Windows Azure Build Output
|
||||||
|
csx
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Windows Store app package directory
|
||||||
|
AppPackages/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
*.Cache
|
||||||
|
ClientBin/
|
||||||
|
[Ss]tyle[Cc]op.*
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
modulesbin/
|
||||||
|
tempbin/
|
||||||
|
|
||||||
|
# EPiServer Site file (VPP)
|
||||||
|
AppData/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file to a newer
|
||||||
|
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
|
||||||
|
# vim
|
||||||
|
*.txt~
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# Temp files when opening LibreOffice on ubuntu
|
||||||
|
.~lock.*
|
||||||
|
|
||||||
|
# svn
|
||||||
|
.svn
|
||||||
|
|
||||||
|
# CVS - Source Control
|
||||||
|
**/CVS/
|
||||||
|
|
||||||
|
# Remainings from resolving conflicts in Source Control
|
||||||
|
*.orig
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
**/App_Data/*.mdf
|
||||||
|
**/App_Data/*.ldf
|
||||||
|
**/App_Data/*.sdf
|
||||||
|
|
||||||
|
|
||||||
|
#LightSwitch generated files
|
||||||
|
GeneratedArtifacts/
|
||||||
|
_Pvt_Extensions/
|
||||||
|
ModelManifest.xml
|
||||||
|
|
||||||
|
# =========================
|
||||||
|
# Windows detritus
|
||||||
|
# =========================
|
||||||
|
|
||||||
|
# Windows image file caches
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# OS generated files #
|
||||||
|
Icon?
|
||||||
|
|
||||||
|
# Mac desktop service store files
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# SASS Compiler cache
|
||||||
|
.sass-cache
|
||||||
|
|
||||||
|
# Visual Studio 2014 CTP
|
||||||
|
**/*.sln.ide
|
||||||
|
|
||||||
|
# Visual Studio temp something
|
||||||
|
.vs/
|
||||||
|
|
||||||
|
# dotnet stuff
|
||||||
|
project.lock.json
|
||||||
|
|
||||||
|
# VS 2015+
|
||||||
|
*.vc.vc.opendb
|
||||||
|
*.vc.db
|
||||||
|
|
||||||
|
# Rider
|
||||||
|
.idea/
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# Output folder used by Webpack or other FE stuff
|
||||||
|
**/node_modules/*
|
||||||
|
**/wwwroot/*
|
||||||
|
|
||||||
|
# SpecFlow specific
|
||||||
|
*.feature.cs
|
||||||
|
*.feature.xlsx.*
|
||||||
|
*.Specs_*.html
|
||||||
|
|
||||||
|
# UWP Projects
|
||||||
|
AppPackages/
|
||||||
|
|
||||||
|
#####
|
||||||
|
# End of core ignore list, below put you custom 'per project' settings (patterns or path)
|
||||||
|
#####
|
6
src/App.config
Executable file
6
src/App.config
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<startup>
|
||||||
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||||
|
</startup>
|
||||||
|
</configuration>
|
55
src/LinkUnshortener.csproj
Executable file
55
src/LinkUnshortener.csproj
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" 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>{5519839D-BFDF-4265-9C44-D2EA39C0B644}</ProjectGuid>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>LinkUnshortener</RootNamespace>
|
||||||
|
<AssemblyName>LinkUnshortener</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<Deterministic>true</Deterministic>
|
||||||
|
</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>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Windows.Forms" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App.config" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
25
src/LinkUnshortener.sln
Executable file
25
src/LinkUnshortener.sln
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.29519.87
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinkUnshortener", "LinkUnshortener.csproj", "{5519839D-BFDF-4265-9C44-D2EA39C0B644}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{5519839D-BFDF-4265-9C44-D2EA39C0B644}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5519839D-BFDF-4265-9C44-D2EA39C0B644}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5519839D-BFDF-4265-9C44-D2EA39C0B644}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{5519839D-BFDF-4265-9C44-D2EA39C0B644}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {C6FD5C83-B15E-4062-A6FC-35579ACE4162}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
103
src/Program.cs
Executable file
103
src/Program.cs
Executable file
@ -0,0 +1,103 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using WinForm = System.Windows.Forms;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
|
namespace LinkUnshortener
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll")]
|
||||||
|
static extern IntPtr GetConsoleWindow();
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
||||||
|
|
||||||
|
const int SW_HIDE = 0;
|
||||||
|
const int SW_SHOW = 5;
|
||||||
|
|
||||||
|
[STAThread]
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var handle = GetConsoleWindow();
|
||||||
|
|
||||||
|
ShowWindow(handle, SW_HIDE);
|
||||||
|
|
||||||
|
if (!Clipboard.ContainsText())
|
||||||
|
return;
|
||||||
|
|
||||||
|
ParseClipboard(Clipboard.GetText());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ParseClipboard(string uriData)
|
||||||
|
{
|
||||||
|
Uri uri;
|
||||||
|
|
||||||
|
if (Uri.IsWellFormedUriString(uriData, UriKind.Absolute))
|
||||||
|
{
|
||||||
|
uri = new Uri(uriData);
|
||||||
|
if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
|
||||||
|
{
|
||||||
|
var returnURL = GetResponseURL(uri.AbsoluteUri);
|
||||||
|
WinForm.MessageBox.Show($"Redirected To: {returnURL}", "Link Unshortener", WinForm.MessageBoxButtons.OK, WinForm.MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Regex.IsMatch(uriData, @"^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$", RegexOptions.IgnoreCase))
|
||||||
|
{
|
||||||
|
var dResultHTTP = WinForm.MessageBox.Show($"URI Scheme Missing!\nRetry using HTTP Scheme?\n\"{uriData}\"", "Link Unshortener", WinForm.MessageBoxButtons.YesNo, WinForm.MessageBoxIcon.Question);
|
||||||
|
|
||||||
|
if (dResultHTTP == WinForm.DialogResult.No)
|
||||||
|
return;
|
||||||
|
|
||||||
|
string returnHTTP = GetResponseURL("http://" + uriData);
|
||||||
|
|
||||||
|
if (returnHTTP == null)
|
||||||
|
{
|
||||||
|
var dResultHTTPS = WinForm.MessageBox.Show($"HTTP Response was null!\nRetry using HTTPS Scheme?\n\"{uriData}\"", "Link Unshortener", WinForm.MessageBoxButtons.YesNo, WinForm.MessageBoxIcon.Question);
|
||||||
|
|
||||||
|
if (dResultHTTPS == WinForm.DialogResult.No)
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
WinForm.MessageBox.Show($"Redirected To: {returnHTTP}", "Link Unshortener", WinForm.MessageBoxButtons.OK, WinForm.MessageBoxIcon.Information);
|
||||||
|
|
||||||
|
string returnHTTPS = GetResponseURL("https://" + uriData);
|
||||||
|
|
||||||
|
if (returnHTTPS == null)
|
||||||
|
WinForm.MessageBox.Show($"HTTPS Response was null!\nApplication Exiting...", "Link Unshortener", WinForm.MessageBoxButtons.YesNo, WinForm.MessageBoxIcon.Information);
|
||||||
|
else
|
||||||
|
WinForm.MessageBox.Show($"Redirected To: {returnHTTPS}", "Link Unshortener", WinForm.MessageBoxButtons.OK, WinForm.MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else
|
||||||
|
WinForm.MessageBox.Show($"We couldn't unshorten this data: \"{uriData}\"", "Link Unshortener", WinForm.MessageBoxButtons.OK, WinForm.MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetResponseURL(string url)
|
||||||
|
{
|
||||||
|
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
|
||||||
|
webRequest.AllowAutoRedirect = false;
|
||||||
|
|
||||||
|
webRequest.Timeout = 10000;
|
||||||
|
webRequest.Method = "HEAD";
|
||||||
|
|
||||||
|
HttpWebResponse webResponse;
|
||||||
|
using (webResponse = (HttpWebResponse)webRequest.GetResponse())
|
||||||
|
{
|
||||||
|
string uriString = webResponse.Headers["Location"];
|
||||||
|
webResponse.Close();
|
||||||
|
return uriString;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
36
src/Properties/AssemblyInfo.cs
Executable file
36
src/Properties/AssemblyInfo.cs
Executable file
@ -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("LinkUnshortener")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("LinkUnshortener")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||||
|
[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("5519839d-bfdf-4265-9c44-d2ea39c0b644")]
|
||||||
|
|
||||||
|
// 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")]
|
Reference in New Issue
Block a user