示例#1
0
        public void UpdateKeywordIsPersisted()
        {
            using (var businessContext = new BusinessContext())
            {
                var language = new Language
                {
                    Name = "LanguageName"
                };

                businessContext.AddNewLanguage(language);

                var keyword = new Keyword
                {
                    Name = "KeywordName",
                    LanguageId = 1,
                };

                businessContext.AddNewKeyword(keyword);

                keyword.Name = "New KeywordName";

                businessContext.UpdateKeyword(keyword);

                bool updated = businessContext.DataContext.Keywords.Any(k => k.Id == keyword.Id && k.Name == keyword.Name);

                Assert.IsTrue(updated);
            }
        }
示例#2
0
 public void OnLanguageDeleted(Language language)
 {
     if (LanguageDeleted != null)
     {
         LanguageDeleted(new SingleItemEventArgs<Language>(language));
     }        
 }
示例#3
0
        public PropertyOptionsVM(PropertyDefOptions options, ModuleDef ownerModule, Language language, TypeDef ownerType)
        {
            this.ownerModule = ownerModule;
            this.origOptions = options;

            var typeSigCreatorOptions = new TypeSigCreatorOptions(ownerModule, language) {
                IsLocal = false,
                CanAddGenericTypeVar = true,
                CanAddGenericMethodVar = true,
                OwnerType = ownerType,
            };
            if (ownerType != null && ownerType.GenericParameters.Count == 0)
                typeSigCreatorOptions.CanAddGenericTypeVar = false;
            var methodSigCreatorOptions = new MethodSigCreatorOptions(typeSigCreatorOptions);
            methodSigCreatorOptions.IsPropertySig = true;
            this.methodSigCreator = new MethodSigCreatorVM(methodSigCreatorOptions);
            this.methodSigCreator.PropertyChanged += methodSigCreator_PropertyChanged;
            this.methodSigCreator.ParametersCreateTypeSigArray.PropertyChanged += methodSigCreator_PropertyChanged;
            this.methodSigCreator.ParametersCreateTypeSigArray.TypeSigCreator.CanAddFnPtr = false;
            this.getMethodsVM = new MethodDefsVM(ownerModule, language);
            this.setMethodsVM = new MethodDefsVM(ownerModule, language);
            this.otherMethodsVM = new MethodDefsVM(ownerModule, language);
            this.customAttributesVM = new CustomAttributesVM(ownerModule, language);
            this.constantVM = new ConstantVM(ownerModule, options.Constant == null ? null : options.Constant.Value, "Default value for this property");
            this.constantVM.PropertyChanged += constantVM_PropertyChanged;

            ConstantVM.IsEnabled = HasDefault;
            Reinitialize();
        }
        public void DeleteLanguage(Language language)
        {
            if (Equals(language, null))
                throw new ArgumentNullException("language");

            CurrentSession.Delete<Language>(language);
        }
示例#5
0
        public Settings_Page4(Color c, Language lang)
        {
            InitializeComponent();

            themeColor = c;
            LANG = lang;

            SlideOutButtonVisible = false;

            settings4_1_filelocation_button.Click += settings4_1_filelocation_button_Click;
            settings4_4_language.Items.AddRange(new object[] {"简体中文", "English"});
            settings4_4_language.DrawItem += settings4_4_language_DrawItem;
            settings4_4_language.SelectionChangeCommitted += settings4_4_language_SelectionChangeCommitted;

            settings4_1_filelocation_label.Text = LANG.getString("settings4_1_filelocation_label");
            settings4_1_filelocation_button.Text = LANG.getString("settings4_1_filelocation_button");
            settings4_2_deletetempfiles_label.Text = LANG.getString("settings4_2_deletetempfiles_label");
            settings4_4_chkupd_label.Text = LANG.getString("settings4_4_chkupd_label");
            settings4_4_chkupd_button.Text = LANG.getString("settings4_4_chkupd_button");
            settings4_3_reset_button.Text = LANG.getString("settings4_3_reset_button");
            settings4_1_filelocation_dialog.Description = LANG.getString("settings4_1_filelocation_dialog");
            settings4_4_language_label.Text = LANG.getString("settings4_4_language_label");

            // DPI settings
            AutoScaleDimensions = new SizeF(96F, 96F);
            AutoScaleMode = AutoScaleMode.Dpi;

            // Set UI Font according to language
            LANG.setFont(this.Controls);
            Font = new Font(LANG.getFont(), Font.Size, Font.Style);
        }
        public static void TranslateProject(string apikey, string project_path, TranslatorDefinition transdef, Language sourceLanguage)
        {
            AndroidProject project = new AndroidProject(project_path);
            ResourceTranslator rt = new ResourceTranslator(project, transdef.CreateInstance(apikey), sourceLanguage);

            rt.TranslateProject();
        }
示例#7
0
    public void SetUp()
    { 
      var home = _context.CurrentDatabase.GetItem("/sitecore/content/home");

      var contentRootItem = TestUtil.CreateContentFromFile("TestResources\\items in workflow.xml", _testRoot);
      _publishableItem = contentRootItem.Axes.GetChild("publishable");
      _itemInWorkflow = contentRootItem.Axes.GetChild("in draft");
      _noWorkflow = contentRootItem.Axes.GetChild("no workflow");

      _noWorkflow.Editing.BeginEdit();
      _noWorkflow[FieldIDs.Workflow] = string.Empty;
      _noWorkflow[FieldIDs.WorkflowState] = string.Empty;
      _noWorkflow.Editing.EndEdit();

      // publish the root item only so publishing on any item works
      var dbs = new Database[]{ Sitecore.Configuration.Factory.GetDatabase("web")};
      var langs = new Language[]{ Sitecore.Context.Language};
      var handle = PublishManager.PublishItem(_testRoot, dbs, langs, false, true);

      PublishManager.PublishItem(contentRootItem, dbs, langs, false, true);

      var jobs = from j in Sitecore.Jobs.JobManager.GetJobs()
                 where j.Name.Contains("Publish") && j.Name.Contains("web")
                 select j;

      foreach (var job in jobs)
        job.Wait();
    }
		///<summary>lanForeign might be null.</summary>
		public FormTranslationEdit(Language lanCur,LanguageForeign lanForeign,string otherTrans){
			InitializeComponent();
			//no need to translate anything here
			LanCur=lanCur;
			LanForeign=lanForeign;
			OtherTrans=otherTrans;
		}
