Пример #1
0
        public override bool Equals(object obj)
        {
            var game = obj as Game;

            if (game == null)
            {
                return(false);
            }

            return(GID.Equals(game.GID));
        }
Пример #2
0
        public bool CheckSearch(Group group)
        {
            if (null == group)
            {
                throw new ArgumentNullException("group", "The group cannot be NULL in a search.");
            }

            bool result = true;

            result &= true == IsNameSet?Name.Equals(group.Name) : true;

            result &= true == IsGIDSet?GID.Equals(group.GID) : true;

            result &= true == IsMembersSet?Members.ContainsAny(group.Members) : true;

            return(result);
        }
Пример #3
0
        public bool CheckSearch(User user)
        {
            if (null == user)
            {
                throw new ArgumentNullException("user", "The user cannot be NULL in a search.");
            }

            bool result = true;

            result &= true == IsNameSet?Name.Equals(user.Name) : true;

            result &= true == IsUIDSet?UID.Equals(user.UID) : true;

            result &= true == IsGIDSet?GID.Equals(user.GID) : true;

            result &= true == IsCommentSet?Comment.Equals(user.Comment) : true;

            result &= true == IsHomeSet?Home.Equals(user.Home) : true;

            result &= true == IsShellSet?Shell.Equals(user.Shell) : true;

            return(result);
        }
Пример #4
0
        public void Action()
        {
            var    CV = UpCall.TD.Villages[VillageID];
            int    GID;
            var    Q = this;
            string mat_str, id, c;
            Match  m;
            string result;

            switch (ResearchType)
            {
            case TResearchType.Research:
                if (!CV.Upgrades[Aid].CanResearch)
                {
                    MarkDeleted  = true;
                    UpCall.Dirty = true;
                    UpCall.CallStatusUpdate(this, new Travian.StatusChanged()
                    {
                        ChangedData = Travian.ChangedType.Queue, VillageID = VillageID
                    });
                    return;
                }
                GID    = 22;
                result = UpCall.PageQuery(VillageID, "build.php?gid=" + GID.ToString());
                if (result == null)
                {
                    return;
                }
                mat_str = "'build.php\\?id=(\\d+)&a=" + Aid.ToString() + "&c=([^']*?)'";
                m       = Regex.Match(result, mat_str);
                if (!m.Success)
                {
                    return;
                }
                id     = m.Groups[1].Value;
                c      = m.Groups[2].Value;
                result = UpCall.PageQuery(VillageID, "build.php?id=" + id + "&a=" + Aid.ToString() + "&c=" + c);
                break;

            case TResearchType.UpTroopLevel:
                if (TargetLevel != 0 && CV.Upgrades[Aid].troop_lvl >= TargetLevel || CV.Upgrades[Aid].troop_lvl >= CV.SmithyLevel)
                {
                    MarkDeleted  = true;
                    UpCall.Dirty = true;
                    UpCall.CallStatusUpdate(this, new Travian.StatusChanged()
                    {
                        ChangedData = Travian.ChangedType.Queue, VillageID = VillageID
                    });
                    return;
                }
                GID    = 13;
                result = UpCall.PageQuery(VillageID, "build.php?gid=" + GID.ToString());
                if (result == null)
                {
                    return;
                }
                mat_str = "'build.php\\?id=(\\d+)&a=" + Aid.ToString() + "&c=([^']*?)'";
                m       = Regex.Match(result, mat_str, RegexOptions.Singleline);
                if (!m.Success)
                {
                    return;
                }
                id     = m.Groups[1].Value;
                c      = m.Groups[2].Value;
                result = UpCall.PageQuery(VillageID, "build.php?id=" + id + "&a=" + Aid.ToString() + "&c=" + c);
                break;

            default:
                return;
            }
            UpCall.BuildCount();

            if (TargetLevel == 0 || ResearchType == TResearchType.Research)
            {
                MarkDeleted  = true;
                UpCall.Dirty = true;
                UpCall.CallStatusUpdate(this, new Travian.StatusChanged()
                {
                    ChangedData = Travian.ChangedType.Queue, VillageID = VillageID
                });
            }
            else if (ResearchType == TResearchType.UpTroopLevel)
            {
                if (CV.Upgrades[Aid].troop_lvl >= TargetLevel || CV.Upgrades[Aid].troop_lvl >= CV.SmithyLevel)
                {
                    MarkDeleted  = true;
                    UpCall.Dirty = true;
                    UpCall.CallStatusUpdate(this, new Travian.StatusChanged()
                    {
                        ChangedData = Travian.ChangedType.Queue, VillageID = VillageID
                    });
                }
            }

            UpCall.CallStatusUpdate(this, new Travian.StatusChanged()
            {
                ChangedData = Travian.ChangedType.Research, VillageID = VillageID
            });
        }
