예제 #1
0
        static void test4()
        {
            string   originString = (new StreamReader("03,073.txt")).ReadToEnd();
            DateTime dt           = DateTime.Now;
            Reaper   reaper       = new Reaper(originString);

            foreach (Reaper part in reaper.RemainBeforeFirst("<table width=\"100%\" summary=\"table used for formatting\"><tr><td>").ReapByProfix("<hr><big><b><i>"))
            {
                string partName = part.RemainBeforeFirst(":</i></b></big>").GetResult()[0];
                foreach (Reaper table in part.ReapByProfix("<div align=\"center\"><table border=1 summary=\""))
                {
                    string tableName = table.RemainBeforeFirst("\" width=\"95%\">").GetResult()[0];

                    foreach (Reaper line in table.ReapByProfix("<tr><td>").GiveUpContain("<td>Jan</td><td>Feb</td><td>Mar</td>"))
                    {
                        string lineName = line.RemainBeforeFirst("</td>").GetResult()[0];
                        /////////
                        foreach (Reaper data in line.ReapByProfix("<td align=\"center\" nowrap>").RemainBeforeFirst("</td>"))
                        {
                            /////////
                        }
                        /////////////
                    }
                }
            }
            ////////////
            TimeSpan ts = DateTime.Now - dt;

            Console.WriteLine(ts);
        }
        public Task(int lat, int lon)
        {
            _inFileName = "input\\";

            if (lat < 0)
                _inFileName += "-";
            else
                _inFileName += "+";
            if (Math.Abs(lat) < 10)
                _inFileName += "0" + Math.Abs(lat);
            else
                _inFileName += "" + Math.Abs(lat);

            _inFileName += ",";

            if (lon < 0)
                _inFileName += "-";
            else
                _inFileName += "+";
            if (Math.Abs(lon) < 10)
                _inFileName += "00" + Math.Abs(lon);
            else
            {
                if (Math.Abs(lon) < 100)
                    _inFileName += "0" + Math.Abs(lon);
                else
                    _inFileName += "" + Math.Abs(lon);
            }
            _inFileName += ".html";

            Reaper reaper = new Reaper((new StreamReader(_inFileName).ReadToEnd()));
            _lat = Convert.ToDouble(reaper.RemainAfterFirst("<br>Latitude <b>").RemainBeforeFirst("</b>").GetResult()[0]);
            _lon = Convert.ToDouble(reaper.RemainAfterFirst("<br>Longitude <b>").RemainBeforeFirst("</b>").GetResult()[0]);
        }
예제 #3
0
        static void test3()
        {
            Reaper       reaper     = new Reaper((new StreamReader("03,073.html")).ReadToEnd());
            StreamWriter outputFile = new StreamWriter("test3_output.txt");

            foreach (Reaper part in reaper.RemainBeforeFirst("<table width=\"100%\" summary=\"table used for formatting\"><tr><td>").ReapByProfix("<hr><big><b><i>"))
            {
                string partName = part.RemainBeforeFirst(":</i></b></big>").GetResult()[0];
                ShowStrings(part.RemainBeforeFirst(":</i></b></big>").GetResult());
                foreach (Reaper table in part.ReapByProfix("<div align=\"center\"><table border=1 summary=\""))
                {
                    string tableName = table.RemainBeforeFirst("\" width=\"95%\">").GetResult()[0];

                    int lineCount = 0;
                    foreach (Reaper line in table.ReapByProfix("<tr><td>").GiveUpContain("<td>Jan</td><td>Feb</td><td>Mar</td>"))
                    {
                        string lineName = line.RemainBeforeFirst("</td>").GetResult()[0];

                        outputFile.WriteLine("PART:" + partName);
                        outputFile.WriteLine("TABLE:" + tableName);
                        outputFile.WriteLine("LINE:" + lineName);
                        outputFile.WriteLine("NO.:" + ++lineCount);
                        foreach (Reaper data in line.ReapByProfix("<td align=\"center\" nowrap>").RemainBeforeFirst("</td>"))
                        {
                            outputFile.Write(data.GetResult()[0] + " ");
                        }
                        outputFile.WriteLine();
                    }
                }
            }
            outputFile.Close();
        }
예제 #4
0
        public async Task <long> Save(Reaper entity)
        {
            _context.Entry(entity).State = entity.Id > 0 ? EntityState.Modified : EntityState.Added;
            await _context.SaveChangesAsync();

            return(entity.Id);
        }
예제 #5
0
        private void statusreoload()
        {
            ushort down = 32768;
            ushort up   = 32768;

            if (checkBox3.Checked == true)
            {
                if ((GetAsyncKeyState(0X52) & up) == up)
                {
                    if (comboBox3.Text == "SOILDER76")
                    {
                        Solider_76.Start();
                    }
                    else if (comboBox3.Text == "PHARAH")
                    {
                        Pharah.Start();
                    }
                    else if (comboBox3.Text == "ROADHOG")
                    {
                        Roadhog.Start();
                    }
                    else if (comboBox3.Text == "REAPER")
                    {
                        Reaper.Start();
                    }
                }
            }
        }
예제 #6
0
        public static void HandleAbnormalityEnd(S_ABNORMALITY_END p)
        {
            AbnormalityManager.EndAbnormality(p.TargetId, p.AbnormalityId);
            if (!SettingsManager.ClassWindowSettings.Enabled)
            {
                return;
            }

            switch (SessionManager.CurrentPlayer.Class)
            {
            case Class.Archer:
                Archer.CheckFocusEnd(p);
                Archer.CheckSniperEyeEnd(p);
                break;

            case Class.Warrior:
                Warrior.CheckBuffEnd(p);
                break;

            case Class.Lancer:
                Lancer.CheckLineHeldEnd(p);
                Lancer.CheckArushEnd(p);
                Lancer.CheckGshoutEnd(p);
                break;

            case Class.Mystic:
                Mystic.CheckBuffEnd(p);
                break;

            case Class.Brawler:
                Brawler.CheckBrawlerAbnormalEnd(p);
                break;

            case Class.Ninja:
                Ninja.CheckFocusEnd(p);
                break;

            case Class.Priest:
                Priest.CheckBuffEnd(p);
                break;

            case Class.Sorcerer:
                Sorcerer.CheckBuffEnd(p);
                break;

            case Class.Reaper:
                Reaper.CheckBuffEnd(p);
                break;

            case Class.Slayer:
                Slayer.CheckBuffEnd(p);
                break;

            case Class.Berserker:
                Berserker.CheckBuffEnd(p);
                break;
            }
        }
    // I could this the same thing here
    public override MagicInvocation InvokeMagic()
    {
        // But instead I want to the Magic one be the clever AI
        Reaper reaper = base.InvokeMagic() as Reaper;

        reaper.gameObject.AddComponent <MoreCleverAIEnemy>();

        return(reaper);
    }
예제 #8
0
        public async Task <long> Delete(long id)
        {
            Reaper farm = await GetById(id);

            _context.Reapers.Remove(farm);
            await _context.SaveChangesAsync();

            return(id);
        }
        private void Reaper2_Click(object sender, RoutedEventArgs e)
        {
            //MessageBox.Show("Reaper");
            this.Hide();
            Reaper reaper = new Reaper();

            reaper.ShowDialog();
            this.Show();
        }
