mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 22:46:06 +02:00
Option to copy VRC images
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
@@ -453,7 +454,11 @@ namespace VRCX
|
|||||||
MainForm.Instance.BeginInvoke(new MethodInvoker(() =>
|
MainForm.Instance.BeginInvoke(new MethodInvoker(() =>
|
||||||
{
|
{
|
||||||
var image = Image.FromFile(path);
|
var image = Image.FromFile(path);
|
||||||
Clipboard.SetImage(image);
|
// Clipboard.SetImage(image);
|
||||||
|
var data = new DataObject();
|
||||||
|
data.SetData(DataFormats.Bitmap, image);
|
||||||
|
data.SetFileDropList(new StringCollection { path });
|
||||||
|
Clipboard.SetDataObject(data, true);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ namespace VRCX
|
|||||||
/// <param name="metadataString">The metadata to add to the screenshot file.</param>
|
/// <param name="metadataString">The metadata to add to the screenshot file.</param>
|
||||||
/// <param name="worldId">The ID of the world to associate with the screenshot.</param>
|
/// <param name="worldId">The ID of the world to associate with the screenshot.</param>
|
||||||
/// <param name="changeFilename">Whether or not to rename the screenshot file to include the world ID.</param>
|
/// <param name="changeFilename">Whether or not to rename the screenshot file to include the world ID.</param>
|
||||||
public void AddScreenshotMetadata(string path, string metadataString, string worldId, bool changeFilename = false)
|
public string AddScreenshotMetadata(string path, string metadataString, string worldId, bool changeFilename = false)
|
||||||
{
|
{
|
||||||
var fileName = Path.GetFileNameWithoutExtension(path);
|
var fileName = Path.GetFileNameWithoutExtension(path);
|
||||||
if (!File.Exists(path) || !path.EndsWith(".png") || !fileName.StartsWith("VRChat_"))
|
if (!File.Exists(path) || !path.EndsWith(".png") || !fileName.StartsWith("VRChat_"))
|
||||||
return;
|
return string.Empty;
|
||||||
|
|
||||||
if (changeFilename)
|
if (changeFilename)
|
||||||
{
|
{
|
||||||
@@ -34,6 +34,7 @@ namespace VRCX
|
|||||||
}
|
}
|
||||||
|
|
||||||
ScreenshotHelper.WritePNGDescription(path, metadataString);
|
ScreenshotHelper.WritePNGDescription(path, metadataString);
|
||||||
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
+47
-30
@@ -10155,9 +10155,6 @@ speechSynthesis.getVoices();
|
|||||||
database.addGamelogResourceLoadToDatabase(entry);
|
database.addGamelogResourceLoadToDatabase(entry);
|
||||||
break;
|
break;
|
||||||
case 'screenshot':
|
case 'screenshot':
|
||||||
if (!this.screenshotHelper) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// var entry = {
|
// var entry = {
|
||||||
// created_at: gameLog.dt,
|
// created_at: gameLog.dt,
|
||||||
// type: 'Event',
|
// type: 'Event',
|
||||||
@@ -10167,33 +10164,8 @@ speechSynthesis.getVoices();
|
|||||||
// )}`
|
// )}`
|
||||||
// };
|
// };
|
||||||
// database.addGamelogEventToDatabase(entry);
|
// database.addGamelogEventToDatabase(entry);
|
||||||
var location = API.parseLocation(this.lastLocation.location);
|
|
||||||
var metadata = {
|
this.processScreenshot(gameLog.screenshotPath);
|
||||||
application: 'VRCX',
|
|
||||||
version: 1,
|
|
||||||
author: {
|
|
||||||
id: API.currentUser.id,
|
|
||||||
displayName: API.currentUser.displayName
|
|
||||||
},
|
|
||||||
world: {
|
|
||||||
name: this.lastLocation.name,
|
|
||||||
id: location.worldId,
|
|
||||||
instanceId: this.lastLocation.location
|
|
||||||
},
|
|
||||||
players: []
|
|
||||||
};
|
|
||||||
for (var user of this.lastLocation.playerList.values()) {
|
|
||||||
metadata.players.push({
|
|
||||||
id: user.userId,
|
|
||||||
displayName: user.displayName
|
|
||||||
});
|
|
||||||
}
|
|
||||||
AppApi.AddScreenshotMetadata(
|
|
||||||
gameLog.screenshotPath,
|
|
||||||
JSON.stringify(metadata),
|
|
||||||
location.worldId,
|
|
||||||
this.screenshotHelperModifyFilename
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
case 'api-request':
|
case 'api-request':
|
||||||
var bias = Date.parse(gameLog.dt) + 60 * 1000;
|
var bias = Date.parse(gameLog.dt) + 60 * 1000;
|
||||||
@@ -15127,6 +15099,11 @@ speechSynthesis.getVoices();
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$app.data.screenshotHelperCopyToClipboard = await configRepository.getBool(
|
||||||
|
'VRCX_screenshotHelperCopyToClipboard',
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
$app.data.enableAppLauncher = await configRepository.getBool(
|
$app.data.enableAppLauncher = await configRepository.getBool(
|
||||||
'VRCX_enableAppLauncher',
|
'VRCX_enableAppLauncher',
|
||||||
true
|
true
|
||||||
@@ -22723,6 +22700,46 @@ speechSynthesis.getVoices();
|
|||||||
'VRCX_screenshotHelperModifyFilename',
|
'VRCX_screenshotHelperModifyFilename',
|
||||||
this.screenshotHelperModifyFilename
|
this.screenshotHelperModifyFilename
|
||||||
);
|
);
|
||||||
|
await configRepository.setBool(
|
||||||
|
'VRCX_screenshotHelperCopyToClipboard',
|
||||||
|
this.screenshotHelperCopyToClipboard
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
$app.methods.processScreenshot = async function (path) {
|
||||||
|
var newPath = path;
|
||||||
|
if (this.screenshotHelper) {
|
||||||
|
var location = API.parseLocation(this.lastLocation.location);
|
||||||
|
var metadata = {
|
||||||
|
application: 'VRCX',
|
||||||
|
version: 1,
|
||||||
|
author: {
|
||||||
|
id: API.currentUser.id,
|
||||||
|
displayName: API.currentUser.displayName
|
||||||
|
},
|
||||||
|
world: {
|
||||||
|
name: this.lastLocation.name,
|
||||||
|
id: location.worldId,
|
||||||
|
instanceId: this.lastLocation.location
|
||||||
|
},
|
||||||
|
players: []
|
||||||
|
};
|
||||||
|
for (var user of this.lastLocation.playerList.values()) {
|
||||||
|
metadata.players.push({
|
||||||
|
id: user.userId,
|
||||||
|
displayName: user.displayName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
newPath = await AppApi.AddScreenshotMetadata(
|
||||||
|
path,
|
||||||
|
JSON.stringify(metadata),
|
||||||
|
location.worldId,
|
||||||
|
this.screenshotHelperModifyFilename
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (this.screenshotHelperCopyToClipboard) {
|
||||||
|
await AppApi.CopyImageToClipboard(newPath);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$app.methods.getAndDisplayScreenshot = function (
|
$app.methods.getAndDisplayScreenshot = function (
|
||||||
|
|||||||
@@ -425,7 +425,8 @@
|
|||||||
"description_tooltip": "Unfortunately, windows doesn't support viewing PNG text chunks(few things do) natively, but you can view it using a command-line tool like exiftool, a png chunk inspector, or a hex editor.",
|
"description_tooltip": "Unfortunately, windows doesn't support viewing PNG text chunks(few things do) natively, but you can view it using a command-line tool like exiftool, a png chunk inspector, or a hex editor.",
|
||||||
"enable": "Enable",
|
"enable": "Enable",
|
||||||
"modify_filename": "Modify Filename",
|
"modify_filename": "Modify Filename",
|
||||||
"modify_filename_tooltip": "Will add the World ID to screenshot filename, in addition to file metadata."
|
"modify_filename_tooltip": "Will add the World ID to screenshot filename, in addition to file metadata.",
|
||||||
|
"copy_to_clipboard": "Copy to Clipboard"
|
||||||
},
|
},
|
||||||
"app_launcher": {
|
"app_launcher": {
|
||||||
"header": "App Launcher",
|
"header": "App Launcher",
|
||||||
|
|||||||
@@ -445,7 +445,10 @@ mixin settingsTab()
|
|||||||
span.name {{ $t('view.settings.advanced.advanced.screenshot_helper.modify_filename') }}
|
span.name {{ $t('view.settings.advanced.advanced.screenshot_helper.modify_filename') }}
|
||||||
el-tooltip(placement="top" style="margin-left:5px" :content="$t('view.settings.advanced.advanced.screenshot_helper.modify_filename_tooltip')")
|
el-tooltip(placement="top" style="margin-left:5px" :content="$t('view.settings.advanced.advanced.screenshot_helper.modify_filename_tooltip')")
|
||||||
i.el-icon-info
|
i.el-icon-info
|
||||||
el-switch(v-model="screenshotHelperModifyFilename" @change="saveScreenshotHelper")
|
el-switch(v-model="screenshotHelperModifyFilename" @change="saveScreenshotHelper" :disabled="!screenshotHelper")
|
||||||
|
div.options-container-item
|
||||||
|
span.name {{ $t('view.settings.advanced.advanced.screenshot_helper.copy_to_clipboard') }}
|
||||||
|
el-switch(v-model="screenshotHelperCopyToClipboard" @change="saveScreenshotHelper")
|
||||||
//- Advanced | YouTube API
|
//- Advanced | YouTube API
|
||||||
div.options-container
|
div.options-container
|
||||||
span.header {{ $t('view.settings.advanced.advanced.youtube_api.header') }}
|
span.header {{ $t('view.settings.advanced.advanced.youtube_api.header') }}
|
||||||
|
|||||||
Reference in New Issue
Block a user