Ejemplo n.º 1
0
    //[XmlAttribute]
    //public string Url;
    //[XmlAttribute]
    //public string Style;

    public override IEnumerable<tag> Generate(body pg, LoggerMemory wr) {
      //if (string.IsNullOrEmpty(urlText) && string.IsNullOrEmpty(urlDialog)) wr.ErrorLine(pg.url, "Missing url-text or url-dialog attribute");
      //if (!string.IsNullOrEmpty(urlText) && !string.IsNullOrEmpty(urlDialog)) wr.ErrorLine(pg.url, "Use only one from url-text or url-dialog attributes");
      //var isDialog = !string.IsNullOrEmpty(urlDialog);
      var cid = "macrovideo_" + cnt++.ToString();
      //var file = isDialog ? (include)new includeDialog { cutUrl = urlDialog} : new includeText { cutUrl = urlText};
      switch (displayStyle) {
        case "WithDialog":
          yield return htmlTag.create(htmlTag.div,
            htmlTag.create(htmlTag.div,
              "class", "col-md-5 video-hidden-xs video-hidden-sm",
              new mediaVideo { classSetter = "video-hidden-xs video-hidden-sm", shareMediaId = cid },
              new mediaPlayer { classSetter = "hidden-xs hidden-sm", shareMediaId = cid }
            ),
            htmlTag.create(htmlTag.div,
              "class", "col-md-7",
              new mediaText { id = cid, /*audioUrl = audioUrl,*/ mediaUrl = mediaUrl, cutUrl = cutUrl }
            )
          );
          break;
        default:
          yield return htmlTag.create(htmlTag.div,
            new mediaVideo() { id = cid, /*audioUrl = audioUrl,*/ mediaUrl = mediaUrl, cutUrl = cutUrl },
            new mediaPlayer() { shareMediaId = cid });
          break;
      }
    }
Ejemplo n.º 2
0
 //[XmlAttribute]
 //public CheckItemTexts TextId;
 public override IEnumerable<tag> Generate(body pg, LoggerMemory wr) {
   var lines = smartElement.splitLines(cdata); if (lines.Length == 0) { wr.ErrorLine(pg.url, "Missing lines with data"); yield break; }
   lines = lines.Select(l => smartElement.removeNums(l).Trim()).ToArray();
   yield return new listGroup() {
     //width = width,
     Items = lines.Select(l => new checkItem() {
       correctValue = l.StartsWith("#"),
       textType = textId,
       Items = smartElement.replaceMacroHardReturn(l.Replace("#", null), wr).ToArray()
     }).ToArray()
   };
 }
Ejemplo n.º 3
0
 //z D:\NetNew\ObjectModel\Course\Meta.cs
 public static IEnumerable<TradosLib.tradosPage> tradosOper1Pages(IEnumerable<CourseMeta.data> nodes, LoggerMemory log, bool isFakeRussian) {
   return nodes.SelectMany(n => n.scan()).GroupBy(dt => dt.getTradosPage()).
     Where(g => g.Key != null).
     Select(g => new TradosLib.tradosPage {
       srcLang = isFakeRussian ? Langs.cs_cz : Langs.en_gb,
       FileName = g.Key,
       sentences = g.OfType<CourseMeta.ex>().SelectMany(e => e.toTransSentences(log)).Concat(
         g.SelectMany(dt => CourseMeta.locLib.getLocId2EnglishLoc(dt.title, dt.url, null).Select(nv => new NameValueString { Name = dt.url + "/" + nv.Name, Value = nv.Value }))
     ).
     Where(kv => isFakeRussian ? !kv.Name.EndsWith("ahtmltitle") : true).
     ToArray()
     });
 }
Ejemplo n.º 4
0
 public sitemap getSiteMap(LoggerMemory logger) {
   if (_siteMap == null) {
     _siteMap = new sitemap(actNode.url, logger, sitemap.fromFileSystem("/data/instr/std/", logger), sitemap.fromFileSystem("/data/instr/new/", logger));
     if (logger.vsNetForBrowseAction) { //uprava sitemap pro vs.net browse - pouze taskCourse, data a testEx nodes. Nahrad vsechny testGlobalAdmin... nodes apod.
       XElement root;
       using (StringReader rdr = new StringReader(XmlUtils.ObjectToString(_siteMap))) root = XElement.Load(rdr);
       foreach (var highLev in root.Elements().Where(he => he.AttributeValue("type", "").IndexOf("instrs") < 0)) {
         highLev.Name = "taskCourse"; highLev.SetAttributeValue("type", "mod");
         foreach (var el in highLev.Descendants().Where(e => e.Name.LocalName != "ex")) { el.Name = "data"; el.SetAttributeValue("type", null); }
       }
       _siteMap = XmlUtils.StringToObject<sitemap>(root.ToString());
       _siteMap.finish();
     }
   }
   return _siteMap;
 } sitemap _siteMap;
Ejemplo n.º 5
0
 //************ ruzne formy file: lmdata, xml, old, transformavene, ...
 public object getFileContentLow(CourseMeta.oldeaDataType type, LoggerMemory logger) { //vrati string => xml string, @string => filename, XElement => xml
   //var logger = new LoggerMemory(false);
   switch (type) {
     case CourseMeta.oldeaDataType.lmdata: return "@" + fileName();
     case CourseMeta.oldeaDataType.lmdataNew:
       if (getMeta().isByHand()) {
         var fn = fileName(CourseMeta.oldeaDataType.lmdataNew);
         return File.Exists(fn) ? "@" + fn : null;
       } else {
         var res = CourseMeta.Lib.dataFromEAStr(newUrl, CourseMeta.oldeaDataType.lmdataNew, logger, removeOldEAPart);
         //XElement root = XElement.Load(fileName(), LoadOptions.PreserveWhitespace);
         //controlProp.adjust_child_attrs_all(root, null);
         //var trs = getTransforms();
         //if (trs != null) foreach (var tr in trs) trans.form(tr, root);
         return res;
       }
     case CourseMeta.oldeaDataType.xml: return CourseMeta.Lib.dataFromEAStr(newUrl, CourseMeta.oldeaDataType.lmdata, logger);
     case CourseMeta.oldeaDataType.xmlNew: return CourseMeta.Lib.dataFromEAStr(newUrl, CourseMeta.oldeaDataType.xmlNew, logger, removeOldEAPart);
     default: throw new NotImplementedException();
   }
 }
