diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-11-26 12:15:52 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-11-26 12:15:52 +0200 |
| commit | 0a8af16821cfbb52fe02881921695d378f6578d7 (patch) | |
| tree | a6c833776be9fe8cd5bf83d0a802c9a15cb60410 /Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI | |
| parent | 4eff62d399ff3f3093f67185ac58b5d0a134e25e (diff) | |
| download | Tango-0a8af16821cfbb52fe02881921695d378f6578d7.tar.gz Tango-0a8af16821cfbb52fe02881921695d378f6578d7.zip | |
Implemented shortcut generator + post build events for all GUI utilities.
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI')
6 files changed, 155 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/App.config b/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/App.config new file mode 100644 index 000000000..8e1564635 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/App.config @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> + </startup> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/Options.cs b/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/Options.cs new file mode 100644 index 000000000..e1b59d3c3 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/Options.cs @@ -0,0 +1,26 @@ +using CommandLine; +using CommandLine.Text; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.ShortcutGenerator.CLI +{ + public class Options + { + [Option('s', Required = true, HelpText = "Source application file.")] + public String SourcePath { get; set; } + + [Option('d', Required = true, HelpText = "Target shortcut file.")] + public String TargetPath { get; set; } + + [HelpOption] + public string GetUsage() + { + return HelpText.AutoBuild(this, + (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current)); + } + } +} diff --git a/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/Program.cs new file mode 100644 index 000000000..9d1a4666b --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/Program.cs @@ -0,0 +1,34 @@ +using IWshRuntimeLibrary; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.ShortcutGenerator.CLI +{ + class Program + { + static void Main(string[] args) + { + var options = new Options(); + + if (CommandLine.Parser.Default.ParseArguments(args, options)) + { + Directory.CreateDirectory(Path.GetDirectoryName(options.TargetPath)); + + WshShell wsh = new WshShell(); + IWshShortcut shortcut = wsh.CreateShortcut(Path.GetFullPath(options.TargetPath)) as IWshShortcut; + shortcut.Arguments = ""; + shortcut.TargetPath = Path.GetFullPath(options.SourcePath); + shortcut.Description = FileVersionInfo.GetVersionInfo(shortcut.TargetPath).FileDescription; + shortcut.WorkingDirectory = Path.GetDirectoryName(shortcut.TargetPath); + //shortcut.IconLocation = "specify icon location"; + shortcut.Save(); + Console.WriteLine("Shortcut create: " + shortcut.TargetPath); + } + } + } +} diff --git a/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..d9073ce97 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/Properties/AssemblyInfo.cs @@ -0,0 +1,6 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Tango - Executable shortcut generator utility")] +[assembly: ComVisible(false)]
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/Tango.ShortcutGenerator.CLI.csproj b/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/Tango.ShortcutGenerator.CLI.csproj new file mode 100644 index 000000000..0e95fe3f2 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/Tango.ShortcutGenerator.CLI.csproj @@ -0,0 +1,79 @@ +<?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>{ADDEEDAF-B45C-4681-8FB7-1C0A0DC63B4B}</ProjectGuid> + <OutputType>Exe</OutputType> + <RootNamespace>Tango.ShortcutGenerator.CLI</RootNamespace> + <AssemblyName>linkgen</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>..\..\Build\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="CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL"> + <HintPath>..\..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <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="..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="Options.cs" /> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <None Include="App.config" /> + <None Include="packages.config" /> + </ItemGroup> + <ItemGroup> + <COMReference Include="IWshRuntimeLibrary"> + <Guid>{F935DC20-1CF0-11D0-ADB9-00C04FD58A0B}</Guid> + <VersionMajor>1</VersionMajor> + <VersionMinor>0</VersionMinor> + <Lcid>0</Lcid> + <WrapperTool>tlbimp</WrapperTool> + <Isolated>False</Isolated> + <EmbedInteropTypes>True</EmbedInteropTypes> + </COMReference> + <COMReference Include="Shell32"> + <Guid>{50A7E9B0-70EF-11D1-B75A-00A0C90564FE}</Guid> + <VersionMajor>1</VersionMajor> + <VersionMinor>0</VersionMinor> + <Lcid>0</Lcid> + <WrapperTool>tlbimp</WrapperTool> + <Isolated>False</Isolated> + <EmbedInteropTypes>True</EmbedInteropTypes> + </COMReference> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/packages.config b/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/packages.config new file mode 100644 index 000000000..0d9f59112 --- /dev/null +++ b/Software/Visual_Studio/Utilities/Tango.ShortcutGenerator.CLI/packages.config @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="CommandLineParser" version="1.9.71" targetFramework="net45" /> +</packages>
\ No newline at end of file |