示例#9
0
 public LanguageKey(string key, string value, Language lang)
 {
     Key = key;
     Value = value;
     Language = lang;
     FkLanguage = lang.Id;
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        bool canContinue = false;
        try
        {
            double.Parse(TextBoxHeight.Text);
            double.Parse(TextBoxWidth.Text);
            LabelSizeError.Visible = false;
            canContinue = true;
        }
        catch
        {
            LabelSizeError.Visible = true;
        }

        if (canContinue)
        {
            if (int.Parse(DropDownListLanguages.SelectedValue) > 509)
            {
                Account newAccount = CurrentUser.CurrentAccount;
                bool isEditing = !newAccount.IsNew;
                newAccount.Description = TextBoxDescription.Text;
                newAccount.CountryId = int.Parse(DropDownCountry.SelectedValue);
                newAccount.LanguageId = int.Parse(DropDownListLanguages.SelectedValue);
                newAccount.CityId = int.Parse(DropDownListCityList.SelectedValue);
                newAccount.TrackNames = CheckBoxNames.Checked;
                newAccount.TrackPhoneNumbers = CheckBoxPhoneNumbers.Checked;
                newAccount.PrintHeight = double.Parse(TextBoxHeight.Text);
                newAccount.PrintUnit = DropDownListUnit.SelectedValue;
                newAccount.PrintWidth = double.Parse(TextBoxWidth.Text);
                newAccount.IsForeignLanguage = CheckBoxIsForeignLanguage.Checked;
                newAccount.Save();
                CurrentUser.SetAccountCookie(newAccount);
                if (!isEditing)
                {
                    if (AccountUserMap.GetForCurrentUser() == null)
                    {
                        AccountUserMap newMap = new AccountUserMap();
                        newMap.AccountId = newAccount.AccountId;
                        newMap.UserId = CurrentUser.UserName;
                        newMap.Save();

                    }
                    Language defaultLanguage = new Language(509);
                    defaultLanguage.AddLanguageToCurrentAccount();
                    defaultLanguage = new Language(int.Parse(DropDownListLanguages.SelectedValue));
                    defaultLanguage.AddLanguageToCurrentAccount();
                    City selectedCity = new City(int.Parse(this.DropDownListCityList.SelectedValue));
                    selectedCity.AssociateWithCurrentAccount();
                }
                LabelMessage.Text = "Saved.";
                Saved();
                CurrentUser.Refresh();
            }
            else
            {
                LabelMessage.Text = "Please select a valid language";
            }
        }
    }
示例#11
0
	void Init (string fname)
	{
		if (File.Exists (fname)) {
			File.Delete (fname);
		}

		lang = LanguageForExtension (Path.GetExtension (fname));

		switch (lang) {
			case Language.C:
				Indenter = "  ";
				break;

			case Language.CSharp:
			default:
				Indenter = "\t";
				break;
		}

		FileStream fs = new FileStream (fname, FileMode.OpenOrCreate, FileAccess.Write);
		w = new StreamWriter (fs);

		if (lang == Language.CSharp) {
			w.WriteLine ("//------------------------------------------------------------------------------");
			w.WriteLine ("// <auto-generated>");
			w.WriteLine ("//     This code was generated by a tool.");
			w.WriteLine ("// </auto-generated>");
			w.WriteLine ("//------------------------------------------------------------------------------");
			w.WriteLine ();
		} else {
			WriteComment ("This code was generated by a tool.");
		}

	}
示例#12
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
            WritLanguage = (Language)reader.ReadInt();
        }
示例#13
0
        /// <summary>
        /// Deletes a language
        /// </summary>
        /// <param name="language">Language</param>
        public virtual void DeleteLanguage(Language language)
        {
            if (language == null)
                throw new ArgumentNullException("language");

            //update default admin area language (if required)
            if (_localizationSettings.DefaultAdminLanguageId == language.Id)
            {
                foreach (var activeLanguage in GetAllLanguages())
                {
                    if (activeLanguage.Id != language.Id)
                    {
                        _localizationSettings.DefaultAdminLanguageId = activeLanguage.Id;
                        _settingService.SaveSetting(_localizationSettings);
                        break;
                    }
                }
            }

            _languageRepository.Delete(language);

            //cache
            _cacheManager.RemoveByPattern(LANGUAGES_PATTERN_KEY);

            //event notification
            _eventPublisher.EntityDeleted(language);
        }
示例#14
0
		public static CodeDomProvider CreateProvider(Language language, CompilerVersion version)
		{
			var providerOptions = GetProviderOptions(version);
			var provider = CodeDomProvider.CreateProvider(language.ToString(), providerOptions);

			return provider;
		}
示例#15
0
        /// <summary>
        /// Adds a new language.
        /// </summary>
        public void AddNewLanguage(Language language)
        {
            Check.Require(language.Name);

            dataContext.Languages.Add(language);
            dataContext.SaveChanges();
        }
        RuleSetInformation ISolutionRuleStore.GetRuleSetInformation(Language language)
        {
            RuleSetInformation ruleSet;
            Assert.IsTrue(this.availableRuleSets.TryGetValue(language, out ruleSet), "No RuleSet for group: " + language);

            return ruleSet;
        }
示例#17
0
        public LanguageAdapter(Language language)
        {
            if (language == null) throw new ArgumentNullException(nameof(language));

            Id = language.Id;
            Name = language.Name;
        }
 public SummonerSpellListStaticWrapper(SummonerSpellListStatic spells, Language language
     , SummonerSpellData summonerSpellData)
 {
     SummonerSpellListStatic = spells;
     Language = language;
     SummonerSpellData = summonerSpellData;
 }
 public Completion(SimpleIni config, Settings settings)
 {
     this.settings = settings;
     lang = ScintillaControl.Configuration.GetLanguage("css");
     InitProperties(GetSection(config, "Properties"));
     InitLists(GetSection(config, "Lists"));
 }
        public IHttpActionResult PutLanguage(int id, Language language)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != language.Id)
            {
                return BadRequest();
            }

            db.Entry(language).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LanguageExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
 protected void Add_Click(object sender, EventArgs e)
 {
     Language language = new Language();
     language.Name = tbNewLang.Text.Trim();
     BLL.LanguageManager.Add(language);
     this.GridView1.DataBind();
 }
 protected override void Write(ITextOutput output, Language language)
 {
     if (name != null)
         output.Write(name, TextTokenType.Keyword);
     else
         base.Write(output, language);
 }
        public void SaveLanguage(Language language)
        {
            if (Equals(language, null))
                throw new ArgumentNullException("language");

            CurrentSession.Save(language);
        }
 public PageLinksValidationResult(string key, Language language, string version)
 {
     PageKey = key;
     PageLanguage = language;
     PageVersion = version;
     Links = new Dictionary<string, bool>();
 }
