Skip to content

Commit

Permalink
RC2 plus fix for receiving streaming data in ConnectorBase
Browse files Browse the repository at this point in the history
  • Loading branch information
briandunnington committed Oct 9, 2009
1 parent 60ee356 commit a809d35
Show file tree
Hide file tree
Showing 84 changed files with 4,420 additions and 376 deletions.
Binary file modified Growl Connectors/NET/libraries/Growl.Connector.dll
Binary file not shown.
Binary file modified Growl Connectors/NET/libraries/Growl.CoreLibrary.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,14 @@
{
"Name" = "8:Microsoft Visual Studio"
"ProductName" = "8:Feed Monitor"
"ProductCode" = "8:{112838BB-CDED-4071-AB0D-865F82874302}"
"PackageCode" = "8:{B67AFFBF-0CCE-41B9-88E8-74A41DE9618C}"
"ProductCode" = "8:{BD7EE876-9F0E-4C2D-8B25-BDA55F54A594}"
"PackageCode" = "8:{FA534258-825F-4AA3-843E-7B3521B408C5}"
"UpgradeCode" = "8:{E8D784D8-949E-4CC9-BA80-A316D25574D7}"
"RestartWWWService" = "11:FALSE"
"RemovePreviousVersions" = "11:TRUE"
"DetectNewerInstalledVersion" = "11:TRUE"
"InstallAllUsers" = "11:FALSE"
"ProductVersion" = "8:1.0.2"
"ProductVersion" = "8:1.0.4"
"Manufacturer" = "8:element code project"
"ARPHELPTELEPHONE" = "8:"
"ARPHELPLINK" = "8:"
Expand Down
15 changes: 5 additions & 10 deletions Growl Extras/Feed Monitor/GrowlExtras.FeedMonitor/FeedListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ public FeedListView(IContainer container)

this.SuspendLayout();

this.OwnerDraw = true;
this.DoubleBuffered = true;
this.OwnerDraw = true;
this.DrawItem += new DrawListViewItemEventHandler(FeedListView_DrawItem);

// columns
ColumnHeader nameHeader = new ColumnHeader();
Expand All @@ -39,8 +40,6 @@ public FeedListView(IContainer container)
this.ShowItemToolTips = true;
this.LabelWrap = false;

this.DrawItem += new DrawListViewItemEventHandler(FeedListView_DrawItem);

// uncomment this to use custom tool tips
//this.ShowItemToolTips = false;
this.ItemMouseHover += new ListViewItemMouseHoverEventHandler(FeedListView_ItemMouseHover);
Expand All @@ -56,15 +55,11 @@ void FeedListView_DrawItem(object sender, DrawListViewItemEventArgs e)
Feed feed = (Feed) e.Item.Tag;

// draw the background and focus rectangle for selected and non-selected states
if ((e.State & ListViewItemStates.Selected) != 0)
e.DrawBackground();
if (e.Item.Selected)
{
e.Graphics.FillRectangle(System.Drawing.Brushes.LightGray, e.Bounds);
e.DrawFocusRectangle();
}
else
{
e.DrawBackground();
e.DrawFocusRectangle();
ControlPaint.DrawFocusRectangle(e.Graphics, e.Bounds);
}

// draw icon
Expand Down
14 changes: 12 additions & 2 deletions Growl Extras/Feed Monitor/GrowlExtras.FeedMonitor/MainComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private void InitializeFeeds()
List<Feed> savedFeeds = SettingsPersister.Read();
foreach (Feed feed in savedFeeds)
{
AddFeed(feed.Url, feed.PollInterval);
AddFeed(feed);
}

if (this.feeds.Count == 0)
Expand All @@ -120,11 +120,21 @@ private void InitializeFeeds()
}
}

public void AddFeed(Feed feed)
{
AddFeed(feed.Url, feed.PollInterval, feed.CustomName, feed.Username, feed.Password);
}

public void AddFeed(string url, int pollInterval)
{
AddFeed(url, pollInterval, null, null, null);
}

