Skip to content
This repository has been archived by the owner on May 20, 2022. It is now read-only.

Commit

Permalink
* Refactored NumbersOnly to DigitsOnly in Filters class
Browse files Browse the repository at this point in the history
* Added NormalizeNumber to Filters class
* Commandline arguments will now handle telephonenumbers like "+31123456789" correctly
* Setup now also offers the ability to handle "tel:" links alongside "callto:" links
* Setup will now require at least Windows XP (which was Windows 2000 but .Net 4.0 isn't supported on that platform)
* Setup build location changed to parent directory
* Added little reminder list of what needs to be done for new releases
  • Loading branch information
RobThree committed Feb 22, 2013
1 parent e001ebb commit 2e2696c
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 9 deletions.
1 change: 1 addition & 0 deletions Fop2DD.sln
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
Fop2ClientLib\Fop2Client.nuspec = Fop2ClientLib\Fop2Client.nuspec
Fop2ClientLib\Fop2Client.shfbproj = Fop2ClientLib\Fop2Client.shfbproj
howto_release.txt = howto_release.txt
README.txt = README.txt
EndProjectSection
EndProject
Expand Down
21 changes: 18 additions & 3 deletions Fop2DD/Core/Common/Filters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ public static class Filters
//Regex to remove double (or more) whitespace
private static Regex _removeextrawhitespace = new Regex(@"\s{2,}", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline);
//Regex to remove anything but numbers
private static Regex _numericonly = new Regex(@"([^0-9])", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline);
private static Regex _digitsonly = new Regex(@"([^0-9])", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.Singleline);

/// <summary>
/// Removes any non-digits from a string.
/// </summary>
/// <param name="value">The value to remove non-digits from.</param>
/// <returns>Returns the original string with anything but digits removed.</returns>
public static string NumbersOnly(string value)
public static string DigitsOnly(string value)
{
return _numericonly.Replace(value ?? string.Empty, string.Empty);
return _digitsonly.Replace(value ?? string.Empty, string.Empty);
}

/// <summary>
Expand All @@ -28,5 +28,20 @@ public static string RemoveExtraWhitespace(string value)
{
return _removeextrawhitespace.Replace(value ?? string.Empty, " ").Trim();
}

/// <summary>
/// Normalizes a number like "+31123456789" to "0031123456789"
/// </summary>
/// <param name="value">The number to normalize.</param>
/// <returns>Returns a normalized number.</returns>
/// <remarks>
/// Currently this is a very simple routine that should be modified
/// to handle all sorts of normalization and take into account different
/// countries' rules.
/// </remarks>
public static string NormalizeNumber(string value)
{
return (value ?? string.Empty).Replace("+", "00");
}
}
}
2 changes: 1 addition & 1 deletion Fop2DD/Core/Common/PhonenumberGrabber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private static string[] FilterPhoneNumbers(string value, int minlength)
.Select(m => Filters.RemoveExtraWhitespace(m.Captures[0].Value))
.Where(r => r.Length >= minlength)
)
.Select(n => Filters.NumbersOnly(n.Replace("+", "00")))
.Select(n => Filters.DigitsOnly(Filters.NormalizeNumber(n)))
.ToArray();
}
}
Expand Down
6 changes: 3 additions & 3 deletions Fop2DD/Core/DDCore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void DialFromCommandlineArgs(string[] args)

private string GetNumberFromArgs(string[] args)
{
return args.Select(a => Filters.NumbersOnly(a))
return args.Select(a => Filters.DigitsOnly(Filters.NormalizeNumber(a)))
.Where(n => n.Length > Properties.Settings.Default.GrabMinLength)
.FirstOrDefault();
}
Expand All @@ -68,7 +68,7 @@ private void event_BalloonClicked(object sender, DDBalloonClickedEventArgs e)