예제 #10
0
 /// <param name="client">the client</param>
 /// <param name="path">path to reap children from</param>
 /// <param name="executor">executor to use for background tasks</param>
 /// <param name="reapingThresholdMs">threshold in milliseconds that determines that a path can be deleted
 ///     </param>
 /// <param name="mode">reaping mode</param>
 /// <param name="leaderPath">if not null, uses a leader selection so that only 1 reaper is active in the cluster
 ///     </param>
 public ChildReaper(CuratorFramework client, string path, Reaper.Mode mode, ScheduledExecutorService
                    executor, int reapingThresholdMs, string leaderPath)
 {
     this.client             = client;
     this.mode               = mode;
     this.executor           = new CloseableScheduledExecutorService(executor);
     this.reapingThresholdMs = reapingThresholdMs;
     this.reaper             = new Reaper(client, executor, reapingThresholdMs, leaderPath);
     AddPath(path);
 }
예제 #11
0
    public void Sell(Recipe recipe, Invoice invoice)
    {
        if (!GameController.instance.player.inventory.CheckIfWarehouseContains(recipe.description.Name) || invoice.quantity + area.soldItems > area.maxQuotum)
        {
            return;
        }

        bool soldSuccesfully = GameController.instance.player.inventory.Remove(recipe.description.Name, invoice.quantity);

        if (soldSuccesfully)
        {
            if (!tutorial.isTutorialCompleted)
            {
                tutorial.ContinueTutorial();
            }
            view.returnBtn.gameObject.SetActive(true);
            var messageBox = GameController.instance.buttons.messageBox;
            messageBox.Show(
                "x" + invoice.quantity.ToString() + " "
                + RecipeSelector.recipeHolderSelected.recipe.description.Name + " sold",
                RecipeSelector.recipeHolderSelected.recipe.description.sprite
                );
            GameController.instance.player.GainExperience(invoice.quantity * 10 * (area.experienceMultiplier + (recipe.Talents.Count) / 4));
            GameController.instance.player.resources.ChangeBalance(invoice.Summary, true);
            int healAmount = recipe.characteristics.healingRate * invoice.quantity;
            area.health    += healAmount; area.health = Mathf.Clamp(area.health, 0, area.maxHealth);
            area.soldItems += invoice.quantity;
            // refresh dead/alive rate
            int    alive  = 0;
            int    dead   = 0;
            Reaper reaper = new Reaper();
            dead               = reaper.GetDeadAliveRate(recipe, invoice.quantity, out alive);
            area.dead         += dead;
            area.cured        += alive;
            area.health       -= dead * 10;
            recipe.soldAmount += invoice.quantity;
            recipe.deadAmount += dead;
            recipe.RecalculatePrice();
            view.onSell.Play();
            // achieve quest's objective if it exists
            EventManager.TriggerEvent("OnSell", invoice.quantity);
            EventManager.TriggerEvent("OnKill", dead);
            EventManager.TriggerEvent("OnCure", alive);
            EventManager.TriggerEvent("OnHeal", healAmount);
            // increment achievement
            PlayGameScript.IncrementAchievement(GPGSIds.achievement_life_saver, alive);
            PlayGameScript.IncrementAchievement(GPGSIds.achievement_grim_reaper, dead);
            GameController.instance.audio.MakeSound(onSellSound);
        }
        view.SetViewToArea(area);
        view.RemoveCheckmarks();

        ListPopulator.PopulateRecipeList(view.recipeView, view.recipePrefab, GameController.instance.player.inventory.recipes.Where(x => x.GetDeathRating() <= area.deathRatingAllowed &&
                                                                                                                                    GameController.instance.player.inventory.GetQuantity(x.description.Name) > 0).ToList());
    }
예제 #12
0
        public List <Build> ZergBuilds(Bot bot)
        {
            List <Build> options = new List <Build>();

            if (bot.EnemyRace == Race.Protoss)
            {
                options.Add(new MassZergling()
                {
                    AllowHydraTransition = true
                });
                options.Add(new MacroHydra());
            }
            else if (bot.EnemyRace == Race.Terran)
            {
                if (ProxyDetected.Get().DetectedPreviously &&
                    Reaper.Get().DetectedPreviously &&
                    Hellion.Get().DetectedPreviously &&
                    Cyclone.Get().DetectedPreviously &&
                    Banshee.Get().DetectedPreviously)
                {
                    options.Add(new Muukzor());
                    return(options);
                }
                if (BattlecruiserRush.Get().DetectedPreviously)
                {
                    options.Add(new MacroHydra());
                    return(options);
                }

                options.Add(new MassZergling()
                {
                    AllowHydraTransition = true
                });
                options.Add(new MacroHydra());
                options.Add(new Muukzor());
            }
            else if (bot.EnemyRace == Race.Zerg)
            {
                options.Add(new RoachRavager());
                options.Add(new MacroHydra());
                options.Add(new RushDefense());
            }
            else
            {
                options.Add(new MassZergling()
                {
                    AllowHydraTransition = true
                });
                options.Add(new MacroHydra());
                options.Add(new RushDefense());
            }

            return(options);
        }
        public Task(int lat, int lon)
        {
            _inFileName = "input\\";

            if (lat < 0)
            {
                _inFileName += "-";
            }
            else
            {
                _inFileName += "+";
            }
            if (Math.Abs(lat) < 10)
            {
                _inFileName += "0" + Math.Abs(lat);
            }
            else
            {
                _inFileName += "" + Math.Abs(lat);
            }

            _inFileName += ",";

            if (lon < 0)
            {
                _inFileName += "-";
            }
            else
            {
                _inFileName += "+";
            }
            if (Math.Abs(lon) < 10)
            {
                _inFileName += "00" + Math.Abs(lon);
            }
            else
            {
                if (Math.Abs(lon) < 100)
                {
                    _inFileName += "0" + Math.Abs(lon);
                }
                else
                {
                    _inFileName += "" + Math.Abs(lon);
                }
            }
            _inFileName += ".html";


            Reaper reaper = new Reaper((new StreamReader(_inFileName).ReadToEnd()));

            _lat = Convert.ToDouble(reaper.RemainAfterFirst("<br>Latitude <b>").RemainBeforeFirst("</b>").GetResult()[0]);
            _lon = Convert.ToDouble(reaper.RemainAfterFirst("<br>Longitude <b>").RemainBeforeFirst("</b>").GetResult()[0]);
        }
예제 #14
0
        public static void HandleAbnormalityRefresh(S_ABNORMALITY_REFRESH p)
        {
            AbnormalityManager.BeginAbnormality(p.AbnormalityId, p.TargetId, p.Duration, p.Stacks);
            if (!SettingsManager.ClassWindowSettings.Enabled)
            {
                return;
            }
            switch (SessionManager.CurrentPlayer.Class)
            {
            case Class.Warrior:
                Warrior.CheckBuff(p);
                break;

            case Class.Archer:
                Archer.CheckFocus(p);
                Archer.CheckFocusX(p);
                Archer.CheckSniperEye(p);
                break;

            case Class.Lancer:
                Lancer.CheckLineHeld(p);
                break;

            case Class.Priest:
                Priest.CheckBuff(p);
                break;

            case Class.Mystic:
                Mystic.CheckBuff(p);
                break;

            case Class.Sorcerer:
                Sorcerer.CheckBuff(p);
                break;

            case Class.Reaper:
                Reaper.CheckBuff(p);
                break;

            case Class.Slayer:
                Slayer.CheckBuff(p);
                break;

            case Class.Berserker:
                Berserker.CheckBuff(p);
                break;

            case Class.Brawler:
                Brawler.CheckBrawlerAbnormal(p);
                break;
            }
        }
예제 #15
0
    public override Hero Get_Instance()
    {
        if (_instance == null)
        {
            _instance = new Reaper();
            _instance.Start();
            return(_instance);
        }

        else
        {
            return(_instance);
        }
    }
