TwitCore/Helpers/TweetAnalyser.cs
/// <summary>
/// Generates a list of tweets.
/// </summary>
/// <param name="file">Origin file for all of the tweets.</param>
/// <returns></returns>
Generates a list of tweets.
Generates a list of tweets .
public static List<Tweet> TweetsInit(this TextFile file) {
            var result = new List<Tweet>();
            file.ReadFileToList().ForEach(line => {
                var tStartEnd = line.GetStartEnd(">");
                if (tStartEnd.Item1 != 0 && tStartEnd.Item2 != 0) {
                    var userHandle = line.Substring(0, tStartEnd.Item1).Trim(' ');
                    var message = line.Length <= 140 ? line.Substring(tStartEnd.Item2).Trim(' ') 
                        : line.Substring(tStartEnd.Item2, 140).Trim(' ') + "...";
                    result.Add(new Tweet(DateTime.Now.Ticks, 0, message, userHandle));
                }
            });
            return result;
        }
public static List < Tweet > TweetsInit ( this TextFile file ) { var result = new List < Tweet > ( ) ; file . ReadFileToList ( ) . ForEach ( line => { var tStartEnd = line . GetStartEnd ( " " ) ; if ( tStartEnd . Item1 != 0 && tStartEnd . Item2 != 0 ) { var userHandle = line . Substring ( 0 , tStartEnd . Item1 ) . Trim ( ' ' ) ; var message = line . Length <= 140 ? line . Substring ( tStartEnd . Item2 ) . Trim ( ' ' ) : line . Substring ( tStartEnd . Item2 , 140 ) . Trim ( ' ' ) + " " ; result . Add ( new Tweet ( DateTime . Now . Ticks , 0 , message , userHandle ) ) ; } } ) ; return result ; }
Generates a list of tweets.
Generates a list of tweets .
None
TextFile
this
file
Origin file for all of the tweets.
Origin file for all of the tweets .