Skip to content
This repository has been archived by the owner on Mar 2, 2024. It is now read-only.

Commit

Permalink
fix: escape
Browse files Browse the repository at this point in the history
  • Loading branch information
rassi0429 committed Jun 13, 2022
1 parent 4a2c850 commit b9be339
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions SaveExif/SaveExif.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class SaveExif : NeosMod
{
public override string Name => "SaveExif";
public override string Author => "kka429";
public override string Version => "1.0.0";
public override string Version => "1.0.1";
public override string Link => "https://github.com/rassi0429/SaveExif"; // this line is optional and can be omitted

// Exif Type: https://github.com/mono/libgdiplus/blob/main/src/gdiplusimaging.h
Expand Down Expand Up @@ -104,30 +104,31 @@ static bool Prefix(bool ___keepOriginalScreenshotFormat, WindowsPlatformConnecto

var locationName = Engine.Current.WorldManager.FocusedWorld.GetSessionInfo().Name;
var locationUrl = Engine.Current.WorldManager.FocusedWorld.IsPublic ? Engine.Current.WorldManager.FocusedWorld.CorrespondingRecord?.URL.ToString() : "private";
var hostUserId = Engine.Current.WorldManager.FocusedWorld.HostUser.UserID;
locationUrl = locationUrl == null ? "" : locationUrl;
var hostUserId = (Engine.Current.WorldManager.FocusedWorld.HostUser.UserID == null ? "" : Engine.Current.WorldManager.FocusedWorld.HostUser.UserID);
var hostUserName = Engine.Current.WorldManager.FocusedWorld.HostUser.UserName;
var timeTaken = timestamp.ToString();
var takeUserId = Engine.Current.WorldManager.FocusedWorld.LocalUser.UserID;
var takeUserId = (Engine.Current.WorldManager.FocusedWorld.LocalUser.UserID == null ? "" : Engine.Current.WorldManager.FocusedWorld.LocalUser.UserID);
var takeUserName = Engine.Current.WorldManager.FocusedWorld.LocalUser.UserName;
var neosVersion = Engine.Version.ToString();
var _presentUser = Engine.Current.WorldManager.FocusedWorld.AllUsers;
List<string> presentUserIdArray = new List<string>();
List<string> presentUserNameArray = new List<string>();
foreach(var user in _presentUser)
{
presentUserIdArray.Add(user.UserID);
presentUserNameArray.Add(user.UserName);
presentUserIdArray.Add(user.UserID?.Replace("\\", "\\\\").Replace("\"", "\\\""));
presentUserNameArray.Add(user.UserName.Replace("\\", "\\\\").Replace("\"", "\\\""));
}

string str = $"{{\"locationName\":\"{locationName}\",\n" +
$"\"locationUrl\":\"{locationUrl}\",\n" +
$"\"hostUserId\":\"{hostUserId}\",\n" +
$"\"hostUserName\":\"{hostUserName}\",\n" +
$"\"timeTaken\":\"{timeTaken}\",\n" +
$"\"takeUserId\":\"{takeUserId}\",\n" +
$"\"takeUserName\":\"{takeUserName}\",\n" +
$"\"neosVersion\":\"{neosVersion}\",\n" +
$"\"takeUserName\":\"{takeUserName}\",\n" +
string str = $"{{\"locationName\":\"{locationName?.Replace("\\", "\\\\").Replace("\"", "\\\"")}\",\n" +
$"\"locationUrl\":\"{locationUrl?.Replace("\\", "\\\\").Replace("\"", "\\\"")}\",\n" +
$"\"hostUserId\":\"{hostUserId?.Replace("\\", "\\\\").Replace("\"", "\\\"")}\",\n" +
$"\"hostUserName\":\"{hostUserName?.Replace("\\", "\\\\").Replace("\"", "\\\"")}\",\n" +
$"\"timeTaken\":\"{timeTaken?.Replace("\\", "\\\\").Replace("\"", "\\\"")}\",\n" +
$"\"takeUserId\":\"{takeUserId?.Replace("\\", "\\\\").Replace("\"", "\\\"")}\",\n" +
$"\"takeUserName\":\"{takeUserName?.Replace("\\", "\\\\").Replace("\"", "\\\"")}\",\n" +
$"\"neosVersion\":\"{neosVersion?.Replace("\\", "\\\\").Replace("\"", "\\\"")}\",\n" +
$"\"takeUserName\":\"{takeUserName?.Replace("\\", "\\\\").Replace("\"", "\\\"")}\",\n" +
$"\"presentUserIdArray\":[\"{String.Join("\",\"", presentUserIdArray)}\"],\n" +
$"\"presentUserNameArray\":[\"{String.Join("\",\"", presentUserNameArray)}\"],\n" +
$"\"version\":\"1.0.0\"}}";
Expand Down

0 comments on commit b9be339

Please sign in to comment.