예제 #16
0
        static void test1()
        {
            Reaper        reaper     = new Reaper((new StreamReader("03,073.html")).ReadToEnd());
            StreamWriter  outputFile = new StreamWriter("test1_output.txt");
            List <string> partResult =
                reaper
                .RemainBeforeFirst("<table width=\"100%\" summary=\"table used for formatting\"><tr><td>")
                .ReapByProfix("<hr><big><b><i>")
                .GetResult();

            foreach (var part in partResult)
            {
                string partName = (new Reaper(part)).RemainBeforeFirst(":</i></b></big>").GetResult()[0];
                ShowStrings((new Reaper(part)).RemainBeforeFirst(":</i></b></big>").GetResult());
                outputFile.WriteLine("----------PART:" + partName);
                List <string> tableResult =
                    (new Reaper(part))
                    .ReapByProfix("<div align=\"center\"><table border=1 summary=\"")
                    .GetResult();
                foreach (var table in tableResult)
                {
                    string tableName = (new Reaper(table)).RemainBeforeFirst("\" width=\"95%\">").GetResult()[0];
                    //ShowStrings((new Reaper(table)).RemainBeforeFirst("\" width=\"95%\">").GetResult());
                    outputFile.WriteLine("-----TABLE:" + tableName);
                    List <string> lineResult =
                        (new Reaper(table))
                        .ReapByProfix("<tr><td>")
                        .GiveUpContain("<td>Jan</td><td>Feb</td><td>Mar</td>")
                        .GetResult();
                    int lineCount = 0;
                    foreach (var line in lineResult)
                    {
                        string lineName = (new Reaper(line)).RemainBeforeFirst("</td>").GetResult()[0];
                        //ShowStrings((new Reaper(line)).RemainBeforeFirst("</td>").GetResult());
                        outputFile.WriteLine("LINE:" + lineName + " " + ++lineCount);
                        List <string> dataResult =
                            (new Reaper(line))
                            .ReapByProfix("<td align=\"center\" nowrap>")
                            .RemainBeforeFirst("</td>")
                            .GetResult();
                        foreach (var data in dataResult)
                        {
                            outputFile.Write(data + " ");
                        }
                        outputFile.WriteLine();
                    }
                }
            }
            outputFile.Close();
        }
        public FeedWriter(ITimer timer, EventBuffer buffer, IFileSystem fileSystem, FeedBuilder feedBuilder)
        {
            Check.IsNotNull(timer, "timer");
            Check.IsNotNull(buffer, "buffer");
            Check.IsNotNull(fileSystem, "fileSystem");
            Check.IsNotNull(feedBuilder, "feedBuilder");

            this.timer = timer;
            this.fileSystem = fileSystem;
            this.buffer = buffer;
            this.feedBuilder = feedBuilder;

            this.timer.TimerFired += TimerFiredHandler;

            reaper = new Reaper(fileSystem);
            FeedMappingsChanged += reaper.OnFeedMappingsChanged;
        }
예제 #18
0
        /// <summary>
        /// runReaper executes the Reaper for the timer process
        /// It is responsible for gathering the settings and the current subscription
        /// that are required by the reaper. This is so that the reaper does not need to
        /// access the DB directly
        /// </summary>
        private async Task runReaper()
        {
            Response response = new Response();
            List <Models.Setting>      settings      = new List <Models.Setting>();
            List <Models.Subscription> subscriptions = new List <Models.Subscription>();
            List <Models.LocationTZ>   locationTZs   = new List <Models.LocationTZ>();

            // get the necessary settings by category
            string[] categories = new string[] { "tags", "slack", "lifecycle" };

            // get the settings the reaper will use
            Dictionary <string, dynamic> criteria = new Dictionary <string, dynamic>();

            criteria.Add("category", categories);

            IModel setting = new Setting(_backend, _logger);

            response = setting.Get(criteria);

            settings = response.GetData();

            // get the subscriptions known to the system
            IModel subscription = new Subscription(_backend, _logger);

            response = subscription.GetByName();

            subscriptions = response.GetData();

            // get the location timezones known to the system
            LocationTZ locationTZ = new LocationTZ(_backend, _logger);

            // Create a notification delay object for the reaper to work with
            NotificationDelay notificationDelay = new NotificationDelay(_backend, _logger);

            // Create an instance of the reaper and process it
            Reaper reaper = new Reaper(_backend, _logger, settings, notificationDelay);

            reaper.Process(subscriptions, locationTZ);
        }
예제 #19
0
        /// <summary>
        /// Used to create new network or NPC ships
        /// DO NOT USE FOR PLAYERSHIP
        /// ignorePositionUpdates should only be used by the Simulator
        /// </summary>
        public Ship CreateShip(World world, bool isNPC, Vector2 position, int shipID, float rotation, Vector2 velocity,
                               string playerName,
                               ShipStats shipStats, List <WeaponTypes> weaponTypes, HashSet <int> teams, bool ignorePositionUpdates = false)
        {
            Ship tempShip;


            _targetManager.DisableTargetSetting();

            switch (shipStats.ShipType)
            {
            case ShipTypes.Barge:
                tempShip = new Barge(position, velocity, rotation, shipID, 0,
                                     playerName, shipStats,
                                     _particleManager,
                                     world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                tempShip.Pilot = new NetworkPilot(tempShip, new ShipBodyDataObject(BodyTypes.NetworkShip, shipID, tempShip));
                break;

            case ShipTypes.Reaper:
                tempShip = new Reaper(position, velocity, rotation, shipID, 0, playerName,
                                      shipStats,
                                      _particleManager,
                                      world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                tempShip.Pilot = new NetworkPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip));
                break;

            case ShipTypes.SuperCoolAwesome3DShip:
                tempShip = new SuperCoolAwesome3DShip(_spriteBatch, GetModel(shipStats.ShipType), position, velocity, rotation, shipID, 0,
                                                      playerName, shipStats,
                                                      _particleManager,
                                                      world, teams);
                tempShip.Pilot = new NetworkPilot(tempShip, new ShipBodyDataObject(BodyTypes.NetworkShip, shipID, tempShip));
                break;


            case ShipTypes.BattleCruiser:
                tempShip = new Battlecruiser(position, velocity, rotation, shipID, 0,
                                             playerName, shipStats,
                                             _particleManager,
                                             world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                tempShip.Pilot = new NetworkPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip));
                break;

            case ShipTypes.Penguin:
                tempShip = new Penguin(position, velocity, rotation, shipID, 0,
                                       playerName, shipStats,
                                       _particleManager,
                                       world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                tempShip.Pilot = new NetworkPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip));
                break;

            case ShipTypes.Dread:
                tempShip = new Dread(position, velocity, rotation, shipID, 0,
                                     playerName, shipStats,
                                     _particleManager,
                                     world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                tempShip.Pilot = new NetworkPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip));

                break;

            default:
                ConsoleManager.WriteLine("Ship type not implemented in ClientShipManager.CreateShip",
                                         ConsoleMessageType.Error);
                return(null);
            }

            if (!_simulateNPCs || tempShip.Pilot.PilotType == PilotType.NetworkPlayer)
            {
                tempShip.BodyBehaviors.Add(new LerpBodyBehavior(_spriteBatch, _textureManager, tempShip, 100));
            }

            tempShip.IsLocalSim = (_simulateNPCs && isNPC);
            AddShip(shipID, tempShip);

            byte numSet = 0;

            foreach (var t in weaponTypes)
            {
                tempShip.SetWeapon(_createWeapon(tempShip, _projectileManager, t, numSet), numSet);
                numSet++;
            }


            tempShip.Pilot = isNPC
                ? new NPCPilot(tempShip, GenerateNetworkShipBodyData(shipID, tempShip))
                : new NPCPilot(tempShip, new ShipBodyDataObject(BodyTypes.NetworkShip, shipID, tempShip));

            if (ignorePositionUpdates)
            {
                _updateIgnoreList.Add(tempShip.Id);
            }

            _targetManager.EnableTargetSetting();


            return(tempShip);
        }
