Example #1
0
        /// <summary>
        /// Creates a new AboutViewModel
        /// </summary>
        /// <param name="locale">Locale</param>
        public AboutViewModel(ILocale locale)
        {
            var assembly = Assembly.GetExecutingAssembly();
            var name = assembly.GetName();
            var builder = new StringBuilder();

            builder.AppendLine(name.Name);
            builder.AppendLine("Version " + name.Version.ToString());
            builder.AppendLine("Copyright © Abricot Soinou 2016");
            builder.AppendLine(locale["About.Contact"]);
            builder.AppendLine(locale["About.Bugs"]);

            About = builder.ToString();
        }
        private static CultureInfo GetUserCulture(ILocale locale)
        {
            if (AppContext.Value.Configuration.Localization.CurrentCulture.Name == null)
            {
                return(locale.GetCurrentCultureInfo());
            }

            try
            {
                return(new CultureInfo(AppContext.Value.Configuration.Localization.CurrentCulture.Name));
            }
            catch (CultureNotFoundException)
            {
                return(locale.GetCurrentCultureInfo());
            }
        }
        public static bool IsLanguageSupported(this ILocale locale, string languageCode)
        {
            switch (languageCode)
            {
            case "en":
            case "en-US":
                return(true);

            case "fr":
            case "fr-FR":
            case "fr-US":
                return(true);

            default:
                return(false);
            }
        }
Example #4
0
        public LocaleGenerator(int seed, ILocale locale, int width, int length, int elevation, int depth)
        {
            VerifyLocale(locale);
            VerifyDimensions(width, length, elevation, depth);

            _randomizer = new Random(Seed);

            Seed   = seed;
            Locale = locale;

            Width     = width;
            Length    = length;
            Elevation = elevation;
            Depth     = depth;

            RoomMap = new long[width * 3 + 1, length * 3 + 1, (elevation + depth) * 3 + 1];
        }
Example #5
0
        /// <summary>
        /// Get factor trees for specified locale.
        /// </summary>
        /// <param name="locale">Locale.</param>
        /// <param name="getOnlyPublicFactors">Get only public factor trees or all from cache.</param>
        /// <returns>Factor trees for specified locale.</returns>
        protected override FactorTreeNodeList GetFactorTrees(ILocale locale, Boolean getOnlyPublicFactors)
        {
            String factorTreeType = getOnlyPublicFactors
                                        ? FactorTreesPermissionType.PublicFactorTrees.ToString()
                                        : FactorTreesPermissionType.AllFactorTrees.ToString();

            FactorTreeNodeList factorTrees = null;

            lock (FactorTrees)
            {
                if (FactorTrees.ContainsKey(locale.ISOCode + "#" + factorTreeType))
                {
                    factorTrees = (FactorTreeNodeList)(FactorTrees[locale.ISOCode + "#" + factorTreeType]);
                }
            }
            return(factorTrees);
        }
Example #6
0
        public List <KeyValuePair <string, string> > CalculateSummaryStatistics(ILocale locale)
        {
            CultureInfo currentUICulture = Thread.CurrentThread.CurrentUICulture;
            CultureInfo currentCulture   = Thread.CurrentThread.CurrentCulture;

            try
            {
                Thread.CurrentThread.CurrentUICulture = locale.CultureInfo;
                Thread.CurrentThread.CurrentCulture   = locale.CultureInfo;
                return(CalculateSummaryStatistics());
            }
            finally
            {
                Thread.CurrentThread.CurrentUICulture = currentUICulture;
                Thread.CurrentThread.CurrentCulture   = currentCulture;
            }
        }
Example #7
0
        /// <summary>
        /// We just throw errors, no need for a return value
        /// </summary>
        private void VerifyLocale(ILocale locale)
        {
            if (locale == null)
            {
                throw new ArgumentNullException("Locale must not be null.");
            }

            if (locale.Rooms().Any())
            {
                throw new ArgumentOutOfRangeException("Locale must be devoid of rooms.");
            }

            if (locale.Template <ILocaleTemplate>().FitnessProblems)
            {
                throw new ArgumentOutOfRangeException("Zone must have data integrity.");
            }
        }
        public UserRepositoryFixture()
        {
            // Fixture setup
            var fixture = new Fixture()
                          .Customize(new AutoMoqCustomization());

            mockUser  = fixture.Freeze <User>();
            mockUsers = fixture.Freeze <IEnumerable <User> >();
            string mockProductString = JsonConvert.SerializeObject(mockUser);

            ICouchbaseClient db          = MakeMockCbClient(mockProductString);
            IFactory <IUser> userFactory = new UserFactory();
            ILocale          locale      = fixture.Freeze <DefaultLocale>();

            //ICouchbaseClient db, IFactory<IUser> userFactory, ILocale locale
            userRepo = new UserRepository(db, userFactory, locale, "http://localhost:9200/unittests/_search");
        }
