All the runas of mine

This commit is contained in:
2023-05-10 13:38:05 +03:00
commit 498f069437
978 changed files with 7088 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,68 @@
using Newtonsoft.Json;
using System.Diagnostics;
using System;
using System.Text.RegularExpressions;
namespace Runas
{
class Program
{
public static string DataText = RegexAllEnv(Runas.Properties.Resources.progs);
public static dynamic jprograms = JsonConvert.DeserializeObject(DataText);
public static string RegexAllEnv(string data)
{
System.Collections.Hashtable env = (System.Collections.Hashtable)Environment.GetEnvironmentVariables();
string val;
foreach (System.Collections.DictionaryEntry key in env)
{
val = (string)key.Value;
val = val.Replace(@"\", @"\\");
if (key.Key != "Path" && key.Key != "path")
{
data = val.EndsWith(@"\") ? Regex.Replace(data, $"\\u0025{key.Key}\\u0025\\\\", val, RegexOptions.IgnoreCase) : Regex.Replace(data, $"\\u0025{key.Key}\\u0025", val, RegexOptions.IgnoreCase);
// val.EndsWith(@"\")? data.Replace($"%{key.Key}%\\", val) : data.Replace($"%{key.Key}%",val);
}
}
return data;
}
public static bool DoRun(string program)
{
Process[] process = Process.GetProcessesByName(program);
return (process.Length > 0);
}
public static void RunProcess(string programName)
{
if (!(DoRun(programName)))
{
if (programName.Equals("AutoHotKey"))
{
Process.Start(jprograms[programName][0].Value, $"\u0022{jprograms[programName][1].Value.ToString()}\u0022");
}
else if (jprograms[programName].Count > 1)
{
foreach (var prog in jprograms[programName])
{
if (System.IO.File.Exists(prog.Value))
{
Process.Start(prog.Value);
}
}
}
else if (jprograms[programName].Count == 1)
{
Process.Start(jprograms[programName][0].Value);
}
}
}
static void Main(string[] args)
{
foreach (var prog in jprograms)
{
string ProgProg = ((Newtonsoft.Json.Linq.JProperty)prog).Name;
System.Threading.Thread thread = new(new System.Threading.ThreadStart(() => RunProcess(ProgProg)));
thread.Start();
}
}
}
}

View File

@@ -0,0 +1,85 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Runas.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Runas.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to {
/// &quot;AutoHotKey&quot;: [
/// &quot;C:\\Program Files\\AutoHotkey\\AutoHotkey.exe&quot;,
/// &quot;D:\\Drive\\טוויקים למחשב\\myscript 3.0\\myscript 2.0.ahk&quot;
/// ],
/// &quot;Lightshot&quot;: [
/// &quot;C:\\Program Files (x86)\\Skillbrains\\lightshot\\Lightshot.exe&quot;
/// ],
/// &quot;AsusNbKeys&quot;: [
/// &quot;C:\\Program Files (x86)\\ASUS\\ATK Package\\AsusNbKeys\\AsusNbKeys.exe&quot;,
/// &quot;C:\\Program Files (x86)\\ASUS\\ATK Package\\ATK Hotkey\\AsusNbKeys.exe&quot;
/// ],
/// &quot;HControl&quot;: [
/// &quot;C:\\Program Files (x86)\\ASUS\ [rest of string was truncated]&quot;;.
/// </summary>
internal static string progs {
get {
return ResourceManager.GetString("progs", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,41 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v5.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v5.0": {
"Runas/1.0.0": {
"dependencies": {
"Newtonsoft.Json": "13.0.1"
},
"runtime": {
"Runas.dll": {}
}
},
"Newtonsoft.Json/13.0.1": {
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.1.25517"
}
}
}
}
},
"libraries": {
"Runas/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Newtonsoft.Json/13.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
"path": "newtonsoft.json/13.0.1",
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,8 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\Saret\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\Saret\\.nuget\\packages"
]
}
}

View File

@@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "net5.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "5.0.0"
}
}
}