Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.9.0.2 #60

Merged
merged 32 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3bcf536
version change
0x78654C Sep 16, 2024
c284a53
wip: process fix run with different user
0x78654C Sep 16, 2024
cfc3cfa
fix run new terminal with normal user
0x78654C Sep 16, 2024
b1e8a18
run with different user
0x78654C Sep 16, 2024
fc94845
fix run nt -u properly
0x78654C Sep 16, 2024
40a9600
removed use shell execute
0x78654C Sep 16, 2024
8418fd0
name rule
0x78654C Sep 17, 2024
d5f9329
set to x64 release
0x78654C Sep 17, 2024
5fc09d0
mor progress on open file from different user
0x78654C Sep 17, 2024
51fffb0
Merge branch 'v1.9.0.2' of https://github.com/0x78654C/xTerminal into…
0x78654C Sep 17, 2024
1b68cdb
update readmed with -r param for ./ (start process) command
0x78654C Sep 19, 2024
9d8959f
added verb runas
0x78654C Sep 19, 2024
4a17cab
added param -r for runas verb
0x78654C Sep 19, 2024
efac0b0
removed -r param
0x78654C Sep 19, 2024
8f39d09
now runas works properly
0x78654C Sep 19, 2024
711398a
now runas works properly
0x78654C Sep 19, 2024
8b08651
removed -r param parser
0x78654C Sep 19, 2024
e24d1ec
added filter for executable files .exe and .msi, now you don't need t…
0x78654C Sep 19, 2024
cd6556e
set to shell execute
0x78654C Sep 19, 2024
cfdd4c6
fix runas
0x78654C Sep 21, 2024
5b5396b
removed unused separator
0x78654C Sep 21, 2024
5f9af3e
fix path for -u param
0x78654C Sep 21, 2024
92ddc13
added new method for odir command
0x78654C Sep 22, 2024
067bb11
fix run on normal
0x78654C Sep 22, 2024
c02103b
fix parse argument for -u aswell
0x78654C Sep 22, 2024
fadf3f0
created command enc for set console input/output encoding
0x78654C Sep 22, 2024
df498e1
cleanup
0x78654C Sep 22, 2024
3f913db
fix input to UTF 8
0x78654C Sep 22, 2024
8880069
cleanup message help
0x78654C Sep 22, 2024
8aebf47
updated documetation and help command with enc command
0x78654C Sep 22, 2024
3c73ac7
version change
0x78654C Sep 22, 2024
abe08b3
removed console.readline()
0x78654C Sep 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Commands/TerminalCommands/ConsoleSystem/BiosInfo.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using Core;
using System;
using System.Runtime.Versioning;
using ping = Core.NetWork;
using wmi = Core.Hardware.WMIDetails;
using Ping = Core.NetWork;
using Wmi = Core.Hardware.WMIDetails;