Example #9
0
        /// <summary>
        /// Get organism groups for specified locale.
        /// </summary>
        /// <param name="locale">Currently used locale.</param>
        /// <param name='organismGroupType'>Type of organism groups.</param>
        /// <returns>Organism groups for specified locale.</returns>
        protected override OrganismGroupList GetOrganismGroups(ILocale locale,
                                                               OrganismGroupType organismGroupType)
        {
            OrganismGroupList organismGroups = null;
            String            cacheKey;

            cacheKey = locale.ISOCode + "#" + organismGroupType;
            lock (OrganismGroups)
            {
                if (OrganismGroups.ContainsKey(cacheKey))
                {
                    organismGroups = (OrganismGroupList)(OrganismGroups[cacheKey]);
                }
            }

            return(organismGroups);
        }
Example #10
0
        /// <summary>
        /// Get a factor tree node for specified locale by the spcified factor id.
        /// </summary>
        /// <param name="locale">Locale.</param>
        /// <param name="factorId">The specified factor id.</param>
        /// <param name="getOnlyPublicFactors">Get only public factor trees or all from cache.</param>
        /// <returns>A factor tree node related to the specified factor id for specified locale.</returns>
        protected override IFactorTreeNode GetFactorTreeNode(ILocale locale, int factorId, Boolean getOnlyPublicFactors)
        {
            String factorTreeType = getOnlyPublicFactors
                                        ? FactorTreesPermissionType.PublicFactorTrees.ToString()
                                        : FactorTreesPermissionType.AllFactorTrees.ToString();

            IFactorTreeNode factorTreeNode = null;

            lock (FactorTreeNodes)
            {
                if (FactorTreeNodes.ContainsKey(locale.ISOCode + "#" + factorTreeType))
                {
                    factorTreeNode = ((Dictionary <int, IFactorTreeNode>)(FactorTreeNodes[locale.ISOCode + "#" + factorTreeType]))[factorId];
                }
            }

            return(factorTreeNode);
        }
Example #11
0
        /// <summary>
        /// Sets the current language (culture).
        /// </summary>
        /// <param name="culture">The culture.</param>
        /// <param name="returnUrl">The return URL.</param>
        /// <returns></returns>
        public RedirectResult SetCulture(string culture, string returnUrl)
        {
            IUserContext userContext = GetCurrentUser();
            ILocale      locale      = CoreData.LocaleManager.GetUsedLocales(userContext).Get(culture);

            Thread.CurrentThread.CurrentCulture = locale.CultureInfo;
            if (locale != null)
            {
                SetLanguage(locale.ISOCode);
                if (userContext.IsAuthenticated())
                {
                    userContext.Locale = locale;
                }
            }

            returnUrl = RemoveLangQuerystringFromUrl(returnUrl);
            return(Redirect(returnUrl));
        }
        /// <summary>
        ///		Makes an attempt to get the message translations from cache
        ///		delegating its initial population to the factory.
        /// </summary>
        /// <exception cref="Datapoint.Globalization.MessageFactoryException">
        ///		Thrown when an unexpected error is encountered while creating
        ///		the repository population.
        ///	</exception>
        /// <param name="locale">
        ///		The locale to get the message translations for.
        /// </param>
        /// <param name="domain">
        ///		The domain to get the message translations for.
        /// </param>
        /// <returns>
        ///		The message translations, by message.
        /// </returns>
        private Dictionary <string, string> GetMessagesWithCache(ILocale locale, string domain)
        {
            if (!_messages.TryGetValue(locale, out var localeDomainsMessages))
            {
                _messages.Add
                (
                    locale,
                    localeDomainsMessages = new Dictionary <string, Dictionary <string, string> >()
                );
            }

            if (!localeDomainsMessages.TryGetValue(domain, out var localeDomainMessages))
            {
                var messages = new Dictionary <string, string>();

                try
                {
                    foreach (var message in _factory.CreateMessages(locale, domain))
                    {
                        if (!messages.TryAdd(message.Key, message.Value))
                        {
                            throw new Exception($"Message '{message.Key}' was created by the factory more than once.");
                        }
                    }
                }
                catch (Exception e)
                {
                    throw new MessageFactoryException
                          (
                              _factory,
                              "An exception was caught while trying to create the message repository population.",
                              e
                          );
                }

                localeDomainsMessages.Add
                (
                    domain,
                    localeDomainMessages = messages
                );
            }

            return(localeDomainMessages);
        }
