static void Main(string[] args)
        {
            //if (args.Length != 1)
            //{
            //    WriteLine("Please provide exactly 1 argument - the text to split.");
            //    return;
            //}

            //var messageInput = args[0];
            var messageInput = "Without requirements or design, programming is the art of adding bugs to an empty text file.";

            var configuration = new SplitterConfiguration();
            var splitter      = new Splitter(configuration);
            var tweets        = splitter.Split(messageInput);

            for (int i = 0; i < tweets.Count(); i++)
            {
                var tweet = tweets.ElementAt(i);
                WriteLine($"Printing Tweet {i + 1} of {tweets.Count()}");
                WriteLine($"\"{tweet.Message}\"");
                WriteLine();
            }

            ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Please provide exactly 1 argument - the text to split.");
                return;
            }

            var messageInput = args[0];

            var configuration = new SplitterConfiguration();
            var splitter      = new Splitter(configuration);;

            Console.WriteLine("Splitting message into Tweets.");
            var tweets = splitter.Split(messageInput);

            Console.WriteLine($"Tweets created: {tweets.Count()}.");

            for (var i = 0; i < tweets.Count(); i++)
            {
                var tweet = tweets.ElementAt(i);
                Console.WriteLine($"Printing Tweet {i} of {tweets.Count()} ({tweet.Message.Length}) characters.");
                Console.WriteLine(tweet.Message);
                Console.WriteLine();
            }

            Console.WriteLine($"Press any key to continue.");
            Console.ReadKey();
        }
Пример #3
0
 public Splitter(SplitterConfiguration splitterConfiguration)
 {
     _MaxTweetLength     = splitterConfiguration.MaximumTweetLength;
     _ShortUrlCharLength = splitterConfiguration.ShortenedUrlCharacterLength;
     _TweetFormat        = splitterConfiguration.TweetFormat;
     _ContinuationText   = splitterConfiguration.ContinuationText;
     _ContinuesText      = splitterConfiguration.ContinuesText;
     _UrlRegex           = splitterConfiguration.UrlRegex;
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Splitter"/> class.
 /// </summary>
 /// <param name="splitterConfiguration">The splitter configuration.</param>
 /// <exception cref="NotImplementedException"></exception>
 public Splitter(SplitterConfiguration splitterConfiguration)
 {
     SplitterConfig = splitterConfiguration;
 }