예제 #20
0
        public static void HandleAbnormalityBegin(S_ABNORMALITY_BEGIN p)
        {
            AbnormalityManager.BeginAbnormality(p.AbnormalityId, p.TargetId, p.Duration, p.Stacks);
            if (!SettingsManager.ClassWindowSettings.Enabled)
            {
                return;
            }
            switch (SessionManager.CurrentPlayer.Class)
            {
            case Class.Mystic:
                Mystic.CheckHurricane(p);
                Mystic.CheckBuff(p);
                break;

            case Class.Warrior:
                Warrior.CheckBuff(p);
                break;

            case Class.Valkyrie:
                Valkyrie.CheckRagnarok(p);
                break;

            case Class.Archer:
                Archer.CheckFocus(p);
                Archer.CheckFocusX(p);
                Archer.CheckSniperEye(p);
                break;

            case Class.Lancer:
                Lancer.CheckArush(p);
                Lancer.CheckGshout(p);
                Lancer.CheckLineHeld(p);
                break;

            case Class.Priest:
                Priest.CheckBuff(p);
                break;

            case Class.Brawler:
                Brawler.CheckBrawlerAbnormal(p);
                break;

            case Class.Ninja:
                Ninja.CheckFocus(p);
                break;

            case Class.Sorcerer:
                Sorcerer.CheckBuff(p);
                break;

            case Class.Reaper:
                Reaper.CheckBuff(p);
                break;

            case Class.Slayer:
                Slayer.CheckBuff(p);
                break;

            case Class.Berserker:
                Berserker.CheckBuff(p);
                break;
            }
        }
예제 #21
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            Reaper RR  = new Reaper();
            Reaper RR2 = new Reaper();

            richTextBox.Clear();

            WoTReplay Replay  = RR.Parse(@"D:\MyClouds\YandexDisk\wot\REP_Cache\086\086_20130531_2238_uk-GB51_Excelsior_07_lakeville (1).wotreplay");
            WoTReplay Replay2 = RR2.Parse(@"D:\MyClouds\YandexDisk\wot\REP_Cache\67690030279124597.wotreplay");

            /*
             * ReplayInfo RI = new ReplayInfo();
             * RI.ReadDataFromFile(@"D:\MyClouds\YandexDisk\wot\REP_Cache\086\086_20130531_2238_uk-GB51_Excelsior_07_lakeville (1).wotreplay");
             *
             * ReplayInfo RI2 = new ReplayInfo();
             * RI2.ReadDataFromFile(@"D:\MyClouds\YandexDisk\wot\REP_Cache\67690030279124597.wotreplay");
             */


            // BattleResult_v2 BR = new BattleResult_v2(@"D:\MyClouds\YandexDisk\wot\REP_Cache\!!!\___KV1_321235285635519637.dat");
            //BattleResult_v2 BRv2 = new BattleResult_v2(@"D:\MyClouds\YandexDisk\wot\REP_Cache\!!!\82243763184823766.dat");

            //KeyValuePair<string, dynamic>

            /*
             * foreach (int key in BRv2.Vehicles.Keys)
             * {
             *  richTextBox.AppendText(BRv2.Players[BRv2.Vehicles[key]["accountDBID"]]["name"]);
             *  if (BRv2.Players[BRv2.Vehicles[key]["accountDBID"]]["clanAbbver"] != "")
             *  {
             *      richTextBox.AppendText("[" + BRv2.Players[BRv2.Vehicles[key]["accountDBID"]]["clanAbbver"] + "]");
             *  }
             *  richTextBox.AppendText("\n");
             *  richTextBox.AppendText("---Damage: "+BRv2.Vehicles[key]["damageDealt"]+"\n");
             *  richTextBox.AppendText("---Team  : " + BRv2.Vehicles[key]["team"] + "\n");
             * }
             */

            JsonTextReader reader = new JsonTextReader(new StringReader(RR.RawData2));

            //////////////////////////////////////////////////////////////////
            /// UnPicle
            //////////////////////////////////////////////////////////////////

            ScriptEngine m_engine = Python.CreateEngine();
            ScriptScope  m_scope  = null;

            m_scope = m_engine.CreateScope();

            var paths = new List <string>();

            paths.Add(@"C:\Program Files (x86)\IronPython 2.7\Lib");

            m_engine.SetSearchPaths(paths);

            string code = @"
import pickle
class Serialize(object):
    def unpickle(self,value):
        return pickle.loads(value)
    def unpickledat(self,value):
        f = open(value,'rb')
        f.seek(261)
        bb = f.read()
        return pickle.loads(bb)
";

            ObjectOperations ops = m_engine.Operations;
            ScriptSource     source;

            source = m_engine.CreateScriptSourceFromString(code, SourceCodeKind.Statements);
            source.Execute(m_scope);
            object klass    = m_scope.GetVariable("Serialize");
            object instance = ops.Invoke(klass);
            object method   = ops.GetMember(instance, "unpickle");

            object result1 = ops.Invoke(method, (object)RR.RawData3);
            object result2 = ops.Invoke(method, (object)RR2.RawData3);



            IronPython.Runtime.PythonDictionary OBJ = (IronPython.Runtime.PythonDictionary)result1;

            //Dictionary<string, dynamic> D = OBJ.ToDictionary<string, dynamic>(;

            //double O2 = (double)(((IronPython.Runtime.PythonDictionary)OBJ["common"])["duration"]);

            //269093955030980.dat



            //BattleResult BR2 = new BattleResult("D:\\322055057453144847.dat");

            string[] LAYOUT = new string[] { "_version",
                                             "lastBattleTime",
                                             "battleLifeTime",
                                             "maxFrags",
                                             "xp",
                                             "maxXP",
                                             "battlesCount",
                                             "wins",
                                             "losses",
                                             "survivedBattles",
                                             "winAndSurvived",
                                             "frags",
                                             "frags8p",
                                             "fragsBeast",
                                             "shots",
                                             "hits",
                                             "spotted",
                                             "damageDealt",
                                             "damageReceived",
                                             "treesCut",
                                             "capturePoints",
                                             "droppedCapturePoints",
                                             "sniperSeries",
                                             "maxSniperSeries",
                                             "invincibleSeries",
                                             "maxInvincibleSeries",
                                             "diehardSeries",
                                             "maxDiehardSeries",
                                             "killingSeries",
                                             "maxKillingSeries",
                                             "piercingSeries",
                                             "maxPiercingSeries",
                                             "battleHeroes",
                                             "fragsSinai",
                                             "warrior",
                                             "invader",
                                             "sniper",
                                             "defender",
                                             "steelwall",
                                             "supporter",
                                             "scout",
                                             "evileye",
                                             "medalKay",
                                             "medalCarius",
                                             "medalKnispel",
                                             "medalPoppel",
                                             "medalAbrams",
                                             "medalLeClerc",
                                             "medalLavrinenko",
                                             "medalEkins",
                                             "medalWittmann",
                                             "medalOrlik",
                                             "medalOskin",
                                             "medalHalonen",
                                             "medalBurda",
                                             "medalBillotte",
                                             "medalKolobanov",
                                             "medalFadin",
                                             "medalRadleyWalters",
                                             "medalBrunoPietro",
                                             "medalTarczay",
                                             "medalPascucci",
                                             "medalDumitru",
                                             "medalLehvaslaiho",
                                             "medalNikolas",
                                             "medalLafayettePool",
                                             "sinai",
                                             "heroesOfRassenay",
                                             "beasthunter",
                                             "mousebane",
                                             "tankExpertStrg",
                                             "titleSniper",
                                             "invincible",
                                             "diehard",
                                             "raider",
                                             "handOfDeath",
                                             "armorPiercer",
                                             "kamikaze",
                                             "lumberjack",
                                             "markOfMastery",
                                             "company/xp",
                                             "company/battlesCount",
                                             "company/wins",
                                             "company/losses",
                                             "company/survivedBattles",
                                             "company/frags",
                                             "company/shots",
                                             "company/hits",
                                             "company/spotted",
                                             "company/damageDealt",
                                             "company/damageReceived",
                                             "company/capturePoints",
                                             "company/droppedCapturePoints",
                                             "clan/xp",
                                             "clan/battlesCount",
                                             "clan/wins",
                                             "clan/losses",
                                             "clan/survivedBattles",
                                             "clan/frags",
                                             "clan/shots",
                                             "clan/hits",
                                             "clan/spotted",
                                             "clan/damageDealt",
                                             "clan/damageReceived",
                                             "clan/capturePoints",
                                             "clan/droppedCapturePoints",
                                             "tankExpert",
                                             "tankExpert0",
                                             "tankExpert1",
                                             "tankExpert2",
                                             "tankExpert3",
                                             "tankExpert4",
                                             "tankExpert5",
                                             "tankExpert6",
                                             "tankExpert7",
                                             "tankExpert8",
                                             "tankExpert9",
                                             "tankExpert10",
                                             "tankExpert11",
                                             "tankExpert12",
                                             "tankExpert13",
                                             "tankExpert14",
                                             "medalBrothersInArms",
                                             "medalCrucialContribution",
                                             "medalDeLanglade",
                                             "medalTamadaYoshio",
                                             "bombardier",
                                             "huntsman",
                                             "alaric",
                                             "sturdy",
                                             "ironMan",
                                             "luckyDevil",
                                             "pattonValley",
                                             "fragsPatton",
                                             "_dynRecPos_vehicle" };
        }
