Esempio n. 1
0
        /// <summary>
        /// 创建实例
        /// </summary>
        /// <param name="assemblyPath"></param>
        /// <param name="fullClassName"></param>
        private void CreateInstance(string assemblyPath, string fullClassName)
        {
            CurrentAppDomain = AppDomain.CreateDomain(Guid.NewGuid().ToString());

            CurrentProxyObject = (ProxyObject)CurrentAppDomain.CreateInstanceFromAndUnwrap(typeof(ProxyObject).Assembly.Location, typeof(ProxyObject).FullName);

            CurrentProxyObject.CreateInstance(assemblyPath, fullClassName);
        }
Esempio n. 2
0
        /// <summary>
        /// 卸载程序集
        /// </summary>
        public void UnLoad()
        {
            if (CurrentAppDomain != null)
            {
                AppDomain.Unload(CurrentAppDomain);
            }

            CurrentAppDomain = null;

            CurrentProxyObject = null;
        }
Esempio n. 3
0
        public static void InitializeComponents(ref GameObject prefab)
        {
            if (ComponentUtils.GetModComponent(prefab) != null)
            {
                return;
            }

            string      name = NameUtils.RemoveGearPrefix(prefab.name);
            string      data = JsonHandler.GetJsonText(name);
            ProxyObject dict = JSON.Load(data) as ProxyObject;

            InitializeComponents(ref prefab, dict);
        }
Esempio n. 4
0
        public static void RemoveEntry(
            DBDictionary dict, ObjectId id, Transaction tr)
        {
            ProxyObject obj =
                (ProxyObject)tr.GetObject(id, OpenMode.ForRead);

            // If you want to check what exact proxy it is

            /*if (obj.OriginalClassName != "ProxyToRemove")
             *  return;*/

            dict.Remove(id);
        }
Esempio n. 5
0
 private void BtnPaste_Click(object sender, RoutedEventArgs e)
 {
     string[] strArray = Regex.Split(Clipboard.GetText(), "\r\n|\r|\n");
     for (int i = 0; i < strArray.Length; i++)
     {
         ProxyObject item = Helpers.CheckProxyValidity(strArray[i]);
         if (item != null)
         {
             item.Enabled = true;
             this._proxyList.Proxies.Add(item);
         }
     }
 }
Esempio n. 6
0
 private static void InitializeBedComponent(ModBedComponent modBed, ProxyObject dict, string className = "ModBedComponent")
 {
     InitializeBaseComponent(modBed, dict, className);
     modBed.ConditionGainPerHour           = dict[className]["ConditionGainPerHour"];
     modBed.AdditionalConditionGainPerHour = dict[className]["AdditionalConditionGainPerHour"];
     modBed.WarmthBonusCelsius             = dict[className]["WarmthBonusCelsius"];
     modBed.DegradePerHour     = dict[className]["DegradePerHour"];
     modBed.BearAttackModifier = dict[className]["BearAttackModifier"];
     modBed.WolfAttackModifier = dict[className]["WolfAttackModifier"];
     modBed.OpenAudio          = dict[className]["OpenAudio"];
     modBed.CloseAudio         = dict[className]["CloseAudio"];
     modBed.PackedMesh         = ModUtils.GetChild(modBed.gameObject, dict[className]["PackedMesh"]);
     modBed.UsableMesh         = ModUtils.GetChild(modBed.gameObject, dict[className]["UsableMesh"]);
 }
Esempio n. 7
0
        public object Invoke(ProxyObject obj, MethodInfo method, object[] args)
        {
            Func <object, object[], object> invoke;

            lock (_methods)
            {
                if (!_methods.TryGetValue(method, out invoke))
                {
                    BuildMethod(method, out invoke);
                }
            }

            return(invoke(_bindings[obj.Id], args));
        }
Esempio n. 8
0
        private static void ProcessFile(string filePath, string fileText)
        {
            if (string.IsNullOrEmpty(fileText))
            {
                return;
            }
            ProxyObject dict = JSON.Load(fileText) as ProxyObject;

            if (!JsonUtils.ContainsKey(dict, "GearName"))
            {
                PageManager.SetItemPackNotWorking(filePath, "The JSON file doesn't contain the key: 'GearName'");
                return;
            }

            string           gearName = dict["GearName"];
            ModExistingEntry modExistingEntry;

            if (modExistingEntries.ContainsKey(gearName))
            {
                modExistingEntry = modExistingEntries[gearName];
            }
            else
            {
                modExistingEntry = new ModExistingEntry();
                modExistingEntries.Add(gearName, modExistingEntry);
            }
            foreach (var pair in dict)
            {
                if (pair.Key == "GearName")
                {
                    continue;
                }
                else if (pair.Key == "WeightKG")
                {
                    modExistingEntry.SetWeightChange(pair.Value);
                }
                else
                {
                    ProxyObject data = (ProxyObject)pair.Value;
                    if (modExistingEntry.behaviourChanges.ContainsKey(pair.Key))
                    {
                        modExistingEntry.behaviourChanges[pair.Key] = data;
                    }
                    else
                    {
                        modExistingEntry.behaviourChanges.Add(pair.Key, data);
                    }
                }
            }
        }