示例#25
0
 public Importer(DataTable dt, Language language, Wordtype wordtype, Language targetLanguage)
 {
     _dt = dt;
     _language = language;
     _wordtype = wordtype;
     _targetLanguage = targetLanguage;
 }
示例#26
0
        public static string CompileAndRun(string code, Language language)
        {
            var compilerParams = new CompilerParameters
            {
                GenerateInMemory = false,
                TreatWarningsAsErrors = false,
                GenerateExecutable = false,
                CompilerOptions = "/optimize"
            };

            string[] references = { "System.dll", "System.Linq.dll", "System.Core.dll" };
            compilerParams.ReferencedAssemblies.AddRange(references);

            CodeDomProvider provider = language == Language.CSharp ? (CodeDomProvider)new CSharpCodeProvider() : (CodeDomProvider)new VBCodeProvider();
            var compile = provider.CompileAssemblyFromSource(compilerParams, code);

            if (compile.Errors.HasErrors)
            {
                return compile.Errors.Cast<CompilerError>().Aggregate("Compile error: ",
                    (current, ce) => current
                        + string.Format("Line: {0}\r\nColumn: {1}\r\nError Code: {2}\r\nError Text: {3}\r\n",
                            ce.Line, ce.Column, ce.ErrorNumber, ce.ErrorText));
            }

            var sandbox = Sandbox.Create();
            return sandbox.Execute(compile.PathToAssembly);
        }
示例#27
0
        public void DeleteKeywordIsPersisted()
        {
            using (var businessContext = new BusinessContext())
            {
                var language = new Language
                {
                    Name = "LanguageName"
                };

                businessContext.AddNewLanguage(language);

                var keyword = new Keyword
                {
                    Name = "KeywordName",
                    LanguageId = 1,
                };

                businessContext.AddNewKeyword(keyword);

                //businessContext.DeleteKeyword(keyword);

                bool notDeleted = businessContext.DataContext.Keywords.Any(k => k.Id == keyword.Id);

                //Assert.IsFalse(notDeleted);
            }
        }
示例#28
0
        public static void WriteJavascriptDictionary(StreamWriter stream, Language language)
        {
            var processDictionaryItems = new ProcessDictionaryItems();

            stream.WriteLine("(function () {");

            // IE7 can't handle trailing "," in javascript array
            var lastLine = "  var tmp = {";
            processDictionaryItems.Start(item =>
            {
                stream.WriteLine(lastLine);
                var key = EscapeSingleQuote(item.key);
                var value = EscapeSingleQuote(item.Value(language.id));
                lastLine = string.Format("    '{0}': '{1}',", key, value);
            }, Dictionary.getTopMostItems);
            stream.WriteLine(lastLine.TrimEnd(','));

            stream.WriteLine("  };");

            stream.WriteLine("");
            stream.WriteLine("  if (window['$uDictionary'] === undefined) {");
            stream.WriteLine("    window['$uDictionary'] = tmp;");
            stream.WriteLine("  } else {");
            stream.WriteLine("    var $uDic = window['$uDictionary'];");
            stream.WriteLine("    for (var attrname in tmp) { ");
            stream.WriteLine("      var value = tmp[attrname];");
            stream.WriteLine("      if(value != '')");
            stream.WriteLine("        $uDic[attrname] = value;");
            stream.WriteLine("    }");
            stream.WriteLine("  }");
            stream.WriteLine("})();");
        }
示例#29
0
        /// <summary>
        /// Initialize Speech Recognizer and compile constraints.
        /// </summary>
        /// <param name="recognizerLanguage">Language to use for the speech recognizer</param>
        /// <returns>Awaitable task.</returns>
        private async Task InitializeRecognizer(Language recognizerLanguage)
        {
            MicrophoneAccessStatus status = await AudioCapturePermissions.RequestMicrophoneAccessAsync();
            if (status != MicrophoneAccessStatus.Allowed)
            {
                string prompt = status == MicrophoneAccessStatus.NoCaptureDevices ?
                    "没有检测到音频捕获设备,请检查设备后重试" :
                    "您没有允许本应用访问麦克风,请在 设置 -> 隐私 -> 麦克风 中设置";
                var messageDialog = new MessageDialog(prompt);
                await messageDialog.ShowAsync();
                throw new Exception($"Request microphone access failed. Status: {status}");
            }

            Dispose();

            // Create an instance of SpeechRecognizer.
            _speechRecognizer = new SpeechRecognizer(recognizerLanguage);

            // Add a web search topic constraint to the recognizer.
            var webSearchGrammar = new SpeechRecognitionTopicConstraint(SpeechRecognitionScenario.WebSearch, "webSearch");
            _speechRecognizer.Constraints.Add(webSearchGrammar);

            // RecognizeWithUIAsync allows developers to customize the prompts.    
            _speechRecognizer.UIOptions.AudiblePrompt = "请说出您想搜索的东西";
            _speechRecognizer.UIOptions.ExampleText = "例如:“你好,美女”";

            // Compile the constraint.
            SpeechRecognitionCompilationResult compilationResult = await _speechRecognizer.CompileConstraintsAsync();

            // Check to make sure that the constraints were in a proper format and the recognizer was able to compile it.
            if (compilationResult.Status != SpeechRecognitionResultStatus.Success)
                throw new Exception($"Unable to compile grammar. Status: {compilationResult.Status}");
        }
示例#30
0
        /// <summary>
        /// Deletes a language
        /// </summary>
        /// <param name="language">Language</param>
        public virtual void Delete(Language language)
        {
            Guard.IsNotNull(language, "language");

            //update default admin area language (if required)
            if (localizationSettings.DefaultLanguageId == language.RowId)
            {
                foreach (var activeLanguage in GetAll())
                {
                    if (activeLanguage.RowId != language.RowId)
                    {
                        localizationSettings.DefaultLanguageId = activeLanguage.RowId;
                        settingService.Save(localizationSettings);
                        break;
                    }
                }
            }

            //update appropriate users (their language)
            //it can take a lot of time if you have thousands of associated customers
            var users = userService.GetUsersByLanguageId(language.RowId);
            foreach (var user in users)
            {
                user.LanguageId = null;
                userService.Update(user);
            }

            languageRepository.Delete(language);

            //cache
            cacheManager.RemoveByPattern(LANGUAGES_PATTERN_KEY);

            //event notification
            eventPublisher.EntityDeleted(language);
        }
