Skip to content

Commit

Permalink
First Commit by Arash
Browse files Browse the repository at this point in the history
  • Loading branch information
arashnorouzi committed Aug 9, 2011
0 parents commit a16c216
Show file tree
Hide file tree
Showing 42 changed files with 43,452 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Feedback.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;

namespace MoonAPNS
{
/// <summary>
/// Feedback object
/// </summary>
public class Feedback
{

/// <summary>
/// Constructor
/// </summary>
public Feedback()
{
this.DeviceToken = string.Empty;
this.Timestamp = DateTime.MinValue;
}

/// <summary>
/// Device Token string in hex form without any spaces or dashes
/// </summary>
public string DeviceToken
{
get;
set;
}

/// <summary>
/// Timestamp of the Feedback for when Apple received the notice to stop sending notifications to the device
/// </summary>
public DateTime Timestamp
{
get;
set;
}
}
}
53 changes: 53 additions & 0 deletions Logs/Push Notification/20110723.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

20110723 1827 - Info - Payload queue received.
20110723 1827 - Info - Connecting to apple server.
20110723 1827 - Info - Creating SSL connection.
20110723 1827 - Info - Conected.
20110723 1827 - Info - Payload generated for 498a47348b020a74fd30d6cc9ed4f7845d09ee447738b521a31cb3b267b5cc26 : {"aps":{"alert":"salam Arash!","badge":1,"sound":"default"},"RegionID":"IDQ10150"}
20110723 1827 - Info - Notification successfully sent to APNS server for Device Toekn : 498a47348b020a74fd30d6cc9ed4f7845d09ee447738b521a31cb3b267b5cc26
20110723 1827 - Info - Payload generated for 1bd0d35214f7da3c19496c29fb6de811ad3d652c66d6b2d2c05ace79046ec788 : {"aps":{"alert":"salam Arash!","badge":1,"sound":"default"},"RegionID":"IDQ10150"}
20110723 1827 - Info - Notification successfully sent to APNS server for Device Toekn : 1bd0d35214f7da3c19496c29fb6de811ad3d652c66d6b2d2c05ace79046ec788
20110723 1827 - Error - Apple rejected palyload for device token : 1bd0d35214f7da3c19496c29fb6de811ad3d652c66d6b2d2c05ace79046ec788
20110723 1827 - Error - Connection terminated by Apple.
20110723 1827 - Info - Connecting to apple server.
20110723 1827 - Info - Creating SSL connection.
20110723 1827 - Info - Conected.
20110723 1827 - Info - Payload generated for ee048ae0fca4b347a10724497235e004efe95fecc3c3b776c27a185b2f977895 : {"aps":{"alert":"salam Arash!","badge":1,"sound":"default"},"RegionID":"IDQ10150"}
20110723 1827 - Info - Notification successfully sent to APNS server for Device Toekn : ee048ae0fca4b347a10724497235e004efe95fecc3c3b776c27a185b2f977895
20110723 1827 - Info - Disconnected.
20110723 1827 - Error - An error occurred while reading Apple response for token 0 - Safe handle has been closed
20110723 1831 - Info - Payload queue received.
20110723 1831 - Info - Connecting to apple server.
20110723 1831 - Info - Creating SSL connection.
20110723 1831 - Info - Conected.
20110723 1831 - Info - Payload generated for 498a47348b020a74fd30d6cc9ed4f7845d09ee447738b521a31cb3b267b5cc26 : {"aps":{"alert":"salam Arash!","badge":1,"sound":"default"},"RegionID":"IDQ10150"}
20110723 1831 - Info - Notification successfully sent to APNS server for Device Toekn : 498a47348b020a74fd30d6cc9ed4f7845d09ee447738b521a31cb3b267b5cc26
20110723 1831 - Info - Payload generated for 1bd0d35214f7da3c19496c29fb6de811ad3d652c66d6b2d2c05ace79046ec788 : {"aps":{"alert":"salam Arash!","badge":1,"sound":"default"},"RegionID":"IDQ10150"}
20110723 1831 - Info - Notification successfully sent to APNS server for Device Toekn : 1bd0d35214f7da3c19496c29fb6de811ad3d652c66d6b2d2c05ace79046ec788
20110723 1831 - Error - Apple rejected palyload for device token : 1bd0d35214f7da3c19496c29fb6de811ad3d652c66d6b2d2c05ace79046ec788
20110723 1831 - Error - Connection terminated by Apple.
20110723 1832 - Info - Connecting to apple server.
20110723 1832 - Info - Creating SSL connection.
20110723 1832 - Info - Conected.
20110723 1832 - Info - Payload generated for ee048ae0fca4b347a10724497235e004efe95fecc3c3b776c27a185b2f977895 : {"aps":{"alert":"salam Arash!","badge":1,"sound":"default"},"RegionID":"IDQ10150"}
20110723 1832 - Info - Notification successfully sent to APNS server for Device Toekn : ee048ae0fca4b347a10724497235e004efe95fecc3c3b776c27a185b2f977895
20110723 1832 - Info - Disconnected.
20110723 1832 - Error - An error occurred while reading Apple response for token 0 - Safe handle has been closed
20110723 1849 - Info - Payload queue received.
20110723 1849 - Info - Connecting to apple server.
20110723 1849 - Info - Creating SSL connection.
20110723 1849 - Info - Conected.
20110723 1849 - Info - Payload generated for 498a47348b020a74fd30d6cc9ed4f7845d09ee447738b521a31cb3b267b5cc26 : {"aps":{"alert":"salam Arash!","badge":1,"sound":"default"},"RegionID":"IDQ10150"}
20110723 1849 - Info - Notification successfully sent to APNS server for Device Toekn : 498a47348b020a74fd30d6cc9ed4f7845d09ee447738b521a31cb3b267b5cc26
20110723 1849 - Info - Payload generated for 1bd0d35214f7da3c19496c29fb6de811ad3d652c66d6b2d2c05ace79046ec788 : {"aps":{"alert":"salam Arash!","badge":1,"sound":"default"},"RegionID":"IDQ10150"}
20110723 1849 - Info - Notification successfully sent to APNS server for Device Toekn : 1bd0d35214f7da3c19496c29fb6de811ad3d652c66d6b2d2c05ace79046ec788
20110723 1849 - Error - Apple rejected palyload for device token : 1bd0d35214f7da3c19496c29fb6de811ad3d652c66d6b2d2c05ace79046ec788
20110723 1849 - Error - Apple Error code : Invalid token
20110723 1849 - Error - Connection terminated by Apple.
20110723 1849 - Info - Connecting to apple server.
20110723 1849 - Info - Creating SSL connection.
20110723 1849 - Info - Conected.
20110723 1849 - Info - Payload generated for ee048ae0fca4b347a10724497235e004efe95fecc3c3b776c27a185b2f977895 : {"aps":{"alert":"salam Arash!","badge":1,"sound":"default"},"RegionID":"IDQ10150"}
20110723 1849 - Info - Notification successfully sent to APNS server for Device Toekn : ee048ae0fca4b347a10724497235e004efe95fecc3c3b776c27a185b2f977895
20110723 1849 - Info - Disconnected.
20110723 1849 - Error - An error occurred while reading Apple response for token 0 - Safe handle has been closed
21 changes: 21 additions & 0 deletions Logs/Push Notification/20110724.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
20110724 1928 - Info - Payload queue received.
20110724 1928 - Info - Connecting to apple server.
20110724 1928 - Info - Creating SSL connection.
20110724 1928 - Info - Conected.
20110724 1928 - Info - Payload generated for 498a47348b020a74fd30d6cc9ed4f7845d09ee447738b521a31cb3b267b5cc26 : {"aps":{"alert":"An updated weather forecast for Brisbane is available.","badge":1,"sound":"default"},"RegionID":"IDQ10095"}
20110724 1928 - Info - Notification successfully sent to APNS server for Device Toekn : 498a47348b020a74fd30d6cc9ed4f7845d09ee447738b521a31cb3b267b5cc26
20110724 1928 - Info - Disconnected.
20110724 2237 - Info - Payload queue received.
20110724 2239 - Info - Payload queue received.
20110724 2247 - Info - Payload queue received.
20110724 2321 - Info - Payload queue received.
20110724 2322 - Info - Payload queue received.
20110724 2327 - Info - Payload queue received.
20110724 2327 - Error - An error occurred while disconnecting. - Object reference not set to an instance of an object.
20110724 2330 - Info - Payload queue received.
20110724 2330 - Info - Connecting to apple server.
20110724 2330 - Info - Creating SSL connection.
20110724 2330 - Info - Conected.
20110724 2330 - Info - Payload generated for 498a47348b020a74fd30d6cc9ed4f7845d09ee447738b521a31cb3b267b5cc26 : {"aps":{"alert":"An updated weather forecast for Brisbane is available.","badge":1,"sound":"default"},"RegionID":"IDQ10095"}
20110724 2330 - Info - Notification successfully sent to APNS server for Device Toekn : 498a47348b020a74fd30d6cc9ed4f7845d09ee447738b521a31cb3b267b5cc26
20110724 2330 - Info - Disconnected.
113 changes: 113 additions & 0 deletions MoonAPNS.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{A91E03EF-6532-4896-89C4-9FCEC1D8D4DB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MoonAPNS</RootNamespace>
<AssemblyName>MoonAPNS</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.4.0.2\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog">
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Feedback.cs" />
<Compile Include="NotificationAlert.cs" />
<Compile Include="NotificationPayload.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PushNotification.cs" />
</ItemGroup>
<ItemGroup>
<None Include="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.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>
14 changes: 14 additions & 0 deletions MoonAPNS.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
<PublishUrlHistory>publish\</PublishUrlHistory>
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>
20 changes: 20 additions & 0 deletions MoonAPNS.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoonAPNS", "MoonAPNS.csproj", "{A91E03EF-6532-4896-89C4-9FCEC1D8D4DB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A91E03EF-6532-4896-89C4-9FCEC1D8D4DB}.Debug|x86.ActiveCfg = Debug|x86
{A91E03EF-6532-4896-89C4-9FCEC1D8D4DB}.Debug|x86.Build.0 = Debug|x86
{A91E03EF-6532-4896-89C4-9FCEC1D8D4DB}.Release|x86.ActiveCfg = Release|x86
{A91E03EF-6532-4896-89C4-9FCEC1D8D4DB}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file added MoonAPNS.suo
Binary file not shown.
14 changes: 14 additions & 0 deletions NLog.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<!-- make sure to set 'Copy To Output Directory' option for this file -->
<!-- go to http://nlog-project.org/wiki/Configuration_file for more information -->

<targets>
<target name="logfile" xsi:type="File" fileName="D:\MoonAPNS\MoonAPNS\MoonAPNS\Logs\Push Notification\${date:format=yyyyMMdd}.log" archiveEvery="Day" layout="${date:format=yyyyMMdd HHmm} - ${level} - ${message}" createDirs="true"/>
</targets>

<rules>
<logger name="*" minlevel="Info" writeTo="logfile"/>
</rules>
</nlog>
79 changes: 79 additions & 0 deletions NotificationAlert.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using System.Collections.Generic;

namespace MoonAPNS
{
/// <summary>
/// Alert Portion of the Notification Payload
/// </summary>
public class NotificationAlert
{
/// <summary>
/// Constructor
/// </summary>
public NotificationAlert()
{
Body = null;
ActionLocalizedKey = null;
LocalizedKey = null;
LocalizedArgs = new List<object>();
}

/// <summary>
/// Body Text of the Notification's Alert
/// </summary>
public string Body
{
get;
set;
}

/// <summary>
/// Action Button's Localized Key
/// </summary>
public string ActionLocalizedKey
{
get;
set;
}

/// <summary>
/// Localized Key
/// </summary>
public string LocalizedKey
{
get;
set;
}

/// <summary>
/// Localized Argument List
/// </summary>
public List<object> LocalizedArgs
{
get;
set;
}

public void AddLocalizedArgs(params object[] values)
{
this.LocalizedArgs.AddRange(values);
}

/// <summary>
/// Determines if the Alert is empty and should be excluded from the Notification Payload
/// </summary>
public bool IsEmpty
{
get
{
if (!string.IsNullOrEmpty(Body)
|| !string.IsNullOrEmpty(ActionLocalizedKey)
|| !string.IsNullOrEmpty(LocalizedKey)
|| (LocalizedArgs != null && LocalizedArgs.Count > 0))
return false;
else
return true;
}
}
}
}
Loading

0 comments on commit a16c216

Please sign in to comment.