mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-30 20:24:25 +00:00
* [Packages] Updated packages * [Sonarr/Series] Switched to bottom navigation, removed sliver app bar * [Sonarr/Series] Removed bottom padding from overview * [README] Added AltStore, Removed Feedback, Updated Android APK Build (#213) * [Snackbar] Fixed cases where iOS swipe-back would lock UI * [Android/Back Button] Back button now shows drawer on primary routes instead of closing app * [Wake on LAN] Added configuration to hive * [Settings/Modules] Added Wake on LAN section * [Wake on LAN] Added entry to drawer * [Lidarr/Details] Removed sliver app bar, removed fanart, switched to bottom navigation bar * [Radarr/Details] Removed sliver app bar, removed fanart, switched to bottom navigation bar * [Wake on LAN] Show toast on action * [Wake on LAN] Created RawDatagramSocket binding * [WoL] Full support for Wake on LAN functionality * [Semantics] Cleanup * [TestFlight] v2.3.0 (230002) * [Settings/Modules] Implemented settings UI for custom headers * [Custom Headers] Finished UI implementation * [Custom Headers] Integrated into API calls * [TestFlight] v2.3.0 (230003) * [Images] Attach custom headers to all network image requests * [Everything] Many Changes (Read Notes) (#218) - Unified the structure of each module (core, routes, widgets at the root of every module) - Cleaned Most Remaining Dialogs (SABnzbd and NZBGet remain) - Reduced font-size across dialogs - Unified padding across all dialogs (that have been cleaned so far) - Changelog is now a routed page, not a dialog prompt - SABnzbd: Fixed bug where setting priority to "stop" would cause a fatal crash * [Networking] Added RegExp Validation for IPv4 & MAC Addresses * [Networking] Improved network address classes * Finished Dialog Rework * [TestFlight] v2.3.0 (230004) * [README] Updated README for v2.3.0
24 lines
880 B
Dart
24 lines
880 B
Dart
import 'package:convert/convert.dart';
|
|
|
|
class MacAddress {
|
|
static const String _REGEX = r"^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$";
|
|
final String _address;
|
|
|
|
MacAddress._internal(this._address);
|
|
factory MacAddress.from(String address) {
|
|
if(!MacAddress.validate(address)) throw FormatException('Not a valid MAC address string');
|
|
return MacAddress._internal(address);
|
|
}
|
|
|
|
String get address => _address;
|
|
List<int> get bytes => _getBytes();
|
|
|
|
//Parse the address string and returns an int array list of 6 values, each containing one block of the
|
|
List<int> _getBytes() => _address.split(":").map((octet) => hex.decode(octet)[0]).toList();
|
|
|
|
/// Validate that a MAC address has been formatted correctly
|
|
static bool validate(String address) {
|
|
RegExp exp = new RegExp(_REGEX);
|
|
return exp.hasMatch(address);
|
|
}
|
|
} |