mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-11 19:44:52 +00:00
Combined projects into one solution
This commit is contained in:
@@ -2,6 +2,23 @@
|
|||||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
# Visual Studio 2008
|
# Visual Studio 2008
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDashEssentials", "PepperDashEssentials\PepperDashEssentials.csproj", "{1BED5BA9-88C4-4365-9362-6F4B128071D3}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDashEssentials", "PepperDashEssentials\PepperDashEssentials.csproj", "{1BED5BA9-88C4-4365-9362-6F4B128071D3}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{892B761C-E479-44CE-BD74-243E9214AF13} = {892B761C-E479-44CE-BD74-243E9214AF13}
|
||||||
|
{9199CE8A-0C9F-4952-8672-3EED798B284F} = {9199CE8A-0C9F-4952-8672-3EED798B284F}
|
||||||
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PepperDash_Essentials_Core", "..\..\essentials-core\PepperDashEssentialsBase\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj", "{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials Devices Common", "..\..\essentials-devices-common\Essentials Devices Common\Essentials Devices Common\Essentials Devices Common.csproj", "{892B761C-E479-44CE-BD74-243E9214AF13}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Essentials_DM", "..\..\essentials-dm\Essentials_DM\Essentials_DM\Essentials_DM.csproj", "{9199CE8A-0C9F-4952-8672-3EED798B284F}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} = {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -13,6 +30,18 @@ Global
|
|||||||
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
{1BED5BA9-88C4-4365-9362-6F4B128071D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{892B761C-E479-44CE-BD74-243E9214AF13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{892B761C-E479-44CE-BD74-243E9214AF13}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{892B761C-E479-44CE-BD74-243E9214AF13}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{892B761C-E479-44CE-BD74-243E9214AF13}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9199CE8A-0C9F-4952-8672-3EED798B284F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -1,266 +1,266 @@
|
|||||||
using System;
|
//using System;
|
||||||
using System.Collections.Generic;
|
//using System.Collections.Generic;
|
||||||
using System.Linq;
|
//using System.Linq;
|
||||||
using System.Text;
|
//using System.Text;
|
||||||
using Crestron.SimplSharp;
|
//using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharp.CrestronIO;
|
//using Crestron.SimplSharp.CrestronIO;
|
||||||
using Crestron.SimplSharp.Net.Http;
|
//using Crestron.SimplSharp.Net.Http;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
//using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
//using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
using PepperDash.Essentials.Core;
|
//using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Http;
|
//using PepperDash.Essentials.Core.Http;
|
||||||
using PepperDash.Core;
|
//using PepperDash.Core;
|
||||||
|
|
||||||
namespace PepperDash.Essentials
|
//namespace PepperDash.Essentials
|
||||||
{
|
//{
|
||||||
public class EssentialsHttpApiHandler
|
// public class EssentialsHttpApiHandler
|
||||||
{
|
// {
|
||||||
string ConfigPath;
|
// string ConfigPath;
|
||||||
string PresetsPathPrefix;
|
// string PresetsPathPrefix;
|
||||||
EssentialsHttpServer Server;
|
// EssentialsHttpServer Server;
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
///
|
// ///
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="server">HTTP server to attach to</param>
|
// /// <param name="server">HTTP server to attach to</param>
|
||||||
/// <param name="configPath">The full path to configuration file</param>
|
// /// <param name="configPath">The full path to configuration file</param>
|
||||||
/// <param name="presetsListPath">The folder prefix for the presets path, eq "\HTML\presets\"</param>
|
// /// <param name="presetsListPath">The folder prefix for the presets path, eq "\HTML\presets\"</param>
|
||||||
public EssentialsHttpApiHandler(EssentialsHttpServer server, string configPath, string presetsPathPrefix)
|
// public EssentialsHttpApiHandler(EssentialsHttpServer server, string configPath, string presetsPathPrefix)
|
||||||
{
|
// {
|
||||||
if (server == null) throw new ArgumentNullException("server");
|
// if (server == null) throw new ArgumentNullException("server");
|
||||||
Server = server;
|
// Server = server;
|
||||||
ConfigPath = configPath;
|
// ConfigPath = configPath;
|
||||||
PresetsPathPrefix = presetsPathPrefix;
|
// PresetsPathPrefix = presetsPathPrefix;
|
||||||
server.ApiRequest += Server_ApiRequest;
|
// server.ApiRequest += Server_ApiRequest;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
void Server_ApiRequest(object sender, Crestron.SimplSharp.Net.Http.OnHttpRequestArgs args)
|
// void Server_ApiRequest(object sender, Crestron.SimplSharp.Net.Http.OnHttpRequestArgs args)
|
||||||
{
|
// {
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
var path = args.Request.Path.ToLower();
|
// var path = args.Request.Path.ToLower();
|
||||||
|
|
||||||
if (path == "/api/config")
|
// if (path == "/api/config")
|
||||||
HandleApiConfig(args);
|
// HandleApiConfig(args);
|
||||||
else if (path.StartsWith("/api/presetslist/"))
|
// else if (path.StartsWith("/api/presetslist/"))
|
||||||
HandleApiPresetsList(args);
|
// HandleApiPresetsList(args);
|
||||||
else if (path == "/api/presetslists")
|
// else if (path == "/api/presetslists")
|
||||||
HandleApiGetPresetsLists(args.Request, args.Response);
|
// HandleApiGetPresetsLists(args.Request, args.Response);
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
args.Response.Code = 404;
|
// args.Response.Code = 404;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
args.Response.Header.SetHeaderValue("Access-Control-Allow-Origin", "*");
|
// args.Response.Header.SetHeaderValue("Access-Control-Allow-Origin", "*");
|
||||||
args.Response.Header.SetHeaderValue("Access-Control-Allow-Methods", "GET, POST, PATCH, PUT, DELETE, OPTIONS");
|
// args.Response.Header.SetHeaderValue("Access-Control-Allow-Methods", "GET, POST, PATCH, PUT, DELETE, OPTIONS");
|
||||||
}
|
// }
|
||||||
catch (Exception e)
|
// catch (Exception e)
|
||||||
{
|
// {
|
||||||
Debug.Console(1, "Uncaught HTTP server error: \n{0}", e);
|
// Debug.Console(1, "Uncaught HTTP server error: \n{0}", e);
|
||||||
args.Response.Code = 500;
|
// args.Response.Code = 500;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// GET will return the running configuration. POST will attempt to take in a new config
|
// /// GET will return the running configuration. POST will attempt to take in a new config
|
||||||
/// and restart the program.
|
// /// and restart the program.
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
void HandleApiConfig(OnHttpRequestArgs args)
|
// void HandleApiConfig(OnHttpRequestArgs args)
|
||||||
{
|
// {
|
||||||
var request = args.Request;
|
// var request = args.Request;
|
||||||
if (request.Header.RequestType == "GET")
|
// if (request.Header.RequestType == "GET")
|
||||||
{
|
// {
|
||||||
if (File.Exists(ConfigPath))
|
// if (File.Exists(ConfigPath))
|
||||||
{
|
// {
|
||||||
Debug.Console(2, "Sending config:{0}", ConfigPath);
|
// Debug.Console(2, "Sending config:{0}", ConfigPath);
|
||||||
args.Response.Header.ContentType = EssentialsHttpServer.GetContentType(new FileInfo(ConfigPath).Extension);
|
// args.Response.Header.ContentType = EssentialsHttpServer.GetContentType(new FileInfo(ConfigPath).Extension);
|
||||||
args.Response.ContentStream = new FileStream(ConfigPath, FileMode.Open, FileAccess.Read);
|
// args.Response.ContentStream = new FileStream(ConfigPath, FileMode.Open, FileAccess.Read);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if (request.Header.RequestType == "POST")
|
// else if (request.Header.RequestType == "POST")
|
||||||
{
|
// {
|
||||||
Debug.Console(2, "Post type: '{0}'", request.Header.ContentType);
|
// Debug.Console(2, "Post type: '{0}'", request.Header.ContentType);
|
||||||
|
|
||||||
// Make sure we're receiving at least good json
|
// // Make sure we're receiving at least good json
|
||||||
Debug.Console(1, "Receving new config");
|
// Debug.Console(1, "Receving new config");
|
||||||
if (GetContentStringJson(args) == null)
|
// if (GetContentStringJson(args) == null)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
//---------------------------- try to move these into common method
|
// //---------------------------- try to move these into common method
|
||||||
// Move current file aside
|
// // Move current file aside
|
||||||
var bakPath = ConfigPath + ".bak";
|
// var bakPath = ConfigPath + ".bak";
|
||||||
if (File.Exists(bakPath))
|
// if (File.Exists(bakPath))
|
||||||
File.Delete(bakPath);
|
// File.Delete(bakPath);
|
||||||
File.Move(ConfigPath, bakPath);
|
// File.Move(ConfigPath, bakPath);
|
||||||
|
|
||||||
// Write the file
|
// // Write the file
|
||||||
using (FileStream fs = File.Open(ConfigPath, FileMode.OpenOrCreate))
|
// using (FileStream fs = File.Open(ConfigPath, FileMode.OpenOrCreate))
|
||||||
using (StreamWriter sw = new StreamWriter(fs))
|
// using (StreamWriter sw = new StreamWriter(fs))
|
||||||
{
|
// {
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
sw.Write(args.Request.ContentString);
|
// sw.Write(args.Request.ContentString);
|
||||||
}
|
// }
|
||||||
catch (Exception e)
|
// catch (Exception e)
|
||||||
{
|
// {
|
||||||
string err = string.Format("Error writing received config file:\r{0}", e);
|
// string err = string.Format("Error writing received config file:\r{0}", e);
|
||||||
CrestronConsole.PrintLine(err);
|
// CrestronConsole.PrintLine(err);
|
||||||
ErrorLog.Warn(err);
|
// ErrorLog.Warn(err);
|
||||||
// Put file back
|
// // Put file back
|
||||||
File.Move(ConfigPath + ".bak", ConfigPath);
|
// File.Move(ConfigPath + ".bak", ConfigPath);
|
||||||
args.Response.Code = 500;
|
// args.Response.Code = 500;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// If client says "yeah, restart" and has a good token
|
// // If client says "yeah, restart" and has a good token
|
||||||
// Restart program
|
// // Restart program
|
||||||
string consoleResponse = null;
|
// string consoleResponse = null;
|
||||||
var restart = CrestronConsole.SendControlSystemCommand("progreset -p:" +
|
// var restart = CrestronConsole.SendControlSystemCommand("progreset -p:" +
|
||||||
InitialParametersClass.ApplicationNumber, ref consoleResponse);
|
// InitialParametersClass.ApplicationNumber, ref consoleResponse);
|
||||||
if (!restart) Debug.Console(0, "CAN'T DO THAT YO: {0}", consoleResponse);
|
// if (!restart) Debug.Console(0, "CAN'T DO THAT YO: {0}", consoleResponse);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
void HandleApiPresetsList(OnHttpRequestArgs args)
|
// void HandleApiPresetsList(OnHttpRequestArgs args)
|
||||||
{
|
// {
|
||||||
var listPath = PresetsPathPrefix + args.Request.Path.Remove(0, 17);
|
// var listPath = PresetsPathPrefix + args.Request.Path.Remove(0, 17);
|
||||||
Debug.Console(2, "Checking for preset list '{0}'", listPath);
|
// Debug.Console(2, "Checking for preset list '{0}'", listPath);
|
||||||
|
|
||||||
if (args.Request.Header.RequestType == "GET")
|
// if (args.Request.Header.RequestType == "GET")
|
||||||
{
|
// {
|
||||||
if (File.Exists(listPath))
|
// if (File.Exists(listPath))
|
||||||
{
|
// {
|
||||||
Debug.Console(2, "Sending presets file:{0}", listPath);
|
// Debug.Console(2, "Sending presets file:{0}", listPath);
|
||||||
args.Response.Header.ContentType = EssentialsHttpServer.GetContentType(new FileInfo(listPath).Extension);
|
// args.Response.Header.ContentType = EssentialsHttpServer.GetContentType(new FileInfo(listPath).Extension);
|
||||||
args.Response.ContentStream = new FileStream(listPath, FileMode.Open, FileAccess.Read);
|
// args.Response.ContentStream = new FileStream(listPath, FileMode.Open, FileAccess.Read);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if (args.Request.Header.RequestType == "POST")
|
// else if (args.Request.Header.RequestType == "POST")
|
||||||
{
|
// {
|
||||||
// Make sure we're receiving at least good json
|
// // Make sure we're receiving at least good json
|
||||||
Debug.Console(1, "Receving new presets");
|
// Debug.Console(1, "Receving new presets");
|
||||||
if (GetContentStringJson(args) == null)
|
// if (GetContentStringJson(args) == null)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
//---------------------------- try to move these into common method
|
// //---------------------------- try to move these into common method
|
||||||
// Move current file aside
|
// // Move current file aside
|
||||||
var bakPath = listPath + ".new";
|
// var bakPath = listPath + ".new";
|
||||||
Debug.Console(2, "Moving presets file to {0}", bakPath);
|
// Debug.Console(2, "Moving presets file to {0}", bakPath);
|
||||||
if(File.Exists(bakPath))
|
// if(File.Exists(bakPath))
|
||||||
File.Delete(bakPath);
|
// File.Delete(bakPath);
|
||||||
File.Move(listPath, bakPath);
|
// File.Move(listPath, bakPath);
|
||||||
|
|
||||||
Debug.Console(2, "Writing new file");
|
// Debug.Console(2, "Writing new file");
|
||||||
// Write the file
|
// // Write the file
|
||||||
using (FileStream fs = File.OpenWrite(listPath))
|
// using (FileStream fs = File.OpenWrite(listPath))
|
||||||
using (StreamWriter sw = new StreamWriter(fs))
|
// using (StreamWriter sw = new StreamWriter(fs))
|
||||||
{
|
// {
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
Debug.Console(2, "Writing {1}, {0} bytes", args.Request.ContentString.Length, listPath);
|
// Debug.Console(2, "Writing {1}, {0} bytes", args.Request.ContentString.Length, listPath);
|
||||||
sw.Write(args.Request.ContentString);
|
// sw.Write(args.Request.ContentString);
|
||||||
}
|
// }
|
||||||
catch (Exception e)
|
// catch (Exception e)
|
||||||
{
|
// {
|
||||||
string err = string.Format("Error writing received presets file:\r{0}", e);
|
// string err = string.Format("Error writing received presets file:\r{0}", e);
|
||||||
CrestronConsole.PrintLine(err);
|
// CrestronConsole.PrintLine(err);
|
||||||
ErrorLog.Warn(err);
|
// ErrorLog.Warn(err);
|
||||||
// Put file back
|
// // Put file back
|
||||||
File.Move(listPath + ".bak", listPath);
|
// File.Move(listPath + ".bak", listPath);
|
||||||
args.Response.Code = 500;
|
// args.Response.Code = 500;
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
void HandleApiGetPresetsLists(HttpServerRequest request, HttpServerResponse response)
|
// void HandleApiGetPresetsLists(HttpServerRequest request, HttpServerResponse response)
|
||||||
{
|
// {
|
||||||
if (request.Header.RequestType != "GET")
|
// if (request.Header.RequestType != "GET")
|
||||||
{
|
// {
|
||||||
response.Code = 404; // This should be a 405 with an allow header
|
// response.Code = 404; // This should be a 405 with an allow header
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (Directory.Exists(PresetsPathPrefix))
|
// if (Directory.Exists(PresetsPathPrefix))
|
||||||
{
|
// {
|
||||||
//CrestronConsole.PrintLine("Parsing presets directory");
|
// //CrestronConsole.PrintLine("Parsing presets directory");
|
||||||
List<string> files = Directory.GetFiles(PresetsPathPrefix, "*.json")
|
// List<string> files = Directory.GetFiles(PresetsPathPrefix, "*.json")
|
||||||
.ToList().Select(f => Path.GetFileName(f)).ToList();
|
// .ToList().Select(f => Path.GetFileName(f)).ToList();
|
||||||
if (files.Count > 0)
|
// if (files.Count > 0)
|
||||||
files.Sort();
|
// files.Sort();
|
||||||
var json = JsonConvert.SerializeObject(files);
|
// var json = JsonConvert.SerializeObject(files);
|
||||||
response.Header.ContentType = "application/json";
|
// response.Header.ContentType = "application/json";
|
||||||
response.ContentString = json;
|
// response.ContentString = json;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// //CrestronConsole.PrintLine("Found {0} files", files.Count);
|
// // //CrestronConsole.PrintLine("Found {0} files", files.Count);
|
||||||
// JObject jo = new JObject();
|
// // JObject jo = new JObject();
|
||||||
// JArray ja = new JArray();
|
// // JArray ja = new JArray();
|
||||||
|
|
||||||
// foreach (var filename in files)
|
// // foreach (var filename in files)
|
||||||
// {
|
// // {
|
||||||
// try
|
// // try
|
||||||
// {
|
// // {
|
||||||
// using (StreamReader sr = new StreamReader(filename))
|
// // using (StreamReader sr = new StreamReader(filename))
|
||||||
// {
|
// // {
|
||||||
// JObject tempJo = JObject.Parse(sr.ReadToEnd());
|
// // JObject tempJo = JObject.Parse(sr.ReadToEnd());
|
||||||
// if (tempJo.Value<string>("content").Equals("presetsList"))
|
// // if (tempJo.Value<string>("content").Equals("presetsList"))
|
||||||
// {
|
// // {
|
||||||
// var jItem = new JObject(); // make a new object
|
// // var jItem = new JObject(); // make a new object
|
||||||
// jItem.Add("Name", tempJo["name"]);
|
// // jItem.Add("Name", tempJo["name"]);
|
||||||
// jItem.Add("File", filename);
|
// // jItem.Add("File", filename);
|
||||||
// jItem.Add("Url", Uri.EscapeUriString(new Uri(
|
// // jItem.Add("Url", Uri.EscapeUriString(new Uri(
|
||||||
// filename.Replace("\\html", "")
|
// // filename.Replace("\\html", "")
|
||||||
// .Replace("\\HTML", "")
|
// // .Replace("\\HTML", "")
|
||||||
// .Replace('\\', '/'), UriKind.Relative).ToString()));
|
// // .Replace('\\', '/'), UriKind.Relative).ToString()));
|
||||||
// ja.Add(jItem); // add to array
|
// // ja.Add(jItem); // add to array
|
||||||
// }
|
// // }
|
||||||
// else
|
// // else
|
||||||
// CrestronConsole.PrintLine("Cannot use presets file '{0}'", filename);
|
// // CrestronConsole.PrintLine("Cannot use presets file '{0}'", filename);
|
||||||
// }
|
// // }
|
||||||
// }
|
// // }
|
||||||
// catch
|
// // catch
|
||||||
// {
|
// // {
|
||||||
// // ignore failures - maybe delete them
|
// // // ignore failures - maybe delete them
|
||||||
// CrestronConsole.PrintLine("Unable to read presets file '{0}'", filename);
|
// // CrestronConsole.PrintLine("Unable to read presets file '{0}'", filename);
|
||||||
// }
|
// // }
|
||||||
// }
|
// // }
|
||||||
// jo.Add("PresetChannelLists", ja);
|
// // jo.Add("PresetChannelLists", ja);
|
||||||
// //CrestronConsole.PrintLine(jo.ToString());
|
// // //CrestronConsole.PrintLine(jo.ToString());
|
||||||
// response.Header.ContentType = "application/json";
|
// // response.Header.ContentType = "application/json";
|
||||||
// response.ContentString = jo.ToString();
|
// // response.ContentString = jo.ToString();
|
||||||
//}
|
// //}
|
||||||
//else
|
// //else
|
||||||
// CrestronConsole.PrintLine("No presets files in directory");
|
// // CrestronConsole.PrintLine("No presets files in directory");
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// Simply does what it says
|
// /// Simply does what it says
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
JObject GetContentStringJson(OnHttpRequestArgs args)
|
// JObject GetContentStringJson(OnHttpRequestArgs args)
|
||||||
{
|
// {
|
||||||
//var content = args.Request.ContentString;
|
// //var content = args.Request.ContentString;
|
||||||
//Debug.Console(1, "{0}", content);
|
// //Debug.Console(1, "{0}", content);
|
||||||
|
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
// just see if it parses properly
|
// // just see if it parses properly
|
||||||
return JObject.Parse(args.Request.ContentString);
|
// return JObject.Parse(args.Request.ContentString);
|
||||||
}
|
// }
|
||||||
catch (Exception e)
|
// catch (Exception e)
|
||||||
{
|
// {
|
||||||
string err = string.Format("JSON Error reading config file:\r{0}", e);
|
// string err = string.Format("JSON Error reading config file:\r{0}", e);
|
||||||
CrestronConsole.PrintLine(err);
|
// CrestronConsole.PrintLine(err);
|
||||||
ErrorLog.Warn(err);
|
// ErrorLog.Warn(err);
|
||||||
args.Response.Code = 400; // Bad request
|
// args.Response.Code = 400; // Bad request
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
@@ -75,10 +75,6 @@
|
|||||||
<HintPath>..\..\..\essentials-devices-common\Essentials Devices Common\Essentials Devices Common\bin\Essentials Devices Common.dll</HintPath>
|
<HintPath>..\..\..\essentials-devices-common\Essentials Devices Common\Essentials Devices Common\bin\Essentials Devices Common.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="EssentialsHttpServer, Version=1.0.0.21365, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\..\..\essentials-http-server\EssentialsHttpServer\bin\EssentialsHttpServer.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="mscorlib" />
|
<Reference Include="mscorlib" />
|
||||||
<Reference Include="PepperDashCorePortalSync, Version=1.0.0.27069, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="PepperDashCorePortalSync, Version=1.0.0.27069, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user