Esempio n. 1
0
 public override void CreateResourceDataComment(string name, string comment)
 {
     VSResxData resxData = new VSResxData(this, name);
     resxData.Comment = comment;
     Data.Add(name, resxData);
     this.FileGroup.AllData[name].Add(resxData);
 }
Esempio n. 2
0
 public override void CreateResourceData(string name, string value)
 {
     VSResxData resxData = new VSResxData(this, name);
     resxData.Value = value;
     Data.Add(name, resxData);
     this.FileGroup.AllData[name].Add(resxData);
 }
Esempio n. 3
0
        public override void CreateResourceDataComment(string name, string comment)
        {
            VSResxData resxData = new VSResxData(this, name);

            resxData.Comment = comment;
            Data.Add(name, resxData);
            this.FileGroup.AllData[name].Add(resxData);
        }
Esempio n. 4
0
        public override void CreateResourceData(string name, string value)
        {
            VSResxData resxData = new VSResxData(this, name);

            resxData.Value = value;
            Data.Add(name, resxData);
            this.FileGroup.AllData[name].Add(resxData);
        }
Esempio n. 5
0
        public VSResxFile(VSFileContainer folder, FileInfo file)
            : base(folder, file)
        {
            using (XmlReader reader = new XmlTextReader(file.FullName))
            {
                XPathDocument xml = new XPathDocument(reader);
                XPathNavigator nav = xml.CreateNavigator();
                XPathNodeIterator nodes = nav.Select("/root/data[count(@type) = 0 and count(@mimetype) = 0]");
                while (nodes.MoveNext())
                {
                    VSResxData d = new VSResxData(this, nodes.Current);

                    if (!Data.ContainsKey(d.Name))
                        Data.Add(d.Name, d);
                }
            }

            string[] parts = file.Name.Split('.');
            if (parts.Length >= 2)
            {
                int posCultureInfo = parts.Length - 2;
                if (parts[posCultureInfo] == "asax" ||
                    parts[posCultureInfo] == "aspx" ||
                    parts[posCultureInfo] == "ascx")
                {
                    posCultureInfo--;
                }

                try
                {
                    Culture = CultureInfo.GetCultureInfo(parts[posCultureInfo]);
                    IsCultureAutoDetected = true;
                    Prefix = buildPrefix(parts, posCultureInfo);

                    if (Prefix.LastIndexOf('.') == Prefix.Length - 1)
                        Prefix = Prefix.Substring(0, Prefix.Length - 1);
                }
                catch
                {
                    Culture = CultureInfo.InvariantCulture;
                }
            }

            if (Prefix == null || Prefix == "")
            {
                Prefix = Path.GetFileNameWithoutExtension(file.Name);
            }

            folder.Project.ResxProjectFile.LoadFile(this);
        }
Esempio n. 6
0
        public VSResxFile(VSFileContainer folder, FileInfo file)
            : base(folder, file)
        {
            using (XmlReader reader = new XmlTextReader(file.FullName))
            {
                XPathDocument     xml   = new XPathDocument(reader);
                XPathNavigator    nav   = xml.CreateNavigator();
                XPathNodeIterator nodes = nav.Select("/root/data[count(@type) = 0 and count(@mimetype) = 0]");
                while (nodes.MoveNext())
                {
                    var d = new VSResxData(this, nodes.Current);

                    if (folder.Project.SkipGroup(d.Name))
                    {
                        continue;
                    }

                    if (!Data.ContainsKey(d.Name))
                    {
                        Data.Add(d.Name, d);
                    }
                }
            }

            string[] parts = file.Name.Split('.');
            if (parts.Length >= 2)
            {
                int posCultureInfo = parts.Length - 2;
                if (parts[posCultureInfo] == "asax" ||
                    parts[posCultureInfo] == "aspx" ||
                    parts[posCultureInfo] == "ascx")
                {
                    posCultureInfo--;
                }

                try
                {
                    if (posCultureInfo == 0)
                    {
                        Culture = CultureInfo.InvariantCulture;
                    }
                    else
                    {
                        Culture = CultureInfo.GetCultureInfo(parts[posCultureInfo]);
                        IsCultureAutoDetected = true;
                        Prefix = buildPrefix(parts, posCultureInfo);

                        if (Prefix.LastIndexOf('.') == Prefix.Length - 1)
                        {
                            Prefix = Prefix.Substring(0, Prefix.Length - 1);
                        }
                    }
                }
                catch
                {
                    Culture = CultureInfo.InvariantCulture;
                }
            }

            if (Prefix == null || Prefix == "")
            {
                Prefix = Path.GetFileNameWithoutExtension(file.Name);
            }

            folder.Project.ResxProjectFile.LoadFile(this);
        }