Inheritance: MonoBehaviour
Example #1
0
 public static LocalizedString DisplayFilter(string fieldName, dynamic formState, Localizer T) {
     var op = (Orchard.Projections.FilterEditors.Forms.StringOperator) Enum.Parse(typeof (Orchard.Projections.FilterEditors.Forms.StringOperator), Convert.ToString(formState.Operator));
     string value = Convert.ToString(formState.Value);
     fieldName = fieldName.Split('.')[1];
     switch (op) {
         case Orchard.Projections.FilterEditors.Forms.StringOperator.Equals:
             return T("{0} is equal to '{1}'", fieldName, value);
         case Orchard.Projections.FilterEditors.Forms.StringOperator.NotEquals:
             return T("{0} is not equal to '{1}'", fieldName, value);
         case Orchard.Projections.FilterEditors.Forms.StringOperator.Contains:
             return T("{0} contains '{1}'", fieldName, value);
         case Orchard.Projections.FilterEditors.Forms.StringOperator.ContainsAny:
             return T("{0} contains any of '{1}'", fieldName, new LocalizedString(String.Join("', '", value.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries))));
         case Orchard.Projections.FilterEditors.Forms.StringOperator.ContainsAll:
             return T("{0} contains all '{1}'", fieldName, new LocalizedString(String.Join("', '", value.Split(new[] {' '}, StringSplitOptions.RemoveEmptyEntries))));
         case Orchard.Projections.FilterEditors.Forms.StringOperator.Starts:
             return T("{0} starts with '{1}'", fieldName, value);
         case Orchard.Projections.FilterEditors.Forms.StringOperator.NotStarts:
             return T("{0} does not start with '{1}'", fieldName, value);
         case Orchard.Projections.FilterEditors.Forms.StringOperator.Ends:
             return T("{0} ends with '{1}'", fieldName, value);
         case Orchard.Projections.FilterEditors.Forms.StringOperator.NotEnds:
             return T("{0} does not end with '{1}'", fieldName, value);
         case Orchard.Projections.FilterEditors.Forms.StringOperator.NotContains:
             return T("{0} does not contain '{1}'", fieldName, value);
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Example #2
0
 public ContentTypesFilterForms(
     IShapeFactory shapeFactory,
     IContentDefinitionManager contentDefinitionManager) {
     _contentDefinitionManager = contentDefinitionManager;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
Example #3
0
        public ResourceFileService(
            IVirtualPathProvider virtualPathProvider)
        {
            _virtualPathProvider = virtualPathProvider;

            T = NullLocalizer.Instance;
        }
        public LocalizedRegularExpressionAttribute(RegularExpressionAttribute attribute, Localizer t)
            : base(attribute.Pattern) {
            if ( !String.IsNullOrEmpty(attribute.ErrorMessage) )
                ErrorMessage = attribute.ErrorMessage;

            T = t;
        }
Example #5
0
 public TermsFilterForms(
     IShapeFactory shapeFactory,
     IOptionSetService optionSetService) {
     _optionSetService = optionSetService;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
		[Test] public void CascadedTemplate ()
		{
			Localizer loc = new Localizer(null);
			loc.Add("Plural", "{1}s");
			loc.Add("Report2", "Report {Plural'1}/{Plural'2}");
			Assert.AreEqual("Report Scopes/Storys", loc.Resolve("Report2'Scope'Story"));
		}
        public WinXinRespForms(IShapeFactory shapeFactory, IContentManager contentManager)
        {
            Shape = shapeFactory;
            T = NullLocalizer.Instance;

            _contentManager = contentManager;
        }
Example #8
0
 public static LocalizedString DisplayFilter(string fieldName, dynamic formState, Localizer T) {
     bool value = Convert.ToBoolean(formState.Value);
     fieldName = fieldName.Split('.')[1];
     return value
         ? T("{0} is true", fieldName)
         : T("{0} is false", fieldName);
 }
		public OptionAdminController(IOrchardServices services, IPollService pollService) {
			_services = services;
			_pollService = pollService;
			_notifier = _services.Notifier;
			New = _services.New;
			T = NullLocalizer.Instance;
		}
Example #10
0
 public RelationshipController(
     IRelationshipService relationshipService,
     IRepository<RelationshipRecord> relationshipRepository) {
     _relationshipService = relationshipService;
     _relationshipRepository = relationshipRepository;
     T = NullLocalizer.Instance;
 }
 public CheckoutController(IWebStoreServices webStoreServices, IOrchardServices orchardServices, IShapeFactory shapeFactory)
 {
     this._localizer = NullLocalizer.Instance;
     this._webStoreServices = webStoreServices;
     this._orchardServices = orchardServices;
     this._shapeFactory = shapeFactory;
 }
        public static LocalizedString DisplayFilter(string fieldName, dynamic formState, Localizer T)
        {
            var op = (NumericOperator)Enum.Parse(typeof(NumericOperator), Convert.ToString(formState.Operator));
            string value = Convert.ToString(formState.Value);
            string min = Convert.ToString(formState.Min);
            string max = Convert.ToString(formState.Max);

            switch (op) {
                case NumericOperator.LessThan:
                    return T("{0} is less than {1}", fieldName, value);
                case NumericOperator.LessThanEquals:
                    return T("{0} is less or equal than {1}", fieldName, value);
                case NumericOperator.Equals:
                    return T("{0} equals {1}", fieldName, value);
                case NumericOperator.NotEquals:
                    return T("{0} is not equal to {1}", fieldName, value);
                case NumericOperator.GreaterThan:
                    return T("{0} is greater than {1}", fieldName, value);
                case NumericOperator.GreaterThanEquals:
                    return T("{0} is greater or equal than {1}", fieldName, value);
                case NumericOperator.Between:
                    return T("{0} is between {1} and {2}", fieldName, min, max);
                case NumericOperator.NotBetween:
                    return T("{0} is not between {1} and {2}", fieldName, min, max);
            }

            // should never be hit, but fail safe
            return new LocalizedString(fieldName);
        }
		public FallbackDictionaryLocalizer(LocalizationDictionary dictionary, params string[] locales) {
		  if(dictionary == null) throw new ArgumentNullException("dictionary");
		  if(locales == null) throw new ArgumentNullException("locales");
      DefaultLocalizer = NullLocalizer.Instance;
      this.dictionary = dictionary;
			this.locales = locales;
		}
Example #14
0
 public TermsFilterForms(
     IShapeFactory shapeFactory,
     ITaxonomyService taxonomyService) {
     _taxonomyService = taxonomyService;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
        public static MvcHtmlString CreateFilteredRequestTable(this HtmlHelper helper, IQueryable<FilteredRequestRecord> filteredRequestRecords, Localizer T)
        {
            StringBuilder sb = new StringBuilder();

            if (filteredRequestRecords == null || !filteredRequestRecords.Any())
            {
                sb.AppendLine(T("No requests are filtered yet.").Text);
            }
            else
            {
                sb.AppendLine("<table><tr>");
                sb.AppendFormat("<th>{0}</th>", T("Request time"));
                sb.AppendFormat("<th>{0}</th>", T("Url"));
                sb.AppendFormat("<th>{0}</th>", T("User Host Address"));
                sb.AppendFormat("<th>{0}</th>", T("User Agent"));
                sb.AppendLine("</tr>");

                foreach (FilteredRequestRecord filteredRequest in filteredRequestRecords.OrderByDescending(r => r.RequestTime))
                {
                    sb.AppendLine("<tr>");
                    sb.AppendFormat("<td>{0}</td>", filteredRequest.RequestTime);
                    sb.AppendFormat("<td>{0}</td>", filteredRequest.Url);
                    sb.AppendFormat("<td>{0}</td>", filteredRequest.UserHostAddress);
                    sb.AppendFormat("<td>{0}</td>", filteredRequest.UserAgent);
                    sb.AppendLine("</tr>");
                }
                sb.AppendLine("</table>");
            }
            return new MvcHtmlString(sb.ToString());
        }
Example #16
0
 public UserTaskForms(
     IShapeFactory shapeFactory,
     IRoleService roleService) {
     _roleService = roleService;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
	void Awake()
	{
		if (instance == null)
			instance = this;
		else if (instance != this)
			Destroy (this.gameObject);
	}
        public NewSubmissionFinalizerController(IOrchardServices orchardServices, IGalleryPackagePublishingService galleryPackagePublishingService, IParameterFormatValidator parameterFormatValidator) {
            _orchardServices = orchardServices;
            _galleryPackagePublishingService = galleryPackagePublishingService;
            _parameterFormatValidator = parameterFormatValidator;

            T = NullLocalizer.Instance;
        }
 public WebShopSettingsPartHandler(IRepository<WebShopSettingsRecord> repository)
 {
     T = NullLocalizer.Instance;
     Filters.Add(new ActivatingFilter<WebShopSettingsPart>("Site"));
     Filters.Add(StorageFilter.For(repository));
     OnGetContentItemMetadata<WebShopSettingsPart>((context, part) => context.Metadata.EditorGroupInfo.Add(new GroupInfo(T("WebShop"))));
 }
 public GalleryScreenshotService(IOrchardServices orchardServices, IUserkeyService userkeyService,
     IAuthenticationService authenticationService) {
     T = NullLocalizer.Instance;
     _orchardServices = orchardServices;
     _userkeyService = userkeyService;
     _authenticationService = authenticationService;
 }
 public ContentPartRecordsForm(
     ShellBlueprint shellBlueprint,
     IShapeFactory shapeFactory) {
     _shellBlueprint = shellBlueprint;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
Example #22
0
        public AdminUserController(
            IRepository<RoleRecord> roleRepository,
            IOrderService orderService,
            ICampaignService campaignService,
            IRepository<CurrencyRecord> currencyRepository,
            IMembershipService membershipService,
            ShellSettings shellSettings,
            IOrchardServices services,
            IUserService userService,
            ISiteService siteService,
            IShapeFactory shapeFactory)
        {
            _roleRepository = roleRepository;
            _orderService = orderService;
            _campaignService = campaignService;
            _currencyRepository = currencyRepository;
            _membershipService = membershipService;
            _shellSettings = shellSettings;
            Services = services;
            _siteService = siteService;
            _userService = userService;

            T = NullLocalizer.Instance;
            Shape = shapeFactory;
        }
 public SelectRolesForms(
     IShapeFactory shapeFactory,
     IRoleService roleService) {
     _roleService = roleService;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
 public EventController(IOrchardServices services, 
     IEventService eventService)
 {
     T = NullLocalizer.Instance;
     _eventService = eventService;
     _services = services;
 }
Example #25
0
 public OrderController(IWebStoreConfigurationService webStoreConfigurationServices, IBasketServices basketServices, IWebStoreProfileServices webstoreProfileServices)
 {
     this.T = NullLocalizer.Instance;
     this._basketServices = basketServices;
     this._webstoreProfileServices = webstoreProfileServices;
     this._webStoreConfigurationServices = webStoreConfigurationServices;
 }
        public AdminController(IOrchardServices orchardService, IDirectoryNavService directoryNavService)
        {
            _orchardServices = orchardService;
            _directoryNavService = directoryNavService;

            T = NullLocalizer.Instance;
        }
Example #27
0
        public PackageIconUploader(IMediaService mediaService, IPackageIconValidator packageIconValidator, IPackageMediaDirectoryHelper packageMediaDirectoryHelper) {
            _mediaService = mediaService;
            _packageMediaDirectoryHelper = packageMediaDirectoryHelper;
            _packageIconValidator = packageIconValidator;

            T = NullLocalizer.Instance;
        }
 public AddressDirectoryService(IOrchardServices services,Lazy<IMechanicsService> mechanics)
 {
     _services = services;
     _mechanics = mechanics;
     Logger = NullLogger.Instance;
     T = NullLocalizer.Instance;
 }
        public LocalizedRangeAttribute(RangeAttribute attribute, Localizer t)
            : base(attribute.OperandType, new FormatterConverter().ToString(attribute.Minimum), new FormatterConverter().ToString(attribute.Maximum)) {
            if ( !String.IsNullOrEmpty(attribute.ErrorMessage) )
                ErrorMessage = attribute.ErrorMessage;

            T = t;
        }
Example #30
0
        static Permissions()
        {
            T = NullLocalizer.Instance;

            AddProduct.Description = T("Place new advertisements.").Text;
            ManageProducts.Description = T("Manage advertisements.").Text;
            ManageProductTypes.Description = T("Manage product categories.").Text;
        }
        public void Should_throw_MissingBlockException()
        {
            var localizer = new Localizer(new CurrentCulture("ru-ru"));

            Assert.Throws <MissingBlockException>(() => localizer.Get("there_is_no_block", "Hello"));
        }
Example #32
0
 public override string GetModuleDisplayName()
 {
     return(Localizer.Format("#LOC_SystemHeat_ModuleSystemHeatExchanger_ModuleName"));
 }
Example #33
0
 public EventValidator(Localizer localizer)
 {
     _localizer = localizer;
 }
Example #34
0
        private void Run(IMessaging messaging)
        {
#if false
            // Initialize the variable resolver from the command line.
            WixVariableResolver wixVariableResolver = new WixVariableResolver();
            foreach (var wixVar in this.commandLine.Variables)
            {
                wixVariableResolver.AddVariable(wixVar.Key, wixVar.Value);
            }

            // Initialize the linker from the command line.
            Linker linker = new Linker();
            linker.UnreferencedSymbolsFile = this.commandLine.UnreferencedSymbolsFile;
            linker.ShowPedanticMessages    = this.commandLine.ShowPedanticMessages;
            linker.WixVariableResolver     = wixVariableResolver;

            foreach (IExtensionData data in this.extensionData)
            {
                linker.AddExtensionData(data);
            }

            // Initialize the binder from the command line.
            WixToolset.Binder binder = new WixToolset.Binder();
            binder.CabCachePath     = this.commandLine.CabCachePath;
            binder.ContentsFile     = this.commandLine.ContentsFile;
            binder.BuiltOutputsFile = this.commandLine.BuiltOutputsFile;
            binder.OutputsFile      = this.commandLine.OutputsFile;
            binder.WixprojectFile   = this.commandLine.WixprojectFile;
            binder.BindPaths.AddRange(this.commandLine.BindPaths);
            binder.CabbingThreadCount = this.commandLine.CabbingThreadCount;
            if (this.commandLine.DefaultCompressionLevel.HasValue)
            {
                binder.DefaultCompressionLevel = this.commandLine.DefaultCompressionLevel.Value;
            }
            binder.Ices.AddRange(this.commandLine.Ices);
            binder.SuppressIces.AddRange(this.commandLine.SuppressIces);
            binder.SuppressAclReset    = this.commandLine.SuppressAclReset;
            binder.SuppressLayout      = this.commandLine.SuppressLayout;
            binder.SuppressValidation  = this.commandLine.SuppressValidation;
            binder.PdbFile             = this.commandLine.SuppressWixPdb ? null : this.commandLine.PdbFile;
            binder.TempFilesLocation   = AppCommon.GetTempLocation();
            binder.WixVariableResolver = wixVariableResolver;

            foreach (IBinderExtension extension in this.binderExtensions)
            {
                binder.AddExtension(extension);
            }

            foreach (IBinderFileManager fileManager in this.fileManagers)
            {
                binder.AddExtension(fileManager);
            }

            // Initialize the localizer.
            Localizer localizer = this.InitializeLocalization(linker.TableDefinitions);
            if (messaging.EncounteredError)
            {
                return;
            }

            wixVariableResolver.Localizer = localizer;
            linker.Localizer = localizer;
            binder.Localizer = localizer;

            // Loop through all the believed object files.
            List <Section> sections = new List <Section>();
            Output         output   = null;
            foreach (string inputFile in this.commandLine.Files)
            {
                string     inputFileFullPath = Path.GetFullPath(inputFile);
                FileFormat format            = FileStructure.GuessFileFormatFromExtension(Path.GetExtension(inputFileFullPath));
                bool       retry;
                do
                {
                    retry = false;

                    try
                    {
                        switch (format)
                        {
                        case FileFormat.Wixobj:
                            Intermediate intermediate = Intermediate.Load(inputFileFullPath, linker.TableDefinitions, this.commandLine.SuppressVersionCheck);
                            sections.AddRange(intermediate.Sections);
                            break;

                        case FileFormat.Wixlib:
                            Library library = Library.Load(inputFileFullPath, linker.TableDefinitions, this.commandLine.SuppressVersionCheck);
                            AddLibraryLocalizationsToLocalizer(library, this.commandLine.Cultures, localizer);
                            sections.AddRange(library.Sections);
                            break;

                        default:
                            output = Output.Load(inputFileFullPath, this.commandLine.SuppressVersionCheck);
                            break;
                        }
                    }
                    catch (WixUnexpectedFileFormatException e)
                    {
                        format = e.FileFormat;
                        retry  = (FileFormat.Wixobj == format || FileFormat.Wixlib == format || FileFormat.Wixout == format); // .wixobj, .wixout and .wixout are supported by light.
                        if (!retry)
                        {
                            messaging.OnMessage(e.Error);
                        }
                    }
                } while (retry);
            }

            // Stop processing if any errors were found loading object files.
            if (messaging.EncounteredError)
            {
                return;
            }

            // and now for the fun part
            if (null == output)
            {
                OutputType expectedOutputType = OutputType.Unknown;
                if (!String.IsNullOrEmpty(this.commandLine.OutputFile))
                {
                    expectedOutputType = Output.GetOutputType(Path.GetExtension(this.commandLine.OutputFile));
                }

                output = linker.Link(sections, expectedOutputType);

                // If an error occurred during linking, stop processing.
                if (null == output)
                {
                    return;
                }
            }
            else if (0 != sections.Count)
            {
                throw new InvalidOperationException(LightStrings.EXP_CannotLinkObjFilesWithOutpuFile);
            }

            bool tidy = true; // clean up after ourselves by default.
            try
            {
                // only output the xml if its a patch build or user specfied to only output wixout
                string outputFile      = this.commandLine.OutputFile;
                string outputExtension = Path.GetExtension(outputFile);
                if (this.commandLine.OutputXml || OutputType.Patch == output.Type)
                {
                    if (String.IsNullOrEmpty(outputExtension) || outputExtension.Equals(".wix", StringComparison.Ordinal))
                    {
                        outputExtension = (OutputType.Patch == output.Type) ? ".wixmsp" : ".wixout";
                        outputFile      = Path.ChangeExtension(outputFile, outputExtension);
                    }

                    output.Save(outputFile);
                }
                else // finish creating the MSI/MSM
                {
                    if (String.IsNullOrEmpty(outputExtension) || outputExtension.Equals(".wix", StringComparison.Ordinal))
                    {
                        outputExtension = Output.GetExtension(output.Type);
                        outputFile      = Path.ChangeExtension(outputFile, outputExtension);
                    }

                    binder.Bind(output, outputFile);
                }
            }
            catch (WixException we) // keep files around for debugging IDT issues.
            {
                if (we is WixInvalidIdtException)
                {
                    tidy = false;
                }

                throw;
            }
            catch (Exception) // keep files around for debugging unexpected exceptions.
            {
                tidy = false;
                throw;
            }
            finally
            {
                if (null != binder)
                {
                    binder.Cleanup(tidy);
                }
            }

            return;
#endif
        }
Example #35
0
        void DrawSettings(int id)
        {
            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal();
            GUILayout.Box(Localizer.Format("quickstart_options"), GUILayout.Height(30));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            QSettings.Instance.enableStopWatch = GUILayout.Toggle(QSettings.Instance.enableStopWatch, Localizer.Format("quickstart_enableStopWatch"), GUILayout.Width(400));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label(Localizer.Format("quickstart_waitLoading"), GUILayout.Width(300));
            int _int;

            if (int.TryParse(GUILayout.TextField(QSettings.Instance.WaitLoading.ToString(), GUILayout.Width(100)), out _int))
            {
                QSettings.Instance.WaitLoading = _int;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            bool b = GUILayout.Toggle(QSettings.Instance.enableBlackScreen, Localizer.Format("quickstart_blackScreen"), GUILayout.Width(400));

            if (b != QSettings.Instance.enableBlackScreen)
            {
                QSettings.Instance.enableBlackScreen = b;
                QStyle.Label = null;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            QSettings.Instance.enableEditorAutoSaveShip = GUILayout.Toggle(QSettings.Instance.enableEditorAutoSaveShip, Localizer.Format("quickstart_autoSaveShip"), GUILayout.Width(400));
            GUILayout.EndHorizontal();

            if (QSettings.Instance.enableEditorAutoSaveShip)
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label(Localizer.Format("quickstart_saveEach"), GUILayout.Width(300));
                if (int.TryParse(GUILayout.TextField(QSettings.Instance.editorTimeToSave.ToString(), GUILayout.Width(100)), out _int))
                {
                    QSettings.Instance.editorTimeToSave = _int;
                }
                GUILayout.EndHorizontal();
            }

            GUILayout.BeginHorizontal();
            QSettings.Instance.enableEditorLoadAutoSave = GUILayout.Toggle(QSettings.Instance.enableEditorLoadAutoSave, Localizer.Format("quickstart_loadLastShip"), GUILayout.Width(400));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            QSettings.Instance.enablePauseOnFlight = GUILayout.Toggle(QSettings.Instance.enablePauseOnFlight, Localizer.Format("quickstart_pauseLoad"), GUILayout.Width(400));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            QSettings.Instance.evenlySpaceToggles = GUILayout.Toggle(QSettings.Instance.evenlySpaceToggles, Localizer.Format("quickstart_evenlySpaceToggles"), GUILayout.Width(400));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            QSettings.Instance.abbreviations = GUILayout.Toggle(QSettings.Instance.abbreviations, Localizer.Format("quickstart_abbreviations"), GUILayout.Width(400));
            GUILayout.EndHorizontal();



            QKey.DrawConfigKey();

            GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(Localizer.Format("quickstart_close"), GUILayout.Height(30)))
            {
                Settings();
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();

            GUI.DragWindow();
        }
Example #36
0
            public TomatoesSpecies() : base()
            {
                species           = this;
                this.InstanceType = typeof(Tomatoes);

                // Info
                this.Decorative  = false;
                this.Name        = "Tomatoes";
                this.DisplayName = Localizer.DoStr("Tomatoes");
                this.IsConsideredNearbyFoodDuringSpawnCheck = true;
                // Lifetime
                this.MaturityAgeDays = 0.65f;
                // Generation
                this.Height = 1;
                // Food
                this.CalorieValue = 5;
                // Resources
                this.PostHarvestingGrowth = 0.5f;
                this.PickableAtPercent    = 0.8f;
                this.ResourceList         = new List <SpeciesResource>()
                {
                    new SpeciesResource(typeof(TomatoItem), new Range(1, 3), 1),
                    new SpeciesResource(typeof(TomatoSeedItem), new Range(1, 2), 0.08f),
                };
                this.ResourceBonusAtGrowth = 0.9f;
                // Visuals
                this.BlockType = typeof(TomatoesBlock);
                // Climate
                this.ReleasesCO2TonsPerDay = -0.0002f;
                // WorldLayers
                this.MaxGrowthRate = 0.02f;
                this.MaxDeathRate  = 0.01f;
                this.SpreadRate    = 0.001f;
                this.ResourceConstraints.Add(new ResourceConstraint()
                {
                    LayerName = "Nitrogen", HalfSpeedConcentration = 0.1f, MaxResourceContent = 0.2f
                });
                this.ResourceConstraints.Add(new ResourceConstraint()
                {
                    LayerName = "Phosphorus", HalfSpeedConcentration = 0.1f, MaxResourceContent = 0.2f
                });
                this.ResourceConstraints.Add(new ResourceConstraint()
                {
                    LayerName = "Potassium", HalfSpeedConcentration = 0.1f, MaxResourceContent = 0.2f
                });
                this.ResourceConstraints.Add(new ResourceConstraint()
                {
                    LayerName = "SoilMoisture", HalfSpeedConcentration = 0.1f, MaxResourceContent = 0.2f
                });
                this.CapacityConstraints.Add(new CapacityConstraint()
                {
                    CapacityLayerName = "FertileGround", ConsumedCapacityPerPop = 2
                });
                this.CapacityConstraints.Add(new CapacityConstraint()
                {
                    CapacityLayerName = "ShrubSpace", ConsumedCapacityPerPop = 4
                });
                this.BlanketSpawnPercent       = 0.6f;
                this.IdealTemperatureRange     = new Range(0.7f, 0.75f);
                this.IdealMoistureRange        = new Range(0.32f, 0.45f);
                this.IdealWaterRange           = new Range(0, 0.1f);
                this.WaterExtremes             = new Range(0, 0.2f);
                this.TemperatureExtremes       = new Range(0.4f, 0.8f);
                this.MoistureExtremes          = new Range(0.3f, 0.5f);
                this.MaxPollutionDensity       = 0.7f;
                this.PollutionDensityTolerance = 0.1f;
                this.VoxelsPerEntry            = 5;
            }
Example #37
0
 private void AddLibraryLocalizationsToLocalizer(Library library, string[] cultures, Localizer localizer)
 {
     foreach (Localization localization in library.GetLocalizations(cultures))
     {
         localizer.AddLocalization(localization);
     }
 }
        public MillRecipe()
        {
            this.Products = new CraftingElement[]
            {
                new CraftingElement <MillItem>(),
            };

            this.Ingredients = new CraftingElement[]
            {
                new CraftingElement <StoneItem>(typeof(StoneworkingEfficiencySkill), 50, StoneworkingEfficiencySkill.MultiplicativeStrategy),
                new CraftingElement <LogItem>(typeof(StoneworkingEfficiencySkill), 30, StoneworkingEfficiencySkill.MultiplicativeStrategy),
            };
            SkillModifiedValue value = new SkillModifiedValue(20, StoneworkingSpeedSkill.MultiplicativeStrategy, typeof(StoneworkingSpeedSkill), Localizer.DoStr("craft time"));

            SkillModifiedValueManager.AddBenefitForObject(typeof(MillRecipe), Item.Get <MillItem>().UILink(), value);
            SkillModifiedValueManager.AddSkillBenefit(Item.Get <MillItem>().UILink(), value);
            this.CraftMinutes = value;
            this.Initialize(Localizer.DoStr("Mill"), typeof(MillRecipe));
            CraftingComponent.AddRecipe(typeof(MasonryTableObject), this);
        }
Example #39
0
        protected override void WindowGUI(int windowID)
        {
            GUILayout.BeginVertical();

            if (core.target.PositionTargetExists)
            {
                var ASL = core.vessel.mainBody.TerrainAltitude(core.target.targetLatitude, core.target.targetLongitude);
                GUILayout.Label(Localizer.Format("#MechJeb_LandingGuidance_label1"));//Target coordinates:

                GUILayout.BeginHorizontal();
                core.target.targetLatitude.DrawEditGUI(EditableAngle.Direction.NS);
                if (GUILayout.Button("▲"))
                {
                    moveByMeter(ref core.target.targetLatitude, 10, ASL);
                }
                GUILayout.Label("10m");
                if (GUILayout.Button("▼"))
                {
                    moveByMeter(ref core.target.targetLatitude, -10, ASL);
                }
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                core.target.targetLongitude.DrawEditGUI(EditableAngle.Direction.EW);
                if (GUILayout.Button("◄"))
                {
                    moveByMeter(ref core.target.targetLongitude, -10, ASL);
                }
                GUILayout.Label("10m");
                if (GUILayout.Button("►"))
                {
                    moveByMeter(ref core.target.targetLongitude, 10, ASL);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                GUILayout.Label("ASL: " + MuUtils.ToSI(ASL, -1, 4) + "m");
                GUILayout.Label(core.target.targetBody.GetExperimentBiomeSafe(core.target.targetLatitude, core.target.targetLongitude));
                GUILayout.EndHorizontal();
            }
            else
            {
                if (GUILayout.Button(Localizer.Format("#MechJeb_LandingGuidance_button1")))//Enter target coordinates
                {
                    core.target.SetPositionTarget(mainBody, core.target.targetLatitude, core.target.targetLongitude);
                }
            }

            if (GUILayout.Button(Localizer.Format("#MechJeb_LandingGuidance_button2")))
            {
                core.target.PickPositionTargetOnMap();                                                                        //Pick target on map
            }
            List <LandingSite> availableLandingSites = landingSites.Where(p => p.body == mainBody).ToList();

            if (availableLandingSites.Any())
            {
                GUILayout.BeginHorizontal();
                landingSiteIdx = GuiUtils.ComboBox.Box(landingSiteIdx, availableLandingSites.Select(p => p.name).ToArray(), this);
                if (GUILayout.Button("Set", GUILayout.ExpandWidth(false)))
                {
                    core.target.SetPositionTarget(mainBody, availableLandingSites[landingSiteIdx].latitude, availableLandingSites[landingSiteIdx].longitude);
                }
                GUILayout.EndHorizontal();
            }

            DrawGUITogglePredictions();

            if (core.landing != null)
            {
                GUILayout.Label(Localizer.Format("#MechJeb_LandingGuidance_label2"));//Autopilot:

                predictor.maxOrbits        = core.landing.enabled ? 0.5 : 4;
                predictor.noSkipToFreefall = !core.landing.enabled;

                if (core.landing.enabled)
                {
                    if (GUILayout.Button(Localizer.Format("#MechJeb_LandingGuidance_button3")))
                    {
                        core.landing.StopLanding();                                                                        //Abort autoland
                    }
                }
                else
                {
                    GUILayout.BeginHorizontal();
                    if (!core.target.PositionTargetExists || vessel.LandedOrSplashed)
                    {
                        GUI.enabled = false;
                    }
                    if (GUILayout.Button(Localizer.Format("#MechJeb_LandingGuidance_button4")))
                    {
                        core.landing.LandAtPositionTarget(this);                                                                        //Land at target
                    }
                    GUI.enabled = !vessel.LandedOrSplashed;
                    if (GUILayout.Button(Localizer.Format("#MechJeb_LandingGuidance_button5")))
                    {
                        core.landing.LandUntargeted(this);                                                                        //Land somewhere
                    }
                    GUI.enabled = true;
                    GUILayout.EndHorizontal();
                }

                GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_LandingGuidance_label3"), core.landing.touchdownSpeed, "m/s", 35);//Touchdown speed:

                if (core.landing != null)
                {
                    core.node.autowarp = GUILayout.Toggle(core.node.autowarp, Localizer.Format("#MechJeb_LandingGuidance_checkbox1"));             //Auto-warp
                }
                core.landing.deployGears = GUILayout.Toggle(core.landing.deployGears, Localizer.Format("#MechJeb_LandingGuidance_checkbox2"));     //Deploy Landing Gear
                GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_LandingGuidance_label4"), core.landing.limitGearsStage, "", 35);                 //"Stage Limit:"
                core.landing.deployChutes = GUILayout.Toggle(core.landing.deployChutes, Localizer.Format("#MechJeb_LandingGuidance_checkbox3"));   //Deploy Parachutes
                predictor.deployChutes    = core.landing.deployChutes;
                GuiUtils.SimpleTextBox(Localizer.Format("#MechJeb_LandingGuidance_label5"), core.landing.limitChutesStage, "", 35);                //Stage Limit:
                predictor.limitChutesStage = core.landing.limitChutesStage;
                core.landing.rcsAdjustment = GUILayout.Toggle(core.landing.rcsAdjustment, Localizer.Format("#MechJeb_LandingGuidance_checkbox4")); //Use RCS for small adjustment

                if (core.landing.enabled)
                {
                    GUILayout.Label(Localizer.Format("#MechJeb_LandingGuidance_label6") + core.landing.status);                                                                                                                                              //Status:
                    GUILayout.Label(Localizer.Format("#MechJeb_LandingGuidance_label7") + (core.landing.CurrentStep != null ? core.landing.CurrentStep.GetType().Name : "N/A"));                                                                             //Step:
                    GUILayout.Label(Localizer.Format("#MechJeb_LandingGuidance_label8") + (core.landing.descentSpeedPolicy != null ? core.landing.descentSpeedPolicy.GetType().Name : "N/A") + " (" + core.landing.UseAtmosphereToBrake().ToString() + ")"); //Mode
                    //GUILayout.Label("DecEndAlt: " + core.landing.DecelerationEndAltitude().ToString("F2"));
                    //var dragLength = mainBody.DragLength(core.landing.LandingAltitude, core.landing.vesselAverageDrag, vesselState.mass);
                    //GUILayout.Label("Drag Length: " + ( dragLength < double.MaxValue ? dragLength.ToString("F2") : "infinite"));
                    //
                    //string parachuteInfo = core.landing.ParachuteControlInfo;
                    //if (null != parachuteInfo)
                    //{
                    //    GUILayout.Label(parachuteInfo);
                    //}
                }
            }

            GUILayout.EndVertical();

            base.WindowGUI(windowID);
        }
Example #40
0
        public void Add(ChartControl chart, Pane ownerPane)
        {
            owner   = chart;
            tencan  = new TrendLineSeries(string.Format("{0} - {1}", Localizer.GetString("TitleIchimokuIndicator"), Localizer.GetString("TitleTenkanLineSmall")));
            kijyn   = new TrendLineSeries(string.Format("{0} - {1}", Localizer.GetString("TitleIchimokuIndicator"), Localizer.GetString("TitleKijunLineSmall")));
            senkouA = new TrendLineSeries(string.Format("{0} - {1}", Localizer.GetString("TitleIchimokuIndicator"), Localizer.GetString("TitleSenkouALineSmall")));
            senkouB = new TrendLineSeries(string.Format("{0} - {1}", Localizer.GetString("TitleIchimokuIndicator"), Localizer.GetString("TitleSenkouBLineSmall")));
            chikou  = new TrendLineSeries(string.Format("{0} - {1}", Localizer.GetString("TitleIchimokuIndicator"), Localizer.GetString("TitleChikouSmall")));
            cloud   = new PolygonSeries(string.Format("{0} - {1}", Localizer.GetString("TitleIchimokuIndicator"), Localizer.GetString("TitleKumoSmall")))
            {
                colorCloudA = ColorCloudA,
                colorCloudB = ColorCloudB
            };

            SeriesResult = new List <Series.Series> {
                tencan, kijyn, senkouA, senkouB, chikou, cloud
            };
            EntitleIndicator();
        }
Example #41
0
        public static void Update(Vessel v, Vessel_info vi, VesselData vd, Resource_info ec, double elapsed_s)
        {
            if (!Lib.IsVessel(v))
            {
                return;
            }

            // consume ec for transmitters
            ec.Consume(vi.connection.ec * elapsed_s, "comms");

            Cache.WarpCache(v).dataCapacity = vi.connection.rate * elapsed_s;

            // do nothing if network is not ready
            if (!NetworkInitialized)
            {
                return;
            }

            // maintain and send messages
            // - do not send messages during/after solar storms
            // - do not send messages for EVA kerbals
            if (!v.isEVA && v.situation != Vessel.Situations.PRELAUNCH)
            {
                if (!vd.msg_signal && !vi.connection.linked)
                {
                    vd.msg_signal = true;
                    if (vd.cfg_signal)
                    {
                        string subtext = Localizer.Format("#KERBALISM_UI_transmissiondisabled");

                        switch (vi.connection.status)
                        {
                        case LinkStatus.plasma:
                            subtext = Localizer.Format("#KERBALISM_UI_Plasmablackout");
                            break;

                        case LinkStatus.storm:
                            subtext = Localizer.Format("#KERBALISM_UI_Stormblackout");
                            break;

                        default:
                            if (vi.crew_count == 0)
                            {
                                switch (Settings.UnlinkedControl)
                                {
                                case UnlinkedCtrl.none:
                                    subtext = Localizer.Format("#KERBALISM_UI_noctrl");
                                    break;

                                case UnlinkedCtrl.limited:
                                    subtext = Localizer.Format("#KERBALISM_UI_limitedcontrol");
                                    break;
                                }
                            }
                            break;
                        }

                        Message.Post(Severity.warning, Lib.BuildString(Localizer.Format("#KERBALISM_UI_signallost"), " <b>", v.vesselName, "</b>"), subtext);
                    }
                }
                else if (vd.msg_signal && vi.connection.linked)
                {
                    vd.msg_signal = false;
                    if (vd.cfg_signal)
                    {
                        Message.Post(Severity.relax, Lib.BuildString("<b>", v.vesselName, "</b> ", Localizer.Format("#KERBALISM_UI_signalback")),
                                     vi.connection.status == LinkStatus.direct_link ? Localizer.Format("#KERBALISM_UI_directlink") :
                                     Lib.BuildString(Localizer.Format("#KERBALISM_UI_relayby"), " <b>", vi.connection.target_name, "</b>"));
                    }
                }
            }
        }
Example #42
0
 public ValidateDynamicButtonData()
 {
     T = NullLocalizer.Instance;
 }
Example #43
0
 public override void DoParametersGUI(Orbit o, double universalTime, MechJebModuleTargetController target)
 {
     timeSelector.DoChooseTimeGUI();
     GUILayout.Label(Localizer.Format("#MechJeb_AN_label"));//New Longitude of Ascending Node:
     target.targetLongitude.DrawEditGUI(EditableAngle.Direction.EW);
 }
Example #44
0
        public void Update()
        {
            // update ui
            string status_str = string.Empty;

            switch (state)
            {
            case State.enabled:
                if (Math.Truncate(Math.Abs((perctDeployed + ResourceBalance.precision) - 1.0) * 100000) / 100000 > ResourceBalance.precision)
                {
                    // No inflatable can be enabled been pressurizing
                    status_str = Localizer.Format("#KERBALISM_Habitat_pressurizing");
                }
                else
                {
                    status_str = Localizer.Format("#KERBALISM_Generic_ENABLED");
                }
                Set_pressurized(true);
                break;

            case State.disabled:
                status_str = Localizer.Format("#KERBALISM_Generic_DISABLED");
                Set_pressurized(false);
                break;

            case State.pressurizing:
                status_str  = Get_inflate_string().Length == 0 ? Localizer.Format("#KERBALISM_Habitat_pressurizing") : Localizer.Format("#KERBALISM_Habitat_inflating");
                status_str += string.Format("{0:p2}", perctDeployed);
                Set_pressurized(false);
                break;

            case State.depressurizing:
                status_str  = Get_inflate_string().Length == 0 ? Localizer.Format("#KERBALISM_Habitat_depressurizing") : Localizer.Format("#KERBALISM_Habitat_deflating");
                status_str += string.Format("{0:p2}", perctDeployed);
                Set_pressurized(false);
                break;
            }
            Events["Toggle"].guiName = Lib.StatusToggle("Habitat", status_str);

            // Changing this animation when we expect rotation will not work because
            // Unity disables other animations when playing the inflation animation.
            if (prev_state != State.enabled)
            {
                Set_inflation();
            }
            prev_state = state;
        }
 public void Should_throw_ANE_if_configuration_at_Initialize_is_null()
 {
     Assert.Throws <ArgumentNullException>(() => Localizer.Initialize(null));
 }
Example #46
0
 public override string GetName()
 {
     return(Localizer.Format("#MechJeb_LandingGuidance_title"));//Landing Guidance
 }
 public LocalizerTest()
 {
     Localizer.Initialize(Configuration);
 }
Example #48
0
        void DrawGUIPrediction()
        {
            ReentrySimulation.Result result = predictor.Result;
            if (result != null)
            {
                switch (result.outcome)
                {
                case ReentrySimulation.Outcome.LANDED:
                    GUILayout.Label(Localizer.Format("#MechJeb_LandingGuidance_label9"));    //Landing Predictions:
                    GUILayout.Label(Coordinates.ToStringDMS(result.endPosition.latitude, result.endPosition.longitude) + "\nASL:" + MuUtils.ToSI(result.endASL, -1, 4) + "m");
                    GUILayout.Label(result.body.GetExperimentBiomeSafe(result.endPosition.latitude, result.endPosition.longitude));
                    double error = Vector3d.Distance(mainBody.GetWorldSurfacePosition(result.endPosition.latitude, result.endPosition.longitude, 0) - mainBody.position,
                                                     mainBody.GetWorldSurfacePosition(core.target.targetLatitude, core.target.targetLongitude, 0) - mainBody.position);
                    GUILayout.Label(Localizer.Format("#MechJeb_LandingGuidance_Label10") + MuUtils.ToSI(error, 0) + "m"
                                    + Localizer.Format("#MechJeb_LandingGuidance_Label11") + result.maxDragGees.ToString("F1") + "g"
                                    + Localizer.Format("#MechJeb_LandingGuidance_Label12") + result.deltaVExpended.ToString("F1") + "m/s"
                                    + Localizer.Format("#MechJeb_LandingGuidance_Label13") + (vessel.Landed ? "0.0s" : GuiUtils.TimeToDHMS(result.endUT - Planetarium.GetUniversalTime(), 1)));  //Target difference = \nMax drag: \nDelta-v needed: \nTime to land:
                    break;

                case ReentrySimulation.Outcome.AEROBRAKED:
                    GUILayout.Label(Localizer.Format("#MechJeb_LandingGuidance_Label14"));    //Predicted orbit after aerobraking:
                    Orbit o = result.AeroBrakeOrbit();
                    if (o.eccentricity > 1)
                    {
                        GUILayout.Label(Localizer.Format("#MechJeb_LandingGuidance_Label15") + o.eccentricity.ToString("F2"));                        //Hyperbolic, eccentricity =
                    }
                    else
                    {
                        GUILayout.Label(MuUtils.ToSI(o.PeA, 3) + "m x " + MuUtils.ToSI(o.ApA, 3) + "m");
                    }
                    GUILayout.Label(Localizer.Format("#MechJeb_LandingGuidance_Label16", result.maxDragGees.ToString("F1")) + Localizer.Format("#MechJeb_LandingGuidance_Label17", GuiUtils.TimeToDHMS(result.aeroBrakeUT - Planetarium.GetUniversalTime(), 1)));  //Max drag:<<1>>g  \nExit atmosphere in:
                    break;

                case ReentrySimulation.Outcome.NO_REENTRY:
                    GUILayout.Label(Localizer.Format("#MechJeb_LandingGuidance_Label18_1")
                                    + MuUtils.ToSI(orbit.PeA, 3) + "m Pe > " + MuUtils.ToSI(mainBody.RealMaxAtmosphereAltitude(), 3) + (mainBody.atmosphere ? Localizer.Format("#MechJeb_LandingGuidance_Label18_2") : Localizer.Format("#MechJeb_LandingGuidance_Label18_3")));  //"Orbit does not reenter:\n""m atmosphere height""m ground"
                    break;

                case ReentrySimulation.Outcome.TIMED_OUT:
                    GUILayout.Label(Localizer.Format("#MechJeb_LandingGuidance_Label19"));    //Reentry simulation timed out.
                    break;
                }
            }
        }
Example #49
0
 public PlantLayerSettingsTomatoes() : base()
 {
     this.Name                = "Tomatoes";
     this.DisplayName         = string.Format("{0} {1}", Localizer.DoStr("Tomatoes"), Localizer.DoStr("Population"));
     this.InitMultiplier      = 1;
     this.SyncToClient        = false;
     this.Range               = new Range(0f, 1f);
     this.OverrideRenderRange = new Range(0f, 0.333333f);
     this.MinColor            = new Color(1f, 1f, 1f);
     this.MaxColor            = new Color(0f, 1f, 0f);
     this.SumRelevant         = true;
     this.Unit                = "Tomatoes";
     this.VoxelsPerEntry      = 5;
     this.Category            = WorldLayerCategory.Plant;
     this.ValueType           = WorldLayerValueType.FillRate;
     this.AreaDescription     = "";
     this.Subcategory         = "Tomatoes".AddSpacesBetweenCapitals();
 }
Example #50
0
        [GeneralInfoItem("#MechJeb_LandingPredictions", InfoItem.Category.Misc)]//Landing predictions
        void DrawGUITogglePredictions()
        {
            GUILayout.BeginVertical();

            bool active = GUILayout.Toggle(predictor.enabled, Localizer.Format("#MechJeb_LandingGuidance_checkbox5"));//Show landing predictions

            if (predictor.enabled != active)
            {
                if (active)
                {
                    predictor.users.Add(this);
                }
                else
                {
                    predictor.users.Remove(this);
                }
            }

            if (predictor.enabled)
            {
                predictor.makeAerobrakeNodes = GUILayout.Toggle(predictor.makeAerobrakeNodes, Localizer.Format("#MechJeb_LandingGuidance_checkbox6")); //"Show aerobrake nodes"
                predictor.showTrajectory     = GUILayout.Toggle(predictor.showTrajectory, Localizer.Format("#MechJeb_LandingGuidance_checkbox7"));     //Show trajectory
                predictor.worldTrajectory    = GUILayout.Toggle(predictor.worldTrajectory, Localizer.Format("#MechJeb_LandingGuidance_checkbox8"));    //World trajectory
                predictor.camTrajectory      = GUILayout.Toggle(predictor.camTrajectory, Localizer.Format("#MechJeb_LandingGuidance_checkbox9"));      //Camera trajectory (WIP)
                DrawGUIPrediction();
            }

            GUILayout.EndVertical();
        }
Example #51
0
        private Localizer InitializeLocalization(TableDefinitionCollection tableDefinitions)
        {
            Localizer localizer = null;

            // Instantiate the localizer and load any localization files.
            if (!this.commandLine.SuppressLocalization || 0 < this.commandLine.LocalizationFiles.Count || null != this.commandLine.Cultures || !this.commandLine.OutputXml)
            {
                List <Localization> localizations = new List <Localization>();

                // Load each localization file.
                foreach (string localizationFile in this.commandLine.LocalizationFiles)
                {
                    Localization localization = Localizer.ParseLocalizationFile(localizationFile, tableDefinitions);
                    if (null != localization)
                    {
                        localizations.Add(localization);
                    }
                }

                localizer = new Localizer();
                if (null != this.commandLine.Cultures)
                {
                    // Alocalizations in order specified in cultures.
                    foreach (string culture in this.commandLine.Cultures)
                    {
                        foreach (Localization localization in localizations)
                        {
                            if (culture.Equals(localization.Culture, StringComparison.OrdinalIgnoreCase))
                            {
                                localizer.AddLocalization(localization);
                            }
                        }
                    }
                }
                else // no cultures specified, so try neutral culture and if none of those add all loc files.
                {
                    bool neutralFound = false;
                    foreach (Localization localization in localizations)
                    {
                        if (String.IsNullOrEmpty(localization.Culture))
                        {
                            // If a neutral wxl was provided use it.
                            localizer.AddLocalization(localization);
                            neutralFound = true;
                        }
                    }

                    if (!neutralFound)
                    {
                        // No cultures were specified and no neutral wxl are available, include all of the loc files.
                        foreach (Localization localization in localizations)
                        {
                            localizer.AddLocalization(localization);
                        }
                    }
                }

                // Load localizations provided by extensions with data.
                foreach (IExtensionData data in this.extensionData)
                {
                    Library library = data.GetLibrary(tableDefinitions);
                    if (null != library)
                    {
                        // Load the extension's default culture if it provides one and no cultures were specified.
                        string[] extensionCultures = this.commandLine.Cultures;
                        if (null == extensionCultures && null != data.DefaultCulture)
                        {
                            extensionCultures = new string[] { data.DefaultCulture };
                        }

                        AddLibraryLocalizationsToLocalizer(library, extensionCultures, localizer);
                    }
                }
            }

            return(localizer);
        }
        public void Should_read_all_files()
        {
            var localizer = new Localizer(_culture);

            AssertLocalizer(localizer, 3);
        }
Example #53
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(123, 312, true);
            WriteLiteral(@"<div class=""modal fade"" id=""edit-password"" tabindex=""-1"" role=""dialog"" aria-labelledby=""editPasswordLable"" aria-hidden=""true"">
    <div class=""modal-dialog"" role=""document"">
        <div class=""modal-content"">
            <div class=""modal-header"">
                <h5 class=""modal-title"" id=""editPasswordLable"">");
            EndContext();
            BeginContext(436, 42, false);
#line 8 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
                                                          Write(Localizer.GetLocalizedHtmlString("t_edit"));

#line default
#line hidden
            EndContext();
            BeginContext(478, 257, true);
            WriteLiteral(@"</h5>
                <button type=""button"" class=""close"" data-dismiss=""modal"" aria-label=""Close"">
                    <span aria-hidden=""true"">&times;</span>
                </button>
            </div>
            <div class=""modal-body"">
                ");
            EndContext();
            BeginContext(735, 1106, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5003c33594420581df5851f2ea3d6d07a021a6446902", async() => {
                BeginContext(803, 56, true);
                WriteLiteral("\n                    <input name=\"IsValid\" type=\"hidden\"");
                EndContext();
                BeginWriteAttribute("value", " value=\"", 859, "\"", 906, 1);
#line 15 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
WriteAttributeValue("", 867, ViewData.ModelState.IsValid.ToString(), 867, 39, false);

#line default
#line hidden
                EndWriteAttribute();
                BeginContext(907, 72, true);
                WriteLiteral("/>\n                    <div class=\"form-group\">\n                        ");
                EndContext();
                BeginContext(979, 89, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("label", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5003c33594420581df5851f2ea3d6d07a021a6447856", async() => {
                    BeginContext(1009, 51, false);
#line 17 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
                                                Write(Localizer.GetLocalizedHtmlString("lbl_newPassword"));

#line default
#line hidden
                    EndContext();
                }
                );
                __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper);
#line 17 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
__Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.NewPassword);

#line default
#line hidden
                __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(1068, 25, true);
                WriteLiteral("\n                        ");
                EndContext();
                BeginContext(1093, 132, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "5003c33594420581df5851f2ea3d6d07a021a6449813", async() => {
                }
                );
                __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper);
#line 18 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.NewPassword);

#line default
#line hidden
                __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.InputTypeName = (string)__tagHelperAttribute_0.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1);
                BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "placeholder", 1, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
#line 18 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
AddHtmlAttributeValue("", 1171, Localizer.GetLocalizedHtmlString("pld_newPassword"), 1171, 52, false);

#line default
#line hidden
                EndAddHtmlAttributeValues(__tagHelperExecutionContext);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(1225, 25, true);
                WriteLiteral("\n                        ");
                EndContext();
                BeginContext(1250, 76, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("span", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5003c33594420581df5851f2ea3d6d07a021a64412224", async() => {
                }
                );
                __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper);
#line 19 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.NewPassword);

#line default
#line hidden
                __tagHelperExecutionContext.AddTagHelperAttribute("asp-validation-for", __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(1326, 97, true);
                WriteLiteral("\n                    </div>\n                    <div class=\"form-group\">\n                        ");
                EndContext();
                BeginContext(1423, 97, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("label", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5003c33594420581df5851f2ea3d6d07a021a64414095", async() => {
                    BeginContext(1457, 55, false);
#line 22 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
                                                    Write(Localizer.GetLocalizedHtmlString("lbl_confirmPassword"));

#line default
#line hidden
                    EndContext();
                }
                );
                __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper);
#line 22 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
__Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.ConfirmPassword);

#line default
#line hidden
                __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_LabelTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(1520, 25, true);
                WriteLiteral("\n                        ");
                EndContext();
                BeginContext(1545, 140, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "5003c33594420581df5851f2ea3d6d07a021a64416065", async() => {
                }
                );
                __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper);
#line 23 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
__Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.ConfirmPassword);

#line default
#line hidden
                __tagHelperExecutionContext.AddTagHelperAttribute("asp-for", __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                __Microsoft_AspNetCore_Mvc_TagHelpers_InputTagHelper.InputTypeName = (string)__tagHelperAttribute_0.Value;
                __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_0);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_1);
                BeginAddHtmlAttributeValues(__tagHelperExecutionContext, "placeholder", 1, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
#line 23 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
AddHtmlAttributeValue("", 1627, Localizer.GetLocalizedHtmlString("pld_confirmPassword"), 1627, 56, false);

#line default
#line hidden
                EndAddHtmlAttributeValues(__tagHelperExecutionContext);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(1685, 25, true);
                WriteLiteral("\n                        ");
                EndContext();
                BeginContext(1710, 80, false);
                __tagHelperExecutionContext = __tagHelperScopeManager.Begin("span", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "5003c33594420581df5851f2ea3d6d07a021a64418485", async() => {
                }
                );
                __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper>();
                __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper);
#line 24 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
__Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For = ModelExpressionProvider.CreateModelExpression(ViewData, __model => __model.ConfirmPassword);

#line default
#line hidden
                __tagHelperExecutionContext.AddTagHelperAttribute("asp-validation-for", __Microsoft_AspNetCore_Mvc_TagHelpers_ValidationMessageTagHelper.For, global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes);
                __tagHelperExecutionContext.AddHtmlAttribute(__tagHelperAttribute_2);
                await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
                if (!__tagHelperExecutionContext.Output.IsContentModified)
                {
                    await __tagHelperExecutionContext.SetOutputContentAsync();
                }
                Write(__tagHelperExecutionContext.Output);
                __tagHelperExecutionContext = __tagHelperScopeManager.End();
                EndContext();
                BeginContext(1790, 44, true);
                WriteLiteral("\n                    </div>\n                ");
                EndContext();
            }
            );
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper = CreateTagHelper<global::Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_TagHelpers_RenderAtEndOfFormTagHelper);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Action = (string)__tagHelperAttribute_3.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_3);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Controller = (string)__tagHelperAttribute_4.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_4);
            __Microsoft_AspNetCore_Mvc_TagHelpers_FormTagHelper.Method = (string)__tagHelperAttribute_5.Value;
            __tagHelperExecutionContext.AddTagHelperAttribute(__tagHelperAttribute_5);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1841, 144, true);
            WriteLiteral("\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">");
            EndContext();
            BeginContext(1986, 45, false);
#line 29 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
                                                                                Write(Localizer.GetLocalizedHtmlString("btn_close"));

#line default
#line hidden
            EndContext();
            BeginContext(2031, 90, true);
            WriteLiteral("</button>\n                <button type=\"button\" class=\"btn btn-primary\" data-save=\"modal\">");
            EndContext();
            BeginContext(2122, 44, false);
#line 30 "C:\Users\Admin\Desktop\3STask\3S\TaskTranning\Views\User\_ChangePassword.cshtml"
                                                                           Write(Localizer.GetLocalizedHtmlString("btn_save"));

#line default
#line hidden
            EndContext();
            BeginContext(2166, 61, true);
            WriteLiteral("</button>\n            </div>\n        </div>\n    </div>\n</div>");
            EndContext();
        }
        public void Should_throw_MissingLocalizationException_if_there_is_no_key()
        {
            var localizer = new Localizer(new CurrentCulture("ru-ru"));

            Assert.Throws <MissingLocalizationException>(() => localizer.Get("messages", "there_is_no_localization"));
        }