Example #13
0
        /// <summary>
        /// Get message types for specified locale.
        /// </summary>
        /// <param name="locale">Locale.</param>
        /// <returns>Message types for specified locale.</returns>
        protected override MessageTypeList GetMessageTypes(ILocale locale)
        {
            MessageTypeList messageTypes = null;

            lock (MessageTypes)
            {
                if (MessageTypes.ContainsKey(locale.ISOCode))
                {
                    messageTypes = (MessageTypeList)(MessageTypes[locale.ISOCode]);
                }
            }
            if (messageTypes.IsNotNull())
            {
                return(messageTypes.CloneMessageTypeList());
            }
            else
            {
                return(messageTypes);
            }
        }
        public async Task <string[]> GetContent(ILocale locale, IProgress <float> progress, CancellationToken ct)
        {
            if (!(locale is AssemblyLocale assemblyLocale))
            {
                throw new NotSupportedException($"Unsupported type: {locale}. Please use AssemblyLocale for AssemblyContent");
            }

            progress?.Report(0);
            var contents = new List <string>();

            foreach (var hostAssembly in assemblyLocale.HostAssemblies)
            {
                contents.Add(await GetAssemblyContent(
                                 hostAssembly,
                                 assemblyLocale.GetSourcePath(hostAssembly, this.contentConfig.ResourceFolder)));
            }

            progress?.Report(100);
            return(contents.ToArray());
        }
            /// <summary>
            /// Compiles the given locale into a nested class inside the Processor class.
            /// </summary>
            /// <param name="code"></param>
            /// <param name="classNameTemplate"></param>
            /// <param name="baseClass"></param>
            /// <param name="accessor"></param>
            /// <param name="culture"></param>
            /// <returns></returns>
            private static LocaleProviderType Compile(Class code, ILocale locale, string classNameTemplate, LocaleProviderType baseClass, string accessor, Culture culture)
            {
                // init
                var className = "@" + string.Format(classNameTemplate, culture.GetMethodName());

                // class
                using (var @class = code.AppendNestedClass("{0} class {1} : {2}", accessor, className, (baseClass == null ? "LocaleProvider" : baseClass.ClassName)))
                {
                    // summary
                    @class.Summary = (culture.IsInvariant ? "Invariant." : culture.ToString());

                    // ctor()
                    using (var block = @class.AppendMethod("public {0}() : base({1})", className, Compiler.GetLiteral(culture.ToString())))
                    {
                    }

                    // ctor(string culture)
                    using (var block = @class.AppendMethod("protected {0}(Culture culture) : base(culture)", className))
                    {
                    }

                    // style options
                    CompileStyleOptions(@class, locale.StyleOptions);

                    // date parts
                    CompileDatePartParameters(@class, locale.Dates, DateFormat.Numeric);
                    CompileDatePartParameters(@class, locale.Dates, DateFormat.Text);

                    // ordinals
                    CompileOrdinals(@class, locale.Terms);
                    CompileLongOrdinals(@class, locale.Terms);

                    // terms
                    CompileTerms(@class, locale.Terms);
                    CompileTermGender(@class, locale.Terms);
                }

                // done
                return(new LocaleProviderType(culture, className));
            }
        /// <summary>
        /// Gets the current locale.
        /// </summary>
        /// <param name="locales">The locales.</param>
        /// <returns></returns>
        public static ILocale GetCurrentLocale(IList <ILocale> locales)
        {
            //3 - max locales number: current locale, default locale and neutral locale
            ILocale locale = null;

            if (locales != null && locales.Count > 0 && locales.Count <= 3)
            {
                if (locales.Count == 1)
                {
                    locale = locales[0];
                }
                else if (locales.Count == 2)
                {
                    locale = locales.Where(l => l.Culture != null).First();
                }
                else
                {
                    locale = locales.Where(l => l.Culture != null && !l.Culture.Equals(DefaultCultureName)).First();
                }
            }
            return(locale);
        }
