Exemple #1
0
 static bool createMeta(Rewise.Book bk, ref RwBooksMeta res) {
   var less = bk.lessons().Where(l => !string.IsNullOrEmpty(l.jsonId)).Select(l => new RwBooksMeta.link() { jsonId = l.jsonId, lesId = l.Id }).ToArray();
   if (less.Length == 0) less = null;
   bool isCreated = res == null;
   if (isCreated) res = new RwBooksMeta();
   res.Id = bk.Id;
   res.Name = bk.Name;
   res.courseLinks = less;
   res.LineId = bk.LineId;
   return isCreated;
 }
Exemple #2
0
 static void mergeLoc(Rewise.Book bk, RwBooksLoc loc, ref bool changed) {
   if (!RwFactLoc.isEmpty(loc.Trans) || !RwFactLoc.isEmpty(loc.TransPerex) || !RwFactLoc.isEmpty(loc.AdminEMail)) {
     Rewise.LocaleBook lb = bk.adjustLoc(loc.Lang);
     if (lb.Text != loc.Trans) { changed = true; lb.Text = loc.Trans; }
     if (lb.Perex != loc.TransPerex) { changed = true; lb.Perex = loc.TransPerex; }
     if (lb.AdminEMail != loc.AdminEMail) { changed = true; lb.AdminEMail = loc.AdminEMail; }
   }
   foreach (var l in loc.Locs.Where(l => !l.isEmpty())) {
     if (RwIdManager.isFactId(l.Id)) {
       var side = bk.findFact(l.Id).adjustSide(loc.Lang); if (side.Text != l.Trans) { changed = true; side.Text = l.Trans; }
     } else if (RwIdManager.isLessonId(l.Id)) {
       var lc = bk.findLess((int)l.Id).adjustLoc(loc.Lang); if (lc.Text != l.Trans) { changed = true; lc.Text = l.Trans; }
     }
   }
 }
Exemple #3
0
 public static Rew.FactSrc createFact(Rewise.SrcFact f, Langs srcLang, Langs loc, StringBuilder sb) {
   return new Rew.FactSrc() { DbId = f.Id, Type = f.Type, Question = getFactText(f.getAnswer(Langs.no), srcLang, sb), Answer = getFactText(f.getAnswer(loc), loc, sb) };
 }