PEASS-ng/winPEAS/winPEASexe/winPEAS/TaskScheduler/CultureSwitcher.cs
makikvues 9dd1fdbc95 - scheduled tasks rewrite - cleanup, excluding also Microsoft from Path; skipping failed scheduled tasks
- added total execution time for debugging purposes
- bugfixes
- GetEverLoggedUsers() - skipping users which could not be translated
2021-01-18 22:12:01 +01:00

28 lines
697 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace winPEAS.TaskScheduler
{
internal class CultureSwitcher : IDisposable
{
private readonly System.Globalization.CultureInfo cur, curUI;
public CultureSwitcher([NotNull] System.Globalization.CultureInfo culture)
{
cur = Thread.CurrentThread.CurrentCulture;
curUI = Thread.CurrentThread.CurrentUICulture;
Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = culture;
}
public void Dispose()
{
Thread.CurrentThread.CurrentCulture = cur;
Thread.CurrentThread.CurrentUICulture = curUI;
}
}
}