static void CreateEnglishMap(LineIds line, string basicPath) { ScanDir sd = new ScanDir(); sd.BasicPath = basicPath; sd.FileMask = @"(?i:\.xml)$"; QuestionPool res = new QuestionPool() { Line = line }; res.Pointers = sd.FileName(FileNameMode.RelPath).Select(fn => fn.ToLower()).Where(fn => !fn.StartsWith("map")).Select(fn => createPointer(basicPath, fn)).Where(p => p != null).ToArray(); XmlUtils.ObjectToFile(basicPath + "\\map.xml", res); }
public static string BuildProductNew(string prodId) { try { ProductsDefine.productDescrNew prod = (ProductsDefine.productDescrNew)ProductsDefine.Lib.findProduct(prodId); prod.refreshLessons(); //JSON data cviceni var res = run(prod.Modules(), true); if (res.IndexOf("******* ERROR: ") >= 0) return res.Replace("\r", "\r\n<br/>"); //JSON nastrihani zvuku ScanDir sd = new ScanDir(); var bp = Machines.basicPath + @"rew\Web4\RwCourses\" + prod.dataPath; sd.BasicPath = Machines.basicPath + @"rew\Web4\RwCourses\" + prod.dataPath; sd.FileMask = @"(?i:\.(lst))$"; foreach (var fn in sd.FileName(FileNameMode.FullPath)) { CourseModel.SndFile sf = XmlUtils.FileToObject<CourseModel.SndFile>(fn); string sfStr = CourseModel.Lib.ObjectToJson(sf); File.WriteAllText(Path.ChangeExtension(fn, ".json"), sfStr); } //sitemap CoursesSitemap.courseSitemapWithLoc(prod, false); return null; } catch (Exception exp) { return LowUtils.ExceptionToString(exp, true, true); } }
public static void RefreshTrados() { ScanDir sd = new ScanDir(); var bp = Machines.basicPath + @"rew\Web4"; sd.BasicPath = bp; sd.FileMask = @"(?i:\.(ts|html))$"; sd.FileMask = @"(?i:\.(ts))$"; sd.DirsToResult = false; using (var str = File.OpenWrite(@"c:\temp\trados.txt")) using (var wr = new StreamWriter(str)) foreach (var fn in sd.FileName(FileNameMode.FullPath)) { if (File.ReadAllText(fn).IndexOf("CSLocalize") >= 0) { wr.WriteLine(string.Format("<string>{0}</string>", fn.Substring(bp.Length))); } } }
static IEnumerable<Consts.file> mediaFiles(Config cfg) { ProductsDefine.productDescrNew prod = cfg.prod as ProductsDefine.productDescrNew; if (prod == null) yield break; ScanDir sd = new ScanDir(); sd.BasicPath = basicPath + @"RwCourses\" + prod.dataPath.Replace('/', '\\'); sd.DirsToResult = false; sd.FileMask = @"(?i:\.(wmv|png|mp3|jpg|json))$"; foreach (var f in sd.FileName(FileNameMode.FullPath)) yield return new Consts.file(f.Substring(basicPath.Length)); }
//ridi se obsahem d:\LMCom\rew\Downloads\Common\batches\webs\ public static void webHomePages() { ScanDir sd = new ScanDir(); sd.BasicPath = Machines.basicPath + @"rew\Downloads\Common\batches\webs"; sd.FileMask = @"(?i:\.xml)$"; foreach (var f in sd.FileName(FileNameMode.FullPath)) { var cfg = XmlUtils.FileToObject<Config>(f); var project = Path.GetFileNameWithoutExtension(f); foreach (var lv in cfg.WebLangs.SelectMany(l => webVersions.Select(v => new { l, v }))) { cfg.target = LMComLib.Targets.web; cfg.version = lv.v; cfg.lang = lv.l; var home = HomePage(cfg); File.WriteAllText(basicPath + string.Format(@"schools/index_{0}{1}{2}.html", string.IsNullOrEmpty(project) ? null : project + "_", lv.l, lv.v == versions.minified ? null : "_debug"), home); } } }
static IEnumerable<string> typeScriptFiles(string dir) { ScanDir sd = new ScanDir(); sd.BasicPath = basicPath + dir; sd.DirsToResult = false; sd.FileMask = @"(?i:\.ts)$"; return sd.FileName(FileNameMode.FullPath); }
public static void compileTypeScript() { ScanDir sd = new ScanDir(); sd.BasicPath = basicPath; sd.DirsToResult = false; sd.FileMask = @"(?i:\.ts)$"; var cmd = @"""C:\Program Files\Microsoft SDKs\TypeScript\tsc.exe"" --comments --target ES5 " + typescriptDirs.SelectMany(d => typeScriptFiles(d)).Select(f => "\"" + f + "\"").Aggregate((r, i) => r + " " + i); run(cmd); }