<commit_before>/**
 *  LocalNotification.cs
 *  Cordova LocalNotification Plugin
 *
 *  Created by <NAME> (github.com/katzer) on 07/10/2013.
 *  Copyright 2013 <NAME>. All rights reserved.
 *  GPL v2 licensed
 */

using System;
using System.Linq;

using Microsoft.Phone.Shell;

using WPCordovaClassLib.Cordova;
using WPCordovaClassLib.Cordova.Commands;
using WPCordovaClassLib.Cordova.JSON;

using De.APPPlant.Cordova.Plugin.LocalNotification;

namespace Cordova.Extension.Commands
{
    /// <summary>
    /// Implementes access to application live tiles
    /// http://msdn.microsoft.com/en-us/library/hh202948(v=VS.92).aspx
    /// </summary>
    public class LocalNotification : BaseCommand
    {
        /// <summary>
        /// Sets application live tile
        /// </summary>
        public void add (string jsonArgs)
        {
            string[] args                    = JsonHelper.Deserialize<string[]>(jsonArgs);
            LocalNotificationOptions options = JsonHelper.Deserialize<LocalNotificationOptions>(args[0]);
            // Application Tile is always the first Tile, even if it is not pinned to Start.
            ShellTile AppTile                = ShellTile.ActiveTiles.First();

            if (AppTile != null)
            {
                // Set the properties to update for the Application Tile
                // Empty strings for the text values and URIs will result in the property being cleared.
                StandardTileData TileData = CreateTileData(options);

                // Update the Application Tile
                AppTile.Update(TileData);

                if (!string.IsNullOrEmpty(options.Foreground))
                {
                    string arguments = String.Format("{0}({1})", options.Foreground, options.ID);

                    DispatchCommandResult(new PluginResult(PluginResult.Status.OK, arguments));
                }
            }

            DispatchCommandResult();
        }

        /// <summary>
        /// Clears the application live tile
        /// </summary>
        public void cancel (string jsonArgs)
        {
            cancelAll(jsonArgs);
        }

        /// <summary>
        /// Clears the application live tile
        /// </summary>
        public void cancelAll (string jsonArgs)
        {
            // Application Tile is always the first Tile, even if it is not pinned to Start.
            ShellTile AppTile = ShellTile.ActiveTiles.First();

            if (AppTile != null)
            {
                // Set the properties to update for the Application Tile
                // Empty strings for the text values and URIs will result in the property being cleared.
                StandardTileData TileData = new StandardTileData
                {
                    BackTitle   = "",
                    BackContent = ""
                };

                // Update the Application Tile
                AppTile.Update(TileData);
            }

            DispatchCommandResult();
        }

        /// <summary>
        /// Creates tile data
        /// </summary>
        private StandardTileData CreateTileData (LocalNotificationOptions options)
        {
            StandardTileData tile = new StandardTileData();

            // Badge sollte nur gelöscht werden, wenn expliziet eine `0` angegeben wurde
            if (options.Badge != 0)
            {
                tile.Count = options.Badge;
            }

            tile.Title       = options.Title;
            tile.BackContent = options.Message;

            return tile;
        }
    }
}<commit_msg>Now it looks better ...<commit_after>/**
 *  LocalNotification.cs
 *  Cordova LocalNotification Plugin
 *
 *  Created by <NAME> (github.com/katzer) on 07/10/2013.
 *  Copyright 2013 <NAME>. All rights reserved.
 *  GPL v2 licensed
 */

using System;
using System.Linq;

using Microsoft.Phone.Shell;

using WPCordovaClassLib.Cordova;
using WPCordovaClassLib.Cordova.Commands;
using WPCordovaClassLib.Cordova.JSON;

using De.APPPlant.Cordova.Plugin.LocalNotification;

namespace Cordova.Extension.Commands
{
    /// <summary>
    /// Implementes access to application live tiles
    /// http://msdn.microsoft.com/en-us/library/hh202948(v=VS.92).aspx
    /// </summary>
    public class LocalNotification : BaseCommand
    {
        /// <summary>
        /// Sets application live tile
        /// </summary>
        public void add (string jsonArgs)
        {
            string[] args                    = JsonHelper.Deserialize<string[]>(jsonArgs);
            LocalNotificationOptions options = JsonHelper.Deserialize<LocalNotificationOptions>(args[0]);
            // Application Tile is always the first Tile, even if it is not pinned to Start.
            ShellTile AppTile                = ShellTile.ActiveTiles.First();

            if (AppTile != null)
            {
                // Set the properties to update for the Application Tile
                // Empty strings for the text values and URIs will result in the property being cleared.
                StandardTileData TileData = CreateTileData(options);

                // Update the Application Tile
                AppTile.Update(TileData);

                if (!string.IsNullOrEmpty(options.Foreground))
                {
                    string arguments = String.Format("{0}({1})", options.Foreground, options.ID);

                    DispatchCommandResult(new PluginResult(PluginResult.Status.OK, arguments));
                }
            }

            DispatchCommandResult();
        }

        /// <summary>
        /// Clears the application live tile
        /// </summary>
        public void cancel (string jsonArgs)
        {
            cancelAll(jsonArgs);
        }

        /// <summary>
        /// Clears the application live tile
        /// </summary>
        public void cancelAll (string jsonArgs)
        {
            // Application Tile is always the first Tile, even if it is not pinned to Start.
            ShellTile AppTile = ShellTile.ActiveTiles.First();

            if (AppTile != null)
            {
                // Set the properties to update for the Application Tile
                // Empty strings for the text values and URIs will result in the property being cleared.
                StandardTileData TileData = new StandardTileData
                {
                    BackTitle   = "",
                    BackContent = ""
                };

                // Update the Application Tile
                AppTile.Update(TileData);
            }

            DispatchCommandResult();
        }

        /// <summary>
        /// Creates tile data
        /// </summary>
        private StandardTileData CreateTileData (LocalNotificationOptions options)
        {
            StandardTileData tile = new StandardTileData();

            // Badge sollte nur gelöscht werden, wenn expliziet eine `0` angegeben wurde
            if (options.Badge != 0)
            {
                tile.Count = options.Badge;
            }

            tile.BackTitle   = options.Title;
            tile.BackContent = options.Message;

            return tile;
        }
    }
}
{'fraction_non_alphanumeric': 0.08932065977075762, 'fraction_numerical': 0.00726866088901314, 'mean_word_length': 1.6343888070692194, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '942883', 'n_tokens_mistral': 1844, 'n_tokens_neox': 1726, 'n_words': 500}