public SimpleHexEditor(byte[] originalBytes) { InitializeComponent(); WinFormsTranslator.TranslateInterface(this, WinFormsTranslator.CurrentLanguage); RTB_RAM.Text = string.Join(" ", originalBytes.Select(z => $"{z:X2}")); Bytes = originalBytes; }
private void EditSettingsProperties(object _settings) { var lang = WinFormsTranslator.CurrentLanguage; var translation = WinFormsTranslator.GetContext(lang); var ctd = new PropertyOverridingTypeDescriptor(TypeDescriptor.GetProvider(_settings).GetTypeDescriptor(_settings)); foreach (var pd in TypeDescriptor.GetProperties(_settings).OfType <PropertyDescriptor>()) { var s = Array.Find(settings, z => z.SettingName == pd.Name); if (s == null) { continue; } var desc = "Property Description needs to be defined. Please raise this issue on GitHub or at the discord: https://discord.gg/tDMvSRv"; if (s.Description != null) { desc = translation.GetTranslatedText($"{s.SettingName}_description", s.Description); } var category = "Uncategorized Settings"; if (s.Category != null) { category = translation.GetTranslatedText($"{s.SettingName}_category", s.Category); } PropertyDescriptor pd2 = TypeDescriptor.CreateProperty(_settings.GetType(), pd, new DescriptionAttribute(desc), new CategoryAttribute(category)); ctd.OverrideProperty(pd2); } TypeDescriptor.AddProvider(new TypeDescriptorOverridingProvider(ctd), _settings); }
public ALMSettings(object obj) { InitializeComponent(); PG_Settings.SelectedObject = obj; WinFormsTranslator.TranslateInterface(this, WinFormsTranslator.CurrentLanguage); this.CenterToForm(FindForm()); }