예제 #22
0
        public List <Build> ProtossBuilds(Bot bot)
        {
            List <Build> options = new List <Build>();

            if (Bot.Debug)
            {
                foreach (Strategy strategy in bot.EnemyStrategyAnalyzer.Strategies)
                {
                    if (strategy.DetectedPreviously)
                    {
                        System.Console.WriteLine("Detected previous strategy: " + strategy.Name());
                    }
                }
            }

            if (bot.EnemyRace == Race.Terran)
            {
                if (Marine.Get().DetectedPreviously &&
                    !Reaper.Get().DetectedPreviously &&
                    !Marauder.Get().DetectedPreviously &&
                    !Cyclone.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously &&
                    !SiegeTank.Get().DetectedPreviously &&
                    !Medivac.Get().DetectedPreviously &&
                    !Viking.Get().DetectedPreviously &&
                    !Raven.Get().DetectedPreviously &&
                    !Battlecruiser.Get().DetectedPreviously &&
                    !WidowMine.Get().DetectedPreviously &&
                    !Hellion.Get().DetectedPreviously &&
                    !Thor.Get().DetectedPreviously &&
                    !Liberator.Get().DetectedPreviously)
                {
                    // ValinMarineBot
                    options.Add(new NinjaTurtles());
                    return(options);
                }
                if (BattlecruiserRush.Get().DetectedPreviously &&
                    Thor.Get().DetectedPreviously &&
                    WidowMine.Get().DetectedPreviously)
                {
                    // BenBotBC
                    options.Add(new OneBaseStalkerImmortal());
                    return(options);
                }
                if (Battlecruiser.Get().DetectedPreviously &&
                    !BattlecruiserRush.Get().DetectedPreviously &&
                    !Marauder.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously &&
                    !Reaper.Get().DetectedPreviously &&
                    !Cyclone.Get().DetectedPreviously &&
                    !Medivac.Get().DetectedPreviously &&
                    !Raven.Get().DetectedPreviously)
                {
                    options.Add(new MassVoidray()
                    {
                        SkipDefenses = true
                    });
                    return(options);
                }

                /*
                 * if (ProxyDetected.Get().DetectedPreviously
                 *  && !Marauder.Get().DetectedPreviously
                 *  && Banshee.Get().DetectedPreviously)
                 * {
                 *  options.Add(new AntiMicro());
                 *  return options;
                 * }
                 */
                if (ProxyDetected.Get().DetectedPreviously &&
                    Marauder.Get().DetectedPreviously &&
                    Banshee.Get().DetectedPreviously)
                {
                    // MicroMachine
                    options.Add(new AntiMicro()
                    {
                        HuntProxies = true, CounterProxyMarauder = false
                    });
                    //options.Add(new NinjaTurtles() { Expand = true });
                    //options.Add(new OneBaseTempest() { DefendingStalker = true });
                    return(options);
                }
                if (ProxyDetected.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously)
                {
                    // Strelok
                    //options.Add(new PvTStalkerImmortal() { BuildReaperWall = true, ProxyPylon = false, DelayObserver = true, SendScout = true, MassTanksDetected = MassTank.Get().DetectedPreviously });
                    options.Add(new OneBaseStalkerImmortal()
                    {
                        UseSentry = true
                    });
                    options.Add(new OneBaseTempest());
                    return(options);
                }
                if (Marine.Get().DetectedPreviously &&
                    Medivac.Get().DetectedPreviously &&
                    Viking.Get().DetectedPreviously &&
                    Reaper.Get().DetectedPreviously &&
                    Raven.Get().DetectedPreviously &&
                    !Cyclone.Get().DetectedPreviously &&
                    !Marauder.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously)
                {
                    options.Add(new OneBaseStalkerImmortal());
                    //options.Add(new PvTStalkerImmortal() { BuildReaperWall = false, ProxyPylon = false, DelayObserver = true, SendScout = false, MassTanksDetected = true });
                    return(options);
                }
                if (Marine.Get().DetectedPreviously &&
                    Medivac.Get().DetectedPreviously &&
                    Viking.Get().DetectedPreviously &&
                    Reaper.Get().DetectedPreviously &&
                    !Raven.Get().DetectedPreviously &&
                    Marauder.Get().DetectedPreviously &&
                    Liberator.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously)
                {
                    // Jensiiibot
                    //options.Add(new PvTStalkerTempest());
                    //options.Add(new Builds.Protoss.WorkerRush() { CounterJensiii = true, BuildStalkers = true });
                    //options.Add(new PvTStalkerImmortal() { BuildReaperWall = true, ProxyPylon = false, DelayObserver = true, MassTanksDetected = MassTank.Get().DetectedPreviously, UseColosus = false });
                    options.Add(new PvTZealotImmortal());
                    return(options);
                }
                if (Marine.Get().DetectedPreviously &&
                    Medivac.Get().DetectedPreviously &&
                    Viking.Get().DetectedPreviously &&
                    Reaper.Get().DetectedPreviously &&
                    Cyclone.Get().DetectedPreviously &&
                    !Marauder.Get().DetectedPreviously &&
                    !Liberator.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously)
                {
                    // Rusty
                    options.Add(new OneBaseStalkerImmortal());
                    return(options);
                }
                if (Marine.Get().DetectedPreviously &&
                    Medivac.Get().DetectedPreviously &&
                    Viking.Get().DetectedPreviously &&
                    Reaper.Get().DetectedPreviously &&
                    !Raven.Get().DetectedPreviously &&
                    Cyclone.Get().DetectedPreviously &&
                    Marauder.Get().DetectedPreviously &&
                    !Liberator.Get().DetectedPreviously &&
                    !Banshee.Get().DetectedPreviously &&
                    Thor.Get().DetectedPreviously &&
                    SiegeTank.Get().DetectedPreviously &&
                    MassTank.Get().DetectedPreviously &&
                    Hellbat.Get().DetectedPreviously)
                {
                    // MechSweep
                    options.Add(new OneBaseTempest()
                    {
                        RequiredSize = 3
                    });
                    return(options);
                }

                options.Add(new PvTStalkerImmortal()
                {
                    BuildReaperWall = true, ProxyPylon = false, DelayObserver = true, MassTanksDetected = MassTank.Get().DetectedPreviously, UseColosus = false
                });
            }
            else if (bot.EnemyRace == Race.Zerg)
            {
                if (Bot.Main.OpponentID == "eed44128-f488-4e31-b457-8e55f8a95628")
                {
                    options.Add(new PvZHjax()
                    {
                        CounterRoaches = false, DefendNydus = false
                    });
                    return(options);
                }
                options.Add(new PvZHjax());
                return(options);

                /*
                 * if (Lurker.Get().DetectedPreviously)
                 * {
                 *  //Kagamine
                 *  //options.Add(new PvZAdeptIntoVoidray());
                 *  //options.Add(new WorkerRush());
                 *  options.Add(new PvZHjax());
                 *  return options;
                 * }
                 * if (Mutalisk.Get().DetectedPreviously
                 *  && !Lurker.Get().DetectedPreviously)
                 * {
                 *  options.Add(new OneBaseStalkerImmortal() { StartZealots = true });
                 *  return options;
                 * }
                 * if (Hydralisk.Get().DetectedPreviously && StrategyAnalysis.ZerglingRush.Get().DetectedPreviously)
                 * {
                 *  options.Add(new ZealotRush());
                 *  return options;
                 * }
                 * if (RoachRush.Get().DetectedPreviously || StrategyAnalysis.ZerglingRush.Get().DetectedPreviously)
                 * {
                 *  options.Add(new PvZRushDefense());
                 *  options.Add(new NinjaTurtles());
                 *  return options;
                 * }
                 * if (Roach.Get().DetectedPreviously
                 *  && Zergling.Get().DetectedPreviously
                 *  && !Hydralisk.Get().DetectedPreviously)
                 * {
                 *  options.Add(new PvZRushDefense());
                 *  options.Add(new NinjaTurtles());
                 *  return options;
                 * }
                 * if (Queen.Get().DetectedPreviously
                 *  && Zergling.Get().DetectedPreviously
                 *  && !Hydralisk.Get().DetectedPreviously
                 *  && !Roach.Get().DetectedPreviously)
                 * {
                 *  options.Add(new NinjaTurtles());
                 *  return options;
                 * }
                 * if (bot.PreviousEnemyStrategies.MassHydra
                 *  && MassRoach.Get().DetectedPreviously
                 *  && !Lurker.Get().DetectedPreviously)
                 * {
                 *  options.Add(new OneBaseTempest());
                 *  return options;
                 * }
                 * if (!Zergling.Get().DetectedPreviously
                 *  && !Roach.Get().DetectedPreviously
                 *  && !Hydralisk.Get().DetectedPreviously
                 *  && !Queen.Get().DetectedPreviously
                 *  && !Mutalisk.Get().DetectedPreviously)
                 * {
                 *  options.Add(new OneBaseTempest());
                 *  return options;
                 * }
                 * if (!Zergling.Get().DetectedPreviously
                 *  && Roach.Get().DetectedPreviously
                 *  && !Hydralisk.Get().DetectedPreviously
                 *  && Queen.Get().DetectedPreviously
                 *  && !Mutalisk.Get().DetectedPreviously)
                 * {
                 *  options.Add(new OneBaseTempest());
                 *  return options;
                 * }
                 * options.Add(new OneBaseStalkerImmortal() { StartZealots = true });
                 */
            }
            else if (bot.EnemyRace == Race.Protoss)
            {
                if (Zealot.Get().DetectedPreviously &&
                    VoidRay.Get().DetectedPreviously &&
                    !Carrier.Get().DetectedPreviously &&
                    !Tempest.Get().DetectedPreviously &&
                    !Stalker.Get().DetectedPreviously &&
                    !Adept.Get().DetectedPreviously &&
                    !Immortal.Get().DetectedPreviously &&
                    !StrategyAnalysis.CannonRush.Get().DetectedPreviously)
                {
                    // MavBot3
                    options.Add(new ZealotRush());
                    return(options);
                }
                if (SkippedNatural.Get().DetectedPreviously &&
                    !AdeptHarass.Get().DetectedPreviously &&
                    VoidRay.Get().DetectedPreviously &&
                    Immortal.Get().DetectedPreviously)
                {
                    // AdditionalPylons
                    options.Add(new DoubleRoboProxy());
                    return(options);
                }
                if (Oracle.Get().DetectedPreviously &&
                    ThreeGate.Get().DetectedPreviously &&
                    Zealot.Get().DetectedPreviously &&
                    !Stalker.Get().DetectedPreviously &&
                    !VoidRay.Get().DetectedPreviously &&
                    !Immortal.Get().DetectedPreviously)
                {
                    // LuckyBot
                    options.Add(new OneBaseTempest());
                    return(options);
                }
                if (Carrier.Get().DetectedPreviously &&
                    Collosus.Get().DetectedPreviously &&
                    SkyToss.Get().DetectedPreviously &&
                    Tempest.Get().DetectedPreviously &&
                    !Archon.Get().DetectedPreviously &&
                    !HighTemplar.Get().DetectedPreviously)
                {
                    // TheGoldenArmada
                    options.Add(new OneBaseTempest());
                    return(options);
                }
                options.Add(new OneBaseStalkerImmortal()
                {
                    DoubleRobo = true, EarlySentry = true, AggressiveMicro = true
                });
                return(options);

                /*
                 * if (AdeptHarass.Get().DetectedPreviously
                 *  && SkyToss.Get().DetectedPreviously
                 *  && Carrier.Get().DetectedPreviously
                 *  && HighTemplar.Get().DetectedPreviously
                 *  && VoidRay.Get().DetectedPreviously
                 *  && !StrategyAnalysis.CannonRush.Get().DetectedPreviously)
                 * {
                 *  options.Add(new ZealotRush());
                 *  options.Add(new OneBaseStalkerImmortal());
                 *  return options;
                 * }
                 * if (AdeptHarass.Get().DetectedPreviously)
                 * {
                 *  // SharpenedEdge
                 *  options.Add(new OneBaseTempest());
                 *  options.Add(new Dishwasher());
                 *  return options;
                 * }
                 * if (StrategyAnalysis.CannonRush.Get().DetectedPreviously
                 *  && Tempest.Get().DetectedPreviously)
                 * {
                 *  // ThreeWayLover
                 *  //options.Add(new MassVoidray() { SkipDefenses = true });
                 *  options.Add(new OneBaseTempest());
                 *  return options;
                 * }
                 * if (Sentry.Get().DetectedPreviously
                 *  && Archon.Get().DetectedPreviously
                 *  && !Stalker.Get().DetectedPreviously
                 *  && !Zealot.Get().DetectedPreviously)
                 * {
                 *  options.Add(new TempestProxy());
                 *  return options;
                 * }
                 * if (Zealot.Get().DetectedPreviously
                 *  && StrategyAnalysis.CannonRush.Get().DetectedPreviously
                 *  && Oracle.Get().DetectedPreviously
                 *  && Phoenix.Get().DetectedPreviously
                 *  && Stalker.Get().DetectedPreviously
                 *  && !Immortal.Get().DetectedPreviously)
                 * {
                 *  //Gumby
                 *  options.Add(new NinjaTurtles());
                 *  return options;
                 * }
                 * if (Oracle.Get().DetectedPreviously)
                 * {
                 *  options.Add(new OneBaseTempest());
                 *  return options;
                 * }
                 * if (!Stalker.Get().DetectedPreviously
                 *  && !Zealot.Get().DetectedPreviously
                 *  && !Sentry.Get().DetectedPreviously)
                 * {
                 *  options.Add(new ZealotRush());
                 *  return options;
                 * }
                 * if (Zealot.Get().DetectedPreviously
                 *  && !Stalker.Get().DetectedPreviously)
                 * {
                 *  options.Add(new NinjaTurtles());
                 *  return options;
                 * }
                 *
                 * options.Add(new NinjaTurtles());
                 * options.Add(new PvPMothershipSiege());
                 */
            }

            return(options);
        }
