/// <summary> /// Generates spoof keys and adds them to the player prefs. /// </summary> /// <param name="iterations"> The amount of times to iterate through the length of the dictionary and add the spoof keys. </param> private void GenerateSpoofKeys(int iterations = 10) { for (int i = 0; i < iterations * prefDictionary.Keys.Count; i++) { AsyncTaskScheduler.Schedule(GenerateSpoofKey); } }
public static async Task InitializeAsync(string projectId, string secretKey, string userName = "", bool newUser = true) { LoggerFactory = new LoggerFactory(); ConfigurationProvider = new ConfigurationProvider(); HmacService = new HmacService(); CancellationTokenSource = new CancellationTokenSource(); ProjectId = projectId; SecretKet = secretKey; var handler = new HttpClientHandler(); handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return(true); }; mainClient = new HttpClient(handler); UnitOfWork = new UnitOfWork(LoggerFactory.Logger); var c = await ConfigurationProvider.LoadConfigurationAsync(); if (!c) { throw new Exception("Configuration not found!!!"); } ProbaHttpClient = new ProbaHttpClient(LoggerFactory.Logger, mainClient, SecretKet, ProjectId, HmacService, CancellationTokenSource, ConfigurationProvider.Configuration); AsyncTaskScheduler = new AsyncTaskScheduler(CancellationTokenSource, ProbaHttpClient); AsyncTaskScheduler.StartAsync(); UserName = userName != "" ? userName : Guid.NewGuid().ToString(); NewUser = newUser; await RegisterAsync(); }
//[ReflectionProtect(typeof(DisposableData<string>))] public DisposableDataPromise <TType> CreateDisposableData() { DisposableDataPromise <TType> promise = new DisposableDataPromise <TType>(); byte[] data = memoryEncryptor.Decrypt(protectedData); AsyncTaskScheduler.Schedule(() => Task.Run(() => { SetValue((byte[])data.Clone()); GC.Collect(); disposableData = disposableData?.Disposed != false ? (TDisposable)Activator.CreateInstance(typeof(TDisposable), data) : disposableData; MainThreadExecutor.QueueAction(() => promise.Build(() => disposableData)); })); return(promise); }
/// <summary> /// Starts the AsyncSetPref by getting the base encrypted key and starting the InternalSetString. /// </summary> /// <param name="key"> The key of the PlayerPref to set. </param> /// <param name="value"> The value of the PlayerPref to set. </param> /// <param name="onValueSet"> Action to call once the value has been set. </param> private static void StartAsyncSetPref(string key, string value, Action onValueSet) { string baseKeyEncrypted = GetSeedValue(); AsyncTaskScheduler.Schedule(() => InternalSetString(baseKeyEncrypted, key, value, onValueSet)); }