Example #55
0
        void OnGUI()
        {
            if (HighLogic.LoadedScene != GameScenes.LOADING)
            {
                return;
            }
            if (string.IsNullOrEmpty(QSaveGame.LastUsed))
            {
                return;
            }
            GUI.skin = HighLogic.Skin;

            QKey.DrawSetKey();

            if (WindowSettings)
            {
                RectSettings = ClickThruBlocker.GUILayoutWindow(1545177, RectSettings, DrawSettings, RegisterToolbar.MOD + " " + RegisterToolbar.VERSION);
            }

            GUILayout.BeginArea(RectGUI);
            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            GUILayout.Label(StopWatchText);

            if (QSettings.Instance.Enabled)
            {
                if (GUILayout.Button("◄", GUILayout.Width(20), GUILayout.Height(20)))
                {
                    QSaveGame.Prev();
                }
                GUILayout.Label(!string.IsNullOrEmpty(QSaveGame.LastUsed) ?
                                Localizer.Format("quickstart_lastGame", QSaveGame.LastUsed) :
                                Localizer.Format("quickstart_noLastGame"));
                if (GUILayout.Button("►", QStyle.Button, GUILayout.Width(20), GUILayout.Height(20)))
                {
                    QSaveGame.Next();
                }
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            if (!string.IsNullOrEmpty(QSaveGame.LastUsed))
            {
                bool abbr = QSettings.Instance.abbreviations;
                if (Screen.width <= 1280)
                {
                    abbr = true;
                }
                GUILayout.BeginHorizontal();
                QSettings.Instance.Enabled = GUILayout.Toggle(QSettings.Instance.Enabled, Localizer.Format("quickstart_enable", RegisterToolbar.MOD), LabelWidth.Enabled);
                if (QSettings.Instance.Enabled)
                {
                    if (QSettings.Instance.evenlySpaceToggles)
                    {
                        GUILayout.FlexibleSpace();
                    }
                    if (GUILayout.Toggle(QSettings.Instance.gameScene == (int)GameScenes.SPACECENTER, Localizer.Format(
                                             abbr ? "quickstart_sc_abbr" : "quickstart_sc"
                                             ), LabelWidth.KSC))
                    {
                        if (QSettings.Instance.gameScene != (int)GameScenes.SPACECENTER)
                        {
                            QSettings.Instance.gameScene = (int)GameScenes.SPACECENTER;
                        }
                    }
                    if (QSettings.Instance.evenlySpaceToggles)
                    {
                        GUILayout.FlexibleSpace();
                    }
                    if (GUILayout.Toggle(QSettings.Instance.editorFacility == (int)EditorFacility.VAB && QSettings.Instance.gameScene == (int)GameScenes.EDITOR, Localizer.Format(
                                             abbr ? "quickstart_vab_abbr": "quickstart_vab"
                                             ), LabelWidth.VAB))
                    {
                        if (QSettings.Instance.gameScene != (int)GameScenes.EDITOR || QSettings.Instance.editorFacility != (int)EditorFacility.VAB)
                        {
                            QSettings.Instance.gameScene      = (int)GameScenes.EDITOR;
                            QSettings.Instance.editorFacility = (int)EditorFacility.VAB;
                        }
                    }
                    if (QSettings.Instance.evenlySpaceToggles)
                    {
                        GUILayout.FlexibleSpace();
                    }
                    if (GUILayout.Toggle(QSettings.Instance.editorFacility == (int)EditorFacility.SPH && QSettings.Instance.gameScene == (int)GameScenes.EDITOR, Localizer.Format(
                                             abbr ? "quickstart_sph_abbr" : "quickstart_sph"
                                             ), LabelWidth.SPH))
                    {
                        if (QSettings.Instance.gameScene != (int)GameScenes.EDITOR || QSettings.Instance.editorFacility != (int)EditorFacility.SPH)
                        {
                            QSettings.Instance.gameScene      = (int)GameScenes.EDITOR;
                            QSettings.Instance.editorFacility = (int)EditorFacility.SPH;
                        }
                    }
                    if (QSettings.Instance.evenlySpaceToggles)
                    {
                        GUILayout.FlexibleSpace();
                    }
                    if (GUILayout.Toggle(QSettings.Instance.gameScene == (int)GameScenes.TRACKSTATION, Localizer.Format("quickstart_ts"), LabelWidth.TrackingStation))
                    {
                        if (QSettings.Instance.gameScene != (int)GameScenes.TRACKSTATION)
                        {
                            QSettings.Instance.gameScene = (int)GameScenes.TRACKSTATION;
                        }
                    }
                    if (QSettings.Instance.evenlySpaceToggles)
                    {
                        GUILayout.FlexibleSpace();
                    }
                    GUI.enabled = !string.IsNullOrEmpty(QuickStart_Persistent.vesselID);
                    if (GUILayout.Toggle(QSettings.Instance.gameScene == (int)GameScenes.FLIGHT, (!string.IsNullOrEmpty(QSaveGame.vesselName) ? Localizer.Format("quickstart_lastVessel", QSaveGame.vesselName, QSaveGame.vesselType) : Localizer.Format("quickstart_noVessel")), LabelWidth.Vessel))
                    {
                        if (QSettings.Instance.gameScene != (int)GameScenes.FLIGHT)
                        {
                            QSettings.Instance.gameScene = (int)GameScenes.FLIGHT;
                        }
                    }
                    GUI.enabled = true;
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button(Localizer.Format("quickstart_settings"), QStyle.Button, GUILayout.Height(20)))
                    {
                        Settings();
                    }
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            GUILayout.EndArea();
        }
        public void Should_throw_MissingLocalizationException_if_there_is_no_culture()
        {
            var localizer = new Localizer(new CurrentCulture("ke-ke"));

            Assert.Throws <MissingLocalizationException>(() => localizer.Get("messages", "Hello"));
        }
Example #57
0
 public EditorSettingsDock()
 {
     this.InitializeComponent();
     this.m_paramShowFog.ToolTip                           = Localizer.LocalizeCommon("HELP_SETTINGS_FOG");
     this.m_paramShowExposure.ToolTip                      = Localizer.LocalizeCommon("HELP_SETTINGS_SHOW_EXPOSURE");
     this.m_paramShowShadow.ToolTip                        = Localizer.LocalizeCommon("HELP_SETTINGS_SHADOW");
     this.m_paramShowWater.ToolTip                         = Localizer.LocalizeCommon("HELP_SETTINGS_WATER");
     this.m_paramShowCollections.ToolTip                   = Localizer.LocalizeCommon("HELP_SETTINGS_COLLECTION");
     this.m_paramShowIcons.ToolTip                         = Localizer.LocalizeCommon("HELP_SETTINGS_ICONS");
     this.m_paramEnableSound.ToolTip                       = Localizer.LocalizeCommon("HELP_SETTINGS_SOUND");
     this.m_paramShowGrid.ToolTip                          = Localizer.LocalizeCommon("HELP_SETTINGS_GRID");
     this.m_paramInvincible.ToolTip                        = Localizer.LocalizeCommon("HELP_SETTINGS_INVINCIBILITY");
     this.m_paramInvisible.ToolTip                         = Localizer.LocalizeCommon("HELP_SETTINGS_INVISIBILITY");
     this.m_paramSnapObjects.ToolTip                       = Localizer.LocalizeCommon("HELP_SETTINGS_KEEPOBJTERRAIN");
     this.m_paramAutoSnappingObjects.ToolTip               = Localizer.LocalizeCommon("HELP_SETTINGS_AUTOSNAP_OBJ");
     this.m_paramAutoSnappingObjectsRotation.ToolTip       = Localizer.LocalizeCommon("HELP_SETTINGS_AUTOSNAP_OBJ_ROT");
     this.m_paramAutoSnappingObjectsTerrain.ToolTip        = Localizer.LocalizeCommon("HELP_SETTINGS_AUTOSNAP_OBJ_TER");
     this.m_paramInvertMouseView.ToolTip                   = Localizer.Localize("HELP_SETTINGS_INVERT_MOUSE_VIEW");
     this.m_paramInvertMousePan.ToolTip                    = Localizer.Localize("HELP_SETTINGS_INVERT_MOUSE_PAN");
     this.m_paramEngineQuality.ToolTip                     = Localizer.Localize("HELP_SETTINGS_ENGINE_QUALITY");
     this.m_paramViewportQuality.ToolTip                   = Localizer.Localize("HELP_SETTINGS_VIEWPORT_QUALITY");
     this.m_paramKillDistanceOverride.ToolTip              = Localizer.Localize("HELP_SETTINGS_KILL_DISTANCE");
     this.m_paramShowFog.ValueChanged                     += new EventHandler(this.paramShowFog_ValueChanged);
     this.m_paramShowExposure.ValueChanged                += new EventHandler(this.paramShowExposure_ValueChanged);
     this.m_paramShowShadow.ValueChanged                  += new EventHandler(this.paramShowShadow_ValueChanged);
     this.m_paramShowWater.ValueChanged                   += new EventHandler(this.paramShowWater_ValueChanged);
     this.m_paramShowCollections.ValueChanged             += new EventHandler(this.paramShowCollections_ValueChanged);
     this.m_paramShowIcons.ValueChanged                   += new EventHandler(this.paramShowIcons_ValueChanged);
     this.m_paramEnableSound.ValueChanged                 += new EventHandler(this.paramEnableSound_ValueChanged);
     this.m_paramShowGrid.ValueChanged                    += new EventHandler(this.paramShowGrid_ValueChanged);
     this.m_paramGridResolution.ValueChanged              += new EventHandler(this.paramGridResolution_ValueChanged);
     this.m_paramInvincible.ValueChanged                  += new EventHandler(this.paramInvincible_ValueChanged);
     this.m_paramInvisible.ValueChanged                   += new EventHandler(this.paramInvisible_ValueChanged);
     this.m_paramSnapObjects.ValueChanged                 += new EventHandler(this.paramSnapObjects_ValueChanged);
     this.m_paramAutoSnappingObjects.ValueChanged         += new EventHandler(this.paramAutoSnappingObjects_ValueChanged);
     this.m_paramAutoSnappingObjectsRotation.ValueChanged += new EventHandler(this.paramAutoSnappingObjectsRotation_ValueChanged);
     this.m_paramAutoSnappingObjectsTerrain.ValueChanged  += new EventHandler(this.paramAutoSnappingObjectsTerrain_ValueChanged);
     this.m_paramInvertMouseView.ValueChanged             += new EventHandler(this.paramInvertMouseView_ValueChanged);
     this.m_paramInvertMousePan.ValueChanged              += new EventHandler(this.paramInvertMousePan_ValueChanged);
     this.m_paramEngineQuality.ValueChanged               += new EventHandler(this.paramEngineQuality_ValueChanged);
     this.m_paramViewportQuality.ValueChanged             += new EventHandler(this.paramViewportQuality_ValueChanged);
     this.m_paramKillDistanceOverride.ValueChanged        += new EventHandler(this.paramKillDistanceOverride_ValueChanged);
     this.m_paramGridResolution.Names                      = new string[]
     {
         "16",
         "32",
         "64",
         "128"
     };
     this.m_paramGridResolution.Values = new float[]
     {
         16f,
         32f,
         64f,
         128f
     };
     this.m_paramEngineQuality.Names = new string[]
     {
         Localizer.Localize("Video", "OPTIONS_CONTROLS_PC_LOW"),
         Localizer.Localize("Video", "OPTIONS_CONTROLS_PC_MEDIUM"),
         Localizer.Localize("Video", "OPTIONS_CONTROLS_PC_HIGH"),
         Localizer.Localize("Video", "OPTIONS_CONTROLS_PC_VERY_HIGH"),
         Localizer.Localize("Video", "OPTIONS_CONTROLS_PC_ULTRA"),
         Localizer.Localize("Video", "OPTIONS_CONTROLS_PC_OPTIMAL")
     };
     this.m_paramEngineQuality.Values = new EditorSettings.QualityLevel[]
     {
         EditorSettings.QualityLevel.Low,
         EditorSettings.QualityLevel.Medium,
         EditorSettings.QualityLevel.High,
         EditorSettings.QualityLevel.VeryHigh,
         EditorSettings.QualityLevel.UltraHigh,
         EditorSettings.QualityLevel.Optimal
     };
     this.m_paramViewportQuality.Names = new string[]
     {
         "100%",
         "90%",
         "80%",
         "70%",
         "60%",
         "50%"
     };
     this.m_paramViewportQuality.Values = new float[]
     {
         1f,
         0.9f,
         0.8f,
         0.7f,
         0.6f,
         0.5f
     };
     this.Text = Localizer.Localize(this.Text);
 }
Example #58
0
 public override string getName()
 {
     return(Localizer.Format("#MechJeb_AN_title"));
 }                                                                                //change longitude of ascending node
Example #59
0
        public OptionsForm(UserSettings settings, UpdateManager updateManager, bool initialContentSetup)
        {
            InitializeComponent();

            Localizer.Localize(this, catalog);

            Settings      = settings;
            UpdateManager = updateManager;

            // Collect all the available language codes by searching for
            // localisation files, but always include English (base language).
            var languageCodes = new List <string> {
                "en"
            };

            foreach (var path in Directory.GetDirectories(Path.GetDirectoryName(Application.ExecutablePath)))
            {
                if (Directory.GetFiles(path, "*.Messages.resources.dll").Length > 0)
                {
                    languageCodes.Add(Path.GetFileName(path));
                }
            }

            // Turn the list of codes in to a list of code + name pairs for
            // displaying in the dropdown list.
            comboLanguage.DataSource =
                new[] { new ComboBoxMember {
                            Code = "", Name = "System"
                        } }
            .Union(languageCodes
                   .SelectMany(lc =>
            {
                try
                {
                    return(new[] { new ComboBoxMember {
                                       Code = lc, Name = CultureInfo.GetCultureInfo(lc).NativeName
                                   } });
                }
                catch (ArgumentException)
                {
                    return(new ComboBoxMember[0]);
                }
            })
                   .OrderBy(l => l.Name)
                   )
            .ToList();
            comboLanguage.DisplayMember = "Name";
            comboLanguage.ValueMember   = "Code";
            comboLanguage.SelectedValue = Settings.Language;
            if (comboLanguage.SelectedValue == null)
            {
                comboLanguage.SelectedIndex = 0;
            }

            comboBoxOtherUnits.DataSource = new[] {
                new ComboBoxMember {
                    Code = "Route", Name = catalog.GetString("Route")
                },
                new ComboBoxMember {
                    Code = "Automatic", Name = catalog.GetString("Player's location")
                },
                new ComboBoxMember {
                    Code = "Metric", Name = catalog.GetString("Metric")
                },
                new ComboBoxMember {
                    Code = "US", Name = catalog.GetString("Imperial US")
                },
                new ComboBoxMember {
                    Code = "UK", Name = catalog.GetString("Imperial UK")
                },
            }.ToList();
            comboBoxOtherUnits.DisplayMember = "Name";
            comboBoxOtherUnits.ValueMember   = "Code";
            comboBoxOtherUnits.SelectedValue = Settings.Units;

            comboPressureUnit.DataSource = new[] {
                new ComboBoxMember {
                    Code = "Automatic", Name = catalog.GetString("Automatic")
                },
                new ComboBoxMember {
                    Code = "bar", Name = catalog.GetString("bar")
                },
                new ComboBoxMember {
                    Code = "PSI", Name = catalog.GetString("psi")
                },
                new ComboBoxMember {
                    Code = "inHg", Name = catalog.GetString("inHg")
                },
                new ComboBoxMember {
                    Code = "kgf/cm^2", Name = catalog.GetString("kgf/cm²")
                },
            }.ToList();
            comboPressureUnit.DisplayMember = "Name";
            comboPressureUnit.ValueMember   = "Code";
            comboPressureUnit.SelectedValue = Settings.PressureUnit;

            // Windows 2000 and XP should use 8.25pt Tahoma, while Windows
            // Vista and later should use 9pt "Segoe UI". We'll use the
            // Message Box font to allow for user-customizations, though.
            Font = SystemFonts.MessageBoxFont;
            AdhesionLevelValue.Font = new Font(Font, FontStyle.Bold);

            // Fix up the TrackBars on TabPanels to match the current theme.
            if (!Application.RenderWithVisualStyles)
            {
                trackAdhesionFactor.BackColor       = BackColor;
                trackAdhesionFactorChange.BackColor = BackColor;
                trackDayAmbientLight.BackColor      = BackColor;
                trackLODBias.BackColor = BackColor;
            }

            // General tab
            checkAlerter.Checked               = Settings.Alerter;
            checkAlerterExternal.Enabled       = Settings.Alerter;
            checkAlerterExternal.Checked       = Settings.Alerter && !Settings.AlerterDisableExternal;
            checkSpeedControl.Checked          = Settings.SpeedControl;
            checkConfirmations.Checked         = !Settings.SuppressConfirmations;
            checkViewDispatcher.Checked        = Settings.ViewDispatcher;
            checkUseLargeAddressAware.Checked  = Settings.UseLargeAddressAware;
            checkRetainers.Checked             = Settings.RetainersOnAllCars;
            checkGraduatedRelease.Checked      = Settings.GraduatedRelease;
            numericBrakePipeChargingRate.Value = Settings.BrakePipeChargingRate;
            comboLanguage.Text             = Settings.Language;
            comboPressureUnit.Text         = Settings.PressureUnit;
            comboBoxOtherUnits.Text        = settings.Units;
            checkDisableTCSScripts.Checked = Settings.DisableTCSScripts;
            checkEnableWebServer.Checked   = Settings.WebServer;
            numericWebServerPort.Value     = Settings.WebServerPort;

            // Audio tab

            checkMSTSBINSound.Checked                 = Settings.MSTSBINSound;
            numericSoundVolumePercent.Value           = Settings.SoundVolumePercent;
            numericSoundDetailLevel.Value             = Settings.SoundDetailLevel;
            numericExternalSoundPassThruPercent.Value = Settings.ExternalSoundPassThruPercent;

            // Video tab
            checkDynamicShadows.Checked       = Settings.DynamicShadows;
            checkShadowAllShapes.Checked      = Settings.ShadowAllShapes;
            checkFastFullScreenAltTab.Checked = Settings.FastFullScreenAltTab;
            checkWindowGlass.Checked          = Settings.WindowGlass;
            checkModelInstancing.Checked      = Settings.ModelInstancing;
            checkWire.Checked             = Settings.Wire;
            checkVerticalSync.Checked     = Settings.VerticalSync;
            numericCab2DStretch.Value     = Settings.Cab2DStretch;
            numericViewingDistance.Value  = Settings.ViewingDistance;
            checkDistantMountains.Checked = Settings.DistantMountains;
            labelDistantMountainsViewingDistance.Enabled   = checkDistantMountains.Checked;
            numericDistantMountainsViewingDistance.Enabled = checkDistantMountains.Checked;
            numericDistantMountainsViewingDistance.Value   = Settings.DistantMountainsViewingDistance / 1000;
            numericViewingFOV.Value         = Settings.ViewingFOV;
            numericWorldObjectDensity.Value = Settings.WorldObjectDensity;
            comboWindowSize.Text            = Settings.WindowSize;
            trackDayAmbientLight.Value      = Settings.DayAmbientLight;
            trackDayAmbientLight_ValueChanged(null, null);
            checkDoubleWire.Checked = Settings.DoubleWire;

            // Simulation tab

            checkSimpleControlPhysics.Checked              = Settings.SimpleControlPhysics;
            checkUseAdvancedAdhesion.Checked               = Settings.UseAdvancedAdhesion;
            labelAdhesionMovingAverageFilterSize.Enabled   = checkUseAdvancedAdhesion.Checked;
            numericAdhesionMovingAverageFilterSize.Enabled = checkUseAdvancedAdhesion.Checked;
            numericAdhesionMovingAverageFilterSize.Value   = Settings.AdhesionMovingAverageFilterSize;
            checkBreakCouplers.Checked                = Settings.BreakCouplers;
            checkCurveResistanceDependent.Checked     = Settings.CurveResistanceDependent;
            checkCurveSpeedDependent.Checked          = Settings.CurveSpeedDependent;
            checkTunnelResistanceDependent.Checked    = Settings.TunnelResistanceDependent;
            checkWindResistanceDependent.Checked      = Settings.WindResistanceDependent;
            checkOverrideNonElectrifiedRoutes.Checked = Settings.OverrideNonElectrifiedRoutes;
            checkHotStart.Checked = Settings.HotStart;
            checkForcedRedAtStationStops.Checked = !Settings.NoForcedRedAtStationStops;
            checkDoorsAITrains.Checked           = Settings.OpenDoorsInAITrains;

            // Keyboard tab
            InitializeKeyboardSettings();

            // DataLogger tab
            var dictionaryDataLoggerSeparator = new Dictionary <string, string>();

            dictionaryDataLoggerSeparator.Add("comma", catalog.GetString("comma"));
            dictionaryDataLoggerSeparator.Add("semicolon", catalog.GetString("semicolon"));
            dictionaryDataLoggerSeparator.Add("tab", catalog.GetString("tab"));
            dictionaryDataLoggerSeparator.Add("space", catalog.GetString("space"));
            comboDataLoggerSeparator.DataSource    = new BindingSource(dictionaryDataLoggerSeparator, null);
            comboDataLoggerSeparator.DisplayMember = "Value";
            comboDataLoggerSeparator.ValueMember   = "Key";
            comboDataLoggerSeparator.Text          = catalog.GetString(Settings.DataLoggerSeparator);
            var dictionaryDataLogSpeedUnits = new Dictionary <string, string>();

            dictionaryDataLogSpeedUnits.Add("route", catalog.GetString("route"));
            dictionaryDataLogSpeedUnits.Add("mps", catalog.GetString("m/s"));
            dictionaryDataLogSpeedUnits.Add("kmph", catalog.GetString("km/h"));
            dictionaryDataLogSpeedUnits.Add("mph", catalog.GetString("mph"));
            comboDataLogSpeedUnits.DataSource    = new BindingSource(dictionaryDataLogSpeedUnits, null);
            comboDataLogSpeedUnits.DisplayMember = "Value";
            comboDataLogSpeedUnits.ValueMember   = "Key";
            comboDataLogSpeedUnits.Text          = catalog.GetString(Settings.DataLogSpeedUnits);
            checkDataLogger.Checked                   = Settings.DataLogger;
            checkDataLogPerformance.Checked           = Settings.DataLogPerformance;
            checkDataLogPhysics.Checked               = Settings.DataLogPhysics;
            checkDataLogMisc.Checked                  = Settings.DataLogMisc;
            checkDataLogSteamPerformance.Checked      = Settings.DataLogSteamPerformance;
            checkVerboseConfigurationMessages.Checked = Settings.VerboseConfigurationMessages;

            // Evaluation tab
            checkDataLogTrainSpeed.Checked     = Settings.DataLogTrainSpeed;
            labelDataLogTSInterval.Enabled     = checkDataLogTrainSpeed.Checked;
            numericDataLogTSInterval.Enabled   = checkDataLogTrainSpeed.Checked;
            checkListDataLogTSContents.Enabled = checkDataLogTrainSpeed.Checked;
            numericDataLogTSInterval.Value     = Settings.DataLogTSInterval;
            checkListDataLogTSContents.Items.AddRange(new object[] {
                catalog.GetString("Time"),
                catalog.GetString("Train Speed"),
                catalog.GetString("Max. Speed"),
                catalog.GetString("Signal State"),
                catalog.GetString("Track Elevation"),
                catalog.GetString("Direction"),
                catalog.GetString("Control Mode"),
                catalog.GetString("Distance Travelled"),
                catalog.GetString("Throttle %"),
                catalog.GetString("Brake Cyl Press"),
                catalog.GetString("Dyn Brake %"),
                catalog.GetString("Gear Setting")
            });
            for (var i = 0; i < checkListDataLogTSContents.Items.Count; i++)
            {
                checkListDataLogTSContents.SetItemChecked(i, Settings.DataLogTSContents[i] == 1);
            }
            checkDataLogStationStops.Checked = Settings.DataLogStationStops;

            // Content tab
            bindingSourceContent.DataSource = (from folder in Settings.Folders.Folders
                                               orderby folder.Key
                                               select new ContentFolder()
            {
                Name = folder.Key, Path = folder.Value
            }).ToList();
            if (initialContentSetup)
            {
                tabOptions.SelectedTab      = tabPageContent;
                buttonContentBrowse.Enabled = false; // Initial state because browsing a null path leads to an exception
                try
                {
                    bindingSourceContent.Add(new ContentFolder()
                    {
                        Name = "Train Simulator", Path = MSTSPath.Base()
                    });
                }
                catch { }
            }

            // Updater tab
            var updateChannelNames = new Dictionary <string, string> {
                { "stable", catalog.GetString("Stable (recommended)") },
                { "testing", catalog.GetString("Testing") },
                { "unstable", catalog.GetString("Unstable") },
                { "", catalog.GetString("None") },
            };
            var updateChannelDescriptions = new Dictionary <string, string> {
                { "stable", catalog.GetString("Infrequent updates to official, hand-picked versions. Recommended for most users.") },
                { "testing", catalog.GetString("Weekly updates which may contain noticable defects. For project supporters.") },
                { "unstable", catalog.GetString("Daily updates which may contain serious defects. For developers only.") },
                { "", catalog.GetString("No updates.") },
            };
            var spacing = labelUpdateChannel.Margin.Size;
            var indent  = 20;
            var top     = labelUpdateChannel.Bottom + spacing.Height;

            foreach (var channel in UpdateManager.GetChannels())
            {
                var radio = new RadioButton()
                {
                    Text     = updateChannelNames[channel.ToLowerInvariant()],
                    Margin   = labelUpdateChannel.Margin,
                    Left     = spacing.Width,
                    Top      = top,
                    Checked  = updateManager.ChannelName.Equals(channel, StringComparison.InvariantCultureIgnoreCase),
                    AutoSize = true,
                    Tag      = channel,
                };
                tabPageUpdater.Controls.Add(radio);
                top += radio.Height + spacing.Height;
                var label = new Label()
                {
                    Text     = updateChannelDescriptions[channel.ToLowerInvariant()],
                    Margin   = labelUpdateChannel.Margin,
                    Left     = spacing.Width + indent,
                    Top      = top,
                    Width    = tabPageUpdater.ClientSize.Width - indent - spacing.Width * 2,
                    AutoSize = true,
                };
                tabPageUpdater.Controls.Add(label);
                top += label.Height + spacing.Height;
            }

            // Experimental tab
            numericUseSuperElevation.Value        = Settings.UseSuperElevation;
            numericSuperElevationMinLen.Value     = Settings.SuperElevationMinLen;
            numericSuperElevationGauge.Value      = Settings.SuperElevationGauge;
            checkPerformanceTuner.Checked         = Settings.PerformanceTuner;
            labelPerformanceTunerTarget.Enabled   = checkPerformanceTuner.Checked;
            numericPerformanceTunerTarget.Enabled = checkPerformanceTuner.Checked;
            numericPerformanceTunerTarget.Value   = Settings.PerformanceTunerTarget;
            trackLODBias.Value = Settings.LODBias;
            trackLODBias_ValueChanged(null, null);
            checkConditionalLoadOfNightTextures.Checked = Settings.ConditionalLoadOfDayOrNightTextures;
            checkSignalLightGlow.Checked         = Settings.SignalLightGlow;
            checkCircularSpeedGauge.Checked      = Settings.CircularSpeedGauge;
            checkLODViewingExtention.Checked     = Settings.LODViewingExtention;
            checkPreferDDSTexture.Checked        = Settings.PreferDDSTexture;
            checkUseLocationPassingPaths.Checked = Settings.UseLocationPassingPaths;
            checkUseMSTSEnv.Checked            = Settings.UseMSTSEnv;
            trackAdhesionFactor.Value          = Settings.AdhesionFactor;
            checkAdhesionPropToWeather.Checked = Settings.AdhesionProportionalToWeather;
            trackAdhesionFactorChange.Value    = Settings.AdhesionFactorChange;
            trackAdhesionFactor_ValueChanged(null, null);
            checkShapeWarnings.Checked   = !Settings.SuppressShapeWarnings;
            precipitationBoxHeight.Value = Settings.PrecipitationBoxHeight;
            precipitationBoxWidth.Value  = Settings.PrecipitationBoxWidth;
            precipitationBoxLength.Value = Settings.PrecipitationBoxLength;
            checkCorrectQuestionableBrakingParams.Checked = Settings.CorrectQuestionableBrakingParams;
            numericActRandomizationLevel.Value            = Settings.ActRandomizationLevel;
            numericActWeatherRandomizationLevel.Value     = Settings.ActWeatherRandomizationLevel;
        }
Example #60
0
        public WindTurbineRecipe()
        {
            this.Products = new CraftingElement[]
            {
                new CraftingElement <WindTurbineItem>(),
            };

            this.Ingredients = new CraftingElement[]
            {
                new CraftingElement <SteelItem>(typeof(MechanicsAssemblyEfficiencySkill), 50, MechanicsAssemblyEfficiencySkill.MultiplicativeStrategy),
                new CraftingElement <GearboxItem>(typeof(MechanicsAssemblyEfficiencySkill), 5, MechanicsAssemblyEfficiencySkill.MultiplicativeStrategy),
                new CraftingElement <CircuitItem>(typeof(MechanicsAssemblyEfficiencySkill), 10, MechanicsAssemblyEfficiencySkill.MultiplicativeStrategy),
                new CraftingElement <ReinforcedConcreteItem>(typeof(MechanicsAssemblyEfficiencySkill), 6, MechanicsAssemblyEfficiencySkill.MultiplicativeStrategy),
            };
            SkillModifiedValue value = new SkillModifiedValue(50, MechanicsAssemblySpeedSkill.MultiplicativeStrategy, typeof(MechanicsAssemblySpeedSkill), Localizer.Do("craft time"));

            SkillModifiedValueManager.AddBenefitForObject(typeof(WindTurbineRecipe), Item.Get <WindTurbineItem>().UILink(), value);
            SkillModifiedValueManager.AddSkillBenefit(Item.Get <WindTurbineItem>().UILink(), value);
            this.CraftMinutes = value;
            this.Initialize("Wind Turbine", typeof(WindTurbineRecipe));
            CraftingComponent.AddRecipe(typeof(MachineShopObject), this);
        }