Esempio n. 9
0
        private static void InitializeFoodComponent(ModFoodComponent modFood, ProxyObject dict, string className = "ModFoodComponent")
        {
            InitializeCookableComponent(modFood, dict, className);
            modFood.DaysToDecayOutdoors = dict[className]["DaysToDecayOutdoors"];
            modFood.DaysToDecayIndoors  = dict[className]["DaysToDecayIndoors"];

            modFood.Calories   = dict[className]["Calories"];
            modFood.EatingTime = dict[className]["EatingTime"];

            modFood.EatingAudio         = dict[className]["EatingAudio"];
            modFood.EatingPackagedAudio = dict[className]["EatingPackagedAudio"];

            modFood.ThirstEffect = dict[className]["ThirstEffect"];

            modFood.FoodPoisoning             = dict[className]["FoodPoisoning"];
            modFood.FoodPoisoningLowCondition = dict[className]["FoodPoisoningLowCondition"];
            modFood.ParasiteRiskIncrements    = JsonUtils.MakeFloatArray(dict[className]["ParasiteRiskIncrements"] as ProxyArray);

            modFood.Natural = dict[className]["Natural"];
            modFood.Raw     = dict[className]["Raw"];
            modFood.Drink   = dict[className]["Drink"];
            modFood.Meat    = dict[className]["Meat"];
            modFood.Fish    = dict[className]["Fish"];

            modFood.Canned  = dict[className]["Canned"];
            modFood.Opening = dict[className]["Opening"];
            modFood.OpeningWithCanOpener = dict[className]["OpeningWithCanOpener"];
            modFood.OpeningWithKnife     = dict[className]["OpeningWithKnife"];
            modFood.OpeningWithHatchet   = dict[className]["OpeningWithHatchet"];
            modFood.OpeningWithSmashing  = dict[className]["OpeningWithSmashing"];

            modFood.AffectCondition      = dict[className]["AffectCondition"];
            modFood.ConditionRestBonus   = dict[className]["ConditionRestBonus"];
            modFood.ConditionRestMinutes = dict[className]["ConditionRestMinutes"];

            modFood.AffectRest        = dict[className]["AffectRest"];
            modFood.InstantRestChange = dict[className]["InstantRestChange"];
            modFood.RestFactor        = dict[className]["RestFactor"];
            modFood.RestFactorMinutes = dict[className]["RestFactorMinutes"];

            modFood.AffectCold        = dict[className]["AffectCold"];
            modFood.InstantColdChange = dict[className]["InstantColdChange"];
            modFood.ColdFactor        = dict[className]["ColdFactor"];
            modFood.ColdFactorMinutes = dict[className]["ColdFactorMinutes"];

            modFood.ContainsAlcohol      = dict[className]["ContainsAlcohol"];
            modFood.AlcoholPercentage    = dict[className]["AlcoholPercentage"];
            modFood.AlcoholUptakeMinutes = dict[className]["AlcoholUptakeMinutes"];
        }
Esempio n. 10
0
 private static void InitializeRifleComponent(ModRifleComponent modRifle, ProxyObject dict, string className = "ModRifleComponent")
 {
     InitializeEquippableComponent(modRifle, dict, className);
     modRifle.ClipSize         = dict[className]["ClipSize"];
     modRifle.DamagePerShot    = dict[className]["DamagePerShot"];
     modRifle.Range            = dict[className]["Range"];
     modRifle.FiringDelay      = dict[className]["FiringDelay"];
     modRifle.ReloadDelay      = dict[className]["ReloadDelay"];
     modRifle.AimDelay         = dict[className]["AimDelay"];
     modRifle.MuzzleFlashDelay = dict[className]["MuzzleFlashDelay"];
     modRifle.MuzzleSmokeDelay = dict[className]["MuzzleSmokeDelay"];
     modRifle.MinSway          = dict[className]["MinSway"];
     modRifle.MaxSway          = dict[className]["MaxSway"];
     modRifle.SwayIncrement    = dict[className]["SwayIncrement"];
 }
Esempio n. 11
0
        private static bool LoadJSONLocalization(string contents)
        {
            if (string.IsNullOrWhiteSpace(contents))
            {
                return(false);
            }
            ProxyObject dict = JSON.Load(contents) as ProxyObject;

            foreach (var pair in dict)
            {
                string locID = pair.Key;
                Dictionary <string, string> locDict = pair.Value.Make <Dictionary <string, string> >();
                LoadLocalization(locID, locDict, USE_ENGLISH_AS_DEFAULT);
            }
            return(true);
        }
