Beispiel #1
0
 public LocString(ResXFile file, string name, string nonLocalized, string comment)
 {
     this.File = file;
     this.Name = name;
     this.NonLocalized = nonLocalized;
     this.Comment = comment;
 }
Beispiel #2
0
        string GetResourcesName(ResXFile resxFile, string directoryPath)
        {
            string newFileName = Path.Combine(directoryPath, Path.GetFileName(resxFile.LocalizedFileName));

            newFileName = Path.ChangeExtension(newFileName, ".resources");
            return(newFileName);
        }
Beispiel #3
0
 public LocString(ResXFile file, string name, string nonLocalized, string comment)
 {
     this.File         = file;
     this.Name         = name;
     this.NonLocalized = nonLocalized;
     this.Comment      = comment;
 }
Beispiel #4
0
        public void WriteResources()
        {
            string filename = GetTestFile("AboutForm.resx");
            ResXFile resXFile = new ResXFile(filename, new CultureInfo("fr"));
            resXFile.Read();

            LocString str = resXFile.GetString("label1.Text");
            str.Localized = "Foo";
            resXFile.Write();

            resXFile = new ResXFile(filename, new CultureInfo("fr"));
            resXFile.Read();

            ICollection<LocString> strings = resXFile.AllStrings;

            foreach (LocString locstr in strings) {
                Console.WriteLine("Name:{0}    NonLocValue:{1}   LocValue:{2}   Comment:{3}", locstr.Name, locstr.NonLocalized, locstr.Localized, locstr.Comment);
            }
        }
Beispiel #5
0
        public void ResXFileName()
        {
            string filename = GetTestFile("AboutForm.resx");
            ResXFile resXFile = new ResXFile(filename, new CultureInfo("de"));

            Assert.AreEqual(filename, resXFile.NonLocalizedFileName, true);
            Assert.AreEqual(GetTestFile("de\\AboutForm.de.resx"), resXFile.LocalizedFileName, true);
            Assert.AreEqual("de", resXFile.Culture.Name);
        }
Beispiel #6
0
        // Convert one resxFile. Returns true on success.
        bool ConvertResX(ResXFile resxFile, string directoryPath)
        {
            int exitCode = programRunner.Run(resgenExeName, string.Format("\"{0}\" \"{1}\"", resxFile.LocalizedFileName, GetResourcesName(resxFile, directoryPath)), Path.GetDirectoryName(resxFile.LocalizedFileName));

            return(exitCode == 0);
        }
Beispiel #7
0
 string GetResourcesName(ResXFile resxFile, string directoryPath)
 {
     string newFileName = Path.Combine(directoryPath, Path.GetFileName(resxFile.LocalizedFileName));
     newFileName = Path.ChangeExtension(newFileName, ".resources");
     return newFileName;
 }
Beispiel #8
0
 // Convert one resxFile. Returns true on success.
 bool ConvertResX(ResXFile resxFile, string directoryPath)
 {
     int exitCode = programRunner.Run(resgenExeName, string.Format("\"{0}\" \"{1}\"", resxFile.LocalizedFileName, GetResourcesName(resxFile, directoryPath)), Path.GetDirectoryName(resxFile.LocalizedFileName));
     return exitCode == 0;
 }