mirror of
https://github.com/moonlight-stream/moonlight-ios.git
synced 2026-04-24 01:06:53 +00:00
Dark Mode & Stream Overlay [macOS] (#315)
* dark mode & stream overlay * removed all redundant imports * update for the new xcode version with fixes for the new 'implicitly retains self warning' * reworked the overlay view * cleaning up unused variables * small corrections
This commit is contained in:
committed by
Cameron Gutman
parent
74283a6763
commit
f759f719e6
15
Moonlight macOS/Network/NetworkTraffic.h
Normal file
15
Moonlight macOS/Network/NetworkTraffic.h
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// NetworkTraffic.h
|
||||
// Moonlight macOS
|
||||
//
|
||||
// Created by Felix Kratz on 28.03.18.
|
||||
// Copyright © 2018 Felix Kratz. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef NetworkTraffic_h
|
||||
#define NetworkTraffic_h
|
||||
|
||||
unsigned long getBytesDown(void);
|
||||
unsigned long getBytesUp(void);
|
||||
|
||||
#endif /* NetworkTraffic_h */
|
||||
50
Moonlight macOS/Network/NetworkTraffic.m
Normal file
50
Moonlight macOS/Network/NetworkTraffic.m
Normal file
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// NetworkTraffic.m
|
||||
// Moonlight macOS
|
||||
//
|
||||
// Created by Felix Kratz on 28.03.18.
|
||||
// Copyright © 2018 Felix Kratz. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NetworkTraffic.h"
|
||||
#include <ifaddrs.h>
|
||||
#include <net/if.h>
|
||||
|
||||
struct ifaddrs *ifap, *ifa;
|
||||
unsigned long da;
|
||||
|
||||
unsigned long getBytesDown() {
|
||||
da = 0;
|
||||
getifaddrs (&ifap);
|
||||
ifa = ifap;
|
||||
while (ifa != NULL) {
|
||||
if (ifa->ifa_addr->sa_family == AF_LINK) {
|
||||
const struct if_data *ifa_data = (struct if_data *)ifa->ifa_data;
|
||||
if (ifa_data != NULL) {
|
||||
da += ifa_data->ifi_ibytes;
|
||||
}
|
||||
}
|
||||
ifa = ifa->ifa_next;
|
||||
}
|
||||
|
||||
freeifaddrs(ifap);
|
||||
return da;
|
||||
}
|
||||
|
||||
unsigned long getBytesUp() {
|
||||
da = 0;
|
||||
getifaddrs (&ifap);
|
||||
ifa = ifap;
|
||||
while (ifa != NULL) {
|
||||
if (ifa->ifa_addr->sa_family == AF_LINK) {
|
||||
const struct if_data *ifa_data = (struct if_data *)ifa->ifa_data;
|
||||
if (ifa_data != NULL) {
|
||||
da += ifa_data->ifi_obytes;
|
||||
}
|
||||
}
|
||||
ifa = ifa->ifa_next;
|
||||
}
|
||||
|
||||
freeifaddrs(ifap);
|
||||
return da;
|
||||
}
|
||||
Reference in New Issue
Block a user