Esempio n. 12
0
        /// <summary>
        /// Attempts to log in to an Instagram account.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnAccountLogin_Click(object sender, EventArgs e)
        {
            btnAccountLogin.Enabled = false;

            // Proxy initialization
            _proxy = new ProxyObject(txtProxy.Text, ':');

            if (!string.IsNullOrEmpty(txtProxy.Text))
            {
                _httpClientHandler.Proxy = _proxy.GetWebProxy();
            }

            _instaApi = InstaApiBuilder.CreateBuilder()
                        .UseHttpClientHandler(_httpClientHandler)
                        .SetUser(new UserSessionData
            {
                UserName = txtAccountUsername.Text,
                Password = txtAccountPassword.Text
            })
                        .Build();

            lblAccountLoginStatus.Text = @"Status: Attempting to log in.";
            var login = await _instaApi.LoginAsync();

            if (login.Succeeded)
            {
                _isLogged                       = true;
                gbDownload.Enabled              = true;
                lblAccountLoginStatus.Text      = @"Status: Logged in.";
                lblAccountLoginStatus.ForeColor = Color.Green;
                Log($@"Successfully logged in as {txtAccountUsername.Text}.", nameof(LogType.Success));
            }
            else
            {
                lblAccountLoginStatus.Text      = @"Status: Failed to log in.";
                lblAccountLoginStatus.ForeColor = Color.Red;
                Log($@"Failed to log in as {txtAccountUsername.Text}. Message: {login.Info.Message}", nameof(LogType.Fail));

                btnAccountLogin.Enabled = true;
                return;
            }

            btnAccountLogin.Enabled  = false;
            btnAccountLogout.Enabled = true;
        }
Esempio n. 13
0
        public static void RemoveEntry2(
            DBDictionary dict, ObjectId id, Transaction tr)
        {
            ProxyObject obj =
                (ProxyObject)tr.GetObject(id, OpenMode.ForRead);

            // If you want to check what exact proxy it is

            /*if (obj.OriginalClassName != "ProxyToRemove")
             *  return;*/

            obj.UpgradeOpen();

            using (DBObject newObj = new Xrecord())
            {
                obj.HandOverTo(newObj, false, false);
                newObj.Erase();
            }
        }
Esempio n. 14
0
    /// <summary>
    /// 把栈顶的表转为一个ProxyObject或ProxyArray
    /// 转为ProxyArray时,其下标可能和Lua表不一致
    /// </summary>
    public static Variant ToJsonObj(this ILuaState self)
    {
        Variant ret = null;
        var     top = self.GetTop();

        self.PushNil();
        if (self.Next(top))
        {
            var key = self.ToAnyObject(-2) as string;
            if (key != null)
            {
                var obj = new ProxyObject();
                ret = obj;
                var value = ToJsonValue(self);
                obj[key] = value;
                self.Pop(1);
                while (self.Next(top))
                {
                    key      = self.ToString(-2);
                    value    = ToJsonValue(self);
                    obj[key] = value;
                    self.Pop(1);
                }
            }
            else
            {
                var array = new ProxyArray();
                ret = array;
                array.Add(ToJsonValue(self));
                self.Pop(1);
                while (self.Next(top))
                {
                    array.Add(ToJsonValue(self));
                    self.Pop(1);
                }
            }
        }
        else
        {
            return(new ProxyArray());
        }
        return(ret);
    }
Esempio n. 15
0
        private static HttpClient CreateClient(ProxyObject proxyObject = null)
        {
            var httpClientHandler = new HttpClientHandler();


            var proxyObjext = ProxyManager.GetProxy();

            if (proxyObject != null)
            {
                var proxy = new WebProxy();
                //proxy.Address = new Uri($"http://12.229.217.226:55443");
                proxy.Address           = new Uri($"http://{proxyObjext.data[0].ip}:{proxyObjext.data[0].port}");
                httpClientHandler.Proxy = proxy;
            }

            return(new HttpClient(handler: httpClientHandler, disposeHandler: true)
            {
                Timeout = TimeSpan.FromMinutes(Timeout)
            });
        }