Ejemplo n.º 6
0
 //*********** COURSE_build
 public static void COURSE_build(BuildIds buildId, IEnumerable<Langs> locs, dictTypes dictType = dictTypes.no) {
   runTask("COURSE_build", () => {
     Trace.TraceWarning("BuildId: {0}, locs: {1}, dictType: {2}", buildId, locs.Join(), dictType);
     LoggerMemory log = new LoggerMemory(true);
     try {
       CourseMeta.Lib.init(log, @"d:\lmcom\", false);
       if (!log.hasError) {
         //vytvoreni WebDataBatch, vse je pripraveno nahradit DATA-{0}.xml pouhymi seznamy produkt IDS
         var productIds = File.ReadAllLines(string.Format(@"D:\LMCom\rew\DeployGUI\Web4CourseProducts\{0}.txt", buildId));
         Trace.TraceWarning("Start build {0} products", productIds.Length);
         var batch = new WebDataBatch { dictType = dictType, locs = locs.ToArray(), products = productIds.Select(id => new BatchProduct { id = id }).ToArray() };
         WebDataBatch.FinishAfterLoad(batch);
         //seznam souboru, v product adresari jsou metainformace o produktech, v envelope jsou aktualizovane informace.
         var files = batch.getWebBatchFilesNew(buildId, log, @"d:\LMCom\rew\Web4\products\");
         buildLib.writeVirtualFiles(buildId, files);
       }
     } catch (Exception exp) {
       log.ErrorLine("Exception", LowUtils.ExceptionToString(exp));
     }
     return log.hasError ? log.Log() : null;
   });
 }
Ejemplo n.º 7
0
    //static string xrefFn = Machines.basicPath + @"rew\Web4\author\xref.xml";


    //public void generateXref() {

    //  //generace xrefs
    //  var xref = generateXref(XmlUtils.FileToObject<docTagsMeta>(Machines.rootPath + @"Author\tagsMeta.xml"), CourseMeta.lib.publishers).ToArray();
    //  XmlUtils.ObjectToFile(xrefFn, xref);

    //  //sitemap (bez cviceni) to jsonML 
    //  StringBuilder sb = new StringBuilder();
    //  var sm = XElement.Load(CourseMeta.lib.siteFn); sm.Descendants("testEx").Remove();
    //  CourseModel.tag.xmlToJsonsLowMeta(sm, sb);
    //  File.WriteAllText(Machines.rootPath + @"author\xrefSitemap.js", sb.ToString());

    //}

    public static void adjustXrefSitemap(LoggerMemory sb) {
      var smFile = Machines.rootPath + @"author\xrefSitemap.js";
      if (!File.Exists(smFile)) {
        CourseMeta.Lib.init(sb, @"d:\lmcom\");
        StringBuilder buff = new StringBuilder();
        var sm = XElement.Load(CourseMeta.Lib.siteFn); sm.Descendants("ex").Remove();
        CourseModel.tag.xmlToJsonsLowMeta(sm, buff);
        File.WriteAllText(smFile, buff.ToString());
      }
    }
Ejemplo n.º 8
0
    void adjustXrefData(string srcUrl, bool refresh, LoggerMemory sb) {
      var url = srcUrl;
      if (url != null) {
        if (url.StartsWith("/")) url = url.Substring(1);
        if (url.EndsWith("/")) url = url.Substring(0, url.Length - 1);
      }
      this.url = url;
      this.xrefFn = Machines.rootPath + (url == null ? null : url.Replace('/', '\\') + "\\") + "meta.xref";
      if (refresh || !File.Exists(this.xrefFn)) {
        var sm = url == null ? CourseMeta.Lib.publishers : new sitemap(srcUrl, new LoggerMemory());
        xrefs = null;
        var xref = generateXref(XmlUtils.FileToObject<docTagsMeta>(Machines.rootPath + @"Author\tagsMeta.xml"), sm, sb).ToArray();
        XmlUtils.ObjectToFile(xrefFn, xref);
      }

      if (xrefs != null) return;
      xrefs = XmlUtils.FileToObject<xrefPageObj[]>(xrefFn);
      //var count = xrefs.SelectMany(p => p.types == null ? Enumerable.Empty<typeObj>() : p.types).SelectMany(t => t.props==null ? Enumerable.Empty<propObj>() : t.props).Count();
      foreach (var p in xrefs) foreach (var t in p.types) { t.page = p; if (t.props != null) foreach (var pr in t.props) pr.type = t; } //parent ptrs
      Func<IEnumerable<xrefPageObj>, xrefPageObj[]> uniqPages = pages => pages.GroupBy(p => p.url).Select(pg => pg.First()).ToArray(); //seznam jednoznacnych stranek
      //types
      typeToPages = xrefs.SelectMany(p => p.types).GroupBy(t => t.type).ToDictionary(
        g => g.Key,
        g => uniqPages(g.Select(t => t.page)));
      //props
      var props = xrefs.SelectMany(p => p.types).SelectMany(t => t.props == null ? Enumerable.Empty<xrefPropObj>() : t.props);
      typePropToPages = props.GroupBy(pr => pr.type.type).ToDictionary(
        g => g.Key,
        g => g.GroupBy(pr => pr.prop).ToDictionary(
          pg => pg.Key,
          pg => uniqPages(g.Select(t => t.type.page))));
      foreach (var tpName in typeToPages.Keys) if (!typePropToPages.ContainsKey(tpName)) typePropToPages.Add(tpName, new Dictionary<string, xrefPageObj[]>());
      typePropValToPages = props.GroupBy(pr => pr.type.type).ToDictionary(
        g => g.Key,
        g => g.GroupBy(pr => pr.prop).ToDictionary(
          pg => pg.Key,
          pg => pg.GroupBy(pr => pr.value).ToDictionary(
            pgv => pgv.Key,
            pgv => uniqPages(pgv.Select(t => t.type.page)))));
      propToPages = props.GroupBy(pr => pr.prop).ToDictionary(
        g => g.Key,
        g => uniqPages(g.Select(t => t.type.page)));
      propValToPages = props.GroupBy(pr => pr.prop).ToDictionary(
        g => g.Key,
        g => g.GroupBy(pr => pr.value).ToDictionary(
          pgv => pgv.Key,
          pgv => uniqPages(pgv.Select(t => t.type.page))));
    }
Ejemplo n.º 9
0
 public static void getPostDataFilesZip(Stream str, INodeContext ctx, product prod, LoggerMemory log, IEnumerable<Packager.Consts.file> files = null) {
   buildLib.zipVirtualFiles(str, getPostDataFiles(ctx, prod, log).Concat(files == null ? Enumerable.Empty<Packager.Consts.file>() : files), log);
 }
Ejemplo n.º 10
0
 public override IEnumerable<tag> Generate(body pg, LoggerMemory wr) {
   var lines = smartElement.splitLines(cdata); if (lines.Length == 0) return Enumerable.Empty<tag>();
   list res = new list() {
     //width = width,
     delim = delim,
     isStriped = isStriped,
     icon = icon,
     color = color,
     Items = lines.Select(l => smartElement.removeNums(l).Trim()).Select(l => htmlTag.create(htmlTag.li, smartTag.formatedText(l))).ToArray()
   };
   return (res as IMacroTemplate).Generate(pg, wr);
 }
Ejemplo n.º 11
0
 static htmlTag createCell(string ct, LoggerMemory wr, inlineControlTypes type, int rowIdx, int colIdx) {
   var match = cellFmt.Match(ct);
   string cls = null;
   if (match.Success) {
     var align = match.Groups["align"].Value;
     var color = match.Groups["color"].Value;
     ct = ct.Substring(match.Length);
     if (!string.IsNullOrEmpty(color)) {
       switch (color[0]) {
         case 'y': cls += rowIdx == 0 ? " oli-table-top-rounded oli-table-default" : (colIdx == 0 ? " oli-table-left-rounded oli-table-default" : " oli-table-default"); break;
         case 'b': cls += " oli-table-del"; break;
         case 'g': cls += " oli-table-default"; break;
       }
     }
     if (!string.IsNullOrEmpty(align)) {
       switch (align[0]) {
         case 'l': cls += " left"; break;
         case 'c': cls += " center"; break;
         case 'r': cls += " right"; break;
       }
       switch (align[1]) {
         case 't': cls += " top"; break;
         case 'm': cls += " middle"; break;
         case 'b': cls += " bottom"; break;
       }
     }
   }
   return htmlTag.create(htmlTag.td,
     "class", cls,
     smartTag.replaceMacroHardReturn(ct, wr, type)
   );
 }
Ejemplo n.º 12
0
 public override IEnumerable<tag> Generate(body pg, LoggerMemory wr) {
   var lines = smartElement.splitLines(cdata); if (lines.Length == 0) { wr.ErrorLine(pg.url, "Missing lines with data"); yield break; }
   List<pairingItem> items = new List<pairingItem>();
   foreach (var l in lines) {
     var parts = l.Split('\\').Select(w => w.Trim()).ToArray(); if (parts.Length != 2) { wr.ErrorLine(pg.url, "Two part of pairing data required"); continue; };
     items.Add(new pairingItem() {
       right = smartElement.removeNums(parts[1]),
       Items = smartElement.replaceMacroHardReturn(smartElement.removeNums(parts[0]), wr).ToArray()
     });
   }
   yield return new pairing() { Items = items.ToArray()/*, width = width*/ };
 }
Ejemplo n.º 13
0
 public static string getServerScript(string url, CourseMeta.oldeaDataType dataType, LoggerMemory logger) {
   url = url.ToLower(); if (!url.StartsWith(newUrlPrefix)) return null;
   url = url.Substring(newUrlPrefix.Length);
   exFile fileEx;
   if (!OldToNew.fileGroup.getAllFiles().TryGetValue(url, out fileEx)) return null;
   return fileEx.getFileContentString(dataType, logger);
 }
Ejemplo n.º 14
0
 void makeNewLmdata() {
   LoggerMemory log = new LoggerMemory(false);
   //transformed do new lmdata
   var transformed = getFileContentXml(CourseMeta.oldeaDataType.lmdataNew, log);
   var newFn = fileName(CourseMeta.oldeaDataType.lmdataNew);
   transformed.Element(html + "head").Elements(html + "script").Remove();
   transformed.Save(newFn);
 }
Ejemplo n.º 15
0
 public string getFileContentString(CourseMeta.oldeaDataType type, LoggerMemory logger) {
   var obj = getFileContentLow(type, logger); if (obj == null) return null;
   if (obj is XElement) return ((XElement)obj).ToString();
   var str = (string)obj; if (str.Length < 1) return null;
   return str[0] == '@' ? File.ReadAllText(str.Substring(1), Encoding.UTF8) : str;
 }
Ejemplo n.º 16
0
 static void saveLog(LoggerMemory lg3, string name, bool waitMsg = true) {
   var fn = string.Format(@"d:\LMCom\rew\Web4\Data\buildLogs\{0}.log", name);
   if (File.Exists(fn)) File.Delete(fn);
   if (lg3.hasError) {
     File.WriteAllText(fn, lg3.Log());
     Console.WriteLine("*** Error in " + fn);
   } else {
     Console.WriteLine("Build OK");
   }
   if (waitMsg) {
     Console.WriteLine("Press any key to continue");
     Console.ReadKey();
   }
 }
Ejemplo n.º 17
0
    static void Main(string[] args) {

      //File.WriteAllText(@"d:\temp\build.json", Packager.RewApp.jsDeployData());
      //return;
      //CourseMeta.Lib.init(new LoggerMemory(true), @"d:\lmcom\", false);
      //return;

      Machines._basicPath = @"d:\lmcom\";
      var ignExts = new HashSet<string> { ".webm", ".mp4", ".mp3" };
      if (args != null && args.Length == 1 && (args[0].StartsWith("-8") || args[0].StartsWith("-9"))) {
        var isZip = args[0].StartsWith("-9");
        string bi = args[0].Substring(2);
        LoggerMemory lg10 = new LoggerMemory(true);
        try {
          Machines.appData = @"d:\LMCom\rew\Web4\App_Data\";
          CourseMeta.Lib.init(lg10, @"d:\lmcom\", false);
          if (!lg10.hasError) {
            var meta = CourseMeta.WebDataBatch.Load(@"d:\LMCom\rew\Downloads\Common\batches\webs\" + bi + ".xml");
            //meta.locs = null; //vsechny lokalizace
            var files = meta.getWebBatchFiles(lg10, true);
            if (isZip) {
              //var zfn = @"c:\temp\build.zip";
              var zfn = string.Format(@"d:\LMCom\ReleaseDeploy\packs\{0}.zip", bi); if (File.Exists(zfn)) File.Delete(zfn);
              CourseMeta.buildLib.zipVirtualFiles(zfn, files, lg10, f => !ignExts.Contains(Path.GetExtension(f.srcPath)), File.Exists(zfn));
            } else
              CourseMeta.buildLib.writeVirtualFiles(files);
          }
        } catch (Exception exp) {
          lg10.ErrorLine("Exception", LowUtils.ExceptionToString(exp));
        }
        saveLog(lg10, bi, false);
        return;
      }

      //var pars = new CommonMark.styleParams("gap-fill(id a=b;c=d;e=f) asd|asdf|asd");
      //return;
      //azure.lib.testAll();
      //return;

      //⋘
      //  ⊏bold+underline≻⊏italic≻
      //    ≪gap\-fill O\\}\\{K≫≺italic⊐ ⊂styles⊃≺bold+underline⊐
      //  ⋘
      //  ⋙
      //⋙

      //excelReport.tests.testGlobalAdmin(@"d:\temp\tests.xlsx", 1);
      //excelReport.evaluatorsReport.testGlobalAdmin(@"d:\temp\evaluators.xlsx", 1);
      //return;


      //var metas = Directory.GetFiles(@"d:\LMCom\rew\Web4\lm", "meta.xml", SearchOption.AllDirectories).Concat(Directory.GetFiles(@"d:\LMCom\rew\Web4\skrivanek", "meta.xml", SearchOption.AllDirectories)).ToArray();
      //foreach (var fn in metas) {
      //  XElement root = XElement.Load(fn); if (root.Name.LocalName != "taskTestSkill") continue;
      //  if (root.Attribute("skill").Value != "UseEnglish") continue;
      //  root.SetAttributeValue("skill", "UseLanguage");
      //  root.Save(fn);
      //  //root = null;
      //}
      //return;

      //var metas = Directory.GetFiles(@"d:\LMCom\rew\Web4\lm", "meta.xml", SearchOption.AllDirectories).Concat(Directory.GetFiles(@"d:\LMCom\rew\Web4\skrivanek", "meta.xml", SearchOption.AllDirectories)).ToArray();
      //foreach (var fn in metas) {
      //  XElement root = XElement.Load(fn); if (root.Name.LocalName!="taskTestSkill") continue;
      //  if (root.Elements().Count() != 1) continue;
      //  var dyn = root.Elements().First(); if (dyn.Name.LocalName!="dynamicModuleData") continue;
      //  var grps = dyn.Elements("testTaskGroup").ToArray(); if (grps.Length != dyn.Elements().Count()) continue;
      //  var selfUrl = CourseMeta.testEx.urlFromFileName(fn);
      //  foreach (var grp in grps) {
      //    var grpUrl = grp.Element("ptr").Element("urls").Element("string").Value.ToLower();
      //    if (grpUrl.IndexOf(selfUrl) != 0) throw new Exception();
      //    var grpMetaFn = CourseMeta.testEx.fileNameFromUrl(grpUrl); if (!File.Exists(grpMetaFn)) throw new Exception();
      //    grp.RemoveNodes();
      //    grp.Save(grpMetaFn);
      //  }
      //  root.RemoveNodes();
      //  root.SetAttributeValue("type", root.Attribute("type").Value + " dynamicModuleData");
      //  root.Save(fn);
      //}
      //return;
      //CourseMeta.lib.init(new LoggerFile(@"d:\temp\sitemap.error"), @"d:\lmcom\");
      //return;

      //SchemaDefinition.ModifyXsd.genSchema();
      //return;

      //Machines._basicPath = @"d:\lmcom\";
      //changeXml(null); //@"d:\LMCom\rew\Web4\grafia\opendoor\de\od1_administrativ\lesson1\module4");
      //return;
      //CourseMeta.lib.init(new LoggerDummy(), @"d:\lmcom\", true);
      //return;

      //Action<string, Func<CourseModel.jsClassMeta, bool>> dump = (fn, cond) => {
      //  var csCtrlGrp = CourseModel.lib.courseModelJsonMLMeta.types.Values.Where(t => (t.st & CourseModel.tgSt.obsolete)==0).GroupBy(t => cond(t));
      //  new XElement("root",
      //    new XElement("true", csCtrlGrp.First(g => g.Key).OrderBy(t => t.tagName).Select(t => new XElement(t.tagName, new XAttribute("st", t.st.ToString()), t.xsdChildElements == null ? null : new XAttribute("xsdChildElements", t.xsdChildElements)))),
      //    new XElement("false", csCtrlGrp.First(g => !g.Key).OrderBy(t => t.tagName).Select(t => new XElement(t.tagName, new XAttribute("st", t.st.ToString()), t.xsdChildElements == null ? null : new XAttribute("xsdChildElements", t.xsdChildElements))))
      //  ).Save(@"d:\temp\" + fn + ".xml");
      //};
      //dump("csCtrl", t => (t.st & tgSt.csControl) != 0);
      //dump("xsdIgnore", t => (t.st & (tgSt.xsdIgnore | tgSt.obsolete)) != 0);
      //dump("jsCtrl", t => (t.st & tgSt.jsCtrl) != 0);
      //dump("docIgnore", t => (t.st & tgSt.docIgnore) != 0);
      //dump("xsdHtmlEl", t => (t.st & tgSt.xsdHtmlEl) != 0);
      //dump("xsd", t => (t.st & (tgSt.xsdHtmlEl | tgSt.xsdIgnore | tgSt.xsdString_ | tgSt.xsdNoMixed)) == 0 && t.xsdChildElements == null);

      //new XElement("root",
      //  CourseModel.lib.courseModelJsonMLMeta.types.Values.Where(t => (t.st & CourseModel.tgSt.obsolete) != 0).Select(t => new XElement(t.tagName, new XAttribute("st", t.st.ToString())))).
      //  Save(@"d:\temp\obsolete.xml");
      //return;



      ////var res2 = CourseMeta.sitemap.readFromFilesystem(@"D:\LMCom\rew\Web4\lm\examples\meta.xml");
      //CourseMeta.lib.init(new LoggerDummy(), @"d:\lmcom\");
      //var res2 = CourseMeta.testEx.readPageFromFile(@"D:\LMCom\rew\Web4\lm\examples\New\testGlobalAdmin.xml", null);
      ////CourseMeta.lib.init(new LoggerDummy(), @"d:\lmcom\", true);
      //return;


      //xref.lib.init();
      //return;

      //OldToNew.StatLib.dump(false);
      //OldToNew.StatLib.dump(true);
      //OldToNew.FileGroupGenerator.generator();
      //return;

      //ClearScript.lib.JsReflection(Machines._basicPath + @"rew\Web4\Courses\GenCourseModel.ts", Machines._basicPath + @"rew\SchemaDefinition\map");
      //return;

      //XmlUtils.ObjectToFile(@"d:\LMCom\rew\SchemaDefinition\tagsMeta.xml", CourseModel.doc.export(@"d:\lmcom\rew\schemadefinition\schemadefinition.xml", null));
      ////CourseModel.doc.export(null, @"d:\LMCom\rew\Web4\lm\examples").toFile(@"d:\LMCom\rew\SchemaDefinition\tagsMeta.xml");

      //File.WriteAllText(@"d:\temp\xrefs.json", doc.lib.generateXrefJson("/lm/examples/"));

      //var arr = XmlUtils.FileToObject<CourseModel.docTagsMeta>(@"d:\LMCom\rew\SchemaDefinition\tagsMeta.xml");
      //XmlUtils.ObjectToFile(@"d:\LMCom\rew\SchemaDefinition\tagsMeta.xml", arr);

      //var xrefs = CourseModel.doc.generateXref(@"d:\LMCom\rew\Web4\lm\examples", CourseModel.docTagsMeta.parse(File.ReadAllText(@"d:\LMCom\rew\SchemaDefinition\tagsMeta.xml"))).ToArray();
      //XmlUtils.ObjectToFile(@"d:\temp\xrefs.xml", xrefs);

      //return;

      //var ss = File.ReadAllText(@"d:\LMCom\rew\Web4\Temp\XMLFile2.xml");
      //XmlSerializer serializer = new XmlSerializer(typeof(CourseModel.div));
      //serializer.UnknownNode += (s, a) => {
      //  if (a == null) return;
      //};

      //using (var reader = new XmlTextReader(ss, XmlNodeType.Element, null) {
      //}) {
      //  //using (StringReader rdr = new StringReader(ss))
      //  //using (XmlReader reader = XmlReader.Create(rdr, new XmlReaderSettings() { IgnoreWhitespace = false, ConformanceLevel = ConformanceLevel.Document })) {
      //  var o = serializer.Deserialize(reader);
      //  using (StringWriter writer = new StringWriter()) {
      //    using (XmlWriter wr = XmlWriter.Create(writer, new XmlWriterSettings() { }))
      //      new XmlSerializer(o.GetType()).Serialize(wr, o);
      //    var str1 = writer.ToString();
      //    str1 = null;
      //  }
      //}



      //return;


      //CourseMeta.lib.prepareForRussianTrans();
      //return;
      var path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\temp\";
      string serverId;
      LowUtils.AdjustDir(path);
      var errorFn = path + "error.log";
      if (File.Exists(errorFn)) File.Delete(errorFn);
      string webBatchId = "unknown"; string zipFn = "";

      try {
        if (args.Length == 0) {
          //0. compile LMDbExtension
          Console.WriteLine("Enter 1 (refreshSASSDeploymentBatchFile)");
          //1.1. recompile CubesDeployment
          //A. remote server
          //1.2. copy all to LMV1
          //1.3. run batches locally on LMV1
          //B. local server
          Console.WriteLine("Enter 2 (includeClrExtensionToDB)");
          Console.WriteLine("Enter 3 (buildCompanyCubes)");
          Console.WriteLine("Enter 4 (includeClrExtensionToDB & buildCompanyCubes)");
          Console.WriteLine("Enter 5 (extract XML from old EA)");
          Console.WriteLine("Enter 6 (trados OPER 1)");
          Console.WriteLine("Enter 7 (build all products)");
          Console.WriteLine("Enter 8 (build Web x Scorm)");
          Console.WriteLine("Enter 9 (dump LMDatabaseExtension data)");
          var ch = Console.ReadKey().KeyChar; char s = ' ';
          switch (ch) {
            case '1':
            case '2':
            case '3':
            case '4':
            case '9':
              Console.WriteLine("");
              Console.WriteLine("Enter 1 (NewLMCom pz-w8virtual)");
              Console.WriteLine("Enter 2 (NewLMCom lm-virtual-1)");
              Console.WriteLine("Enter 3 (NewLMComServices lm-virtual-1)");
              Console.WriteLine("Enter 4 (NewLMCom dedi8439)");
              Console.WriteLine("Enter 5 (NewLMCom virtualdeploy)");
              s = Console.ReadKey().KeyChar;
              break;
          }
          switch (s) {
            case '1': serverId = "pz-w8virtual"; break;
            case '2': serverId = "lm-virtual-1"; break;
            case '3': serverId = "lm-virtual-1_run"; break;
            case '4': serverId = "dedi8439"; break;
            case '5': serverId = "w2008server"; break;
            case ' ': serverId = null; break;
            default: throw new Exception("Wrong char");
          }
          Console.WriteLine("");
          Console.WriteLine("... processing ...");
          switch (ch) {
            case '1':
              NewData.SSAS.refreshSASSDeploymentBatchFile();
              break;
            case '2':
              NewData.SSAS.includeClrExtensionToDB(serverId);
              break;
            case '3':
              NewData.SSAS.buildCompanyCubes(serverId);
              break;
            case '4':
              NewData.SSAS.includeClrExtensionToDB(serverId);
              NewData.SSAS.buildCompanyCubes(serverId);
              break;
            case '5':
              LoggerMemory log1 = new LoggerMemory(true);
              //TradosLib.recomputeLookupHash(0); TradosLib.recomputeSentHash(0); return;

              //CourseMeta.lib.init(log1, @"d:\lmcom\");
              //CourseMeta.lib.dataFromEA(CourseMeta.lib.publishers.find("/lm/oldea/english1/"), false);
              //CourseMeta.lib.dataFromEA(CourseMeta.lib.publishers.find("/lm/oldea/english4/l21/a/hueex3_l21_a04"), false, log1);

              //CourseMeta.lib.dataFromEA(CourseMeta.lib.publishers.find("lm/oldea/russian1/lesson1/ChapterA/novyeslova1"));
              //CourseMeta.lib.dataFromEA(CourseMeta.lib.publishers.find("/lm/oldea/english1/l01/a/hueex0_l01_a07"));
              //return;
              //CourseMeta.lib.init(log1, @"d:\lmcom\", false);
              //CourseMeta.lib.init(log1, @"d:\lmcom\", false);

              //CourseMeta.lib.dataFromEA(CourseMeta.lib.publishers.find("/lm/oldea/english1/"), false);
              //CourseMeta.lib.dataFromEA(CourseMeta.lib.publishers.find("/lm/oldea/english/grammar/"), false);


              //CourseMeta.lib.dataFromEA(CourseMeta.lib.publishers.find("data/instr/std"), false);
              //CourseMeta.lib.dataFromEA(CourseMeta.lib.publishers.find("lm/oldea/russian3/lesson3/ChapterA/slova2"));
              //CourseMeta.lib.dataFromEA(CourseMeta.lib.publishers.find("lm/oldea/russian2"));
              //CourseMeta.lib.dataFromEA(CourseMeta.lib.publishers.find("lm/oldea/russian3"));

              //Instructions.run(); 
              //aktualizace cviceni a instrukci z old EA
              //CourseMeta.Lib.init(log1, @"d:\lmcom\", false); Instructions.run();
              //Instructions.run(); CourseMeta.Lib.dataFromEA(CourseMeta.Lib.publishers, CourseMeta.oldeaDataType.lmdata, log1);

              saveLog(log1, "FromOldEA");

              break;
            case '6':
              LoggerMemory log = new LoggerMemory(true);

              //CourseMeta.lib.init(log, @"d:\lmcom\", false);
              //CourseMeta.data.tradosOper1(new CourseMeta.data[] { CourseMeta.lib.publishers.find("/data/instr/new/"), CourseMeta.lib.publishers.find("/data/instr/std/") }, log);
              //Operace 2
              //TradosLib.tradosOper2_forLang(LocPageGroup.newEA, Langs.cs_cz, true);
              //CourseMeta.lib.publishers.find("/skrivanek/").tradosOper1(log);
              //Parallel.ForEach(CommonLib.bigLocalizations.Where(l => l != Langs.en_gb).Select(l => l == Langs.sp_sp ? Langs.es_es : l), lng => {
              //  TradosLib.AdjustTrans(LocPageGroup.newEA, lng, true);
              //});


              //rustina
              //var pages = CourseMeta.data.tradosOper1Pages(CourseMeta.lib.publishers.finds("lm/oldea/russian1","lm/oldea/russian2","lm/oldea/russian3"), log, true).ToArray();
              //TradosLib.oper1NewTradosPages(pages, true);

              //debug
              //CourseMeta.lib.publishers.find("lm/oldea/french2/grammar/sec06/g11").tradosOper1(log);

              try {
                //vse
                CourseMeta.Lib.init(log, @"d:\lmcom\", false);

                //CourseMeta.data.tradosOper1(new CourseMeta.data[] { CourseMeta.Lib.publishers.find("/skrivanek/questionnaire/") }, log);

                //var pages = CourseMeta.data.tradosOper1Pages(CourseMeta.lib.publishers.finds("lm/oldea/russian1","lm/oldea/russian2","lm/oldea/russian3"), log, true).ToArray();
                //TradosLib.oper1NewTradosPages(pages, true);

                //Oper1
                CourseMeta.Lib.publishers.tradosOper1(log);

                //Oper2 na data a instrukce
                Parallel.ForEach(CommonLib.bigLocalizations.Where(l => l != Langs.en_gb).Select(l => l == Langs.sp_sp ? Langs.es_es : l), lng => {
                  TradosLib.tradosOper2_forLang(LocPageGroup.newEA, lng, true);
                });

                //Oper5 na kod, aktualizace d:\LMCom\rew\Web4\Schools\Loc\ z TradosDB
                //foreach (var lng in CommonLib.bigLocalizations.Where(l => l != Langs.en_gb).Select(l => l == Langs.sp_sp ? Langs.es_es : l))
                //  TradosLib.GenerateResx(LocPageGroup.rew_school, lng);
              } catch (Exception exp) {
                log.ErrorLine("Exception", LowUtils.ExceptionToString(exp));
              }

              saveLog(log, "Trados");
              break;
            case '7':
              LoggerMemory logger = new LoggerMemory(true);
              CourseMeta.Lib.init(logger, @"d:\lmcom\", false);
              Machines.appData = @"d:\LMCom\rew\Web4\App_Data\";

              //CourseMeta.buildLib.writeVirtualFiles(CourseMeta.WebBatch.Load(@"D:\LMCom\rew\Downloads\Common\batches\webs\LM_debug.xml").getWebBatchFiles());

              //CourseMeta.buildLib.zipVirtualFiles(@"d:\temp\pom.zip", CourseMeta.WebBatch.Load(@"d:\LMCom\rew\Downloads\Common\batches\webs\LM_debug.xml").getWebBatchFiles());
              //buildLow("web", "LM_Software", true);
              //buildLow("rweb", "LM_Software", false);
              //Packager.RewApp.genWeb("LM_Software");
              //CourseMeta.buildLib.writeVirtualFiles(CourseMeta.WebBatch.Load(@"d:\LMCom\rew\Downloads\Common\batches\webs\LM_debug.xml").getWebBatchFiles());

              //CourseMeta.buildLib.writeVirtualFiles(CourseMeta.buildLib.refreshFiles("/lm/examples/controls_sound/", CommonLib.bigLocalizations, CourseMeta.dictTypes.L, false));
              //CourseMeta.buildLib.writeVirtualFiles(CourseMeta.buildLib.refreshFiles("data/instr/std", CommonLib.bigLocalizations, CourseMeta.dictTypes.no, false));
              //CourseMeta.buildLib.writeVirtualFiles(CourseMeta.buildLib.refreshFiles("lm/examples/Controls", CommonLib.bigLocalizations, CourseMeta.dictTypes.no, false));

              //CourseMeta.lib.forceRewriteSitempas = true; CourseMeta.buildLib.writeVirtualFiles(CourseMeta.WebBatch.Load(@"d:\lmcom\rew\downloads\common\batches\webs\lm_data_new.xml").getWebBatchFiles());
              //CourseMeta.buildLib.writeVirtualFiles(CourseMeta.WebBatch.Load(@"d:\LMCom\rew\Downloads\Common\batches\webs\lm_debug.xml").getWebBatchFiles());


              //var files = CourseMeta.WebBatch.Load(@"d:\LMCom\rew\Downloads\Common\batches\webs\" + webBatchId + ".xml").getWebBatchFiles().ToArray();
              //if (files != null) return;

              /***** LM FE5 web ***
              //CourseMeta.buildLib.writeVirtualFiles(CourseMeta.WebBatch.Load(@"d:\LMCom\rew\Downloads\Common\batches\webs\LM_debug.xml").getWebBatchFiles(logger));

              /***** ALAN ZIP ****/
                //webBatchId = "alan_data";
                //string zipFn = Machines.basicPath + @"ReleaseDeploy\packs\" + webBatchId + ".zip"; var tempZip = @"c:\temp\build.zip";
                //CourseMeta.buildLib.zipVirtualFiles(tempZip, CourseMeta.WebBatch.Load(@"d:\LMCom\rew\Downloads\Common\batches\webs\" + webBatchId + ".xml").getWebBatchFiles(logger), logger);
                //if (File.Exists(zipFn)) File.Delete(zipFn); File.Move(tempZip, zipFn);

                /***** GRAFIA ZIP ****/
                //webBatchId = "grafia_data";
                //string zipFn = Machines.basicPath + @"ReleaseDeploy\packs\" + webBatchId + ".zip"; var tempZip = @"c:\temp\build.zip";
                //if (File.Exists(tempZip)) File.Delete(tempZip); if (File.Exists(zipFn)) File.Delete(zipFn);
                //var ignExts = new HashSet<string> { ".webm", ".mp4" };
                //CourseMeta.buildLib.zipVirtualFiles(
                //  tempZip,
                //  CourseMeta.WebBatch.Load(@"d:\LMCom\rew\Downloads\Common\batches\webs\" + webBatchId + ".xml").getWebBatchFiles(logger),
                //  logger,
                //  f => !ignExts.Contains(Path.GetExtension(f.srcPath)));
                //File.Move(tempZip, zipFn);

                /***** refresh LM web *****/
                CourseMeta.Lib.init(logger, @"d:\lmcom\", true);
              CourseMeta.buildLib.writeVirtualFiles(CourseMeta.WebDataBatch.Load(@"d:\LMCom\rew\Downloads\Common\batches\webs\LM_Data_New.xml").getWebBatchFiles(logger));
              break;
            case '8':
              LoggerMemory lg3 = new LoggerMemory(true);
              try {
                Machines.appData = @"d:\LMCom\rew\Web4\App_Data\";
                CourseMeta.Lib.init(lg3, @"d:\lmcom\", false);
                if (!lg3.hasError) {

                  string tempZip;

                  /***** VS.NET AUTHOR - d:\LMCom\rew\Web4\Author\ExFormData.htm ****/
                  //string html;
                  //html = Author.vsNetServer.getHtmlFromScratch(new Author.vsNetServer.serverContext("/lm/author/demo/", lg3), "[%#baseTagUrl#%]", null, lg3, scriptData => {
                  //  //html = Author.vsNetServer.getHtmlFromScratch(new Author.vsNetServer.serverContext("/lm/author/demo/", lg3), "http://testGlobalAdmin.langmaster.com/alpha/Schools/", null, lg3, scriptData => {
                  //  foreach (var fn in Directory.GetFiles(@"d:\LMCom\rew\Web4\lm\author\shell\").Select(f => f.ToLower()).Where(f => f.EndsWith(".xml") && !f.EndsWith("\\meta.xml"))) {
                  //    scriptData.AppendFormat("<script type=\"text/xml\" data-email=\"{0}\">", CourseMeta.data.urlFromFileName(fn));
                  //    var root = XElement.Load(fn); root.Element("body").SetAttributeValue("email", Path.GetFileNameWithoutExtension(fn));
                  //    scriptData.Append(root.ToString());
                  //    scriptData.Append("</script>");
                  //  }
                  //});
                  //File.WriteAllText(@"d:\LMCom\rew\Web4\Author\ExFormData.htm", "<!-- saved from url=(0014)about:internet -->\r\n" + html, Encoding.UTF8);

                  //html = Author.vsNetServer.getHtmlFromScratch(new Author.vsNetServer.serverContext("/lm/author/empty/", lg3), "[%#baseTagUrl#%]", null, lg3, scriptData => {
                  //  scriptData.Clear(); scriptData.Append("[%#scriptData#%]");
                  //});
                  //File.WriteAllText(@"d:\LMCom\rew\Web4\Author\ModTemplate.htm", "<!-- saved from url=(0014)about:internet -->\r\n" + html, Encoding.UTF8);

                  //html = Author.vsNetServer.getHtmlFromScratch(new Author.fileContext("/lm/author/empty/empty"), "[%#baseTagUrl#%]", "[%#hash#%]", lg3, scriptData => {
                  //  scriptData.Clear(); scriptData.Append("[%#scriptData#%]");
                  //});
                  //File.WriteAllText(@"d:\LMCom\rew\Web4\Author\ExTemplate.htm", "<!-- saved from url=(0014)about:internet -->\r\n" + html, Encoding.UTF8);

                  /***** LM FE5 web (=> .js files, ktere se prenesou na FE5) ****/
                  //CourseMeta.buildLib.writeVirtualFiles(CourseMeta.WebDataBatch.Load(@"d:\LMCom\rew\Downloads\Common\batches\webs\LM_Data_New.xml").getWebBatchFiles(lg3));

                  //*************** Alan
                  //webBatchId = "alan_Software";
                  //Packager.RewApp.BUILD(webBatchId, Targets.web, lg3, new Packager.BatchLow {
                  //  actBatchVersion = Packager.batchVersion.release,
                  //  //version = schools.versions.debug,
                  //  version = schools.versions.minified,
                  //  persistType = schools.persistTypes.persistNewEA,
                  //  testGroup_debug = false,
                  //});
                  //zipFn = Machines.basicPath + @"ReleaseDeploy\packs\" + webBatchId + ".zip"; if (File.Exists(zipFn)) File.Delete(zipFn);
                  //File.Move(Machines.basicPath + @"rew\Downloads\webs\" + webBatchId + ".zip", zipFn);
                  //webBatchId = "alan_data-globals";
                  //zipFn = Machines.basicPath + @"ReleaseDeploy\packs\" + webBatchId + ".zip"; tempZip = @"c:\temp\build.zip";
                  //if (File.Exists(tempZip)) File.Delete(tempZip); if (File.Exists(zipFn)) File.Delete(zipFn);
                  //CourseMeta.buildLib.zipVirtualFiles(
                  //  tempZip,
                  //  CourseMeta.WebDataBatch.Load(@"d:\LMCom\rew\Downloads\Common\batches\webs\" + webBatchId + ".xml").
                  //  getWebBatchFiles(lg3, true), lg3, f => !ignExts.Contains(Path.GetExtension(f.srcPath)));
                  //File.Move(tempZip, zipFn);

                  //*************** Blended
                  webBatchId = "blended_software";
                  Packager.RewApp.BUILD(webBatchId, Targets.web, lg3, new Packager.BatchLow {
                    actBatchVersion = Packager.batchVersion.release,
                    version = schools.versions.debug,
                    //version = schools.versions.minified,
                    persistType = schools.persistTypes.persistNewEA,
                    testGroup_debug = false,
                  });
                  zipFn = Machines.basicPath + @"ReleaseDeploy\packs\" + webBatchId + ".zip"; if (File.Exists(zipFn)) File.Delete(zipFn);
                  File.Move(Machines.basicPath + @"rew\Downloads\webs\" + webBatchId + ".zip", zipFn);

                  //*************** Skrivanek
                  //webBatchId = "skrivanek_software";
                  //Packager.RewApp.BUILD(webBatchId, Targets.web, lg3, new Packager.BatchLow {
                  //  actBatchVersion = Packager.batchVersion.release,
                  //  version = schools.versions.debug,
                  //  //version = schools.versions.minified,
                  //  persistType = schools.persistTypes.persistNewEA,
                  //  testGroup_debug = false,
                  //});
                  //zipFn = Machines.basicPath + @"ReleaseDeploy\packs\" + webBatchId + ".zip"; if (File.Exists(zipFn)) File.Delete(zipFn);
                  //File.Move(Machines.basicPath + @"rew\Downloads\webs\" + webBatchId + ".zip", zipFn);

                  //*************** FE3
                  //webBatchId = "LM_Software";
                  //Packager.RewApp.BUILD(webBatchId, Targets.web, lg3, new Packager.BatchLow {
                  //  actBatchVersion = Packager.batchVersion.release,
                  //  version = schools.versions.debug,
                  //  //version = schools.versions.minified,
                  //  persistType = schools.persistTypes.persistNewEA,
                  //  testGroup_debug = false,
                  //});
                  //zipFn = Machines.basicPath + @"ReleaseDeploy\packs\" + webBatchId + ".zip"; if (File.Exists(zipFn)) File.Delete(zipFn);
                  //File.Move(Machines.basicPath + @"rew\Downloads\webs\" + webBatchId + ".zip", zipFn);

                  //*************** chinhTestVN
                  //webBatchId = "chinhTestvn_software";
                  //Packager.RewApp.BUILD(webBatchId, Targets.web, lg3, new Packager.BatchLow {
                  //  actBatchVersion = Packager.batchVersion.release,
                  //  version = schools.versions.debug,
                  //  //version = schools.versions.minified,
                  //  persistType = schools.persistTypes.persistNewEA,
                  //  testGroup_debug = false,
                  //});
                  //zipFn = Machines.basicPath + @"ReleaseDeploy\packs\" + webBatchId + ".zip"; if (File.Exists(zipFn)) File.Delete(zipFn);
                  //File.Move(Machines.basicPath + @"rew\Downloads\webs\" + webBatchId + ".zip", zipFn);

                  //webBatchId = "chinhtestvn_software";
                  //Packager.RewApp.BUILD(webBatchId, Targets.web, lg3, new Packager.BatchLow {
                  //  actBatchVersion = Packager.batchVersion.release,
                  //  version = schools.versions.debug,
                  //  //version = schools.versions.minified,
                  //  persistType = schools.persistTypes.persistNewEA,
                  //  testGroup_debug = false,
                  //});
                  ////zipFn = Machines.basicPath + @"ReleaseDeploy\packs\" + webBatchId + ".zip";
                  //zipFn = string.Format(@"\\192.168.0.14\q\temp\{0}.zip", webBatchId);
                  //if (File.Exists(zipFn)) File.Delete(zipFn);
                  //File.Move(Machines.basicPath + @"rew\Downloads\webs\" + webBatchId + ".zip", zipFn);

                  //webBatchId = "chinhtestvn_data";
                  ////zipFn = Machines.basicPath + @"ReleaseDeploy\packs\" + webBatchId + ".zip";
                  //zipFn = string.Format(@"\\192.168.0.14\q\temp\{0}.zip", webBatchId);
                  //if (File.Exists(zipFn)) File.Delete(zipFn);
                  //tempZip = @"c:\temp\build.zip"; if (File.Exists(tempZip)) File.Delete(tempZip);
                  //CourseMeta.buildLib.zipVirtualFiles(
                  //  tempZip,
                  //  CourseMeta.WebDataBatch.Load(@"d:\LMCom\rew\Downloads\Common\batches\webs\" + webBatchId + ".xml").
                  //  getWebBatchFiles(lg3), lg3, f => !ignExts.Contains(Path.GetExtension(f.srcPath)));
                  //File.Move(tempZip, zipFn);

                  //*************** Grafia
                  //webBatchId = "grafia_software";
                  //Packager.RewApp.BUILD(webBatchId, Targets.web, lg3, new Packager.BatchLow {
                  //  actBatchVersion = Packager.batchVersion.release,
                  //  //version = schools.versions.debug,
                  //  version = schools.versions.minified,
                  //  persistType = schools.persistTypes.persistNewEA
                  //});
                  //var zipFn = Machines.basicPath + @"ReleaseDeploy\packs\" + webBatchId + ".zip"; if (File.Exists(zipFn)) File.Delete(zipFn);
                  //File.Move(Machines.basicPath + @"rew\Downloads\webs\" + webBatchId + ".zip", zipFn);
                  //webBatchId = "grafia_data";
                  //zipFn = Machines.basicPath + @"ReleaseDeploy\packs\" + webBatchId + ".zip"; var tempZip = @"c:\temp\build.zip";
                  //if (File.Exists(tempZip)) File.Delete(tempZip); if (File.Exists(zipFn)) File.Delete(zipFn);
                  //var ignExts = new HashSet<string> { ".webm", ".mp4", "*.mp3"  };
                  //CourseMeta.buildLib.zipVirtualFiles(
                  //  tempZip,
                  //  CourseMeta.WebDataBatch.Load(@"d:\LMCom\rew\Downloads\Common\batches\webs\" + webBatchId + ".xml").
                  //  getWebBatchFiles(lg3), lg3, f => !ignExts.Contains(Path.GetExtension(f.srcPath)));
                  //File.Move(tempZip, zipFn);

                  //*************** ALAN licence report
                  //var alanDB = new AlanDB.AlanDBDataContext();
                  //var lics = alanDB.UserLicences.Select(u => new {
                  //  u.CourseUser.CompanyUser.User.compId,
                  //  u.Created,
                  //  u.LicenceId,
                  //  u.Counter,
                  //  u.CompanyLicence.Days,
                  //  u.CompanyLicence.ProductId
                  //}).ToArray();
                  //new XElement("root", new XAttribute("connectionString", alanDB.Connection.ConnectionString), lics.OrderBy(l => l.Created).Select(l => new XElement("lic",
                  //  new XAttribute("email", l.LicenceId.ToString() + "." + l.Counter.ToString()),
                  //  new XAttribute("created", l.Created.ToShortDateString() + " " + l.Created.ToShortTimeString()),
                  //  new XAttribute("compId", l.compId),
                  //  new XAttribute("days", l.Days.ToString()),
                  //  new XAttribute("product", l.ProductId)
                  //))).Save(@"d:\temp\alan.xml");

                  //*************** Trask
                  //Packager.RewApp.BUILD("trask", Targets.scorm, lg3, new Packager.BatchLow {
                  //  //scorm_driver = schools.scormDriver.edoceo, actBatchVersion = Packager.batchVersion.release, version = schools.versions.minified, persistType = schools.persistTypes.persistScormEx
                  //  scorm_driver = schools.scormDriver.no,
                  //  actBatchVersion = Packager.batchVersion.fe5,
                  //  version = schools.versions.debug,
                  //  persistType = schools.persistTypes.persistScormEx
                  //});
                  //Packager.RewApp.BUILD("trask", Targets.scorm, lg3, new Packager.BatchLow {
                  //  scorm_driver = schools.scormDriver.edoceo, actBatchVersion = Packager.batchVersion.release, version = schools.versions.minified,
                  //  //scorm_driver = schools.scormDriver.no, actBatchVersion = Packager.batchVersion.fe5, version = schools.versions.debug,
                  //  persistType = schools.persistTypes.persistScormEx
                  //});

                  //*************** Testovaci SCORM
                  //Packager.RewApp.BUILD("testscorm", Targets.scorm, lg3, new Packager.BatchLow {
                  //  //scorm_driver = schools.scormDriver.edoceo, actBatchVersion = Packager.batchVersion.release,
                  //  scorm_driver = schools.scormDriver.no,
                  //  actBatchVersion = Packager.batchVersion.fe5,
                  //  version = schools.versions.debug,
                  //  //version = schools.versions.minified,
                  //  persistType = schools.persistTypes.persistScormEx
                  //});

                  //*************** LM_Software
                  //Packager.RewApp.BUILD("lm_software", Targets.web, lg3, new Packager.BatchLow {
                  //  actBatchVersion = Packager.batchVersion.fe5,
                  //  //version = schools.versions.debug,
                  //  version = schools.versions.minified,
                  //  persistType = schools.persistTypes.persistNewEA
                  //});
                }
              } catch (Exception exp) {
                lg3.ErrorLine("Exception", LowUtils.ExceptionToString(exp));
              }

              saveLog(lg3, webBatchId);
              break;
            case '9':
              Console.WriteLine("Enter companyId and press Enter");
              var compIdStr = Console.ReadLine(); var compId = int.Parse(compIdStr);
              List<string> queries = new List<string>();
              try {
                //Admin.Test.dump(compId, (o, id) => {
                //  try {
                //    XmlUtils.ObjectToFile(path + id + "_" + compIdStr + ".xml", o);
                //  } catch (Exception exp) {
                //    throw new Exception(id, exp);
                //  }
                //}, NewData.SSAS.getConnectionString(serverId), lib);
              } finally {
                File.WriteAllLines(path + "queries.txt", queries);
              }
              break;
          }
          return;
        }
        serverId = args.Length < 2 ? null : args[1].ToLower();
        switch (args[0]) {
          case "buildCompanyCubes":
            NewData.SSAS.buildCompanyCubes(serverId);
            break;
          case "includeClrExtensionToDB":
            NewData.SSAS.includeClrExtensionToDB(serverId);
            break;
        }
      } catch (Exception exp) {
        File.WriteAllText(errorFn, LowUtils.ExceptionToString(exp));
      }
    }
Ejemplo n.º 18
0
 IEnumerable<xrefPageObj> generateXref(docTagsMeta meta, sitemap smap, LoggerMemory sb) {
   var typeDir = meta.types.ToDictionary(t => t.name, t => t); //type => docType 
   //vsechny property vsech objektu => materska property (napr. gapFill.correctValue => edit.correctValue prop)
   var propsDir = meta.props.SelectMany(prop => typeDir[prop.ownerType].descendantsAndSelf.Select(typeId => new { typeId, prop })).ToDictionary(tp => tp.typeId + "." + tp.prop.name, tp => tp.prop);
   //return allExs().
   //  Select(fn => new { fn, url = fn.Substring(Machines.rootDir.Length).Replace(".xml", null).Replace('\\', '/') }).
   //  Select(fn => pageObj.fromXml(fn.url, loadAndValidate(fn.fn), propsDir, smap));
   return smap.scan().Where(n => n is ex || n.type == runtimeType.mediaCutFile).Select(ex => xrefPageObj.fromXml(ex.url, CourseModel.tag.loadExerciseXml(ex.fileName(), sb), propsDir, smap));
 }
Ejemplo n.º 19
0
 public override IEnumerable<tag> Generate(body pg, LoggerMemory wr) {
   var lines = smartElement.splitLines(cdata); if (lines.Length < 2) { wr.ErrorLine(pg.url, "At least 2 lines with data required"); yield break; }
   yield return new listGroup() {
     isStriped = true,
     //width = width,
     Items = doubles(lines).Select(db => new node() {
       Items = new tag[] {
         new text() { title = smartElement.splitEx(db.Item1).Select(p => p.Trim()).Aggregate((r, it) => r + " / " + it) },
         htmlTag.create(htmlTag.br),
         new gapFill() { correctValue = db.Item2.Trim() }
       }
     }).ToArray()
   };
 }
Ejemplo n.º 20
0
 public XElement getFileContentXml(CourseMeta.oldeaDataType type, LoggerMemory logger) {
   var obj = getFileContentLow(type, logger); if (obj == null) return null;
   if (obj is XElement) return (XElement)obj;
   var str = getFileContentString(type, logger);
   if (Convert.ToInt32(str[0]) == 65279) str = str.Substring(1);
   return str == null ? null : XElement.Parse(str);
 }
Ejemplo n.º 21
0
 public override IEnumerable<tag> Generate(body pg, LoggerMemory wr) {
   var lines = smartElement.splitLines(cdata); if (lines.Length == 0) { wr.ErrorLine(pg.url, "Missing lines with data"); yield break; }
   string tableStyleSheet;
   tag pref = prefix(this, inlineType, ref lines, out tableStyleSheet);
   if (pref != null) yield return pref;
   var cells = lines.Select(l => l.Split('\\').Select(w => w.Trim()).ToArray()).ToArray();
   if (cells.GroupBy(c => c.Length).Count() > 1) { wr.ErrorLine(pg.url, "The equal number of cells in every row required"); yield break; }
   var res = htmlTag.create(htmlTag.table,
     "class", "table table-bordered oli-table",
     //width = width,
     cells.Select((cls, rowIdx) => htmlTag.create(htmlTag.tr,
       cls.Select((c, colIdx) => createCell(c, wr, inlineType, rowIdx, colIdx))
     ))
   );
   res.styleSheet = tableStyleSheet;
   //smartElement.adjustWidths(res2, inlineType, wr);
   yield return res;
 }
Ejemplo n.º 22
0
 public static CmdXrefDataResult getXrefData(CmdXrefData par) {
   var url = string.IsNullOrEmpty(par.urlContext) ? "" : par.urlContext.ToLower();
   bool doRefresh = par.oper == CmdXrefDataOpers.refreshXref;
   XrefContext actCtx;
   string error = null;
   if (doRefresh || !allUrlContexts.TryGetValue(url, out actCtx)) {
     actCtx = new XrefContext();
     LoggerMemory err = new LoggerMemory(true);
     actCtx.adjustXrefData(url == "" ? null : url, doRefresh, err);
     error = err.Log().Replace("\r\n", "<br/>");
     allUrlContexts[url] = actCtx;
   }
   //lib.init();
   switch (par.oper) {
     case CmdXrefDataOpers.nodeTypes: return new CmdXrefDataResult { error = error, names = actCtx.nodeTypes(par.nodeId).ToArray() };
     case CmdXrefDataOpers.typeProps: return new CmdXrefDataResult { error = error, names = actCtx.typeProps(par.type, par.nodeId).ToArray() };
     case CmdXrefDataOpers.typePropValues: return new CmdXrefDataResult { error = error, names = actCtx.typePropValues(par.type, par.prop, par.nodeId).ToArray() };
     case CmdXrefDataOpers.typeLinks: return new CmdXrefDataResult { error = error, links = actCtx.typeLinks(par.type, par.nodeId, par.maxLinks).ToArray() };
     case CmdXrefDataOpers.typePropLinks: return new CmdXrefDataResult { error = error, links = actCtx.typePropLinks(par.type, par.prop, par.nodeId, par.maxLinks).ToArray() };
     case CmdXrefDataOpers.typePropValueLinks: return new CmdXrefDataResult { error = error, links = actCtx.typePropValueLinks(par.type, par.prop, par.value, par.nodeId, par.maxLinks).ToArray() };
     case CmdXrefDataOpers.nodeProps: return new CmdXrefDataResult { error = error, names = actCtx.nodeProps(par.nodeId).ToArray() };
     case CmdXrefDataOpers.propValues: return new CmdXrefDataResult { error = error, names = actCtx.propValues(par.prop, par.nodeId).ToArray() };
     case CmdXrefDataOpers.propLinks: return new CmdXrefDataResult { error = error, links = actCtx.propLinks(par.prop, par.nodeId, par.maxLinks).ToArray() };
     case CmdXrefDataOpers.propValueLinks: return new CmdXrefDataResult { error = error, links = actCtx.propValueLinks(par.prop, par.value, par.nodeId, par.maxLinks).ToArray() };
     case CmdXrefDataOpers.refreshXref: return new CmdXrefDataResult { error = error };
     case CmdXrefDataOpers.checkAll: return new CmdXrefDataResult { error = checkAllError() };
     default: throw new NotImplementedException();
   }
 }
Ejemplo n.º 23
0
 public override IEnumerable<tag> Generate(body pg, LoggerMemory wr) {
   if (cdata == null) yield break; 
   var lines = smartElement.splitLines(cdata); if (lines.Length == 0) yield break;
   string tableStyleSheet;
   tag pref = macroTable.prefix(this, inlineType, ref lines, out tableStyleSheet);
   if (pref != null) yield return pref;
   var res = new listGroup() {
     //width = width,
     Items = lines.Select(l => smartElement.removeNums(l).Trim()).Select(l => new node() {
       Items = smartTag.replaceMacroHardReturn(l, wr, inlineType).ToArray()
     }).ToArray()
   };
   //smartElement.adjustWidths(res2, inlineType, wr);
   yield return res;
 }
Ejemplo n.º 24
0
 public override IEnumerable<tag> Generate(body pg, LoggerMemory wr) {
   var txt = doubleCrLf.Replace(cdata, "#####");
   var linesSingleChs = txt.Split(new string[] { "#####" }, StringSplitOptions.RemoveEmptyEntries); if (linesSingleChs.Length == 0) { wr.ErrorLine(pg.url, "Missing lines with data"); yield break; }
   var singleChs = linesSingleChs.Select(l => smartElement.splitLines(l).Select(ll => smartElement.removeNums(ll)).ToArray());
   //var cnt = 0;
   var res = new twoColumn() {
     Items = singleChs.Where(l => l.Count() > 0).Select(singleCh => new panel() {
       header = new headerProp { Items = new tag[] { htmlTag.create(htmlTag.h4, smartElement.replaceMacroHardReturn(singleCh[0], wr)) } },
       //id = cnt++<0 ? "": null, //noop majici sideefekt - zvetseni cnt
       Items = new tag[] { new singleChoice {
         Items = singleCh.Skip(1).Select(t => new radioButton{correctValue = t.StartsWith("#"), Items = new tag[] { new text{title = t.TrimStart('#')}}}).ToArray()},
       }
     }).ToArray()
   };
   yield return res;
 }
Ejemplo n.º 25
0
 public override IEnumerable<tag> Generate(body pg, LoggerMemory wr) {
   yield return htmlTag.create(htmlTag.h3, new text() { title = cdata });
 }
Ejemplo n.º 26
0
 public static StringBuilder getPostDataStr(INodeContext ctx, product prod, LoggerMemory log, Action<StringBuilder> finishScriptData = null) {
   StringBuilder scriptData = buildLib.getServerScript(getPostDataFiles(ctx, prod, log));
   if (finishScriptData != null) finishScriptData(scriptData);
   return scriptData;
 }
Ejemplo n.º 27
0
 public static void allToRename() {
   var resName = @"d:\LMCom\rew\Web4\renamed\allxml.txt";
   var allFiles = validDirs.SelectMany(d => Directory.EnumerateFiles(Machines.rootDir + d.Replace('/', '\\'), "*.xml", SearchOption.AllDirectories)).Select(f => f.ToLower()).Where(f => !f.EndsWith("meta.xml")).Concat(File.ReadAllLines(@"d:\LMCom\rew\OldToNewData\fileGroups\allXmlNew.txt")).ToArray();
   File.WriteAllLines(resName, allFiles);
   return;
   LoggerMemory log = new LoggerMemory(true);
   CourseMeta.Lib.init(log, Machines.basicPath ?? @"d:\lmcom\", false);
   var exs = validDirs.SelectMany(d => CourseMeta.Lib.publishers.find(d).scan().Where(dt => (dt.type & (runtimeType.ex | runtimeType.error | runtimeType.mediaCutFile)) != 0)).ToArray();
   using (var fs = File.Open(resName, FileMode.Create)) using (var wr = new StreamWriter(fs)) {
     foreach (var ex in exs) {
       var fn = Machines.rootDir + ex.url.Replace('/', '\\') + ".xml";
       wr.WriteLine(fn);
     }
     //d:\LMCom\rew\EduAuthor\OldToNew\OldToNew_Transform.cs, line 226
     foreach (var fn in File.ReadAllLines(@"d:\LMCom\rew\OldToNewData\fileGroups\allXmlNew.txt")) wr.WriteLine(fn);
   }
 }
Ejemplo n.º 28
0
 public static IEnumerable<Packager.Consts.file> getModuleFiles(INodeContext ctx, product prod, LoggerMemory logger) {
   try {
     //var ctx = new serverContext(url, logger);
     if (ctx.line == LineIds.no) { logger.ErrorLine("?", "Unknown product Line"); return Enumerable.Empty<Packager.Consts.file>(); }
     if (prod == null) prod = new product {
       url = vsNetProductId,
       styleSheet = ex.stdStyle,
       line = ctx.line,
       title = ctx.actNode.title,
       //Items = new data[] { new ptr(ctx.actNode.type == runtimeType.no ? new taskCourse() : null, ctx.url) { takeChilds = childMode.selfChild } }
       Items = new data[] { new ptr(true, ctx.url) { takeChilds = childMode.selfChild } }
     };
     var sm = ctx.getSiteMap(logger);
     prod = (product)prodDef.expand(prod, sm, logger);
     prodDef.addInstructions(prod, logger);
     var bldProd = new buildProduct {
       prod = prod,
       natLangs = new Langs[] { Langs.cs_cz },
       dictType = dictTypes.L
     };
     Cache cache = new Cache(logger, new Langs[] { Langs.cs_cz });
     return bldProd.getFiles(cache, logger, sm).ToArray();
   } catch (Exception exp) {
     logger.ErrorLineFmt("?", ">>>> Compiling Error {0}", LowUtils.ExceptionToString(exp));
     return Enumerable.Empty<Packager.Consts.file>();
   }
 }
Ejemplo n.º 29
0
Archivo: Main.cs Proyecto: PavelPZ/REW
 void EditBtn_Click(object sender, EventArgs e) {
   if (comboEdit.SelectedItem == null) return;
   var tpObj = typeObj.itemsDict[((typeObj)comboEdit.SelectedItem).value];
   LoggerMemory log = new LoggerMemory(false);
   var isEditable = (tpObj.value == oldeaDataType.lmdataNew && File.Exists(fileEx.fileName(oldeaDataType.lmdataNew))) || tpObj.editable;
   if (isEditable) {
     var cont = fileEx.getFileContentLow(tpObj.value, log) as string; if (cont == null) return;
     if (cont[0] != '@') {
       var fn = tempDir + fileEx.tempFileName(tpObj.value);
       File.WriteAllText(fn, log.hasError ? log.Log() : cont, Encoding.UTF8);
       openInVSNet(fn);
     } else
       openInVSNet(cont.Substring(1));
   } else {
     var cont = fileEx.getFileContentString(tpObj.value, log);
     var fn = tempDir + fileEx.tempFileName(tpObj.value);
     File.WriteAllText(fn, log.hasError ? log.Log() : cont, Encoding.UTF8);
     openInVSNet(fn);
   }
 }
Ejemplo n.º 30
0
 public static string checkAllError() {
   LoggerMemory log = new LoggerMemory(true);
   CourseMeta.Lib.init(log, Machines.basicPath ?? @"d:\lmcom\", true); //RENAME
   var exs = validDirs.SelectMany(d => CourseMeta.Lib.publishers.find(d).scan().Where(dt => (dt.type & (runtimeType.ex | runtimeType.error | runtimeType.mediaCutFile)) != 0)).ToArray();
   Parallel.ForEach(exs, ex => ex.readTag(log));
   //foreach (var ex in exs) ex.readTag(log);
   var error = log.Log();
   return string.IsNullOrEmpty(error) ? ">>>>>>>>>>>>>>> ALL OK :-)" : error;
 }