Skip to content

Commit

Permalink
PCL version
Browse files Browse the repository at this point in the history
  • Loading branch information
atifaziz committed Mar 11, 2016
1 parent b573e02 commit 51f5b98
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ bin/
*.cache
*.suo
obj/
obj.portable/
_ReSharper.*
*.orig
dist/
Expand Down
15 changes: 12 additions & 3 deletions NCrontab.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,21 @@
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
<projectUrl>https://github.com/atifaziz/NCrontab</projectUrl>
<tags>cron schedule time</tags>
<releaseNotes>Replaces uses of Converter with Func and therefore requires .NET Framework 3.5 as a minimum.</releaseNotes>
<releaseNotes>Replaces uses of Converter with Func and therefore requires .NET Framework 3.5 as a minimum.

This release also make the library available as a PCL for:
- Microsoft .NET Framework 4.5
- Microsoft Windows 8.0
- Microsoft Windows Phone 8.1
- Microsoft Windows Phone Silverlight 8.0</releaseNotes>
</metadata>
<files>
<file src="bin\Release\*" target="lib\net35" />
<file src="bin\Release\*" target="lib\net35-client" />
<file src="bin\Release\*" target="lib\net40-client" />
<file src="bin\Release\*" target="lib\net45" />
<file src="bin\Portable\Release\*" target="lib\portable-net45+netcore45+wpa81+wp8" />
<file src="COPYING.txt" target="COPYING.txt" />
<file src="*.cs" target="src" />
<file src="NCrontab\**\*.cs" target="src\NCrontab" />
<file src="NCrontab\**\*.cs" target="src\NCrontab" exclude="**\obj*\**\*.cs" />
</files>
</package>
8 changes: 7 additions & 1 deletion NCrontab.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
VisualStudioVersion = 14.0.24720.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A4109292-0FE5-4761-868A-31A5BEB1810A}"
ProjectSection(SolutionItems) = preProject
Expand All @@ -24,6 +24,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NCrontab.Tests", "NCrontab.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NCrontabViewer", "NCrontabViewer\NCrontabViewer.csproj", "{02F42DAC-8A9F-45BB-B734-BB08F0D194C4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NCrontab.Portable", "NCrontab\NCrontab.Portable.csproj", "{D8441CFB-E606-4304-8CA3-FD6E0FF1CD73}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -46,6 +48,10 @@ Global
{02F42DAC-8A9F-45BB-B734-BB08F0D194C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{02F42DAC-8A9F-45BB-B734-BB08F0D194C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{02F42DAC-8A9F-45BB-B734-BB08F0D194C4}.Release|Any CPU.Build.0 = Release|Any CPU
{D8441CFB-E606-4304-8CA3-FD6E0FF1CD73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D8441CFB-E606-4304-8CA3-FD6E0FF1CD73}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D8441CFB-E606-4304-8CA3-FD6E0FF1CD73}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D8441CFB-E606-4304-8CA3-FD6E0FF1CD73}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
11 changes: 2 additions & 9 deletions NCrontab/CrontabException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@

namespace NCrontab
{
#region Imports

using System;
using System.Runtime.Serialization;

#endregion
// ReSharper disable once PartialTypeWithSinglePart

[ Serializable ]
public class CrontabException : Exception
public partial class CrontabException : Exception
{
public CrontabException() :
base("Crontab error.") {} // TODO: Fix message and add it to resource.
Expand All @@ -37,8 +33,5 @@ public CrontabException(string message) :

public CrontabException(string message, Exception innerException) :
base(message, innerException) {}

protected CrontabException(SerializationInfo info, StreamingContext context) :
base(info, context) {}
}
}
5 changes: 3 additions & 2 deletions NCrontab/CrontabField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ namespace NCrontab
/// Represents a single crontab field.
/// </summary>

[ Serializable ]
public sealed class CrontabField : ICrontabField
// ReSharper disable once PartialTypeWithSinglePart

public sealed partial class CrontabField : ICrontabField
{
readonly BitArray _bits;
/* readonly */ int _minValueSet;
Expand Down
8 changes: 3 additions & 5 deletions NCrontab/CrontabFieldImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ namespace NCrontab
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Runtime.Serialization;
using Debug = System.Diagnostics.Debug;

#endregion

public delegate T CrontabFieldAccumulator<T>(int start, int end, int interval, T successs, Func<ExceptionProvider, T> onError);

[ Serializable ]
public sealed class CrontabFieldImpl : IObjectReference
// ReSharper disable once PartialTypeWithSinglePart

public sealed partial class CrontabFieldImpl
{
public static readonly CrontabFieldImpl Second = new CrontabFieldImpl(CrontabFieldKind.Second, 0, 59, null);
public static readonly CrontabFieldImpl Minute = new CrontabFieldImpl(CrontabFieldKind.Minute, 0, 59, null);
Expand Down Expand Up @@ -298,7 +298,5 @@ int ParseValue(string str)
var names = string.Join(", ", _names);
throw new CrontabException($"'{str}' is not a known value name. Use one of the following: {names}.");
}

object IObjectReference.GetRealObject(StreamingContext context) => FromKind(Kind);
}
}
3 changes: 0 additions & 3 deletions NCrontab/CrontabFieldKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@