示例#31
0
 // コピー
 void Copy(Preferences src)
 {
     m_Language    = src.m_Language;
     m_GameVersion = src.m_GameVersion;
 }
示例#32
0
        public async Task it_displays_detailed_information_for_exceptions_thrown_in_user_code(Language language)
        {
            var kernel = CreateKernel(language);

            var source = language switch
            {
                Language.FSharp => new[]
                {
                    // F# syntax doesn't allow a bare `raise ...` expression at the root due to type inference being
                    // ambiguous, but the same effect can be achieved by wrapping the exception in a strongly-typed
                    // function call.
                    @"open System
let f (): unit = 
    try
        raise (Exception(""the-inner-exception""))
    with
        | ex -> raise (DataMisalignedException(""the-outer-exception"", ex))

f ()"
                },

                Language.CSharp => new[]
                {
                    @"
void f()
{
    try
    {
        throw new Exception(""the-inner-exception"");
    }
    catch(Exception e)
    {
        throw new DataMisalignedException(""the-outer-exception"", e);
    }
    
}

f();"
                }
            };

            await SubmitCode(kernel, source);

            KernelEvents
            .Should()
            .ContainSingle <CommandFailed>()
            .Which
            .Message
            .Should()
            .Contain("the-inner-exception")
            .And
            .Contain("the-outer-exception");
        }
 public override void UpdateArmorSet(Player player)
 {
     player.onHitPetal = true;
     player.setBonus   = Language.GetTextValue("Mods.ClassOverhaul.ArmorSetBonus.OrichalcumRogue");
 }
示例#34
0
        public static Currency ToWebModel(this VirtoCommerceDomainCommerceModelCurrency currency, Language language)
        {
            var retVal = new Currency(language, currency.Code, currency.Name, currency.Symbol, (decimal)currency.ExchangeRate.Value);

            retVal.CustomFormatting = currency.CustomFormatting;
            return(retVal);
        }
        string ISolutionRuleSetsInformationProvider.CalculateSolutionSonarQubeRuleSetFilePath(string sonarQubeProjectKey, Language language)
        {
            string fileName = $"{sonarQubeProjectKey}{language.Id}.{Constants.RuleSetFileExtension}";

            return(Path.Combine(((ISolutionRuleSetsInformationProvider)this).GetSolutionSonarQubeRulesFolder(), fileName));
        }
示例#36
0
        public async Task Javascript_helper_emits_string_as_content_within_a_script_element(Language language)
        {
            var kernel = CreateKernel(language);

            var scriptContent = "alert('Hello World!');";

            var submission = language switch
            {
                Language.CSharp => $@"Javascript(""{scriptContent}"");",
                Language.FSharp => $@"Javascript(""{scriptContent}"")",
            };

            await kernel.SendAsync(new SubmitCode(submission));

            var formatted =
                KernelEvents
                .OfType <DisplayedValueProduced>()
                .SelectMany(v => v.FormattedValues)
                .ToArray();

            formatted
            .Should()
            .ContainSingle(v =>
                           v.MimeType == "text/html" &&
                           v.Value.ToString().Contains($@"<script type=""text/javascript"">{scriptContent}</script>"));
        }
示例#37
0
        public override void PopulateData(RowParser parser, GameData gameData, Language language)
        {
            base.PopulateData(parser, gameData, language);

            Name = parser.ReadColumn <SeString>(0);
        }
示例#38
0
 // 初期設定
 public void Initialize()
 {
     m_Language    = Language.Japanese;
     m_GameVersion = 0;
 }
 // If we need to perform some actions before or after the lenguage change we use this method
 private static void ProcessLanguageChange(Language _newLanguage)
 {
     gameLanguage = _newLanguage;
     Debug.Log("lenguage set to " + gameLanguage);
 }
示例#40
0
 public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
 {
     language.DecompileType(GetTypeDefinition(), output, options);
 }
