Skip to main content

Helper reference

Namespace: WebRadioFM.Helpers.

ApiSignatureHelper (static)​

CreateSignature(IDictionary<string,string> parameters, string secret)​

Public entry point. Sorts pairs by key, excludes keys containing format, concatenates key/value with no delimiters, appends secret, and returns lowercase MD5 hex.

MD5 implementation​

Private CreateMd5 UTF-8 encodes input and formats the 16-byte digest. ComputeMd5 implements RFC-style padding, 512-bit blocks, four rounds, and little-endian output. Private F, G, H, I, RL, FF, GG, HH, and II implement round functions/rotation.

No null checks are performed. A null parameters dictionary fails during enumeration, and a null key fails when the filter reaches Key.Contains. StringBuilder.Append treats a null secret or parameter value as an empty string.

SettingsManager (static)​

Typed facade over IsolatedStorageSettings.ApplicationSettings.

Scalar properties​

PropertyTypeDefaultSet constraint
ScrobblerEnabledbooltruenone
NowPlayingEnabledbooltruenone
ScrobbleDelaySecsint18030–360
ScrobbleDelayPercentint5030–95
MinTrackDurationint3010–60
FetchAlbumArtboolfalsenone
ThemeNamestringDefaultnone
ThemeIsDarkbooltruenone
LoveOnStartupboolfalsenone

Collection methods​

MethodDescription
GetRegexRules()Stored list or a new empty list
SaveRegexRules(List<MetadataEditRule>)Replaces stored regex list
GetSimpleEdits()Stored list or a new empty list
SaveSimpleEdits(List<MetadataEditRule>)Replaces literal list
GetBlockedTracks()Stored list or a new empty list
SaveBlockedTracks(List<string>)Replaces block list

Transformation methods​

string ApplyEdits(string text, string field)​

Applies matching (edit.Field == field || "all") literal replacements, then matching regex replacements. Regex exceptions are ignored. The method does not check MetadataEditRule.Enabled.

bool IsTrackBlocked(string artist, string track)​

Builds lowercase artist - track and returns true when it contains any lowercase block string. Null arguments or null entries are not guarded.

void UpgradeSettings()​

When SettingsVersion is absent, optionally migrates LastFmScrobblingEnabled, writes version 1, and saves.

Private generic Get<T> falls back on any exception. Set<T> writes/saves and suppresses any exception.

MetadataEditRule​

PropertyTypeDescription
Fieldstringtitle, artist, album, or all by convention
PatternstringLiteral text or regex
ReplacementstringReplacement text
EnabledboolDefaults true; not consulted during transformation
DescriptionstringOptional annotation; not exposed by current UI

Constructors:

  • parameterless, for serialization/object initialization;
  • (string field, string pattern, string replacement, string desc = ""), sets all core fields and enables rule.

ThemeInfo​

Plain theme definition:

PropertyTypeCurrent use
NamestringSettings list/lookup
AccentColorApplied accent
BackgroundColorDeclared but not read by manager
ForegroundColorDeclared but not read
SubtleColorDeclared but not read

ThemeManager (static)​

MemberDescription
ThemeNamesReturns a new list of names from the private catalog
CurrentThemeExact name match; falls back to first/Default
ApplyTheme()Writes accent and dark/light phone resources; dark mode also writes text styles
GetTextStyle(Color,double)Private helper creating a TextBlock style with foreground/font size

The private theme catalog contains ten entries.

BoolToVisibilityConverter : IValueConverter​

  • Convert: casts input to bool; true → Visible, false → Collapsed.
  • ConvertBack: casts input to Visibility; Visible → true.

InverseBoolToVisibilityConverter : IValueConverter​

  • Convert: true → Collapsed, false → Visible.
  • ConvertBack: every visibility other than Visible → true.

Both converters ignore targetType, parameter, and culture and perform direct casts.