Esempio n. 16
0
        public static void LoadJSONLocalization(Object asset)
        {
            TextAsset textAsset = asset.Cast <TextAsset>();

            if (textAsset == null)
            {
                Implementation.LogWarning("Asset called '{0}' is not a TextAsset as expected.", asset.name);
                return;
            }
            //Implementation.Log("Processing asset '{0}' as json localization.", asset.name);
            string      contents = GetText(textAsset);
            ProxyObject dict     = JSON.Load(contents) as ProxyObject;

            foreach (var pair in dict)
            {
                string locID = pair.Key;
                Dictionary <string, string> locDict = pair.Value.Make <Dictionary <string, string> >();
                LoadLocalization(locID, locDict, USE_ENGLISH_AS_DEFAULT);
            }
        }
        private bool PerformFrameProxy(ProxyObject sourceobject, BCBlockGameState gamestate)
        {
            var pPaddle = gamestate.PlayerPaddle;
            if (pPaddle == null) return true;
            //"bleed"
            RectangleF paddlerect = pPaddle.Getrect();
            for (int i = 0; i < (int) (20f*BCBlockGameState.ParticleGenerationFactor); i++)
            {
                //add a random blood particle...
                PointF randomspot =
                    new PointF((float) (paddlerect.Width*BCBlockGameState.rgen.NextDouble() + paddlerect.Left),
                               (float) (paddlerect.Bottom));

                WaterParticle Bloodparticle = new WaterParticle(randomspot, Color.Red);
                Bloodparticle.Velocity = new PointF((float) BCBlockGameState.rgen.NextDouble()*2 - 1,
                                                    (float) BCBlockGameState.rgen.NextDouble() - 0.5f);

                gamestate.Particles.Add(Bloodparticle);
            }

            return false;
        }
Esempio n. 18
0
 //************//
 // COMPONENTS //
 //************//
 #region Components
 private static void InitializeBaseComponent(ModComponent modComponent, ProxyObject dict, string inheritanceName)
 {
     modComponent.ConsoleName = NameUtils.RemoveGearPrefix(modComponent.gameObject.name);
     JsonUtils.TrySetString(ref modComponent.DisplayNameLocalizationId, dict, inheritanceName, "DisplayNameLocalizationId");
     modComponent.DescriptionLocalizatonId      = dict[inheritanceName]["DescriptionLocalizatonId"];
     modComponent.InventoryActionLocalizationId = dict[inheritanceName]["InventoryActionLocalizationId"];
     modComponent.WeightKG          = dict[inheritanceName]["WeightKG"];
     modComponent.DaysToDecay       = dict[inheritanceName]["DaysToDecay"];
     modComponent.MaxHP             = dict[inheritanceName]["MaxHP"];
     modComponent.InitialCondition  = EnumUtils.ParseEnum <InitialCondition>(dict[inheritanceName]["InitialCondition"]);
     modComponent.InventoryCategory = EnumUtils.ParseEnum <InventoryCategory>(dict[inheritanceName]["InventoryCategory"]);
     modComponent.PickUpAudio       = dict[inheritanceName]["PickUpAudio"];
     modComponent.PutBackAudio      = dict[inheritanceName]["PutBackAudio"];
     modComponent.StowAudio         = dict[inheritanceName]["StowAudio"];
     modComponent.WornOutAudio      = dict[inheritanceName]["WornOutAudio"];
     modComponent.InspectOnPickup   = dict[inheritanceName]["InspectOnPickup"];
     modComponent.InspectDistance   = dict[inheritanceName]["InspectDistance"];
     modComponent.InspectAngles     = JsonUtils.MakeVector(dict[inheritanceName]["InspectAngles"]);
     modComponent.InspectOffset     = JsonUtils.MakeVector(dict[inheritanceName]["InspectOffset"]);
     modComponent.InspectScale      = JsonUtils.MakeVector(dict[inheritanceName]["InspectScale"]);
     modComponent.NormalModel       = ModUtils.GetChild(modComponent.gameObject, dict[inheritanceName]["NormalModel"]);
     modComponent.InspectModel      = ModUtils.GetChild(modComponent.gameObject, dict[inheritanceName]["InspectModel"]);
 }