namespace NCrontab
{
using System;

[ Serializable ]
public enum CrontabFieldKind
{
Second = 0, // Keep in order of appearance in expression
Expand Down
10 changes: 6 additions & 4 deletions NCrontab/CrontabSchedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ namespace NCrontab
/// Represents a schedule initialized from the crontab expression.
/// </summary>

[ Serializable ]
public sealed class CrontabSchedule
// ReSharper disable once PartialTypeWithSinglePart

public sealed partial class CrontabSchedule
{
readonly CrontabField _seconds;
readonly CrontabField _minutes;
Expand All @@ -45,8 +46,9 @@ public sealed class CrontabSchedule

static readonly CrontabField SecondZero = CrontabField.Seconds("0");

[Serializable]
public sealed class ParseOptions
// ReSharper disable once PartialTypeWithSinglePart

public sealed partial class ParseOptions
{
public bool IncludingSeconds { get; set; }
}
Expand Down
74 changes: 74 additions & 0 deletions NCrontab/NCrontab.Portable.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D8441CFB-E606-4304-8CA3-FD6E0FF1CD73}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NCrontab</RootNamespace>
<AssemblyName>NCrontab</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<IntermediateOutputPath>obj.portable\$(Configuration)</IntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin\Portable\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Portable\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<Compile Include="AssemblyInfo.cs" />
<Compile Include="AssemblyInfo.g.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>AssemblyInfo.g.tt</DependentUpon>
</Compile>
<Compile Include="CrontabException.cs" />
<Compile Include="CrontabField.cs" />
<Compile Include="CrontabFieldImpl.cs" />
<Compile Include="CrontabFieldKind.cs" />
<Compile Include="CrontabSchedule.cs" />
<Compile Include="ErrorHandling.cs" />
<Compile Include="ICrontabField.cs" />
<Compile Include="StringSeparatorStock.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="AssemblyInfo.g.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>AssemblyInfo.g.cs</LastGenOutput>
</Content>
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
3 changes: 1 addition & 2 deletions NCrontab/NCrontab.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SolutionInfo.cs">
Expand Down Expand Up @@ -130,6 +128,7 @@
<Compile Include="ICrontabField.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Serialization.cs" />
<Compile Include="StringSeparatorStock.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
47 changes: 47 additions & 0 deletions NCrontab/Serialization.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#region License and Terms
//
// NCrontab - Crontab for .NET
// Copyright (c) 2008 Atif Aziz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion

namespace NCrontab
{
using System;
using System.Runtime.Serialization;

[Serializable]
partial class CrontabException
{
protected CrontabException(SerializationInfo info, StreamingContext context) :
base(info, context) {}
}

[Serializable]
partial class CrontabField {}

[Serializable]
partial class CrontabSchedule
{
[Serializable]
partial class ParseOptions {}
}

[Serializable]
partial class CrontabFieldImpl : IObjectReference
{
object IObjectReference.GetRealObject(StreamingContext context) => FromKind(Kind);
}
}

0 comments on commit 51f5b98

Please sign in to comment.