Example #17
0
        public GlobalizationContextUnitTest()
        {
            var guow = new GlobalizationUnitOfWork
                       (
                new CurrencyRepository(new EnvironmentCurrencyFactory()),
                new LocaleRepository(new EnvironmentLocaleFactory()),
                new MessageRepository(new MachineObjectMessageFactory())
                       );

            _currencyRepository = guow.Currencies;

            _localeRepository = guow.Locales;

            _locale = guow.Locales.GetLocale("pt-PT");

            _globalizationContext = guow.CreateContext("pt-PT", "default");

            _alternativeCurrency = guow.Currencies.GetCurrency("USD");

            _alternativeCurrencyNumberFormatInfo = (NumberFormatInfo)_locale.Culture.NumberFormat.Clone();
            _alternativeCurrencyNumberFormatInfo.CurrencyDecimalDigits = _alternativeCurrency.Scale;
            _alternativeCurrencyNumberFormatInfo.CurrencySymbol        = _alternativeCurrency.Symbol;
        }
Example #18
0
        public virtual async Task <string[]> GetContent(ILocale locale, IProgress <float> progressAction,
                                                        CancellationToken ct = default(CancellationToken))
        {
            var    remoteLocale = (RemoteLocale)locale;
            string content;

            if (remoteLocale.Downloaded)
            {
                var filePath = Utils.GetFilePath(this.contentConfig.CacheDir, remoteLocale.CacheSource);
                content = await this.platformCacheFileManager.GetFile(filePath).ConfigureAwait(false);
            }
            else
            {
                var source = remoteLocale.Source;
                content = await this.PlatformHttpClientManager.DownloadContent(source, progressAction, ct).ConfigureAwait(false);

                var cachedFilePath = Utils.GetFilePath(this.contentConfig.CacheDir, remoteLocale.CacheSource);
                await this.platformCacheFileManager.UpsertFile(cachedFilePath, content).ConfigureAwait(false);

                remoteLocale.Downloaded = true;
            }

            return(new[] { content });
        }
        /// <summary>
        /// Get references for specified locale.
        /// </summary>
        /// <param name="userContext">
        /// Information about the user that makes this method call.
        /// </param>
        /// <param name="locale">Currently used locale.</param>
        /// <returns>References for specified locale.</returns>
        protected virtual ReferenceList GetReferences(IUserContext userContext,
                                                      ILocale locale)
        {
            ReferenceList references;

            if (userContext.Transaction.IsNull())
            {
                if (References.ContainsKey(locale.ISOCode))
                {
                    references = (ReferenceList)(References[locale.ISOCode]);
                }
                else
                {
                    references = new ReferenceList();
                    References[locale.ISOCode] = references;
                }
            }
            else
            {
                references = new ReferenceList();
            }

            return(references);
        }
Example #20
0
        /// <summary>
        /// Something went wrong with restoring the live backup, this loads all persistence singeltons from the database (rooms, paths, spawns)
        /// </summary>
        /// <returns>success state</returns>
        public bool NewWorldFallback()
        {
            LiveData liveDataAccessor = new LiveData();

            //This means we delete the entire Current livedata dir since we're falling back.
            string currentLiveDirectory = liveDataAccessor.BaseDirectory + liveDataAccessor.CurrentDirectoryName;

            //No backup directory? No live data.
            if (Directory.Exists(currentLiveDirectory))
            {
                DirectoryInfo currentDir = new DirectoryInfo(currentLiveDirectory);

                LoggingUtility.Log("Current Live directory deleted during New World Fallback Procedures.", LogChannels.Backup, true);

                try
                {
                    currentDir.Delete(true);
                }
                catch
                {
                    //occasionally will be pissy in an async situation
                }
            }

            //Only load in stuff that is static and spawns as singleton
            //We need to pick up any places that aren't already live from the file system incase someone added them during the last session\
            foreach (IGaiaTemplate thing in TemplateCache.GetAll <IGaiaTemplate>())
            {
                IGaia entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as IGaia;
            }

            foreach (IZoneTemplate thing in TemplateCache.GetAll <IZoneTemplate>())
            {
                IZone entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as IZone;
            }

            foreach (ILocaleTemplate thing in TemplateCache.GetAll <ILocaleTemplate>())
            {
                ILocale entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as ILocale;

                entityThing.ParentLocation = entityThing.Template <ILocaleTemplate>().ParentLocation.GetLiveInstance();
                entityThing.GetFromWorldOrSpawn();
            }

            foreach (IRoomTemplate thing in TemplateCache.GetAll <IRoomTemplate>())
            {
                IRoom entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as IRoom;

                entityThing.ParentLocation = entityThing.Template <IRoomTemplate>().ParentLocation.GetLiveInstance();
                entityThing.GetFromWorldOrSpawn();
            }

            foreach (IPathwayTemplate thing in TemplateCache.GetAll <IPathwayTemplate>())
            {
                IPathway entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as IPathway;
            }

            ParseDimension();

            LoggingUtility.Log("World restored from data fallback.", LogChannels.Backup, true);

            return(true);
        }
