コード例 #1
0
        private bool TryGetLangPackFromFile(IFile file, out ILocalizationModel locModel)
        {
            if (file == null)
            {
                locModel = null;
                return(false);
            }

            try
            {
                JObject srcObject = ReadJObjectFromIFile(file);
                locModel = SimpleConfigModel.LocalizationFromJObject(srcObject);
                return(true);
            }
            catch (Exception ex)
            {
                ITemplateEngineHost host = file.MountPoint.EnvironmentSettings.Host;
                host.LogMessage($"Error reading Langpack from file: {file.FullPath} | Error = {ex.ToString()}");
            }

            locModel = null;
            return(false);
        }
コード例 #2
0
ファイル: DualPanelShopping.cs プロジェクト: yakoder/NRaas
 public DualPanelShopping(List <ObjectPicker.RowInfo> items, string preLocalizedSelectedSims, string preLocalizedUnselectedSims, float multiplyer)
     : base("DualPaneSimPicker", 1, true, ModalDialog.PauseMode.PauseSimulator, null)
 {
     mMultiplyer = multiplyer;
     if (this.mModalDialogWindow != null)
     {
         ILocalizationModel arg_2A_0 = Responder.Instance.LocalizationModel;
         this.mSims               = items;
         this.mSelectedSims       = new List <ObjectPicker.RowInfo>();
         this.mDisableSourceWin   = (this.mModalDialogWindow.GetChildByID(99576793u, true) as Window);
         this.mOkayButton         = (this.mModalDialogWindow.GetChildByID(99576785u, true) as Button);
         this.mOkayButton.Click  += new UIEventHandler <UIButtonClickEventArgs>(this.OnOkayButtonClick);
         this.mCloseButton        = (this.mModalDialogWindow.GetChildByID(99576786u, true) as Button);
         this.mCloseButton.Click += new UIEventHandler <UIButtonClickEventArgs>(this.OnCloseButtonClick);
         this.mLeftArrow          = (this.mModalDialogWindow.GetChildByID(99576788u, true) as Button);
         this.mLeftArrow.Click   += new UIEventHandler <UIButtonClickEventArgs>(this.OnArrowClick);
         this.mRightArrow         = (this.mModalDialogWindow.GetChildByID(99576789u, true) as Button);
         this.mRightArrow.Click  += new UIEventHandler <UIButtonClickEventArgs>(this.OnArrowClick);
         this.mSelectedTable      = (this.mModalDialogWindow.GetChildByID(99576784u, true) as TableContainer);
         this.mSelectedTable.ItemDoubleClicked += new TableContainer.ItemGridItemClickedEventHandler(this.OnGridDoubleClicked);
         this.mSelectedTable.SelectionChanged  += new UIEventHandler <UISelectionChangeEventArgs>(this.OnSelectionChanged);
         this.mSourceTable = (this.mModalDialogWindow.GetChildByID(99576787u, true) as TableContainer);
         this.mSourceTable.ItemDoubleClicked += new TableContainer.ItemGridItemClickedEventHandler(this.OnGridDoubleClicked);
         this.mSourceTable.SelectionChanged  += new UIEventHandler <UISelectionChangeEventArgs>(this.OnSelectionChanged);
         Text text = this.mModalDialogWindow.GetChildByID(239714080u, true) as Text;
         text.Caption = preLocalizedSelectedSims;
         Text text2 = this.mModalDialogWindow.GetChildByID(239714016u, true) as Text;
         text2.Caption = preLocalizedUnselectedSims;
         this.mModalDialogWindow.CenterInParent();
         this.mSourceTable.Flush();
         this.mSelectedTable.Flush();
         this.RepopulateSourceTable();
         this.RepopulateSelectedSimTable();
         this.mModalDialogWindow.Visible = true;
         base.SelectedID = 99576785u;
     }
 }
