示例#1
0
 public Concept(String id = null, ILocalizedString name = null, ILocalizedString hint = null)
 {
     Name       = name ?? new LocalizedStringVariable();
     ID         = id.EnsureIdIsSet();
     Hint       = hint ?? new LocalizedStringVariable();
     Attributes = new HashSet <IAttribute>();
 }
示例#2
0
        public LocalizedString(ILocalizedString source)
            : this()
        {
            var variable = (LocalizedStringVariable)source;

            foreach (String locale in variable.Locales)
            {
                Values.Add(new LocalizedStringValue(locale, variable.GetValue(locale)));
            }
        }
示例#3
0
        public void LoadTo(ILocalizedString destination)
        {
            var variable = (LocalizedStringVariable)destination;

            variable.Clear();

            foreach (var value in Values)
            {
                variable.SetLocale(value.Locale, value.Value);
            }
        }
        protected internal virtual string GetLocalizedStringInformation(ILocalizedString localizedString, string resolvedPath)
        {
            // ReSharper disable ConvertIfStatementToReturnStatement
            if (localizedString == null)
            {
                return($"Resolved path: {resolvedPath.ToArgumentString()}{Environment.NewLine} - No hit");
            }
            // ReSharper restore ConvertIfStatementToReturnStatement

            return(string.Format(CultureInfo.InvariantCulture, "Resolved path: {2}{0}{1}Culture: {3}{0}{1}Name: {4}{0}{1}Resource not found: {5}{0}{1}Value: {6}", Environment.NewLine, " - ", resolvedPath.ToArgumentString(), localizedString.Culture.ToArgumentString(), localizedString.Name.ToArgumentString(), localizedString.ResourceNotFound, localizedString.Value.ToArgumentString()));
        }
示例#5
0
 public DiseaseName(
     ILocalizedString primary,
     ILocalizedString primaryPrefix,
     ILocalizedString secondary,
     ILocalizedString subject)
 {
     Primary       = primary ?? throw new ArgumentNullException(nameof(primary));
     PrimaryPrefix = primaryPrefix;
     Secondary     = secondary;
     Subject       = subject;
 }
示例#6
0
        public static string GetValueOrDefaultNoname(Language currentLanguage, ILocalizedString localizedString)
        {
            switch (currentLanguage)
            {
            case Language.English:
            default:
                return(localizedString?.En ?? GetUndefined(currentLanguage));

            case Language.Russian:
                return(localizedString?.Ru ?? GetUndefined(currentLanguage));
            }
        }
示例#7
0
        public static string GetValue(Language currentLanguage, ILocalizedString localizedString)
        {
            switch (currentLanguage)
            {
            case Language.English:
            default:
                return(localizedString?.En);

            case Language.Russian:
                return(localizedString?.Ru);
            }
        }
示例#8
0
        public override void Apply(ILocalizedString localizedString)
        {
            var variableString = localizedString as Semantics.Localization.LocalizedStringVariable;

            if (variableString != null)
            {
                variableString.Clear();
                foreach (var value in Values)
                {
                    variableString.SetLocale(value.Locale, value.Value);
                }
            }
        }
示例#9
0
        private static int InternalGenerateErrorCode(Exception e)
        {
            StackTrace       stackTrace      = new StackTrace(e);
            int              hashCode        = stackTrace.ToString().GetHashCode();
            int              hashCode2       = e.GetType().GetHashCode();
            int              num             = 0;
            ILocalizedString localizedString = e as ILocalizedString;

            if (localizedString != null)
            {
                num = localizedString.LocalizedString.GetHashCode();
            }
            return(num ^ hashCode ^ hashCode2);
        }
示例#10
0
        protected Statement(String id, ILocalizedString name, ILocalizedString hint = null)
        {
            Update(id);

            if (name != null)
            {
                Name = name;
            }
            else
            {
                throw new ArgumentNullException(nameof(name));
            }

            Hint = hint ?? LocalizedString.Empty;
        }
 public ProfessionPerk(ILocalizedString personEquipmentTemplate,
                       ILocalizedString descriptionEquipmentTemplate)
 {
     Scheme = new PersonPerkScheme
     {
         Name = new LocalizedStringSubScheme
         {
             Ru = personEquipmentTemplate.Ru,
             En = personEquipmentTemplate.En
         },
         Description = new LocalizedStringSubScheme
         {
             Ru = descriptionEquipmentTemplate.Ru,
             En = descriptionEquipmentTemplate.En
         }
     };
 }
        public static StepCollection AddCommandWithParameter(this Step step, string command, ILocalizedString suggestParameterText)
        {
            var commandWithParameter      = new CommandStep(command, true);
            var commandWithoutOfParameter = new CommandStep(command, false);

            commandWithoutOfParameter.EchoReply(suggestParameterText, EchoOptions.EchoForceReply());
            var commandAwaitParameter = commandWithoutOfParameter.AddAnyInput();

            step.AddChildStep(commandWithParameter);
            step.AddChildStep(commandWithoutOfParameter);
            return(new StepCollection(new[] { commandWithParameter, commandAwaitParameter }));
        }
