diff --git a/.gitignore b/.gitignore index 7c12997..aceac07 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ *.suo +*.user */bin/* */obj/* Dotfuscated/* +Published/* diff --git a/Scrummer.sln b/Scrummer.sln index 087f852..5cb6ea0 100644 --- a/Scrummer.sln +++ b/Scrummer.sln @@ -1,22 +1,27 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scrummer", "Scrummer\Scrummer.csproj", "{7596FD6B-DAF0-4B22-B356-5CF4629F0436}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7596FD6B-DAF0-4B22-B356-5CF4629F0436}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7596FD6B-DAF0-4B22-B356-5CF4629F0436}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7596FD6B-DAF0-4B22-B356-5CF4629F0436}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7596FD6B-DAF0-4B22-B356-5CF4629F0436}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scrummer", "Scrummer\Scrummer.csproj", "{7596FD6B-DAF0-4B22-B356-5CF4629F0436}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{22F69F04-ABC4-44DB-9742-A24012298108}" + ProjectSection(SolutionItems) = preProject + Notes.txt = Notes.txt + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7596FD6B-DAF0-4B22-B356-5CF4629F0436}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7596FD6B-DAF0-4B22-B356-5CF4629F0436}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7596FD6B-DAF0-4B22-B356-5CF4629F0436}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7596FD6B-DAF0-4B22-B356-5CF4629F0436}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Scrummer/Code/Bundler.cs b/Scrummer/Code/Bundler.cs index 0dca522..86662fa 100644 --- a/Scrummer/Code/Bundler.cs +++ b/Scrummer/Code/Bundler.cs @@ -1,57 +1,57 @@ -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; - -namespace Scrummer.Code -{ - public class Bundler - { - #region Declarations - - private string _path = null; - private List _files = null; - - #endregion - - #region Properties - - private List Files - { - get - { - if (_files != null) { return _files; } - - DirectoryInfo dir = new DirectoryInfo(_path); - FileInfo[] files = dir.GetFiles(); - _files = files.OrderBy(file => file.FullName).Select(file2 => file2.FullName).ToList(); - return _files; - } - } - - #endregion - - #region Creator - - public Bundler(string path) - { - _path = path; - } - - #endregion - - #region Public methods - - public void WriteResponse(Stream outStream) - { - foreach (string fileName in Files) - { - string fileContent = File.ReadAllText(fileName); - byte[] byteArray = Encoding.UTF8.GetBytes(fileContent); - outStream.Write(byteArray, 0, byteArray.Length); - } - } - - #endregion - } -} \ No newline at end of file +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; + +namespace Scrummer.Code +{ + public class Bundler + { + #region Declarations + + private string _path = null; + private List _files = null; + + #endregion + + #region Properties + + private List Files + { + get + { + if (_files != null) { return _files; } + + DirectoryInfo dir = new DirectoryInfo(_path); + FileInfo[] files = dir.GetFiles(); + _files = files.OrderBy(file => file.FullName).Select(file2 => file2.FullName).ToList(); + return _files; + } + } + + #endregion + + #region Creator + + public Bundler(string path) + { + _path = path; + } + + #endregion + + #region Public methods + + public void WriteResponse(Stream outStream) + { + foreach (string fileName in Files) + { + string fileContent = File.ReadAllText(fileName); + byte[] byteArray = Encoding.UTF8.GetBytes(fileContent); + outStream.Write(byteArray, 0, byteArray.Length); + } + } + + #endregion + } +} diff --git a/Scrummer/Code/Controls/CLabel.cs b/Scrummer/Code/Controls/CLabel.cs index 5e0483b..41b28d3 100644 --- a/Scrummer/Code/Controls/CLabel.cs +++ b/Scrummer/Code/Controls/CLabel.cs @@ -1,41 +1,41 @@ -using System.Web.UI; -using System.Web.UI.WebControls; - -namespace Scrummer.Code.Controls -{ - public class CLabel : Label - { - #region Declarations - - private string _tagName = "span"; - - #endregion - - #region Properties - - public string Tag - { - get { return _tagName; } - set { _tagName = value; } - } - - #endregion - - #region Life cycle - - public override void RenderBeginTag(HtmlTextWriter writer) - { - if (string.IsNullOrEmpty(_tagName) == false) - { - this.AddAttributesToRender(writer); - writer.RenderBeginTag(_tagName); - } - else - { - base.RenderBeginTag(writer); - } - } - - #endregion - } -} \ No newline at end of file +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace Scrummer.Code.Controls +{ + public class CLabel : Label + { + #region Declarations + + private string _tagName = "span"; + + #endregion + + #region Properties + + public string Tag + { + get { return _tagName; } + set { _tagName = value; } + } + + #endregion + + #region Life cycle + + public override void RenderBeginTag(HtmlTextWriter writer) + { + if (string.IsNullOrEmpty(_tagName) == false) + { + this.AddAttributesToRender(writer); + writer.RenderBeginTag(_tagName); + } + else + { + base.RenderBeginTag(writer); + } + } + + #endregion + } +} diff --git a/Scrummer/Code/Controls/ChatControl.cs b/Scrummer/Code/Controls/ChatControl.cs index c03eaf7..f19b972 100644 --- a/Scrummer/Code/Controls/ChatControl.cs +++ b/Scrummer/Code/Controls/ChatControl.cs @@ -1,131 +1,127 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.HtmlControls; -using System.Web.UI.WebControls; - -namespace Scrummer.Code.Controls -{ - public class ChatControl : Control - { - #region Declarations - - private string _serviceUrl = "ChatHandler"; - - private int _idBoard = 0; - - private string _userName = string.Empty; - - private Unit _width = new Unit(500, UnitType.Pixel); - private Unit _height = new Unit(300, UnitType.Pixel); - - private Panel _divChatWindow = null; - - #endregion - - #region Properties - - public string ServiceUrl - { - get { return _serviceUrl; } - set { _serviceUrl = value; } - } - - public int IDBoard - { - get { return _idBoard; } - set { _idBoard = value; } - } - - public string UserName - { - get { return _userName; } - set { _userName = value; } - } - - public Unit Width - { - get { return _width; } - set - { - _width = value; - if (_divChatWindow != null) - { - _divChatWindow.Width = value; - } - } - } - - public Unit Height - { - get { return _height; } - set - { - _height = value; - if (_divChatWindow != null) - { - _divChatWindow.Height = value; - } - } - } - - #endregion - - #region Control Life cycle - - public ChatControl() - { - Init += ChatControl_Init; - } - - void ChatControl_Init(object sender, EventArgs e) - { - InitializeControls(); - } - - #endregion - - #region Private methods - - private void InitializeControls() - { - _divChatWindow = new Panel { ID = "divChatWindow", CssClass = "divChatWindow" }; - Controls.Add(_divChatWindow); - _divChatWindow.Width = _width; - _divChatWindow.Height = _height; - - var divChat = new Panel { ID = "divChat", CssClass = "divChat" }; - _divChatWindow.Controls.Add(divChat); - - var divChatControls = new Panel { ID = "divChatControls", CssClass = "divChatControls" }; - _divChatWindow.Controls.Add(divChatControls); - - var hidUserName = new HiddenField { ID = "hidUserName", Value = _userName }; - divChatControls.Controls.Add(hidUserName); - - var hidIDMessage = new HiddenField { ID = "hidIDMessage", Value = "0" }; - divChatControls.Controls.Add(hidIDMessage); - - var hidLastUser = new HiddenField { ID = "hidLastUser", Value = "" }; - divChatControls.Controls.Add(hidLastUser); - - var txtText = new TextBox { ID = "txtText", CssClass = "chatTextBox" }; - txtText.Attributes.Add("autocomplete", "off"); - divChatControls.Controls.Add(txtText); - - var btnSend = new Button { ID = "btnSend", Text = "Send", CssClass = "chatButton" }; - divChatControls.Controls.Add(btnSend); - btnSend.Attributes.Add("onclick", String.Format("SendChat('{0}', '{1}', {2}, '{3}'); return false;", - _serviceUrl, txtText.ClientID, _idBoard, hidUserName.ClientID)); - - LiteralControl litScript = new LiteralControl(); - litScript.Text = String.Format("", - _serviceUrl, divChat.ClientID, _idBoard, hidIDMessage.ClientID, hidUserName.ClientID, hidLastUser.ClientID); - Controls.Add(litScript); - } - - #endregion - } -} \ No newline at end of file +using System; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace Scrummer.Code.Controls +{ + public class ChatControl : Control + { + #region Declarations + + private string _serviceUrl = "ChatHandler"; + + private int _idBoard = 0; + + private string _userName = string.Empty; + + private Unit _width = new Unit(500, UnitType.Pixel); + private Unit _height = new Unit(300, UnitType.Pixel); + + private Panel _divChatWindow = null; + + #endregion + + #region Properties + + public string ServiceUrl + { + get { return _serviceUrl; } + set { _serviceUrl = value; } + } + + public int IDBoard + { + get { return _idBoard; } + set { _idBoard = value; } + } + + public string UserName + { + get { return _userName; } + set { _userName = value; } + } + + public Unit Width + { + get { return _width; } + set + { + _width = value; + if (_divChatWindow != null) + { + _divChatWindow.Width = value; + } + } + } + + public Unit Height + { + get { return _height; } + set + { + _height = value; + if (_divChatWindow != null) + { + _divChatWindow.Height = value; + } + } + } + + #endregion + + #region Control Life cycle + + public ChatControl() + { + Init += ChatControl_Init; + } + + void ChatControl_Init(object sender, EventArgs e) + { + InitializeControls(); + } + + #endregion + + #region Private methods + + private void InitializeControls() + { + _divChatWindow = new Panel { ID = "divChatWindow", CssClass = "divChatWindow" }; + Controls.Add(_divChatWindow); + _divChatWindow.Width = _width; + _divChatWindow.Height = _height; + + var divChat = new Panel { ID = "divChat", CssClass = "divChat" }; + _divChatWindow.Controls.Add(divChat); + + var divChatControls = new Panel { ID = "divChatControls", CssClass = "divChatControls" }; + _divChatWindow.Controls.Add(divChatControls); + + var hidUserName = new HiddenField { ID = "hidUserName", Value = _userName }; + divChatControls.Controls.Add(hidUserName); + + var hidIDMessage = new HiddenField { ID = "hidIDMessage", Value = "0" }; + divChatControls.Controls.Add(hidIDMessage); + + var hidLastUser = new HiddenField { ID = "hidLastUser", Value = "" }; + divChatControls.Controls.Add(hidLastUser); + + var txtText = new TextBox { ID = "txtText", CssClass = "chatTextBox" }; + txtText.Attributes.Add("autocomplete", "off"); + divChatControls.Controls.Add(txtText); + + var btnSend = new Button { ID = "btnSend", Text = "Send", CssClass = "chatButton" }; + divChatControls.Controls.Add(btnSend); + btnSend.Attributes.Add("onclick", String.Format("SendChat('{0}', '{1}', {2}, '{3}'); return false;", + _serviceUrl, txtText.ClientID, _idBoard, hidUserName.ClientID)); + + LiteralControl litScript = new LiteralControl(); + litScript.Text = String.Format("", + _serviceUrl, divChat.ClientID, _idBoard, hidIDMessage.ClientID, hidUserName.ClientID, hidLastUser.ClientID); + Controls.Add(litScript); + } + + #endregion + } +} diff --git a/Scrummer/Code/Controls/ChatHandler.cs b/Scrummer/Code/Controls/ChatHandler.cs index dd07d0e..f0481ca 100644 --- a/Scrummer/Code/Controls/ChatHandler.cs +++ b/Scrummer/Code/Controls/ChatHandler.cs @@ -1,141 +1,142 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Web; -using Scrummer.Code.JSON; - -namespace Scrummer.Code -{ - public class Message - { - public int IDMessage { get; set; } - public string UserName { get; set; } - public string Text { get; set; } - }; - - public class MessageBoard - { - private List _messages = new List(); - private int lastIDMessage = 0; - - public List Messages_GetList(int idMessage) - { - List listMessages = new List(); - for (int i = 0, n = _messages.Count; i < n; i++) - { - Message msg = _messages[i]; - if (msg.IDMessage > idMessage) - { - listMessages.Insert(0, msg); - } - else - { - break; - } - } - return listMessages; - } - - public void Message_Add(string userName, string text) - { - lastIDMessage++; - Message msg = new Message(); - msg.IDMessage = lastIDMessage; - msg.UserName = userName; - msg.Text = text; - _messages.Insert(0, msg); - } - } - - public class ChatHandler : IHttpHandler - { - private static object _monitor = new object(); - private static Dictionary _chatBoards = new Dictionary(); - - public bool IsReusable - { - get { throw new NotImplementedException(); } - } - - public void ProcessRequest(HttpContext context) - { - if (context.Request.RequestType == "GET") - { - ProcessRevicer(context); - } - if (context.Request.RequestType == "POST") - { - ProcessSender(context); - } - } - - private void ProcessRevicer(HttpContext context) - { - int idBoard = Convert.ToInt32(context.Request.Params["idBoard"]); - int idMessage = Convert.ToInt32(context.Request.Params["idMessage"]); - MessageBoard messageBoard; - bool mustWait = true; - do - { - if (_chatBoards.ContainsKey(idBoard)) - { - messageBoard = _chatBoards[idBoard]; - List listMessages = messageBoard.Messages_GetList(idMessage); - if (listMessages.Count > 0) - { - mustWait = false; - ResponseObject(context, listMessages); - } - } - if (mustWait) - { - lock (_monitor) { Monitor.Wait(_monitor, 10000); } - } - } while (mustWait); - } - - private void ProcessSender(HttpContext context) - { - string strIDBoard = GetRequestParm(context, "idBoard"); - int idBoard = Convert.ToInt32(string.IsNullOrEmpty(strIDBoard) ? "0" : strIDBoard); - string userName = Convert.ToString(GetRequestParm(context, "userName")); - string text = Convert.ToString(GetRequestParm(context, "text")); - - lock (_chatBoards) - { - MessageBoard messageBoard; - if (_chatBoards.ContainsKey(idBoard)) - { - messageBoard = _chatBoards[idBoard]; - } - else - { - messageBoard = new MessageBoard(); - _chatBoards[idBoard] = messageBoard; - } - messageBoard.Message_Add(userName, text); - lock (_monitor) { Monitor.PulseAll(_monitor); } - } - } - - private string GetRequestParm(HttpContext context, string parm) - { - foreach (string key in context.Request.Params.AllKeys) - { - if (string.IsNullOrEmpty(key) == false && key.EndsWith(parm)) - { - return context.Request.Params[key]; - } - } - return string.Empty; - } - - private void ResponseObject(HttpContext context, object obj) - { - var jsonWritter = new JSONWriter(true); - context.Response.ContentType = "text/json"; - context.Response.Write(jsonWritter.Write(obj)); - } - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.Threading; +using System.Web; +using Scrummer.Code.JSON; + +namespace Scrummer.Code +{ + public class Message + { + public int IDMessage { get; set; } + public string UserName { get; set; } + public string Text { get; set; } + public DateTime Date { get; set; } + }; + + public class MessageBoard + { + private List _messages = new List(); + private int lastIDMessage = 0; + + public List Messages_GetList(int idMessage) + { + List listMessages = new List(); + for (int i = 0, n = _messages.Count; i < n; i++) + { + Message msg = _messages[i]; + if (msg.IDMessage > idMessage) + { + listMessages.Insert(0, msg); + } + else + { + break; + } + } + return listMessages; + } + + public void Message_Add(string userName, string text) + { + lastIDMessage++; + Message msg = new Message(); + msg.IDMessage = lastIDMessage; + msg.UserName = userName; + msg.Text = text; + msg.Date = DateTime.UtcNow; + _messages.Insert(0, msg); + } + } + + public class ChatHandler : IHttpHandler + { + private static object _monitor = new object(); + private static Dictionary _chatBoards = new Dictionary(); + + public bool IsReusable + { + get { throw new NotImplementedException(); } + } + + public void ProcessRequest(HttpContext context) + { + if (context.Request.RequestType == "GET") + { + ProcessRevicer(context); + } + if (context.Request.RequestType == "POST") + { + ProcessSender(context); + } + } + + private void ProcessRevicer(HttpContext context) + { + int idBoard = Convert.ToInt32(context.Request.Params["idBoard"]); + int idMessage = Convert.ToInt32(context.Request.Params["idMessage"]); + MessageBoard messageBoard; + bool mustWait = true; + do + { + if (_chatBoards.ContainsKey(idBoard)) + { + messageBoard = _chatBoards[idBoard]; + List listMessages = messageBoard.Messages_GetList(idMessage); + if (listMessages.Count > 0) + { + mustWait = false; + ResponseObject(context, listMessages); + } + } + if (mustWait) + { + lock (_monitor) { Monitor.Wait(_monitor, 10000); } + } + } while (mustWait); + } + + private void ProcessSender(HttpContext context) + { + string strIDBoard = GetRequestParm(context, "idBoard"); + int idBoard = Convert.ToInt32(string.IsNullOrEmpty(strIDBoard) ? "0" : strIDBoard); + string userName = Convert.ToString(GetRequestParm(context, "userName")); + string text = Convert.ToString(GetRequestParm(context, "text")); + + lock (_chatBoards) + { + MessageBoard messageBoard; + if (_chatBoards.ContainsKey(idBoard)) + { + messageBoard = _chatBoards[idBoard]; + } + else + { + messageBoard = new MessageBoard(); + _chatBoards[idBoard] = messageBoard; + } + messageBoard.Message_Add(userName, text); + lock (_monitor) { Monitor.PulseAll(_monitor); } + } + } + + private string GetRequestParm(HttpContext context, string parm) + { + foreach (string key in context.Request.Params.AllKeys) + { + if (string.IsNullOrEmpty(key) == false && key.EndsWith(parm)) + { + return context.Request.Params[key]; + } + } + return string.Empty; + } + + private void ResponseObject(HttpContext context, object obj) + { + var jsonWritter = new JSONWriter(true); + context.Response.ContentType = "text/json"; + context.Response.Write(jsonWritter.Write(obj)); + } + } +} diff --git a/Scrummer/Code/GlobalErrorHandler.cs b/Scrummer/Code/GlobalErrorHandler.cs index e24aa4d..3aba2ac 100644 --- a/Scrummer/Code/GlobalErrorHandler.cs +++ b/Scrummer/Code/GlobalErrorHandler.cs @@ -1,64 +1,64 @@ -using System; -using System.Text; -using System.Web; -using Scrummer.Code.Pages; - -namespace Scrummer.Code -{ - public static class GlobalErrorHandler - { - #region Private methods - - private static void ShowInternalError(HttpContext context, Exception ex) - { - context.Response.StatusCode = 500; - context.Response.Clear(); - - StringBuilder sbOutput = new StringBuilder(); - sbOutput.Append("

Internal error

"); - Exception exAux = ex; - if (exAux is HttpUnhandledException && exAux.InnerException != null) { exAux = exAux.InnerException; } - while (exAux != null) - { - sbOutput.AppendFormat("

Message: {0}

", exAux.Message); - sbOutput.AppendFormat("

StackTrace:

{0}
", exAux.StackTrace); - exAux = exAux.InnerException; - } - - // Fill response to 512 bytes to avoid browser "beauty" response of errors. - long fillResponse = 512 - sbOutput.Length; - if (fillResponse > 0) - { - sbOutput.Append(""); - } - - context.Response.Write(sbOutput.ToString()); - } - - #endregion - - #region Public methods - - public static void HandleError(HttpContext context, Exception ex) - { - try - { - IHttpHandler frmError = new FrmError(ex); - context.Response.Clear(); - context.Handler = frmError; - frmError.ProcessRequest(context); - } - catch - { - ShowInternalError(context, ex); - } - } - - #endregion - } -} \ No newline at end of file +using System; +using System.Text; +using System.Web; +using Scrummer.Code.Pages; + +namespace Scrummer.Code +{ + public static class GlobalErrorHandler + { + #region Private methods + + private static void ShowInternalError(HttpContext context, Exception ex) + { + context.Response.StatusCode = 500; + context.Response.Clear(); + + StringBuilder sbOutput = new StringBuilder(); + sbOutput.Append("

Internal error

"); + Exception exAux = ex; + if (exAux is HttpUnhandledException && exAux.InnerException != null) { exAux = exAux.InnerException; } + while (exAux != null) + { + sbOutput.AppendFormat("

Message: {0}

", exAux.Message); + sbOutput.AppendFormat("

StackTrace:

{0}
", exAux.StackTrace); + exAux = exAux.InnerException; + } + + // Fill response to 512 bytes to avoid browser "beauty" response of errors. + long fillResponse = 512 - sbOutput.Length; + if (fillResponse > 0) + { + sbOutput.Append(""); + } + + context.Response.Write(sbOutput.ToString()); + } + + #endregion + + #region Public methods + + public static void HandleError(HttpContext context, Exception ex) + { + try + { + IHttpHandler frmError = new FrmError(ex); + context.Response.Clear(); + context.Handler = frmError; + frmError.ProcessRequest(context); + } + catch + { + ShowInternalError(context, ex); + } + } + + #endregion + } +} diff --git a/Scrummer/Code/JSON/JSONParser.cs b/Scrummer/Code/JSON/JSONParser.cs index ce42042..15c071c 100644 --- a/Scrummer/Code/JSON/JSONParser.cs +++ b/Scrummer/Code/JSON/JSONParser.cs @@ -1,411 +1,411 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Scrummer.Code.JSON -{ - public class JSONParser - { - #region Declarations - - private ParserContext ctx; - private bool tainted = false; - - #endregion - - #region Private methods - - private int ParseHexShort() - { - int value = 0; - for (int i = 0; i < 4; i++) - { - char c = ctx.Next(); - if (Char.IsDigit(c)) - { - value = (value << 4) | (c - '0'); - } - else - { - c = Char.ToLower(c); - if (c >= 'a' && c <= 'f') - { - value = (value << 4) | ((c - 'a') + 10); - } - } - } - return value; - } - - private String ParseQuotedString() - { - StringBuilder scratch = new StringBuilder(); - char c = ctx.SkipWhite(); - if (c == '"') - { - c = ctx.Next(); - } - do - { - if (c == '\\') - { - c = ctx.Next(); - if (c == '"') - { - scratch.Append('"'); - } - else if (c == '\\') - { - scratch.Append('\\'); - } - else if (c == '/') - { - scratch.Append('/'); - } - else if (c == 'b') - { - scratch.Append('\b'); - } - else if (c == 'f') - { - scratch.Append('\f'); - } - else if (c == 'n') - { - scratch.Append('\n'); - } - else if (c == 'r') - { - scratch.Append('\r'); - } - else if (c == 't') - { - scratch.Append('\t'); - } - else if (c == 'u') - { - scratch.Append((char)ParseHexShort()); - } - c = ctx.Next(); - } - else if (c == '"') - { - break; - } - else - { - scratch.Append(c); - c = ctx.Next(); - } - } while (!ctx.AtEnd()); - if (c == '"') - { - ctx.Next(); - } - return scratch.ToString(); - } - - private String ParseString() - { - char c = ctx.SkipWhite(); - if (c == '"') - { - return ParseQuotedString(); - } - StringBuilder scratch = new StringBuilder(); - - while (!ctx.AtEnd() - && (Char.IsLetter(c) || Char.IsDigit(c) || c == '_')) - { - scratch.Append(c); - c = ctx.Next(); - } - - return scratch.ToString(); - } - - private Object ParseNumber() - { - StringBuilder scratch = new StringBuilder(); - bool isFloat = false; - int numberLenght = 0; - char c; - c = ctx.SkipWhite(); - - // Sign - if (c == '-') - { - scratch.Append('-'); - c = ctx.Next(); - } - - // Integer part - while (Char.IsDigit(c)) - { - scratch.Append(c); - c = ctx.Next(); - numberLenght++; - } - - // Decimal part - if (c == '.') - { - isFloat = true; - scratch.Append('.'); - c = ctx.Next(); - while (Char.IsDigit(c)) - { - scratch.Append(c); - c = ctx.Next(); - numberLenght++; - } - } - - if (numberLenght == 0) - { - tainted = true; - return null; - } - - // Exponential part - if (c == 'e' || c == 'E') - { - isFloat = true; - scratch.Append('E'); - c = ctx.Next(); - if (c == '+' || c == '-') - { - scratch.Append(c); - } - while (Char.IsDigit(c)) - { - scratch.Append(c); - c = ctx.Next(); - numberLenght++; - } - } - - // Build number object from the parsed string - String s = scratch.ToString(); - return isFloat ? (numberLenght < 17) ? (Object)Double.Parse(s) - : Decimal.Parse(s) : (numberLenght < 19) ? (Object)System.Int32.Parse(s) - : (Object)System.Int32.Parse(s); - } - - private List ParseArray() - { - char c = ctx.SkipWhite(); - List array = new List(); - if (c == '[') - { - ctx.Next(); - } - do - { - c = ctx.SkipWhite(); - if (c == ']') - { - ctx.Next(); - break; - } - else if (c == ',') - { - ctx.Next(); - } - else - { - array.Add(ParseValue()); - } - } while (!ctx.AtEnd()); - return array; - } - - private Dictionary ParseObject() - { - char c = ctx.SkipWhite(); - Dictionary obj = new Dictionary(); - if (c == '{') - { - ctx.Next(); - c = ctx.SkipWhite(); - } - String attributeName; - Object attributeValue; - do - { - attributeName = ParseString(); - c = ctx.SkipWhite(); - if (c == ':') - { - ctx.Next(); - attributeValue = ParseValue(); - if (attributeName.Length > 0) - { - obj.Add(attributeName, attributeValue); - } - } - else if (c == ',') - { - ctx.Next(); - c = ctx.SkipWhite(); - } - else if (c == '}') - { - ctx.Next(); - break; - } - else - { - // Unexpected character - tainted = true; - break; - } - } while (!ctx.AtEnd()); - if (obj.Count == 0) - { - return null; - } - return obj; - } - - private Object ParseValue() - { - Object token = null; - char c = ctx.SkipWhite(); - switch (c) - { - case '"': - token = ParseQuotedString(); - break; - case '{': - token = ParseObject(); - break; - case '[': - token = ParseArray(); - break; - default: - if (Char.IsDigit(c) || c == '-') - { - token = ParseNumber(); - } - else - { - String aux = ParseString(); - if (aux.CompareTo("true") == 0) - { - token = true; - } - else if (aux.CompareTo("false") == 0) - { - token = false; - } - else if (aux.CompareTo("null") == 0) - { - token = null; - } - else - { - // Unexpected string - if (aux.Length == 0) - { - ctx.Next(); - } - tainted = true; - token = null; - } - } - break; - } - return token; - } - - private String CleanIdentifier(String input) - { - int i; - char c; - i = input.Length - 1; - if (i < 0) - { - return input; - } - c = input[i]; - while (Char.IsLetter(c) || Char.IsDigit(c) || c == '_') - { - i--; - if (i < 0) - { - break; - } - c = input[i]; - } - return input.Substring(i + 1); - } - - #endregion - - #region Public methods - - public Object Parse(String text) - { - // Get the first object - ctx = new ParserContext(text); - tainted = false; - ctx.Mark(); - Object obj = ParseValue(); - if (ctx.AtEnd()) - { - return obj; - } - - // "But wait, there is more!" - int idx = 0; - String name = ""; - String strInvalidPrev = ""; - Dictionary superObject = new Dictionary(); - do - { - // Add the object to the superObject - if (!tainted && name.Length > 0 && obj != null) - { - if (name.Length == 0) - { - name = String.Format("{0:D2}", idx); - } - superObject.Add(name, obj); - idx++; - name = ""; - } - else - { - String strInvalid = ctx.GetMarked(); - strInvalid = strInvalid.Trim(); - if (strInvalidPrev.Length > 0 - && "=".CompareTo(strInvalid) == 0) - { - name = CleanIdentifier(strInvalidPrev); - } - else - { - name = ""; - } - strInvalidPrev = strInvalid; - } - - // Check end - if (ctx.AtEnd()) - { - break; - } - - // Get next object - tainted = false; - ctx.Mark(); - obj = ParseValue(); - - } while (true); - return superObject; - } - - #endregion - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.Text; + +namespace Scrummer.Code.JSON +{ + public class JSONParser + { + #region Declarations + + private ParserContext ctx; + private bool tainted = false; + + #endregion + + #region Private methods + + private int ParseHexShort() + { + int value = 0; + for (int i = 0; i < 4; i++) + { + char c = ctx.Next(); + if (Char.IsDigit(c)) + { + value = (value << 4) | (c - '0'); + } + else + { + c = Char.ToLower(c); + if (c >= 'a' && c <= 'f') + { + value = (value << 4) | ((c - 'a') + 10); + } + } + } + return value; + } + + private String ParseQuotedString() + { + StringBuilder scratch = new StringBuilder(); + char c = ctx.SkipWhite(); + if (c == '"') + { + c = ctx.Next(); + } + do + { + if (c == '\\') + { + c = ctx.Next(); + if (c == '"') + { + scratch.Append('"'); + } + else if (c == '\\') + { + scratch.Append('\\'); + } + else if (c == '/') + { + scratch.Append('/'); + } + else if (c == 'b') + { + scratch.Append('\b'); + } + else if (c == 'f') + { + scratch.Append('\f'); + } + else if (c == 'n') + { + scratch.Append('\n'); + } + else if (c == 'r') + { + scratch.Append('\r'); + } + else if (c == 't') + { + scratch.Append('\t'); + } + else if (c == 'u') + { + scratch.Append((char)ParseHexShort()); + } + c = ctx.Next(); + } + else if (c == '"') + { + break; + } + else + { + scratch.Append(c); + c = ctx.Next(); + } + } while (!ctx.AtEnd()); + if (c == '"') + { + ctx.Next(); + } + return scratch.ToString(); + } + + private String ParseString() + { + char c = ctx.SkipWhite(); + if (c == '"') + { + return ParseQuotedString(); + } + StringBuilder scratch = new StringBuilder(); + + while (!ctx.AtEnd() + && (Char.IsLetter(c) || Char.IsDigit(c) || c == '_')) + { + scratch.Append(c); + c = ctx.Next(); + } + + return scratch.ToString(); + } + + private Object ParseNumber() + { + StringBuilder scratch = new StringBuilder(); + bool isFloat = false; + int numberLenght = 0; + char c; + c = ctx.SkipWhite(); + + // Sign + if (c == '-') + { + scratch.Append('-'); + c = ctx.Next(); + } + + // Integer part + while (Char.IsDigit(c)) + { + scratch.Append(c); + c = ctx.Next(); + numberLenght++; + } + + // Decimal part + if (c == '.') + { + isFloat = true; + scratch.Append('.'); + c = ctx.Next(); + while (Char.IsDigit(c)) + { + scratch.Append(c); + c = ctx.Next(); + numberLenght++; + } + } + + if (numberLenght == 0) + { + tainted = true; + return null; + } + + // Exponential part + if (c == 'e' || c == 'E') + { + isFloat = true; + scratch.Append('E'); + c = ctx.Next(); + if (c == '+' || c == '-') + { + scratch.Append(c); + } + while (Char.IsDigit(c)) + { + scratch.Append(c); + c = ctx.Next(); + numberLenght++; + } + } + + // Build number object from the parsed string + String s = scratch.ToString(); + return isFloat ? (numberLenght < 17) ? (Object)Double.Parse(s) + : Decimal.Parse(s) : (numberLenght < 19) ? (Object)System.Int32.Parse(s) + : (Object)System.Int32.Parse(s); + } + + private List ParseArray() + { + char c = ctx.SkipWhite(); + List array = new List(); + if (c == '[') + { + ctx.Next(); + } + do + { + c = ctx.SkipWhite(); + if (c == ']') + { + ctx.Next(); + break; + } + else if (c == ',') + { + ctx.Next(); + } + else + { + array.Add(ParseValue()); + } + } while (!ctx.AtEnd()); + return array; + } + + private Dictionary ParseObject() + { + char c = ctx.SkipWhite(); + Dictionary obj = new Dictionary(); + if (c == '{') + { + ctx.Next(); + c = ctx.SkipWhite(); + } + String attributeName; + Object attributeValue; + do + { + attributeName = ParseString(); + c = ctx.SkipWhite(); + if (c == ':') + { + ctx.Next(); + attributeValue = ParseValue(); + if (attributeName.Length > 0) + { + obj.Add(attributeName, attributeValue); + } + } + else if (c == ',') + { + ctx.Next(); + c = ctx.SkipWhite(); + } + else if (c == '}') + { + ctx.Next(); + break; + } + else + { + // Unexpected character + tainted = true; + break; + } + } while (!ctx.AtEnd()); + if (obj.Count == 0) + { + return null; + } + return obj; + } + + private Object ParseValue() + { + Object token = null; + char c = ctx.SkipWhite(); + switch (c) + { + case '"': + token = ParseQuotedString(); + break; + case '{': + token = ParseObject(); + break; + case '[': + token = ParseArray(); + break; + default: + if (Char.IsDigit(c) || c == '-') + { + token = ParseNumber(); + } + else + { + String aux = ParseString(); + if (aux.CompareTo("true") == 0) + { + token = true; + } + else if (aux.CompareTo("false") == 0) + { + token = false; + } + else if (aux.CompareTo("null") == 0) + { + token = null; + } + else + { + // Unexpected string + if (aux.Length == 0) + { + ctx.Next(); + } + tainted = true; + token = null; + } + } + break; + } + return token; + } + + private String CleanIdentifier(String input) + { + int i; + char c; + i = input.Length - 1; + if (i < 0) + { + return input; + } + c = input[i]; + while (Char.IsLetter(c) || Char.IsDigit(c) || c == '_') + { + i--; + if (i < 0) + { + break; + } + c = input[i]; + } + return input.Substring(i + 1); + } + + #endregion + + #region Public methods + + public Object Parse(String text) + { + // Get the first object + ctx = new ParserContext(text); + tainted = false; + ctx.Mark(); + Object obj = ParseValue(); + if (ctx.AtEnd()) + { + return obj; + } + + // "But wait, there is more!" + int idx = 0; + String name = ""; + String strInvalidPrev = ""; + Dictionary superObject = new Dictionary(); + do + { + // Add the object to the superObject + if (!tainted && name.Length > 0 && obj != null) + { + if (name.Length == 0) + { + name = String.Format("{0:D2}", idx); + } + superObject.Add(name, obj); + idx++; + name = ""; + } + else + { + String strInvalid = ctx.GetMarked(); + strInvalid = strInvalid.Trim(); + if (strInvalidPrev.Length > 0 + && "=".CompareTo(strInvalid) == 0) + { + name = CleanIdentifier(strInvalidPrev); + } + else + { + name = ""; + } + strInvalidPrev = strInvalid; + } + + // Check end + if (ctx.AtEnd()) + { + break; + } + + // Get next object + tainted = false; + ctx.Mark(); + obj = ParseValue(); + + } while (true); + return superObject; + } + + #endregion + } +} diff --git a/Scrummer/Code/JSON/JSONWriter.cs b/Scrummer/Code/JSON/JSONWriter.cs index c6dade8..216150c 100644 --- a/Scrummer/Code/JSON/JSONWriter.cs +++ b/Scrummer/Code/JSON/JSONWriter.cs @@ -1,328 +1,328 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using System.Text; - -namespace Scrummer.Code.JSON -{ - public class JSONWriter - { - #region Declarations - - private bool indent = false; - private bool useTabForIndent = false; - private int indentChars = 4; - private int indentThresold = 3; - - #endregion - - #region Creator - - public JSONWriter() { } - - public JSONWriter(int indentChars) - { - this.indent = true; - this.indentChars = indentChars; - this.useTabForIndent = false; - } - - public JSONWriter(bool useTabForIndent) - { - this.indent = true; - this.useTabForIndent = useTabForIndent; - } - - #endregion - - #region Private methods - - private bool IsValue(Object obj) - { - if (obj == null) - { - return true; - } - if ((obj is float) || (obj is double) || - (obj is System.Int16) || (obj is System.Int32) || (obj is System.Int64) - || (obj is String) || (obj is Boolean)) - { - return true; - } - return false; - } - - private void WriteIndent(StringBuilder sbOutput, int level) - { - if (!indent) - { - return; - } - sbOutput.Append('\n'); - if (useTabForIndent) - { - for (int i = 0; i < level; i++) { sbOutput.Append('\t'); } - } - else - { - int n = level * indentChars; - for (int i = 0; i < n; i++) { sbOutput.Append(' '); } - } - } - - private void WriteString(StringBuilder sbOutput, String str) - { - sbOutput.Append('"'); - char c; - int n = str.Length; - for (int i = 0; i < n; i++) - { - c = str[i]; - if (c == '"') { sbOutput.Append("\\\""); } - else if (c == '\\') { sbOutput.Append("\\\\"); } - else if (c == '/') { sbOutput.Append("\\/"); } - else if (c == '\b') { sbOutput.Append("\\b"); } - else if (c == '\f') { sbOutput.Append("\\f"); } - else if (c == '\n') { sbOutput.Append("\\n"); } - else if (c == '\r') { sbOutput.Append("\\r"); } - else if (c == '\t') { sbOutput.Append("\\t"); } - else { sbOutput.Append(c); } - // FIXME: Unicode characters - } - sbOutput.Append('"'); - } - - private void WriteValue(StringBuilder sbOutput, Object obj, int level, bool useReflection) - { - if (obj == null) - { - // NULL - sbOutput.Append("null"); - } - else if ((obj is float) || (obj is double) || - (obj is System.Int16) || (obj is System.Int32) || (obj is System.Int64)) - { - // Numbers - sbOutput.Append(obj.ToString()); - } - else if (obj is String) - { - // Strings - WriteString(sbOutput, (String)obj); - } - else if (obj is Boolean) - { - // Booleans - sbOutput.Append(((Boolean)obj) ? "true" : "false"); - } - else if (obj is IDictionary) - { - // Objects - WriteObject(sbOutput, obj, level); - } - else if (obj is IEnumerable) - { - // Array/List - WriteList(sbOutput, obj, level); - } - else - { - if (useReflection) - { - // Reflected object - WriteReflectedObject(sbOutput, obj, level); - } - else - { - WriteString(sbOutput, Convert.ToString(obj)); - } - } - } - - private void WriteList(StringBuilder sbOutput, Object obj, int level) - { - IEnumerable list = (IEnumerable)obj; - int n = 0; - - // Check if it is a leaf object - bool isLeaf = true; - foreach (object childObj in list) - { - if (!IsValue(childObj)) - { - isLeaf = false; - } - n++; - } - - // Empty - if (n == 0) - { - sbOutput.Append("[ ]"); - return; - } - - // Write array - bool first = true; - sbOutput.Append("[ "); - if (!isLeaf || n > indentThresold) - { - WriteIndent(sbOutput, level + 1); - } - foreach (object childObj in list) - { - if (!first) - { - sbOutput.Append(", "); - if (!isLeaf || n > indentThresold) - { - WriteIndent(sbOutput, level + 1); - } - } - first = false; - WriteValue(sbOutput, childObj, level + 1, true); - } - if (!isLeaf || n > indentThresold) - { - WriteIndent(sbOutput, level); - } - sbOutput.Append(" ]"); - } - - private void WriteObject(StringBuilder sbOutput, Object obj, int level) - { - IDictionary map = (IDictionary)obj; - int n = map.Count; - - // Empty - if (map.Count == 0) - { - sbOutput.Append("{ }"); - return; - } - - // Check if it is a leaf object - bool isLeaf = true; - foreach (object value in map.Values) - { - if (!IsValue(value)) - { - isLeaf = false; - break; - } - } - - // Write object - bool first = true; - sbOutput.Append("{ "); - if (!isLeaf || n > indentThresold) - { - WriteIndent(sbOutput, level + 1); - } - foreach (object key in map.Keys) - { - object value = map[key]; - if (!first) - { - sbOutput.Append(", "); - if (!isLeaf || n > indentThresold) - { - WriteIndent(sbOutput, level + 1); - } - } - first = false; - WriteString(sbOutput, Convert.ToString(key)); - sbOutput.Append(": "); - WriteValue(sbOutput, value, level + 1, true); - } - if (!isLeaf || n > indentThresold) - { - WriteIndent(sbOutput, level); - } - sbOutput.Append(" }"); - } - - private void WriteReflectedObject(StringBuilder sbOutput, Object obj, int level) - { - Type type = obj.GetType(); - PropertyInfo[] rawProperties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); - List properties = new List(); - foreach (PropertyInfo property in rawProperties) - { - if (property.CanRead) - { - properties.Add(property); - } - } - int n = properties.Count; - - // Empty - if (n == 0) - { - sbOutput.Append("{ }"); - return; - } - - // Check if it is a leaf object - bool isLeaf = true; - foreach (PropertyInfo property in properties) - { - object value = property.GetValue(obj, null); - if (!IsValue(value)) - { - isLeaf = false; - break; - } - } - - // Write object - bool first = true; - sbOutput.Append("{ "); - if (!isLeaf || n > indentThresold) - { - WriteIndent(sbOutput, level + 1); - } - foreach (PropertyInfo property in properties) - { - object value=null; - MethodInfo getMethod = property.GetMethod; - ParameterInfo[] parameters =getMethod.GetParameters(); - if (parameters.Length == 0) - { - value = property.GetValue(obj, null); - } - if (!first) - { - sbOutput.Append(", "); - if (!isLeaf || n > indentThresold) - { - WriteIndent(sbOutput, level + 1); - } - } - first = false; - WriteString(sbOutput, property.Name); - sbOutput.Append(": "); - WriteValue(sbOutput, value, level + 1, false); - } - if (!isLeaf || n > indentThresold) - { - WriteIndent(sbOutput, level); - } - sbOutput.Append(" }"); - } - - #endregion - - #region Public methods - - public String Write(Object obj) - { - StringBuilder sbOutput = new StringBuilder(); - WriteValue(sbOutput, obj, 0, true); - return sbOutput.ToString(); - } - - #endregion - } -} \ No newline at end of file +using System; +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using System.Text; + +namespace Scrummer.Code.JSON +{ + public class JSONWriter + { + #region Declarations + + private bool indent = false; + private bool useTabForIndent = false; + private int indentChars = 4; + private int indentThresold = 3; + + #endregion + + #region Creator + + public JSONWriter() { } + + public JSONWriter(int indentChars) + { + this.indent = true; + this.indentChars = indentChars; + this.useTabForIndent = false; + } + + public JSONWriter(bool useTabForIndent) + { + this.indent = true; + this.useTabForIndent = useTabForIndent; + } + + #endregion + + #region Private methods + + private bool IsValue(Object obj) + { + if (obj == null) + { + return true; + } + if ((obj is float) || (obj is double) || + (obj is System.Int16) || (obj is System.Int32) || (obj is System.Int64) + || (obj is String) || (obj is Boolean)) + { + return true; + } + return false; + } + + private void WriteIndent(StringBuilder sbOutput, int level) + { + if (!indent) + { + return; + } + sbOutput.Append('\n'); + if (useTabForIndent) + { + for (int i = 0; i < level; i++) { sbOutput.Append('\t'); } + } + else + { + int n = level * indentChars; + for (int i = 0; i < n; i++) { sbOutput.Append(' '); } + } + } + + private void WriteString(StringBuilder sbOutput, String str) + { + sbOutput.Append('"'); + char c; + int n = str.Length; + for (int i = 0; i < n; i++) + { + c = str[i]; + if (c == '"') { sbOutput.Append("\\\""); } + else if (c == '\\') { sbOutput.Append("\\\\"); } + else if (c == '/') { sbOutput.Append("\\/"); } + else if (c == '\b') { sbOutput.Append("\\b"); } + else if (c == '\f') { sbOutput.Append("\\f"); } + else if (c == '\n') { sbOutput.Append("\\n"); } + else if (c == '\r') { sbOutput.Append("\\r"); } + else if (c == '\t') { sbOutput.Append("\\t"); } + else { sbOutput.Append(c); } + // FIXME: Unicode characters + } + sbOutput.Append('"'); + } + + private void WriteValue(StringBuilder sbOutput, Object obj, int level, bool useReflection) + { + if (obj == null) + { + // NULL + sbOutput.Append("null"); + } + else if ((obj is float) || (obj is double) || + (obj is System.Int16) || (obj is System.Int32) || (obj is System.Int64)) + { + // Numbers + sbOutput.Append(obj.ToString()); + } + else if (obj is String) + { + // Strings + WriteString(sbOutput, (String)obj); + } + else if (obj is Boolean) + { + // Booleans + sbOutput.Append(((Boolean)obj) ? "true" : "false"); + } + else if (obj is IDictionary) + { + // Objects + WriteObject(sbOutput, obj, level); + } + else if (obj is IEnumerable) + { + // Array/List + WriteList(sbOutput, obj, level); + } + else + { + if (useReflection) + { + // Reflected object + WriteReflectedObject(sbOutput, obj, level); + } + else + { + WriteString(sbOutput, Convert.ToString(obj)); + } + } + } + + private void WriteList(StringBuilder sbOutput, Object obj, int level) + { + IEnumerable list = (IEnumerable)obj; + int n = 0; + + // Check if it is a leaf object + bool isLeaf = true; + foreach (object childObj in list) + { + if (!IsValue(childObj)) + { + isLeaf = false; + } + n++; + } + + // Empty + if (n == 0) + { + sbOutput.Append("[ ]"); + return; + } + + // Write array + bool first = true; + sbOutput.Append("[ "); + if (!isLeaf || n > indentThresold) + { + WriteIndent(sbOutput, level + 1); + } + foreach (object childObj in list) + { + if (!first) + { + sbOutput.Append(", "); + if (!isLeaf || n > indentThresold) + { + WriteIndent(sbOutput, level + 1); + } + } + first = false; + WriteValue(sbOutput, childObj, level + 1, true); + } + if (!isLeaf || n > indentThresold) + { + WriteIndent(sbOutput, level); + } + sbOutput.Append(" ]"); + } + + private void WriteObject(StringBuilder sbOutput, Object obj, int level) + { + IDictionary map = (IDictionary)obj; + int n = map.Count; + + // Empty + if (map.Count == 0) + { + sbOutput.Append("{ }"); + return; + } + + // Check if it is a leaf object + bool isLeaf = true; + foreach (object value in map.Values) + { + if (!IsValue(value)) + { + isLeaf = false; + break; + } + } + + // Write object + bool first = true; + sbOutput.Append("{ "); + if (!isLeaf || n > indentThresold) + { + WriteIndent(sbOutput, level + 1); + } + foreach (object key in map.Keys) + { + object value = map[key]; + if (!first) + { + sbOutput.Append(", "); + if (!isLeaf || n > indentThresold) + { + WriteIndent(sbOutput, level + 1); + } + } + first = false; + WriteString(sbOutput, Convert.ToString(key)); + sbOutput.Append(": "); + WriteValue(sbOutput, value, level + 1, true); + } + if (!isLeaf || n > indentThresold) + { + WriteIndent(sbOutput, level); + } + sbOutput.Append(" }"); + } + + private void WriteReflectedObject(StringBuilder sbOutput, Object obj, int level) + { + Type type = obj.GetType(); + PropertyInfo[] rawProperties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance); + List properties = new List(); + foreach (PropertyInfo property in rawProperties) + { + if (property.CanRead) + { + properties.Add(property); + } + } + int n = properties.Count; + + // Empty + if (n == 0) + { + sbOutput.Append("{ }"); + return; + } + + // Check if it is a leaf object + bool isLeaf = true; + foreach (PropertyInfo property in properties) + { + object value = property.GetValue(obj, null); + if (!IsValue(value)) + { + isLeaf = false; + break; + } + } + + // Write object + bool first = true; + sbOutput.Append("{ "); + if (!isLeaf || n > indentThresold) + { + WriteIndent(sbOutput, level + 1); + } + foreach (PropertyInfo property in properties) + { + object value = null; + MethodInfo getMethod = property.GetGetMethod(); + ParameterInfo[] parameters = getMethod.GetParameters(); + if (parameters.Length == 0) + { + value = property.GetValue(obj, null); + } + if (!first) + { + sbOutput.Append(", "); + if (!isLeaf || n > indentThresold) + { + WriteIndent(sbOutput, level + 1); + } + } + first = false; + WriteString(sbOutput, property.Name); + sbOutput.Append(": "); + WriteValue(sbOutput, value, level + 1, false); + } + if (!isLeaf || n > indentThresold) + { + WriteIndent(sbOutput, level); + } + sbOutput.Append(" }"); + } + + #endregion + + #region Public methods + + public String Write(Object obj) + { + StringBuilder sbOutput = new StringBuilder(); + WriteValue(sbOutput, obj, 0, true); + return sbOutput.ToString(); + } + + #endregion + } +} diff --git a/Scrummer/Code/JSON/ParserContext.cs b/Scrummer/Code/JSON/ParserContext.cs index 2d0dbbc..61f1844 100644 --- a/Scrummer/Code/JSON/ParserContext.cs +++ b/Scrummer/Code/JSON/ParserContext.cs @@ -1,84 +1,84 @@ -using System; - -namespace Scrummer.Code.JSON -{ - public class ParserContext - { - #region Declarations - - private String text; - private int length; - private int i; - private int markStart; - - #endregion - - #region Creator - - public ParserContext(String text) - { - this.text = text; - this.length = text.Length; - this.i = 0; - this.markStart = 0; - } - - #endregion - - #region Public methods - - public char SkipWhite() - { - while (i < length && Char.IsWhiteSpace(text[i])) - { - i++; - } - if (AtEnd()) - { - return (char)0; - } - return text[i]; - } - - public char Next() - { - i++; - if (AtEnd()) - { - return (char)0; - } - return text[i]; - } - - public bool AtEnd() - { - return i >= length; - } - - public void Mark() - { - markStart = this.i; - } - - public String GetMarked() - { - if (i < length && markStart < length) - { - return text.Substring(markStart, i); - } - else - { - if (markStart < length) - { - return text.Substring(markStart, length); - } - else - { - return string.Empty; - } - } - } - - #endregion - } -} \ No newline at end of file +using System; + +namespace Scrummer.Code.JSON +{ + public class ParserContext + { + #region Declarations + + private String text; + private int length; + private int i; + private int markStart; + + #endregion + + #region Creator + + public ParserContext(String text) + { + this.text = text; + this.length = text.Length; + this.i = 0; + this.markStart = 0; + } + + #endregion + + #region Public methods + + public char SkipWhite() + { + while (i < length && Char.IsWhiteSpace(text[i])) + { + i++; + } + if (AtEnd()) + { + return (char)0; + } + return text[i]; + } + + public char Next() + { + i++; + if (AtEnd()) + { + return (char)0; + } + return text[i]; + } + + public bool AtEnd() + { + return i >= length; + } + + public void Mark() + { + markStart = this.i; + } + + public String GetMarked() + { + if (i < length && markStart < length) + { + return text.Substring(markStart, i); + } + else + { + if (markStart < length) + { + return text.Substring(markStart, length); + } + else + { + return string.Empty; + } + } + } + + #endregion + } +} diff --git a/Scrummer/Code/Pages/FrmBoard.cs b/Scrummer/Code/Pages/FrmBoard.cs new file mode 100644 index 0000000..a8e2222 --- /dev/null +++ b/Scrummer/Code/Pages/FrmBoard.cs @@ -0,0 +1,27 @@ +using System; +using Scrummer.Code.Controls; + +namespace Scrummer.Code.Pages +{ + public class FrmBoard : PageCommon + { + private int _idBoard = 0; + + public FrmBoard() + { + Init += FrmBoard_Init; + } + + void FrmBoard_Init(object sender, EventArgs e) + { + Title = "Board"; + var lblTest = new CLabel { Text = "Hello World", Tag = "h2" }; + Controls.Add(lblTest); + + ChatControl chatControl = new ChatControl(); + chatControl.IDBoard = _idBoard; + chatControl.UserName = Convert.ToString(new Random().Next()); + Controls.Add(chatControl); + } + } +} diff --git a/Scrummer/Code/Pages/FrmEcho.cs b/Scrummer/Code/Pages/FrmEcho.cs index b70cc15..3eccb18 100644 --- a/Scrummer/Code/Pages/FrmEcho.cs +++ b/Scrummer/Code/Pages/FrmEcho.cs @@ -1,21 +1,25 @@ -using System.Web; -using Scrummer.Code.JSON; - -namespace Scrummer.Code.Pages -{ - public class FrmEcho : IHttpHandler - { - public bool IsReusable - { - get { return false; } - } - - public void ProcessRequest(HttpContext context) - { - var jsonWritter = new JSONWriter(true); - context.Response.Write("
");
-            context.Response.Write(jsonWritter.Write(context.Request));
-            context.Response.Write("
"); - } - } -} \ No newline at end of file +using System.Web; +using Scrummer.Code.JSON; + +namespace Scrummer.Code.Pages +{ + public class FrmEcho : IHttpHandler + { + #region IHttpHandler + + public bool IsReusable + { + get { return false; } + } + + public void ProcessRequest(HttpContext context) + { + var jsonWritter = new JSONWriter(true); + context.Response.Write("
");
+            context.Response.Write(jsonWritter.Write(context.Request));
+            context.Response.Write("
"); + } + + #endregion + } +} diff --git a/Scrummer/Code/Pages/FrmError.cs b/Scrummer/Code/Pages/FrmError.cs index 9b40799..dfb4248 100644 --- a/Scrummer/Code/Pages/FrmError.cs +++ b/Scrummer/Code/Pages/FrmError.cs @@ -1,48 +1,65 @@ -using System; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using Scrummer.Code.Controls; - -namespace Scrummer.Code.Pages -{ - public class FrmError : PageCommon - { - Exception _ex = null; - - public FrmError(Exception ex) - { - _ex = ex; - Init += FrmError_Init; - } - - void FrmError_Init(object sender, EventArgs e) - { - Title = "Application Error"; - - CLabel lblErrorTitle = new CLabel { Text = Title, Tag = "h2" }; - Controls.Add(lblErrorTitle); - - Exception exAux = _ex; - if (exAux is HttpUnhandledException && exAux.InnerException != null) { exAux = exAux.InnerException; } - while (exAux != null) - { - CLabel lblMessage = new CLabel { Tag = "P" }; - lblMessage.Text = String.Format("{0}: {1}", "Message", HttpUtility.HtmlEncode(exAux.Message)); - Controls.Add(lblMessage); - - CLabel lblStacktraceTitle = new CLabel { Tag = "p" }; - lblStacktraceTitle.Text = String.Format("{0}:", "Stacktrace"); - Controls.Add(lblStacktraceTitle); - Panel pnlStacktrace = new Panel(); - pnlStacktrace.CssClass = "divCode"; - Controls.Add(pnlStacktrace); - LiteralControl litStackTrace = new LiteralControl( - String.Format("
{0}
", HttpUtility.HtmlEncode(exAux.StackTrace))); - pnlStacktrace.Controls.Add(litStackTrace); - - exAux = exAux.InnerException; - } - } - } -} \ No newline at end of file +using System; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Scrummer.Code.Controls; + +namespace Scrummer.Code.Pages +{ + public class FrmError : PageCommon + { + #region Declarations + + Exception _ex = null; + + #endregion + + #region Page life cycle + + public FrmError(Exception ex) + { + _ex = ex; + Init += FrmError_Init; + } + + void FrmError_Init(object sender, EventArgs e) + { + InitializeControls(); + } + + #endregion + + #region Private methods + + private void InitializeControls() + { + Title = "Application Error"; + + CLabel lblErrorTitle = new CLabel { Text = Title, Tag = "h2" }; + Controls.Add(lblErrorTitle); + + Exception exAux = _ex; + if (exAux is HttpUnhandledException && exAux.InnerException != null) { exAux = exAux.InnerException; } + while (exAux != null) + { + CLabel lblMessage = new CLabel { Tag = "P" }; + lblMessage.Text = String.Format("{0}: {1}", "Message", HttpUtility.HtmlEncode(exAux.Message)); + Controls.Add(lblMessage); + + CLabel lblStacktraceTitle = new CLabel { Tag = "p" }; + lblStacktraceTitle.Text = String.Format("{0}:", "Stacktrace"); + Controls.Add(lblStacktraceTitle); + Panel pnlStacktrace = new Panel(); + pnlStacktrace.CssClass = "divCode"; + Controls.Add(pnlStacktrace); + LiteralControl litStackTrace = new LiteralControl( + String.Format("
{0}
", HttpUtility.HtmlEncode(exAux.StackTrace))); + pnlStacktrace.Controls.Add(litStackTrace); + + exAux = exAux.InnerException; + } + } + + #endregion + } +} diff --git a/Scrummer/Code/Pages/PageCommon.cs b/Scrummer/Code/Pages/PageCommon.cs index 6f0ffdb..8ef1bb9 100644 --- a/Scrummer/Code/Pages/PageCommon.cs +++ b/Scrummer/Code/Pages/PageCommon.cs @@ -1,92 +1,92 @@ -using System; -using System.Reflection; -using System.Text; -using System.Web.UI; -using System.Web.UI.HtmlControls; -using System.Web.UI.WebControls; -using Scrummer.Code.Controls; - -namespace Scrummer.Code.Pages -{ - public class PageCommon : Page - { - #region Declarations - - private HtmlHead _head; - private HtmlGenericControl _body; - private HtmlForm _form; - private Panel _pnlContainer = new Panel(); - - #endregion - - #region Properties - - public new ControlCollection Controls - { - get { return _pnlContainer.Controls; } - } - - #endregion - - #region Life cycle - - public PageCommon() - { - Init += PageCommon_Init; - PreRender += PageCommon_PreRender; - } - - void PageCommon_Init(object sender, EventArgs e) - { - CreateControls(); - } - - void PageCommon_PreRender(object sender, EventArgs e) - { - _head.Title = string.IsNullOrEmpty(Title) ? Globals.Title : String.Format("{0}{1}{2}", Globals.Title, Globals.TitleSeparator, Title); - } - - #endregion - - #region Private methods - - private void CreateControls() - { - Context.Response.Charset = Encoding.UTF8.WebName; - - var doctype = new LiteralControl("\n"); - base.Controls.Add(doctype); - - var html = new HtmlGenericControl("html"); - base.Controls.Add(html); - - _head = new HtmlHead(); - html.Controls.Add(_head); - - _head.Controls.Add(new HtmlMeta { HttpEquiv = "content-type", Content = "text/html; charset=utf-8" }); - _head.Controls.Add(new HtmlMeta { Name = "author", Content = Globals.Author }); - _head.Controls.Add(new HtmlMeta { Name = "Copyright", Content = Globals.Copyright }); - Assembly asm = Assembly.GetExecutingAssembly(); - string version = asm.GetName().Version.ToString(); - _head.Controls.Add(new LiteralControl(String.Format("\n", version))); - _head.Controls.Add(new LiteralControl(String.Format("\n", version))); - - - _body = new HtmlGenericControl("body"); - html.Controls.Add(_body); - _form = new HtmlForm { ID = "formMain" }; - _body.Controls.Add(_form); - - var pnlHeader = new Panel { CssClass = "divHeader" }; - _form.Controls.Add(pnlHeader); - - var lblTitle = new CLabel { Text = Globals.Title, Tag = "h1" }; - pnlHeader.Controls.Add(lblTitle); - - _pnlContainer.CssClass = "divContent"; - _form.Controls.Add(_pnlContainer); - } - - #endregion - } -} \ No newline at end of file +using System; +using System.Reflection; +using System.Text; +using System.Web.UI; +using System.Web.UI.HtmlControls; +using System.Web.UI.WebControls; +using Scrummer.Code.Controls; + +namespace Scrummer.Code.Pages +{ + public class PageCommon : Page + { + #region Declarations + + private HtmlHead _head; + private HtmlGenericControl _body; + private HtmlForm _form; + private Panel _pnlContainer = new Panel(); + + #endregion + + #region Properties + + public new ControlCollection Controls + { + get { return _pnlContainer.Controls; } + } + + #endregion + + #region Life cycle + + public PageCommon() + { + Init += PageCommon_Init; + PreRender += PageCommon_PreRender; + } + + void PageCommon_Init(object sender, EventArgs e) + { + CreateControls(); + } + + void PageCommon_PreRender(object sender, EventArgs e) + { + _head.Title = string.IsNullOrEmpty(Title) ? Globals.Title : String.Format("{0}{1}{2}", Globals.Title, Globals.TitleSeparator, Title); + } + + #endregion + + #region Private methods + + private void CreateControls() + { + Context.Response.Charset = Encoding.UTF8.WebName; + + var doctype = new LiteralControl("\n"); + base.Controls.Add(doctype); + + var html = new HtmlGenericControl("html"); + base.Controls.Add(html); + + _head = new HtmlHead(); + html.Controls.Add(_head); + + _head.Controls.Add(new HtmlMeta { HttpEquiv = "content-type", Content = "text/html; charset=utf-8" }); + _head.Controls.Add(new HtmlMeta { Name = "author", Content = Globals.Author }); + _head.Controls.Add(new HtmlMeta { Name = "Copyright", Content = Globals.Copyright }); + Assembly asm = Assembly.GetExecutingAssembly(); + string version = asm.GetName().Version.ToString(); + _head.Controls.Add(new LiteralControl(String.Format("\n", version))); + _head.Controls.Add(new LiteralControl(String.Format("\n", version))); + + + _body = new HtmlGenericControl("body"); + html.Controls.Add(_body); + _form = new HtmlForm { ID = "formMain" }; + _body.Controls.Add(_form); + + var pnlHeader = new Panel { CssClass = "divHeader" }; + _form.Controls.Add(pnlHeader); + + var lblTitle = new CLabel { Text = Globals.Title, Tag = "h1" }; + pnlHeader.Controls.Add(lblTitle); + + _pnlContainer.CssClass = "divContent"; + _form.Controls.Add(_pnlContainer); + } + + #endregion + } +} diff --git a/Scrummer/Code/ScriptsBundler.cs b/Scrummer/Code/ScriptsBundler.cs index 950dfa2..30b1e63 100644 --- a/Scrummer/Code/ScriptsBundler.cs +++ b/Scrummer/Code/ScriptsBundler.cs @@ -1,20 +1,20 @@ -using System.Web; - -namespace Scrummer.Code -{ - public class ScriptsBundler : IHttpHandler - { - #region IHttpHandler - - public bool IsReusable { get { return false; } } - - public void ProcessRequest(HttpContext context) - { - Bundler bundler = new Bundler(context.Server.MapPath("~/Scripts/")); - context.Response.ContentType = "text/javascript"; - bundler.WriteResponse(context.Response.OutputStream); - } - - #endregion - } -} \ No newline at end of file +using System.Web; + +namespace Scrummer.Code +{ + public class ScriptsBundler : IHttpHandler + { + #region IHttpHandler + + public bool IsReusable { get { return false; } } + + public void ProcessRequest(HttpContext context) + { + Bundler bundler = new Bundler(context.Server.MapPath("~/Scripts/")); + context.Response.ContentType = "text/javascript"; + bundler.WriteResponse(context.Response.OutputStream); + } + + #endregion + } +} diff --git a/Scrummer/Code/StylesBundler.cs b/Scrummer/Code/StylesBundler.cs index 6627b7c..f7894a3 100644 --- a/Scrummer/Code/StylesBundler.cs +++ b/Scrummer/Code/StylesBundler.cs @@ -1,20 +1,20 @@ -using System.Web; - -namespace Scrummer.Code -{ - public class StylesBundler : IHttpHandler - { - #region IHttpHandler - - public bool IsReusable { get { return false; } } - - public void ProcessRequest(HttpContext context) - { - Bundler bundler = new Bundler(context.Server.MapPath("~/Styles/")); - context.Response.ContentType = "text/css"; - bundler.WriteResponse(context.Response.OutputStream); - } - - #endregion - } -} \ No newline at end of file +using System.Web; + +namespace Scrummer.Code +{ + public class StylesBundler : IHttpHandler + { + #region IHttpHandler + + public bool IsReusable { get { return false; } } + + public void ProcessRequest(HttpContext context) + { + Bundler bundler = new Bundler(context.Server.MapPath("~/Styles/")); + context.Response.ContentType = "text/css"; + bundler.WriteResponse(context.Response.OutputStream); + } + + #endregion + } +} diff --git a/Scrummer/GlobalRouter.cs b/Scrummer/GlobalRouter.cs index f9d9d48..f5639e3 100644 --- a/Scrummer/GlobalRouter.cs +++ b/Scrummer/GlobalRouter.cs @@ -1,117 +1,126 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Web; -using Scrummer.Code; - -namespace Scrummer -{ - public class GlobalRouter : IHttpHandler - { - #region Handlers - - private static Dictionary _handlers = new Dictionary(); - - private static IHttpHandler GetHandler(string typeName) - { - if (string.IsNullOrEmpty(typeName)) { return null; } - Type type = null; - if (_handlers.ContainsKey(typeName)) - { - type = _handlers[typeName]; - IHttpHandler handler = Activator.CreateInstance(type) as IHttpHandler; - return handler; - } - - // Search type on executing assembly - Type[] types; - Assembly asm = Assembly.GetExecutingAssembly(); - types = asm.GetTypes(); - foreach (Type typeAux in types) - { - if (typeAux.FullName.EndsWith(typeName)) - { - type = typeAux; - break; - } - } - - // Search type on all loaded assemblies - if (type == null) - { - Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies(); - foreach (Assembly asmAux in asms) - { - types = asmAux.GetTypes(); - foreach (Type typeAux in types) - { - if (typeAux.FullName.EndsWith(typeName)) - { - type = typeAux; - break; - } - } - if (type != null) { break; } - } - } - - // Use found type - if (type != null) - { - IHttpHandler handler = Activator.CreateInstance(type) as IHttpHandler; - if (handler != null) - { - lock (_handlers) - { - if (_handlers.ContainsKey(typeName) == false) - { - _handlers.Add(typeName, type); - } - } - } - return handler; - } - - return null; - } - - #endregion - - #region IHttpHandler - - public bool IsReusable - { - get { return false; } - } - - public void ProcessRequest(HttpContext context) - { - try - { - string file = Path.GetFileName(context.Request.FilePath); - if (string.IsNullOrEmpty(file)) - { - file = Globals.DefaultHandler; - } - IHttpHandler handler = GetHandler(file); - if (handler == null) - { - // TODO: FrmNotFound - throw new Exception("NotFound"); - } - - // Use handler - context.Response.Clear(); - context.Handler = handler; - handler.ProcessRequest(context); - } - catch (Exception ex) - { - GlobalErrorHandler.HandleError(context, ex); - } - } - - #endregion - } -} \ No newline at end of file +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Web; +using Scrummer.Code; + +namespace Scrummer +{ + public class GlobalRouter : IHttpHandler + { + #region Handlers + + private static Dictionary _handlers = new Dictionary(); + + private static IHttpHandler GetHandler(string typeName) + { + if (string.IsNullOrEmpty(typeName)) { return null; } + Type type = null; + if (_handlers.ContainsKey(typeName)) + { + type = _handlers[typeName]; + IHttpHandler handler = Activator.CreateInstance(type) as IHttpHandler; + return handler; + } + + // Search type on executing assembly + Type[] types; + Assembly asm = Assembly.GetExecutingAssembly(); + types = asm.GetTypes(); + foreach (Type typeAux in types) + { + if (typeAux.FullName.EndsWith(typeName)) + { + type = typeAux; + break; + } + } + + // Search type on all loaded assemblies + if (type == null) + { + Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies(); + foreach (Assembly asmAux in asms) + { + types = asmAux.GetTypes(); + foreach (Type typeAux in types) + { + if (typeAux.FullName.EndsWith(typeName)) + { + type = typeAux; + break; + } + } + if (type != null) { break; } + } + } + + // Use found type + if (type != null) + { + IHttpHandler handler = Activator.CreateInstance(type) as IHttpHandler; + if (handler != null) + { + lock (_handlers) + { + if (_handlers.ContainsKey(typeName) == false) + { + _handlers.Add(typeName, type); + } + } + } + return handler; + } + + return null; + } + + #endregion + + #region IHttpHandler + + public bool IsReusable + { + get { return false; } + } + + public void ProcessRequest(HttpContext context) + { + try + { + RouteRequest(context); + } + catch (Exception ex) + { + GlobalErrorHandler.HandleError(context, ex); + } + } + + #endregion + + #region Private methods + + private void RouteRequest(HttpContext context) + { + string file = Path.GetFileName(context.Request.FilePath); + if (string.IsNullOrEmpty(file)) + { + file = Globals.DefaultHandler; + } + IHttpHandler handler = GetHandler(file); + if (handler == null) + { + // TODO: FrmNotFound + throw new Exception("NotFound"); + } + + // Use handler + context.Response.Clear(); + context.Handler = handler; + handler.ProcessRequest(context); + } + + #endregion + } +} diff --git a/Scrummer/Globals.cs b/Scrummer/Globals.cs index d79acc7..9778db5 100644 --- a/Scrummer/Globals.cs +++ b/Scrummer/Globals.cs @@ -1,12 +1,12 @@ - -namespace Scrummer -{ - public static class Globals - { - public const string Title = "Scrummer"; - public const string TitleSeparator = " :: "; - public const string Author = "Valeriano Alfonso Rodriguez"; - public const string Copyright = "Copyright (c) 2015 by Valeriano Alfonso, All Right Reserved"; - public const string DefaultHandler = "FrmBoard"; - } -} \ No newline at end of file + +namespace Scrummer +{ + public static class Globals + { + public const string Title = "Scrummer"; + public const string TitleSeparator = " :: "; + public const string Author = "Valeriano Alfonso Rodriguez"; + public const string Copyright = "Copyright (c) 2015 by Valeriano Alfonso, All Right Reserved"; + public const string DefaultHandler = "FrmBoard"; + } +} diff --git a/Scrummer/Properties/AssemblyInfo.cs b/Scrummer/Properties/AssemblyInfo.cs index c05fcec..0eb6a94 100644 --- a/Scrummer/Properties/AssemblyInfo.cs +++ b/Scrummer/Properties/AssemblyInfo.cs @@ -1,34 +1,33 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Scrummer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("VAR")] -[assembly: AssemblyProduct("Scrummer")] -[assembly: AssemblyCopyright("Copyright © VAR 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("4cd25e9d-237f-4a9f-89ac-35e537cf265e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.*")] +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Scrummer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("VAR")] +[assembly: AssemblyProduct("Scrummer")] +[assembly: AssemblyCopyright("Copyright © VAR 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4cd25e9d-237f-4a9f-89ac-35e537cf265e")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] diff --git a/Scrummer/Properties/PublishProfiles/Scrummer.pubxml b/Scrummer/Properties/PublishProfiles/Scrummer.pubxml new file mode 100644 index 0000000..7b617b3 --- /dev/null +++ b/Scrummer/Properties/PublishProfiles/Scrummer.pubxml @@ -0,0 +1,21 @@ + + + + + FileSystem + Release + Any CPU + + True + True + False + False + DonotMerge + True + C:\Users\VAR\source\Scrummer\Published + True + + diff --git a/Scrummer/Scripts/01. Base.js b/Scrummer/Scripts/01. Base.js index 5dfc48d..65b5a1e 100644 --- a/Scrummer/Scripts/01. Base.js +++ b/Scrummer/Scripts/01. Base.js @@ -1,20 +1,20 @@ - -function GetElement(element) { - if (typeof element == "string") { - element = document.getElementById(element); - } - return element; -} - -function escapeHTML(s) { - return s.replace(/&/g, '&') - .replace(/"/g, '"') - .replace(//g, '>'); -} - -function fixedEncodeURIComponent(str) { - return encodeURIComponent(str).replace(/[!'()*]/g, function (c) { - return '%' + c.charCodeAt(0).toString(16); - }); -} + +function GetElement(element) { + if (typeof element == "string") { + element = document.getElementById(element); + } + return element; +} + +function escapeHTML(s) { + return s.replace(/&/g, '&') + .replace(/"/g, '"') + .replace(//g, '>'); +} + +function fixedEncodeURIComponent(str) { + return encodeURIComponent(str).replace(/[!'()*]/g, function (c) { + return '%' + c.charCodeAt(0).toString(16); + }); +} diff --git a/Scrummer/Scripts/02. Ajax.js b/Scrummer/Scripts/02. Ajax.js index 9cb9ea3..062d542 100644 --- a/Scrummer/Scripts/02. Ajax.js +++ b/Scrummer/Scripts/02. Ajax.js @@ -1,122 +1,122 @@ - -function SendRequest(url, onData, onError) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", url, true); - xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status == 200) { - if (onData) { - onData(xhr.responseText); - } - } else { - if (onError) { - onError(); - } - } - } - } - xhr.send(null); -} - -function GetDataQueryString(data) { - var queryString = ""; - for (var property in data) { - if (data.hasOwnProperty(property)) { - var value = data[property]; - queryString += (queryString.length > 0 ? "&" : "") - + fixedEncodeURIComponent(property) + "=" - + fixedEncodeURIComponent(value ? value : ""); - } - } - return queryString; -} - -function SendData(url, data, onData, onError) { - var xhr = new XMLHttpRequest(); - xhr.open("POST", url, true); - xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status == 200) { - if (onData) { - onData(xhr.responseText); - } - } else { - if (onError) { - onError(); - } - } - } - } - xhr.setRequestHeader('Content-Type', - 'application/x-www-form-urlencoded'); - xhr.send(GetDataQueryString(data)); -} - -function GetFormQueryString(idForm) { - var form = document.getElementById(idForm); - var queryString = ""; - if (!form) - return null; - - function appendVal(name, value) { - queryString += (queryString.length > 0 ? "&" : "") - + fixedEncodeURIComponent(name) + "=" - + fixedEncodeURIComponent(value ? value : ""); - } - - var elements = form.elements; - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - var elemType = element.type.toUpperCase(); - var elemName = element.name; - - if (elemName) { - if ( - elemType.indexOf("TEXT") != -1 || - elemType.indexOf("TEXTAREA") != -1 || - elemType.indexOf("PASSWORD") != -1 || - elemType.indexOf("BUTTON") != -1 || - elemType.indexOf("HIDDEN") != -1 || - elemType.indexOf("SUBMIT") != -1 || - elemType.indexOf("IMAGE") != -1 - ) { - appendVal(elemName, element.value); - } else if (elemType.indexOf("CHECKBOX") != -1 && element.checked) { - appendVal(elemName, element.value ? element.value : "On"); - } else if (elemType.indexOf("RADIO") != -1 && element.checked) { - appendVal(elemName, element.value); - } else if (elemType.indexOf("SELECT") != -1) { - for (var j = 0; j < element.options.length; j++) { - var option = element.options[j]; - if (option.selected) { - appendVal(elemName, - option.value ? option.value : option.text); - } - } - } - } - } - - return queryString; -} - -function SendForm(url, idForm, onData, onError) { - var xhr = new XMLHttpRequest(); - xhr.open("POST", url, true); - xhr.onreadystatechange = function () { - if (xhr.readyState == 4) { - if (xhr.status == 200) { - if (onData) { - onData(xhr.responseText); - } - } else { - if (onError) { - onError(); - } - } - } - } - xhr.setRequestHeader('Content-Type', - 'application/x-www-form-urlencoded'); - xhr.send(GetFormQueryString(idForm)); -} + +function SendRequest(url, onData, onError) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, true); + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + if (xhr.status == 200) { + if (onData) { + onData(xhr.responseText); + } + } else { + if (onError) { + onError(); + } + } + } + } + xhr.send(null); +} + +function GetDataQueryString(data) { + var queryString = ""; + for (var property in data) { + if (data.hasOwnProperty(property)) { + var value = data[property]; + queryString += (queryString.length > 0 ? "&" : "") + + fixedEncodeURIComponent(property) + "=" + + fixedEncodeURIComponent(String(value)); + } + } + return queryString; +} + +function SendData(url, data, onData, onError) { + var xhr = new XMLHttpRequest(); + xhr.open("POST", url, true); + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + if (xhr.status == 200) { + if (onData) { + onData(xhr.responseText); + } + } else { + if (onError) { + onError(); + } + } + } + } + xhr.setRequestHeader('Content-Type', + 'application/x-www-form-urlencoded'); + xhr.send(GetDataQueryString(data)); +} + +function GetFormQueryString(idForm) { + var form = document.getElementById(idForm); + var queryString = ""; + if (!form) + return null; + + function appendVal(name, value) { + queryString += (queryString.length > 0 ? "&" : "") + + fixedEncodeURIComponent(name) + "=" + + fixedEncodeURIComponent(value ? value : ""); + } + + var elements = form.elements; + for (var i = 0; i < elements.length; i++) { + var element = elements[i]; + var elemType = element.type.toUpperCase(); + var elemName = element.name; + + if (elemName) { + if ( + elemType.indexOf("TEXT") != -1 || + elemType.indexOf("TEXTAREA") != -1 || + elemType.indexOf("PASSWORD") != -1 || + elemType.indexOf("BUTTON") != -1 || + elemType.indexOf("HIDDEN") != -1 || + elemType.indexOf("SUBMIT") != -1 || + elemType.indexOf("IMAGE") != -1 + ) { + appendVal(elemName, element.value); + } else if (elemType.indexOf("CHECKBOX") != -1 && element.checked) { + appendVal(elemName, element.value ? element.value : "On"); + } else if (elemType.indexOf("RADIO") != -1 && element.checked) { + appendVal(elemName, element.value); + } else if (elemType.indexOf("SELECT") != -1) { + for (var j = 0; j < element.options.length; j++) { + var option = element.options[j]; + if (option.selected) { + appendVal(elemName, + option.value ? option.value : option.text); + } + } + } + } + } + + return queryString; +} + +function SendForm(url, idForm, onData, onError) { + var xhr = new XMLHttpRequest(); + xhr.open("POST", url, true); + xhr.onreadystatechange = function () { + if (xhr.readyState == 4) { + if (xhr.status == 200) { + if (onData) { + onData(xhr.responseText); + } + } else { + if (onError) { + onError(); + } + } + } + } + xhr.setRequestHeader('Content-Type', + 'application/x-www-form-urlencoded'); + xhr.send(GetFormQueryString(idForm)); +} diff --git a/Scrummer/Scripts/10. Chat.js b/Scrummer/Scripts/10. Chat.js index e189670..4a466d1 100644 --- a/Scrummer/Scripts/10. Chat.js +++ b/Scrummer/Scripts/10. Chat.js @@ -1,93 +1,93 @@ -function RunChat(serviceUrl, divContainer, idBoard, hidIDMessage, hidUserName, hidLastUser) { - divContainer = GetElement(divContainer); - hidIDMessage = GetElement(hidIDMessage); - hidUserName = GetElement(hidUserName); - hidLastUser = GetElement(hidLastUser); - - var CreateMessageDOM = function (message, selfMessage, hidLastUser) { - var divMessageRow = document.createElement("DIV"); - if (selfMessage) { - divMessageRow.className = "selfMessageRow"; - } else { - divMessageRow.className = "messageRow"; - } - - var divMessage = document.createElement("DIV"); - divMessage.className = "message"; - divMessageRow.appendChild(divMessage); - - if (hidLastUser.value !== message.UserName) { - var divUser = document.createElement("DIV"); - divUser.className = "user"; - divUser.innerHTML = escapeHTML(message.UserName); - divMessage.appendChild(divUser); - hidLastUser.value = message.UserName; - } - - var text = message.Text; - - var divText = document.createElement("DIV"); - divText.className = "text"; - divText.innerHTML = escapeHTML(text); - divMessage.appendChild(divText); - - return divMessageRow; - }; - - var RequestChatData = function () { - var requestUrl = serviceUrl + "?idBoard=" + idBoard + "&idMessage=" + hidIDMessage.value; - var ReciveChatData = function (responseText) { - - recvMsgs = JSON.parse(responseText); - if (recvMsgs) { - var idMessage = parseInt(hidIDMessage.value); - var frag = document.createDocumentFragment(); - for (var i = 0, n = recvMsgs.length; i < n; i++) { - var msg = recvMsgs[i]; - if (idMessage < msg.IDMessage) { - hidIDMessage.value = msg.IDMessage; - idMessage = msg.IDMessage; - var elemMessage = CreateMessageDOM(msg, (msg.UserName == hidUserName.value), hidLastUser); - frag.appendChild(elemMessage); - } - } - divContainer.appendChild(frag); - divContainer.scrollTop = divContainer.scrollHeight; - } - - // Reset pool - window.setTimeout(function () { - RequestChatData(); - }, 20); - }; - var ErrorChatData = function () { - - // Retry - window.setTimeout(function () { - RequestChatData(); - }, 5000); - }; - - // Pool data - SendRequest(requestUrl, ReciveChatData, ErrorChatData); - }; - RequestChatData(); -} - -function SendChat(serviceUrl, txtText, idBoard, hidUserName) { - txtText = GetElement(txtText); - hidUserName = GetElement(hidUserName); - - if (txtText.value.trim() == "") { - return; - } - - var data = { - "text": txtText.value, - "idBoard": idBoard, - "userName": hidUserName.value - }; - txtText.value = ""; - SendData(serviceUrl, data, null, null); - txtText.focus(); -} \ No newline at end of file +function RunChat(serviceUrl, divContainer, idBoard, hidIDMessage, hidUserName, hidLastUser) { + divContainer = GetElement(divContainer); + hidIDMessage = GetElement(hidIDMessage); + hidUserName = GetElement(hidUserName); + hidLastUser = GetElement(hidLastUser); + + var CreateMessageDOM = function (message, selfMessage, hidLastUser) { + var divMessageRow = document.createElement("DIV"); + if (selfMessage) { + divMessageRow.className = "selfMessageRow"; + } else { + divMessageRow.className = "messageRow"; + } + + var divMessage = document.createElement("DIV"); + divMessage.className = "message"; + divMessageRow.appendChild(divMessage); + + if (hidLastUser.value !== message.UserName) { + var divUser = document.createElement("DIV"); + divUser.className = "user"; + divUser.innerHTML = escapeHTML(message.UserName); + divMessage.appendChild(divUser); + hidLastUser.value = message.UserName; + } + + var text = message.Text; + + var divText = document.createElement("DIV"); + divText.className = "text"; + divText.innerHTML = escapeHTML(text); + divMessage.appendChild(divText); + + return divMessageRow; + }; + + var RequestChatData = function () { + var requestUrl = serviceUrl + "?idBoard=" + idBoard + "&idMessage=" + hidIDMessage.value; + var ReciveChatData = function (responseText) { + + recvMsgs = JSON.parse(responseText); + if (recvMsgs) { + var idMessage = parseInt(hidIDMessage.value); + var frag = document.createDocumentFragment(); + for (var i = 0, n = recvMsgs.length; i < n; i++) { + var msg = recvMsgs[i]; + if (idMessage < msg.IDMessage) { + hidIDMessage.value = msg.IDMessage; + idMessage = msg.IDMessage; + var elemMessage = CreateMessageDOM(msg, (msg.UserName == hidUserName.value), hidLastUser); + frag.appendChild(elemMessage); + } + } + divContainer.appendChild(frag); + divContainer.scrollTop = divContainer.scrollHeight; + } + + // Reset pool + window.setTimeout(function () { + RequestChatData(); + }, 20); + }; + var ErrorChatData = function () { + + // Retry + window.setTimeout(function () { + RequestChatData(); + }, 5000); + }; + + // Pool data + SendRequest(requestUrl, ReciveChatData, ErrorChatData); + }; + RequestChatData(); +} + +function SendChat(serviceUrl, txtText, idBoard, hidUserName) { + txtText = GetElement(txtText); + hidUserName = GetElement(hidUserName); + + if (txtText.value.trim() == "") { + return; + } + + var data = { + "text": txtText.value, + "idBoard": idBoard, + "userName": hidUserName.value + }; + txtText.value = ""; + SendData(serviceUrl, data, null, null); + txtText.focus(); +} diff --git a/Scrummer/Scrummer.csproj b/Scrummer/Scrummer.csproj index 26b1a1d..be3f471 100644 --- a/Scrummer/Scrummer.csproj +++ b/Scrummer/Scrummer.csproj @@ -1,133 +1,124 @@ - - - - - Debug - AnyCPU - - - 2.0 - {7596FD6B-DAF0-4B22-B356-5CF4629F0436} - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - Scrummer - Scrummer - v4.5.1 - true - - - - - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - Web.config - Designer - - - Web.config - Designer - - - - - - - - - - - - - - - - - - - ASPXCodeBehind - - - - - - - - ASPXCodeBehind - - - - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - - - - - True - True - 51559 - / - http://localhost:51555/ - False - False - - - False - - - - - + + + + + Debug + AnyCPU + + + 2.0 + {7596FD6B-DAF0-4B22-B356-5CF4629F0436} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Scrummer + Scrummer + v3.5 + true + + + + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + + + + + + + + + Web.config + Designer + + + Web.config + Designer + + + + + + + + + + + + + + + + + + ASPXCodeBehind + + + + ASPXCodeBehind + + + + + + + + ASPXCodeBehind + + + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 51559 + / + http://localhost:51555/ + False + False + + + False + + + + + \ No newline at end of file diff --git a/Scrummer/Scrummer.csproj.user b/Scrummer/Scrummer.csproj.user deleted file mode 100644 index 9a6dfb0..0000000 --- a/Scrummer/Scrummer.csproj.user +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - CurrentPage - True - False - False - False - - - - - - - - - True - True - - - - - \ No newline at end of file diff --git a/Scrummer/Styles/01. base.css b/Scrummer/Styles/01. base.css index 2a22a0b..ab3a801 100644 --- a/Scrummer/Styles/01. base.css +++ b/Scrummer/Styles/01. base.css @@ -1,65 +1,69 @@ -* { margin: 0; padding: 0; box-sizing: border-box; } - -body { - font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; - font-size: 12px; - background-color: grey; - color: black; -} - -p{ - margin-bottom: 0.5em; - text-shadow: 0 1px 1px rgba(255,255,255,0.5); -} - -h1 { - font-size: 1.7em; - text-align: center; - margin-top: 1.0em; - margin-bottom: 0.5em; - text-shadow: 0 1px 1px rgba(255,255,255,0.5); -} - -h2 { - font-size: 1.5em; - text-align: center; - margin-top: 1.0em; - margin-bottom: 0.5em; - text-shadow: 0 1px 1px rgba(255,255,255,0.5); -} - -h3 { - font-size: 1.2em; - text-align: left; - margin-top: 1.0em; - margin-bottom: 0.5em; - text-shadow: 0 1px 1px rgba(255,255,255,0.5); -} - -.divHeader { - display: block; - background-color: black; -} -.divHeader h1{ - font-size: 30px; - color: yellow; - margin: 0; - text-shadow: none; -} - -.divContent{ - padding-left:10px; - padding-right:10px; -} - -.divCode{ - background-color: black; - color: green; - font-family: Courier New, Courier, monospace; - text-shadow: none; - overflow:auto; - margin: 5px; - padding: 2px; - box-shadow: 0 0 10px rgb(0,0,0); -} - +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + font-size: 12px; + background-color: grey; + color: black; +} + +p { + margin-bottom: 0.5em; + text-shadow: 0 1px 1px rgba(255,255,255,0.5); +} + +h1 { + font-size: 1.7em; + text-align: center; + margin-top: 1.0em; + margin-bottom: 0.5em; + text-shadow: 0 1px 1px rgba(255,255,255,0.5); +} + +h2 { + font-size: 1.5em; + text-align: center; + margin-top: 1.0em; + margin-bottom: 0.5em; + text-shadow: 0 1px 1px rgba(255,255,255,0.5); +} + +h3 { + font-size: 1.2em; + text-align: left; + margin-top: 1.0em; + margin-bottom: 0.5em; + text-shadow: 0 1px 1px rgba(255,255,255,0.5); +} + +.divHeader { + display: block; + background-color: black; +} + +.divHeader h1 { + font-size: 30px; + color: yellow; + margin: 0; + text-shadow: none; +} + +.divContent { + padding-left: 10px; + padding-right: 10px; +} + +.divCode { + background-color: black; + color: green; + font-family: Courier New, Courier, monospace; + text-shadow: none; + overflow: auto; + margin: 5px; + padding: 2px; + box-shadow: 0 0 10px rgb(0,0,0); +} diff --git a/Scrummer/Styles/10. Chat.css b/Scrummer/Styles/10. Chat.css index 1b13285..b8878f0 100644 --- a/Scrummer/Styles/10. Chat.css +++ b/Scrummer/Styles/10. Chat.css @@ -1,103 +1,102 @@ -.divChatWindow{ - box-sizing: border-box; - overflow: hidden; - border: solid 1px black; - padding: 5px; - border-radius: 5px; - background-color: rgb(220,220,220); - box-shadow: 0px 0px 5px black; -} - -.divChat { - box-sizing: border-box; - overflow: auto; - height: calc(100% - 37px); - margin-bottom: 5px; - border-radius: 5px; - border: solid 1px black; - box-shadow: inset 0px 0px 5px black; -} - -.messageRow, -.selfMessageRow{ - vertical-align:top; - display:block; -} -.messageRow { - text-align: left; -} -.selfMessageRow { - text-align: right; -} -.message { - box-sizing: border-box; - display: inline-block; - vertical-align: top; - border: solid 1px rgb(32, 32, 32); - background-color: rgb(220,220,220); - border-radius: 5px; - box-shadow: - 0px 0px 10px rgba(0,0,0,0.5), - inset 0px 2px 5px rgba(255,255,255,0.5), - inset 0px -2px 5px rgba(128,128,128,0.5); - margin: 2px; - padding: 5px; - font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; -} -.messageRow .message { - background-color: rgb(220,200,200); -} -.selfMessageRow .message { - background-color: rgb(200,220,200); -} - -.message .user{ - box-sizing: border-box; - color:rgb(64,64,64); - text-shadow: 0 0 1px rgba(0,0,0,0.3); - font-size:10px; - font-weight:bold; -} -.message .text{ - box-sizing: border-box; - color:rgb(32,32,32); - text-shadow: 0 0 1px rgba(0,0,0,0.3); - font-size:12px; -} - -.divChatControls{ - -} - -.chatTextBox { - box-sizing: border-box; - padding: 5px; - box-shadow: inset 0px 0px 5px black; - width: calc(100% - 52px); - border-radius: 5px; - border: solid 1px black; - margin: 0 2px 0 0; - vertical-align: top; - height: 30px; - font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; - font-size: 12px; - text-align: left; -} - - -.chatButton { - box-sizing: border-box; - padding: 5px; - box-shadow: - 0px 0px 10px rgba(0,0,0,0.5), - inset 0px 2px 5px rgba(255,255,255,1), - inset 0px -2px 5px rgba(128,128,128,1); - width: 50px; - vertical-align: top; - border-radius: 5px; - border: solid 1px black; - height: 30px; - font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; - font-size: 12px; - text-align: center; -} +.divChatWindow { + box-sizing: border-box; + overflow: hidden; + border: solid 1px black; + padding: 5px; + border-radius: 5px; + background-color: rgb(220,220,220); + box-shadow: 0px 0px 5px black; +} + +.divChat { + box-sizing: border-box; + overflow: auto; + height: calc(100% - 37px); + margin-bottom: 5px; + border-radius: 5px; + border: solid 1px black; + box-shadow: inset 0px 0px 5px black; +} + +.messageRow, +.selfMessageRow { + vertical-align: top; + display: block; +} + +.messageRow { + text-align: left; +} + +.selfMessageRow { + text-align: right; +} + +.message { + box-sizing: border-box; + display: inline-block; + vertical-align: top; + border: solid 1px rgb(32, 32, 32); + background-color: rgb(220,220,220); + border-radius: 5px; + box-shadow: 0px 0px 10px rgba(0,0,0,0.5), inset 0px 2px 5px rgba(255,255,255,0.5), inset 0px -2px 5px rgba(128,128,128,0.5); + margin: 2px; + padding: 5px; + font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; +} + +.messageRow .message { + background-color: rgb(220,200,200); +} + +.selfMessageRow .message { + background-color: rgb(200,220,200); +} + +.message .user { + box-sizing: border-box; + color: rgb(64,64,64); + text-shadow: 0 0 1px rgba(0,0,0,0.3); + font-size: 10px; + font-weight: bold; +} + +.message .text { + box-sizing: border-box; + color: rgb(32,32,32); + text-shadow: 0 0 1px rgba(0,0,0,0.3); + font-size: 12px; +} + +.divChatControls { +} + +.chatTextBox { + box-sizing: border-box; + padding: 5px; + box-shadow: inset 0px 0px 5px black; + width: calc(100% - 52px); + border-radius: 5px; + border: solid 1px black; + margin: 0 2px 0 0; + vertical-align: top; + height: 30px; + font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; + font-size: 12px; + text-align: left; +} + + +.chatButton { + box-sizing: border-box; + padding: 5px; + box-shadow: 0px 0px 10px rgba(0,0,0,0.5), inset 0px 2px 5px rgba(255,255,255,1), inset 0px -2px 5px rgba(128,128,128,1); + width: 50px; + vertical-align: top; + border-radius: 5px; + border: solid 1px black; + height: 30px; + font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; + font-size: 12px; + text-align: center; +} diff --git a/Scrummer/Web.config b/Scrummer/Web.config index 01addc4..654b910 100644 --- a/Scrummer/Web.config +++ b/Scrummer/Web.config @@ -1,12 +1,18 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file