Пример #1
0
 public Logger(LanguageDictionary lng)
 {
     this.logFileName = DateTime.Now.ToString("yyyyMMdd_HHmmss") + "_log.txt";
     if (!(Directory.Exists(path)))
     {
         Directory.CreateDirectory(path);
     }
     File.AppendAllText(path + this.logFileName,
                        lng.txt["This is log of [TMS Updater] program."] + "\r\n" +
                        lng.txt["(Tool for automatic updating SDLXLIFF files on TMS.)"] + "\r\n" +
                        lng.txt["Created:"] + $" {DateTime.Now.ToString("yyyy-MM-dd, HH:mm:ss")}.\r\n\r\n");
 }
Пример #2
0
        public void Work(string pathToSource, string pathToTMS, Logger logger, LanguageDictionary lng)
        {
            this.lng    = lng;
            this.logger = logger;
            this.logger.Log(lng.txt["Path to new files set to:"] + $"\r\n{pathToSource}");
            this.logger.Log(lng.txt["TMS path set to:"] + $"\r\n{pathToTMS}");

            if (!(ArePathsValid(pathToSource, pathToTMS)))
            {
                return;
            }

            List <string> allFiles = Directory.GetFiles(pathToSource, "*.sdlxliff", SearchOption.AllDirectories).ToList();

            this.logger.Log(lng.txt["Number of sdlxliff files detected:"] + $" {allFiles.Count()}");

            ZipInjector zipInjector = new ZipInjector(pathToTMS, ExtractDataFromAll(allFiles), this.logger, this.lng); //better use the Inversion of Control with Dependency Injection patterns,

            //i.e. pass the ZipInjector as parameter the same way you're passing the logger
            //this makes it clear which component relies on which
            zipInjector.Work();
        }
Пример #3
0
        public GUI(string language)
        {
            InitializeComponent();
            this.lng = new LanguageDictionary(language);
            textBoxPathToSource.Text = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            textBoxPathToTMS.Text    = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            labelSourceFolder.Text   = lng.txt["Folder with new files:"];
            labelTMSFolder.Text      = lng.txt["TMS folder with ZIP files:"];
            buttonSourceBrowse.Text  = lng.txt["Browse"];
            buttonTMSBrowse.Text     = lng.txt["Browse"];
            buttonProceed.Text       = lng.txt["Go!"];

            if (language == "arsa")
            {
                textBoxPathToSource.RightToLeft = RightToLeft.Yes;
                textBoxPathToTMS.RightToLeft    = RightToLeft.Yes;
                labelSourceFolder.RightToLeft   = RightToLeft.Yes;
                labelTMSFolder.RightToLeft      = RightToLeft.Yes;
                buttonSourceBrowse.RightToLeft  = RightToLeft.Yes;
                buttonTMSBrowse.RightToLeft     = RightToLeft.Yes;
                buttonProceed.RightToLeft       = RightToLeft.Yes;
                mainDisplay.RightToLeft         = RightToLeft.Yes;
            }
        }
Пример #4
0
 public ZipInjector(string pathToTMS, List <ExtractedData> extractedData, Logger logger, LanguageDictionary lng)
 {
     this.fullListOfextrData = extractedData;
     this.pathToTMS          = pathToTMS;
     this.logger             = logger;
     this.lng = lng;
 }