Example #21
0
        /// <summary>
        /// Restores live entity backup from Current
        /// </summary>
        /// <returns>Success state</returns>
        public bool RestoreLiveBackup()
        {
            LiveData liveDataAccessor = new LiveData();

            string currentBackupDirectory = liveDataAccessor.BaseDirectory + liveDataAccessor.CurrentDirectoryName;

            //No backup directory? No live data.
            if (!Directory.Exists(currentBackupDirectory))
            {
                return(false);
            }

            LoggingUtility.Log("World restored from current live INITIATED.", LogChannels.Backup, false);

            try
            {
                //dont load players here
                List <IEntity>     entitiesToLoad   = new List <IEntity>();
                IEnumerable <Type> implimentedTypes = typeof(EntityPartial).Assembly.GetTypes().Where(ty => ty.GetInterfaces().Contains(typeof(IEntity)) &&
                                                                                                      ty.IsClass &&
                                                                                                      !ty.IsAbstract &&
                                                                                                      !ty.GetCustomAttributes <IgnoreAutomatedBackupAttribute>().Any());

                foreach (Type type in implimentedTypes.OrderByDescending(type => type == typeof(Gaia) ? 6 :
                                                                         type == typeof(Zone) ? 5 :
                                                                         type == typeof(Locale) ? 3 :
                                                                         type == typeof(Room) ? 3 :
                                                                         type == typeof(Pathway) ? 2 : 0))
                {
                    if (!Directory.Exists(currentBackupDirectory + type.Name))
                    {
                        continue;
                    }

                    DirectoryInfo entityFilesDirectory = new DirectoryInfo(currentBackupDirectory + type.Name);

                    foreach (FileInfo file in entityFilesDirectory.EnumerateFiles())
                    {
                        entitiesToLoad.Add(liveDataAccessor.ReadEntity(file, type));
                    }
                }

                //Check we found actual data
                if (!entitiesToLoad.Any(ent => ent.GetType() == typeof(Gaia)))
                {
                    throw new Exception("No Worlds found, failover.");
                }

                if (!entitiesToLoad.Any(ent => ent.GetType() == typeof(Zone)))
                {
                    throw new Exception("No zones found, failover.");
                }

                //Shove them all into the live system first
                foreach (IEntity entity in entitiesToLoad.OrderBy(ent => ent.Birthdate))
                {
                    entity.UpsertToLiveWorldCache();
                    entity.KickoffProcesses();
                }

                //We need to pick up any places that aren't already live from the file system incase someone added them during the last session\
                foreach (IGaiaTemplate thing in TemplateCache.GetAll <IGaiaTemplate>().Where(dt => !entitiesToLoad.Any(ent => ent.TemplateId.Equals(dt.Id) && ent.Birthdate >= dt.LastRevised)))
                {
                    IGaia entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as IGaia;

                    entityThing.SpawnNewInWorld();
                }

                foreach (IZoneTemplate thing in TemplateCache.GetAll <IZoneTemplate>().Where(dt => !entitiesToLoad.Any(ent => ent.TemplateId.Equals(dt.Id) && ent.Birthdate >= dt.LastRevised)))
                {
                    IZone entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as IZone;

                    entityThing.SpawnNewInWorld();
                }

                foreach (ILocaleTemplate thing in TemplateCache.GetAll <ILocaleTemplate>().Where(dt => !entitiesToLoad.Any(ent => ent.TemplateId.Equals(dt.Id) && ent.Birthdate >= dt.LastRevised)))
                {
                    ILocale entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as ILocale;

                    entityThing.ParentLocation = entityThing.ParentLocation.GetLiveInstance();
                    entityThing.SpawnNewInWorld();
                }

                foreach (IRoomTemplate thing in TemplateCache.GetAll <IRoomTemplate>().Where(dt => !entitiesToLoad.Any(ent => ent.TemplateId.Equals(dt.Id) && ent.Birthdate >= dt.LastRevised)))
                {
                    IRoom entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as IRoom;

                    entityThing.ParentLocation = entityThing.Template <IRoomTemplate>().ParentLocation.GetLiveInstance();
                    entityThing.SpawnNewInWorld();
                }

                foreach (IPathwayTemplate thing in TemplateCache.GetAll <IPathwayTemplate>().Where(dt => !entitiesToLoad.Any(ent => ent.TemplateId.Equals(dt.Id) && ent.Birthdate >= dt.LastRevised)))
                {
                    IPathway entityThing = Activator.CreateInstance(thing.EntityClass, new object[] { thing }) as IPathway;

                    entityThing.SpawnNewInWorld();
                }

                //We have the containers contents and the birthmarks from the deserial
                //I don't know how we can even begin to do this type agnostically since the collections are held on type specific objects without some super ugly reflection
                foreach (Room entity in entitiesToLoad.Where(ent => ent.GetType() == typeof(Room)))
                {
                    foreach (IInanimate obj in entity.Contents.EntitiesContained())
                    {
                        IInanimate fullObj = LiveCache.Get <IInanimate>(new LiveCacheKey(obj));
                        entity.MoveFrom(obj);
                        entity.MoveInto(fullObj);
                    }

                    foreach (INonPlayerCharacter obj in entity.MobilesInside.EntitiesContained())
                    {
                        INonPlayerCharacter fullObj = LiveCache.Get <INonPlayerCharacter>(new LiveCacheKey(obj));
                        entity.MoveFrom(obj);
                        entity.MoveInto(fullObj);
                    }
                }

                foreach (NonPlayerCharacter entity in entitiesToLoad.Where(ent => ent.GetType() == typeof(NonPlayerCharacter)))
                {
                    foreach (IInanimate obj in entity.Inventory.EntitiesContained())
                    {
                        IInanimate fullObj = LiveCache.Get <IInanimate>(new LiveCacheKey(obj));
                        entity.MoveFrom(obj);
                        entity.MoveInto(fullObj);
                    }
                }

                foreach (Inanimate entity in entitiesToLoad.Where(ent => ent.GetType() == typeof(Inanimate)))
                {
                    foreach (Tuple <string, IInanimate> obj in entity.Contents.EntitiesContainedByName())
                    {
                        IInanimate fullObj = LiveCache.Get <IInanimate>(new LiveCacheKey(obj.Item2));
                        entity.MoveFrom(obj.Item2);
                        entity.MoveInto(fullObj, obj.Item1);
                    }

                    foreach (Tuple <string, IInanimate> obj in entity.Contents.EntitiesContainedByName())
                    {
                        INonPlayerCharacter fullObj = LiveCache.Get <INonPlayerCharacter>(new LiveCacheKey(obj.Item2));
                        entity.MoveFrom((INonPlayerCharacter)obj.Item2);
                        entity.MoveInto(fullObj, obj.Item1);
                    }
                }

                //We need to poll the WorldMaps here and give all the rooms their coordinates as well as the zones their sub-maps
                ParseDimension();

                LoggingUtility.Log("World restored from current live.", LogChannels.Backup, false);
                return(true);
            }
            catch (Exception ex)
            {
                LoggingUtility.LogError(ex);
            }

            return(false);
        }
