public TrelloToGoogleService()
        {
            _configuration = new TrelloStatsConfiguration();
            var htmlFactory = new HtmlFactory(_configuration);
            var spreadsheetEntryFactory = new SpreadsheetEntryFactory(_configuration, htmlFactory);
            var trelloClient = new TrelloClient(_configuration);

            _googleClient = new GoogleClient(_configuration);
            _googleService = new GoogleService(_configuration, spreadsheetEntryFactory, _googleClient);
            _trelloService = new TrelloService(_configuration, trelloClient);
            _highChartsJsonService = new HighChartsJsonService(_configuration, htmlFactory);
            _timesheetService = new TimesheetService(_configuration, _googleClient);
            _boardStatsService = new BoardStatsService(_configuration);
        }
 private void PrepareToDownload()
 {
     var(service, parsedLink, fileName, isFileExist) = HtmlFactory.ParseLink(ServiceLink);
     if (isFileExist)
     {
         ServiceName = service;
         OnPropertyChanged(nameof(ServiceName));
         DownloadLink = parsedLink;
         OnPropertyChanged(nameof(DownloadLink));
         FileName = fileName;
         OnPropertyChanged(nameof(FileName));
         Status = DownloadStatus.NotDownloading;
         OnPropertyChanged(nameof(Status));
     }
     else
     {
         Status = DownloadStatus.NotFound;
     }
 }
 public HighChartsJsonService(ITrelloStatsConfiguration configuration, HtmlFactory htmlFactory)
 {
     _configuration = configuration;
     _htmlFactory = htmlFactory;
 }
Exemplo n.º 4
0
        private async Task SendResponseAsync(StreamSocket socket, HttpResponseMessage response)
        {
            _logger.Trace("Pipeline => WebSocketListener.SendResponseAsync");

            try
            {
                if (response == null || response.Content == null)
                {
                    string errorPage = HtmlFactory.HttpResponse("utf-8", "Not Found", "Opps, page not found");
                    response.Content      = new HttpStringContent(errorPage, UnicodeEncoding.Utf8, "text/html");
                    response.StatusCode   = HttpStatusCode.NotFound;
                    response.ReasonPhrase = "Not Found";
                    response.Headers.Add("Connection", "close");
                }

                ulong contentLength = await response.Content.BufferAllAsync();

                if (contentLength == 0)
                {
                    return;
                }

                using (DataWriter outputWriter = new DataWriter(socket.OutputStream))
                {
                    string htmlVersion;

                    switch (response.Version)
                    {
                    case HttpVersion.Http10:
                        htmlVersion = "HTTP/1.0";
                        break;

                    case HttpVersion.Http20:
                        htmlVersion = "HTTP/2.0";
                        break;

                    default:
                        htmlVersion = "HTTP/1.1";
                        break;
                    }

                    //if (response.Header. != null)
                    //{
                    //    switch (response.RequestMessage)
                    //    {
                    //        case UnicodeEncoding.Utf16BE:
                    //            outputWriter.UnicodeEncoding = UnicodeEncoding.Utf16BE;
                    //            break;
                    //        case UnicodeEncoding.Utf16LE:
                    //            outputWriter.UnicodeEncoding = UnicodeEncoding.Utf16LE;
                    //            break;
                    //        default:
                    //            outputWriter.UnicodeEncoding = UnicodeEncoding.Utf8;
                    //            break;
                    //    }
                    //}
                    outputWriter.UnicodeEncoding = UnicodeEncoding.Utf8;

                    outputWriter.WriteString(string.Format("{0} {1} {2}\r\n", htmlVersion, (int)response.StatusCode, response.StatusCode));

                    foreach (var item in response.Headers)
                    {
                        outputWriter.WriteString(string.Format("{0}: {1}\r\n", item.Key, item.Value));
                    }

                    foreach (var item in response.Content.Headers)
                    {
                        outputWriter.WriteString(string.Format("{0}: {1}\r\n", item.Key, item.Value));
                    }

                    //string ret = "Set-Cookie: {0}={1}; Path={2}; Expires={3};\r\n";

                    outputWriter.WriteString("\r\n");

                    var bodyContent = await response.Content.ReadAsBufferAsync();

                    outputWriter.WriteBuffer(bodyContent);

                    await outputWriter.StoreAsync();
                }
            }
            catch (Exception ex)
            {
                _logger.Error("WebSocket request failed with error: {0}", ex.Message, ex);
            }
            finally
            {
                if (socket != null)
                {
                    socket.Dispose();
                }

                _logger.Debug("WebSocket connection from {0}:{1} to {2}:{3} was closed",
                              socket.Information.RemoteHostName.DisplayName,
                              socket.Information.RemotePort,
                              socket.Information.LocalAddress.DisplayName,
                              socket.Information.LocalPort);
            }
        }
Exemplo n.º 5
0
 public FleetCompGridModel()
 {
     _HtmlTable = new HtmlFactory(Enums.HtmlTable.FleetComp).HtmlTable as CompHtmlTable;
 }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            string[] commands;
            string   list = "";

            try
            {
                list = File.ReadAllText(RelativeToAbsolutePath("CreateDocumentScript.txt"));
            } catch (FileNotFoundException e)
            {
                Console.WriteLine("Input file not found (be sure CreateDocumentScript.txt is in the right directory: \"" + e.FileName + "\").");
                System.Environment.Exit(1);
            }

            commands = list.Split('#');

            // to be assigned below
            DocumentFactory.IDocument document = null;
            //DocumentFactory.IElement element = null;
            string factoryType = ""; // 'html' or 'markdown'
            string elementType = ""; // 'image','header','list','table'
            string props       = ""; // string value of rest component except elementType

            foreach (var command in commands)
            {
                string   strippedCommand = Regex.Replace(command, @"\t|\n|\r", ""); // this cleans up the text a bit
                string[] commandList     = strippedCommand.Split(':');

                switch (commandList[0])
                {
                case "Document":
                    string[] DocumentList = commandList[1].Split(';');
                    factoryType = DocumentList[0];
                    string fileName = DocumentList[1];

                    if (factoryType == "Html")
                    {
                        document = HtmlFactory.Get().CreateDocument(fileName);
                    }
                    else if (factoryType == "Markdown")
                    {
                        document = MdFactory.Get().CreateDocument(fileName);
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }
                    break;

                case "Element":
                    //props = propsList[0];
                    elementType = commandList[1];
                    props       = commandList[2];

                    if (factoryType == "Html")
                    {
                        document.AddElement(HtmlFactory.Get().CreateElement(elementType, props));
                    }
                    else if (factoryType == "Markdown")
                    {
                        document.AddElement(MdFactory.Get().CreateElement(elementType, props));
                    }

                    else
                    {
                        throw new NotImplementedException();
                    }

                    break;

                case "Run":
                    File.WriteAllText(RelativeToAbsolutePath(document.GetFilename()), document.Run());
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 7
0
 public SiteCompGridModel()
 {
     _HtmlTable = new HtmlFactory(Enums.HtmlTable.SiteComp).HtmlTable as CompHtmlTable;
 }