Ejemplo n.º 1
0
        public static IEnumerable <Session> FindSessions(string[] speakerNames = null, string[] topics = null, string companyName = null, LevelTypes level = LevelTypes.Any)
        {
            var localSpeakerNames = speakerNames;

            if (!String.IsNullOrWhiteSpace(companyName))
            {
                localSpeakerNames = Speakers.Where(k => k.Company.ContainsIgnoreCase(companyName)).Select(k => k.Name).ToArray();
            }
            var topicsRegex = topics?.GetWholeWordsRegex();

            return(CodeCamp.Sessions
                   .Where(s =>
                          localSpeakerNames == null ||
                          localSpeakerNames.Length == 0 ||
                          s.Speakers.ContainIgnoreCase(localSpeakerNames))

                   .Where(s =>
                          topics == null ||
                          (topics.ContainIgnoreCase("misc") && s.AllTracks == true) ||
                          s.Title.RegexMatch(topicsRegex) ||
                          s.Description.RegexMatch(topicsRegex))

                   .Where(s =>
                          level == LevelTypes.None ||
                          level == LevelTypes.Any ||
                          s.Level.ContainsIgnoreCase(level.ToString()))

                   .OrderBy(s => s.StartTime)
                   .Take(10));
        }
Ejemplo n.º 2
0
    public void ExportToXML(XmlElement allLevel_ele)
    {
        XmlDocument doc      = allLevel_ele.OwnerDocument;
        XmlElement  old_node = null;

        foreach (XmlElement level_node in allLevel_ele.ChildNodes)
        {
            if (level_node.Attributes["name_en"].Value.Equals(LevelNames["en"]))
            {
                old_node = level_node;
            }
        }

        if (old_node != null)
        {
            allLevel_ele.RemoveChild(old_node);
        }

        XmlElement level_ele = doc.CreateElement("LevelInfo");

        allLevel_ele.AppendChild(level_ele);
        level_ele.SetAttribute("name_en", LevelNames["en"]);
        level_ele.SetAttribute("name_zh", LevelNames["zh"]);
        level_ele.SetAttribute("picID", LevelPicID.ToString());
        level_ele.SetAttribute("levelType", LevelType.ToString());
        level_ele.SetAttribute("difficultyLevel", DifficultyLevel.ToString());

        ChildrenExportToXML(level_ele);
    }
Ejemplo n.º 3
0
    public void LoadObstaclesFromState(LevelTypes levelType, int[][] positions = null)
    {
        if (positions == null) {
            LoadObstacleSet(levelType.ToString());
        } else {
            string obstacleName = "";
            string tooltip = "";
            if (levelType == LevelTypes.Rocks || levelType == LevelTypes.FewRocks) {
                obstacleName = "Rock";
                tooltip = "A sturdy rock. Won't break, even if you punch it.";
            }

            foreach (int[] position in positions) {
                LoadObstacleBase(obstacleName, position[0], position[1], tooltip);
            }
        }

        CurrentLevelType = levelType;
    }
Ejemplo n.º 4
0
    public void LoadObstaclesFromState(LevelTypes levelType, int[][] positions = null)
    {
        if (positions == null)
        {
            LoadObstacleSet(levelType.ToString());
        }
        else
        {
            string obstacleName = "";
            string tooltip      = "";
            if (levelType == LevelTypes.Rocks || levelType == LevelTypes.FewRocks)
            {
                obstacleName = "Rock";
                tooltip      = "A sturdy rock. Won't break, even if you punch it.";
            }

            foreach (int[] position in positions)
            {
                LoadObstacleBase(obstacleName, position[0], position[1], tooltip);
            }
        }

        CurrentLevelType = levelType;
    }