Ejemplo 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);
                }
            }
        }
Ejemplo 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);
        }
Ejemplo n.º 3
0
 public VSResxFileGroup(VSFileContainer container, string prefix, string path)
     : base(container, prefix, path)
 {
 }
Ejemplo n.º 4
0
 public ResourceFileBase(VSFileContainer folder, FileInfo file)
 {
     this.file   = file;
     this.folder = folder;
 }
Ejemplo n.º 5
0
 public VSResxFileGroup(VSFileContainer container, string prefix, string path)
     : base(container, prefix, path)
 {
 }
Ejemplo n.º 6
0
 public WixLocalizationFileGroup(VSFileContainer container, string prefix, string path)
     : base(container, prefix, path)
 {
 }
Ejemplo n.º 7
0
 public ResourceFileBase(VSFileContainer folder, FileInfo file)
 {
     this.file = file;
     this.folder = folder;
 }
Ejemplo n.º 8
0
 public VSProjectFolder(VSProject project, VSFileContainer parent, string filepath)
     : base(project, parent, filepath)
 {
     base.Init(filepath);
 }
Ejemplo n.º 9
0
 public VSProjectFolder(VSProject project, VSFileContainer parent, string filepath)
     : base(project, parent, filepath)
 {
     base.Init(filepath);
 }
Ejemplo n.º 10
0
 public VSFileContainer(VSProject project, VSFileContainer parent, string filepath)
 {
     this.Project = project;
     this.Parent = parent;
 }
Ejemplo n.º 11
0
 public ResourceFileGroupBase(VSFileContainer container, string prefix, string path)
 {
     this.prefix    = prefix;
     this.container = container;
     this.path      = path;
 }
Ejemplo 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);
        }
Ejemplo n.º 13
0
 public VSFileContainer(VSProject project, VSFileContainer parent, string filepath)
 {
     Project = project;
     Parent  = parent;
 }
Ejemplo n.º 14
0
 public ResourceFileGroupBase(VSFileContainer container, string prefix, string path)
 {
     this.prefix = prefix;
     this.container = container;
     this.path = path;
 }
Ejemplo 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);
                    }
                }
            }
        }