diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-23 12:18:00 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-23 12:18:00 +0300 |
| commit | 374ac997c64b23984e37bd887db03743c2a744d4 (patch) | |
| tree | db1719bcca27efabfba104ba1f61cc58aaa95583 /Software/Visual_Studio | |
| parent | 3e6e666cc3ef5ed1ac1aafa19c8abd3bc35b4c67 (diff) | |
| download | Tango-374ac997c64b23984e37bd887db03743c2a744d4.tar.gz Tango-374ac997c64b23984e37bd887db03743c2a744d4.zip | |
Added Custom Protocol (Web Open) for Tango FSE installer.
Added support for "Action" on System Information template VSTS.
Implemented VSTS download attachments.
Implemented Tango FSE custom protocol startup args support.
Diffstat (limited to 'Software/Visual_Studio')
12 files changed, 194 insertions, 6 deletions
diff --git a/Software/Visual_Studio/Advanced Installer Projects/FSE Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/FSE Installer.aip index 901fd1a05..88d88071b 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/FSE Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/FSE Installer.aip @@ -304,6 +304,7 @@ <ROW Component="Tango.Visuals.dll" ComponentId="{2707D664-4E05-4C02-8DD1-E15379DF35F7}" Directory_="APPDIR" Attributes="0" KeyPath="Tango.Visuals.dll"/> <ROW Component="Tango.Web.dll" ComponentId="{7544BD5E-0E9E-4E4E-8952-9FFF36EABC33}" Directory_="APPDIR" Attributes="0" KeyPath="Tango.Web.dll"/> <ROW Component="Tango.WebRTC.dll" ComponentId="{80F57AE6-B45A-45B4-AE63-7C6C2AF29039}" Directory_="APPDIR" Attributes="0" KeyPath="Tango.WebRTC.dll"/> + <ROW Component="URLProtocol" ComponentId="{2E4F48A6-68BB-48AB-B37C-341998FB535E}" Directory_="APPDIR" Attributes="4" KeyPath="URLProtocol"/> <ROW Component="WebRtc.NET.dll" ComponentId="{58013A07-CC4C-4183-9065-8016522479D1}" Directory_="APPDIR" Attributes="0" KeyPath="WebRtc.NET.dll"/> <ROW Component="WindowsInput.dll" ComponentId="{0AE7A41B-3CD4-49A0-916C-C1C698DD8A7A}" Directory_="APPDIR" Attributes="0" KeyPath="WindowsInput.dll"/> <ROW Component="Z.EntityFramework.Extensions.dll" ComponentId="{0E9EF254-88AE-4C3C-9190-C3F73D896612}" Directory_="APPDIR" Attributes="0" KeyPath="Z.EntityFramework.Extensions.dll"/> @@ -311,12 +312,17 @@ <ROW Component="Z.Expressions.Eval.dll" ComponentId="{FD15C66D-61BF-4E9D-AE0F-240D0EA1D78C}" Directory_="APPDIR" Attributes="0" KeyPath="Z.Expressions.Eval.dll"/> <ROW Component="ZSpitz.Util.dll" ComponentId="{3476B9F6-18D9-41B1-89D8-9774E8DB91A6}" Directory_="APPDIR" Attributes="0" KeyPath="ZSpitz.Util.dll"/> <ROW Component="ZetaIpc.dll" ComponentId="{4FF5B07F-434F-4E8E-A469-B0218EDE0805}" Directory_="APPDIR" Attributes="0" KeyPath="ZetaIpc.dll"/> + <ROW Component="_" ComponentId="{629E2387-A5A3-4F9E-B3C8-F6B006D38184}" Directory_="APPDIR" Attributes="4" KeyPath="_"/> + <ROW Component="__1" ComponentId="{CB79DBEF-638D-4A61-B7A1-723163228EFA}" Directory_="APPDIR" Attributes="4" KeyPath="__1"/> + <ROW Component="__2" ComponentId="{BB4FC310-F05B-42F5-BB16-3596EFDD4DEB}" Directory_="APPDIR" Attributes="4" KeyPath="__2"/> <ROW Component="ffmpeg.exe" ComponentId="{D6862E01-A64B-40FD-847E-A35B561EFD1D}" Directory_="APPDIR" Attributes="0" KeyPath="ffmpeg.exe"/> <ROW Component="mscoree.dll" ComponentId="{B7304190-8E59-45C3-B972-4611DEB9DE60}" Directory_="APPDIR" Attributes="0" KeyPath="mscoree.dll"/> <ROW Component="msvcp140d.dll" ComponentId="{6B725C2A-71DF-44D3-A761-EB3D28379956}" Directory_="APPDIR" Attributes="0" KeyPath="msvcp140d.dll"/> <ROW Component="netstandard.dll" ComponentId="{27E9F013-8E50-4251-9C63-C53A5AA66DD1}" Directory_="APPDIR" Attributes="0" KeyPath="netstandard.dll"/> + <ROW Component="open" ComponentId="{8BFCC527-F4C3-43E1-AE2B-B078C6D0E4FA}" Directory_="APPDIR" Attributes="4" KeyPath="open"/> <ROW Component="procdoc.chm" ComponentId="{A1ADA8CA-C7F6-4C05-BC9A-E2F821E002DC}" Directory_="APPDIR" Attributes="0" KeyPath="procdoc.chm" Type="1"/> <ROW Component="protobufnet.dll" ComponentId="{ED37672F-F343-44FB-8FBD-F9003BD20D52}" Directory_="APPDIR" Attributes="0" KeyPath="protobufnet.dll"/> + <ROW Component="shell" ComponentId="{A08B0CB0-9A35-4E7B-B7A3-F0039D92CBE4}" Directory_="APPDIR" Attributes="4" KeyPath="shell"/> <ROW Component="turbojpeg.dll" ComponentId="{D884024D-FA37-4526-90AC-37963E621CDB}" Directory_="win7x64_Dir" Attributes="256" KeyPath="turbojpeg.dll"/> <ROW Component="turbojpeg.dll.meta" ComponentId="{F34DC99A-4629-4622-8221-3DDA06EEE754}" Directory_="win7x64_Dir" Attributes="0" KeyPath="turbojpeg.dll.meta" Type="0"/> <ROW Component="turbojpeg.dll.meta_1" ComponentId="{0E539245-AA97-440F-BFF5-F399D510517A}" Directory_="win7x86_Dir" Attributes="0" KeyPath="turbojpeg.dll.meta_1" Type="0"/> @@ -1086,6 +1092,12 @@ <ROW Feature_="TangoFSE" Component_="ZetaIpc.dll"/> <ROW Feature_="TangoFSE" Component_="procdoc.chm"/> <ROW Feature_="TangoFSE" Component_="Tango.DAL.Remote.dll"/> + <ROW Feature_="TangoFSE" Component_="_"/> + <ROW Feature_="TangoFSE" Component_="URLProtocol"/> + <ROW Feature_="TangoFSE" Component_="__1"/> + <ROW Feature_="TangoFSE" Component_="shell"/> + <ROW Feature_="TangoFSE" Component_="open"/> + <ROW Feature_="TangoFSE" Component_="__2"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.MsiIconsComponent"> <ROW Name="ext.exe" SourcePath="..\..\Graphics\FSE\File Associations\procedure_dde.ico" Index="0"/> @@ -1161,7 +1173,13 @@ <ROW Registry="AI_ExePath" Root="-1" Key="Software\Caphyon\Advanced Installer\LZMA\[ProductCode]\[ProductVersion]" Name="AI_ExePath" Value="[AI_SETUPEXEPATH]" Component_="AI_ExePath"/> <ROW Registry="D17D1EE3B5447079AEF0A1CF58498F1" Root="-1" Key="Software\Caphyon\Advanced Installer\Prereqs\[ProductCode]\[ProductVersion]" Name="D17D1EE3B5447079AEF0A1CF58498F1" Value="1" Component_="D17D1EE3B5447079AEF0A1CF58498F1"/> <ROW Registry="Path" Root="-1" Key="Software\[Manufacturer]\[ProductName]" Name="Path" Value="[APPDIR]" Component_="ProductInformation"/> + <ROW Registry="URLProtocol" Root="0" Key="Tango.FSE" Name="URL Protocol" Value="OpenTangoFSE" Component_="URLProtocol"/> <ROW Registry="Version" Root="-1" Key="Software\[Manufacturer]\[ProductName]" Name="Version" Value="[ProductVersion]" Component_="ProductInformation"/> + <ROW Registry="_" Root="0" Key="Tango.FSE" Value="URL:OpenTangoFSE Protocol" Component_="_"/> + <ROW Registry="__1" Root="0" Key="Tango.FSE\DefaultIcon" Value="[#Tango.FSE.UI.exe]" Component_="__1"/> + <ROW Registry="__2" Root="0" Key="Tango.FSE\shell\open\command" Value="[#Tango.FSE.UI.exe] %1" Component_="__2"/> + <ROW Registry="open" Root="0" Key="Tango.FSE\shell\open" Name="+" Component_="open"/> + <ROW Registry="shell" Root="0" Key="Tango.FSE\shell" Name="+" Component_="shell"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.MsiRemoveFileComponent"> <ROW FileKey="_" Component_="System.Runtime.InteropServices.RuntimeInformation.dll" DirProperty="APPDIR" InstallMode="3"/> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Helpers/StartupArgsHelper.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Helpers/StartupArgsHelper.cs new file mode 100644 index 000000000..77bc7204b --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Helpers/StartupArgsHelper.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +namespace Tango.FSE.Common.Helpers +{ + public static class StartupArgsHelper + { + private static String FROM_WEB_PREFIX = "tango.fse:%5C%5C"; + + public static String[] CleanArgsFromWeb(String[] args) + { + if (args != null && args.Length == 1) //Check for web custom protocol + { + if (args[0].StartsWith(FROM_WEB_PREFIX)) + { + List<String> cleanArgs = new List<string>(); + + String full = args[0].Replace(FROM_WEB_PREFIX, String.Empty).Replace("%20", " "); + String[] splitted = full.Split(' '); + + foreach (var item in splitted) + { + cleanArgs.Add(item); + } + + return cleanArgs.ToArray(); + } + } + + return args; + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj index cbd70e665..20bd15973 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj @@ -224,6 +224,7 @@ <Compile Include="Helpers\EncryptionHelper.cs" /> <Compile Include="Helpers\LogsHelper.cs" /> <Compile Include="Helpers\ResourceHelper.cs" /> + <Compile Include="Helpers\StartupArgsHelper.cs" /> <Compile Include="INotifyApplicationStarted.cs" /> <Compile Include="INotifyApplicationReady.cs" /> <Compile Include="Insights\InsightReadyBase.cs" /> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/App.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/App.xaml.cs index 047df9f50..a66ffe51f 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/App.xaml.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/App.xaml.cs @@ -61,9 +61,11 @@ namespace Tango.FSE.UI { if (e.Args != null) { - if (e.Args.Length == DefaultFileAssociationProvider.FILE_ASSOCIATION_ARGS_COUNT) + var args = StartupArgsHelper.CleanArgsFromWeb(e.Args); + + if (args.Length == DefaultFileAssociationProvider.FILE_ASSOCIATION_ARGS_COUNT) { - if (e.Args[0] == DefaultFileAssociationProvider.FILE_ASSOCIATION_PREFIX) + if (args[0] == DefaultFileAssociationProvider.FILE_ASSOCIATION_PREFIX) { if (mutex.WaitOne(TimeSpan.Zero, true)) { @@ -78,8 +80,8 @@ namespace Tango.FSE.UI ipcClient.Initialize(settings.FileAssociationServicePort); ipcClient.Send(JsonConvert.SerializeObject(new FileAssociationPackage() { - TargetName = e.Args[1], - File = e.Args[2] + TargetName = args[1], + File = args[2] })); Thread.Sleep(1000); Environment.Exit(0); diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/ActionModel.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/ActionModel.cs new file mode 100644 index 000000000..5f738a6a3 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/ActionModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.FSE.UI.BugReporting +{ + public class ActionModel + { + public String Name { get; set; } + public String Link { get; set; } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationModel.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationModel.cs index f6fbb7dd3..51981b90e 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationModel.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationModel.cs @@ -20,5 +20,12 @@ namespace Tango.FSE.UI.BugReporting public String Description { get; set; } public String Comments { get; set; } public String Exception { get; set; } + + public List<ActionModel> Actions { get; set; } + + public SystemInformationModel() + { + Actions = new List<ActionModel>(); + } } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationTemplate.cshtml b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationTemplate.cshtml index 2aa96f6fc..46a295c25 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationTemplate.cshtml +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/BugReporting/SystemInformationTemplate.cshtml @@ -50,6 +50,17 @@ </tbody> </table> + @if (vm.Actions.Count > 0) + { + <div style="font-size:16pt;text-decoration:underline;margin-top:10px">Actions</div> + <div> + @foreach (Tango.FSE.UI.BugReporting.ActionModel action in vm.Actions) + { + <a href="@action.Link">@action.Name</a> + } + </div> + } + <div style="font-size:16pt;text-decoration:underline;margin-top:10px">Machine</div> @if (vm.Machine != null) diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/FSEApplication/DefaultFSEApplicationManager.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/FSEApplication/DefaultFSEApplicationManager.cs index aa5d4a629..06a523d54 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/FSEApplication/DefaultFSEApplicationManager.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/FSEApplication/DefaultFSEApplicationManager.cs @@ -149,7 +149,7 @@ namespace Tango.FSE.UI.FSEApplication { DisplayWindowControls = true; StartPath = AssemblyHelper.GetCurrentAssemblyFolder(); - StartupArgs = Environment.GetCommandLineArgs().Skip(1).ToList(); + StartupArgs = Common.Helpers.StartupArgsHelper.CleanArgsFromWeb(Environment.GetCommandLineArgs().Skip(1).ToArray()).ToList(); _notificationProvider = notificationProvider; _dispatcher = dispatcherProvider; diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj index 17fa594fd..2c8f28938 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Tango.FSE.UI.csproj @@ -244,6 +244,7 @@ <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="Authentication\DefaultAuthenticationProvider.cs" /> + <Compile Include="BugReporting\ActionModel.cs" /> <Compile Include="BugReporting\DefaultBugReporter.cs" /> <Compile Include="BugReporting\SystemInformationModel.cs" /> <Compile Include="Connection\DefaultMachineProvider.cs" /> diff --git a/Software/Visual_Studio/Tango.TFS/AttachementHandler.cs b/Software/Visual_Studio/Tango.TFS/AttachementHandler.cs new file mode 100644 index 000000000..4eb08d407 --- /dev/null +++ b/Software/Visual_Studio/Tango.TFS/AttachementHandler.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.TFS +{ + public class AttachementHandler + { + private Action<String> _downloadAction; + + public String Name { get; set; } + public string Comment { get; set; } + public DateTime AttachedTimeUtc { get; set; } + public string Extension { get; set; } + public string FileGuid { get; set; } + public long Length { get; set; } + + internal AttachementHandler(Action<String> downloadAction) + { + _downloadAction = downloadAction; + } + + public Task Download(String targetFile) + { + return Task.Factory.StartNew(() => + { + _downloadAction(targetFile); + }); + } + } +} diff --git a/Software/Visual_Studio/Tango.TFS/Tango.TFS.csproj b/Software/Visual_Studio/Tango.TFS/Tango.TFS.csproj index 2e4bba2ad..3e3e6f6fd 100644 --- a/Software/Visual_Studio/Tango.TFS/Tango.TFS.csproj +++ b/Software/Visual_Studio/Tango.TFS/Tango.TFS.csproj @@ -202,6 +202,7 @@ <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="Area.cs" /> + <Compile Include="AttachementHandler.cs" /> <Compile Include="Attachment.cs" /> <Compile Include="Email.cs" /> <Compile Include="ITeamFoundationEmailClient.cs" /> @@ -265,7 +266,7 @@ </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs b/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs index 27e92b740..a47b109b0 100644 --- a/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs +++ b/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs @@ -1,6 +1,7 @@ using Microsoft.TeamFoundation.Client; using Microsoft.TeamFoundation.Core.WebApi; using Microsoft.TeamFoundation.WorkItemTracking.Client; +using Microsoft.TeamFoundation.WorkItemTracking.Proxy; using Microsoft.TeamFoundation.WorkItemTracking.WebApi; using Microsoft.VisualStudio.Services.Common; using Microsoft.VisualStudio.Services.WebApi; @@ -555,6 +556,68 @@ namespace Tango.TFS }); } + public Task<List<AttachementHandler>> GetWorkItemAttachements(int id) + { + return Task.Factory.StartNew<List<AttachementHandler>>(() => + { + List<AttachementHandler> handlers = new List<AttachementHandler>(); + + var connection = CreateConnection(); + var projCollection = new TfsTeamProjectCollection(new Uri(CollectionURL), connection.Credentials); + projCollection.EnsureAuthenticated(); + WorkItemStore wistore = projCollection.GetService<WorkItemStore>(); + Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem wi = wistore.GetWorkItem(id); + //WorkItemServer wiserver = projCollection.GetService<WorkItemServer>(); + + foreach (Microsoft.TeamFoundation.WorkItemTracking.Client.Attachment attachement in wi.Attachments) + { + AttachementHandler handler = new AttachementHandler((targetPath) => + { + WorkItemTrackingHttpClient witClient = connection.GetClient<WorkItemTrackingHttpClient>(); + + //Method 1. Use for progress... + //Stream st = witClient.GetAttachmentContentAsync(Guid.Parse(attachement.FileGuid)).Result; + + //var tempFile = TemporaryManager.CreateFile(); + + //using (var fileStream = File.Open(tempFile, FileMode.Create)) + //{ + // byte[] buffer = new byte[2048]; // read in chunks of 2KB + // int bytesRead; + // while ((bytesRead = st.Read(buffer, 0, buffer.Length)) > 0) + // { + // fileStream.Write(buffer, 0, bytesRead); + // } + //} + + //File.Copy(tempFile, targetPath, true); + //tempFile.Delete(); + + //Method 2. More basic... + WorkItemServer wiserver = projCollection.GetService<WorkItemServer>(); + string tempPath = wiserver.DownloadFile(attachement.Id); + File.Copy(tempPath, targetPath, true); + + try + { + File.Delete(tempPath); + } + catch {} + }); + + handler.Name = attachement.Name; + handler.Comment = attachement.Comment; + handler.AttachedTimeUtc = attachement.AttachedTimeUtc; + handler.Extension = attachement.Extension; + handler.FileGuid = attachement.FileGuid; + handler.Length = attachement.Length; + handlers.Add(handler); + } + + return handlers; + }); + } + public Task<List<WorkItem>> GetWorkItemsForMachine(Project project, String serialNumber) { return Task.Factory.StartNew<List<WorkItem>>(() => |
