Skip to content

Commit

Permalink
v0.3
Browse files Browse the repository at this point in the history
- Added new tab to menu
- Added PowerShell
- Added Quit app when hitting back button
- Added Quit app in menu
- Code cleanup
- Rename app to Mobile Terminal
- Other smaller changes
  • Loading branch information
Pinguin2001 committed Aug 17, 2022
1 parent 07463ce commit 13a95cf
Show file tree
Hide file tree
Showing 76 changed files with 801 additions and 478 deletions.
4 changes: 2 additions & 2 deletions src/App.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Application
x:Class="Command_Prompt.App"
x:Class="MobileTerminal.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Command_Prompt">
xmlns:local="using:MobileTerminal">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand Down
17 changes: 14 additions & 3 deletions src/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
using System;
using MobileTerminal.Classes;
using System;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.ApplicationModel.Core;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace Command_Prompt
namespace MobileTerminal
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
Expand All @@ -31,6 +34,8 @@ public App()
/// <param name="e">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

Frame rootFrame = Window.Current.Content as Frame;

// Do not repeat app initialization when the Window already has content,
Expand Down Expand Up @@ -63,7 +68,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
if (roamingProperties.ContainsKey("FirstRunDone"))
{
// The normal case
rootFrame.Navigate(typeof(TabsPage), e.Arguments);
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
else
{
Expand All @@ -77,6 +82,12 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
}
}

private void OnBackRequested(object sender, BackRequestedEventArgs e)
{
e.Handled = true;
Tools.ExitApp();
}

/// <summary>
/// Invoked when Navigation to a certain page fails
/// </summary>
Expand Down
Binary file modified src/Assets/LargeTile.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/LargeTile.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/LargeTile.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/LargeTile.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/LargeTile.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/SmallTile.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/SmallTile.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/SmallTile.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/SmallTile.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/SmallTile.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/SplashScreen.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/SplashScreen.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/SplashScreen.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/SplashScreen.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/SplashScreen.scale-400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/Square150x150Logo.scale-100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/Square150x150Logo.scale-125.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/Square150x150Logo.scale-150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/Square150x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/Assets/Square150x150Logo.scale-400.png
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.
Binary file modified src/Assets/Square44x44Logo.altform-unplated_targetsize-16.png
Binary file modified src/Assets/Square44x44Logo.altform-unplated_targetsize-256.png
Binary file modified src/Assets/Square44x44Logo.altform-unplated_targetsize-32.png
Binary file modified src/Assets/Square44x44Logo.altform-unplated_targetsize-48.png
Binary file modified src/Assets/Square44x44Logo.scale-100.png
Binary file modified src/Assets/Square44x44Logo.scale-125.png
Binary file modified src/Assets/Square44x44Logo.scale-150.png
Binary file modified src/Assets/Square44x44Logo.scale-200.png
Binary file modified src/Assets/Square44x44Logo.scale-400.png
Binary file modified src/Assets/Square44x44Logo.targetsize-16.png
Binary file modified src/Assets/Square44x44Logo.targetsize-24.png
Binary file modified src/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Binary file modified src/Assets/Square44x44Logo.targetsize-256.png
Binary file modified src/Assets/Square44x44Logo.targetsize-32.png
Binary file modified src/Assets/Square44x44Logo.targetsize-48.png
Binary file modified src/Assets/StoreLogo.scale-100.png
Binary file modified src/Assets/StoreLogo.scale-125.png
Binary file modified src/Assets/StoreLogo.scale-150.png
Binary file modified src/Assets/StoreLogo.scale-200.png
Binary file modified src/Assets/StoreLogo.scale-400.png
Binary file modified src/Assets/Wide310x150Logo.scale-100.png
Binary file modified src/Assets/Wide310x150Logo.scale-125.png
Binary file modified src/Assets/Wide310x150Logo.scale-150.png
Binary file modified src/Assets/Wide310x150Logo.scale-200.png
Binary file modified src/Assets/Wide310x150Logo.scale-400.png
6 changes: 1 addition & 5 deletions src/Exceptions.cs → src/Classes/Exceptions.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Popups;

