Esempio n. 1
0
        public WixLocalizationFile(VSFileContainer folder, FileInfo file)
            : base(folder, file)
        {
            var r = new Regex(".([a-zA-Z]{2,2}([-][a-zA-Z]{2,2})*).wxl");
            var m = r.Match(file.Name);

            if (m.Success)
                Prefix = file.Name.Substring(0, file.Name.Length - m.Value.Length);
            else
                Prefix = Path.GetFileNameWithoutExtension(file.Name);

            using (XmlReader reader = new XmlTextReader(file.FullName))
            {
                XPathDocument xml = new XPathDocument(reader);

                XPathNavigator nav = xml.CreateNavigator();
                XmlNamespaceManager manager = new XmlNamespaceManager(nav.NameTable);
                manager.AddNamespace("wix", NS_WIX_2006);

                //XPathExpression expr = XPathExpression.Compile("/wix:WixLocalization");
                //expr.SetContext(manager);

                XPathNavigator cult = nav.SelectSingleNode("/wix:WixLocalization", manager);
                if (cult != null && !String.IsNullOrEmpty(cult.GetAttribute("Culture", "")))
                {
                    try
                    {
                        Culture = CultureInfo.GetCultureInfo(cult.GetAttribute("Culture", ""));
                        IsCultureAutoDetected = true;
                    }
                    catch
                    {
                        Culture = CultureInfo.InvariantCulture;
                    }
                }
                else
                    Culture = CultureInfo.InvariantCulture;

                folder.Project.ResxProjectFile.LoadFile(this);

                //expr = XPathExpression.Compile("/wix:WixLocalization/wix:String");
                //expr.SetContext(manager);

                XPathNodeIterator nodes = nav.Select("/wix:WixLocalization/wix:String", manager);
                while (nodes.MoveNext())
                {
                    WixLocalizationData d = new WixLocalizationData(this, nodes.Current);

                    if (!Data.ContainsKey(d.Name))
                        Data.Add(d.Name, d);
                }
            }
        }
Esempio n. 2
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. 3
0
 public VSResxFileGroup(VSFileContainer container, string prefix, string path)
     : base(container, prefix, path)
 {
 }
Esempio n. 4
0
 public ResourceFileBase(VSFileContainer folder, FileInfo file)
 {
     this.file   = file;
     this.folder = folder;
 }
Esempio n. 5
0
 public VSResxFileGroup(VSFileContainer container, string prefix, string path)
     : base(container, prefix, path)
 {
 }
Esempio n. 6
0
 public WixLocalizationFileGroup(VSFileContainer container, string prefix, string path)
     : base(container, prefix, path)
 {
 }
Esempio n. 7
0
 public ResourceFileBase(VSFileContainer folder, FileInfo file)
 {
     this.file = file;
     this.folder = folder;
 }
Esempio n. 8
0
 public VSProjectFolder(VSProject project, VSFileContainer parent, string filepath)
     : base(project, parent, filepath)
 {
     base.Init(filepath);
 }
Esempio n. 9
0
 public VSProjectFolder(VSProject project, VSFileContainer parent, string filepath)
     : base(project, parent, filepath)
 {
     base.Init(filepath);
 }
Esempio n. 10
0
 public VSFileContainer(VSProject project, VSFileContainer parent, string filepath)
 {
     this.Project = project;
     this.Parent = parent;
 }
Esempio n. 11
0
 public ResourceFileGroupBase(VSFileContainer container, string prefix, string path)
 {
     this.prefix    = prefix;
     this.container = container;
     this.path      = path;
 }
Esempio n. 12
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);
        }
Esempio n. 13
0
 public VSFileContainer(VSProject project, VSFileContainer parent, string filepath)
 {
     Project = project;
     Parent  = parent;
 }
Esempio n. 14
0
 public ResourceFileGroupBase(VSFileContainer container, string prefix, string path)
 {
     this.prefix = prefix;
     this.container = container;
     this.path = path;
 }
Esempio n. 15
0
        public WixLocalizationFile(VSFileContainer folder, FileInfo file)
            : base(folder, file)
        {
            var r = new Regex(".([a-zA-Z]{2,2}([-][a-zA-Z]{2,2})*).wxl");
            var m = r.Match(file.Name);

            if (m.Success)
            {
                Prefix = file.Name.Substring(0, file.Name.Length - m.Value.Length);
            }
            else
            {
                Prefix = Path.GetFileNameWithoutExtension(file.Name);
            }

            using (XmlReader reader = new XmlTextReader(file.FullName))
            {
                XPathDocument xml = new XPathDocument(reader);

                XPathNavigator      nav     = xml.CreateNavigator();
                XmlNamespaceManager manager = new XmlNamespaceManager(nav.NameTable);
                manager.AddNamespace("wix", NS_WIX_2006);

                //XPathExpression expr = XPathExpression.Compile("/wix:WixLocalization");
                //expr.SetContext(manager);

                XPathNavigator cult = nav.SelectSingleNode("/wix:WixLocalization", manager);
                if (cult != null && !String.IsNullOrEmpty(cult.GetAttribute("Culture", "")))
                {
                    try
                    {
                        Culture = CultureInfo.GetCultureInfo(cult.GetAttribute("Culture", ""));
                        IsCultureAutoDetected = true;
                    }
                    catch
                    {
                        Culture = CultureInfo.InvariantCulture;
                    }
                }
                else
                {
                    Culture = CultureInfo.InvariantCulture;
                }

                folder.Project.ResxProjectFile.LoadFile(this);

                //expr = XPathExpression.Compile("/wix:WixLocalization/wix:String");
                //expr.SetContext(manager);

                XPathNodeIterator nodes = nav.Select("/wix:WixLocalization/wix:String", manager);
                while (nodes.MoveNext())
                {
                    var d = new WixLocalizationData(this, nodes.Current);

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

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