示例#41
0
        public async Task <OperationResult> CreatePost(CasePostCreateModel requestModel)
        {
            //using (var transaction = await _dbContext.Database.BeginTransactionAsync())
//                {
            try
            {
                if (string.IsNullOrEmpty(_emailSettings.Value.SendGridKey))
                {
                    //transaction.Rollback();
                    return(new OperationResult(false,
                                               _localizationService.GetString("SendGridKeyShouldBeAddedToSettings")));
                }

                var casePost = new CasePost
                {
                    CreatedAt       = DateTime.UtcNow,
                    UpdatedAt       = DateTime.UtcNow,
                    Version         = 1,
                    CreatedByUserId = _userService.UserId,
                    UpdatedByUserId = _userService.UserId,
                    AttachPdf       = requestModel.AttachReport,
                    LinkToCase      = requestModel.AttachLinkToCase,
                    Text            = requestModel.Text,
                    Subject         = requestModel.Subject,
                    CaseId          = requestModel.CaseId,
                    PostDate        = DateTime.UtcNow,
                    WorkflowState   = Constants.WorkflowStates.Created,
                };

                await _dbContext.CasePosts.AddAsync(casePost);

                await _dbContext.SaveChangesAsync();

                foreach (var tagsId in requestModel.ToTagsIds)
                {
                    var casePostEmailTag = new CasePostEmailTag
                    {
                        CreatedAt       = DateTime.UtcNow,
                        UpdatedAt       = DateTime.UtcNow,
                        Version         = 1,
                        CreatedByUserId = _userService.UserId,
                        UpdatedByUserId = _userService.UserId,
                        CasePostId      = casePost.Id,
                        EmailTagId      = tagsId,
                        WorkflowState   = Constants.WorkflowStates.Created,
                    };

                    await _dbContext.CasePostEmailTags.AddAsync(casePostEmailTag);
                }

                foreach (var recipientId in requestModel.ToRecipientsIds)
                {
                    var casePostEmailRecipient = new CasePostEmailRecipient()
                    {
                        CreatedAt        = DateTime.UtcNow,
                        UpdatedAt        = DateTime.UtcNow,
                        Version          = 1,
                        CreatedByUserId  = _userService.UserId,
                        UpdatedByUserId  = _userService.UserId,
                        CasePostId       = casePost.Id,
                        EmailRecipientId = recipientId,
                        WorkflowState    = Constants.WorkflowStates.Created,
                    };

                    await _dbContext.CasePostEmailRecipients.AddAsync(casePostEmailRecipient);
                }

                await _dbContext.SaveChangesAsync();

                // Send email
                var currentUser = await _userService.GetCurrentUserAsync();

                var casePostRecipientResult = await _dbContext.CasePosts
                                              .AsNoTracking()
                                              .Where(x => x.Id == casePost.Id)
                                              .Select(x => new
                {
                    Recipients = x.Recipients
                                 .Select(y => y.EmailRecipient)
                                 .ToList(),
                    EmailTags = x.Tags
                                .Select(y => y.EmailTagId)
                                .ToList()
                })
                                              .FirstOrDefaultAsync();

                var emailTagsRecipients = await _dbContext.EmailTagRecipients
                                          .Where(x => casePostRecipientResult.EmailTags.Contains(x.EmailTagId))
                                          .Select(x => x.EmailRecipient)
                                          .ToListAsync();

                var recipients = new List <EmailRecipient>();
                recipients.AddRange(casePostRecipientResult.Recipients);
                recipients.AddRange(emailTagsRecipients);

                var core = await _coreService.GetCore();

                var caseDto = await core.CaseLookupCaseId(casePost.CaseId);

                if (caseDto?.MicrotingUId == null || caseDto.CheckUId == null)
                {
                    //transaction.Rollback();
                    throw new InvalidOperationException("caseDto not found");
                }
                var locale = await _userService.GetCurrentUserLocale();

                Language language     = core.DbContextHelper.GetDbContext().Languages.Single(x => x.LanguageCode.ToLower() == locale.ToLower());
                var      replyElement = await core.CaseRead((int)caseDto.MicrotingUId, (int)caseDto.CheckUId, language).ConfigureAwait(false);

                var    assembly     = Assembly.GetExecutingAssembly();
                var    assemblyName = assembly.GetName().Name;
                var    stream       = assembly.GetManifestResourceStream($"{assemblyName}.Resources.Email.html");
                string html;
                if (stream == null)
                {
                    //transaction.Rollback();
                    throw new InvalidOperationException("Resource not found");
                }
                using (var reader = new StreamReader(stream, Encoding.UTF8))
                {
                    html = await reader.ReadToEndAsync();
                }

                if (casePost.LinkToCase)
                {
                    html = html
                           .Replace("{{link}}",
                                    $"{await core.GetSdkSetting(Settings.httpServerAddress)}/cases/edit/{casePost.CaseId}/{caseDto.CheckListId}")
                           .Replace("{{text}}", casePost.Text);
                }
                else
                {
                    html = casePost.Text;
                }

                foreach (var recipient in recipients
                         .Where(r => r.WorkflowState != Constants.WorkflowStates.Removed)
                         .GroupBy(x => new { x.Email, x.Name })
                         .Select(x => x.Key)
                         .ToList())
                {
                    if (casePost.AttachPdf)
                    {
                        try
                        {
                            // Fix for broken SDK not handling empty customXmlContent well
                            var customXmlContent = new XElement("FillerElement",
                                                                new XElement("InnerElement", "SomeValue")).ToString();

                            // get report file
                            var filePath = await core.CaseToPdf(
                                casePost.CaseId,
                                replyElement.Id.ToString(),
                                DateTime.Now.ToString("yyyyMMddHHmmssffff"),
                                $"{await core.GetSdkSetting(Settings.httpServerAddress)}/" +
                                "api/template-files/get-image/",
                                "pdf",
                                customXmlContent, language);

                            if (!File.Exists(filePath))
                            {
                                throw new Exception("Error while creating report file");
                            }

                            await _emailService.SendFileAsync(
                                EformEmailConst.FromEmail,
                                $"{currentUser.FirstName} {currentUser.LastName}",
                                casePost.Subject.IsNullOrEmpty()? "-" : casePost.Subject,
                                recipient.Email,
                                filePath,
                                html : html);
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine(e);
                            await _emailService.SendAsync(
                                EformEmailConst.FromEmail,
                                $"{currentUser.FirstName} {currentUser.LastName}",
                                casePost.Subject.IsNullOrEmpty()? "-" : casePost.Subject,
                                recipient.Email,
                                html : html);
                        }
                    }
                    else
                    {
                        await _emailService.SendAsync(
                            EformEmailConst.FromEmail,
                            $"{currentUser.FirstName} {currentUser.LastName}",
                            casePost.Subject.IsNullOrEmpty()? "-" : casePost.Subject,
                            recipient.Email,
                            html : html);
                    }
                }

                //transaction.Commit();
                return(new OperationResult(
                           true,
                           _localizationService.GetString("PostCreatedSuccessfully")));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                _logger.LogError(e.Message);
                //transaction.Rollback();
                return(new OperationResult(false,
                                           _localizationService.GetString("ErrorWhileCreatingPost")));
            }
            //}
        }
示例#42
0
        protected override SyncAttempt <ILanguage> DeserializeCore(XElement node, SyncSerializerOptions options)
        {
            var isoCode = node.Element("IsoCode").ValueOrDefault(string.Empty);

            logger.Debug <LanguageSerializer>("Derserializing {0}", isoCode);

            var item = localizationService.GetLanguageByIsoCode(isoCode);

            var details = new List <uSyncChange>();

            if (item == null)
            {
                logger.Debug <LanguageSerializer>("Creating New Language: {0}", isoCode);
                item = new Language(isoCode);
                details.AddNew(isoCode, isoCode, "Language");
            }

            if (item.IsoCode != isoCode)
            {
                details.AddUpdate("IsoCode", item.IsoCode, isoCode);
                item.IsoCode = isoCode;
            }

            try
            {
                var culture = CultureInfo.GetCultureInfo(isoCode);
                if (item.CultureName != culture.DisplayName)
                {
                    details.AddUpdate("CultureName", item.CultureName, culture.DisplayName);
                    item.CultureName = culture.DisplayName;
                }
            }
            catch
            {
                logger.Warn <LanguageSerializer>("Can't set culture name based on IsoCode");
            }

            var mandatory = node.Element("IsMandatory").ValueOrDefault(false);

            if (item.IsMandatory != mandatory)
            {
                details.AddUpdate("IsMandatory", item.IsMandatory, mandatory);
                item.IsMandatory = mandatory;
            }

            var isDefault = node.Element("IsDefault").ValueOrDefault(false);

            if (item.IsDefault != isDefault)
            {
                details.AddUpdate("IsDefault", item.IsDefault, isDefault);
                item.IsDefault = isDefault;
            }

            var fallbackId = GetFallbackLanguageId(item, node);

            if (fallbackId > 0 && item.FallbackLanguageId != fallbackId)
            {
                details.AddUpdate("FallbackId", item.FallbackLanguageId, fallbackId);
                item.FallbackLanguageId = fallbackId;
            }

            // logger.Debug<ILanguage>("Saving Language");
            //localizationService.Save(item);

            return(SyncAttempt <ILanguage> .Succeed(item.CultureName, item, ChangeType.Import, details));
        }
