Skip to content

Commit

Permalink
v2.0.4.2; Italian translation
Browse files Browse the repository at this point in the history
  • Loading branch information
briandunnington committed Aug 14, 2010
1 parent 2b24e67 commit 3a00fc3
Show file tree
Hide file tree
Showing 72 changed files with 5,282 additions and 1,340 deletions.
2 changes: 1 addition & 1 deletion Growl Connectors/NET/Sample App/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void button2_Click(object sender, EventArgs e)
this.growl.Notify(notification, callbackContext);
}

void growl_NotificationCallback(Response response, CallbackData callbackData)
void growl_NotificationCallback(Response response, CallbackData callbackData, object state)
{
string text = String.Format("Response Type: {0}\r\nNotification ID: {1}\r\nCallback Data: {2}\r\nCallback Data Type: {3}\r\n", callbackData.Result, callbackData.NotificationID, callbackData.Data, callbackData.Type);
MessageBox.Show(text, "Callback received", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
Expand Down
2 changes: 1 addition & 1 deletion Growl Connectors/NET/VB.NET Example/Form1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Public Class Form1
Me.growl.Notify(n, cc)
End Sub

Private Sub growl_NotificationCallback(ByVal response As Response, ByVal callbackData As CallbackData) Handles growl.NotificationCallback
Private Sub growl_NotificationCallback(ByVal response As Response, ByVal callbackData As CallbackData, ByVal state As Object) Handles growl.NotificationCallback
Dim text As String = String.Format("Response Type: {0} - Notification ID: {1} - Callback Data: {2} - Callback Data Type: {3}", callbackData.Result, callbackData.NotificationID, callbackData.Data, callbackData.Type)
MessageBox.Show(text, "Callback received", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)
End Sub
Expand Down
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.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@ namespace Sample_Display
/// 3. The Growl client will ensure that the settings panel is never resized smaller than
/// 450*155 pixels. Your panel should be layed out to work at this size, as well as handle
/// larger sizes (usually simply designing for 450*155 and setting .Anchor = Top | Left
/// is preferred)
/// is sufficient)
///
/// 4. Do *not* call GetSettings() or SaveSetting() from within the constructor. Your plugin
/// is instantiated by GfW using reflection and the values for the plugin directory path
/// and settings directory path are not yet available. Any initialization can instead be
/// done in the Load() event.
/// </summary>
public partial class SampleSettingsPanel : SettingsPanelBase
{
public SampleSettingsPanel()
{
InitializeComponent();

string filename = GetFileFromSetting(@"c:\growl_display_sdk_sample.txt");
this.textBox1.Text = filename;

this.Load +=new EventHandler(SampleSettingsPanel_Load);

// uncomment this section if you want to use a custom ISettingsProvider
Expand All @@ -42,6 +44,9 @@ public SampleSettingsPanel()

void SampleSettingsPanel_Load(object sender, EventArgs e)
{
string filename = GetFileFromSetting(@"c:\growl_display_sdk_sample.txt");
this.textBox1.Text = filename;

this.openFileDialog1.FileOk += new CancelEventHandler(openFileDialog1_FileOk);
}

Expand Down
Binary file modified Growl Extras/Growl Display SDK/libraries/Growl.CoreLibrary.dll
Binary file not shown.
Binary file modified Growl Extras/Growl Display SDK/libraries/Growl.DisplayStyle.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions Growl/Growl.Connector/ConnectorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ private void SendAsync(object obj)
client = new TcpClient();
client.Connect(this.hostname, this.port);
}
catch (Exception ex)
catch
{
OnCommunicationFailure(new Response(ErrorCode.NETWORK_FAILURE, ErrorDescription.CONNECTION_FAILURE), cs.UserState);
}
Expand All @@ -261,7 +261,7 @@ private void SendAsync(object obj)
stream = client.GetStream();
stream.Write(bytes, 0, bytes.Length);
}
catch (Exception ex)
catch
{
OnCommunicationFailure(new Response(ErrorCode.NETWORK_FAILURE, ErrorDescription.WRITE_FAILURE), cs.UserState);
}
Expand Down Expand Up @@ -306,7 +306,7 @@ private void SendAsync(object obj)
del(response, cs.UserState);
}
}
catch (Exception ex)
catch
{
OnCommunicationFailure(new Response(ErrorCode.NETWORK_FAILURE, ErrorDescription.READ_FAILURE), cs.UserState);
}
Expand Down
2 changes: 1 addition & 1 deletion Growl/Growl.Connector/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.4.1")]
[assembly: AssemblyFileVersion("2.0.4.2")]
[assembly: AssemblyInformationalVersion("2.0.4")]
17 changes: 17 additions & 0 deletions Growl/Growl.CoreLibrary/Detector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,23 @@ public static bool DetectIfGrowlIsRunning()
return !createdNew;
}