コード例 #3
0
ファイル: WorldData.cs プロジェクト: yakoder/NRaas
        private static bool GetWorldFileDetails(ref WorldFileMetadata info)
        {
            string mWorldFile = info.mWorldFile;

            if (!mWorldFile.ToLower().EndsWith(".world"))
            {
                mWorldFile = mWorldFile + ".world";
            }

            info.mDescription = null;
            info.mWorldThumb  = null;
            info.mLotCount    = 0x0;

            WorldName worldName    = WorldName.Undefined;
            ulong     worldNameKey = 0x0L;

            string entryKey = UIManager.GetWorldMetadata(mWorldFile, ref info.mLotCount, ref info.mWorldThumb, ref worldNameKey, ref info.mWorldType, ref worldName);

            if (!GameUtils.WorldNameToType.ContainsKey(worldName))
            {
                GameUtils.WorldNameToType.Add(worldName, info.mWorldType);
            }

            ILocalizationModel localizationModel = Sims3.Gameplay.UI.Responder.Instance.LocalizationModel;

            if (entryKey != null)
            {
                if (localizationModel.HasLocalizationString(entryKey))
                {
                    info.mDescription = localizationModel.LocalizeString(entryKey, new object[0x0]);
                }
                else
                {
                    info.mDescription = entryKey;
                }
            }

            if ((worldNameKey != 0x0L) && localizationModel.HasLocalizationString(worldNameKey))
            {
                info.mCaption = localizationModel.LocalizeString(worldNameKey);
            }

            if (string.IsNullOrEmpty(info.mCaption))
            {
                BooterLogger.AddTrace("Untranslated " + mWorldFile + ": " + worldNameKey);

                if (mWorldFile.ToLower().EndsWith(".world"))
                {
                    int num2 = mWorldFile.LastIndexOfAny(new char[] { '\\', '/' });
                    info.mCaption = ((num2 >= 0x0) && (mWorldFile.Length > 0x0)) ? mWorldFile.Substring(num2 + 0x1) : mWorldFile.Substring(0x0, mWorldFile.Length - 0x6);
                }
                else
                {
                    info.mCaption = mWorldFile;
                }
            }

            if (info.mDescription == null)
            {
                info.mDescription = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce pulvinar. Donec faucibus, dolor eu porta lobortis ante nibh vulputate justo, velvolutpat odio sapien venenatis justo. Quisque sit amet felis acelit imperdiet hendrerit. Nam ut mauris et nisi varius portitor. Fusce blandit, diam id varius portitor, sem elit bibendum dolor, congue molestie sapien lorem vel dolor. Fusce laoreet est non urna euismod commodo. Donec enim quam, blandit at, placerat in, eleifend vitae, justo. Suspendisse potenti. In blandit pede sit amet sem. Nam condimentum sapien sit amet erat.";
            }

            if (info.mWorldThumb == null)
            {
                info.mWorldThumb = UIManager.LoadUIImage(ResourceKey.CreatePNGKey("game_entry_town_placeholder", 0x0));
            }
            return(true);
        }