示例#43
0
 public static void SetLanguage(Language pLanguage)
 {
     gameLanguage = pLanguage;
 }
示例#44
0
        public async Task <OperationDataResult <CasePostsListModel> > GetAllPosts(
            CasePostsRequest requestModel)
        {
            try
            {
                var value = _httpContextAccessor?.HttpContext.User?.FindFirstValue(ClaimTypes.NameIdentifier);
                var core  = await _coreService.GetCore();

                var      localeString       = _dbContext.Users.Single(x => x.Id == int.Parse(value)).Locale;
                Language language           = core.DbContextHelper.GetDbContext().Languages.Single(x => x.LanguageCode.ToLower() == localeString.ToLower());
                var      casePostsListModel = new CasePostsListModel();
                var      casePostsQuery     = _dbContext.CasePosts.AsQueryable();
                if (!string.IsNullOrEmpty(requestModel.Sort))
                {
                    if (requestModel.IsSortDsc)
                    {
                        casePostsQuery = casePostsQuery
                                         .CustomOrderByDescending(requestModel.Sort);
                    }
                    else
                    {
                        casePostsQuery = casePostsQuery
                                         .CustomOrderBy(requestModel.Sort);
                    }
                }
                else
                {
                    casePostsQuery = casePostsQuery
                                     .OrderBy(x => x.Id);
                }

                casePostsQuery = casePostsQuery
                                 .Where(x => x.CaseId == requestModel.CaseId);

                casePostsListModel.Total = await casePostsQuery.CountAsync();

                casePostsQuery = casePostsQuery
                                 .Skip(requestModel.Offset)
                                 .Take(requestModel.PageSize);

                var templateDto = await core.TemplateItemRead(requestModel.TemplateId, language);

                var caseDto = await core.CaseLookupCaseId(requestModel.CaseId);

                if (caseDto?.MicrotingUId == null || caseDto.CheckUId == null)
                {
                    throw new InvalidOperationException("caseDto not found");
                }

                var replyElement = await core.CaseRead((int)caseDto.MicrotingUId, (int)caseDto.CheckUId, language).ConfigureAwait(false);

                if (replyElement.DocxExportEnabled || replyElement.JasperExportEnabled)
                {
                    casePostsListModel.PdfReportAvailable = true;
                }

                casePostsListModel.CaseId     = requestModel.CaseId;
                casePostsListModel.CaseDoneAt = replyElement.DoneAt;

                var casePostList = await casePostsQuery
                                   .Select(x => new CasePostModel()
                {
                    Id      = x.Id,
                    Subject = x.Subject,
                    Text    = x.Text,
                    Date    = x.PostDate,
                    From    = _dbContext.Users
                              .Where(y => y.Id == x.CreatedByUserId)
                              .Select(y => $"{y.FirstName} {y.LastName}")
                              .FirstOrDefault(),
                    ToRecipients = x.Recipients
                                   .Select(y => $"{y.EmailRecipient.Name} ({y.EmailRecipient.Email})")
                                   .ToList(),
                    ToRecipientsTags = x.Tags
                                       .Select(y => y.EmailTag.Name)
                                       .ToList(),
                }).ToListAsync();

                using (var dbContext = core.DbContextHelper.GetDbContext())
                {
                    var caseEntity = await dbContext.Cases
                                     .AsNoTracking()
                                     .Include(x => x.Site)
                                     .SingleOrDefaultAsync(x => x.Id == requestModel.CaseId);

                    if (caseEntity == null)
                    {
                        return(new OperationDataResult <CasePostsListModel>(
                                   false,
                                   _localizationService.GetString("CaseNotFound")));
                    }

                    if (caseEntity.Site?.MicrotingUid != null)
                    {
                        var site = await core.SiteRead((int)caseEntity.Site.MicrotingUid);

                        casePostsListModel.WorkerName = site.SiteName;
                    }

                    casePostsListModel.EFormName = templateDto.Label;

                    if (templateDto.Field1 != null)
                    {
                        casePostsListModel.AdditionalFields.Add(
                            new KeyValueStringModel
                        {
                            Key   = templateDto.Field1.Label,
                            Value = caseEntity.FieldValue1 == "null" ? "" : caseEntity.FieldValue1
                        });
                    }

                    if (templateDto.Field2 != null)
                    {
                        casePostsListModel.AdditionalFields.Add(
                            new KeyValueStringModel
                        {
                            Key   = templateDto.Field2.Label,
                            Value = caseEntity.FieldValue2 == "null" ? "" : caseEntity.FieldValue2
                        });
                    }

                    if (templateDto.Field3 != null)
                    {
                        casePostsListModel.AdditionalFields.Add(
                            new KeyValueStringModel
                        {
                            Key   = templateDto.Field3.Label,
                            Value = caseEntity.FieldValue3 == "null" ? "" : caseEntity.FieldValue3
                        });
                    }

                    if (templateDto.Field4 != null)
                    {
                        casePostsListModel.AdditionalFields.Add(
                            new KeyValueStringModel
                        {
                            Key   = templateDto.Field4.Label,
                            Value = caseEntity.FieldValue4 == "null" ? "" : caseEntity.FieldValue4
                        });
                    }

                    if (templateDto.Field5 != null)
                    {
                        casePostsListModel.AdditionalFields.Add(
                            new KeyValueStringModel
                        {
                            Key   = templateDto.Field5.Label,
                            Value = caseEntity.FieldValue5 == "null" ? "" : caseEntity.FieldValue5
                        });
                    }

                    if (templateDto.Field6 != null)
                    {
                        casePostsListModel.AdditionalFields.Add(
                            new KeyValueStringModel
                        {
                            Key   = templateDto.Field6.Label,
                            Value = caseEntity.FieldValue6 == "null" ? "" : caseEntity.FieldValue6
                        });
                    }

                    if (templateDto.Field7 != null)
                    {
                        casePostsListModel.AdditionalFields.Add(
                            new KeyValueStringModel
                        {
                            Key   = templateDto.Field7.Label,
                            Value = caseEntity.FieldValue7 == "null" ? "" : caseEntity.FieldValue7
                        });
                    }

                    if (templateDto.Field8 != null)
                    {
                        casePostsListModel.AdditionalFields.Add(
                            new KeyValueStringModel
                        {
                            Key   = templateDto.Field8.Label,
                            Value = caseEntity.FieldValue8 == "null" ? "" : caseEntity.FieldValue8
                        });
                    }

                    if (templateDto.Field9 != null)
                    {
                        casePostsListModel.AdditionalFields.Add(
                            new KeyValueStringModel
                        {
                            Key   = templateDto.Field9.Label,
                            Value = caseEntity.FieldValue9 == "null" ? "" : caseEntity.FieldValue9
                        });
                    }

                    if (templateDto.Field10 != null)
                    {
                        casePostsListModel.AdditionalFields.Add(
                            new KeyValueStringModel
                        {
                            Key   = templateDto.Field10.Label,
                            Value = caseEntity.FieldValue10 == "null" ? "" : caseEntity.FieldValue10
                        });
                    }
                }

                casePostsListModel.CasePostsList = casePostList;
                return(new OperationDataResult <CasePostsListModel>(true, casePostsListModel));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                _logger.LogError(e.Message);
                return(new OperationDataResult <CasePostsListModel>(false,
                                                                    _localizationService.GetString("ErrorWhileObtainingPosts")));
            }
        }