示例#13
0
 public virtual bool ContentEquals(ILocalizedString another)
 {
     return(another != null && another.Language == Language && another.Value == Value);
 }
示例#14
0
 public EntryName(TEntry entry, ILocalizedString localizedString)
     : base(localizedString.Value, localizedString.Language)
 {
     Entry = entry;
 }
示例#15
0
 public VenueName(Venue venue, ILocalizedString localizedString) : base(venue, localizedString)
 {
 }
示例#16
0
 public static LocalizedString From(ILocalizedString value)
 {
     return(value is Semantics.Localization.LocalizedStringVariable
                         ? new LocalizedStringVariable(value as Semantics.Localization.LocalizedStringVariable) as LocalizedString
                         : new LocalizedStringConstant(value as Semantics.Localization.LocalizedStringConstant));
 }
示例#17
0
 public EventName(ReleaseEvent song, ILocalizedString localizedString) : base(song, localizedString)
 {
 }
示例#18
0
        public IDisease Create()
        {
            var roll = _dice.RollD6();

            if (roll <= 1)
            {
                var nameGenerationAttempt = 0;
                do
                {
                    var primaryName = _dice.RollFromList(DiseaseNames.Primary);

                    ILocalizedString prefix = null;

                    var rollPrefix = _dice.RollD6();
                    if (rollPrefix >= 4)
                    {
                        prefix = _dice.RollFromList(DiseaseNames.PrimaryPreffix);
                    }

                    ILocalizedString secondary = null;
                    var rollSecondary          = _dice.RollD6();
                    if (rollSecondary >= 4)
                    {
                        secondary = _dice.RollFromList(DiseaseNames.Secondary);
                    }

                    ILocalizedString subject = null;
                    var rollSubject          = _dice.RollD6();
                    if (rollSubject >= 6)
                    {
                        subject = _dice.RollFromList(DiseaseNames.Subject);
                    }

                    var diseaseName = new DiseaseName(primaryName, prefix, secondary, subject);

                    // Проверяем, была ли уже такая болезнь.

                    var isDuplicate = CheckDuplicates(diseaseName);
                    if (isDuplicate)
                    {
                        nameGenerationAttempt++;
                        continue;
                    }

                    var rolledSymptoms = RolledSymptoms();

                    var progressSpeed = RollDiseaseProgressSpeed();

                    var disease = new Disease(diseaseName, rolledSymptoms, progressSpeed);

                    _usedDiseases.Add(diseaseName);

                    return(disease);
                } while (nameGenerationAttempt < 10);

                // Не удалось сгенерировать уникальное имя. Значит вообще не генерируем болезнь.
                return(null);
            }
            else
            {
                return(null);
            }
        }
示例#19
0
 public TestStatement(string id, ILocalizedString name, ILocalizedString hint)
     : base(id, name, hint)
 {
 }
示例#20
0
 public EventSeriesName(ReleaseEventSeries series, ILocalizedString localizedString) : base(series, localizedString)
 {
 }
示例#21
0
 public override void Apply(ILocalizedString localizedString)
 {
 }
示例#22
0
 public abstract void Apply(ILocalizedString localizedString);
示例#23
0
 public EchoExecutor(ILocalizedString echoText, EchoOptions echoOptions)
 {
     _echoText    = echoText;
     _echoOptions = echoOptions;
 }
 public static Step EchoReply(this Step step, ILocalizedString localizedString, EchoOptions echoOptions = null)
 {
     step.AppendExecutor(new EchoExecutor(localizedString, echoOptions));
     return(step);
 }
示例#25
0
 public EntryName(TEntry song, ILocalizedString localizedString)
     : base(localizedString.Value, localizedString.Language)
 {
     Entry = song;
 }