コード例 #4
0
        public IList <ITemplate> GetTemplatesAndLangpacksFromDir(IMountPoint source, out IList <ILocalizationLocator> localizations)
        {
            _ = source ?? throw new ArgumentNullException(nameof(source));

            ILogger logger = source.EnvironmentSettings.Host.LoggerFactory.CreateLogger <RunnableProjectGenerator>();

            IDirectory        folder       = source.Root;
            IList <ITemplate> templateList = new List <ITemplate>();

            localizations = new List <ILocalizationLocator>();

            foreach (IFile file in folder.EnumerateFiles(TemplateConfigFileName, SearchOption.AllDirectories))
            {
                logger.LogDebug($"Found {TemplateConfigFileName} at {file.GetDisplayPath()}.");
                try
                {
                    IFile?hostConfigFile = FindBestHostTemplateConfigFile(source.EnvironmentSettings, file);
                    logger.LogDebug($"Found *{HostTemplateFileConfigBaseName} at {hostConfigFile?.GetDisplayPath()}.");

                    // issue here: we need to pass locale as parameter
                    // consider passing current locale file here if exists
                    // tracking issue: https://github.com/dotnet/templating/issues/3255
                    var templateConfiguration = new RunnableProjectConfig(source.EnvironmentSettings, this, file, hostConfigFile);

                    IDirectory?localizeFolder = file.Parent?.DirectoryInfo("localize");
                    if (localizeFolder != null && localizeFolder.Exists)
                    {
                        foreach (IFile locFile in localizeFolder.EnumerateFiles(LocalizationFilePrefix + "*" + LocalizationFileExtension, SearchOption.AllDirectories))
                        {
                            string locale = locFile.Name.Substring(LocalizationFilePrefix.Length, locFile.Name.Length - LocalizationFilePrefix.Length - LocalizationFileExtension.Length);

                            try
                            {
                                ILocalizationModel locModel = LocalizationModelDeserializer.Deserialize(locFile);
                                if (templateConfiguration.VerifyLocalizationModel(locModel, locFile))
                                {
                                    localizations.Add(new LocalizationLocator(
                                                          locale,
                                                          locFile.FullPath,
                                                          templateConfiguration.Identity,
                                                          locModel.Author ?? string.Empty,
                                                          locModel.Name ?? string.Empty,
                                                          locModel.Description ?? string.Empty,
                                                          locModel.ParameterSymbols));
                                }
                            }
                            catch (Exception ex)
                            {
                                logger.LogWarning(LocalizableStrings.LocalizationModelDeserializer_Error_FailedToParse, locFile.GetDisplayPath());
                                logger.LogDebug("Details: {0}", ex);
                            }
                        }
                    }
                    templateList.Add(templateConfiguration);
                }
                catch (TemplateValidationException)
                {
                    //do nothing
                    //template validation prints all required information
                }
                catch (NotSupportedException ex)
                {
                    //do not print stack trace for this type.
                    logger.LogError(LocalizableStrings.Authoring_TemplateNotInstalled_Message, file.GetDisplayPath(), ex.Message);
                }
                catch (TemplateAuthoringException ex)
                {
                    //do not print stack trace for this type.
                    logger.LogError(LocalizableStrings.Authoring_TemplateNotInstalled_Message, file.GetDisplayPath(), ex.Message);
                }
                catch (Exception ex)
                {
                    //unexpected error - print details
                    logger.LogError(LocalizableStrings.Authoring_TemplateNotInstalled_Message, file.GetDisplayPath(), ex);
                }
            }

            return(templateList);
        }
