PC Uptime

This commit is contained in:
Natsumi
2022-04-21 00:54:49 +12:00
parent 6921c17ef7
commit 5d50150ad7
5 changed files with 33 additions and 8 deletions
+9
View File
@@ -425,6 +425,15 @@ namespace VRCX
WinformThemer.DoFunny(); WinformThemer.DoFunny();
} }
public double GetUptime()
{
using (var uptime = new PerformanceCounter("System", "System Up Time"))
{
uptime.NextValue();
return TimeSpan.FromSeconds(uptime.NextValue()).TotalMilliseconds;
}
}
public void SetStartup(bool enabled) public void SetStartup(bool enabled)
{ {
try try
+9 -8
View File
@@ -10427,11 +10427,10 @@ speechSynthesis.getVoices();
this.favoriteAvatarsSorted.push(ctx); this.favoriteAvatarsSorted.push(ctx);
this.sortFavoriteAvatars = true; this.sortFavoriteAvatars = true;
} }
} else { } else if (type === 'friend') {
if (type === 'friend') { this.favoriteFriends_.push(ctx);
this.favoriteFriends_.push(ctx); this.favoriteFriendsSorted.push(ctx);
this.favoriteFriendsSorted.push(ctx); this.sortFavoriteFriends = true;
this.sortFavoriteFriends = true;
} else if (type === 'world') { } else if (type === 'world') {
this.favoriteWorlds_.push(ctx); this.favoriteWorlds_.push(ctx);
this.favoriteWorldsSorted.push(ctx); this.favoriteWorldsSorted.push(ctx);
@@ -10439,8 +10438,7 @@ speechSynthesis.getVoices();
} else if (type === 'avatar') { } else if (type === 'avatar') {
this.favoriteAvatars_.push(ctx); this.favoriteAvatars_.push(ctx);
this.favoriteAvatarsSorted.push(ctx); this.favoriteAvatarsSorted.push(ctx);
this.sortFavoriteAvatars = true; this.sortFavoriteAvatars = true;
}
} }
} }
} else if (typeof ctx !== 'undefined') { } else if (typeof ctx !== 'undefined') {
@@ -11284,6 +11282,7 @@ speechSynthesis.getVoices();
$app.data.hideUptimeFromFeed = configRepository.getBool( $app.data.hideUptimeFromFeed = configRepository.getBool(
'VRCX_hideUptimeFromFeed' 'VRCX_hideUptimeFromFeed'
); );
$app.data.pcUptimeOnFeed = configRepository.getBool('VRCX_pcUptimeOnFeed');
$app.data.overlayNotifications = configRepository.getBool( $app.data.overlayNotifications = configRepository.getBool(
'VRCX_overlayNotifications' 'VRCX_overlayNotifications'
); );
@@ -11361,6 +11360,7 @@ speechSynthesis.getVoices();
'VRCX_hideUptimeFromFeed', 'VRCX_hideUptimeFromFeed',
this.hideUptimeFromFeed this.hideUptimeFromFeed
); );
configRepository.setBool('VRCX_pcUptimeOnFeed', this.pcUptimeOnFeed);
configRepository.setBool( configRepository.setBool(
'VRCX_overlayNotifications', 'VRCX_overlayNotifications',
this.overlayNotifications this.overlayNotifications
@@ -11819,7 +11819,8 @@ speechSynthesis.getVoices();
notificationTimeout: this.notificationTimeout, notificationTimeout: this.notificationTimeout,
notificationTheme, notificationTheme,
backgroundEnabled: this.vrBackgroundEnabled, backgroundEnabled: this.vrBackgroundEnabled,
dtHour12: this.dtHour12 dtHour12: this.dtHour12,
pcUptimeOnFeed: this.pcUptimeOnFeed
}; };
var json = JSON.stringify(VRConfigVars); var json = JSON.stringify(VRConfigVars);
AppApi.ExecuteVrFeedFunction('configUpdate', json); AppApi.ExecuteVrFeedFunction('configUpdate', json);
+3
View File
@@ -1080,6 +1080,9 @@ html
div.options-container-item div.options-container-item
span.name Hide Uptime span.name Hide Uptime
el-switch(v-model="hideUptimeFromFeed" @change="saveOpenVROption" :disabled="!openVR || !overlayWrist") el-switch(v-model="hideUptimeFromFeed" @change="saveOpenVROption" :disabled="!openVR || !overlayWrist")
div.options-container-item
span.name Show PC Uptime
el-switch(v-model="pcUptimeOnFeed" @change="saveOpenVROption" :disabled="!openVR || !overlayWrist")
div.options-container-item div.options-container-item
el-button(size="small" icon="el-icon-notebook-2" @click="showWristFeedFiltersDialog" :disabled="!openVR || !overlayWrist") Wrist Feed Filters el-button(size="small" icon="el-icon-notebook-2" @click="showWristFeedFiltersDialog" :disabled="!openVR || !overlayWrist") Wrist Feed Filters
br br
+8
View File
@@ -161,6 +161,7 @@ Vue.component('marquee-text', MarqueeText);
appType: location.href.substr(-1), appType: location.href.substr(-1),
currentTime: new Date().toJSON(), currentTime: new Date().toJSON(),
cpuUsage: 0, cpuUsage: 0,
pcUptime: '',
config: {}, config: {},
photonLobbyBotSize: 0, photonLobbyBotSize: 0,
onlineFriendCount: 0, onlineFriendCount: 0,
@@ -364,6 +365,13 @@ Vue.component('marquee-text', MarqueeText);
} else { } else {
this.devices = ''; this.devices = '';
} }
if (this.config.pcUptimeOnFeed) {
AppApi.GetUptime().then((uptime) => {
this.pcUptime = timeToText(uptime);
});
} else {
this.pcUptime = '';
}
} catch (err) { } catch (err) {
console.error(err); console.error(err);
} }
+4
View File
@@ -403,6 +403,8 @@ html
span(style="float:right") {{ lastLocationTimer }} span(style="float:right") {{ lastLocationTimer }}
template(v-if="onlineForTimer") template(v-if="onlineForTimer")
| / {{ onlineForTimer }} | / {{ onlineForTimer }}
template(v-if="pcUptime")
| / {{ pcUptime }}
span(style="display:inline-block") {{ lastLocation.playerList.length }} span(style="display:inline-block") {{ lastLocation.playerList.length }}
span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? ` (${lastLocation.friendList.length})` : ''}} span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? ` (${lastLocation.friendList.length})` : ''}}
span(v-if="photonLobbyBotSize > 0 && lastLocation.playerList.length > 0" style="display:inline-block;color:red;margin-left:5px") {{ photonLobbyBotSize }} span(v-if="photonLobbyBotSize > 0 && lastLocation.playerList.length > 0" style="display:inline-block;color:red;margin-left:5px") {{ photonLobbyBotSize }}
@@ -410,6 +412,8 @@ html
span(style="float:right") Timer: {{ lastLocationTimer }} span(style="float:right") Timer: {{ lastLocationTimer }}
template(v-if="onlineForTimer") template(v-if="onlineForTimer")
| / {{ onlineForTimer }} | / {{ onlineForTimer }}
template(v-if="pcUptime")
| / {{ pcUptime }}
span(style="display:inline-block") Players: {{ lastLocation.playerList.length }} span(style="display:inline-block") Players: {{ lastLocation.playerList.length }}
span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? ` (${lastLocation.friendList.length})` : ''}} span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? ` (${lastLocation.friendList.length})` : ''}}
span(v-if="photonLobbyBotSize > 0 && lastLocation.playerList.length > 0" style="display:inline-block;color:red;margin-left:5px") {{ photonLobbyBotSize }} span(v-if="photonLobbyBotSize > 0 && lastLocation.playerList.length > 0" style="display:inline-block;color:red;margin-left:5px") {{ photonLobbyBotSize }}