Esempio n. 19
0
        private static void InitializeToolComponent(ModToolComponent modTool, ProxyObject dict, string className = "ModToolComponent")
        {
            InitializeEquippableComponent(modTool, dict, className);
            modTool.ToolType     = EnumUtils.ParseEnum <ToolType>(dict[className]["ToolType"]);
            modTool.DegradeOnUse = dict[className]["DegradeOnUse"];
            modTool.Usage        = EnumUtils.ParseEnum <Usage>(dict[className]["Usage"]);
            modTool.SkillBonus   = dict[className]["SkillBonus"];

            modTool.CraftingTimeMultiplier = dict[className]["CraftingTimeMultiplier"];
            modTool.DegradePerHourCrafting = dict[className]["DegradePerHourCrafting"];

            modTool.BreakDown = dict[className]["BreakDown"];
            modTool.BreakDownTimeMultiplier = dict[className]["BreakDownTimeMultiplier"];

            modTool.ForceLocks     = dict[className]["ForceLocks"];
            modTool.ForceLockAudio = dict[className]["ForceLockAudio"];

            modTool.IceFishingHole             = dict[className]["IceFishingHole"];
            modTool.IceFishingHoleDegradeOnUse = dict[className]["IceFishingHoleDegradeOnUse"];
            modTool.IceFishingHoleMinutes      = dict[className]["IceFishingHoleMinutes"];
            modTool.IceFishingHoleAudio        = dict[className]["IceFishingHoleAudio"];

            modTool.CarcassHarvesting        = dict[className]["CarcassHarvesting"];
            modTool.MinutesPerKgMeat         = dict[className]["MinutesPerKgMeat"];
            modTool.MinutesPerKgFrozenMeat   = dict[className]["MinutesPerKgFrozenMeat"];
            modTool.MinutesPerHide           = dict[className]["MinutesPerHide"];
            modTool.MinutesPerGut            = dict[className]["MinutesPerGut"];
            modTool.DegradePerHourHarvesting = dict[className]["DegradePerHourHarvesting"];

            modTool.StruggleBonus        = dict[className]["StruggleBonus"];
            modTool.DamageMultiplier     = dict[className]["DamageMultiplier"];
            modTool.FleeChanceMultiplier = dict[className]["FleeChanceMultiplier"];
            modTool.TapMultiplier        = dict[className]["TapMultiplier"];
            modTool.CanPuncture          = dict[className]["CanPuncture"];
            modTool.BleedoutMultiplier   = dict[className]["BleedoutMultiplier"];
        }
Esempio n. 20
0
 private static void InitializeHarvestableComponent(ModHarvestableComponent modHarvestable, ProxyObject dict, string className = "ModHarvestableComponent")
 {
     modHarvestable.Audio             = dict[className]["Audio"];
     modHarvestable.Minutes           = dict[className]["Minutes"];
     modHarvestable.YieldCounts       = JsonUtils.MakeIntArray(dict[className]["YieldCounts"] as ProxyArray);
     modHarvestable.YieldNames        = JsonUtils.MakeStringArray(dict[className]["YieldNames"] as ProxyArray);
     modHarvestable.RequiredToolNames = JsonUtils.MakeStringArray(dict[className]["RequiredToolNames"] as ProxyArray);
 }
Esempio n. 21
0
 public void Connect(string strName, out ProxyObject item)
 {
     ExAddProperty(this.m_pSelf, strName, 4, 0x1adb0);
     item = null;
 }