namespace Commands.TerminalCommands.ConsoleSystem
{
Expand Down Expand Up @@ -38,20 +38,20 @@ private static void BiosInformation(string commandType)
case "-r":
Console.Write("Type remote PC name or IP: ");
pc = Console.ReadLine();
if (!ping.PingHost(pc))
if (!Ping.PingHost(pc))
{
Console.WriteLine($"{pc} is offline!");
return;
}
if (GlobalVariables.isPipeCommand)
{
if (GlobalVariables.pipeCmdCount > 0)
GlobalVariables.pipeCmdOutput = wmi.GetWMIDetails("SELECT * FROM Win32_BIOS", @"\\" + pc + @"\root\cimv2");
GlobalVariables.pipeCmdOutput = Wmi.GetWMIDetails("SELECT * FROM Win32_BIOS", @"\\" + pc + @"\root\cimv2");
else
Console.WriteLine(wmi.GetWMIDetails("SELECT * FROM Win32_BIOS", @"\\" + pc + @"\root\cimv2"));
Console.WriteLine(Wmi.GetWMIDetails("SELECT * FROM Win32_BIOS", @"\\" + pc + @"\root\cimv2"));
}
else
Console.WriteLine(wmi.GetWMIDetails("SELECT * FROM Win32_BIOS", @"\\" + pc + @"\root\cimv2"));
Console.WriteLine(Wmi.GetWMIDetails("SELECT * FROM Win32_BIOS", @"\\" + pc + @"\root\cimv2"));
break;
case "-h":
Console.WriteLine(HelpCommand());
Expand All @@ -60,12 +60,12 @@ private static void BiosInformation(string commandType)
if (GlobalVariables.isPipeCommand)
{
if(GlobalVariables.pipeCmdCount > 0)
GlobalVariables.pipeCmdOutput = wmi.GetWMIDetails("SELECT * FROM Win32_BIOS", @"\\.\root\cimv2");
GlobalVariables.pipeCmdOutput = Wmi.GetWMIDetails("SELECT * FROM Win32_BIOS", @"\\.\root\cimv2");
else
Console.WriteLine(wmi.GetWMIDetails("SELECT * FROM Win32_BIOS", @"\\.\root\cimv2"));
Console.WriteLine(Wmi.GetWMIDetails("SELECT * FROM Win32_BIOS", @"\\.\root\cimv2"));
}
else
Console.WriteLine(wmi.GetWMIDetails("SELECT * FROM Win32_BIOS", @"\\.\root\cimv2"));
Console.WriteLine(Wmi.GetWMIDetails("SELECT * FROM Win32_BIOS", @"\\.\root\cimv2"));
break;
}
}
Expand Down
81 changes: 81 additions & 0 deletions Commands/TerminalCommands/ConsoleSystem/ConsoleEncoding.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using Core;
using System;
using System.Runtime.Versioning;
using System.Text;

namespace Commands.TerminalCommands.ConsoleSystem
{
[SupportedOSPlatform("windows")]
public class ConsoleEncoding : ITerminalCommand
{
public string Name => "enc";
private static string s_helpMessage = $@" Usage of enc command:
enc defalut : Set input/output encoding to default .NET encoding.
enc utf8 : Set input/output encoding to UTF8.
enc unicode : Set input/output encoding to Unicode.
enc ascii : Set input/output encoding to ASCII.
enc -current : Show the current input/output encoding.

Default input/output encoding for xTerminal is UTF-8.
";
public void Execute(string arg)
{
if (arg == Name)
{
FileSystem.SuccessWriteLine("Use -h for more information!");
return;
}

arg = arg.Substring(3).Trim().ToLower();

// Display help message.
if (arg.Trim() == "-h")
{
Console.WriteLine(s_helpMessage);
return;
}

if(arg == "-current")
{
var encodingIn = Console.InputEncoding.EncodingName;
var encodingOut = Console.OutputEncoding.EncodingName;
var dataDisplay = $"Input encoding: {encodingIn}\nOutput encoding: {encodingOut}";
FileSystem.SuccessWriteLine(dataDisplay);
return;
}

if (arg == "utf8")
{
Console.InputEncoding = Encoding.UTF8;
Console.OutputEncoding = Encoding.UTF8;
FileSystem.SuccessWriteLine($"Console encoding set to: {Console.InputEncoding.EncodingName}");
return;
}

if (arg == "unicode")
{
Console.InputEncoding = Encoding.Unicode;
Console.OutputEncoding = Encoding.Unicode;
FileSystem.SuccessWriteLine($"Console encoding set to: {Console.InputEncoding.EncodingName}");
return;
}

if (arg == "default")
{
Console.InputEncoding = Encoding.Default;
Console.OutputEncoding = Encoding.Default;
FileSystem.SuccessWriteLine($"Console encoding set to: {Console.InputEncoding.EncodingName}");
return;
}

if (arg == "ascii")
{
Console.InputEncoding = Encoding.ASCII;
Console.OutputEncoding = Encoding.ASCII;
FileSystem.SuccessWriteLine($"Console encoding set to: {Console.InputEncoding.EncodingName}");
return;
}
FileSystem.ErrorWriteLine("The encode type is not part of the lis. Use -h for more information!");
}
}
}
1 change: 1 addition & 0 deletions Commands/TerminalCommands/ConsoleSystem/Help.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void Execute(string arg)
time -- Display current time.
sc -- Manage local or remote computer services. Use -h for additional help.
fw -- Manage local firewall rules. Use -h for additional help.
enc -- Set input/output encoding for xTerminal. Use -h for additional help.