Example #22
0
 /// <summary>
 /// Set taxon revision states for specified locale.
 /// </summary>
 /// <param name="taxonRevisionStates">Taxon revision states.</param>
 /// <param name="locale">Locale.</param>
 protected virtual void SetTaxonRevisionStates(TaxonRevisionStateList taxonRevisionStates,
                                               ILocale locale)
 {
     TaxonRevisionStates[locale.ISOCode] = taxonRevisionStates;
 }
Example #23
0
 /// <summary>
 /// Set taxon name usage for specified locale.
 /// </summary>
 /// <param name="taxonNameUsage">Taxon name usage.</param>
 /// <param name="locale">Locale.</param>
 protected virtual void SetTaxonNameUsage(TaxonNameUsageList taxonNameUsage,
                                          ILocale locale)
 {
     TaxonNameUsages[locale.ISOCode] = taxonNameUsage;
 }
Example #24
0
 /// <summary>
 /// Set taxon name status for specified locale.
 /// </summary>
 /// <param name="taxonNameStatus">Taxon name status.</param>
 /// <param name="locale">Locale.</param>
 protected virtual void SetTaxonNameStatus(TaxonNameStatusList taxonNameStatus,
                                           ILocale locale)
 {
     TaxonNameStatuses[locale.ISOCode] = taxonNameStatus;
 }