Пример #5
0
 public static bool GenLEUXmlFile(this LEUXmlGen instance, LEU_filtered_values.leu leurf, GID gid, string filename)
 {
     return((bool)MethodHelper.InvokePrivateMethod <LEUXmlGen>(instance, "GenLEUXmlFile", new object[] { leurf, gid, filename }));
 }
Пример #6
0
        public bool Configure()
        {
            if (Option.BEACON == option)
            {
                //读取beacon layout文件
                List <XmlVisitor> beaconList = xmlBeaconInfo.Children().ToList();
                if (null != beaconList)
                {
                    foreach (XmlVisitor node in beaconList)
                    {
                        BeaconLayout beacon = new BeaconLayout();
                        if (!beacon.SetBeacon(node))
                        {
                            logMsg = string.Format("Read Beacon.ID = {0}  error, please check!", beacon.ID);
                            WriteLog(logMsg, LogManager.Level.Error);
                            continue;
                        }
                        BeaconInfoList.Add(beacon);
                    }
                }
            }
            else if (Option.BMV == option)
            {
                //读取beacon layout文件
                List <XmlVisitor> beaconList = xmlBeaconInfo.Children().ToList();
                if (null != beaconList)
                {
                    foreach (XmlVisitor node in beaconList)
                    {
                        BeaconLayout beacon = new BeaconLayout();
                        if (!beacon.SetBeacon(node))
                        {
                            logMsg = string.Format("Read Beacon.ID = {0} error in beacon layout file, please check!", beacon.ID);
                            WriteLog(logMsg, LogManager.Level.Error);
                            continue;
                        }
                        BeaconInfoList.Add(beacon);
                    }
                }

                try
                {
                    ReadSyDB readSydb = new ReadSyDB(xmlSyDBInfo);
                    //计算LINE.ID
                    sydb.LineID = readSydb.ReadLineId();
                    //读SYDB的IBBM表
                    sydb.ibbmInfoList = readSydb.ReadIBBM();
                    //读SYDB的route表
                    sydb.routeInfoList = readSydb.ReadRoute();
                    //读取SYDB的signal表
                    sydb.signalInfoList = readSydb.ReadSignal();
                    //读取SYDB的block表
                    sydb.blockInfoList = readSydb.ReadBlock();
                    //读取SYDB的point表
                    sydb.pointInfoList = readSydb.ReadPoint();
                    //读取SYDB的overlap表
                    sydb.overlapInfoList = readSydb.ReadOverlap();
                    //读取SYDB的TFC表
                    sydb.tfcInfoList = readSydb.ReadTFC();
                    //读取SYDB的TFC表
                    sydb.sddbInfoList = readSydb.ReadSDDB();
                }
                catch (System.Exception ex)
                {
                    logMsg = "Read sydb data error, please check!";
                    WriteLog(logMsg, LogManager.Level.Error);
                    return(false);
                }
            }
            else if (Option.LEURF == option)
            {
                //读取BMV文件
                this.lineID = DataOpr.Xmlattr2Int(xmlBMVInfo, "LINE_ID");
                List <XmlVisitor> bmvList = xmlBMVInfo.Children().ToList();
                if (null != bmvList)
                {
                    foreach (XmlVisitor node in bmvList)
                    {
                        BMVBeaconInfo bm = new BMVBeaconInfo(node);
                        BmvInfoList.Add(bm.GetBMBeaconInfo());
                    }
                }
            }
            else if (Option.LEUXML == option)
            {
                this.lineID = DataOpr.Xmlattr2Int(xmlLEURFInfo, "LINE_ID");
                List <XmlVisitor> leuList = xmlLEURFInfo.Children().ToList();
                if (null != leuList)
                {
                    foreach (XmlVisitor node in leuList)
                    {
                        LEURF leu = new LEURF();
                        if (!leu.Read(node))
                        {
                            logMsg = string.Format("Read LEU.ID = {0} error int LEU result filtered file, please check!", leu.leuId);
                            WriteLog(logMsg, LogManager.Level.Error);
                            continue;
                        }
                        LeuInfoList.Add(leu);
                    }
                }
                //根据Config文件夹下GID-Table文件的内容计算伪随机数列表
                string       filename = System.IO.Directory.GetCurrentDirectory() + "\\Config\\GID-Table.txt";
                StreamReader sr       = new StreamReader(filename);
                string       line     = null;
                while ((line = sr.ReadLine()) != null)
                {
                    string[] gids = line.Split(',');
                    if (gids.Length < 3)
                    {
                        continue;
                    }
                    GID gid = new GID();
                    gid.ibGid  = gids[0];
                    gid.ouGid  = gids[1];
                    gid.netGid = gids[2];
                    GidInfoList.Add(gid);
                }
            }
            return(true);
        }
Пример #7
0
 public override int GetHashCode()
 {
     return(GID.GetHashCode());
 }