예제 #23
0
파일: Sima.cs 프로젝트: m2bad4u/JOIN_AIS
 public ReaperSkillEffect(int type, double x, double y, double radius, int duration, int order, Reaper reaper) : base(type, x, y, radius, duration, order, reaper)
 {
 }
        public bool 提取()
        {
            StringWriter strWriter = new StringWriter();
            //TimeSpan repearTime = new TimeSpan();
            string originString = (new StreamReader(_inFileName)).ReadToEnd();

            //处理重大漏洞:HTML代码中,部分行名是包含在</tr>\n<tr><td align=\"center\">中,而大多数是包含在</tr>\n<tr><td>中
            originString = originString.Replace("</tr>\n<tr><td align=\"center\">", "</tr>\n<tr><td>");

            //DateTime startTime = DateTime.Now;
            Reaper reaper = new Reaper(originString);

            string latStr = reaper.RemainAfterFirst("<br>Latitude <b>").RemainBeforeFirst("</b>").GetResult()[0];
            string lonStr = reaper.RemainAfterFirst("<br>Longitude <b>").RemainBeforeFirst("</b>").GetResult()[0];

            //repearTime += DateTime.Now - startTime;

            strWriter.Write("LATLON:");
            strWriter.WriteLine(latStr + " " + lonStr);

            //startTime = DateTime.Now;

            foreach (Reaper part in reaper.RemainBeforeFirst("<table width=\"100%\" summary=\"table used for formatting\"><tr><td>").ReapByProfix("<hr><big><b><i>"))
            {
                string partName = part.RemainBeforeFirst(":</i></b></big>").GetResult()[0];
                //ShowStrings(part.RemainBeforeFirst(":</i></b></big>").GetResult());
                foreach (Reaper table in part.ReapByProfix("<div align=\"center\"><table border=1 summary=\""))
                {
                    string tableName = table.RemainBeforeFirst("\" width=\"95%\">").GetResult()[0];

                    int lineCount = 0;
                    foreach (Reaper line in table.ReapByProfix("<tr><td>").GiveUpContain("<td>Jan</td><td>Feb</td><td>Mar</td>"))
                    {
                        string lineName = line.RemainBeforeFirst("</td>").GetResult()[0];

                        //repearTime += DateTime.Now - startTime;

                        strWriter.WriteLine("PART:" + partName);
                        strWriter.WriteLine("TABLE:" + tableName);
                        strWriter.WriteLine("LINE:" + lineName);
                        strWriter.WriteLine("NUM:" + ++lineCount);
                        strWriter.Write("DATA:");

                        //startTime = DateTime.Now;

                        foreach (Reaper data in line.ReapByProfix("<td align=\"center\" nowrap>").RemainBeforeFirst("</td>"))
                        {
                            //repearTime += DateTime.Now - startTime;

                            strWriter.Write(data.GetResult()[0] + " ");

                            //startTime = DateTime.Now;
                        }
                        strWriter.WriteLine();
                    }
                }
            }

            //处理HTML的转义符
            string result = strWriter.ToString();
            result = result.Replace("&lt;", "<");
            result = result.Replace("&gt;", ">");
            result = result.Replace("&deg;", "°");
            //处理Average Daily Temperature Range 多出的*
            result = result.Replace("* ", "");

            try
            {
                StreamWriter _outFile = new StreamWriter(_outFileName);
                _outFile.Write(result);
                _outFile.Close();
            }
            catch(Exception ex)
            {
                Program.errLog.WriteLine(ex.Message);
                Program.errLog.Flush();
            }
            //Console.WriteLine("完成:" + _inFileName + " -> " + _outFileName);
            //Console.WriteLine("Reaper\n耗时" + repearTime);
            return true;
        }
