mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-25 17:53:48 +02:00
cleanup
This commit is contained in:
35
AppApi.cs
35
AppApi.cs
@@ -59,8 +59,11 @@ namespace VRCX
|
|||||||
public string MD5File(string Blob)
|
public string MD5File(string Blob)
|
||||||
{
|
{
|
||||||
var fileData = Convert.FromBase64CharArray(Blob.ToCharArray(), 0, Blob.Length);
|
var fileData = Convert.FromBase64CharArray(Blob.ToCharArray(), 0, Blob.Length);
|
||||||
var md5 = MD5.Create().ComputeHash(fileData);
|
using (var md5 = MD5.Create())
|
||||||
return Convert.ToBase64String(md5);
|
{
|
||||||
|
var md5Hash = md5.ComputeHash(fileData);
|
||||||
|
return Convert.ToBase64String(md5Hash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -71,11 +74,13 @@ namespace VRCX
|
|||||||
public string SignFile(string Blob)
|
public string SignFile(string Blob)
|
||||||
{
|
{
|
||||||
var fileData = Convert.FromBase64CharArray(Blob.ToCharArray(), 0, Blob.Length);
|
var fileData = Convert.FromBase64CharArray(Blob.ToCharArray(), 0, Blob.Length);
|
||||||
var sig = Librsync.ComputeSignature(new MemoryStream(fileData));
|
using (var sig = Librsync.ComputeSignature(new MemoryStream(fileData)))
|
||||||
var memoryStream = new MemoryStream();
|
using (var memoryStream = new MemoryStream())
|
||||||
sig.CopyTo(memoryStream);
|
{
|
||||||
var sigBytes = memoryStream.ToArray();
|
sig.CopyTo(memoryStream);
|
||||||
return Convert.ToBase64String(sigBytes);
|
var sigBytes = memoryStream.ToArray();
|
||||||
|
return Convert.ToBase64String(sigBytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -85,7 +90,7 @@ namespace VRCX
|
|||||||
/// <returns>The length of the file in bytes.</returns>
|
/// <returns>The length of the file in bytes.</returns>
|
||||||
public string FileLength(string Blob)
|
public string FileLength(string Blob)
|
||||||
{
|
{
|
||||||
var fileData = Convert.FromBase64CharArray(Blob.ToCharArray(), 0, Blob.Length);
|
var fileData = Convert.FromBase64String(Blob);
|
||||||
return fileData.Length.ToString();
|
return fileData.Length.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +104,7 @@ namespace VRCX
|
|||||||
var configFile = Path.Combine(logPath, @"config.json");
|
var configFile = Path.Combine(logPath, @"config.json");
|
||||||
if (!Directory.Exists(logPath) || !File.Exists(configFile))
|
if (!Directory.Exists(logPath) || !File.Exists(configFile))
|
||||||
{
|
{
|
||||||
return "";
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
var json = File.ReadAllText(configFile);
|
var json = File.ReadAllText(configFile);
|
||||||
@@ -404,7 +409,7 @@ namespace VRCX
|
|||||||
Icon = Image;
|
Icon = Image;
|
||||||
}
|
}
|
||||||
|
|
||||||
var broadcastIP = IPAddress.Parse("127.0.0.1");
|
var broadcastIP = IPAddress.Loopback;
|
||||||
var broadcastSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
var broadcastSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
|
||||||
var endPoint = new IPEndPoint(broadcastIP, 42069);
|
var endPoint = new IPEndPoint(broadcastIP, 42069);
|
||||||
|
|
||||||
@@ -415,7 +420,7 @@ namespace VRCX
|
|||||||
msg.height = 110f;
|
msg.height = 110f;
|
||||||
msg.sourceApp = "VRCX";
|
msg.sourceApp = "VRCX";
|
||||||
msg.timeout = Timeout;
|
msg.timeout = Timeout;
|
||||||
msg.audioPath = "";
|
msg.audioPath = string.Empty;
|
||||||
msg.useBase64Icon = UseBase64Icon;
|
msg.useBase64Icon = UseBase64Icon;
|
||||||
msg.icon = Icon;
|
msg.icon = Icon;
|
||||||
|
|
||||||
@@ -430,9 +435,11 @@ namespace VRCX
|
|||||||
public void DownloadVRCXUpdate(string url)
|
public void DownloadVRCXUpdate(string url)
|
||||||
{
|
{
|
||||||
var Location = Path.Combine(Program.AppDataDirectory, "update.exe");
|
var Location = Path.Combine(Program.AppDataDirectory, "update.exe");
|
||||||
var client = new WebClient();
|
using (var client = new WebClient())
|
||||||
client.Headers.Add("user-agent", Program.Version);
|
{
|
||||||
client.DownloadFile(new Uri(url), Location);
|
client.Headers.Add("user-agent", Program.Version);
|
||||||
|
client.DownloadFile(new Uri(url), Location);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace VRCX
|
|||||||
public string GetAssetVersion(int version)
|
public string GetAssetVersion(int version)
|
||||||
{
|
{
|
||||||
byte[] bytes = BitConverter.GetBytes(version);
|
byte[] bytes = BitConverter.GetBytes(version);
|
||||||
string versionHex = String.Empty;
|
string versionHex = string.Empty;
|
||||||
foreach (byte b in bytes)
|
foreach (byte b in bytes)
|
||||||
{
|
{
|
||||||
versionHex += b.ToString("X2");
|
versionHex += b.ToString("X2");
|
||||||
|
|||||||
@@ -162,9 +162,8 @@ namespace VRCX
|
|||||||
Process proc = Process.GetProcessById(pid);
|
Process proc = Process.GetProcessById(pid);
|
||||||
proc.Kill();
|
proc.Kill();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace VRCX
|
|||||||
_ipcServer.BeginRead(_recvBuffer, 0, _recvBuffer.Length, OnRead, _ipcServer);
|
_ipcServer.BeginRead(_recvBuffer, 0, _recvBuffer.Length, OnRead, _ipcServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Send(IPCPacket ipcPacket)
|
public void Send(IPCPacket ipcPacket)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ namespace VRCX
|
|||||||
new IPCServer().CreateIPCServer();
|
new IPCServer().CreateIPCServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task Send(IPCPacket ipcPacket)
|
public static void Send(IPCPacket ipcPacket)
|
||||||
{
|
{
|
||||||
foreach (var client in Clients)
|
foreach (var client in Clients)
|
||||||
{
|
{
|
||||||
await client.Send(ipcPacket);
|
client.Send(ipcPacket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace VRCX
|
|||||||
|
|
||||||
using (var client = new WebClient())
|
using (var client = new WebClient())
|
||||||
{
|
{
|
||||||
string cookieString = String.Empty;
|
string cookieString = string.Empty;
|
||||||
if (WebApi.Instance != null && WebApi.Instance._cookieContainer != null)
|
if (WebApi.Instance != null && WebApi.Instance._cookieContainer != null)
|
||||||
{
|
{
|
||||||
CookieCollection cookies = WebApi.Instance._cookieContainer.GetCookies(new Uri($"https://{imageHost}"));
|
CookieCollection cookies = WebApi.Instance._cookieContainer.GetCookies(new Uri($"https://{imageHost}"));
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace VRCX
|
|||||||
public static class Program
|
public static class Program
|
||||||
{
|
{
|
||||||
public static string BaseDirectory { get; private set; }
|
public static string BaseDirectory { get; private set; }
|
||||||
public static string AppDataDirectory { get; private set; }
|
public static readonly string AppDataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "VRCX");
|
||||||
public static string ConfigLocation;
|
public static string ConfigLocation;
|
||||||
public static string Version { get; private set; }
|
public static string Version { get; private set; }
|
||||||
public static bool LaunchDebug;
|
public static bool LaunchDebug;
|
||||||
@@ -25,7 +25,6 @@ namespace VRCX
|
|||||||
static Program()
|
static Program()
|
||||||
{
|
{
|
||||||
BaseDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
BaseDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
AppDataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "VRCX");
|
|
||||||
ConfigLocation = Path.Combine(Program.AppDataDirectory, "VRCX.sqlite3");
|
ConfigLocation = Path.Combine(Program.AppDataDirectory, "VRCX.sqlite3");
|
||||||
|
|
||||||
if (!Directory.Exists(AppDataDirectory))
|
if (!Directory.Exists(AppDataDirectory))
|
||||||
|
|||||||
2
Properties/Resources.Designer.cs
generated
2
Properties/Resources.Designer.cs
generated
@@ -19,7 +19,7 @@ namespace VRCX.Properties {
|
|||||||
// class via a tool like ResGen or Visual Studio.
|
// class via a tool like ResGen or Visual Studio.
|
||||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
// with the /str option, or rebuild your VS project.
|
// with the /str option, or rebuild your VS project.
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
internal class Resources {
|
internal class Resources {
|
||||||
|
|||||||
26
SQLite.cs
26
SQLite.cs
@@ -484,7 +484,7 @@ namespace SQLite
|
|||||||
throw new ArgumentNullException (nameof (key));
|
throw new ArgumentNullException (nameof (key));
|
||||||
if (key.Length != 32 && key.Length != 48)
|
if (key.Length != 32 && key.Length != 48)
|
||||||
throw new ArgumentException ("Key must be 32 bytes (256-bit) or 48 bytes (384-bit)", nameof (key));
|
throw new ArgumentException ("Key must be 32 bytes (256-bit) or 48 bytes (384-bit)", nameof (key));
|
||||||
var s = String.Join ("", key.Select (x => x.ToString ("X2")));
|
var s = string.Join(string.Empty, key.Select (x => x.ToString ("X2")));
|
||||||
ExecuteScalar<string> ("pragma key = \"x'" + s + "'\"");
|
ExecuteScalar<string> ("pragma key = \"x'" + s + "'\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -816,7 +816,7 @@ namespace SQLite
|
|||||||
public int CreateIndex (string indexName, string tableName, string[] columnNames, bool unique = false)
|
public int CreateIndex (string indexName, string tableName, string[] columnNames, bool unique = false)
|
||||||
{
|
{
|
||||||
const string sqlFormat = "create {2} index if not exists \"{3}\" on \"{0}\"(\"{1}\")";
|
const string sqlFormat = "create {2} index if not exists \"{3}\" on \"{0}\"(\"{1}\")";
|
||||||
var sql = String.Format (sqlFormat, tableName, string.Join ("\", \"", columnNames), unique ? "unique" : "", indexName);
|
var sql = String.Format (sqlFormat, tableName, string.Join ("\", \"", columnNames), unique ? "unique" : string.Empty, indexName);
|
||||||
return Execute (sql);
|
return Execute (sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1720,7 +1720,7 @@ namespace SQLite
|
|||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return Insert (obj, "", Orm.GetType (obj));
|
return Insert (obj, string.Empty, Orm.GetType (obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1761,7 +1761,7 @@ namespace SQLite
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public int Insert (object obj, Type objType)
|
public int Insert (object obj, Type objType)
|
||||||
{
|
{
|
||||||
return Insert (obj, "", objType);
|
return Insert (obj, string.Empty, objType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -2170,7 +2170,7 @@ namespace SQLite
|
|||||||
|
|
||||||
// Check for errors
|
// Check for errors
|
||||||
r = SQLite3.GetResult (destHandle);
|
r = SQLite3.GetResult (destHandle);
|
||||||
string msg = "";
|
string msg = string.Empty;
|
||||||
if (r != SQLite3.Result.OK) {
|
if (r != SQLite3.Result.OK) {
|
||||||
msg = SQLite3.GetErrmsg (destHandle);
|
msg = SQLite3.GetErrmsg (destHandle);
|
||||||
}
|
}
|
||||||
@@ -2932,16 +2932,16 @@ namespace SQLite
|
|||||||
public static string Collation (MemberInfo p)
|
public static string Collation (MemberInfo p)
|
||||||
{
|
{
|
||||||
#if ENABLE_IL2CPP
|
#if ENABLE_IL2CPP
|
||||||
return (p.GetCustomAttribute<CollationAttribute> ()?.Value) ?? "";
|
return (p.GetCustomAttribute<CollationAttribute> ()?.Value) ?? string.Empty;
|
||||||
#else
|
#else
|
||||||
return
|
return
|
||||||
(p.CustomAttributes
|
(p.CustomAttributes
|
||||||
.Where (x => typeof (CollationAttribute) == x.AttributeType)
|
.Where (x => typeof (CollationAttribute) == x.AttributeType)
|
||||||
.Select (x => {
|
.Select (x => {
|
||||||
var args = x.ConstructorArguments;
|
var args = x.ConstructorArguments;
|
||||||
return args.Count > 0 ? ((args[0].Value as string) ?? "") : "";
|
return args.Count > 0 ? ((args[0].Value as string) ?? string.Empty) : string.Empty;
|
||||||
})
|
})
|
||||||
.FirstOrDefault ()) ?? "";
|
.FirstOrDefault ()) ?? string.Empty;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3033,7 +3033,7 @@ namespace SQLite
|
|||||||
{
|
{
|
||||||
_conn = conn;
|
_conn = conn;
|
||||||
_bindings = new List<Binding> ();
|
_bindings = new List<Binding> ();
|
||||||
CommandText = "";
|
CommandText = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ExecuteNonQuery ()
|
public int ExecuteNonQuery ()
|
||||||
@@ -4052,7 +4052,7 @@ namespace SQLite
|
|||||||
cmdText += " where " + w.CommandText;
|
cmdText += " where " + w.CommandText;
|
||||||
}
|
}
|
||||||
if ((_orderBys != null) && (_orderBys.Count > 0)) {
|
if ((_orderBys != null) && (_orderBys.Count > 0)) {
|
||||||
var t = string.Join (", ", _orderBys.Select (o => "\"" + o.ColumnName + "\"" + (o.Ascending ? "" : " desc")).ToArray ());
|
var t = string.Join (", ", _orderBys.Select (o => "\"" + o.ColumnName + "\"" + (o.Ascending ? string.Empty : " desc")).ToArray ());
|
||||||
cmdText += " order by " + t;
|
cmdText += " order by " + t;
|
||||||
}
|
}
|
||||||
if (_limit.HasValue) {
|
if (_limit.HasValue) {
|
||||||
@@ -4127,7 +4127,7 @@ namespace SQLite
|
|||||||
args[i] = CompileExpr (call.Arguments[i], queryArgs);
|
args[i] = CompileExpr (call.Arguments[i], queryArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
var sqlCall = "";
|
var sqlCall = string.Empty;
|
||||||
|
|
||||||
if (call.Method.Name == "Like" && args.Length == 2) {
|
if (call.Method.Name == "Like" && args.Length == 2) {
|
||||||
sqlCall = "(" + args[0].CommandText + " like " + args[1].CommandText + ")";
|
sqlCall = "(" + args[0].CommandText + " like " + args[1].CommandText + ")";
|
||||||
@@ -4269,7 +4269,7 @@ namespace SQLite
|
|||||||
if (val != null && val is System.Collections.IEnumerable && !(val is string) && !(val is System.Collections.Generic.IEnumerable<byte>)) {
|
if (val != null && val is System.Collections.IEnumerable && !(val is string) && !(val is System.Collections.Generic.IEnumerable<byte>)) {
|
||||||
var sb = new System.Text.StringBuilder ();
|
var sb = new System.Text.StringBuilder ();
|
||||||
sb.Append ("(");
|
sb.Append ("(");
|
||||||
var head = "";
|
var head = string.Empty;
|
||||||
foreach (var a in (System.Collections.IEnumerable)val) {
|
foreach (var a in (System.Collections.IEnumerable)val) {
|
||||||
queryArgs.Add (a);
|
queryArgs.Add (a);
|
||||||
sb.Append (head);
|
sb.Append (head);
|
||||||
@@ -4726,7 +4726,7 @@ namespace SQLite
|
|||||||
public static Result Open (string filename, out Sqlite3DatabaseHandle db, int flags, string vfsName)
|
public static Result Open (string filename, out Sqlite3DatabaseHandle db, int flags, string vfsName)
|
||||||
{
|
{
|
||||||
#if USE_WP8_NATIVE_SQLITE
|
#if USE_WP8_NATIVE_SQLITE
|
||||||
return (Result)Sqlite3.sqlite3_open_v2(filename, out db, flags, vfsName ?? "");
|
return (Result)Sqlite3.sqlite3_open_v2(filename, out db, flags, vfsName ?? string.Empty);
|
||||||
#else
|
#else
|
||||||
return (Result)Sqlite3.sqlite3_open_v2 (filename, out db, flags, vfsName);
|
return (Result)Sqlite3.sqlite3_open_v2 (filename, out db, flags, vfsName);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
metadata.Add("author", new JObject
|
metadata.Add("author", new JObject
|
||||||
{
|
{
|
||||||
{ "id", "" },
|
{ "id", string.Empty },
|
||||||
{ "displayName", $"{author[1]} ({author[0]})" }
|
{ "displayName", $"{author[1]} ({author[0]})" }
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@@ -249,18 +249,18 @@ namespace VRCX
|
|||||||
var world = split[1].Split(',');
|
var world = split[1].Split(',');
|
||||||
metadata.Add("world", new JObject
|
metadata.Add("world", new JObject
|
||||||
{
|
{
|
||||||
{ "id", "" },
|
{ "id", string.Empty },
|
||||||
{ "name", $"{world[2]} ({world[0]})" },
|
{ "name", $"{world[2]} ({world[0]})" },
|
||||||
{ "instanceId", "" }
|
{ "instanceId", string.Empty }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (version == 1)
|
else if (version == 1)
|
||||||
{
|
{
|
||||||
metadata.Add("world", new JObject
|
metadata.Add("world", new JObject
|
||||||
{
|
{
|
||||||
{ "id", "" },
|
{ "id", string.Empty },
|
||||||
{ "name", split[1] },
|
{ "name", split[1] },
|
||||||
{ "instanceId", "" }
|
{ "instanceId", string.Empty }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -297,7 +297,7 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
playersArray.Add(new JObject
|
playersArray.Add(new JObject
|
||||||
{
|
{
|
||||||
{ "id", "" },
|
{ "id", string.Empty },
|
||||||
{ "x", playerSplit[1] },
|
{ "x", playerSplit[1] },
|
||||||
{ "y", playerSplit[2] },
|
{ "y", playerSplit[2] },
|
||||||
{ "z", playerSplit[3] },
|
{ "z", playerSplit[3] },
|
||||||
@@ -342,7 +342,6 @@ namespace VRCX
|
|||||||
// init lookup table and store crc for iTXt
|
// init lookup table and store crc for iTXt
|
||||||
private static readonly uint iTXtCrc = Crc32(new[] { (byte)'i', (byte)'T', (byte)'X', (byte)'t' }, 0, 4, 0);
|
private static readonly uint iTXtCrc = Crc32(new[] { (byte)'i', (byte)'T', (byte)'X', (byte)'t' }, 0, 4, 0);
|
||||||
private readonly Encoding keywordEncoding = Encoding.GetEncoding("ISO-8859-1"); // ISO-8859-1/Latin1 is the encoding used for the keyword in text chunks.
|
private readonly Encoding keywordEncoding = Encoding.GetEncoding("ISO-8859-1"); // ISO-8859-1/Latin1 is the encoding used for the keyword in text chunks.
|
||||||
public List<byte> ChunkBytes;
|
|
||||||
public List<byte> ChunkDataBytes;
|
public List<byte> ChunkDataBytes;
|
||||||
public int ChunkDataLength;
|
public int ChunkDataLength;
|
||||||
public string ChunkType;
|
public string ChunkType;
|
||||||
|
|||||||
13
Update.cs
13
Update.cs
@@ -13,13 +13,16 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
internal class Update
|
internal class Update
|
||||||
{
|
{
|
||||||
|
private static readonly string VRCX_Setup_Executable = Path.Combine(Program.AppDataDirectory, "VRCX_Setup.exe");
|
||||||
|
private static readonly string Update_Executable = Path.Combine(Program.AppDataDirectory, "update.exe");
|
||||||
|
|
||||||
public static void Check()
|
public static void Check()
|
||||||
{
|
{
|
||||||
if (Process.GetProcessesByName("VRCX_Setup").Length > 0)
|
if (Process.GetProcessesByName("VRCX_Setup").Length > 0)
|
||||||
Environment.Exit(0);
|
Environment.Exit(0);
|
||||||
if (File.Exists(Path.Combine(Program.AppDataDirectory, "VRCX_Setup.exe")))
|
if (File.Exists(VRCX_Setup_Executable))
|
||||||
File.Delete(Path.Combine(Program.AppDataDirectory, "VRCX_Setup.exe"));
|
File.Delete(VRCX_Setup_Executable);
|
||||||
if (File.Exists(Path.Combine(Program.AppDataDirectory, "update.exe")))
|
if (File.Exists(Update_Executable))
|
||||||
Install();
|
Install();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,12 +30,12 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Move(Path.Combine(Program.AppDataDirectory, "update.exe"), Path.Combine(Program.AppDataDirectory, "VRCX_Setup.exe"));
|
File.Move(Update_Executable, VRCX_Setup_Executable);
|
||||||
var VRCXProcess = new Process
|
var VRCXProcess = new Process
|
||||||
{
|
{
|
||||||
StartInfo = new ProcessStartInfo
|
StartInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = Path.Combine(Program.AppDataDirectory, "VRCX_Setup.exe"),
|
FileName = VRCX_Setup_Executable,
|
||||||
Arguments = "/S"
|
Arguments = "/S"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -134,9 +134,11 @@
|
|||||||
<Compile Include="WinformThemer.cs" />
|
<Compile Include="WinformThemer.cs" />
|
||||||
<EmbeddedResource Include="VRForm.resx">
|
<EmbeddedResource Include="VRForm.resx">
|
||||||
<DependentUpon>VRForm.cs</DependentUpon>
|
<DependentUpon>VRForm.cs</DependentUpon>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="MainForm.resx">
|
<EmbeddedResource Include="MainForm.resx">
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
<DependentUpon>MainForm.cs</DependentUpon>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
<Generator>ResXFileCodeGenerator</Generator>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ namespace VRCX
|
|||||||
string FormDataTemplate = "--{0}\r\nContent-Disposition: form-data; name=\"{1}\"\r\n\r\n{2}\r\n";
|
string FormDataTemplate = "--{0}\r\nContent-Disposition: form-data; name=\"{1}\"\r\n\r\n{2}\r\n";
|
||||||
foreach (string key in postData.Keys)
|
foreach (string key in postData.Keys)
|
||||||
{
|
{
|
||||||
string item = String.Format(FormDataTemplate, boundary, key, postData[key]);
|
string item = string.Format(FormDataTemplate, boundary, key, postData[key]);
|
||||||
byte[] itemBytes = System.Text.Encoding.UTF8.GetBytes(item);
|
byte[] itemBytes = System.Text.Encoding.UTF8.GetBytes(item);
|
||||||
await requestStream.WriteAsync(itemBytes, 0, itemBytes.Length);
|
await requestStream.WriteAsync(itemBytes, 0, itemBytes.Length);
|
||||||
}
|
}
|
||||||
@@ -215,7 +215,7 @@ namespace VRCX
|
|||||||
string fileName = "image.png";
|
string fileName = "image.png";
|
||||||
string fileMimeType = "image/png";
|
string fileMimeType = "image/png";
|
||||||
string HeaderTemplate = "--{0}\r\nContent-Disposition: form-data; name=\"{1}\"; filename=\"{2}\"\r\nContent-Type: {3}\r\n\r\n";
|
string HeaderTemplate = "--{0}\r\nContent-Disposition: form-data; name=\"{1}\"; filename=\"{2}\"\r\nContent-Type: {3}\r\n\r\n";
|
||||||
string header = String.Format(HeaderTemplate, boundary, fileFormKey, fileName, fileMimeType);
|
string header = string.Format(HeaderTemplate, boundary, fileFormKey, fileName, fileMimeType);
|
||||||
byte[] headerbytes = Encoding.UTF8.GetBytes(header);
|
byte[] headerbytes = Encoding.UTF8.GetBytes(header);
|
||||||
await requestStream.WriteAsync(headerbytes, 0, headerbytes.Length);
|
await requestStream.WriteAsync(headerbytes, 0, headerbytes.Length);
|
||||||
using (MemoryStream fileStream = new MemoryStream(fileToUpload))
|
using (MemoryStream fileStream = new MemoryStream(fileToUpload))
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ namespace VRCX
|
|||||||
/// <returns>True if the world was successfully initialized, false otherwise.</returns>
|
/// <returns>True if the world was successfully initialized, false otherwise.</returns>
|
||||||
private bool TryInitializeWorld(string worldId, out string connectionKey)
|
private bool TryInitializeWorld(string worldId, out string connectionKey)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrEmpty(worldId))
|
if (string.IsNullOrEmpty(worldId))
|
||||||
{
|
{
|
||||||
connectionKey = null;
|
connectionKey = null;
|
||||||
return false;
|
return false;
|
||||||
@@ -421,7 +421,7 @@ namespace VRCX
|
|||||||
|
|
||||||
string worldId = funcResult?.Result?.ToString();
|
string worldId = funcResult?.Result?.ToString();
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(worldId))
|
if (string.IsNullOrEmpty(worldId))
|
||||||
{
|
{
|
||||||
// implement
|
// implement
|
||||||
// wait what was i going to do here again
|
// wait what was i going to do here again
|
||||||
@@ -484,7 +484,7 @@ namespace VRCX
|
|||||||
/// Processes a JSON request containing world data and logs it to the world database.
|
/// Processes a JSON request containing world data and logs it to the world database.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="json">The JSON request containing the world data.</param>
|
/// <param name="json">The JSON request containing the world data.</param>
|
||||||
public async void ProcessLogWorldDataRequest(string json)
|
public void ProcessLogWorldDataRequest(string json)
|
||||||
{
|
{
|
||||||
// Current format:
|
// Current format:
|
||||||
// {
|
// {
|
||||||
@@ -519,7 +519,7 @@ namespace VRCX
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(request.RequestType))
|
if (string.IsNullOrEmpty(request.RequestType))
|
||||||
{
|
{
|
||||||
logger.Warn("World tried to store data with no request type provided. Request: ", json);
|
logger.Warn("World tried to store data with no request type provided. Request: ", json);
|
||||||
this.lastError = "`requestType` is missing or null";
|
this.lastError = "`requestType` is missing or null";
|
||||||
|
|||||||
Reference in New Issue
Block a user