)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » ApplicationInformation (Ia.TentPlay.Cl.Model.Data.Trek)

Public general use code classes and xml files that we've compiled and used over the years:

ApplicationInformation Support class for TentPlay Trek data model

    1: using System;
    2: using System.Linq;
    3: using System.Collections.Generic;
    4: using System.IO;
    5: using System.Text.RegularExpressions;
    6: using System.Xml.Linq;
    7: using System.Reflection;
    8: using System.Web;
    9: using static Ia.Cl.Models.Db.Temp;
   10:  
   11: namespace Ia.TentPlay.Cl.Model.Data.Trek
   12: {
   13:     ////////////////////////////////////////////////////////////////////////////
   14:  
   15:     /// <summary publish="true">
   16:     /// ApplicationInformation Support class for TentPlay Trek data model
   17:     /// </summary>
   18:     /// 
   19:     /// <remarks> 
   20:     /// Copyright © 2006-2024 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   21:     ///
   22:     /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
   23:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   24:     ///
   25:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   26:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   27:     /// 
   28:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   29:     /// 
   30:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   31:     /// </remarks> 
   32:     public class ApplicationInformation
   33:     {
   34:         private static XDocument xDocument;
   35:         private static List<Country> countryList;
   36:         private static List<Translation> translationList;
   37:  
   38:         private static readonly object objectLock = new object();
   39:  
   40:         ////////////////////////////////////////////////////////////////////////////
   41:  
   42:         /// <summary>
   43:         ///
   44:         /// </summary>
   45:         public ApplicationInformation() { }
   46:  
   47:         ////////////////////////////////////////////////////////////////////////////
   48:         ////////////////////////////////////////////////////////////////////////////
   49:  
   50:         /// <summary>
   51:         ///
   52:         /// </summary>
   53:         public class Country
   54:         {
   55:             private List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> translationList;
   56:  
   57:             /// <summary/>
   58:             public Country() { }
   59:  
   60:             /// <summary/>
   61:             public string Iso3 { get; set; }
   62:  
   63:             /// <summary/>
   64:             public string Name { get; set; }
   65:  
   66:             /// <summary/>
   67:             public Dictionary<string, string> NameDictionary { get; set; }
   68:  
   69:             /// <summary/>
   70:             public string ManifestPackagePrefix { get; set; }
   71:  
   72:             /// <summary/>
   73:             public Dictionary<string, string> ApplicationNameDictionary { get; set; }
   74:  
   75:             /// <summary/>
   76:             public string WhatsNew { get; set; }
   77:  
   78:             /// <summary/>
   79:             public string VersionName { get; set; }
   80:  
   81:             /// <summary/>
   82:             public string CopyrightYear { get; set; }
   83:  
   84:             /// <summary/>
   85:             public string ManifestPackage { get; set; }
   86:  
   87:             /// <summary/>
   88:             public string ApplicationUrl { get; set; }
   89:  
   90:             /// <summary/>
   91:             public string GoogleMapsDebugApiKey { get; set; }
   92:  
   93:             /// <summary/>
   94:             public string GoogleMapsProductionApiKey { get; set; }
   95:  
   96:             /// <summary/>
   97:             public string GoogleAdMobAdUnitDebugId { get; set; }
   98:  
   99:             /// <summary/>
  100:             public string GoogleAdMobAppId { get; set; }
  101:  
  102:             /// <summary/>
  103:             public string GoogleAdMobAdUnitProductionId { get; set; }
  104:  
  105:             /// <summary/>
  106:             public DateTime Published { get; set; }
  107:  
  108:             /// <summary/>
  109:             public int FeatureCount { get; set; }
  110:  
  111:             /// <summary/>
  112:             public int AdministrativeFeatureCount { get; set; }
  113:  
  114:             /// <summary/>
  115:             public int PopulatedFeatureCount { get; set; }
  116:  
  117:             /// <summary/>
  118:             public int VegetationFeatureCount { get; set; }
  119:  
  120:             /// <summary/>
  121:             public int LocalityFeatureCount { get; set; }
  122:  
  123:             /// <summary/>
  124:             public int UnderseaFeatureCount { get; set; }
  125:  
  126:             /// <summary/>
  127:             public int StreetFeatureCount { get; set; }
  128:  
  129:             /// <summary/>
  130:             public int HypsographicFeatureCount { get; set; }
  131:  
  132:             /// <summary/>
  133:             public int HydrographicFeatureCount { get; set; }
  134:  
  135:             /// <summary/>
  136:             public int SpotFeatureCount { get; set; }
  137:  
  138:             /// <summary/>
  139:             public string ColorPrimary { get; set; }
  140:  
  141:             /// <summary/>
  142:             public string ColorPrimaryDark { get; set; }
  143:  
  144:             /// <summary/>
  145:             public string ColorAccent { get; set; }
  146:  
  147:             /// <summary/>
  148:             public bool LanguageListMatchesTranslationList
  149:             {
  150:                 get
  151:                 {
  152:                     bool b;
  153:  
  154:                     if (Languages != null && Translations != null)
  155:                     {
  156:                         b = Languages.All(u => Translations.Any(y => y.Iso6391 == u.Iso6391)) && Translations.All(u => Languages.Any(y => y.Iso6391 == u.Iso6391)) && Languages.Count == Translations.Count;
  157:                     }
  158:                     else b = false;
  159:  
  160:                     return b;
  161:                 }
  162:             }
  163:  
  164:             /// <summary/>
  165:             public virtual List<Image> NavigationHeaderImages { get; set; }
  166:  
  167:             /// <summary/>
  168:             public virtual List<Ia.Cl.Models.Language> Languages { get; set; }
  169:  
  170:             /// <summary/>
  171:             public virtual ICollection<Translation> Translations
  172:             {
  173:                 get
  174:                 {
  175:                     if (translationList == null || translationList.Count == 0)
  176:                     {
  177:                         translationList = TranslationList(this);
  178:                     }
  179:  
  180:                     return translationList;
  181:                 }
  182:             }
  183:  
  184:             ////////////////////////////////////////////////////////////////////////////
  185:  
  186:             /// <summary>
  187:             ///
  188:             /// </summary>
  189:             public string FeatureGraphicImageUrl
  190:             {
  191:                 get
  192:                 {
  193:                     return "https://cdn.tentplay.com/trek/country/" + this.Iso3 + @"/images/feature-graphic.png";
  194:                 }
  195:             }
  196:  
  197:             ////////////////////////////////////////////////////////////////////////////
  198:  
  199:             /// <summary>
  200:             ///
  201:             /// </summary>
  202:             public string PromoGraphicImageUrl
  203:             {
  204:                 get
  205:                 {
  206:                     return "https://cdn.tentplay.com/trek/country/" + this.Iso3 + @"/images/promo-graphic.png";
  207:                 }
  208:             }
  209:  
  210:             ////////////////////////////////////////////////////////////////////////////
  211:  
  212:             /// <summary>
  213:             ///
  214:             /// </summary>
  215:             public string HiResIconImageUrl
  216:             {
  217:                 get
  218:                 {
  219:                     return "https://cdn.tentplay.com/trek/country/" + this.Iso3 + @"/images/hi-res-icon.png";
  220:                 }
  221:             }
  222:  
  223:             ////////////////////////////////////////////////////////////////////////////
  224:             ////////////////////////////////////////////////////////////////////////////
  225:  
  226:             /// <summary>
  227:             ///
  228:             /// </summary>
  229:             public string MipMapLdpiIcLauncherImageUrl
  230:             {
  231:                 get
  232:                 {
  233:                     return MipMapXIcLauncherImage("ldpi");
  234:                 }
  235:             }
  236:  
  237:             ////////////////////////////////////////////////////////////////////////////
  238:  
  239:             /// <summary>
  240:             ///
  241:             /// </summary>
  242:             public string MipMapMdpiIcLauncherImageUrl
  243:             {
  244:                 get
  245:                 {
  246:                     return MipMapXIcLauncherImage("mdpi");
  247:                 }
  248:             }
  249:  
  250:             ////////////////////////////////////////////////////////////////////////////
  251:  
  252:             /// <summary>
  253:             ///
  254:             /// </summary>
  255:             public string MipMapHdpiIcLauncherImageUrl
  256:             {
  257:                 get
  258:                 {
  259:                     return MipMapXIcLauncherImage("hdpi");
  260:                 }
  261:             }
  262:  
  263:             ////////////////////////////////////////////////////////////////////////////
  264:  
  265:             /// <summary>
  266:             ///
  267:             /// </summary>
  268:             public string MipMapXhdpiIcLauncherImageUrl
  269:             {
  270:                 get
  271:                 {
  272:                     return MipMapXIcLauncherImage("xhdpi");
  273:                 }
  274:             }
  275:  
  276:             ////////////////////////////////////////////////////////////////////////////
  277:  
  278:             /// <summary>
  279:             ///
  280:             /// </summary>
  281:             public string MipMapXxhdpiIcLauncherImageUrl
  282:             {
  283:                 get
  284:                 {
  285:                     return MipMapXIcLauncherImage("xxhdpi");
  286:                 }
  287:             }
  288:  
  289:             ////////////////////////////////////////////////////////////////////////////
  290:  
  291:             /// <summary>
  292:             ///
  293:             /// </summary>
  294:             public string MipMapXxxhdpiIcLauncherImageUrl
  295:             {
  296:                 get
  297:                 {
  298:                     return MipMapXIcLauncherImage("xxxhdpi");
  299:                 }
  300:             }
  301:  
  302:             ////////////////////////////////////////////////////////////////////////////
  303:  
  304:             /// <summary>
  305:             ///
  306:             /// </summary>
  307:             public string MipMapXIcLauncherImage(string x)
  308:             {
  309:                 return "https://cdn.tentplay.com/trek/country/" + this.Iso3 + @"/images/mipmap-" + x + "/ic_launcher.png";
  310:             }
  311:  
  312:             ////////////////////////////////////////////////////////////////////////////
  313:             ////////////////////////////////////////////////////////////////////////////
  314:  
  315:             /// <summary>
  316:             ///
  317:             /// </summary>
  318:             public string MipMapLdpiSplashScreenImageUrl
  319:             {
  320:                 get
  321:                 {
  322:                     return MipMapXSplashScreenImage("ldpi");
  323:                 }
  324:             }
  325:  
  326:             ////////////////////////////////////////////////////////////////////////////
  327:  
  328:             /// <summary>
  329:             ///
  330:             /// </summary>
  331:             public string MipMapMdpiSplashScreenImageUrl
  332:             {
  333:                 get
  334:                 {
  335:                     return MipMapXSplashScreenImage("mdpi");
  336:                 }
  337:             }
  338:  
  339:             ////////////////////////////////////////////////////////////////////////////
  340:  
  341:             /// <summary>
  342:             ///
  343:             /// </summary>
  344:             public string MipMapHdpiSplashScreenImageUrl
  345:             {
  346:                 get
  347:                 {
  348:                     return MipMapXSplashScreenImage("hdpi");
  349:                 }
  350:             }
  351:  
  352:             ////////////////////////////////////////////////////////////////////////////
  353:  
  354:             /// <summary>
  355:             ///
  356:             /// </summary>
  357:             public string MipMapXhdpiSplashScreenImageUrl
  358:             {
  359:                 get
  360:                 {
  361:                     return MipMapXSplashScreenImage("xhdpi");
  362:                 }
  363:             }
  364:  
  365:             ////////////////////////////////////////////////////////////////////////////
  366:  
  367:             /// <summary>
  368:             ///
  369:             /// </summary>
  370:             public string MipMapXxhdpiSplashScreenImageUrl
  371:             {
  372:                 get
  373:                 {
  374:                     return MipMapXSplashScreenImage("xxhdpi");
  375:                 }
  376:             }
  377:  
  378:             ////////////////////////////////////////////////////////////////////////////
  379:  
  380:             /// <summary>
  381:             ///
  382:             /// </summary>
  383:             public string MipMapXxxhdpiSplashScreenImageUrl
  384:             {
  385:                 get
  386:                 {
  387:                     return MipMapXSplashScreenImage("xxxhdpi");
  388:                 }
  389:             }
  390:  
  391:             ////////////////////////////////////////////////////////////////////////////
  392:  
  393:             /// <summary>
  394:             ///
  395:             /// </summary>
  396:             public string MipMapXSplashScreenImage(string x)
  397:             {
  398:                 return "https://cdn.tentplay.com/trek/country/" + this.Iso3 + @"/images/mipmap-" + x + "/splash_screen.png";
  399:             }
  400:  
  401:             ////////////////////////////////////////////////////////////////////////////    
  402:             ////////////////////////////////////////////////////////////////////////////
  403:  
  404:             /// <summary>
  405:             ///
  406:             /// </summary>
  407:             public string StoreListingSampleScreenCapture1ImageUrl
  408:             {
  409:                 get
  410:                 {
  411:                     return StoreListingSampleScreenCaptureXImage(1);
  412:                 }
  413:             }
  414:  
  415:             ////////////////////////////////////////////////////////////////////////////
  416:  
  417:             /// <summary>
  418:             ///
  419:             /// </summary>
  420:             public string StoreListingSampleScreenCapture2ImageUrl
  421:             {
  422:                 get
  423:                 {
  424:                     return StoreListingSampleScreenCaptureXImage(2);
  425:                 }
  426:             }
  427:  
  428:             ////////////////////////////////////////////////////////////////////////////
  429:  
  430:             /// <summary>
  431:             ///
  432:             /// </summary>
  433:             public string StoreListingSampleScreenCapture3ImageUrl
  434:             {
  435:                 get
  436:                 {
  437:                     return StoreListingSampleScreenCaptureXImage(3);
  438:                 }
  439:             }
  440:  
  441:             ////////////////////////////////////////////////////////////////////////////
  442:  
  443:             /// <summary>
  444:             ///
  445:             /// </summary>
  446:             public string StoreListingSampleScreenCapture4ImageUrl
  447:             {
  448:                 get
  449:                 {
  450:                     return StoreListingSampleScreenCaptureXImage(4);
  451:                 }
  452:             }
  453:  
  454:             ////////////////////////////////////////////////////////////////////////////
  455:  
  456:             /// <summary>
  457:             ///
  458:             /// </summary>
  459:             public string StoreListingSampleScreenCapture5ImageUrl
  460:             {
  461:                 get
  462:                 {
  463:                     return StoreListingSampleScreenCaptureXImage(5);
  464:                 }
  465:             }
  466:  
  467:             ////////////////////////////////////////////////////////////////////////////
  468:  
  469:             /// <summary>
  470:             ///
  471:             /// </summary>
  472:             public string StoreListingSampleScreenCapture6ImageUrl
  473:             {
  474:                 get
  475:                 {
  476:                     return StoreListingSampleScreenCaptureXImage(6);
  477:                 }
  478:             }
  479:  
  480:             ////////////////////////////////////////////////////////////////////////////
  481:  
  482:             /// <summary>
  483:             ///
  484:             /// </summary>
  485:             public string StoreListingSampleScreenCapture7ImageUrl
  486:             {
  487:                 get
  488:                 {
  489:                     return StoreListingSampleScreenCaptureXImage(7);
  490:                 }
  491:             }
  492:  
  493:             ////////////////////////////////////////////////////////////////////////////
  494:  
  495:             /// <summary>
  496:             ///
  497:             /// </summary>
  498:             public string StoreListingSampleScreenCapture8ImageUrl
  499:             {
  500:                 get
  501:                 {
  502:                     return StoreListingSampleScreenCaptureXImage(8);
  503:                 }
  504:             }
  505:  
  506:             ////////////////////////////////////////////////////////////////////////////
  507:  
  508:             /// <summary>
  509:             ///
  510:             /// </summary>
  511:             public string StoreListingSampleScreenCaptureXImage(int i)
  512:             {
  513:                 return "https://cdn.tentplay.com/trek/country/" + this.Iso3 + @"/images/" + i + ".png";
  514:             }
  515:  
  516:             ////////////////////////////////////////////////////////////////////////////    
  517:             ////////////////////////////////////////////////////////////////////////////    
  518:         }
  519:  
  520:         ////////////////////////////////////////////////////////////////////////////    
  521:  
  522:         public class Image
  523:         {
  524:             /// <summary/>
  525:             //public string Caption { get; set; }
  526:  
  527:             /// <summary/>
  528:             //public string Photographer { get; set; }
  529:  
  530:             /// <summary/>
  531:             //public string Source { get; set; }
  532:  
  533:             /// <summary/>
  534:             public string AndroidFileName { get; set; }
  535:  
  536:             /// <summary/>
  537:             public string FileName { get; set; }
  538:         }
  539:  
  540:         ////////////////////////////////////////////////////////////////////////////    
  541:  
  542:         public class Translation
  543:         {
  544:             /// <summary/>
  545:             public Translation() { }
  546:  
  547:             /// <summary/>
  548:             public string CountryIso3 { get; set; }
  549:             /// <summary/>
  550:             public string Iso6391 { get; set; }
  551:             /// <summary/>
  552:             public string SiteName { get; set; }
  553:             /// <summary/>
  554:             public string CompanyName { get; set; }
  555:             /// <summary/>
  556:             public string ShortDescription { get; set; }
  557:             /// <summary/>
  558:             public string LongDescription { get; set; }
  559:  
  560:             /// <summary/>
  561:             public string About { get; set; }
  562:             /// <summary/>
  563:             public string AboutTitle { get; set; }
  564:             /// <summary/>
  565:             public string SearchSearchHint { get; set; }
  566:             /// <summary/>
  567:             public string Statistic { get; set; }
  568:             /// <summary/>
  569:             public string StatisticTitle { get; set; }
  570:             /// <summary/>
  571:             public string Setting { get; set; }
  572:             /// <summary/>
  573:             public string SettingTitle { get; set; }
  574:  
  575:             /// <summary/>
  576:             public string ShareTitle { get; set; }
  577:             /// <summary/>
  578:             public string ShareApplication { get; set; }
  579:             /// <summary/>
  580:             public string ShareTrek { get; set; }
  581:             /// <summary/>
  582:             public string ShareNoEmailClientInstalled { get; set; }
  583:             /// <summary/>
  584:             public string ShareContactUs { get; set; }
  585:  
  586:             /// <summary/>
  587:             public string HelpFeedbackTitle { get; set; }
  588:             /// <summary/>
  589:             public string Help { get; set; }
  590:             /// <summary/>
  591:             public string HelpTitle { get; set; }
  592:             /// <summary/>
  593:             public string HelpMagnifiyingGlass { get; set; }
  594:             /// <summary/>
  595:             public string HelpMainListOrder { get; set; }
  596:             /// <summary/>
  597:             public string HelpMapType { get; set; }
  598:             /// <summary/>
  599:             public string HelpGoogleMapRoute { get; set; }
  600:             /// <summary/>
  601:             public string HelpGoogleMapMarker { get; set; }
  602:             /// <summary/>
  603:             public string Feedback { get; set; }
  604:             /// <summary/>
  605:             public string FeedbackTitle { get; set; }
  606:             /// <summary/>
  607:             public string FeedbackEmailSubject { get; set; }
  608:  
  609:             /// <summary/>
  610:             public string Legal { get; set; }
  611:             /// <summary/>
  612:             public string LegalTitle { get; set; }
  613:             /// <summary/>
  614:             public string FeatureClassName { get; set; }
  615:             /// <summary/>
  616:             public string FeatureClassCaption { get; set; }
  617:             /// <summary/>
  618:             public string FeatureClassDescription { get; set; }
  619:             /// <summary/>
  620:             public string FeatureClassAdministrativeName { get; set; }
  621:             /// <summary/>
  622:             public string FeatureClassAdministrativeCaption { get; set; }
  623:             /// <summary/>
  624:             public string FeatureClassAdministrativeClassId { get; set; }
  625:             /// <summary/>
  626:             public string FeatureClassAdministrativeDescription { get; set; }
  627:             /// <summary/>
  628:             public string FeatureClassPopulatedName { get; set; }
  629:             /// <summary/>
  630:             public string FeatureClassPopulatedCaption { get; set; }
  631:             /// <summary/>
  632:             public string FeatureClassPopulatedClassId { get; set; }
  633:             /// <summary/>
  634:             public string FeatureClassPopulatedDescription { get; set; }
  635:             /// <summary/>
  636:             public string FeatureClassVegetationName { get; set; }
  637:             /// <summary/>
  638:             public string FeatureClassVegetationCaption { get; set; }
  639:             /// <summary/>
  640:             public string FeatureClassVegetationClassId { get; set; }
  641:             /// <summary/>
  642:             public string FeatureClassVegetationDescription { get; set; }
  643:             /// <summary/>
  644:             public string FeatureClassLocalityName { get; set; }
  645:             /// <summary/>
  646:             public string FeatureClassLocalityCaption { get; set; }
  647:             /// <summary/>
  648:             public string FeatureClassLocalityClassId { get; set; }
  649:             /// <summary/>
  650:             public string FeatureClassLocalityDescription { get; set; }
  651:             /// <summary/>
  652:             public string FeatureClassUnderseaName { get; set; }
  653:             /// <summary/>
  654:             public string FeatureClassUnderseaCaption { get; set; }
  655:             /// <summary/>
  656:             public string FeatureClassUnderseaClassId { get; set; }
  657:             /// <summary/>
  658:             public string FeatureClassUnderseaDescription { get; set; }
  659:             /// <summary/>
  660:             public string FeatureClassStreetName { get; set; }
  661:             /// <summary/>
  662:             public string FeatureClassStreetCaption { get; set; }
  663:             /// <summary/>
  664:             public string FeatureClassStreetClassId { get; set; }
  665:             /// <summary/>
  666:             public string FeatureClassStreetDescription { get; set; }
  667:             /// <summary/>
  668:             public string FeatureClassHypsographicName { get; set; }
  669:             /// <summary/>
  670:             public string FeatureClassHypsographicCaption { get; set; }
  671:             /// <summary/>
  672:             public string FeatureClassHypsographicClassId { get; set; }
  673:             /// <summary/>
  674:             public string FeatureClassHypsographicDescription { get; set; }
  675:             /// <summary/>
  676:             public string FeatureClassHydrographicName { get; set; }
  677:             /// <summary/>
  678:             public string FeatureClassHydrographicCaption { get; set; }
  679:             /// <summary/>
  680:             public string FeatureClassHydrographicClassId { get; set; }
  681:             /// <summary/>
  682:             public string FeatureClassHydrographicDescription { get; set; }
  683:             /// <summary/>
  684:             public string FeatureClassSpotName { get; set; }
  685:             /// <summary/>
  686:             public string FeatureClassSpotCaption { get; set; }
  687:             /// <summary/>
  688:             public string FeatureClassSpotClassId { get; set; }
  689:             /// <summary/>
  690:             public string FeatureClassSpotDescription { get; set; }
  691:             /// <summary/>
  692:             public virtual ICollection<Country> Countries
  693:             {
  694:                 get
  695:                 {
  696:                     return (from c in CountryList where c.Languages.Any(u => u.Iso6391 == this.Iso6391) select c).ToList();
  697:                 }
  698:             }
  699:             /// <summary/>
  700:             public List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass> FeatureClassList
  701:             {
  702:                 get
  703:                 {
  704:                     Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass fc;
  705:                     List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass> list;
  706:  
  707:                     list = new List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass>();
  708:  
  709:                     fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
  710:  
  711:                     fc.Id = this.FeatureClassAdministrativeClassId;
  712:                     fc.Name = this.FeatureClassAdministrativeName;
  713:                     fc.Caption = this.FeatureClassAdministrativeCaption;
  714:                     fc.Description = this.FeatureClassAdministrativeDescription;
  715:  
  716:                     list.Add(fc);
  717:  
  718:  
  719:                     fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
  720:  
  721:                     fc.Id = this.FeatureClassPopulatedClassId;
  722:                     fc.Name = this.FeatureClassPopulatedName;
  723:                     fc.Caption = this.FeatureClassPopulatedCaption;
  724:                     fc.Description = this.FeatureClassPopulatedDescription;
  725:  
  726:                     list.Add(fc);
  727:  
  728:  
  729:                     fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
  730:  
  731:                     fc.Id = this.FeatureClassVegetationClassId;
  732:                     fc.Name = this.FeatureClassVegetationName;
  733:                     fc.Caption = this.FeatureClassVegetationCaption;
  734:                     fc.Description = this.FeatureClassVegetationDescription;
  735:  
  736:                     list.Add(fc);
  737:  
  738:  
  739:                     fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
  740:  
  741:                     fc.Id = this.FeatureClassLocalityClassId;
  742:                     fc.Name = this.FeatureClassLocalityName;
  743:                     fc.Caption = this.FeatureClassLocalityCaption;
  744:                     fc.Description = this.FeatureClassLocalityDescription;
  745:  
  746:                     list.Add(fc);
  747:  
  748:  
  749:                     fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
  750:  
  751:                     fc.Id = this.FeatureClassUnderseaClassId;
  752:                     fc.Name = this.FeatureClassUnderseaName;
  753:                     fc.Caption = this.FeatureClassUnderseaCaption;
  754:                     fc.Description = this.FeatureClassUnderseaDescription;
  755:  
  756:                     list.Add(fc);
  757:  
  758:  
  759:                     fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
  760:  
  761:                     fc.Id = this.FeatureClassStreetClassId;
  762:                     fc.Name = this.FeatureClassStreetName;
  763:                     fc.Caption = this.FeatureClassStreetCaption;
  764:                     fc.Description = this.FeatureClassStreetDescription;
  765:  
  766:                     list.Add(fc);
  767:  
  768:  
  769:                     fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
  770:  
  771:                     fc.Id = this.FeatureClassHypsographicClassId;
  772:                     fc.Name = this.FeatureClassHypsographicName;
  773:                     fc.Caption = this.FeatureClassHypsographicCaption;
  774:                     fc.Description = this.FeatureClassHypsographicDescription;
  775:  
  776:                     list.Add(fc);
  777:  
  778:  
  779:                     fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
  780:  
  781:                     fc.Id = this.FeatureClassHydrographicClassId;
  782:                     fc.Name = this.FeatureClassHydrographicName;
  783:                     fc.Caption = this.FeatureClassHydrographicCaption;
  784:                     fc.Description = this.FeatureClassHydrographicDescription;
  785:  
  786:                     list.Add(fc);
  787:  
  788:  
  789:                     fc = new Ia.TentPlay.Cl.Model.Business.Trek.FeatureClass();
  790:  
  791:                     fc.Id = this.FeatureClassSpotClassId;
  792:                     fc.Name = this.FeatureClassSpotName;
  793:                     fc.Caption = this.FeatureClassSpotCaption;
  794:                     fc.Description = this.FeatureClassSpotDescription;
  795:  
  796:                     list.Add(fc);
  797:  
  798:                     return list;
  799:                 }
  800:             }
  801:         }
  802:  
  803:         ////////////////////////////////////////////////////////////////////////////
  804:  
  805:         /// <summary>
  806:         ///
  807:         /// </summary>
  808:         public static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country> CountryList
  809:         {
  810:             get
  811:             {
  812:                 if (countryList == null || countryList.Count == 0)
  813:                 {
  814:                     lock (objectLock)
  815:                     {
  816:                         Country country;
  817:  
  818:                         countryList = new List<Country>(100);
  819:  
  820:                         foreach (XElement x in XDocument.Element("applicationInformation").Element("countryList").Elements("country"))
  821:                         {
  822:                             country = new Country();
  823:                             country.Iso3 = x.Attribute("id").Value;
  824:  
  825:                             country.Name = (from c in Ia.Cl.Models.Country.List where c.Iso3 == country.Iso3.ToUpper() select c.Name).SingleOrDefault();
  826:                             country.NameDictionary = (from c in Ia.Cl.Models.Country.List where c.Iso3 == country.Iso3.ToUpper() select c.NameDictionary).SingleOrDefault();
  827:  
  828:                             country.ManifestPackagePrefix = x.Parent.Parent.Element("manifestPackagePrefix").Value;
  829:  
  830:                             country.GoogleMapsDebugApiKey = x.Parent.Parent.Element("googleMapsDebugApiKey").Value;
  831:                             country.GoogleAdMobAdUnitDebugId = x.Parent.Parent.Element("googleAdMobAdUnitDebugId").Value;
  832:  
  833:                             country.ApplicationNameDictionary = ApplicationNameDictionary(x);
  834:  
  835:                             country.WhatsNew = Regex.Replace(x.Parent.Parent.Element("googleStoreWhatsNew").Value.Trim(), @"\n[ ]+", "\n");
  836:  
  837:                             country.VersionName = x.Element("version").Attribute("name").Value;
  838:                             country.CopyrightYear = x.Element("version").Attribute("copyrightYear").Value;
  839:                             country.ManifestPackage = x.Element("manifestPackage").Value;
  840:  
  841:                             country.ApplicationUrl = ReplaceNameVariableWithName(Ia.TentPlay.Cl.Model.Data.CompanyInformation.ApplicationDownloadLink, country);
  842:  
  843:                             country.GoogleMapsProductionApiKey = x.Element("googleMapsProductionApiKey").Value;
  844:                             country.GoogleAdMobAppId = x.Element("googleAdMobAppId").Value;
  845:                             country.GoogleAdMobAdUnitProductionId = x.Element("googleAdMobAdUnitId").Value;
  846:  
  847:                             country.Published = (x.Element("version").Attribute("published") != null && x.Element("version").Attribute("published").Value != string.Empty) ? DateTime.Parse(x.Element("version").Attribute("published").Value) : DateTime.MinValue;
  848:  
  849:                             country.ColorPrimary = (from e in x.Element("colorTheme").Elements("color") where e.Attribute("name").Value == "colorPrimary" select e.Attribute("value").Value).SingleOrDefault();
  850:                             country.ColorPrimaryDark = (from e in x.Element("colorTheme").Elements("color") where e.Attribute("name").Value == "colorPrimaryDark" select e.Attribute("value").Value).SingleOrDefault();
  851:                             country.ColorAccent = (from e in x.Element("colorTheme").Elements("color") where e.Attribute("name").Value == "colorAccent" select e.Attribute("value").Value).SingleOrDefault();
  852:  
  853:                             country.NavigationHeaderImages = ApplicationImageList(x.Element("navigationHeader").Element("imageList"));
  854:  
  855:                             country.Languages = ApplicationLanguageList(country.Iso3, country.ApplicationNameDictionary);
  856:  
  857:                             countryList.Add(country);
  858:                         }
  859:                     }
  860:                 }
  861:  
  862:                 return countryList.ToList();
  863:             }
  864:         }
  865:  
  866:         ////////////////////////////////////////////////////////////////////////////
  867:  
  868:         /// <summary>
  869:         ///
  870:         /// </summary>
  871:         public static Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country ByIso3(string iso3)
  872:         {
  873:             var country = (from c in CountryList where c.Iso3 == iso3 select c).SingleOrDefault();
  874:  
  875:             return country;
  876:         }
  877:  
  878:         ////////////////////////////////////////////////////////////////////////////
  879:  
  880:         /// <summary>
  881:         ///
  882:         /// </summary>
  883:         public static void CountryStatisticCalcucation(ref Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country country)
  884:         {
  885:             int featureCount, administrative, populated, vegetation, locality, undersea, street, hypsographic, hydrographic, spot;
  886:             Ia.Cl.Models.Result result;
  887:  
  888:             Ia.TentPlay.Cl.Model.Data.Trek.Feature.Statistic(country.Iso3, out featureCount, out administrative, out populated, out vegetation, out locality, out undersea, out street, out hypsographic, out hydrographic, out spot, out result);
  889:  
  890:             country.FeatureCount = featureCount;
  891:             country.AdministrativeFeatureCount = administrative;
  892:             country.PopulatedFeatureCount = populated;
  893:             country.VegetationFeatureCount = vegetation;
  894:             country.LocalityFeatureCount = locality;
  895:             country.UnderseaFeatureCount = undersea;
  896:             country.StreetFeatureCount = street;
  897:             country.HypsographicFeatureCount = hypsographic;
  898:             country.HydrographicFeatureCount = hydrographic;
  899:             country.SpotFeatureCount = spot;
  900:         }
  901:  
  902:         ////////////////////////////////////////////////////////////////////////////
  903:  
  904:         /// <summary>
  905:         /// 
  906:         /// </summary>
  907:         private static Dictionary<string, string> ApplicationNameDictionary(XElement xElement)
  908:         {
  909:             XElement xe;
  910:             IEnumerable<XAttribute> list;
  911:             Dictionary<string, string> dictionary;
  912:  
  913:             dictionary = new Dictionary<string, string>();
  914:  
  915:             xe = xElement.Element("applicationName");
  916:  
  917:             if (xe.HasAttributes)
  918:             {
  919:                 list = xe.Attributes();
  920:  
  921:                 foreach (XAttribute xa in list)
  922:                 {
  923:                     dictionary.Add(xa.Name.LocalName, xa.Value);
  924:                 }
  925:             }
  926:  
  927:             return dictionary;
  928:         }
  929:  
  930:         ////////////////////////////////////////////////////////////////////////////
  931:  
  932:         /// <summary>
  933:         /// 
  934:         /// </summary>
  935:         private static List<Ia.Cl.Models.Language> ApplicationLanguageList(string fileCountry, Dictionary<string, string> countryApplicationNameDictionary)
  936:         {
  937:             List<Ia.Cl.Models.Language> list, countrySpokenLanguageList, featureDesignationLanguageList;
  938:  
  939:             list = new List<Ia.Cl.Models.Language>();
  940:  
  941:             countrySpokenLanguageList = (from c in Ia.Cl.Models.Country.List
  942:                                          where c.Iso3 == fileCountry
  943:                                          select c.SpokenLanguageList).SingleOrDefault();
  944:  
  945:             featureDesignationLanguageList = Ia.TentPlay.Cl.Model.Data.Trek.FeatureDesignation.LanguageList;
  946:  
  947:             // make sure to select only languages defined in application title
  948:  
  949:             list = (from c in countrySpokenLanguageList
  950:                     join n in featureDesignationLanguageList on c.Symbol equals n.Symbol
  951:                     join cand in countryApplicationNameDictionary on n.Symbol equals cand.Key
  952:                     select c).ToList();
  953:  
  954:             // below: add English to all language lists for all countries
  955:             if (list.Find(u => u.Symbol == "en") == null) list.Add(Ia.Cl.Models.Language.List.Single(u => u.Symbol == "en"));
  956:  
  957:             return list;
  958:         }
  959:  
  960:         ////////////////////////////////////////////////////////////////////////////
  961:  
  962:         /// <summary>
  963:         /// 
  964:         /// </summary>
  965:         private static List<Image> ApplicationImageList(XElement imageList)
  966:         {
  967:             Image image;
  968:             List<Image> list;
  969:  
  970:             list = new List<Image>();
  971:  
  972:             foreach (XElement x in imageList.Elements("image"))
  973:             {
  974:                 image = new Image();
  975:  
  976:                 // Attribute
  977:                 //image.Caption = x.Attribute("caption").Value;
  978:                 //image.Photographer = x.Attribute("photographer").Value.Replace(" ", "").ToLower();
  979:                 //image.Source = x.Attribute("source").Value.ToLower();
  980:                 image.FileName = x.Attribute("fileName").Value;
  981:                 image.AndroidFileName = x.Attribute("fileName").Value.Replace("-", "_");
  982:  
  983:                 list.Add(image);
  984:             }
  985:  
  986:             return list;
  987:         }
  988:  
  989:         ////////////////////////////////////////////////////////////////////////////
  990:         ////////////////////////////////////////////////////////////////////////////
  991:  
  992:         /// <summary>
  993:         ///
  994:         /// </summary>
  995:         private static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> TranslationList(Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country country)
  996:         {
  997:             string s;
  998:             Ia.Cl.Models.Result result;
  999:             Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation translation;
 1000:             List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> translationList;
 1001:             List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureDesignation> featureDesignationNameAndCountList;
 1002:  
 1003:             translationList = new List<Translation>(100);
 1004:  
 1005:             foreach (Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation rawTranslation in RawTranslationList)
 1006:             {
 1007:                 if (country.Languages.Any(u => u.Iso6391 == rawTranslation.Iso6391))
 1008:                 {
 1009:                     featureDesignationNameAndCountList = Ia.TentPlay.Cl.Model.Data.Trek.Default.FeatureDesignationNameAndCountWithinDatabaseList(country.Iso3, rawTranslation, out result);
 1010:  
 1011:                     translation = new Translation();
 1012:                     translation.CountryIso3 = country.Iso3;
 1013:                     translation.Iso6391 = rawTranslation.Iso6391;
 1014:  
 1015:                     translation.SiteName = rawTranslation.SiteName;
 1016:                     translation.CompanyName = rawTranslation.CompanyName;
 1017:  
 1018:                     translation.About = ReplaceNameVariableWithName(rawTranslation.About, country, translation.Iso6391);
 1019:                     translation.AboutTitle = rawTranslation.AboutTitle;
 1020:  
 1021:                     translation.ShortDescription = ReplaceNameVariableWithName(rawTranslation.ShortDescription, country, translation.Iso6391);
 1022:  
 1023:                     translation.LongDescription = ReplaceNameVariableWithName(rawTranslation.LongDescription, country, translation.Iso6391);
 1024:                     s = Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.BuildRandomDesignationListString(featureDesignationNameAndCountList);
 1025:                     translation.LongDescription = translation.LongDescription.Replace("#randomDesignationList", s);
 1026:  
 1027:                     translation.SearchSearchHint = rawTranslation.SearchSearchHint;
 1028:  
 1029:                     translation.Statistic = ReplaceNameVariableWithName(rawTranslation.Statistic, country, translation.Iso6391);
 1030:                     translation.StatisticTitle = rawTranslation.StatisticTitle;
 1031:                     translation.Setting = rawTranslation.Setting;
 1032:                     translation.SettingTitle = rawTranslation.SettingTitle;
 1033:  
 1034:                     translation.ShareTitle = rawTranslation.ShareTitle;
 1035:                     translation.ShareApplication = ReplaceNameVariableWithName(rawTranslation.ShareApplication, country, translation.Iso6391);
 1036:                     translation.ShareTrek = ReplaceNameVariableWithName(rawTranslation.ShareTrek, country, translation.Iso6391);
 1037:                     translation.ShareNoEmailClientInstalled = rawTranslation.ShareNoEmailClientInstalled;
 1038:                     translation.ShareContactUs = rawTranslation.ShareContactUs;
 1039:  
 1040:                     translation.HelpFeedbackTitle = rawTranslation.HelpFeedbackTitle;
 1041:                     translation.Help = rawTranslation.Help;
 1042:                     translation.HelpTitle = rawTranslation.HelpTitle;
 1043:                     translation.HelpMainListOrder = rawTranslation.HelpMainListOrder;
 1044:                     translation.HelpGoogleMapRoute = rawTranslation.HelpGoogleMapRoute;
 1045:                     translation.HelpGoogleMapMarker = rawTranslation.HelpGoogleMapMarker;
 1046:                     translation.HelpMagnifiyingGlass = rawTranslation.HelpMagnifiyingGlass;
 1047:                     translation.HelpMapType = rawTranslation.HelpMapType;
 1048:                     translation.Feedback = ReplaceNameVariableWithName(rawTranslation.Feedback, country, translation.Iso6391);
 1049:                     translation.FeedbackTitle = rawTranslation.FeedbackTitle;
 1050:                     translation.FeedbackEmailSubject = rawTranslation.FeedbackEmailSubject;
 1051:  
 1052:                     translation.Legal = ReplaceNameVariableWithName(rawTranslation.Legal, country, translation.Iso6391);
 1053:                     translation.LegalTitle = rawTranslation.LegalTitle;
 1054:  
 1055:                     translation.FeatureClassName = rawTranslation.FeatureClassName;
 1056:                     translation.FeatureClassDescription = rawTranslation.FeatureClassDescription;
 1057:  
 1058:                     translation.FeatureClassAdministrativeName = rawTranslation.FeatureClassAdministrativeName;
 1059:                     translation.FeatureClassAdministrativeCaption = rawTranslation.FeatureClassAdministrativeCaption;
 1060:                     translation.FeatureClassAdministrativeClassId = rawTranslation.FeatureClassAdministrativeClassId;
 1061:                     translation.FeatureClassAdministrativeDescription = rawTranslation.FeatureClassAdministrativeDescription;
 1062:  
 1063:                     translation.FeatureClassPopulatedName = rawTranslation.FeatureClassPopulatedName;
 1064:                     translation.FeatureClassPopulatedCaption = rawTranslation.FeatureClassPopulatedCaption;
 1065:                     translation.FeatureClassPopulatedClassId = rawTranslation.FeatureClassPopulatedClassId;
 1066:                     translation.FeatureClassPopulatedDescription = rawTranslation.FeatureClassPopulatedDescription;
 1067:  
 1068:                     translation.FeatureClassVegetationName = rawTranslation.FeatureClassVegetationName;
 1069:                     translation.FeatureClassVegetationCaption = rawTranslation.FeatureClassVegetationCaption;
 1070:                     translation.FeatureClassVegetationClassId = rawTranslation.FeatureClassVegetationClassId;
 1071:                     translation.FeatureClassVegetationDescription = rawTranslation.FeatureClassVegetationDescription;
 1072:  
 1073:                     translation.FeatureClassLocalityName = rawTranslation.FeatureClassLocalityName;
 1074:                     translation.FeatureClassLocalityCaption = rawTranslation.FeatureClassLocalityCaption;
 1075:                     translation.FeatureClassLocalityClassId = rawTranslation.FeatureClassLocalityClassId;
 1076:                     translation.FeatureClassLocalityDescription = rawTranslation.FeatureClassLocalityDescription;
 1077:  
 1078:                     translation.FeatureClassUnderseaName = rawTranslation.FeatureClassUnderseaName;
 1079:                     translation.FeatureClassUnderseaCaption = rawTranslation.FeatureClassUnderseaCaption;
 1080:                     translation.FeatureClassUnderseaClassId = rawTranslation.FeatureClassUnderseaClassId;
 1081:                     translation.FeatureClassUnderseaDescription = rawTranslation.FeatureClassUnderseaDescription;
 1082:  
 1083:                     translation.FeatureClassStreetName = rawTranslation.FeatureClassStreetName;
 1084:                     translation.FeatureClassStreetCaption = rawTranslation.FeatureClassStreetCaption;
 1085:                     translation.FeatureClassStreetClassId = rawTranslation.FeatureClassStreetClassId;
 1086:                     translation.FeatureClassStreetDescription = rawTranslation.FeatureClassStreetDescription;
 1087:  
 1088:                     translation.FeatureClassHypsographicName = rawTranslation.FeatureClassHypsographicName;
 1089:                     translation.FeatureClassHypsographicCaption = rawTranslation.FeatureClassHypsographicCaption;
 1090:                     translation.FeatureClassHypsographicClassId = rawTranslation.FeatureClassHypsographicClassId;
 1091:                     translation.FeatureClassHypsographicDescription = rawTranslation.FeatureClassHypsographicDescription;
 1092:  
 1093:                     translation.FeatureClassHydrographicName = rawTranslation.FeatureClassHydrographicName;
 1094:                     translation.FeatureClassHydrographicCaption = rawTranslation.FeatureClassHydrographicCaption;
 1095:                     translation.FeatureClassHydrographicClassId = rawTranslation.FeatureClassHydrographicClassId;
 1096:                     translation.FeatureClassHydrographicDescription = rawTranslation.FeatureClassHydrographicDescription;
 1097:  
 1098:                     translation.FeatureClassSpotName = rawTranslation.FeatureClassSpotName;
 1099:                     translation.FeatureClassSpotCaption = rawTranslation.FeatureClassSpotCaption;
 1100:                     translation.FeatureClassSpotClassId = rawTranslation.FeatureClassSpotClassId;
 1101:                     translation.FeatureClassSpotDescription = rawTranslation.FeatureClassSpotDescription;
 1102:  
 1103:                     translationList.Add(translation);
 1104:                 }
 1105:             }
 1106:  
 1107:             return translationList.ToList();
 1108:         }
 1109:  
 1110:         ////////////////////////////////////////////////////////////////////////////
 1111:  
 1112:         /// <summary>
 1113:         /// 
 1114:         /// </summary>
 1115:         private static string ReplaceNameVariableWithName(string line, Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country applicationCountry)
 1116:         {
 1117:             return ReplaceNameVariableWithName(line, applicationCountry, null);
 1118:         }
 1119:  
 1120:         ////////////////////////////////////////////////////////////////////////////
 1121:  
 1122:         /// <summary>
 1123:         /// 
 1124:         /// </summary>
 1125:         private static string ReplaceNameVariableWithName(string line, Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Country applicationCountry, string iso6391)
 1126:         {
 1127:             string s;
 1128:  
 1129:             s = line;
 1130:  
 1131:             // this must be before $manifestPackage
 1132:             s = Replace(s, "$applicationUrl", applicationCountry.ApplicationUrl);
 1133:  
 1134:             if (!string.IsNullOrEmpty(iso6391))
 1135:             {
 1136:                 s = Replace(s, "$applicationName", applicationCountry.ApplicationNameDictionary[iso6391]);
 1137:                 s = Replace(s, "$countryName", applicationCountry.NameDictionary[iso6391]);
 1138:             }
 1139:  
 1140:             s = Replace(s, "$countryIso3", applicationCountry.Iso3);
 1141:             s = Replace(s, "$version", applicationCountry.VersionName);
 1142:             s = Replace(s, "$manifestPackagePrefix", applicationCountry.ManifestPackagePrefix);
 1143:             s = Replace(s, "$manifestPackage", applicationCountry.ManifestPackage);
 1144:             s = Replace(s, "$copyrightYear", applicationCountry.CopyrightYear);
 1145:             s = Replace(s, "$featureCount", applicationCountry.FeatureCount.ToString());
 1146:  
 1147:             s = Replace(s, "$companyName", Ia.TentPlay.Cl.Model.Data.CompanyInformation.CompanyName);
 1148:             s = Replace(s, "$companyEmail", Ia.TentPlay.Cl.Model.Data.CompanyInformation.CompanyEmail);
 1149:             s = Replace(s, "$companyUrl", Ia.TentPlay.Cl.Model.Data.CompanyInformation.CompanyUrl);
 1150:  
 1151:             s = Replace(s, "$applicationCompanyName", Ia.TentPlay.Cl.Model.Data.CompanyInformation.ApplicationCompanyName);
 1152:             s = Replace(s, "$applicationCompanyEmail", Ia.TentPlay.Cl.Model.Data.CompanyInformation.ApplicationCompanyEmail);
 1153:             s = Replace(s, "$applicationCompanyUrl", Ia.TentPlay.Cl.Model.Data.CompanyInformation.ApplicationCompanyUrl);
 1154:  
 1155:             return s;
 1156:         }
 1157:  
 1158:         ////////////////////////////////////////////////////////////////////////////
 1159:  
 1160:         /// <summary>
 1161:         /// 
 1162:         /// </summary>
 1163:         private static string Replace(string content, string term, string replacementTerm)
 1164:         {
 1165:             return content.Replace(term, replacementTerm);
 1166:         }
 1167:  
 1168:         ////////////////////////////////////////////////////////////////////////////
 1169:  
 1170:         /// <summary>
 1171:         /// 
 1172:         /// </summary>
 1173:         public static string BuildRandomDesignationListString(List<Ia.TentPlay.Cl.Model.Business.Trek.FeatureDesignation> featureDesignationNameAndCountList)
 1174:         {
 1175:             string s;
 1176:  
 1177:             s = string.Join(", ", (from f in featureDesignationNameAndCountList where f.Name.Length < 16 select Ia.Cl.Models.Language.Pluralize(f.Name)).PickRandom(19).ToArray());
 1178:             s = Ia.Cl.Models.Language.FirstCharacterToUpper(s);
 1179:  
 1180:             return s;
 1181:  
 1182:         }
 1183:  
 1184:         ////////////////////////////////////////////////////////////////////////////
 1185:  
 1186:         /// <summary>
 1187:         ///
 1188:         /// </summary>
 1189:         public static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> RawTranslationList
 1190:         {
 1191:             get
 1192:             {
 1193:                 if (translationList == null || translationList.Count == 0)
 1194:                 {
 1195:                     lock (objectLock)
 1196:                     {
 1197:                         if (HttpContext.Current != null && HttpContext.Current.Application["rawTranslationList"] != null)
 1198:                         {
 1199:                             translationList = (List<Translation>)HttpContext.Current.Application["rawTranslationList"];
 1200:                         }
 1201:                         else
 1202:                         {
 1203:                             translationList = Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation._RawTranslationList;
 1204:  
 1205:                             if (HttpContext.Current != null) HttpContext.Current.Application["rawTranslationList"] = translationList;
 1206:                         }
 1207:                     }
 1208:                 }
 1209:  
 1210:                 return translationList;
 1211:             }
 1212:         }
 1213:  
 1214:         ////////////////////////////////////////////////////////////////////////////
 1215:  
 1216:         /// <summary>
 1217:         ///
 1218:         /// </summary>
 1219:         private static List<Ia.TentPlay.Cl.Model.Data.Trek.ApplicationInformation.Translation> _RawTranslationList
 1220:         {
 1221:             get
 1222:             {
 1223:                 if (translationList == null || translationList.Count == 0)
 1224:                 {
 1225:                     lock (objectLock)
 1226:                     {
 1227:                         Translation translation;
 1228:  
 1229:                         translationList = new List<Translation>(100);
 1230:  
 1231:                         foreach (XElement x in XDocument.Element("applicationInformation").Element("translationList").Elements("translation"))
 1232:                         {
 1233:                             translation = new Translation();
 1234:                             translation.Iso6391 = x.Attribute("id").Value;
 1235:                             translation.SiteName = x.Element("siteName").Value;
 1236:                             translation.CompanyName = x.Element("companyName").Value;
 1237:  
 1238:                             translation.About = x.Element("about").Value.Trim();
 1239:                             translation.AboutTitle = x.Element("about").Attribute("title").Value;
 1240:  
 1241:                             translation.ShortDescription = Regex.Replace(x.Element("shortDescription").Value.Trim(), @"\n[ ]+", "\n");
 1242:                             translation.LongDescription = Regex.Replace(translation.About, @"\n[ ]+", "\n");
 1243:  
 1244:                             translation.SearchSearchHint = x.Element("search").Attribute("searchHint").Value;
 1245:  
 1246:                             translation.Statistic = x.Element("statistic").Value.Trim();
 1247:                             translation.StatisticTitle = x.Element("statistic").Attribute("title").Value;
 1248:                             translation.Setting = x.Element("setting").Value.Trim();
 1249:                             translation.SettingTitle = x.Element("setting").Attribute("title").Value;
 1250:  
 1251:                             translation.ShareTitle = x.Element("share").Attribute("title").Value;
 1252:                             translation.ShareApplication = x.Element("share").Element("application").Value.Trim();
 1253:                             translation.ShareTrek = x.Element("share").Element("trek").Value.Trim();
 1254:                             translation.ShareNoEmailClientInstalled = x.Element("share").Attribute("noEmailClientInstalled").Value;
 1255:                             translation.ShareContactUs = x.Element("share").Attribute("contactUs").Value;
 1256:  
 1257:                             translation.HelpFeedbackTitle = x.Element("help_feedback").Attribute("title").Value;
 1258:                             translation.Help = x.Element("help_feedback").Element("help").Value.Trim();
 1259:                             translation.HelpTitle = x.Element("help_feedback").Element("help").Attribute("title").Value;
 1260:                             translation.HelpMainListOrder = x.Element("help_feedback").Element("help").Attribute("mainListOrder").Value;
 1261:                             translation.HelpGoogleMapRoute = x.Element("help_feedback").Element("help").Attribute("googleMapRoute").Value;
 1262:                             translation.HelpGoogleMapMarker = x.Element("help_feedback").Element("help").Attribute("googleMapMarker").Value;
 1263:                             translation.HelpMagnifiyingGlass = x.Element("help_feedback").Element("help").Attribute("magnifiyingGlass").Value;
 1264:                             translation.HelpMapType = x.Element("help_feedback").Element("help").Attribute("mapType").Value;
 1265:                             translation.Feedback = x.Element("help_feedback").Element("feedback").Value.Trim();
 1266:                             translation.FeedbackTitle = x.Element("help_feedback").Element("feedback").Attribute("title").Value;
 1267:                             translation.FeedbackEmailSubject = x.Element("help_feedback").Element("feedback").Attribute("feedbackEmailSubject").Value;
 1268:  
 1269:                             translation.Legal = x.Element("legal").Value.Trim();
 1270:                             translation.LegalTitle = x.Element("legal").Attribute("title").Value;
 1271:  
 1272:                             translation.FeatureClassName = x.Element("featureClass").Attribute("caption").Value;
 1273:                             translation.FeatureClassDescription = x.Element("featureClass").Attribute("description").Value;
 1274:  
 1275:                             translation.FeatureClassAdministrativeName = x.Element("featureClass").Element("administrative").Attribute("name").Value;
 1276:                             translation.FeatureClassAdministrativeCaption = x.Element("featureClass").Element("administrative").Attribute("caption").Value;
 1277:                             translation.FeatureClassAdministrativeClassId = x.Element("featureClass").Element("administrative").Attribute("classId").Value;
 1278:                             translation.FeatureClassAdministrativeDescription = x.Element("featureClass").Element("administrative").Attribute("description").Value;
 1279:  
 1280:                             translation.FeatureClassPopulatedName = x.Element("featureClass").Element("populated").Attribute("name").Value;
 1281:                             translation.FeatureClassPopulatedCaption = x.Element("featureClass").Element("populated").Attribute("caption").Value;
 1282:                             translation.FeatureClassPopulatedClassId = x.Element("featureClass").Element("populated").Attribute("classId").Value;
 1283:                             translation.FeatureClassPopulatedDescription = x.Element("featureClass").Element("populated").Attribute("description").Value;
 1284:  
 1285:                             translation.FeatureClassVegetationName = x.Element("featureClass").Element("vegetation").Attribute("name").Value;
 1286:                             translation.FeatureClassVegetationCaption = x.Element("featureClass").Element("vegetation").Attribute("caption").Value;
 1287:                             translation.FeatureClassVegetationClassId = x.Element("featureClass").Element("vegetation").Attribute("classId").Value;
 1288:                             translation.FeatureClassVegetationDescription = x.Element("featureClass").Element("vegetation").Attribute("description").Value;
 1289:  
 1290:                             translation.FeatureClassLocalityName = x.Element("featureClass").Element("locality").Attribute("name").Value;
 1291:                             translation.FeatureClassLocalityCaption = x.Element("featureClass").Element("locality").Attribute("caption").Value;
 1292:                             translation.FeatureClassLocalityClassId = x.Element("featureClass").Element("locality").Attribute("classId").Value;
 1293:                             translation.FeatureClassLocalityDescription = x.Element("featureClass").Element("locality").Attribute("description").Value;
 1294:  
 1295:                             translation.FeatureClassUnderseaName = x.Element("featureClass").Element("undersea").Attribute("name").Value;
 1296:                             translation.FeatureClassUnderseaCaption = x.Element("featureClass").Element("undersea").Attribute("caption").Value;
 1297:                             translation.FeatureClassUnderseaClassId = x.Element("featureClass").Element("undersea").Attribute("classId").Value;
 1298:                             translation.FeatureClassUnderseaDescription = x.Element("featureClass").Element("undersea").Attribute("description").Value;
 1299:  
 1300:                             translation.FeatureClassStreetName = x.Element("featureClass").Element("street").Attribute("name").Value;
 1301:                             translation.FeatureClassStreetCaption = x.Element("featureClass").Element("street").Attribute("caption").Value;
 1302:                             translation.FeatureClassStreetClassId = x.Element("featureClass").Element("street").Attribute("classId").Value;
 1303:                             translation.FeatureClassStreetDescription = x.Element("featureClass").Element("street").Attribute("description").Value;
 1304:  
 1305:                             translation.FeatureClassHypsographicName = x.Element("featureClass").Element("hypsography").Attribute("name").Value;
 1306:                             translation.FeatureClassHypsographicCaption = x.Element("featureClass").Element("hypsography").Attribute("caption").Value;
 1307:                             translation.FeatureClassHypsographicClassId = x.Element("featureClass").Element("hypsography").Attribute("classId").Value;
 1308:                             translation.FeatureClassHypsographicDescription = x.Element("featureClass").Element("hypsography").Attribute("description").Value;
 1309:  
 1310:                             translation.FeatureClassHydrographicName = x.Element("featureClass").Element("hydrographic").Attribute("name").Value;
 1311:                             translation.FeatureClassHydrographicCaption = x.Element("featureClass").Element("hydrographic").Attribute("caption").Value;
 1312:                             translation.FeatureClassHydrographicClassId = x.Element("featureClass").Element("hydrographic").Attribute("classId").Value;
 1313:                             translation.FeatureClassHydrographicDescription = x.Element("featureClass").Element("hydrographic").Attribute("description").Value;
 1314:  
 1315:                             translation.FeatureClassSpotName = x.Element("featureClass").Element("spot").Attribute("name").Value;
 1316:                             translation.FeatureClassSpotCaption = x.Element("featureClass").Element("spot").Attribute("caption").Value;
 1317:                             translation.FeatureClassSpotClassId = x.Element("featureClass").Element("spot").Attribute("classId").Value;
 1318:                             translation.FeatureClassSpotDescription = x.Element("featureClass").Element("spot").Attribute("description").Value;
 1319:  
 1320:                             translationList.Add(translation);
 1321:                         }
 1322:                     }
 1323:                 }
 1324:  
 1325:                 return translationList.ToList();
 1326:             }
 1327:         }
 1328:  
 1329:         ////////////////////////////////////////////////////////////////////////////
 1330:         ////////////////////////////////////////////////////////////////////////////
 1331:  
 1332:         /// <summary>
 1333:         /// 
 1334:         /// How to embed and access resources by using Visual C# http://support.microsoft.com/kb/319292/en-us
 1335:         /// 
 1336:         /// 1. Change the "Build Action" property of your XML file from "Content" to "Embedded Resource".
 1337:         /// 2. Add "using System.Reflection".
 1338:         /// 3. Manifest resource stream will start with the project namespace, the location of XML file.
 1339:         /// 
 1340:         /// </summary>
 1341:  
 1342:         private static XDocument XDocument
 1343:         {
 1344:             get
 1345:             {
 1346:                 if (xDocument == null)
 1347:                 {
 1348:                     lock (objectLock)
 1349:                     {
 1350:                         Assembly _assembly;
 1351:                         StreamReader streamReader;
 1352:  
 1353:                         _assembly = Assembly.GetExecutingAssembly();
 1354:                         streamReader = new StreamReader(_assembly.GetManifestResourceStream("Ia.TentPlay.Cl.model.data.trek.application-information.xml"));
 1355:  
 1356:                         try
 1357:                         {
 1358:                             if (streamReader.Peek() != -1) xDocument = System.Xml.Linq.XDocument.Load(streamReader);
 1359:                         }
 1360:                         catch (Exception)
 1361:                         {
 1362:                         }
 1363:                         finally
 1364:                         {
 1365:                         }
 1366:                     }
 1367:                 }
 1368:  
 1369:                 return xDocument;
 1370:             }
 1371:         }
 1372:  
 1373:         ////////////////////////////////////////////////////////////////////////////
 1374:         ////////////////////////////////////////////////////////////////////////////    
 1375:     }
 1376: }