Ejemplo n.º 1
0
        public override bool Execute()
        {
            if (String.IsNullOrEmpty(DataFile))
            {
                DataFile = Path.Combine(OutputDirectory, "data.xml");
            }
            if (File.Exists(DataFile) && Incremental)
            {
                DateTime lastWriteTimeUtc = File.GetLastWriteTimeUtc(DataFile);
                ServiceUrl += "," + lastWriteTimeUtc.ToString("yyyyMMddHHmmss");
            }
            Directory.CreateDirectory(OutputDirectory);
            using (var client = new WebClient())
            {
                Log.LogMessage(String.Format(Resources.Messages.DownloadingDataFrom, ServiceUrl));
                client.DownloadProgressChanged += WebClientDownloadProgressChanged;

                Task downloadFile = client.DownloadFileTaskAsync(ServiceUrl, DataFile);
                Task.WaitAll(downloadFile);
            }
            string dataFile = DataFile;

            Directory.CreateDirectory(OutputDirectory);

            string[] cultures = Culture.Split(new char[] { ',' });
            foreach (string culture in cultures)
            {
                Log.LogMessage(String.Format(Resources.Messages.StartCultureResxGeneration, culture));
                DataToResx.ToResx(dataFile, culture, OutputDirectory);
            }
            return(true);
        }
        public void TestResxGeneration()
        {
            string dataFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "data.xml");

            Directory.CreateDirectory("c:\\testlocalization");
            DataToResx.ToResx(dataFile, "pt", "c:\\testlocalization");
        }