示例#45
0
 public override void PostUpdate()
 {
     if (Main.dayTime && VolcanoCountdown == 0)
     {
         if (VolcanoCooldown > 0)
         {
             VolcanoCooldown--;
         }
         if (VolcanoCooldown <= 0 && Main.rand.NextBool(VolcanoChance) && !ModContent.GetInstance <ExampleConfigServer>().DisableVolcanoes)
         {
             string key          = "Mods.ExampleMod.VolcanoWarning";
             Color  messageColor = Color.Orange;
             if (Main.netMode == NetmodeID.Server)                     // Server
             {
                 NetMessage.BroadcastChatMessage(NetworkText.FromKey(key), messageColor);
             }
             else if (Main.netMode == NetmodeID.SinglePlayer)                     // Single Player
             {
                 Main.NewText(Language.GetTextValue(key), messageColor);
             }
             VolcanoCountdown = DefaultVolcanoCountdown;
             VolcanoCooldown  = DefaultVolcanoCooldown;
         }
     }
     if (VolcanoCountdown > 0)
     {
         VolcanoCountdown--;
         if (VolcanoCountdown == 0)
         {
             VolcanoTremorTime = DefaultVolcanoTremorTime;
             // Since PostUpdate only happens in single and server, we need to inform the clients to shake if this is a server
             if (Main.netMode == NetmodeID.Server)
             {
                 var netMessage = mod.GetPacket();
                 netMessage.Write((byte)ExampleModMessageType.SetTremorTime);
                 netMessage.Write(VolcanoTremorTime);
                 netMessage.Send();
             }
             for (int playerIndex = 0; playerIndex < 255; playerIndex++)
             {
                 if (Main.player[playerIndex].active)
                 {
                     Player  player       = Main.player[playerIndex];
                     int     speed        = 12;
                     float   spawnX       = Main.rand.Next(1000) - 500 + player.Center.X;
                     float   spawnY       = -1000 + player.Center.Y;
                     var     baseSpawn    = new Vector2(spawnX, spawnY);
                     Vector2 baseVelocity = player.Center - baseSpawn;
                     baseVelocity.Normalize();
                     baseVelocity = baseVelocity * speed;
                     var identities = new List <int>();
                     for (int i = 0; i < VolcanoProjectiles; i++)
                     {
                         Vector2 spawn = baseSpawn;
                         spawn.X = spawn.X + i * 30 - VolcanoProjectiles * 15;
                         Vector2 velocity = baseVelocity;
                         velocity   = baseVelocity.RotatedBy(MathHelper.ToRadians(-VolcanoAngleSpread / 2 + VolcanoAngleSpread * i / (float)VolcanoProjectiles));
                         velocity.X = velocity.X + 3 * Main.rand.NextFloat() - 1.5f;
                         int projectile = Projectile.NewProjectile(spawn.X, spawn.Y, velocity.X, velocity.Y, Main.rand.Next(ProjectileID.MolotovFire, ProjectileID.MolotovFire3 + 1), 10, 10f, Main.myPlayer, 0f, 0f);
                         Main.projectile[projectile].hostile = true;
                         Main.projectile[projectile].Name    = "Volcanic Rubble";
                         identities.Add(Main.projectile[projectile].identity);
                     }
                     if (Main.netMode == NetmodeID.Server)
                     {
                         var netMessage = mod.GetPacket();
                         netMessage.Write((byte)ExampleModMessageType.VolcanicRubbleMultiplayerFix);
                         netMessage.Write(identities.Count);
                         for (int i = 0; i < identities.Count; i++)
                         {
                             netMessage.Write(identities[i]);
                         }
                         netMessage.Send();
                     }
                 }
             }
         }
     }
 }