Esempio n. 22
0
 private void contextBtnOpenBrowser_Click(object sender, RoutedEventArgs e)
 {
     if (this.gvTasks.SelectedItems.Count == 1)
     {
         TaskObject task = (TaskObject)this.gvTasks.SelectedItems[0];
         Task.Factory.StartNew(delegate {
             try
             {
                 ChromeDriverService service     = ChromeDriverService.CreateDefaultService();
                 service.HideCommandPromptWindow = true;
                 ChromeOptions options           = new ChromeOptions();
                 if ((!task.PaypalProxyIgnore && !string.IsNullOrEmpty(task.ProxyListId)) && Global.SETTINGS.PROXIES.Any <ProxyListObject>(x => (x.Id == task.ProxyListId)))
                 {
                     ProxyObject proxy = Helpers.GetProxy(Global.SETTINGS.PROXIES.First <ProxyListObject>(x => x.Id == task.ProxyListId));
                     if (proxy != null)
                     {
                         options.AddArgument("ignore-certificate-errors");
                         string str3 = Guid.NewGuid().ToString();
                         string str2 = Helpers.Decrypt(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ext\manifest.json"));
                         string str  = Helpers.Decrypt(File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + @"\ext\background.js")).Replace("{0}", proxy.IP).Replace("{1}", proxy.Port.ToString()).Replace("{2}", proxy.Username).Replace("{3}", proxy.Password);
                         Dictionary <string, string> dictionary = new Dictionary <string, string> {
                             {
                                 "manifest.json",
                                 str2
                             },
                             {
                                 "background.js",
                                 str
                             }
                         };
                         using (MemoryStream stream = new MemoryStream())
                         {
                             string path = AppDomain.CurrentDomain.BaseDirectory + @"\ext\" + str3 + ".zip";
                             using (ZipArchive archive = new ZipArchive(stream, ZipArchiveMode.Create, true))
                             {
                                 foreach (KeyValuePair <string, string> pair in dictionary)
                                 {
                                     using (Stream stream2 = archive.CreateEntry(pair.Key).Open())
                                     {
                                         using (StreamWriter writer = new StreamWriter(stream2))
                                         {
                                             writer.Write(pair.Value);
                                         }
                                     }
                                 }
                             }
                             using (FileStream stream3 = new FileStream(path, FileMode.Create))
                             {
                                 stream.Seek(0L, SeekOrigin.Begin);
                                 stream.CopyTo(stream3);
                             }
                         }
                         options.AddExtension(AppDomain.CurrentDomain.BaseDirectory + @"\ext\" + str3 + ".zip");
                     }
                 }
                 options.AddArgument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36");
                 task.Driver = new ChromeDriver(service, options);
                 Global.ChromeDrivers.Add(task.Driver);
                 if (task.Platform != TaskObject.PlatformEnum.supreme)
                 {
                     if (task.Platform == TaskObject.PlatformEnum.footlockerau)
                     {
                         task.Driver.Navigate().GoToUrl("https://www.footlocker.com.au");
                     }
                     else if (task.Platform == TaskObject.PlatformEnum.footlockereu)
                     {
                         task.Driver.Navigate().GoToUrl("https://www.footlocker.eu");
                     }
                     else
                     {
                         task.PaypalRefresh = new DateTime?(DateTime.Now);
                         task.Driver.Navigate().GoToUrl("https://www.paypal.com");
                     }
                 }
                 else
                 {
                     task.Driver.Navigate().GoToUrl("https://www.gmail.com");
                 }
                 if (!string.IsNullOrEmpty(task.GmailEmail) && !string.IsNullOrEmpty(task.GmailPassword))
                 {
                     IWebElement element1 = task.Driver.FindElement(By.Id("identifierId"));
                     element1.Clear();
                     element1.SendKeys(task.GmailEmail);
                     task.Driver.FindElement(By.XPath("//span[.='Next']")).Click();
                     new WebDriverWait(task.Driver, TimeSpan.FromSeconds(5.0)).Until <IWebElement>(ExpectedConditions.ElementExists(By.Name("password")));
                     IWebElement element2 = task.Driver.FindElement(By.Name("password"));
                     element2.Clear();
                     element2.SendKeys(task.GmailPassword);
                     Thread.Sleep(500);
                     task.Driver.FindElement(By.XPath("//span[.='Next']")).Click();
                 }
             }
             catch (Exception)
             {
             }
         });
     }
 }
Esempio n. 23
0
 private void CreateProxyObject(TouchInfo touchInfo)
 {
     ProxyObject po = new ProxyObject(touchInfo);
     _rootPanel.Children.Add(po);
     _proxyObjects.Add(po);
 }
Esempio n. 24
0
 private void BtnStartTest_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(this.txtUrl.Text.Trim()) && !string.IsNullOrEmpty(this.txtTimeout.Text.Trim()))
     {
         this.txtUrl.Background     = (Brush)Application.Current.MainWindow.FindResource("ButtonBackground");
         this.txtTimeout.Background = (Brush)Application.Current.MainWindow.FindResource("ButtonBackground");
         if (!Global.IsProxyTestRunning)
         {
             List <ProxyObject> proxies = new List <ProxyObject>();
             foreach (object obj3 in (IEnumerable)this.gvProxies.Items)
             {
                 if (obj3 is ProxyObject)
                 {
                     ProxyObject item = (ProxyObject)obj3;
                     item.Status = "";
                     item.State  = ProxyObject.StateEnum.untested;
                     proxies.Add(item);
                 }
             }
             if (proxies.Count >= 1)
             {
                 this.progBarTester.Visibility = Visibility.Visible;
                 this.progBarTester.IsEnabled  = true;
                 Global.IsProxyTestRunning     = true;
                 TaskScheduler scheduler = TaskScheduler.FromCurrentSynchronizationContext();
                 this._cancelTokenSource = new CancellationTokenSource();
                 this._cancelToken       = this._cancelTokenSource.Token;
                 _testers = new List <ProxyTester>();
                 _pingers = new List <ProxyPinger>();
                 string url     = this.txtUrl.Text.Trim();
                 int    timeout = int.Parse(this.txtTimeout.Text.Trim());
                 if (this.rTestWebsite.IsChecked.HasValue && this.rTestWebsite.IsChecked.Value)
                 {
                     Task.Factory.StartNew(() => Parallel.ForEach <Tuple <int, int> >(Partitioner.Create(0, proxies.Count, 5), delegate(Tuple <int, int> range, ParallelLoopState state) {
                         if (this._cancelToken.IsCancellationRequested)
                         {
                             state.Break();
                         }
                         for (int i = range.Item1; i < range.Item2; i++)
                         {
                             ProxyTester item = new ProxyTester(this, proxies[i], url, timeout);
                             _testers.Add(item);
                             item.Start();
                         }
                     }), this._cancelToken).ContinueWith(delegate(Task t) {
                         Global.IsProxyTestRunning     = false;
                         this.progBarTester.Visibility = Visibility.Collapsed;
                         this.progBarTester.IsEnabled  = false;
                     }, scheduler);
                 }
                 else
                 {
                     Task.Factory.StartNew(() => Parallel.ForEach <Tuple <int, int> >(Partitioner.Create(0, proxies.Count, 5), delegate(Tuple <int, int> range, ParallelLoopState state) {
                         if (this._cancelToken.IsCancellationRequested)
                         {
                             state.Break();
                         }
                         for (int i = range.Item1; i < range.Item2; i++)
                         {
                             ProxyPinger item = new ProxyPinger(this, proxies[i], timeout);
                             _pingers.Add(item);
                             item.Start();
                         }
                     }), this._cancelToken).ContinueWith(delegate(Task t) {
                         Global.IsProxyTestRunning     = false;
                         this.progBarTester.Visibility = Visibility.Collapsed;
                         this.progBarTester.IsEnabled  = false;
                     }, scheduler);
                 }
             }
         }
     }
     else
     {
         if (!string.IsNullOrEmpty(this.txtUrl.Text))
         {
             this.txtUrl.Background = (Brush)Application.Current.MainWindow.FindResource("ButtonBackground");
         }
         else
         {
             this.txtUrl.Background = (Brush)Application.Current.MainWindow.FindResource("MissingFieldBackground");
         }
         if (string.IsNullOrEmpty(this.txtTimeout.Text))
         {
             this.txtTimeout.Background = (Brush)Application.Current.MainWindow.FindResource("MissingFieldBackground");
         }
         else
         {
             this.txtTimeout.Background = (Brush)Application.Current.MainWindow.FindResource("ButtonBackground");
         }
     }
 }
