Extract organization GUID from any position in file name.

This commit is contained in:
Jared Goodwin 2020-03-06 17:48:28 -08:00
parent fb25461d2e
commit e8ee742b0a
2 changed files with 5 additions and 4 deletions

View File

@ -67,7 +67,7 @@
Cursor="Hand"
ToolTip="Enter the organization ID that will have access to this device."></Run>
</TextBlock>
<TextBox Grid.Column="1" Grid.Row="2" TextWrapping="Wrap" Text="{Binding OrganizationName}" FontSize="14" />
<TextBox Grid.Column="1" Grid.Row="2" TextWrapping="Wrap" Text="{Binding OrganizationID}" FontSize="14" />
</Grid>

View File

@ -1,4 +1,4 @@
using Remotely.Agent.Installer.Win.Services;
using Remotely.Agent.Installer.Win.Services;
using Remotely.Shared.Models;
using System;
using System.Collections.Generic;
@ -193,9 +193,10 @@ namespace Remotely.Agent.Installer.Win.ViewModels
CopyCommandLineArgs();
var fileName = Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location);
if (fileName.Length > 36)
for (var i = 0; i < fileName.Length; i++)
{
var guid = fileName.Substring(fileName.Length - 36);
var guid = string.Join("", fileName.Skip(i).Take(36));
if (Guid.TryParse(guid, out _))
{
OrganizationID = guid;