示例#46
0
        public void LoadPage()
        {
            if (!AjaxLoadCheck())
            {
                return;
            }
            string     msg      = "";
            string     name     = "";
            int        theme_id = RequestTool.RequestInt("theme_id", 0);
            Lebi_Theme theme    = B_Lebi_Theme.GetModel(theme_id);

            if (theme == null)
            {
                Response.Write("{\"msg\":\"" + Language.Tag("参数错误") + "\"}");
                return;
            }
            HttpFileCollection files = HttpContext.Current.Request.Files;
            BaseConfig         conf  = ShopCache.GetBaseConfig();
            B_WaterConfig      bc    = new B_WaterConfig();
            WaterConfig        mx    = bc.LoadConfig();

            if (files.Count > 0)
            {
                ///'检查文件扩展名字
                HttpPostedFile postedFile = files[0];
                string         savepath = GetPath(theme.Path_Advert);
                string         fileName, fileExtension;
                fileName      = System.IO.Path.GetFileName(postedFile.FileName);
                fileExtension = System.IO.Path.GetExtension(fileName);
                if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null)
                {
                    conf.UpLoadSaveName = "0";
                }
                if (conf.UpLoadSaveName == "0")
                {
                    name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_";
                }
                else
                {
                    name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_";
                }
                name = conf.UpLoadRName + name + fileExtension;
                int status = ImageHelper.SaveImage(postedFile, savepath, name);
                if (status != 290)
                {
                    msg = Language.Tag(EX_Type.TypeName(status));
                    Response.Write("{\"msg\":\"" + msg + "\"}");
                    return;
                }

                string OldImage = savepath + name;
                OldImage = ThemeUrl.CheckURL(OldImage);
                string ImageSmall = name.Replace("_w$h_", "_100$100_");
                string size       = "100$100";


                ImageHelper.UPLoad(OldImage, savepath, ImageSmall, Convert.ToInt32(conf.ImageSmallWidth), Convert.ToInt32(conf.ImageSmallHeight));

                //写入数据库
                Lebi_Image model = new Lebi_Image();
                model.Image     = savepath + name;
                model.Keyid     = 0;
                model.Size      = size;
                model.TableName = "temp";
                B_Lebi_Image.Add(model);
                msg = "OK";
                Response.Write("{\"msg\":\"" + msg + "\",\"url\":\"" + savepath + name + "\",\"Image\":\"" + name + "\",\"ImageSmall\":\"" + ImageSmall + "\"}");
                return;
            }
            msg = Language.Tag("没有选择任何文件", "");
            Response.Write("{\"msg\":\"" + msg + "\"}");
        }
示例#47
0
        public static string GetLanguageCode(Language language)
        {
            switch (language)
            {
            case Language.Unspecified:
                return(null);

            case Language.English:
                return("en");

            case Language.French:
                return("fr");

            case Language.German:
                return("de");

            case Language.Spanish:
                return("es");

            case Language.Danish:
                return("da");

            case Language.Dutch:
                return("nl");

            case Language.Finnish:
                return("fi");

            case Language.Italian:
                return("it");

            case Language.Norwegian:
                return("no");

            case Language.Portuguese:
                return("pt");

            case Language.Swedish:
                return("sv");

            case Language.Serbian:
                return("sr");

            case Language.Slovene:
                return("sl");

            case Language.Romanian:
                return("ro");

            case Language.Hungarian:
                return("hu");

            case Language.Estonian:
                return("et");

            case Language.Bulgarian:
                return("bg");

            case Language.Czech:
                return("cs");

            case Language.Russian:
                return("ru");

            case Language.Greek:
                return("el");

            case Language.Lithuanian:
                return("lt");

            case Language.Latvian:
                return("lv");

            case Language.Maltese:
                return("mt");

            case Language.Polish:
                return("pl");

            case Language.Slovak:
                return("sk");

            case Language.Turkish:
                return("tr");

            case Language.Vietnamese:
                return("vi");

            case Language.Icelandic:
                return("is");

            default:
                throw new ArgumentNotSupportedException("language");     // should not happen
            }
        }
示例#48
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataWindowViewModel"/> class.
        /// </summary>
        /// <param name="language">The language.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="language"/> is <c>null</c>.</exception>
        public DataWindowViewModel(Language language)
        {
            Argument.IsNotNull("language", language);

            Language = language;
        }
示例#49
0
 public override void Decompile(Language language, ITextOutput output, DecompilationOptions options)
 {
 }
示例#50
0
        public static void GetLanguageTools(Language language, out Set <string> .ReadOnly stopWords, out IStemmer stemmer)
        {
            switch (language)
            {
            case Language.Bulgarian:
                stopWords = StopWords.BulgarianStopWords;
                stemmer   = new Lemmatizer(language);
                break;

            case Language.Czech:
                stopWords = StopWords.CzechStopWords;
                stemmer   = new Lemmatizer(language);
                break;

            case Language.Danish:
                stopWords = StopWords.DanishStopWords;
                stemmer   = new Stemmer(language);
                break;

            case Language.Dutch:
                stopWords = StopWords.DutchStopWords;
                stemmer   = new Stemmer(language);
                break;

            case Language.English:
                stopWords = StopWords.EnglishStopWords;
                stemmer   = new Stemmer(language);
                break;

            case Language.Estonian:
                stopWords = null;     // *** stop words are missing
                stemmer   = new Lemmatizer(language);
                break;

            case Language.Finnish:
                stopWords = StopWords.FinnishStopWords;
                stemmer   = new Stemmer(language);
                break;

            case Language.French:
                stopWords = StopWords.FrenchStopWords;
                stemmer   = new Stemmer(language);
                break;

            case Language.German:
                stopWords = StopWords.GermanStopWords;
                stemmer   = new Stemmer(language);
                break;

            case Language.Hungarian:
                stopWords = StopWords.HungarianStopWords;
                stemmer   = new Lemmatizer(language);
                break;

            case Language.Italian:
                stopWords = StopWords.ItalianStopWords;
                stemmer   = new Stemmer(language);
                break;

            case Language.Norwegian:
                stopWords = StopWords.NorwegianStopWords;
                stemmer   = new Stemmer(language);
                break;

            case Language.Portuguese:
                stopWords = StopWords.PortugueseStopWords;
                stemmer   = new Stemmer(language);
                break;

            case Language.Romanian:
                stopWords = StopWords.RomanianStopWords;
                stemmer   = new Lemmatizer(language);
                break;

            case Language.Russian:
                stopWords = StopWords.RussianStopWords;
                stemmer   = new Stemmer(language);
                break;

            case Language.Serbian:
                stopWords = StopWords.SerbianStopWordsLatin;
                stemmer   = new Lemmatizer(language);
                break;

            case Language.Slovene:
                stopWords = StopWords.SloveneStopWords;
                stemmer   = new Lemmatizer(language);
                break;

            case Language.Spanish:
                stopWords = StopWords.SpanishStopWords;
                stemmer   = new Stemmer(language);
                break;

            case Language.Swedish:
                stopWords = StopWords.SwedishStopWords;
                stemmer   = new Stemmer(language);
                break;

            default:
                throw new ArgumentNotSupportedException("language");
            }
        }