Example #25
0
 /// <summary>
 /// Set taxon names for specified locale and taxon.
 /// </summary>
 /// <param name="taxonNames">Taxon names.</param>
 /// <param name="taxon">Taxon.</param>
 /// <param name="locale">Locale.</param>
 protected virtual void SetTaxonNames(TaxonNameList taxonNames,
                                      ITaxon taxon,
                                      ILocale locale)
 {
     TaxonNames[GetTaxonNameCacheKey(taxon, locale)] = taxonNames;
 }
Example #26
0
 /// <summary>
 /// Creates a new MainViewModel
 /// </summary>
 /// <param name="configuration">Configuration</param>
 /// <param name="locale">Locale</param>
 public MainViewModel(Configuration configuration, ILocale locale)
 {
     configuration_ = configuration;
     locale_ = locale;
 }
Example #27
0
 /// <summary>
 /// Set taxon categories for specified locale.
 /// </summary>
 /// <param name="taxonCategories">Taxon categories.</param>
 /// <param name="locale">Locale.</param>
 protected virtual void SetTaxonCategories(TaxonCategoryList taxonCategories,
                                           ILocale locale)
 {
     TaxonCategories[locale.ISOCode] = taxonCategories;
 }
Example #28
0
 /// <summary>
 /// Set taxon alert statuses for specified locale.
 /// </summary>
 /// <param name="taxonAlertStatuses">Taxon alert statuses.</param>
 /// <param name="locale">Locale.</param>
 protected virtual void SetTaxonAlertStatuses(TaxonAlertStatusList taxonAlertStatuses,
                                              ILocale locale)
 {
     TaxonAlertStatuses[locale.ISOCode] = taxonAlertStatuses;
 }
Example #29
0
 /// <summary>
 /// Set taxon information for specified locale.
 /// </summary>
 /// <param name="taxon">Taxon.</param>
 /// <param name="locale">Locale.</param>
 protected virtual void SetTaxon(ITaxon taxon, ILocale locale)
 {
     Taxa[GetTaxonCacheKey(taxon.Id, locale)] = taxon;
 }
 public static void AddLocale(ILocale locale)
 {
 }
 /// <summary>
 /// Set picture relation types for specified locale.
 /// </summary>
 /// <param name="pictureRelationTypes">Picture relation types.</param>
 /// <param name="locale">The locale.</param>
 protected virtual void SetPictureRelationTypes(PictureRelationTypeList pictureRelationTypes,
                                                ILocale locale)
 {
     PictureRelationTypes[locale.ISOCode] = pictureRelationTypes;
 }
Example #32
0
 public override Task <string> GetContent(ILocale locale, IProgress <float> progressAction,
                                          CancellationToken ct = default(CancellationToken))
 {
     return(locale is OfflineLocale?this.GetOfflineContent() : base.GetContent(locale, progressAction, ct));
 }
Example #33
0
 /// <summary>
 /// Set taxon name category types for specified locale.
 /// </summary>
 /// <param name="taxonNameCategoryTypes">Taxon name category types.</param>
 /// <param name="locale">Locale.</param>
 protected virtual void SetTaxonNameCategoryTypes(TaxonNameCategoryTypeList taxonNameCategoryTypes,
                                                  ILocale locale)
 {
     TaxonNameCategoryTypes[locale.ISOCode] = taxonNameCategoryTypes;
 }