/// <summary>
/// Shows the settings window.
/// </summary>
/// <remarks>
/// If GfW is not running, it will be launched.
/// </remarks>
public void ShowSettingsWindow()
{
if (this.IsInstalled)
{
string exePath = Path.Combine(this.InstallationFolder, "Growl.exe");
string args = "/cmd:show";
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(exePath, args);
System.Diagnostics.Process.Start(info);
}
}

/// <summary>
/// Returns the full path to where Growl is installed
/// </summary>
Expand Down
40 changes: 40 additions & 0 deletions Growl/Growl.CoreLibrary/IPUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,35 @@

namespace Growl.CoreLibrary
{
/// <summary>
/// Provides helper methods for common IP-address related functionality.
/// </summary>
public class IPUtilities
{
/// <summary>
/// Provides a lock while gathering network adapter information from the system.
/// </summary>
private static object syncLock = new object();

/// <summary>
/// Loads a list of subnet masks for each IP address on the machine (IPv4 only)
/// </summary>
private static Dictionary<IPAddress, IPAddress> masks;


/// <summary>
/// Determines whether <paramref name="otherAddress"/> is in the same subnet as <paramref name="localAddress"/>.
/// </summary>
/// <param name="localAddress">The local address to compare to.</param>
/// <param name="otherAddress">The other address being compared.</param>
/// <returns>
/// <c>true</c> if both addresses are in the same subnet; otherwise, <c>false</c>.
/// </returns>
/// <remarks>
/// If the otherAddress is the loopback address, then this method always returns true.
/// The subnet comparison is done for IPv4 addresses. For IPv6 addresses, this method returns
/// <c>true</c> if the address is a LinkLocal or SiteLocal address.
/// </remarks>
public static bool IsInSameSubnet(IPAddress localAddress, IPAddress otherAddress)
{
try
Expand All @@ -32,6 +56,14 @@ public static bool IsInSameSubnet(IPAddress localAddress, IPAddress otherAddress
return false;
}

/// <summary>
/// Gets the local subnet mask for the given IP address.
/// </summary>
/// <param name="ipaddress">The ipaddress.</param>
/// <returns>
/// <see cref="IPAddress"/> of the subnet mask of the IP address, or <see cref="IPAddress.None"/>
/// if the subnet cannot be determined.
/// </returns>
public static IPAddress GetLocalSubnetMask(IPAddress ipaddress)
{
lock (syncLock)
Expand Down Expand Up @@ -64,6 +96,14 @@ public static IPAddress GetLocalSubnetMask(IPAddress ipaddress)
return IPAddress.None;
}

/// <summary>
/// Gets the network broadcast address based on an IP address and subnet mask.
/// </summary>
/// <param name="address">The IP address.</param>
/// <param name="subnetMask">The subnet mask.</param>
/// <returns>
/// The broadcast <see cref="IPAddress"/>
/// </returns>
public static IPAddress GetNetworkAddress(IPAddress address, IPAddress subnetMask)
{
byte[] ipAdressBytes = address.GetAddressBytes();
Expand Down
2 changes: 1 addition & 1 deletion Growl/Growl.CoreLibrary/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.4.1")]
[assembly: AssemblyFileVersion("2.0.4.2")]
[assembly: AssemblyInformationalVersion("2.0.4")]
2 changes: 1 addition & 1 deletion Growl/Growl.Daemon/FlashPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal static class FlashPolicy
/// <summary>
/// String that indicates the request may be a Flash policy request
/// </summary>
public const string REQUEST_INDICATOR = "<";
public const string REQUEST_INDICATOR = "<pol";

/// <summary>
/// String that represents a valid Flash policy request
Expand Down
94 changes: 94 additions & 0 deletions Growl/Growl.Daemon/GNTPFlashSocketReader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;
using Growl.CoreLibrary;
using Growl.Connector;

namespace Growl.Daemon
{
/// <summary>
/// Handles Flash policy requests
/// </summary>
class GNTPFlashSocketReader : GNTPRequestReader
{
private const long FLASH_POLICY_REQUEST_TAG = 3001;
private const long FLASH_POLICY_RESPONSE_TAG = 3002;

private const int TIMEOUT_FLASHPOLICYREQUEST = -1;
private const int TIMEOUT_FLASHPOLICYRESPONSE = -1;

/// <summary>
/// The <see cref="AsyncSocket"/> making the request
/// </summary>
private AsyncSocket socket;

/// <summary>
/// Indicates if Flash requests are allowed
/// </summary>
private bool allowFlash;


/// <summary>
/// Initializes a new instance of the <see cref="GNTPFlashSocketReader"/> class.
/// </summary>
/// <param name="socket">The <see cref="AsyncSocket"/> making the request</param>
/// <param name="allowFlash">Indicates if Flash requests are allowed</param>
public GNTPFlashSocketReader(AsyncSocket socket, bool allowFlash)
{
this.socket = socket;
this.allowFlash = allowFlash;
}

/// <summary>
/// Reads the socket data and handles the request
/// </summary>
/// <param name="alreadyReadBytes">Any bytes that were already read from the socket</param>
public void Read(byte[] alreadyReadBytes)
{
Data data = new Data(alreadyReadBytes);
string s = data.ToString();
this.AlreadyReceivedData.Append(s);

this.socket.DidRead += new AsyncSocket.SocketDidRead(ReadPolicyRequest);
this.socket.Read(FlashPolicy.REQUEST.Length - s.Length, TIMEOUT_FLASHPOLICYREQUEST, FLASH_POLICY_REQUEST_TAG);
}

/// <summary>
/// Reads the Flash policy request and returns the policy response if Flash requests are allowed.
/// </summary>
/// <param name="sender">The <see cref="AsyncSocket"/></param>
/// <param name="readBytes">The bytes read from the socket</param>
/// <param name="tag">A tag identifying the read request</param>
void ReadPolicyRequest(AsyncSocket sender, byte[] readBytes, long tag)
{
// remove this now that we are done with it
this.socket.DidRead -= new AsyncSocket.SocketDidRead(ReadPolicyRequest);

if (tag == FLASH_POLICY_REQUEST_TAG)
{
Data data = new Data(readBytes);
this.AlreadyReceivedData.Append(data.ToString());

string request = this.AlreadyReceivedData.ToString();
if (request == FlashPolicy.REQUEST)
{
if (this.allowFlash)
{
this.socket.Write(FlashPolicy.ResponseBytes, TIMEOUT_FLASHPOLICYRESPONSE, FLASH_POLICY_RESPONSE_TAG);
this.socket.CloseAfterWriting();
}
else
{
OnError(ErrorCode.NOT_AUTHORIZED, ErrorDescription.FLASH_CONNECTIONS_NOT_ALLOWED);
}
}
else
{
OnError(ErrorCode.INVALID_REQUEST, ErrorDescription.UNRECOGNIZED_REQUEST);
}
}
}
}
}
Loading

0 comments on commit 3a00fc3

Please sign in to comment.