Esempio n. 25
0
 private static void InitializeSharpenableComponent(ModSharpenableComponent modSharpenable, ProxyObject dict, string className = "ModSharpenableComponent")
 {
     modSharpenable.Audio        = dict[className]["Audio"];
     modSharpenable.MinutesMin   = dict[className]["MinutesMin"];
     modSharpenable.MinutesMax   = dict[className]["MinutesMax"];
     modSharpenable.ConditionMin = dict[className]["ConditionMin"];
     modSharpenable.ConditionMax = dict[className]["ConditionMax"];
     modSharpenable.Tools        = JsonUtils.MakeStringArray(dict[className]["Tools"] as ProxyArray);
 }
Esempio n. 26
0
        public override bool PerformFrame(BCBlockGameState gamestate)
        {
            if (InstantSpawn)
            {
                try
                {
                    InstantiateObject(gamestate);
                }
                catch
                {

                }
                ProxyObject po = new ProxyObject(ProxyObjectFunc, null);
                gamestate.GameObjects.AddLast(po);
                return true;
            }
            return false;
        }
 private bool forcerefresher(ProxyObject po, BCBlockGameState gs)
 {
     gs.Forcerefresh = true;
     return true; //destroy.
 }
Esempio n. 28
0
        public bool proxyfunction(ProxyObject sourceobject, BCBlockGameState gstate)
        {
            List<Block> removethese = new List<Block>();
            List<Block> addthese = new List<Block>();

            foreach (var loopit in from q in gstate.Blocks where q.GetType() == SearchBlockType select q)
            {
                removethese.Add(loopit);
                addthese.Add((Block)Activator.CreateInstance(ReplaceWithBlockType, new Object[] { loopit.BlockRectangle }));

            }

            foreach (var removeit in removethese)
            {
                gstate.Blocks.Remove(removeit);

            }
            foreach (var addit in addthese)
            {
                gstate.Blocks.AddLast(addit);

            }
            gstate.Forcerefresh = true;
            return true;
        }
Esempio n. 29
0
 public object Invoke(ProxyObject obj, MethodInfo method, object[] args)
 => method.Invoke(_bindings[obj.Id], args);
Esempio n. 30
0
 //***************//
 // MODIFICATIONS //
 //***************//
 #region Modifications
 private static void InitializeChangeLayer(ChangeLayer changeLayer, ProxyObject dict, string className = "ChangeLayer")
 {
     JsonUtils.TrySetBool(ref changeLayer.Recursively, dict, className, "Recursively");
     JsonUtils.TrySetInt(ref changeLayer.Layer, dict, className, "Layer");
 }
Esempio n. 31
0
 private static void InitializeTinderComponent(ModTinderComponent modTinder, ProxyObject dict, string className = "ModTinderComponent")
 {
     JsonUtils.TrySetFloat(ref modTinder.SuccessModifier, dict, className, "SuccessModifier");
     JsonUtils.TrySetFloat(ref modTinder.DurationOffset, dict, className, "DurationOffset");
 }
Esempio n. 32
0
 private static void InitializeRepairableComponent(ModRepairableComponent modRepairable, ProxyObject dict, string className = "ModRepairableComponent")
 {
     modRepairable.Audio          = dict[className]["Audio"];
     modRepairable.Minutes        = dict[className]["Minutes"];
     modRepairable.Condition      = dict[className]["Condition"];
     modRepairable.RequiredTools  = JsonUtils.MakeStringArray(dict[className]["RequiredTools"] as ProxyArray);
     modRepairable.MaterialNames  = JsonUtils.MakeStringArray(dict[className]["MaterialNames"] as ProxyArray);
     modRepairable.MaterialCounts = JsonUtils.MakeIntArray(dict[className]["MaterialCounts"] as ProxyArray);
 }