예제 #25
0
    internal void InitializeUnit(UnitDetails unitDetails)
    {
        switch (unitDetails.UnitType)
        {
        case Constants.ReaperTypeId:
        {
            var reaper = new Reaper(unitDetails);

            if (reaper.PlayerId == 0)
            {
                this.MyReapers.Add(reaper);
            }
            else
            {
                this.EnemyReapers.Add(reaper.PlayerId, reaper);
            }

            break;
        }

        case Constants.DestroyerTypeId:
        {
            var destroyer = new Destroyer(unitDetails);

            if (destroyer.PlayerId == 0)
            {
                this.MyDestroyers.Add(destroyer);
            }
            else
            {
                this.EnemyDestroyers.Add(destroyer.PlayerId, destroyer);
            }

            break;
        }

        case Constants.DoofTypeId:
        {
            var doof = new Doof(unitDetails);

            if (doof.PlayerId == 0)
            {
                this.MyDoofs.Add(doof);
            }
            else
            {
                this.EnemyDoofs.Add(doof.
                                    PlayerId, doof);
            }

            break;
        }

        case Constants.TankerTypeId:
        {
            var tanker = new Tanker(unitDetails);
            this.Tankers.Add(tanker);
            break;
        }

        case Constants.WreckTypeId:
        {
            var wreck = new Wreck(unitDetails);
            this.Wrecks.Add(wreck);
            break;
        }

        case Constants.TarPoolTypeId:
        {
            var pool = new TarPool(unitDetails);
            this.TarPools.Add(pool);
            break;
        }

        case Constants.OilPoolTypeId:
        {
            var pool = new OilPool(unitDetails);
            this.OilPools.Add(pool);
            break;
        }

        default:
            break;
        }
    }
