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

View File

@@ -425,6 +425,15 @@ namespace VRCX
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)
{
try

View File

@@ -10427,11 +10427,10 @@ speechSynthesis.getVoices();
this.favoriteAvatarsSorted.push(ctx);
this.sortFavoriteAvatars = true;
}
} else {
if (type === 'friend') {
this.favoriteFriends_.push(ctx);
this.favoriteFriendsSorted.push(ctx);
this.sortFavoriteFriends = true;
} else if (type === 'friend') {
this.favoriteFriends_.push(ctx);
this.favoriteFriendsSorted.push(ctx);
this.sortFavoriteFriends = true;
} else if (type === 'world') {
this.favoriteWorlds_.push(ctx);
this.favoriteWorldsSorted.push(ctx);
@@ -10439,8 +10438,7 @@ speechSynthesis.getVoices();
} else if (type === 'avatar') {
this.favoriteAvatars_.push(ctx);
this.favoriteAvatarsSorted.push(ctx);
this.sortFavoriteAvatars = true;
}
this.sortFavoriteAvatars = true;
}
}
} else if (typeof ctx !== 'undefined') {
@@ -11284,6 +11282,7 @@ speechSynthesis.getVoices();
$app.data.hideUptimeFromFeed = configRepository.getBool(
'VRCX_hideUptimeFromFeed'
);
$app.data.pcUptimeOnFeed = configRepository.getBool('VRCX_pcUptimeOnFeed');
$app.data.overlayNotifications = configRepository.getBool(
'VRCX_overlayNotifications'
);
@@ -11361,6 +11360,7 @@ speechSynthesis.getVoices();
'VRCX_hideUptimeFromFeed',
this.hideUptimeFromFeed
);
configRepository.setBool('VRCX_pcUptimeOnFeed', this.pcUptimeOnFeed);
configRepository.setBool(
'VRCX_overlayNotifications',
this.overlayNotifications
@@ -11819,7 +11819,8 @@ speechSynthesis.getVoices();
notificationTimeout: this.notificationTimeout,
notificationTheme,
backgroundEnabled: this.vrBackgroundEnabled,
dtHour12: this.dtHour12
dtHour12: this.dtHour12,
pcUptimeOnFeed: this.pcUptimeOnFeed
};
var json = JSON.stringify(VRConfigVars);
AppApi.ExecuteVrFeedFunction('configUpdate', json);

View File

@@ -1080,6 +1080,9 @@ html
div.options-container-item
span.name Hide Uptime
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
el-button(size="small" icon="el-icon-notebook-2" @click="showWristFeedFiltersDialog" :disabled="!openVR || !overlayWrist") Wrist Feed Filters
br

View File

@@ -161,6 +161,7 @@ Vue.component('marquee-text', MarqueeText);
appType: location.href.substr(-1),
currentTime: new Date().toJSON(),
cpuUsage: 0,
pcUptime: '',
config: {},
photonLobbyBotSize: 0,
onlineFriendCount: 0,
@@ -364,6 +365,13 @@ Vue.component('marquee-text', MarqueeText);
} else {
this.devices = '';
}
if (this.config.pcUptimeOnFeed) {
AppApi.GetUptime().then((uptime) => {
this.pcUptime = timeToText(uptime);
});
} else {
this.pcUptime = '';
}
} catch (err) {
console.error(err);
}

View File

@@ -403,6 +403,8 @@ html
span(style="float:right") {{ lastLocationTimer }}
template(v-if="onlineForTimer")
| / {{ onlineForTimer }}
template(v-if="pcUptime")
| / {{ pcUptime }}
span(style="display:inline-block") {{ lastLocation.playerList.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 }}
@@ -410,6 +412,8 @@ html
span(style="float:right") Timer: {{ lastLocationTimer }}
template(v-if="onlineForTimer")
| / {{ onlineForTimer }}
template(v-if="pcUptime")
| / {{ pcUptime }}
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(v-if="photonLobbyBotSize > 0 && lastLocation.playerList.length > 0" style="display:inline-block;color:red;margin-left:5px") {{ photonLobbyBotSize }}