コード例 #5
0
ファイル: EditTownControllerEx.cs プロジェクト: yakoder/NRaas
        public static void ChangeLotTypeTask(object obj)
        {
            try
            {
                EditTownController ths = EditTownController.Instance;

                UIBinInfo info = obj as UIBinInfo;
                if ((info != null) && (info.LotId != ulong.MaxValue))
                {
                    ths.mModel.SetCurrentSelection(null, InfoSource.Unknown);
                    ILocalizationModel    localizationModel     = Sims3.UI.Responder.Instance.LocalizationModel;
                    LotType               lotType               = info.LotType;
                    CommercialLotSubType  commercialLotSubType  = info.CommercialLotSubType;
                    ResidentialLotSubType residentialLotSubType = info.ResidentialLotSubType;
                    string lotTypeName = "";

                    if (ChangeLotTypeDialogEx.Show(ref lotType, ref commercialLotSubType, ref residentialLotSubType, ref lotTypeName, info.IsHouseboatLot))
                    {
                        if (((lotType == LotType.Commercial) && (commercialLotSubType == CommercialLotSubType.kEP1_BaseCamp)) && ths.mModel.IsAnyLotBaseCamp())
                        {
                            string titleText   = Common.LocalizeEAString("Ui/Caption/Global:Failed");
                            string messageText = Common.LocalizeEAString("Ui/Caption/GameEntry/EditTown/EP01:BaseCampExists");
                            SimpleMessageDialog.Show(titleText, messageText, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
                        }
                        else if (((lotType == LotType.Commercial) && (commercialLotSubType == CommercialLotSubType.kEP11_BaseCampFuture)) && ths.mModel.IsAnyLotBaseCamp())
                        {
                            string str4 = localizationModel.LocalizeString("Ui/Caption/Global:Failed", new object[0]);
                            string str5 = localizationModel.LocalizeString("Ui/Caption/GameEntry/EditTown/EP11:BaseCampFutureExists", new object[0]);
                            SimpleMessageDialog.Show(str4, str5, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
                        }
                        else if (EditTownModelEx.ChangeLotType(info.LotId, false, lotType, commercialLotSubType, residentialLotSubType))
                        {
                            EditTownController.AlertLotTypeChangeSuccess(info, localizationModel, lotType, lotTypeName);
                        }
                        else
                        {
                            string promptText = string.Empty;
                            if (commercialLotSubType == CommercialLotSubType.kEP10_Resort)
                            {
                                promptText = localizationModel.LocalizeString("Ui/Caption/GameEntry/EditTown:LotTypeResortFailed", new object[] { info.LotAddress });
                            }
                            else
                            {
                                promptText = localizationModel.LocalizeString((lotType == LotType.Commercial) ? "Ui/Caption/GameEntry/EditTown:LotTypeCommunityFailed" : "Ui/Caption/GameEntry/EditTown:LotTypeResidentialFailed", new object[] { info.LotAddress });
                            }

                            if (AcceptCancelDialog.Show(promptText))
                            {
                                if (EditTownModelEx.ChangeLotType(info.LotId, true, lotType, commercialLotSubType, residentialLotSubType))
                                {
                                    EditTownController.AlertLotTypeChangeSuccess(info, localizationModel, lotType, lotTypeName);
                                    EditTownMaptagController.Instance.ResetMaptags();
                                }
                                else
                                {
                                    string str5 = Common.LocalizeEAString("Ui/Caption/Global:Failed");
                                    promptText = Common.LocalizeEAString("Ui/Caption/GameEntry/EditTown:LotTypeChangeFailed");
                                    SimpleMessageDialog.Show(str5, promptText, ModalDialog.PauseMode.PauseSimulator, new Vector2(-1f, -1f), "ui_error", "ui_hardwindow_close");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Common.Exception("ChangeLotTypeTask", e);
            }
        }
コード例 #6
0
        public static SimpleConfigModel FromJObject(JObject source, JObject localeSource = null)
        {
            ILocalizationModel localizationModel = LocalizationFromJObject(localeSource);

            SimpleConfigModel config = new SimpleConfigModel();

            config.Author              = localizationModel?.Author ?? source.ToString(nameof(config.Author));
            config.Classifications     = source.ArrayAsStrings(nameof(config.Classifications));
            config.DefaultName         = source.ToString(nameof(DefaultName));
            config.Description         = localizationModel?.Description ?? source.ToString(nameof(Description));
            config.GroupIdentity       = source.ToString(nameof(GroupIdentity));
            config.Guids               = source.ArrayAsGuids(nameof(config.Guids));
            config.Identity            = source.ToString(nameof(config.Identity));
            config.Name                = localizationModel?.Name ?? source.ToString(nameof(config.Name));
            config.ShortName           = source.ToString(nameof(config.ShortName));
            config.SourceName          = source.ToString(nameof(config.SourceName));
            config.PlaceholderFilename = source.ToString(nameof(config.PlaceholderFilename));

            List <ExtendedFileSource> sources = new List <ExtendedFileSource>();

            config.Sources = sources;

            foreach (JObject item in source.Items <JObject>(nameof(config.Sources)))
            {
                ExtendedFileSource src = new ExtendedFileSource();
                sources.Add(src);
                src.CopyOnly  = item.Get <JToken>(nameof(src.CopyOnly));
                src.Exclude   = item.Get <JToken>(nameof(src.Exclude));
                src.Include   = item.Get <JToken>(nameof(src.Include));
                src.Condition = item.ToString(nameof(src.Condition));

                List <SourceModifier> modifiers = new List <SourceModifier>();
                src.Modifiers = modifiers;
                foreach (JObject entry in item.Items <JObject>(nameof(src.Modifiers)))
                {
                    SourceModifier modifier = new SourceModifier();
                    modifier.Condition = entry.ToString(nameof(modifier.Condition));
                    modifier.CopyOnly  = entry.Get <JToken>(nameof(modifier.CopyOnly));
                    modifier.Exclude   = entry.Get <JToken>(nameof(modifier.Exclude));
                    modifier.Include   = entry.Get <JToken>(nameof(modifier.Include));
                    modifiers.Add(modifier);
                }

                src.Source = item.ToString(nameof(src.Source));
                src.Target = item.ToString(nameof(src.Target));
            }

            Dictionary <string, ISymbolModel> symbols = new Dictionary <string, ISymbolModel>(StringComparer.Ordinal);

            config.Symbols = symbols;
            foreach (JProperty prop in source.PropertiesOf(nameof(config.Symbols)))
            {
                JObject obj = prop.Value as JObject;

                if (obj == null)
                {
                    continue;
                }

                string localizedDescription = null;
                if (localizationModel != null)
                {
                    localizationModel.SymbolDescriptions.TryGetValue(prop.Name, out localizedDescription);
                }

                ISymbolModel model = SymbolModelConverter.GetModelForObject(obj, localizedDescription);

                if (model != null)
                {
                    symbols[prop.Name] = model;
                }
            }

            config.Tags            = source.ToStringDictionary(StringComparer.OrdinalIgnoreCase, nameof(config.Tags));
            config.PostActionModel = RunnableProjects.PostActionModel.ListFromJArray((JArray)source["PostActions"], localizationModel?.PostActions);

            config.PrimaryOutputs = CreationPathModel.ListFromJArray((JArray)source["PrimaryOutputs"]);

            // Custom operations at the global level
            JToken globalCustomConfigData = source[nameof(config.CustomOperations)];

            if (globalCustomConfigData != null)
            {
                config.CustomOperations = CustomFileGlobModel.FromJObject((JObject)globalCustomConfigData, string.Empty);
            }
            else
            {
                config.CustomOperations = null;
            }

            // Custom operations for specials
            IReadOnlyDictionary <string, JToken> allSpecialOpsConfig = source.ToJTokenDictionary(StringComparer.OrdinalIgnoreCase, "SpecialCustomOperations");
            List <ICustomFileGlobModel>          specialCustomSetup  = new List <ICustomFileGlobModel>();

            foreach (KeyValuePair <string, JToken> globConfigKeyValue in allSpecialOpsConfig)
            {
                string globName = globConfigKeyValue.Key;
                JToken globData = globConfigKeyValue.Value;

                CustomFileGlobModel globModel = CustomFileGlobModel.FromJObject((JObject)globData, globName);
                specialCustomSetup.Add(globModel);
            }

            config.SpecialCustomSetup = specialCustomSetup;

            // localization operations for individual files
            Dictionary <string, IReadOnlyList <IOperationProvider> > localizations = new Dictionary <string, IReadOnlyList <IOperationProvider> >();

            if (localizationModel != null && localizationModel.FileLocalizations != null)
            {
                foreach (FileLocalizationModel fileLocalization in localizationModel.FileLocalizations)
                {
                    List <IOperationProvider> localizationsForFile = new List <IOperationProvider>();
                    foreach (KeyValuePair <string, string> localizationInfo in fileLocalization.Localizations)
                    {
                        localizationsForFile.Add(new Replacement(localizationInfo.Key, localizationInfo.Value, null));
                    }

                    localizations.Add(fileLocalization.File, localizationsForFile);
                }
            }
            config.LocalizationOperations = localizations;

            return(config);
        }
コード例 #7
0
        public static SimpleConfigModel FromJObject(IEngineEnvironmentSettings environmentSettings, JObject source, JObject localeSource = null)
        {
            ILocalizationModel localizationModel = LocalizationFromJObject(localeSource);

            SimpleConfigModel config = new SimpleConfigModel()
            {
                Author              = localizationModel?.Author ?? source.ToString(nameof(config.Author)),
                Classifications     = source.ArrayAsStrings(nameof(config.Classifications)),
                DefaultName         = source.ToString(nameof(DefaultName)),
                Description         = localizationModel?.Description ?? source.ToString(nameof(Description)) ?? string.Empty,
                GroupIdentity       = source.ToString(nameof(GroupIdentity)),
                Guids               = source.ArrayAsGuids(nameof(config.Guids)),
                Identity            = source.ToString(nameof(config.Identity)),
                Name                = localizationModel?.Name ?? source.ToString(nameof(config.Name)),
                ShortName           = source.ToString(nameof(config.ShortName)),
                SourceName          = source.ToString(nameof(config.SourceName)),
                PlaceholderFilename = source.ToString(nameof(config.PlaceholderFilename)),
                EnvironmentSettings = environmentSettings
            };

            List <ExtendedFileSource> sources = new List <ExtendedFileSource>();

            config.Sources = sources;

            foreach (JObject item in source.Items <JObject>(nameof(config.Sources)))
            {
                ExtendedFileSource src = new ExtendedFileSource();
                sources.Add(src);
                src.CopyOnly  = item.Get <JToken>(nameof(src.CopyOnly));
                src.Exclude   = item.Get <JToken>(nameof(src.Exclude));
                src.Include   = item.Get <JToken>(nameof(src.Include));
                src.Condition = item.ToString(nameof(src.Condition));

                List <SourceModifier> modifiers = new List <SourceModifier>();
                src.Modifiers = modifiers;
                foreach (JObject entry in item.Items <JObject>(nameof(src.Modifiers)))
                {
                    SourceModifier modifier = new SourceModifier
                    {
                        Condition = entry.ToString(nameof(modifier.Condition)),
                        CopyOnly  = entry.Get <JToken>(nameof(modifier.CopyOnly)),
                        Exclude   = entry.Get <JToken>(nameof(modifier.Exclude)),
                        Include   = entry.Get <JToken>(nameof(modifier.Include)),
                        Rename    = entry.Get <JObject>(nameof(modifier.Rename))
                    };
                    modifiers.Add(modifier);
                }

                src.Source = item.ToString(nameof(src.Source));
                src.Target = item.ToString(nameof(src.Target));
            }

            Dictionary <string, ISymbolModel> symbols = new Dictionary <string, ISymbolModel>(StringComparer.Ordinal);

            // tags are being deprecated from template configuration, but we still read them for backwards compatibility.
            // They're turned into symbols here, which eventually become tags.
            config._tagsDeprecated = source.ToStringDictionary(StringComparer.OrdinalIgnoreCase, nameof(config.Tags));
            IReadOnlyDictionary <string, ISymbolModel> symbolsFromTags = ConvertDeprecatedTagsToParameterSymbols(config._tagsDeprecated);

            foreach (KeyValuePair <string, ISymbolModel> tagSymbol in symbolsFromTags)
            {
                if (!symbols.ContainsKey(tagSymbol.Key))
                {
                    symbols.Add(tagSymbol.Key, tagSymbol.Value);
                }
            }

            config.Symbols = symbols;
            foreach (JProperty prop in source.PropertiesOf(nameof(config.Symbols)))
            {
                JObject obj = prop.Value as JObject;

                if (obj == null)
                {
                    continue;
                }

                IParameterSymbolLocalizationModel symbolLocalization = null;
                if (localizationModel != null)
                {
                    localizationModel.ParameterSymbols.TryGetValue(prop.Name, out symbolLocalization);
                }

                ISymbolModel model = SymbolModelConverter.GetModelForObject(obj, symbolLocalization);

                if (model != null)
                {
                    symbols[prop.Name] = model;
                }
            }

            config.PostActionModel = RunnableProjects.PostActionModel.ListFromJArray(source.Get <JArray>("PostActions"), localizationModel?.PostActions);
            config.PrimaryOutputs  = CreationPathModel.ListFromJArray(source.Get <JArray>(nameof(PrimaryOutputs)));

            // Custom operations at the global level
            JToken globalCustomConfigData = source[nameof(config.CustomOperations)];

            if (globalCustomConfigData != null)
            {
                config.CustomOperations = CustomFileGlobModel.FromJObject((JObject)globalCustomConfigData, string.Empty);
            }
            else
            {
                config.CustomOperations = null;
            }

            // Custom operations for specials
            IReadOnlyDictionary <string, JToken> allSpecialOpsConfig = source.ToJTokenDictionary(StringComparer.OrdinalIgnoreCase, "SpecialCustomOperations");
            List <ICustomFileGlobModel>          specialCustomSetup  = new List <ICustomFileGlobModel>();

            foreach (KeyValuePair <string, JToken> globConfigKeyValue in allSpecialOpsConfig)
            {
                string globName = globConfigKeyValue.Key;
                JToken globData = globConfigKeyValue.Value;

                CustomFileGlobModel globModel = CustomFileGlobModel.FromJObject((JObject)globData, globName);
                specialCustomSetup.Add(globModel);
            }

            config.SpecialCustomSetup = specialCustomSetup;

            // localization operations for individual files
            Dictionary <string, IReadOnlyList <IOperationProvider> > localizations = new Dictionary <string, IReadOnlyList <IOperationProvider> >();

            if (localizationModel != null && localizationModel.FileLocalizations != null)
            {
                foreach (FileLocalizationModel fileLocalization in localizationModel.FileLocalizations)
                {
                    List <IOperationProvider> localizationsForFile = new List <IOperationProvider>();
                    foreach (KeyValuePair <string, string> localizationInfo in fileLocalization.Localizations)
                    {
                        localizationsForFile.Add(new Replacement(localizationInfo.Key, localizationInfo.Value, null));
                    }

                    localizations.Add(fileLocalization.File, localizationsForFile);
                }
            }
            config.LocalizationOperations = localizations;

            return(config);
        }
コード例 #8
0
        public EnrollmentDialogEx(SimDescription simDesc, IEnumerable <SimDescription> choices, bool infiniteFunds)
            : base(simDesc)
        {
            if (infiniteFunds)
            {
                mHouseholdFunds      = 1000000;
                mStartHouseholdFunds = 1000000;
            }

            if (mModalDialogWindow != null)
            {
                mLeftArrow.Click  -= OnArrowClick;
                mLeftArrow.Click  += OnArrowClickEx;
                mRightArrow.Click -= OnArrowClick;
                mRightArrow.Click += OnArrowClickEx;
                mSelectedTable.ItemDoubleClicked  -= OnGridDoubleClicked;
                mSelectedTable.ItemDoubleClicked  += OnGridDoubleClickedEx;
                mSourceTable.ItemDoubleClicked    -= OnGridDoubleClicked;
                mSourceTable.ItemDoubleClicked    += OnGridDoubleClickedEx;
                mSelectedTable.SelectionChanged   -= OnSelectionChanged;
                mSelectedTable.SelectionChanged   += OnSelectionChangedEx;
                mDegreeCombo.SelectionChange      -= OnDegreeChange;
                mDegreeCombo.SelectionChange      += OnDegreeChangeEx;
                mCourseLoadSldr.SliderValueChange -= OnCourseLoadSliderChanged;
                mCourseLoadSldr.SliderValueChange += OnCourseLoadSliderChangedEx;

                ILocalizationModel localizationModel = Responder.Instance.LocalizationModel;
                mCurrentActor = simDesc;
                mSims         = new List <PhoneSimPicker.SimPickerInfo>();
                mSelectedSims = new List <PhoneSimPicker.SimPickerInfo>();

                foreach (SimDescription description in choices)
                {
                    if (description.OccupationAsAcademicCareer != null)
                    {
                        continue;
                    }

                    PhoneSimPicker.SimPickerInfo item = CreateSimPickerInfo(simDesc, description);
                    mSims.Add(item);
                    if (description == simDesc)
                    {
                        mSelectedSims.Add(item);
                    }
                }

                mDegreeCombo.ValueList.Clear();

                List <AcademicDegreeStaticData> list = new List <AcademicDegreeStaticData>(AcademicDegreeManager.sDictionary.Values);
                list.Sort(OnSortByName);

                foreach (AcademicDegreeStaticData data in list)
                {
                    mDegreeCombo.ValueList.Add(data.DegreeName, data);
                }

                mSourceTable.Flush();
                mSelectedTable.Flush();
                RepopulateSourceTable();
                RepopulateSelectedSimTable();
                mSelectedTable.SelectedItem = 0;
                OnSelectionChangedEx(mSelectedTable, null);
                StartEnrollmentMusic();
            }
        }