This commit is contained in:
Jared Goodwin 2019-09-28 01:11:05 -07:00
parent cc42cf339e
commit b2f7183f12
7 changed files with 30 additions and 34 deletions

View File

@ -38,20 +38,6 @@
<ProjectReference Include="..\Shared\Shared.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="System">
<HintPath>System</HintPath>
</Reference>
<Reference Include="System.Data">
<HintPath>System.Data</HintPath>
</Reference>
<Reference Include="System.ServiceProcess">
<HintPath>System.ServiceProcess</HintPath>
</Reference>
<Reference Include="System.Xml">
<HintPath>System.Xml</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Update="Services\WindowsService.cs">

View File

@ -16,7 +16,7 @@ namespace Remotely.Agent.Services
{
if (!File.Exists("ConnectionInfo.json"))
{
throw new Exception("No connection info available. Please create ConnectionInfo.json file with appropriate values.");
Logger.Write(new Exception("No connection info available. Please create ConnectionInfo.json file with appropriate values."));
}
return JsonConvert.DeserializeObject<ConnectionInfo>(File.ReadAllText("ConnectionInfo.json"));
}

View File

@ -40,7 +40,6 @@ namespace Remotely.Server.Data
base.OnModelCreating(builder);
builder.Entity<IdentityUser>().ToTable("RemotelyUsers");
//builder.Entity<RemotelyUser>().ToTable("RemotelyUsers");
builder.Entity<Organization>()
.HasMany(x => x.Devices)

View File

@ -59,7 +59,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="3.0.0" />
@ -155,14 +154,6 @@
</Content>
</ItemGroup>
<ItemGroup>
<Reference Include="System.Drawing">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.2\System.Drawing.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Update="CurrentVersion.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
namespace Remotely.Server.Services
{
public class PascalCase : JsonNamingPolicy
{
public override string ConvertName(string name)
{
if (string.IsNullOrWhiteSpace(name))
{
return name;
}
var first = name.First().ToString().ToUpper();
return first + new string(name.Skip(1).ToArray());
}
}
}

View File

@ -127,10 +127,10 @@ namespace Remotely.Server
});
}
services.AddMvcCore()
services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0).AddJsonOptions(options =>
{
options.JsonSerializerOptions.PropertyNamingPolicy = new PascalCase();
});
services.AddSignalR(options =>
@ -139,7 +139,7 @@ namespace Remotely.Server
})
.AddJsonProtocol(options =>
{
options.PayloadSerializerOptions.PropertyNamingPolicy = new PascalCase();
})
.AddMessagePackProtocol();
@ -233,12 +233,6 @@ namespace Remotely.Server
private void ConfigureStaticFiles(IApplicationBuilder app)
{
JsonConvert.DefaultSettings = () =>
{
var settings = new JsonSerializerSettings();
settings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
return settings;
};
var provider = new FileExtensionContentTypeProvider();
// Add new mappings
provider.Mappings[".ps1"] = "application/octet-stream";

View File

@ -7,6 +7,7 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text.Json.Serialization;
namespace Remotely.Shared.Models
{
@ -15,6 +16,8 @@ namespace Remotely.Shared.Models
public string AgentVersion { get; set; }
public string CurrentUser { get; set; }
public string DeviceName { get; set; }
[JsonIgnore]
public virtual ICollection<DevicePermissionLink> DevicePermissionLinks { get; set; } = new List<DevicePermissionLink>();
public List<Drive> Drives { get; set; }