---------------------- File System ---------------------
cat -- Displays the content of a file. Use -h for additional parameters.
Expand Down
10 changes: 2 additions & 8 deletions Commands/TerminalCommands/ConsoleSystem/NewTWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,17 @@ class NewTWindow : ITerminalCommand
";
public void Execute(string args)
{

if (args ==Name && !args.Contains("-u"))
{
FileSystem.SuccessWriteLine($"Use -h param for {Name} command usage!");
return;
}
if (args == $"{Name} -h")
{
Console.WriteLine(s_helpMessage);
return;
}
if (args.ContainsText("-u"))
{
Core.SystemTools.ProcessStart.ProcessExecute(Application.StartupPath + "\\xTerminal.exe", true);
Core.SystemTools.ProcessStart.ProcessExecute(Application.StartupPath + "xTerminal.exe", true);
return;
}
Core.SystemTools.ProcessStart.ProcessExecute(Application.StartupPath + "\\xTerminal.exe", false);
Core.SystemTools.ProcessStart.ProcessExecute(Application.StartupPath + "xTerminal.exe", false);
}
}
}
11 changes: 11 additions & 0 deletions Commands/TerminalCommands/ConsoleSystem/StartProccess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Linq;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;

namespace Commands.TerminalCommands.ConsoleSystem
Expand Down Expand Up @@ -67,6 +68,8 @@ public void Execute(string args)
StartApplication(args, paramApp, true, !waitForExit);
return;
}

args = FileSystem.SanitizePath(args, s_currentDirectory);
StartApplication(args, paramApp, false, !waitForExit);
return;
}
Expand All @@ -78,6 +81,7 @@ public void Execute(string args)
StartApplication(args, paramApp, true, !waitForExit);
return;
}

StartApplication(args, paramApp, false, !waitForExit);
}
catch (Exception e)
Expand All @@ -98,11 +102,18 @@ private void StartApplication(string inputCommand, string arg, bool admin, bool
{
int _ch = Regex.Matches(inputCommand, " ").Count;

if (File.Exists(inputCommand + ".exe"))
inputCommand = inputCommand + ".exe";

if (File.Exists(inputCommand + ".msi"))
inputCommand = inputCommand + ".msi";

if (!File.Exists(inputCommand))
{
FileSystem.ErrorWriteLine($"File {inputCommand} does not exist!");
return;
}

if (admin)
{
Core.SystemTools.ProcessStart.ProcessExecute(inputCommand, arg, true, true, waitForExit);
Expand Down
5 changes: 3 additions & 2 deletions Core/FileSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.VisualBasic;
using Core.SystemTools;
using Microsoft.VisualBasic;
using System;
using System.Buffers.Binary;
using System.Collections.Generic;
Expand Down Expand Up @@ -233,7 +234,7 @@ public static void OpenCurrentDiretory(string dirPath, string currentDirectory)
dirPath = SanitizePath(dirPath, currentDirectory);
if (Directory.Exists(dirPath))
{
SystemTools.ProcessStart.ProcessExecute("explorer", dirPath, false, false, false);
ProcessStart.OpenDirProc(dirPath);
return;
}
Console.WriteLine($"Directory '{dirPath}' does not exist!");
Expand Down
4 changes: 2 additions & 2 deletions Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.7.2.0")]
[assembly: AssemblyFileVersion("1.7.2.0")]
[assembly: AssemblyVersion("1.7.3.0")]
[assembly: AssemblyFileVersion("1.7.3.0")]
Loading