Esempio n. 1
0
            public string CsvRow()
            {
                StringBuilder builder = new StringBuilder();

                builder.Append($"{Name}").Append(CSV_SEP);
                builder.Append($"{FullName}").Append(CSV_SEP);
                builder.Append($"\"{Description}\"").Append(CSV_SEP);
                builder.Append($"{Size}").Append(CSV_SEP);
                builder.Append($"{Private}").Append(CSV_SEP);
                builder.Append($"{Language}").Append(CSV_SEP);
                if (License != null)
                {
                    builder.Append($"{License.Name}").Append(CSV_SEP);
                }
                else
                {
                    builder.Append($"").Append(CSV_SEP);
                }
                if (Readme != null)
                {
                    builder.Append($"{Readme.Name}").Append(CSV_SEP);
                }
                else
                {
                    builder.Append($"").Append(CSV_SEP);
                }
                builder.Append($"{ReleaseCount}").Append(CSV_SEP);
                builder.Append($"{OpenIssuesCount}").Append(CSV_SEP);
                builder.Append($"{Fork}").Append(CSV_SEP);
                if (ParentName != null && ParentName.Equals("<None>"))
                {
                    // Leave it blank for <None>
                    builder.Append($"").Append(CSV_SEP);
                }
                else
                {
                    builder.Append($"{ParentName}").Append(CSV_SEP);
                }
                builder.Append($"{ForksCount}").Append(CSV_SEP);
                builder.Append($"{StarCount}").Append(CSV_SEP);
                builder.Append($"{Watchers}").Append(CSV_SEP);
                builder.Append($"{CreatedAt.ToLocalTime()}").Append(CSV_SEP);
                builder.Append($"{UpdatedAt.ToLocalTime()}").Append(CSV_SEP);
                if (PushedAt.HasValue)
                {
                    builder.Append($"{PushedAt.Value.ToLocalTime()}").Append(CSV_SEP);
                }
                else
                {
                    builder.Append($"").Append(CSV_SEP);
                }
                // Remove the last separator
                string line = builder.ToString();

                line = line.Substring(0, line.Length - CSV_SEP.Length);
                return(line);
            }
Esempio n. 2
0
            public override string ToString()
            {
                StringBuilder builder = new StringBuilder();

                builder.AppendLine($"Name={Name}");
                builder.AppendLine($"    FullName={FullName}");
                builder.AppendLine($"    Description={Description}");
                builder.AppendLine($"    Size={Size} KB");
                builder.AppendLine($"    Private={Private}");
                builder.AppendLine($"    Language={Language}");
                if (License != null)
                {
                    builder.AppendLine($"    License={License.Name}");
                }
                else
                {
                    builder.AppendLine($"    License=<NA>");
                }
                if (Readme != null)
                {
                    builder.AppendLine($"    Readme={Readme.Name}");
                }
                else
                {
                    builder.AppendLine($"    Readme=<None>");
                }
                builder.AppendLine($"    ReleaseCount={ReleaseCount}");
                builder.AppendLine($"    OpenIssuesCount={OpenIssuesCount}");
                builder.AppendLine($"    Fork={Fork}");
                // This appears to always be null
                //builder.AppendLine($"    Parent={Parent}");
                builder.AppendLine($"    ParentName={ParentName}");
                builder.AppendLine($"    ForksCount={ForksCount}");
                builder.AppendLine($"    StarCount={StarCount}");
                builder.AppendLine($"    Watchers={Watchers}");
                //builder.AppendLine($"    HomePage={HomePage}");
                builder.AppendLine($"    CreatedAt={CreatedAt.ToLocalTime()}");
                builder.AppendLine($"    UpdatedAt={UpdatedAt.ToLocalTime()}");
                if (PushedAt.HasValue)
                {
                    builder.AppendLine($"    PushedAt={PushedAt.Value.ToLocalTime()}");
                }
                else
                {
                    builder.AppendLine($"    PushedAt=Never");
                }
                return(builder.ToString());
            }
Esempio n. 3
0
 public TwitterMessage(XElement element)
 {
     ActualId = Convert.ToInt64(element.Element("id").Value);
     if (element.Element("retweeted_status") != null)
     {
         RetweetUser = new TwitterUser(element.Element("user"));
         element     = element.Element("retweeted_status");
         IsRetweet   = true;
     }
     CreatedAt   = DateTime.ParseExact(element.Element("created_at").Value, "ddd MMM dd HH:mm:ss +0000 yyyy", CultureInfo.InvariantCulture);
     CreatedAt   = CreatedAt.ToLocalTime();
     Text        = HttpUtility.HtmlDecode(element.Element("text").Value);
     Id          = Convert.ToInt64(element.Element("id").Value);
     IsFavourite = element.Element("favorited").Value == "true";
     if (element.Element("in_reply_to_status_id").Value != "")
     {
         InReplyToId         = Convert.ToInt64(element.Element("in_reply_to_status_id").Value);
         InReplyToUserId     = Convert.ToInt64(element.Element("in_reply_to_user_id").Value);
         InReplyToScreenName = element.Element("in_reply_to_screen_name").Value;
     }
     User = new TwitterUser(element.Element("user"));
 }