Exemplo n.º 1
0
 internal void Merge(IEnumerable <Mission> additional)
 {
     foreach (var m in additional)
     {
         var existing = MissionList.FirstOrDefault((x) => x.ID == m.ID);
         if (existing != null)
         {
             existing.UnlockTime = m.UnlockTime;
             // Refresh cycle will trigger PropertyChanged
         }
         else
         {
             MissionList.Add(m);
         }
     }
 }
Exemplo n.º 2
0
        void LoadMissions()
        {
            if (!Directory.Exists(Locations.ArtemisMissionPath))
            {
                System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(ReLoadMissions));
            }
            else
            {
                MissionList.Clear();
                DirectoryInfo missionDir = new DirectoryInfo(Locations.ArtemisMissionPath);

                foreach (FileInfo f in missionDir.GetFiles("MISS_*.xml", SearchOption.AllDirectories))
                {
                    big_message m = new big_message(f.FullName);
                    if (m != null)
                    {
                        MissionList.Add(m);
                    }
                }
            }
        }
Exemplo n.º 3
0
        public static MissionList LoadMissions(BinaryReader reader, int missionCount)
        {
            var missions = new MissionList();
            for (var i = 0; i < missionCount; i++)
            {
                var mission = new MissionModel();
                mission.Id = reader.ReadInt32();
                mission.Date = GetDateFromValue(reader.ReadInt32());
                mission.ClientName		= new string(reader.ReadChars(10)).TrimEnd();
                mission.RewardAmount	= reader.ReadInt16();
                mission.Type			= (MissionType)reader.ReadByte();
                mission.Difficulty		= (Difficulty)reader.ReadByte();
                mission.TargetStarSystem = Galaxy.StarSystems[reader.ReadByte(), reader.ReadByte()];
                switch (mission.Type)
                {
                    case MissionType.PackageDelivery:	mission.PackageDescription = new string(reader.ReadChars(20)).TrimEnd();	break;
                    case MissionType.GoodsDelivery	:	mission.GoodsToDeliver_Type = (Merchandise)reader.ReadByte();	mission.GoodsToDeliver_Amount = reader.ReadByte();	break;
                    case MissionType.Assassination	:	mission.AssassinationTarget = LoadNPC(reader);		break;
                }
                missions.Add(mission);
            }

            return missions;
        }
Exemplo n.º 4
0
        private async Task LoadMissionTask(string uri)
        {
            MissionList.Clear();
            int o = 0;

            while (true)
            {
                string reqUri         = uri + o;
                string responseString = await SendRequest.GET(reqUri);

                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(responseString);

                HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes(@"//form[@name='frm_mis']/tr");

                int count = 0;

                Regex regex = new Regex(@"# \d+");
                for (int i = 0; i < nodes.Count; i++)
                {
                    if (i == 0 || i == nodes.Count - 1)
                    {
                        continue;
                    }

                    string complete = nodes[i].SelectSingleNode(@"./td[1]/table/tr[@class='m2']//a").GetAttributeValue("href", "");
                    string mark     = nodes[i].SelectSingleNode(@"./td[1]/table/tr[2]//a").GetAttributeValue("href", "");
                    string targetIP = nodes[i].SelectSingleNode(@"./td[2]/table/tr[1]//a/span[@class='green']").InnerText;
                    string type     = nodes[i].SelectSingleNode(@"./td[3]/a/span").InnerText;
                    string detail   = StringHelper.RemoveSpecial(nodes[i].SelectSingleNode(@"./td[4]//td[@align='justify']").InnerText);
                    string reward   = nodes[i].SelectSingleNode(@"./td[5]").InnerText;
                    string fileID   = "";
                    var    match    = regex.Match(detail);
                    if (match.Success)
                    {
                        fileID = match.Value.Replace("#", "").Trim();
                    }

                    MissionModel newData = new MissionModel()
                    {
                        Complete = complete,
                        Mark     = mark,
                        TargetIP = targetIP,
                        Type     = type,
                        Details  = detail,
                        Reward   = reward,
                        FileID   = fileID
                    };
                    MissionList.Add(newData);

                    count++;
                }

                if (count == 0)
                {
                    break;
                }

                o += 50;
            }
        }