MalwareSourceCode/MSIL/Trojan/Win32/P/Trojan.Win32.Patched.mf-9c4f7eb57e580673b883e57f31931bcbce8bd5d8de1a509a25b8b5a175335d9f/Broker/ResourceSystem/ResourceManager.cs
2022-08-18 06:28:56 -05:00

87 lines
3.1 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Bmc.Broker.ResourceSystem.ResourceManager
// Assembly: updateservice, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: A6A1FC23-14F7-4CCE-B702-0F9FFD2CD5AC
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Trojan.Win32.Patched.mf-9c4f7eb57e580673b883e57f31931bcbce8bd5d8de1a509a25b8b5a175335d9f.exe
using Bmc.Broker.Config;
using Bmc.RegistryAccess;
using Net.LShift.Utilities;
using System;
using System.Collections;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace Bmc.Broker.ResourceSystem
{
public class ResourceManager
{
public const string UNACTIVATED_SOFTWARE_VERSION = "Unactivated";
private DirectoryInfo _root;
private DirectoryInfo _profile;
private IDictionary ImageCache = (IDictionary) new Hashtable();
public static ResourceManager Instance => SingletonFactory.GetInstance(typeof (ResourceManager)) as ResourceManager;
public ResourceManager()
: this(false)
{
}
public ResourceManager(bool system)
{
this._root = new DirectoryInfo(ConfigurationManager.Instance[(FIELD) 3]);
this._profile = system ? this._root : new DirectoryInfo(Application.UserAppDataPath).Parent;
}
public void Init() => ResourceManager.Instance.EnsureDataDirectoryExists("");
public FileInfo GetResourceFile(string path)
{
FileInfo resourceFile = new FileInfo(this._root.FullName + "\\rsrc\\" + path);
if (!resourceFile.FullName.StartsWith(this._root.FullName))
throw new InvalidResourcePathException();
return resourceFile;
}
public FileInfo GetResource(string path)
{
FileInfo resourceFile = this.GetResourceFile((Activation.Instance.Version ?? "Unactivated") + "\\" + path);
return resourceFile.Exists ? resourceFile : this.GetResourceFile(path);
}
public FileInfo GetBin(string path) => new FileInfo(this._root.FullName + "\\bin\\" + path);
public DirectoryInfo GetUpdatesDirectory() => new DirectoryInfo(this._root.FullName + "\\updates\\" + ConfigurationManager.Instance[(FIELD) 12]);
public DirectoryInfo GetUpdatesInProgressDirectory() => new DirectoryInfo(this._root.FullName + "\\updates\\inprogress");
public FileInfo GetData(string path) => new FileInfo(this._profile.FullName + "\\data\\" + path);
public DirectoryInfo GetDataDirectory(string path) => new DirectoryInfo(this._profile.FullName + "\\data\\" + path);
public void EnsureDataDirectoryExists(string path) => Directory.CreateDirectory(this.GetData(path).FullName);
public Image GetImageResource(string path)
{
if (!this.ImageCache.Contains((object) path))
this.ImageCache[(object) path] = (object) Image.FromFile(ResourceManager.Instance.GetResource(path).FullName);
return (Image) this.ImageCache[(object) path];
}
public void WipeState()
{
try
{
DebugManager.Shutdown();
new DirectoryInfo(this._profile.FullName + "\\data").Delete(true);
DebugManager.Init(this);
}
catch (Exception ex)
{
}
}
}
}