-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
66 changed files
with
1,988 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Application | ||
x:Class="Logging_Enabler.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:Logging_Enabler"> | ||
|
||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Windows.ApplicationModel; | ||
using Windows.ApplicationModel.Activation; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.Storage; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Windows.UI.Xaml.Data; | ||
using Windows.UI.Xaml.Input; | ||
using Windows.UI.Xaml.Media; | ||
using Windows.UI.Xaml.Navigation; | ||
|
||
namespace Logging_Enabler | ||
{ | ||
/// <summary> | ||
/// Provides application-specific behavior to supplement the default Application class. | ||
/// </summary> | ||
sealed partial class App : Application | ||
{ | ||
/// <summary> | ||
/// Initializes the singleton application object. This is the first line of authored code | ||
/// executed, and as such is the logical equivalent of main() or WinMain(). | ||
/// </summary> | ||
public App() | ||
{ | ||
this.InitializeComponent(); | ||
this.Suspending += OnSuspending; | ||
} | ||
|
||
/// <summary> | ||
/// Invoked when the application is launched normally by the end user. Other entry points | ||
/// will be used such as when the application is launched to open a specific file. | ||
/// </summary> | ||
/// <param name="e">Details about the launch request and process.</param> | ||
protected override void OnLaunched(LaunchActivatedEventArgs e) | ||
{ | ||
Frame rootFrame = Window.Current.Content as Frame; | ||
|
||
// Do not repeat app initialization when the Window already has content, | ||
// just ensure that the window is active | ||
if (rootFrame == null) | ||
{ | ||
// Create a Frame to act as the navigation context and navigate to the first page | ||
rootFrame = new Frame(); | ||
|
||
rootFrame.NavigationFailed += OnNavigationFailed; | ||
|
||
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) | ||
{ | ||
//TODO: Load state from previously suspended application | ||
} | ||
|
||
// Place the frame in the current Window | ||
Window.Current.Content = rootFrame; | ||
} | ||
|
||
if (e.PrelaunchActivated == false) | ||
{ | ||
if (rootFrame.Content == null) | ||
{ | ||
// When the navigation stack isn't restored navigate to the first page, | ||
// configuring the new page by passing required information as a navigation | ||
// parameter | ||
// rootFrame.Navigate(typeof(MainPage), e.Arguments); | ||
IPropertySet roamingProperties = ApplicationData.Current.RoamingSettings.Values; | ||
Package package = Package.Current; | ||
string systemArchitecture = package.Id.Architecture.ToString(); | ||
if (systemArchitecture != "Arm") | ||
{ | ||
Exceptions.CustomMessage("Detected " + systemArchitecture + " CPU, This is in test mode during development, release target is for ARM CPUs"); | ||
rootFrame.Navigate(typeof(MainPage), e.Arguments); | ||
} | ||
else | ||
{ | ||
if (roamingProperties.ContainsKey("FirstRunDone")) | ||
{ | ||
// The normal case | ||
rootFrame.Navigate(typeof(MainPage), e.Arguments); | ||
} | ||
else | ||
{ | ||
// The first-time case | ||
rootFrame.Navigate(typeof(FirstRunPage), e.Arguments); | ||
// roamingProperties["FirstRunDone"] = bool.TrueString; // Doesn't really matter what | ||
} | ||
} | ||
} | ||
// Ensure the current window is active | ||
Window.Current.Activate(); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Invoked when Navigation to a certain page fails | ||
/// </summary> | ||
/// <param name="sender">The Frame which failed navigation</param> | ||
/// <param name="e">Details about the navigation failure</param> | ||
void OnNavigationFailed(object sender, NavigationFailedEventArgs e) | ||
{ | ||
throw new Exception("Failed to load Page " + e.SourcePageType.FullName); | ||
} | ||
|
||
/// <summary> | ||
/// Invoked when application execution is being suspended. Application state is saved | ||
/// without knowing whether the application will be terminated or resumed with the contents | ||
/// of memory still intact. | ||
/// </summary> | ||
/// <param name="sender">The source of the suspend request.</param> | ||
/// <param name="e">Details about the suspend request.</param> | ||
private void OnSuspending(object sender, SuspendingEventArgs e) | ||
{ | ||
var deferral = e.SuspendingOperation.GetDeferral(); | ||
//TODO: Save application state and stop any background activity | ||
deferral.Complete(); | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Windows.UI.Popups; | ||
|
||
namespace Logging_Enabler | ||
{ | ||
class Exceptions | ||
{ | ||
public static async void ThrowFullError(Exception ex) | ||
{ | ||
var ThrownException = new MessageDialog($"{ex.Message}\n\n{ex.Source}\n\n{ex.ToString()}\n\n{ex.StackTrace}"); | ||
ThrownException.Commands.Add(new UICommand("Close")); | ||
await ThrownException.ShowAsync(); | ||
} | ||
|
||
public static async void CustomMessage(String ex) | ||
{ | ||
var ThrownException = new MessageDialog(ex); | ||
ThrownException.Commands.Add(new UICommand("Close")); | ||
await ThrownException.ShowAsync(); | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<Page | ||
x:Class="Logging_Enabler.FirstRunPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:Logging_Enabler" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
|
||
<Grid> | ||
<RelativePanel> | ||
<Border x:Name="HeaderBorder" | ||
RelativePanel.AlignRightWithPanel="True" | ||
RelativePanel.AlignLeftWithPanel="True" RequestedTheme="Default" Height="45" Margin="-2,0,-2,0"> | ||
<TextBox x:Name="MainHeader" | ||
Text="Windows Logging Tools: Initial Setup" | ||
|
||
IsHitTestVisible="False" | ||
IsReadOnly="True" | ||
TextAlignment="Left" | ||
|
||
RelativePanel.RightOf="MainIcon" | ||
RelativePanel.AlignRightWithPanel="True" | ||
RelativePanel.AlignLeftWithPanel="True" BorderBrush="{x:Null}" Background="{x:Null}" RequestedTheme="Default" Height="50" FontSize="18" FontFamily="Segoe UI Light" Padding="0,0,0,0" VerticalAlignment="Stretch" VerticalContentAlignment="Center" Margin="40,8,0,0"/> | ||
</Border> | ||
<FontIcon x:Name="MainIcon" FontFamily="Segoe MDL2 Assets" Glyph="" Foreground="{ThemeResource SystemAccentColor}" Height="40" Width="40" Margin="0,3,0,0"/> | ||
<ProgressBar x:Name="progbar" RelativePanel.Below="HeaderBorder" Height="8" IsIndeterminate="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" Foreground="{ThemeResource SystemAccentColor}"/> | ||
<TextBox x:Name="InfoText" Text="Welcome" RelativePanel.Below="progbar" IsHitTestVisible="False" IsReadOnly="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" RequestedTheme="Default" Margin="-1,1,-1,0" FontSize="12" Height="26" MinHeight="20" Background="#66000000"/> | ||
<TextBlock x:Name="InfoBlock" Text="Please wait while checking compatibility" RelativePanel.Below="InfoText" TextWrapping="Wrap" RequestedTheme="Default" Margin="10,5,10,0" /> | ||
<TextBlock x:Name="CMDpresent" Text="CMD Check" RelativePanel.Below="InfoBlock" RelativePanel.AlignHorizontalCenterWithPanel="True" IsColorFontEnabled="true" Foreground="#FFBBB5BB" Margin="0,10,0,0"/> | ||
<TextBox x:Name="LoopText" Text="Requirements" RelativePanel.Below="CMDpresent" IsHitTestVisible="False" IsReadOnly="True" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" RequestedTheme="Default" Margin="-1,10,-1,0" FontSize="12" Height="26" MinHeight="20" Background="#66000000"/> | ||
|
||
<TextBlock x:Name="LoopbackInfo" Text="Interop Unlock and CMD Access is REQUIRED for this app to function as expected, CMD is required because loopback access is needed to run certain commands to enable logging on the device. Tap the link below to copy the command and paste into a command prompt to enable loopback access." RelativePanel.Below="LoopText" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" RequestedTheme="Default" TextWrapping="Wrap" Margin="10,10,10,0"/> | ||
<TextBlock x:Name="LoopCmd" TextWrapping="Wrap" Text="checknetisolation loopbackexempt -a -n=WindowsLoggingTools_6dg21qtxnde1e" Tapped="LoopCmd_Tapped" RelativePanel.Below="LoopbackInfo" RelativePanel.AlignLeftWithPanel="True" HorizontalAlignment="Center" RelativePanel.AlignRightWithPanel="True" IsColorFontEnabled="True" Foreground="#FF2D89EF" Margin="0,15,0,0" FontSize="14"/> | ||
|
||
<Button x:Name="FinishBtn" Click="FinishBtn_Click" Content="Finish Setup" RelativePanel.AlignBottomWithPanel="True" RelativePanel.AlignLeftWithPanel="True" IsEnabled="False" RelativePanel.AlignRightWithPanel="True" RequestedTheme="Default" HorizontalAlignment="Stretch" Background="{x:Null}" Foreground="{ThemeResource SystemAccentColor}" Margin="0,0,0,10"/> | ||
</RelativePanel> | ||
</Grid> | ||
</Page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Telnet; | ||
using Windows.ApplicationModel.DataTransfer; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.Storage; | ||
using Windows.Storage.Pickers; | ||
using Windows.UI; | ||
using Windows.UI.Core; | ||
using Windows.UI.Popups; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Windows.UI.Xaml.Data; | ||
using Windows.UI.Xaml.Input; | ||
using Windows.UI.Xaml.Media; | ||
using Windows.UI.Xaml.Navigation; | ||
|
||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238 | ||
|
||
namespace Logging_Enabler | ||
{ | ||
/// <summary> | ||
/// An empty page that can be used on its own or navigated to within a Frame. | ||
/// </summary> | ||
public sealed partial class FirstRunPage : Page | ||
{ | ||
bool IsCMDPresent; | ||
|
||
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; | ||
static CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); | ||
TelnetClient client = new TelnetClient(TimeSpan.FromSeconds(3), cancellationTokenSource.Token); | ||
|
||
|
||
public FirstRunPage() | ||
{ | ||
try | ||
{ | ||
this.InitializeComponent(); | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
progbar.IsEnabled = true; | ||
|
||
CMDpresent.Text = "Checking capabilities, please wait..."; | ||
|
||
|
||
Connect(); | ||
progbar.IsEnabled = false; | ||
} | ||
catch (Exception ex) | ||
{ | ||
progbar.IsEnabled = false; | ||
|
||
Exceptions.ThrowFullError(ex); | ||
} | ||
|
||
} | ||
|
||
private async void Connect() | ||
{ | ||
try | ||
{ | ||
|
||
await client.Connect(); | ||
// await Task.Delay(1000); | ||
await client.Send($"set"); | ||
IsCMDPresent = true; | ||
|
||
} | ||
catch (Exception ex) | ||
{ | ||
Exceptions.ThrowFullError(ex); | ||
IsCMDPresent = false; | ||
} | ||
|
||
if (IsCMDPresent == true) | ||
{ | ||
CMDpresent.Foreground = new SolidColorBrush(Windows.UI.Colors.Green); | ||
CMDpresent.Text = "CMD Access Found!"; | ||
FinishBtn.IsEnabled = true; | ||
progbar.IsEnabled = false; | ||
progbar.IsIndeterminate = false; | ||
|
||
} | ||
else | ||
{ | ||
CMDpresent.Foreground = new SolidColorBrush(Windows.UI.Colors.Red); | ||
CMDpresent.Text = "CMD Access Not Found!"; | ||
|
||
progbar.IsEnabled = false; | ||
progbar.IsIndeterminate = false; | ||
|
||
|
||
} | ||
progbar.IsEnabled = false; | ||
} | ||
string LocalPath = ApplicationData.Current.LocalFolder.Path; | ||
|
||
private IAsyncOperation<IUICommand> dialogTask; | ||
IPropertySet roamingProperties = ApplicationData.Current.RoamingSettings.Values; | ||
private async void FinishBtn_Click(object sender, RoutedEventArgs e) | ||
{ | ||
try | ||
{ | ||
//await ApplicationData.Current.LocalFolder.CreateFileAsync("FirstRunComplete.txt", CreationCollisionOption.ReplaceExisting); | ||
roamingProperties["FirstRunDone"] = bool.TrueString; | ||
client.Disconnect(); | ||
var ThrownException = new MessageDialog("App will close in 10 seconds for configuration to load properly, please reopen this app to continue."); | ||
ThrownException.Commands.Add(new UICommand("Close")); | ||
try | ||
{ | ||
dialogTask = ThrownException.ShowAsync(); | ||
|
||
} | ||
catch (TaskCanceledException) | ||
{ | ||
|
||
|
||
} | ||
DispatcherTimer dt = new DispatcherTimer(); | ||
dt.Interval = TimeSpan.FromSeconds(10); | ||
dt.Tick += dt_Tick; | ||
dt.Start(); | ||
|
||
//this.Frame.Navigate(typeof(MainPage)); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Exceptions.ThrowFullError(ex); | ||
} | ||
} | ||
|
||
void dt_Tick(object sender, object e) | ||
{ | ||
(sender as DispatcherTimer).Stop(); | ||
dialogTask.Cancel(); | ||
Application.Current.Exit(); | ||
} | ||
|
||
private void LoopCmd_Tapped(object sender, TappedRoutedEventArgs e) | ||
{ | ||
DataPackage dataPackage = new DataPackage(); | ||
string command = "checknetisolation loopbackexempt -a -n=WindowsLoggingTools_6dg21qtxnde1e"; | ||
dataPackage.RequestedOperation = DataPackageOperation.Copy; | ||
dataPackage.SetText(command); | ||
Clipboard.SetContent(dataPackage); | ||
Exceptions.CustomMessage("'checknetisolation loopbackexempt -a -n=WindowsLoggingTools_6dg21qtxnde1e' copied to clipboard"); | ||
} | ||
} | ||
} |
Oops, something went wrong.