diff --git a/.gitignore b/.gitignore index 77fd30e..d13c477 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,173 @@ -_Resharper* -*.resharper* +################# +## Customer +################# +_ReSharper* +TestResults + +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + + +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.vspscc +.builds +*.dotCover + +## TODO: If you have NuGet Package Restore enabled, uncomment this +packages/ + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf + +# Visual Studio profiler +*.psess +*.vsp + +# ReSharper is a .NET coding add-in +_ReSharper* + +# Installshield output folder +[Ee]xpress + + +#azure +*.PublishSettings + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish + +# Others +[Bb]in +[Oo]bj +sql +TestResults +*.Cache +ClientBin +stylecop.* +~$* +*.dbmdl +Generated_Code #added for RIA/Silverlight projects + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML + + + +############ +## Windows +############ + +# Windows image file caches +Thumbs.db + +# Folder config file +Desktop.ini + + +############# +## Python +############# + +*.py[co] + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts bin -obj +var +sdist +develop-eggs +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg + +# Mac crap +.DS_Store diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config new file mode 100644 index 0000000..67f8ea0 --- /dev/null +++ b/.nuget/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.nuget/NuGet.exe b/.nuget/NuGet.exe new file mode 100644 index 0000000..8f61340 Binary files /dev/null and b/.nuget/NuGet.exe differ diff --git a/.nuget/NuGet.targets b/.nuget/NuGet.targets new file mode 100644 index 0000000..83fe906 --- /dev/null +++ b/.nuget/NuGet.targets @@ -0,0 +1,136 @@ + + + + $(MSBuildProjectDirectory)\..\ + + + false + + + false + + + true + + + false + + + + + + + + + + + $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) + $([System.IO.Path]::Combine($(ProjectDir), "packages.config")) + + + + + $(SolutionDir).nuget + packages.config + + + + + $(NuGetToolsPath)\NuGet.exe + @(PackageSource) + + "$(NuGetExePath)" + mono --runtime=v4.0.30319 $(NuGetExePath) + + $(TargetDir.Trim('\\')) + + -RequireConsent + -NonInteractive + + "$(SolutionDir) " + "$(SolutionDir)" + + + $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) + $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols + + + + RestorePackages; + $(BuildDependsOn); + + + + + $(BuildDependsOn); + BuildPackage; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CronNET.sln b/CronNET.sln index 3d79796..c421a8b 100755 --- a/CronNET.sln +++ b/CronNET.sln @@ -1,10 +1,19 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C# Express 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CronNET", "CronNET\CronNET.csproj", "{F31D7AF3-FDFA-44F1-9C63-305BAF11D002}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CronNETTests", "CronNETTests\CronNETTests.csproj", "{6FCFBDF4-ECB7-4FC2-A376-E962B11D487D}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{EA4722C9-7FD3-4D8C-BA24-AAAFC5E52EAC}" + ProjectSection(SolutionItems) = preProject + .nuget\NuGet.Config = .nuget\NuGet.Config + .nuget\NuGet.exe = .nuget\NuGet.exe + .nuget\NuGet.targets = .nuget\NuGet.targets + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/CronNET.suo b/CronNET.suo deleted file mode 100644 index 62e9cad..0000000 Binary files a/CronNET.suo and /dev/null differ diff --git a/CronNET.v12.suo b/CronNET.v12.suo new file mode 100644 index 0000000..48ab0dd Binary files /dev/null and b/CronNET.v12.suo differ diff --git a/CronNET/CronDaemon.cs b/CronNET/CronDaemon.cs index fdc0f53..ae612fd 100755 --- a/CronNET/CronDaemon.cs +++ b/CronNET/CronDaemon.cs @@ -5,10 +5,17 @@ using System.Threading; namespace CronNET { - public class CronDaemon + public interface ICronDaemon + { + void AddJob(string schedule, ThreadStart action); + void Start(); + void Stop(); + } + + public class CronDaemon : ICronDaemon { private readonly System.Timers.Timer timer = new System.Timers.Timer(30000); - private readonly List cron_jobs = new List(); + private readonly List cron_jobs = new List(); private DateTime _last= DateTime.Now; public CronDaemon() @@ -41,7 +48,7 @@ namespace CronNET if (DateTime.Now.Minute != _last.Minute) { _last = DateTime.Now; - foreach (CronJob job in cron_jobs) + foreach (ICronJob job in cron_jobs) job.execute(DateTime.Now); } } diff --git a/CronNET/CronJob.cs b/CronNET/CronJob.cs index a98c416..97f2b05 100755 --- a/CronNET/CronJob.cs +++ b/CronNET/CronJob.cs @@ -3,9 +3,15 @@ using System.Threading; namespace CronNET { - public class CronJob + public interface ICronJob { - private readonly CronSchedule _cron_schedule = new CronSchedule(); + void execute(DateTime date_time); + void abort(); + } + + public class CronJob : ICronJob + { + private readonly ICronSchedule _cron_schedule = new CronSchedule(); private readonly ThreadStart _thread_start; private Thread _thread; diff --git a/CronNET/CronSchedule.cs b/CronNET/CronSchedule.cs index 23ddc6f..5b6dfb6 100755 --- a/CronNET/CronSchedule.cs +++ b/CronNET/CronSchedule.cs @@ -4,7 +4,13 @@ using System.Text.RegularExpressions; namespace CronNET { - public class CronSchedule + public interface ICronSchedule + { + bool isValid(string expression); + bool isTime(DateTime date_time); + } + + public class CronSchedule : ICronSchedule { #region Readonly Class Members diff --git a/CronNET/Properties/AssemblyInfo.cs b/CronNET/Properties/AssemblyInfo.cs index 46d110f..5154305 100755 --- a/CronNET/Properties/AssemblyInfo.cs +++ b/CronNET/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.0.1")] +[assembly: AssemblyFileVersion("1.0.0.1")] diff --git a/CronNETTests/CronNETTests.csproj b/CronNETTests/CronNETTests.csproj index f7b9711..c4c8dd0 100755 --- a/CronNETTests/CronNETTests.csproj +++ b/CronNETTests/CronNETTests.csproj @@ -31,6 +31,8 @@ false false true + ..\ + true true @@ -50,9 +52,8 @@ 4 - - False - C:\Program Files (x86)\NUnit 2.5.10\bin\net-2.0\framework\nunit.framework.dll + + ..\packages\NUnit.2.6.3\lib\nunit.framework.dll @@ -90,7 +91,11 @@ true + + + +