Пример #1
0
        public List <ConsResProperties> GetResourcesByData(string data)
        {
            List <ConsResProperties> resList = new List <ConsResProperties>();

            for (int i = 0; i < Lvl4_strings.Count; i++)
            {
                for (int j = 0; j < Lvl4_strings.ElementAt(i).Strings.Count; j++)
                {
                    if (Lvl4_strings.ElementAt(i).Strings.ElementAt(j).Data.Contains(data))
                    {
                        ConsResProperties crp = new ConsResProperties();
                        crp.Id         = Lvl4_strings.ElementAt(i).Strings.ElementAt(j).Id;
                        crp.LanguageID = (int)Lvl2_Language.ElementAt(i).Name;
                        crp.CodePage   = (int)Lvl3_Data.ElementAt(i).CodePage;
                        crp.Data       = Lvl4_strings.ElementAt(i).Strings.ElementAt(j).Data;
                        crp.Type       = Type;
                        resList.Add(crp);
                    }
                }
            }

            if (resList.Count == 0)
            {
                throw new Exception("No resources contain " + data);
            }

            return(resList);
        }
Пример #2
0
        public List <ConsResProperties> GetResources(string source)
        {
            List <ConsResProperties> resList = new List <ConsResProperties>();

            for (int i = 0; i < Lvl4_strings.Count; i++)
            {
                for (int j = 0; j < Lvl4_strings.ElementAt(i).Strings.Count; j++)
                {
                    ConsResProperties crp = new ConsResProperties();
                    crp.Id         = Lvl4_strings.ElementAt(i).Strings.ElementAt(j).Id;
                    crp.LanguageID = (int)Lvl2_Language.ElementAt(i).Name;
                    crp.CodePage   = (int)Lvl3_Data.ElementAt(i).CodePage;
                    crp.Source     = source;

                    if (Type == ResType.XML)
                    {
                        crp.Data = XMLParser.Parse(Lvl4_strings.ElementAt(i).Strings.ElementAt(j).Data);
                    }
                    else if (Type == ResType.String)
                    {
                        crp.Data = Lvl4_strings.ElementAt(i).Strings.ElementAt(j).Data;
                    }

                    crp.Type = Type;

                    resList.Add(crp);
                }
            }

            return(resList);
        }
Пример #3
0
 public ConsResProperties GetResourceByID(int id)
 {
     for (int i = 0; i < Lvl4_strings.Count; i++)
     {
         for (int j = 0; j < Lvl4_strings.ElementAt(i).Strings.Count; j++)
         {
             if (Lvl4_strings.ElementAt(i).Strings.ElementAt(j).Id == id)
             {
                 ConsResProperties crp = new ConsResProperties();
                 crp.Id         = Lvl4_strings.ElementAt(i).Strings.ElementAt(j).Id;
                 crp.LanguageID = (int)Lvl2_Language.ElementAt(i).Name;
                 crp.CodePage   = (int)Lvl3_Data.ElementAt(i).CodePage;
                 crp.Data       = Lvl4_strings.ElementAt(i).Strings.ElementAt(j).Data;
                 crp.Type       = Type;
                 return(crp);
             }
         }
     }
     throw new Exception("Couldn't find the resource " + id);
 }
Пример #4
0
        public List <ConsResProperties> GetResourcesByType(ResType type)
        {
            List <ConsResProperties> resList = new List <ConsResProperties>();

            if (Type == type)
            {
                for (int i = 0; i < Lvl4_strings.Count; i++)
                {
                    for (int j = 0; j < Lvl4_strings.ElementAt(i).Strings.Count; j++)
                    {
                        ConsResProperties crp = new ConsResProperties();
                        crp.Id         = Lvl4_strings.ElementAt(i).Strings.ElementAt(j).Id;
                        crp.LanguageID = (int)Lvl2_Language.ElementAt(i).Name;
                        crp.CodePage   = (int)Lvl3_Data.ElementAt(i).CodePage;
                        crp.Data       = Lvl4_strings.ElementAt(i).Strings.ElementAt(j).Data;
                        crp.Type       = Type;

                        resList.Add(crp);
                    }
                }
            }

            return(resList);
        }