if (!string.IsNullOrEmpty(s.DialCmd_File))
{
var phonenumber = Filters.NumbersOnly(e.BalloonInfo.CallerIdNumber);
var phonenumber = Filters.DigitsOnly(e.BalloonInfo.CallerIdNumber);
var command = new ShellCommand(s.DialCmd_File, s.DialCmd_Args);
command.WorkingDirectory = s.DialCmd_WorkDir;

Expand Down Expand Up @@ -137,7 +137,7 @@ private void event_DialRequest(object sender, DialRequestEventArgs e)

if (numbertodial != null)
{
numbertodial = Filters.NumbersOnly(numbertodial);
numbertodial = Filters.DigitsOnly(numbertodial);
if (!string.IsNullOrWhiteSpace(numbertodial))
_client.Dial(numbertodial);
}
Expand Down
14 changes: 12 additions & 2 deletions Fop2DD/setup.iss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
;Inno Setup file. See http://www.jrsoftware.org/isinfo.php if you're unfamiliar with this type of file.

[Setup]
AppPublisher=KeenSystems
AppPublisherURL=http://www.keensystems.eu
Expand All @@ -11,12 +13,12 @@ DefaultGroupName=KeenSystems\Fop2DD
UninstallDisplayIcon={app}\Fop2DD.exe
Compression=lzma2/max
SolidCompression=yes
OutputDir=.\
OutputDir=..\
OutputBaseFilename=fop2dd_setup
PrivilegesRequired=admin
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x86 x64
MinVersion=0.0,5.01
MinVersion=0.0,5.1
UsePreviousLanguage=yes
DisableWelcomePage=yes
SetupIconFile=icons\application.ico
Expand Down Expand Up @@ -51,6 +53,7 @@ Name: "{group}\{cm:UnInstall}"; Filename: "{uninstallexe}"
[Tasks]
Name: launchonboot; Description: {cm:LaunchOnBoot};
Name: calltohandler; Description: {cm:CalltoHandler};
Name: telhandler; Description: {cm:TelHandler}; Flags: unchecked;

[CustomMessages]
en.FullInstallation=Full installation
Expand All @@ -59,6 +62,7 @@ en.MainFiles=Fop2DD program files (required)
en.LanguageFiles_Dutch=Dutch language files
en.LaunchOnBoot=Set Fop2DD to launch when Windows boots
en.CalltoHandler=Set Fop2DD to handle callto: links
en.TelHandler=Set Fop2DD to handle tel: links
en.UnInstall=Uninstall Fop2DD

nl.FullInstallation=Volledige installatie
Expand All @@ -67,6 +71,7 @@ nl.MainFiles=Fop2DD programma bestanden (vereist)
nl.LanguageFiles_Dutch=Nederlandse taalbestanden
nl.LaunchOnBoot=Stel Fop2DD in om te starten wanneer Windows opstart
nl.CalltoHandler=Stel Fop2DD in om callto: links af te handelen
nl.TelHandler=Stel Fop2DD in om tel: links af te handelen
nl.UnInstall=Fop2DD Verwijderen

[Registry]
Expand All @@ -77,6 +82,11 @@ Root: HKCR; Subkey: "callto"; ValueType: string; ValueName: "
Root: HKCR; Subkey: "callto\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\Fop2DD.exe,1"; Flags: uninsdeletevalue; Tasks: CalltoHandler;
Root: HKCR; Subkey: "callto\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\Fop2DD.exe"" ""%1"""; Flags: uninsdeletevalue; Tasks: CalltoHandler;

Root: HKCR; Subkey: "tel"; ValueType: string; ValueName: ""; ValueData: "URL:Callto Protocol"; Flags: uninsdeletevalue; Tasks: TelHandler;
Root: HKCR; Subkey: "tel"; ValueType: string; ValueName: "URL Protocol"; ValueData: ""; Flags: uninsdeletevalue; Tasks: TelHandler;
Root: HKCR; Subkey: "tel\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\Fop2DD.exe,1"; Flags: uninsdeletevalue; Tasks: TelHandler;
Root: HKCR; Subkey: "tel\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\Fop2DD.exe"" ""%1"""; Flags: uninsdeletevalue; Tasks: TelHandler;

[Run]
Filename: "{app}\Fop2DD.exe"; Flags: postinstall nowait;

Expand Down
17 changes: 17 additions & 0 deletions howto_release.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
For new releases the following needs to be done/checked:

Work is done on trunk. When a build is deemed ready for release we increase version numbers on the
projects that have been changed since the previous release (see step 1 and 2).

1) Increase versionnumber on Fop2ClientLib?
If so ->
Also change version in Fop2Client.shfbproj and recompile helpfile
Also change version in Fop2Client.nuspec and update releasenotes; build new nupkg and publish nupkg at nuget.org

2) Increase versionnumber on Fop2DDClient?
If so ->
Also increase versionnumbers in setup.iss, build new setup executable, publish executable at codeplex

3) When release is published, create a branch in sourcecontrol with the name of the release

4) Continue work on trunk

0 comments on commit 2e2696c

Please sign in to comment.