Пример #1
0
        public override IResourceFile CreateNewFile(CultureInfo culture)
        {
            Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ResourceManager.Templates.EmptyResxFile.xml");
            XmlDocument xml = new XmlDocument();
            xml.Load(stream);

            string filepath = Path.Combine(this.FileGroupPath, this.Prefix + "." + culture.Name + ".resx");
            xml.Save(filepath);

            VSResxFile vsfile = new VSResxFile(this.Container, new FileInfo(filepath));
            this.Add(vsfile);

            return vsfile;
        }
Пример #2
0
        public VSResxData(VSResxFile file, XPathNavigator nav)
            : base(file)
        {
            Name = nav.GetAttribute("name", "");

            XPathNodeIterator values = nav.Select("value");
            if (values.MoveNext())
            {
                xmlValue = values.Current.Value;
            }
            values = nav.Select("comment");
            if (values.MoveNext())
            {
                comment = values.Current.Value;
            }
        }
Пример #3
0
        public override IResourceFile CreateNewFile(CultureInfo culture)
        {
            Stream      stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ResourceManager.Templates.EmptyResxFile.xml");
            XmlDocument xml    = new XmlDocument();

            xml.Load(stream);

            string filepath = Path.Combine(this.FileGroupPath, this.Prefix + "." + culture.Name + ".resx");

            xml.Save(filepath);

            VSResxFile vsfile = new VSResxFile(this.Container, new FileInfo(filepath));

            this.Add(vsfile);

            return(vsfile);
        }
Пример #4
0
        public VSResxData(VSResxFile file, XPathNavigator nav)
            : base(file)
        {
            Name = nav.GetAttribute("name", "");

            XPathNodeIterator values = nav.Select("value");

            if (values.MoveNext())
            {
                xmlValue = values.Current.Value;
            }
            values = nav.Select("comment");
            if (values.MoveNext())
            {
                comment = values.Current.Value;
            }
        }
Пример #5
0
        protected virtual void Init(string filepath)
        {
            directory = new DirectoryInfo(Path.Combine(Project.Solution.SolutionDirectory.FullName, filepath));

            IResourceFile resxfile = null;
            FileInfo[] files = directory.GetFiles("*.resx", SearchOption.TopDirectoryOnly);
            Files = new List<IResourceFile>();
            foreach (FileInfo file in files)
            {
                resxfile = new VSResxFile(this, file);

                string fileGroupId = this.ID + "_" + resxfile.Prefix;

                if (!Project.ResxGroups.ContainsKey(fileGroupId))
                    Project.ResxGroups.Add(fileGroupId, new VSResxFileGroup(this, resxfile.Prefix, file.DirectoryName));

                Project.ResxGroups[fileGroupId].Add(resxfile);
                Files.Add(resxfile);
            }

            // Localization file for Windows Installer XML toolkit (WiX)
            files = directory.GetFiles("*.wxl", SearchOption.TopDirectoryOnly);
            foreach (FileInfo file in files)
            {
                resxfile = new WixLocalizationFile(this, file);

                string fileGroupId = this.ID + "_" + resxfile.Prefix;
                if (!Project.ResxGroups.ContainsKey(fileGroupId))
                    Project.ResxGroups.Add(fileGroupId, new VSResxFileGroup(this, resxfile.Prefix, file.DirectoryName));

                Project.ResxGroups[fileGroupId].Add(resxfile);
                Files.Add(resxfile);
            }

            Directories = new List<VSProjectFolder>();
            foreach (DirectoryInfo dir in directory.GetDirectories())
            {
                if (dir.Name == "obj" || dir.Name == "bin")
                    continue;

                VSProjectFolder folder = new VSProjectFolder(Project, this, dir.FullName);

                if (folder.ContainsFiles())
                    Directories.Add(folder);
            }
        }
Пример #6
0
 public VSResxData(VSResxFile file, string name)
     : base(file, name)
 {
 }
Пример #7
0
        protected virtual void Init(string filepath)
        {
            directory = new DirectoryInfo(Path.Combine(Project.Solution.SolutionDirectory.FullName, filepath));

            IResourceFile resxfile = null;

            FileInfo[] files = directory.GetFiles("*.resx", SearchOption.TopDirectoryOnly);
            Files = new List <IResourceFile>();
            foreach (FileInfo file in files)
            {
                if (Project.SkipFile(file.Name))
                {
                    continue;
                }

                resxfile = new VSResxFile(this, file);

                string fileGroupId = this.ID + "_" + resxfile.Prefix;

                if (!Project.ResxGroups.ContainsKey(fileGroupId))
                {
                    Project.ResxGroups.Add(fileGroupId, new VSResxFileGroup(this, resxfile.Prefix, file.DirectoryName));
                }

                Project.ResxGroups[fileGroupId].Add(resxfile);
                Files.Add(resxfile);
            }

            // Localization file for Windows Installer XML toolkit (WiX)
            files = directory.GetFiles("*.wxl", SearchOption.TopDirectoryOnly);
            foreach (FileInfo file in files)
            {
                if (Project.SkipFile(file.Name))
                {
                    continue;
                }

                resxfile = new WixLocalizationFile(this, file);

                string fileGroupId = this.ID + "_" + resxfile.Prefix;
                if (!Project.ResxGroups.ContainsKey(fileGroupId))
                {
                    Project.ResxGroups.Add(fileGroupId, new VSResxFileGroup(this, resxfile.Prefix, file.DirectoryName));
                }

                Project.ResxGroups[fileGroupId].Add(resxfile);
                Files.Add(resxfile);
            }

            Directories = new List <VSProjectFolder>();
            foreach (DirectoryInfo dir in directory.GetDirectories())
            {
                if (dir.Name == "obj" || dir.Name == "bin")
                {
                    continue;
                }
                if (Project.SkipDirectory(dir.Name))
                {
                    continue;
                }

                var folder = new VSProjectFolder(Project, this, dir.FullName);

                if (folder.ContainsFiles())
                {
                    Directories.Add(folder);
                }
            }
        }
Пример #8
0
 public VSResxData(VSResxFile file, string name)
     : base(file, name)
 {
 }