diff --git a/Essentials/PepperDashEssentials.sln b/Essentials/PepperDashEssentials.sln
index a512f634..425d6add 100644
--- a/Essentials/PepperDashEssentials.sln
+++ b/Essentials/PepperDashEssentials.sln
@@ -2,6 +2,23 @@
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
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
Global
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}.Release|Any CPU.ActiveCfg = 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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Essentials/PepperDashEssentials/HttpApiHandler.cs b/Essentials/PepperDashEssentials/HttpApiHandler.cs
index f3dca1e6..0a757999 100644
--- a/Essentials/PepperDashEssentials/HttpApiHandler.cs
+++ b/Essentials/PepperDashEssentials/HttpApiHandler.cs
@@ -1,266 +1,266 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharp.CrestronIO;
-using Crestron.SimplSharp.Net.Http;
+//using System;
+//using System.Collections.Generic;
+//using System.Linq;
+//using System.Text;
+//using Crestron.SimplSharp;
+//using Crestron.SimplSharp.CrestronIO;
+//using Crestron.SimplSharp.Net.Http;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
+//using Newtonsoft.Json;
+//using Newtonsoft.Json.Linq;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Http;
-using PepperDash.Core;
+//using PepperDash.Essentials.Core;
+//using PepperDash.Essentials.Core.Http;
+//using PepperDash.Core;
-namespace PepperDash.Essentials
-{
- public class EssentialsHttpApiHandler
- {
- string ConfigPath;
- string PresetsPathPrefix;
- EssentialsHttpServer Server;
+//namespace PepperDash.Essentials
+//{
+// public class EssentialsHttpApiHandler
+// {
+// string ConfigPath;
+// string PresetsPathPrefix;
+// EssentialsHttpServer Server;
- ///
- ///
- ///
- /// HTTP server to attach to
- /// The full path to configuration file
- /// The folder prefix for the presets path, eq "\HTML\presets\"
- public EssentialsHttpApiHandler(EssentialsHttpServer server, string configPath, string presetsPathPrefix)
- {
- if (server == null) throw new ArgumentNullException("server");
- Server = server;
- ConfigPath = configPath;
- PresetsPathPrefix = presetsPathPrefix;
- server.ApiRequest += Server_ApiRequest;
- }
+// ///
+// ///
+// ///
+// /// HTTP server to attach to
+// /// The full path to configuration file
+// /// The folder prefix for the presets path, eq "\HTML\presets\"
+// public EssentialsHttpApiHandler(EssentialsHttpServer server, string configPath, string presetsPathPrefix)
+// {
+// if (server == null) throw new ArgumentNullException("server");
+// Server = server;
+// ConfigPath = configPath;
+// PresetsPathPrefix = presetsPathPrefix;
+// server.ApiRequest += Server_ApiRequest;
+// }
- void Server_ApiRequest(object sender, Crestron.SimplSharp.Net.Http.OnHttpRequestArgs args)
- {
- try
- {
- var path = args.Request.Path.ToLower();
+// void Server_ApiRequest(object sender, Crestron.SimplSharp.Net.Http.OnHttpRequestArgs args)
+// {
+// try
+// {
+// var path = args.Request.Path.ToLower();
- if (path == "/api/config")
- HandleApiConfig(args);
- else if (path.StartsWith("/api/presetslist/"))
- HandleApiPresetsList(args);
- else if (path == "/api/presetslists")
- HandleApiGetPresetsLists(args.Request, args.Response);
- else
- {
- args.Response.Code = 404;
- return;
- }
- args.Response.Header.SetHeaderValue("Access-Control-Allow-Origin", "*");
- args.Response.Header.SetHeaderValue("Access-Control-Allow-Methods", "GET, POST, PATCH, PUT, DELETE, OPTIONS");
- }
- catch (Exception e)
- {
- Debug.Console(1, "Uncaught HTTP server error: \n{0}", e);
- args.Response.Code = 500;
- }
- }
+// if (path == "/api/config")
+// HandleApiConfig(args);
+// else if (path.StartsWith("/api/presetslist/"))
+// HandleApiPresetsList(args);
+// else if (path == "/api/presetslists")
+// HandleApiGetPresetsLists(args.Request, args.Response);
+// else
+// {
+// args.Response.Code = 404;
+// return;
+// }
+// args.Response.Header.SetHeaderValue("Access-Control-Allow-Origin", "*");
+// args.Response.Header.SetHeaderValue("Access-Control-Allow-Methods", "GET, POST, PATCH, PUT, DELETE, OPTIONS");
+// }
+// catch (Exception e)
+// {
+// Debug.Console(1, "Uncaught HTTP server error: \n{0}", e);
+// args.Response.Code = 500;
+// }
+// }
- ///
- /// GET will return the running configuration. POST will attempt to take in a new config
- /// and restart the program.
- ///
- void HandleApiConfig(OnHttpRequestArgs args)
- {
- var request = args.Request;
- if (request.Header.RequestType == "GET")
- {
- if (File.Exists(ConfigPath))
- {
- Debug.Console(2, "Sending config:{0}", ConfigPath);
- args.Response.Header.ContentType = EssentialsHttpServer.GetContentType(new FileInfo(ConfigPath).Extension);
- args.Response.ContentStream = new FileStream(ConfigPath, FileMode.Open, FileAccess.Read);
- }
- }
- else if (request.Header.RequestType == "POST")
- {
- Debug.Console(2, "Post type: '{0}'", request.Header.ContentType);
+// ///
+// /// GET will return the running configuration. POST will attempt to take in a new config
+// /// and restart the program.
+// ///
+// void HandleApiConfig(OnHttpRequestArgs args)
+// {
+// var request = args.Request;
+// if (request.Header.RequestType == "GET")
+// {
+// if (File.Exists(ConfigPath))
+// {
+// Debug.Console(2, "Sending config:{0}", ConfigPath);
+// args.Response.Header.ContentType = EssentialsHttpServer.GetContentType(new FileInfo(ConfigPath).Extension);
+// args.Response.ContentStream = new FileStream(ConfigPath, FileMode.Open, FileAccess.Read);
+// }
+// }
+// else if (request.Header.RequestType == "POST")
+// {
+// Debug.Console(2, "Post type: '{0}'", request.Header.ContentType);
- // Make sure we're receiving at least good json
- Debug.Console(1, "Receving new config");
- if (GetContentStringJson(args) == null)
- return;
+// // Make sure we're receiving at least good json
+// Debug.Console(1, "Receving new config");
+// if (GetContentStringJson(args) == null)
+// return;
- //---------------------------- try to move these into common method
- // Move current file aside
- var bakPath = ConfigPath + ".bak";
- if (File.Exists(bakPath))
- File.Delete(bakPath);
- File.Move(ConfigPath, bakPath);
+// //---------------------------- try to move these into common method
+// // Move current file aside
+// var bakPath = ConfigPath + ".bak";
+// if (File.Exists(bakPath))
+// File.Delete(bakPath);
+// File.Move(ConfigPath, bakPath);
- // Write the file
- using (FileStream fs = File.Open(ConfigPath, FileMode.OpenOrCreate))
- using (StreamWriter sw = new StreamWriter(fs))
- {
- try
- {
- sw.Write(args.Request.ContentString);
- }
- catch (Exception e)
- {
- string err = string.Format("Error writing received config file:\r{0}", e);
- CrestronConsole.PrintLine(err);
- ErrorLog.Warn(err);
- // Put file back
- File.Move(ConfigPath + ".bak", ConfigPath);
- args.Response.Code = 500;
- return;
- }
- }
+// // Write the file
+// using (FileStream fs = File.Open(ConfigPath, FileMode.OpenOrCreate))
+// using (StreamWriter sw = new StreamWriter(fs))
+// {
+// try
+// {
+// sw.Write(args.Request.ContentString);
+// }
+// catch (Exception e)
+// {
+// string err = string.Format("Error writing received config file:\r{0}", e);
+// CrestronConsole.PrintLine(err);
+// ErrorLog.Warn(err);
+// // Put file back
+// File.Move(ConfigPath + ".bak", ConfigPath);
+// args.Response.Code = 500;
+// return;
+// }
+// }
- // If client says "yeah, restart" and has a good token
- // Restart program
- string consoleResponse = null;
- var restart = CrestronConsole.SendControlSystemCommand("progreset -p:" +
- InitialParametersClass.ApplicationNumber, ref consoleResponse);
- if (!restart) Debug.Console(0, "CAN'T DO THAT YO: {0}", consoleResponse);
- }
- }
+// // If client says "yeah, restart" and has a good token
+// // Restart program
+// string consoleResponse = null;
+// var restart = CrestronConsole.SendControlSystemCommand("progreset -p:" +
+// InitialParametersClass.ApplicationNumber, ref consoleResponse);
+// if (!restart) Debug.Console(0, "CAN'T DO THAT YO: {0}", consoleResponse);
+// }
+// }
- void HandleApiPresetsList(OnHttpRequestArgs args)
- {
- var listPath = PresetsPathPrefix + args.Request.Path.Remove(0, 17);
- Debug.Console(2, "Checking for preset list '{0}'", listPath);
+// void HandleApiPresetsList(OnHttpRequestArgs args)
+// {
+// var listPath = PresetsPathPrefix + args.Request.Path.Remove(0, 17);
+// Debug.Console(2, "Checking for preset list '{0}'", listPath);
- if (args.Request.Header.RequestType == "GET")
- {
- if (File.Exists(listPath))
- {
- Debug.Console(2, "Sending presets file:{0}", listPath);
- args.Response.Header.ContentType = EssentialsHttpServer.GetContentType(new FileInfo(listPath).Extension);
- args.Response.ContentStream = new FileStream(listPath, FileMode.Open, FileAccess.Read);
- }
- }
- else if (args.Request.Header.RequestType == "POST")
- {
- // Make sure we're receiving at least good json
- Debug.Console(1, "Receving new presets");
- if (GetContentStringJson(args) == null)
- return;
+// if (args.Request.Header.RequestType == "GET")
+// {
+// if (File.Exists(listPath))
+// {
+// Debug.Console(2, "Sending presets file:{0}", listPath);
+// args.Response.Header.ContentType = EssentialsHttpServer.GetContentType(new FileInfo(listPath).Extension);
+// args.Response.ContentStream = new FileStream(listPath, FileMode.Open, FileAccess.Read);
+// }
+// }
+// else if (args.Request.Header.RequestType == "POST")
+// {
+// // Make sure we're receiving at least good json
+// Debug.Console(1, "Receving new presets");
+// if (GetContentStringJson(args) == null)
+// return;
- //---------------------------- try to move these into common method
- // Move current file aside
- var bakPath = listPath + ".new";
- Debug.Console(2, "Moving presets file to {0}", bakPath);
- if(File.Exists(bakPath))
- File.Delete(bakPath);
- File.Move(listPath, bakPath);
+// //---------------------------- try to move these into common method
+// // Move current file aside
+// var bakPath = listPath + ".new";
+// Debug.Console(2, "Moving presets file to {0}", bakPath);
+// if(File.Exists(bakPath))
+// File.Delete(bakPath);
+// File.Move(listPath, bakPath);
- Debug.Console(2, "Writing new file");
- // Write the file
- using (FileStream fs = File.OpenWrite(listPath))
- using (StreamWriter sw = new StreamWriter(fs))
- {
- try
- {
- Debug.Console(2, "Writing {1}, {0} bytes", args.Request.ContentString.Length, listPath);
- sw.Write(args.Request.ContentString);
- }
- catch (Exception e)
- {
- string err = string.Format("Error writing received presets file:\r{0}", e);
- CrestronConsole.PrintLine(err);
- ErrorLog.Warn(err);
- // Put file back
- File.Move(listPath + ".bak", listPath);
- args.Response.Code = 500;
- return;
- }
- }
- }
- }
+// Debug.Console(2, "Writing new file");
+// // Write the file
+// using (FileStream fs = File.OpenWrite(listPath))
+// using (StreamWriter sw = new StreamWriter(fs))
+// {
+// try
+// {
+// Debug.Console(2, "Writing {1}, {0} bytes", args.Request.ContentString.Length, listPath);
+// sw.Write(args.Request.ContentString);
+// }
+// catch (Exception e)
+// {
+// string err = string.Format("Error writing received presets file:\r{0}", e);
+// CrestronConsole.PrintLine(err);
+// ErrorLog.Warn(err);
+// // Put file back
+// File.Move(listPath + ".bak", listPath);
+// args.Response.Code = 500;
+// return;
+// }
+// }
+// }
+// }
- void HandleApiGetPresetsLists(HttpServerRequest request, HttpServerResponse response)
- {
- if (request.Header.RequestType != "GET")
- {
- response.Code = 404; // This should be a 405 with an allow header
- return;
- }
+// void HandleApiGetPresetsLists(HttpServerRequest request, HttpServerResponse response)
+// {
+// if (request.Header.RequestType != "GET")
+// {
+// response.Code = 404; // This should be a 405 with an allow header
+// return;
+// }
- if (Directory.Exists(PresetsPathPrefix))
- {
- //CrestronConsole.PrintLine("Parsing presets directory");
- List files = Directory.GetFiles(PresetsPathPrefix, "*.json")
- .ToList().Select(f => Path.GetFileName(f)).ToList();
- if (files.Count > 0)
- files.Sort();
- var json = JsonConvert.SerializeObject(files);
- response.Header.ContentType = "application/json";
- response.ContentString = json;
- }
+// if (Directory.Exists(PresetsPathPrefix))
+// {
+// //CrestronConsole.PrintLine("Parsing presets directory");
+// List files = Directory.GetFiles(PresetsPathPrefix, "*.json")
+// .ToList().Select(f => Path.GetFileName(f)).ToList();
+// if (files.Count > 0)
+// files.Sort();
+// var json = JsonConvert.SerializeObject(files);
+// response.Header.ContentType = "application/json";
+// response.ContentString = json;
+// }
- // //CrestronConsole.PrintLine("Found {0} files", files.Count);
- // JObject jo = new JObject();
- // JArray ja = new JArray();
+// // //CrestronConsole.PrintLine("Found {0} files", files.Count);
+// // JObject jo = new JObject();
+// // JArray ja = new JArray();
- // foreach (var filename in files)
- // {
- // try
- // {
- // using (StreamReader sr = new StreamReader(filename))
- // {
- // JObject tempJo = JObject.Parse(sr.ReadToEnd());
- // if (tempJo.Value("content").Equals("presetsList"))
- // {
- // var jItem = new JObject(); // make a new object
- // jItem.Add("Name", tempJo["name"]);
- // jItem.Add("File", filename);
- // jItem.Add("Url", Uri.EscapeUriString(new Uri(
- // filename.Replace("\\html", "")
- // .Replace("\\HTML", "")
- // .Replace('\\', '/'), UriKind.Relative).ToString()));
- // ja.Add(jItem); // add to array
- // }
- // else
- // CrestronConsole.PrintLine("Cannot use presets file '{0}'", filename);
- // }
- // }
- // catch
- // {
- // // ignore failures - maybe delete them
- // CrestronConsole.PrintLine("Unable to read presets file '{0}'", filename);
- // }
- // }
- // jo.Add("PresetChannelLists", ja);
- // //CrestronConsole.PrintLine(jo.ToString());
- // response.Header.ContentType = "application/json";
- // response.ContentString = jo.ToString();
- //}
- //else
- // CrestronConsole.PrintLine("No presets files in directory");
- }
+// // foreach (var filename in files)
+// // {
+// // try
+// // {
+// // using (StreamReader sr = new StreamReader(filename))
+// // {
+// // JObject tempJo = JObject.Parse(sr.ReadToEnd());
+// // if (tempJo.Value("content").Equals("presetsList"))
+// // {
+// // var jItem = new JObject(); // make a new object
+// // jItem.Add("Name", tempJo["name"]);
+// // jItem.Add("File", filename);
+// // jItem.Add("Url", Uri.EscapeUriString(new Uri(
+// // filename.Replace("\\html", "")
+// // .Replace("\\HTML", "")
+// // .Replace('\\', '/'), UriKind.Relative).ToString()));
+// // ja.Add(jItem); // add to array
+// // }
+// // else
+// // CrestronConsole.PrintLine("Cannot use presets file '{0}'", filename);
+// // }
+// // }
+// // catch
+// // {
+// // // ignore failures - maybe delete them
+// // CrestronConsole.PrintLine("Unable to read presets file '{0}'", filename);
+// // }
+// // }
+// // jo.Add("PresetChannelLists", ja);
+// // //CrestronConsole.PrintLine(jo.ToString());
+// // response.Header.ContentType = "application/json";
+// // response.ContentString = jo.ToString();
+// //}
+// //else
+// // CrestronConsole.PrintLine("No presets files in directory");
+// }
- ///
- /// Simply does what it says
- ///
- JObject GetContentStringJson(OnHttpRequestArgs args)
- {
- //var content = args.Request.ContentString;
- //Debug.Console(1, "{0}", content);
+// ///
+// /// Simply does what it says
+// ///
+// JObject GetContentStringJson(OnHttpRequestArgs args)
+// {
+// //var content = args.Request.ContentString;
+// //Debug.Console(1, "{0}", content);
- try
- {
- // just see if it parses properly
- return JObject.Parse(args.Request.ContentString);
- }
- catch (Exception e)
- {
- string err = string.Format("JSON Error reading config file:\r{0}", e);
- CrestronConsole.PrintLine(err);
- ErrorLog.Warn(err);
- args.Response.Code = 400; // Bad request
- return null;
- }
- }
- }
-}
\ No newline at end of file
+// try
+// {
+// // just see if it parses properly
+// return JObject.Parse(args.Request.ContentString);
+// }
+// catch (Exception e)
+// {
+// string err = string.Format("JSON Error reading config file:\r{0}", e);
+// CrestronConsole.PrintLine(err);
+// ErrorLog.Warn(err);
+// args.Response.Code = 400; // Bad request
+// return null;
+// }
+// }
+// }
+//}
\ No newline at end of file
diff --git a/Essentials/PepperDashEssentials/PepperDashEssentials.csproj b/Essentials/PepperDashEssentials/PepperDashEssentials.csproj
index a74e15fe..1373e284 100644
--- a/Essentials/PepperDashEssentials/PepperDashEssentials.csproj
+++ b/Essentials/PepperDashEssentials/PepperDashEssentials.csproj
@@ -75,10 +75,6 @@
..\..\..\essentials-devices-common\Essentials Devices Common\Essentials Devices Common\bin\Essentials Devices Common.dll
True
-
- False
- ..\..\..\essentials-http-server\EssentialsHttpServer\bin\EssentialsHttpServer.dll
-
False
diff --git a/Essentials/PepperDashEssentials/PepperDashEssentials.projectinfo b/Essentials/PepperDashEssentials/PepperDashEssentials.projectinfo
index e4fe4b78..622ba56e 100644
Binary files a/Essentials/PepperDashEssentials/PepperDashEssentials.projectinfo and b/Essentials/PepperDashEssentials/PepperDashEssentials.projectinfo differ