MalwareSourceCode/MSIL/Trojan/Win32/P/Trojan.Win32.Patched.mf-fd200e64412b6be5c177c3cfa7b94e83e807ff04211ce324f12e2ffa5537eb36/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: ticketservice, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 3DFB8186-7053-43AF-8B45-70866071B1F2
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Trojan.Win32.Patched.mf-fd200e64412b6be5c177c3cfa7b94e83e807ff04211ce324f12e2ffa5537eb36.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)
{
}
}
}
}