public static TranslationProjectDiff Diff(this ITranslationProject p, ITranslationProject other)
        {
            var tpd = new TranslationProjectDiff();

            tpd.Diff(p.Modules, other.Modules);
            return(tpd);
        }
 public static IEnumerable <TranslationModuleDiff> Diff(ITranslationProject one, ITranslationProject other)
 {
     foreach (var tm in one.Modules)
     {
         if (other.ModuleNames.Contains(tm.Name))
         {
             yield return(tm.Diff(other[tm.Name]));
         }
     }
 }
 public void SyncWith(ITranslationProject other)
 {
     foreach (var tp in Projects)
     {
         if (other.ModuleNames.Contains(tp.Key))
         {
             tp.Value.SyncWith(other[tp.Key]);
         }
     }
 }
示例#4
0
        public static IEnumerable <KeyValuePair <string, ITranslationModule> > ToDir(ITranslationProject tpc, string targetDir)
        {
            Dictionary <string, ITranslationModule> fileNames = new Dictionary <string, ITranslationModule>();

            foreach (var moduleName in tpc.ModuleNames)
            {
                var module = tpc[moduleName];

                var fileName = targetDir + @"\" + moduleName + ".xls";
                IO.Xls.ToXLS(module, fileName);

                fileNames.Add(fileName, module);
            }

            return(fileNames);
        }
        public void Diff(ITranslationProject project1, ITranslationProject project2)
        {
            base.Diff(project1.Modules, project2.Modules);

            DiffPerModule = new Dictionary <string, TranslationModuleDiff>();

            foreach (var tm in this.Updated)
            {
                var tmOrig = this.Orig[tm.Key];
                var tmNew  = tm.Value;

                DiffPerModule.Add(tmOrig.Name, tmOrig.Diff(tmNew));
            }

            /*if (list2.ModuleNames.Contains(tm.Name))
             *      yield return tm.Diff(other[tm.Name]);*/
        }
示例#6
0
        public void ToCSV(ITranslationProject tpc, string targetDir)
        {
            StringBuilder sb       = new StringBuilder();
            string        fileName = "";

            foreach (var moduleName in tpc.ModuleNames)
            {
                var module = tpc[moduleName];
                sb.Append("ns:").AppendLine(moduleName);
                IO.CSV.ToCSV(module, sb, false);

                fileName += "_" + moduleName;
            }

            using (StreamWriter outfile = new StreamWriter(targetDir + @"\" + fileName + ".csv", false, Encoding.UTF8))
                outfile.Write(sb.ToString());
        }
示例#7
0
 public TranslationMemory(ITranslationProject tpCollection)
 {
     Index = TranslationMemoryHelpers.BuildTranslationProjectIndex(tpCollection.Modules);
     this.TranslationProject = tpCollection.Modules.First();
 }
示例#8
0
 public void SyncWith(ITranslationProject other)
 {
     throw new NotImplementedException();
 }