public override void IsValid()
 {
     if (SectionName == "Course [Section]")
     {
         throw new Exception("Please insert section name");
     }
     if (!SectionName.Contains('[') && !SectionName.Contains(']'))
     {
         throw new Exception("Section name format is invalid. Be sure to use this format: Course [Section]");
     }
 }
示例#2
0
        public static List <string> GetColorSchemes(string SkinName)
        {
            List <string> functionReturnValue = default(List <string>);
            IniFile       SkinIni             = GetSkinIni(SkinName);

            functionReturnValue = new List <string>();
            foreach (string SectionName in SkinIni.SectionsNames)
            {
                if (SectionName.Contains(SkinIDs.ColorSchemes))
                {
                    functionReturnValue.Add(SectionName.Replace(SkinIDs.ColorSchemes, ""));
                }
            }
            return(functionReturnValue);
        }
        public SectionParser(CommandLineLogger logger, ExtractFileInfo fileInfo, bool isPreservation, string preservationPrefix, ParserVersionEnum version)
        {
            ContainsLocationData = false;
            Logger      = logger;
            FileInfo    = fileInfo;
            SourceFile  = FileInfo.OriginalFile_Path;
            SectionName = Path.GetFileNameWithoutExtension(FileInfo.File_Name);

            List <string> sectionStrings = new List <string>();

            if (SectionName.Contains("_"))
            {
                sectionStrings = SectionName.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries).ToList();
            }
            else if (SectionName.Contains("_"))
            {
                sectionStrings = SectionName.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries).ToList();
            }
            if (!sectionStrings.Any())
            {
                sectionStrings.Add(SectionName);
            }

            List <string> sectionStringsUpper = new List <string>();
            string        temp = string.Empty;

            foreach (string s in sectionStrings)
            {
                sectionStringsUpper.Add(s.First().ToString().ToUpper() + s.Substring(1));
            }

            IsPreservation     = isPreservation;
            PreservationPrefix = preservationPrefix;
            ParserVersion      = version;

            MainTableName = string.Join("", sectionStringsUpper);
            if (isPreservation)
            {
                MainTableName = PreservationPrefix + "_" + MainTableName;
            }
            DisplaySectionName = string.Join(" ", sectionStringsUpper);

            LoadHtml();
            ProcessHTML();
        }
示例#4
0
        /// <summary>
        /// Sjekker om denne instansen matcher et gitt pattern
        /// </summary>
        /// <param name="pattern">Pattern å matche mot. * er eneste wildcard.</param>
        /// <returns>true om det er match, false ellers</returns>
        public bool IsMatch(string pattern)
        {
            var split = pattern.Split(":".ToCharArray());

            if (split.Length > 0) // Vi har seksjon.
            {
                if (split[0] != "*" && split[0] != "")
                {
                    if (!SectionName.Contains(split[0]))
                    {
                        return(false);
                    }
                }
            }
            if (split.Length > 1) // Vi har rad.
            {
                if (split[1] != "*" && split[1] != "")
                {
                    if (RowName != split[1])
                    {
                        return(false);
                    }
                }
            }
            if (split.Length > 2) // Vi har sete.
            {
                if (split[2] != "*" && split[2] != "")
                {
                    if (SeatName != split[2])
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }