TranslateTool.ResXFile.ResXFile C# (CSharp) Method

ResXFile() public method

public ResXFile ( string nonLocalizedFileName, CultureInfo culture ) : System
nonLocalizedFileName string
culture System.Globalization.CultureInfo
return System
        public ResXFile(string nonLocalizedFileName, CultureInfo culture)
        {
            nonLocalizedFileName = Path.GetFullPath(nonLocalizedFileName);

            if (!File.Exists(nonLocalizedFileName))
                throw new ApplicationException(string.Format("File {0} does not exist", nonLocalizedFileName));
            if (string.Compare(Path.GetExtension(nonLocalizedFileName), ".resx", true) != 0)
                throw new ApplicationException(string.Format("File {0} does not have .resx extension", nonLocalizedFileName));

            string fileNameNoExt = Path.GetFileNameWithoutExtension(nonLocalizedFileName);
            if (fileNameNoExt.Contains("."))
                throw new ApplicationException(string.Format("File {0} is already a localized name", nonLocalizedFileName));

            this.NonLocalizedFileName = nonLocalizedFileName;
            this.LocalizedFileName = Path.Combine(Path.GetDirectoryName(nonLocalizedFileName), fileNameNoExt + "." + culture.Name + ".resx");
            this.Culture = culture;
        }