namespace Command_Prompt
namespace MobileTerminal.Classes
{
class Exceptions
{
Expand Down
11 changes: 2 additions & 9 deletions src/Globals.cs → src/Classes/Globals.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Command_Prompt
namespace MobileTerminal.Classes
{
class Globals
{

public static ulong ReportedBuildVersion { get; set; }
public static string FullBuildNumber { get; set; }
}
}
}
4 changes: 2 additions & 2 deletions src/TelnetClient.cs → src/Classes/TelnetClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace Telnet
namespace MobileTerminal.Classes
{
public class TelnetClient : IDisposable
{
Expand Down Expand Up @@ -157,7 +157,7 @@ public async Task Connect(string socks4ProxyHost, int socks4ProxyPort, string so
// Fire-and-forget looping task that waits for messages to arrive
try
{
WaitForMessage();
await WaitForMessage();
}
catch (Exception e)
{
Expand Down
71 changes: 71 additions & 0 deletions src/Classes/Tools.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using System;
using System.IO;
using Windows.ApplicationModel.Core;
using Windows.UI.Core;
using Windows.UI.Xaml.Controls;

namespace MobileTerminal.Classes
{
class Tools
{
//Go Back Handler
public static EventHandler GoBackHandler;

public static bool IsFileAccessable(string file)
{
try
{
using (var stream = File.OpenRead(file))
return false;
}
catch (IOException)
{
return true;
}
}

public static bool CheckForMaliciousCommand(string command)
{
if (command.Contains("\\.\\globalroot\\device\\condrv\\kernelconnect") || command.Contains("%0|%0"))
{
return true;
}
else
{
return false;
}
}

public static async void ShowDialog(string title, string content)
{
ContentDialog dialog = new ContentDialog
{
Title = title,
Content = content,
PrimaryButtonText = "Okay",
DefaultButton = ContentDialogButton.Primary
};

await dialog.ShowAsync();
}

public static async void ExitApp()
{
ContentDialog dialog = new ContentDialog
{
Title = "Question",
Content = "Do you really want to exit Terminal?",
PrimaryButtonText = "Yes",
SecondaryButtonText = "No",
DefaultButton = ContentDialogButton.Primary
};

var result = await dialog.ShowAsync();

if (result == ContentDialogResult.Primary)
{
CoreApplication.Exit();
}
}
}
}
45 changes: 30 additions & 15 deletions src/Command Prompt.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<ProjectGuid>{581F8149-D518-4CD8-8BEB-929820259AC7}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Command_Prompt</RootNamespace>
<AssemblyName>Command Prompt</AssemblyName>
<RootNamespace>MobileTerminal</RootNamespace>
<AssemblyName>MobileTerminalUWP</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.22621.0</TargetPlatformVersion>
Expand Down Expand Up @@ -108,6 +108,7 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
Expand All @@ -128,14 +129,12 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Exceptions.cs" />
<Compile Include="Classes\Tools.cs" />
<Compile Include="Classes\Exceptions.cs" />
<Compile Include="FirstRunPage.xaml.cs">
<DependentUpon>FirstRunPage.xaml</DependentUpon>
</Compile>
<Compile Include="Globals.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Classes\Globals.cs" />
<Compile Include="Pages\About.xaml.cs">
<DependentUpon>About.xaml</DependentUpon>
</Compile>
Expand All @@ -146,10 +145,16 @@
<DependentUpon>Settings.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TabsPage.xaml.cs">
<DependentUpon>TabsPage.xaml</DependentUpon>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Classes\TelnetClient.cs" />
<Compile Include="Terminals\cmd.xaml.cs">
<DependentUpon>cmd.xaml</DependentUpon>
</Compile>
<Compile Include="Terminals\pwsh.xaml.cs">
<DependentUpon>pwsh.xaml</DependentUpon>
</Compile>
<Compile Include="TelnetClient.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
Expand All @@ -161,6 +166,7 @@
<Content Include="Assets\LargeTile.scale-125.png" />
<Content Include="Assets\LargeTile.scale-150.png" />
<Content Include="Assets\LargeTile.scale-200.png" />
<Content Include="Assets\LargeTile.scale-400.png" />
<Content Include="Assets\SmallTile.scale-100.png" />
<Content Include="Assets\SmallTile.scale-125.png" />
<Content Include="Assets\SmallTile.scale-150.png" />
Expand All @@ -174,6 +180,11 @@
<Content Include="Assets\Square150x150Logo.scale-125.png" />
<Content Include="Assets\Square150x150Logo.scale-150.png" />
<Content Include="Assets\Square150x150Logo.scale-400.png" />
<Content Include="Assets\Square44x44Logo.altform-lightunplated_targetsize-16.png" />
<Content Include="Assets\Square44x44Logo.altform-lightunplated_targetsize-24.png" />
<Content Include="Assets\Square44x44Logo.altform-lightunplated_targetsize-256.png" />
<Content Include="Assets\Square44x44Logo.altform-lightunplated_targetsize-32.png" />
<Content Include="Assets\Square44x44Logo.altform-lightunplated_targetsize-48.png" />
<Content Include="Assets\Square44x44Logo.altform-unplated_targetsize-16.png" />
<Content Include="Assets\Square44x44Logo.altform-unplated_targetsize-256.png" />
<Content Include="Assets\Square44x44Logo.altform-unplated_targetsize-32.png" />
Expand Down Expand Up @@ -213,10 +224,6 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Pages\About.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand All @@ -229,10 +236,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="TabsPage.xaml">
<Page Include="MainPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Terminals\cmd.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Terminals\pwsh.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
Expand Down
16 changes: 8 additions & 8 deletions src/Command Prompt.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
<AppxShowAllApps>False</AppxShowAllApps>
<AppxBuildConfigurationSelection>arm</AppxBuildConfigurationSelection>
<PackageOptionalProjectsInIdeBuilds>False</PackageOptionalProjectsInIdeBuilds>
<Source>C:\Users\Empyreal96\Pictures\icons\terminal.png</Source>
<SmallTileSource>C:\Users\Empyreal96\Pictures\icons\terminal.png</SmallTileSource>
<MediumTileSource>C:\Users\Empyreal96\Pictures\icons\terminal.png</MediumTileSource>
<WideTileSource>C:\Users\Empyreal96\Pictures\icons\terminal.png</WideTileSource>
<LargeTileSource>C:\Users\Empyreal96\Pictures\icons\terminal.png</LargeTileSource>
<AppIconSource>C:\Users\Empyreal96\Pictures\icons\terminal.png</AppIconSource>
<SplashScreenSource>C:\Users\Empyreal96\Pictures\icons\terminal.png</SplashScreenSource>
<PackageLogoSource>C:\Users\Empyreal96\Pictures\icons\terminal.png</PackageLogoSource>
<Source>Z:\Repos\Backup\2022.08.14\src\Assets\Square44x44Logo.altform-unplated_targetsize-256.png</Source>
<SmallTileSource>Z:\Repos\Backup\2022.08.14\src\Assets\Square44x44Logo.altform-unplated_targetsize-256.png</SmallTileSource>
<MediumTileSource>Z:\Repos\Backup\2022.08.14\src\Assets\Square44x44Logo.altform-unplated_targetsize-256.png</MediumTileSource>
<WideTileSource>Z:\Repos\Backup\2022.08.14\src\Assets\Square44x44Logo.altform-unplated_targetsize-256.png</WideTileSource>
<LargeTileSource>Z:\Repos\Backup\2022.08.14\src\Assets\Square44x44Logo.altform-unplated_targetsize-256.png</LargeTileSource>
<AppIconSource>Z:\Repos\Backup\2022.08.14\src\Assets\Square44x44Logo.altform-unplated_targetsize-256.png</AppIconSource>
<SplashScreenSource>Z:\Repos\Backup\2022.08.14\src\Assets\Square44x44Logo.altform-unplated_targetsize-256.png</SplashScreenSource>
<PackageLogoSource>Z:\Repos\Backup\2022.08.14\src\Assets\Square44x44Logo.altform-unplated_targetsize-256.png</PackageLogoSource>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<DeviceId>30f105c9-681e-420b-a277-7c086ead8a4e</DeviceId>
Expand Down
4 changes: 2 additions & 2 deletions src/FirstRunPage.xaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Page
x:Class="Command_Prompt.FirstRunPage"
x:Class="MobileTerminal.FirstRunPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Command_Prompt"
xmlns:local="using:MobileTerminal"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
RequestedTheme="Default"
mc:Ignorable="d">
Expand Down
10 changes: 5 additions & 5 deletions src/FirstRunPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using MobileTerminal.Classes;
using System;
using System.Threading;
using Telnet;
using Windows.ApplicationModel.DataTransfer;
using Windows.Foundation.Collections;
using Windows.Storage;
Expand All @@ -12,7 +12,7 @@

// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238

namespace Command_Prompt
namespace MobileTerminal
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
Expand Down Expand Up @@ -75,7 +75,7 @@ private async void Connect()
{

await client.Connect();
// await Task.Delay(1000);
// await Task.Delay(1000);
await client.Send($"set");
IsCMDPresent = true;

Expand Down Expand Up @@ -114,7 +114,7 @@ private void FinishBtn_Click(object sender, RoutedEventArgs e)
{
//await ApplicationData.Current.LocalFolder.CreateFileAsync("FirstRunComplete.txt", CreationCollisionOption.ReplaceExisting);
roamingProperties["FirstRunDone"] = bool.TrueString;
this.Frame.Navigate(typeof(TabsPage));
this.Frame.Navigate(typeof(MainPage));
}

private void LoopCmd_Tapped(object sender, TappedRoutedEventArgs e)
Expand Down
Loading

0 comments on commit 13a95cf

Please sign in to comment.