private void AddFeed(string url, int pollInterval, string customName, string username, string password)
{
try
{
Feed feed = Feed.Create(url, pollInterval);
Feed feed = Feed.Create(url, pollInterval, customName, username, password);
feed.FeedRetrieved += new EventHandler<FeedRetrievedEventArgs>(feed_FeedRetrieved);
feed.FeedUpdated += new EventHandler<FeedUpdatedEventArgs>(feed_FeedUpdated);
feed.FeedError += new EventHandler<FeedErrorEventArgs>(feed_FeedError);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.4.0")]
62 changes: 55 additions & 7 deletions Growl Extras/Feed Monitor/GrowlExtras.FeedMonitor/_source/Feed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ public class Feed : IDisposable
private const string _nullResultErrorMessage = "The returned stream was null.";
private const string _parseErrorMessage = "Unable to parse feed.";

private string name;
private string actualName;
private string customName;
private Uri url;
private int pollInterval;
private string username;
private string password;
private DateTime lastCheckForUpdates;
private DateTimeOffset feedLastUpdated;
private WebClient webclient;
Expand All @@ -29,14 +32,22 @@ private Feed() { }

public static Feed Create(string url, int pollInterval)
{
return new Feed(url, pollInterval, DateTime.MaxValue);
return Create(url, pollInterval, null, null, null);
}

private Feed(string url, int pollInterval, DateTime lastCheckForUpdates)
public static Feed Create(string url, int pollInterval, string customName, string username, string password)
{
this.name = LOADING;
return new Feed(url, pollInterval, customName, username, password, DateTime.MaxValue);
}

private Feed(string url, int pollInterval, string customName, string username, string password, DateTime lastCheckForUpdates)
{
this.actualName = LOADING;
this.customName = customName;
this.url = new Uri(url);
this.pollInterval = pollInterval;
this.username = username;
this.password = password;
this.lastCheckForUpdates = lastCheckForUpdates;
this.feedLastUpdated = DateTimeOffset.MaxValue;

Expand All @@ -56,7 +67,26 @@ public string Name
{
get
{
return this.name;
if (this.actualName == LOADING || String.IsNullOrEmpty(this.customName))
return this.actualName;
else
return this.customName;
}
}

public string ActualName
{
get
{
return this.actualName;
}
}

public string CustomName
{
get
{
return this.customName;
}
}

Expand All @@ -81,6 +111,22 @@ public int PollInterval
}
}

public string Username
{
get
{
return this.username;
}
}

public string Password
{
get
{
return this.password;
}
}

void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
this.timer.Stop();
Expand All @@ -91,6 +137,7 @@ public void CheckForUpdates()
{
if (!this.webclient.IsBusy)
{
this.webclient.Credentials = new NetworkCredential(this.username, this.password);
this.webclient.Headers.Add(System.Net.HttpRequestHeader.UserAgent, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
this.webclient.OpenReadAsync(this.url);
this.lastCheckForUpdates = DateTime.Now;
Expand Down Expand Up @@ -130,6 +177,7 @@ void webclient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)

if (info != null)
{
info.CustomTitle = this.CustomName;
info.Url = this.Url;
OnFeedRetrieved(info);
}
Expand Down Expand Up @@ -165,11 +213,11 @@ void webclient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
/// </summary>
protected void OnFeedRetrieved(FeedInfo feed)
{
this.name = feed.Title;
this.actualName = feed.ActualTitle;
DateTimeOffset mostRecentItem = this.feedLastUpdated;
if (mostRecentItem == DateTimeOffset.MaxValue) mostRecentItem = DateTimeOffset.MinValue;

System.Diagnostics.Debug.WriteLine(String.Format("Feed Retrieved: {0} - Most Recent Item: {1}", this.name, mostRecentItem));
System.Diagnostics.Debug.WriteLine(String.Format("Feed Retrieved: {0} - Most Recent Item: {1}", this.Name, mostRecentItem));

if (FeedRetrieved != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,43 @@ namespace GrowlExtras.FeedMonitor
{
public class FeedInfo
{
string title;
string actualTitle;
string customTitle;
string url;
List<FeedItem> items;

public string Title
{
get
{
return this.title;
if (String.IsNullOrEmpty(this.customTitle))
return this.actualTitle;
else
return this.customTitle;
}
}

public string ActualTitle
{
get
{
return this.actualTitle;
}
set
{
this.actualTitle = value;
}
}

public string CustomTitle
{
get
{
return this.customTitle;
}
set
{
this.title = value;
this.customTitle = value;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public FeedInfo Parse(XmlReader reader)
if (!parsingItems && name.ToLowerInvariant() == "title")
{
reader.Read();
info.Title = reader.Value;
info.ActualTitle = reader.Value;
}

if (name.ToLowerInvariant() == "item" || name.ToLowerInvariant() == "entry")
Expand Down
Loading

0 comments on commit a809d35

Please sign in to comment.