예제 #26
0
        public virtual void start()
        {
            srv_sock1 = createServerSocket(bind_addr1, srv_port);

            if (bind_addr2 != null)
                srv_sock2 = createServerSocket(bind_addr2, 0);


            if (srv_sock1 == null)
            {
                throw new ExtSocketException("Cluster can not be started on the given server port. The port might be already in use.");
            }
            if (bind_addr1 != null)
                local_addr = new Address(bind_addr1, ((System.Net.IPEndPoint)srv_sock1.LocalEndpoint).Port);
            else
                local_addr = new Address(((IPEndPoint)srv_sock1.LocalEndpoint).Address, ((System.Net.IPEndPoint)srv_sock1.LocalEndpoint).Port);

            if (srv_sock2 != null)
            {
                local_addr_s = new Address(bind_addr2, ((System.Net.IPEndPoint)srv_sock2.LocalEndpoint).Port);
            }


            if (NCacheLog.IsInfoEnabled) NCacheLog.Info("server socket created on " + local_addr);

            if (System.Configuration.ConfigurationSettings.AppSettings["NCacheServer.EnableDebuggingCounters"] != null)
            {
                enableMonitoring = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["NCacheServer.EnableDebuggingCounters"]);
            }
            if (System.Configuration.ConfigurationSettings.AppSettings["NCacheServer.EnableDualSocket"] != null)
            {
                useDualConnection = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["NCacheServer.EnableDualSocket"]);
            }
            if (System.Configuration.ConfigurationSettings.AppSettings["NCacheServer.EnableNagling"] != null)
            {
                enableNaggling = Convert.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["NCacheServer.EnableNagling"]);
            }
            if (System.Configuration.ConfigurationSettings.AppSettings["NCacheServer.NaglingSize"] != null)
            {
                nagglingSize = Convert.ToInt32(System.Configuration.ConfigurationSettings.AppSettings["NCacheServer.NaglingSize"]) * 1024;
            }

            //Roland Kurmann 4/7/2003, build new thread group
            //Roland Kurmann 4/7/2003, put in thread_group
            acceptor1 = new Thread(new ThreadStart(this.RunPrimary));//, "ConnectionTable.AcceptorThread_p");
            acceptor1.Name = "ConnectionTable.AcceptorThread_p";
            acceptor1.IsBackground = true;
            acceptor1.Start();

            NCacheLog.CriticalInfo("ConnectionTable.Start", "operating parameters -> [bind_addr :" + local_addr + " ; dual_socket: " + useDualConnection + " ; nagling: " + enableNaggling + " ; nagling_size : " + nagglingSize + " ]");

            
            // start the connection reaper - will periodically remove unused connections
            if (use_reaper && reaper == null)
            {
                reaper = new Reaper(this);
                reaper.start();
            }

        }
예제 #27
0
        public bool 提取()
        {
            StringWriter strWriter = new StringWriter();
            //TimeSpan repearTime = new TimeSpan();
            string originString = (new StreamReader(_inFileName)).ReadToEnd();

            //处理重大漏洞:HTML代码中,部分行名是包含在</tr>\n<tr><td align=\"center\">中,而大多数是包含在</tr>\n<tr><td>中
            originString = originString.Replace("</tr>\n<tr><td align=\"center\">", "</tr>\n<tr><td>");


            //DateTime startTime = DateTime.Now;
            Reaper reaper = new Reaper(originString);

            string latStr = reaper.RemainAfterFirst("<br>Latitude <b>").RemainBeforeFirst("</b>").GetResult()[0];
            string lonStr = reaper.RemainAfterFirst("<br>Longitude <b>").RemainBeforeFirst("</b>").GetResult()[0];

            //repearTime += DateTime.Now - startTime;

            strWriter.Write("LATLON:");
            strWriter.WriteLine(latStr + " " + lonStr);

            //startTime = DateTime.Now;

            foreach (Reaper part in reaper.RemainBeforeFirst("<table width=\"100%\" summary=\"table used for formatting\"><tr><td>").ReapByProfix("<hr><big><b><i>"))
            {
                string partName = part.RemainBeforeFirst(":</i></b></big>").GetResult()[0];
                //ShowStrings(part.RemainBeforeFirst(":</i></b></big>").GetResult());
                foreach (Reaper table in part.ReapByProfix("<div align=\"center\"><table border=1 summary=\""))
                {
                    string tableName = table.RemainBeforeFirst("\" width=\"95%\">").GetResult()[0];

                    int lineCount = 0;
                    foreach (Reaper line in table.ReapByProfix("<tr><td>").GiveUpContain("<td>Jan</td><td>Feb</td><td>Mar</td>"))
                    {
                        string lineName = line.RemainBeforeFirst("</td>").GetResult()[0];

                        //repearTime += DateTime.Now - startTime;

                        strWriter.WriteLine("PART:" + partName);
                        strWriter.WriteLine("TABLE:" + tableName);
                        strWriter.WriteLine("LINE:" + lineName);
                        strWriter.WriteLine("NUM:" + ++lineCount);
                        strWriter.Write("DATA:");

                        //startTime = DateTime.Now;

                        foreach (Reaper data in line.ReapByProfix("<td align=\"center\" nowrap>").RemainBeforeFirst("</td>"))
                        {
                            //repearTime += DateTime.Now - startTime;

                            strWriter.Write(data.GetResult()[0] + " ");

                            //startTime = DateTime.Now;
                        }
                        strWriter.WriteLine();
                    }
                }
            }

            //处理HTML的转义符
            string result = strWriter.ToString();

            result = result.Replace("&lt;", "<");
            result = result.Replace("&gt;", ">");
            result = result.Replace("&deg;", "°");
            //处理Average Daily Temperature Range 多出的*
            result = result.Replace("* ", "");

            try
            {
                StreamWriter _outFile = new StreamWriter(_outFileName);
                _outFile.Write(result);
                _outFile.Close();
            }
            catch (Exception ex)
            {
                Program.errLog.WriteLine(ex.Message);
                Program.errLog.Flush();
            }
            //Console.WriteLine("完成:" + _inFileName + " -> " + _outFileName);
            //Console.WriteLine("Reaper\n耗时" + repearTime);
            return(true);
        }
예제 #28
0
 private void Reaper_Tick(object sender, EventArgs e)
 {
     SendKeys.Send("v");
     Reaper.Stop();
 }
예제 #29
0
        public virtual Ship CreatePlayerShip(World world, Vector2 position, int shipID, float rotation,
                                             Vector2 velocity, string playerName, ShipStats shipStats, List <WeaponTypes> weaponTypes, HashSet <int> teams)
        {
            if (PlayerShip != null)
            {
                _teamManager.DeRegisterObject(PlayerShip);
                _targetManager.DeRegisterObject(PlayerShip);
                if (PlayerShip.IsBodyValid)
                {
                    Debugging.DisposeStack.Push(this.ToString());
                    PlayerShip.Body.Dispose();
                }
            }

            if (_shipList.ContainsKey(shipID))
            {
                _positionUpdateList.Remove(_shipList[shipID]);

                _shipList.Remove(shipID);
            }

            Ship tempShip;


            switch (shipStats.ShipType)
            {
            case ShipTypes.Barge:
                tempShip = new Barge(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName,
                                     shipStats, _particleManager,
                                     world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                break;

            case ShipTypes.SuperCoolAwesome3DShip:
                tempShip = new SuperCoolAwesome3DShip(_spriteBatch, GetModel(shipStats.ShipType), position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName,
                                                      shipStats, _particleManager,
                                                      world, teams);
                break;

            case ShipTypes.Reaper:
                tempShip = new Reaper(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName,
                                      shipStats, _particleManager,
                                      world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                break;

            case ShipTypes.BattleCruiser:
                tempShip = new Battlecruiser(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName,
                                             shipStats, _particleManager,
                                             world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                break;

            case ShipTypes.Penguin:
                tempShip = new Penguin(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName,
                                       shipStats, _particleManager,
                                       world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                break;

            case ShipTypes.Dread:
                tempShip = new Dread(position, velocity, rotation, shipID, (int)_clientPlayerInfoManager.PlayerID, playerName,
                                     shipStats, _particleManager,
                                     world, _spriteBatch, GetTexture(shipStats.ShipType), teams);
                break;

            default:
                Console.WriteLine("Ship type not implemented in ClientShipManager.CreatePlayerShip");
                return(null);
            }

            byte slot = 0;

            foreach (var w in weaponTypes)
            {
                tempShip.SetWeapon(_createWeapon(tempShip, _projectileManager, w, slot), slot);
                slot++;
            }

            SetPilot(tempShip, Debugging.IsBot);

            _shipList.Add(tempShip.Id, tempShip);
            _positionUpdateList.Add(tempShip);

            _playerShipManager.PlayerShip = tempShip;
            _teamManager.RegisterObject(tempShip);

            _updateIgnoreList.Add(PlayerShip.Id);


            tempShip.CanLandWarp = true;
            return(tempShip);
        }