Esempio n. 33
0
 private static void InitializeFireStarterComponent(ModFireStarterComponent modFireStarter, ProxyObject dict, string className = "ModFireStarterComponent")
 {
     modFireStarter.DestroyedOnUse        = dict[className]["DestroyedOnUse"];
     modFireStarter.NumberOfUses          = dict[className]["NumberOfUses"];
     modFireStarter.OnUseSoundEvent       = dict[className]["OnUseSoundEvent"];
     modFireStarter.RequiresSunLight      = dict[className]["RequiresSunLight"];
     modFireStarter.RuinedAfterUse        = dict[className]["RuinedAfterUse"];
     modFireStarter.SecondsToIgniteTinder = dict[className]["SecondsToIgniteTinder"];
     modFireStarter.SecondsToIgniteTorch  = dict[className]["SecondsToIgniteTorch"];
     modFireStarter.SuccessModifier       = dict[className]["SuccessModifier"];
 }
Esempio n. 34
0
 private static void InitializeMillableComponent(ModMillableComponent modMillable, ProxyObject dict, string className = "ModMillableComponent")
 {
     modMillable.RepairDurationMinutes    = dict[className]["RepairDurationMinutes"];
     modMillable.RepairRequiredGear       = JsonUtils.MakeStringArray(dict[className]["RepairRequiredGear"] as ProxyArray);
     modMillable.RepairRequiredGearUnits  = JsonUtils.MakeIntArray(dict[className]["RepairRequiredGearUnits"] as ProxyArray);
     modMillable.CanRestoreFromWornOut    = dict[className]["CanRestoreFromWornOut"];
     modMillable.RecoveryDurationMinutes  = dict[className]["RecoveryDurationMinutes"];
     modMillable.RestoreRequiredGear      = JsonUtils.MakeStringArray(dict[className]["RestoreRequiredGear"] as ProxyArray);
     modMillable.RestoreRequiredGearUnits = JsonUtils.MakeIntArray(dict[className]["RestoreRequiredGearUnits"] as ProxyArray);
     modMillable.skill = EnumUtils.ParseEnum <ModComponentAPI.SkillType>(dict[className]["Skill"]);
 }
Esempio n. 35
0
        ProxyObject DecodeObject()
        {
            var proxy = new ProxyObject();

            // Ditch opening brace.
            json.Read();

            // {
            while (true)
            {
                switch (NextToken)
                {
                    case Token.None:
                        return null;

                    case Token.Comma:
                        continue;

                    case Token.CloseBrace:
                        return proxy;

                    default:
                        // Key
                        string key = DecodeString();
                        if (key == null)
                        {
                            return null;
                        }

                        // :
                        if (NextToken != Token.Colon)
                        {
                            return null;
                        }
                        json.Read();

                        // Value
                        proxy.Add( key, DecodeValue() );
                        break;
                }
            }
        }
Esempio n. 36
0
 private bool ProxyObjectFunc(ProxyObject p, BCBlockGameState g)
 {
     return g.Blocks.Remove(this);
     return true;
 }
Esempio n. 37
0
 private void CreateProxyObject(TouchInfo touchInfo)
 {
     ProxyObject po = new ProxyObject(touchInfo.Position.X, touchInfo.Position.Y, touchInfo.GroupId);
     _rootPanel.Children.Add(po);
     _proxyObjects.Add(po);
 }
Esempio n. 38
0
 private static void InitializeScentComponent(ModScentComponent modScent, ProxyObject dict, string className = "ModScentComponent")
 {
     modScent.scentCategory = EnumUtils.ParseEnum <ScentCategory>(dict[className]["ScentCategory"]);
 }
Esempio n. 39
0
 private static void InitializeStackableComponent(ModStackableComponent modStackable, ProxyObject dict, string className = "ModStackableComponent")
 {
     modStackable.MultipleUnitTextID = dict[className]["MultipleUnitTextId"];
     modStackable.StackSprite        = dict[className]["StackSprite"];
     modStackable.SingleUnitTextID   = dict[className]["SingleUnitTextId"];
     modStackable.UnitsPerItem       = dict[className]["UnitsPerItem"];
     modStackable.ChanceFull         = dict[className]["ChanceFull"];
 }
Esempio n. 40
0
 public void Connect(string strName, out ProxyObject item)
 {
     item = RuntimeObject.FromPtr(ExGetProperty(this.m_pSelf, strName, 4, 0x1adb0)) as ProxyObject;
 }