예제 #1
0
 /// <summary>
 /// Exports information of all the devices that are using Push to an Azure Blob
 /// Storage
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='properties'>
 /// Export configurations.
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ExportStartedResult> ExportDevicesAsync(this IPush operations, ExportConfig properties, string ownerName, string appName, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ExportDevicesWithHttpMessagesAsync(properties, ownerName, appName, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
예제 #2
0
 /// <summary>
 /// Get list of notifications
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 /// <param name='top'>
 /// The maximum number of results to return. (0 will fetch all results)
 /// </param>
 /// <param name='skiptoken'>
 /// The value identifies a starting point in the collection of entities. This
 /// parameter along with limit is used to perform pagination.
 /// </param>
 /// <param name='orderby'>
 /// controls the sorting order and sorting based on which column
 /// </param>
 /// <param name='inlinecount'>
 /// Controls whether or not to include a count of all the items across all
 /// pages. Possible values include: 'allpages', 'none'
 /// </param>
 /// <param name='includeArchived'>
 /// Include arhived push notifications
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <NotificationsListResult> ListAsync(this IPush operations, string ownerName, string appName, long?top = 30, string skiptoken = default(string), string orderby = "count desc", string inlinecount = default(string), bool?includeArchived = default(bool?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ListWithHttpMessagesAsync(ownerName, appName, top, skiptoken, orderby, inlinecount, includeArchived, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
예제 #3
0
 /// <summary>
 /// Pushs the elements onto this collection, one by one.
 /// </summary>
 /// <typeparam name="TElement">The type of the elements in the collection.</typeparam>
 /// <param name="collection">This collection.</param>
 /// <param name="elements">The elements to push.</param>
 public static void Push <TElement>(this IPush <TElement> collection, ReadOnlySpan <TElement> elements)
 {
     for (Int32 i = 0; i < elements.Length; i++)
     {
         collection.Push(elements[i]);
     }
 }
예제 #4
0
 /// <summary>
 /// Get configuration.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <NotificationConfigResult> GetConfigAsync(this IPush operations, string ownerName, string appName, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetConfigWithHttpMessagesAsync(ownerName, appName, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
예제 #5
0
 public static unsafe void Push <TElement>(this IPush <TElement> collection, TElement *elements, Int32 length) where TElement : unmanaged
 {
     for (Int32 i = 0; i < length; i++)
     {
         collection.Push(elements[i]);
     }
 }
예제 #6
0
        private async void btnPush_Click(object sender, RoutedEventArgs e)
        {
            ((Button)sender).IsEnabled = false;
            this.Cursor = Cursors.Wait;
            try
            {
                await Task.Run(() => {
                    var type   = typeof(MainWindow).Assembly.GetType($"RePushOrder.Impls.{_model.Channel}");
                    IPush push = (IPush)Activator.CreateInstance(type);
                    push.Push(_model.Content, _model.Url);
                });

                MessageBox.Show(this, "推送成功!");
            }
            catch (Exception ex)
            {
                var err = ex;
                while (err.InnerException != null)
                {
                    err = err.InnerException;
                }
                MessageBox.Show(this, err.Message);
            }
            finally
            {
                this.Cursor = null;
                ((Button)sender).IsEnabled = true;
            }
        }
예제 #7
0
 public MessagesController(IRepository <ads_messages> messagesRepo, IRepository <user> userRepo, IRepository <device_tokens> deviceTokenRepo, IPush push)
 {
     _messagesRepo     = messagesRepo;
     _deviceTokensRepo = deviceTokenRepo;
     _userRepo         = userRepo;
     _pushNotification = push;
 }
예제 #8
0
 /// <summary>
 /// Send notification.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='properties'>
 /// Notification specifications.
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <NotificationSendSucceededResult> SendAsync(this IPush operations, NotificationDefinition properties, string ownerName, string appName, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.SendWithHttpMessagesAsync(properties, ownerName, appName, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
예제 #9
0
    private void CheckForPushing(GameObject target)
    {
        IPush push = target.GetComponentInParent <IPush>();

        if (push != null)
        {
            (float pushStrength, PushTypes pushType) = push.Push();
            Push(pushStrength, pushType);
        }
    }
예제 #10
0
 /// <summary>
 /// Pushs the elements onto this collection, one by one.
 /// </summary>
 /// <typeparam name="TElement">The type of the elements in the collection.</typeparam>
 /// <typeparam name="TEnumerator">The type of the enumerator of the <paramref name="elements"/>.</typeparam>
 /// <param name="collection">This collection.</param>
 /// <param name="elements">The elements to push.</param>
 public static void Push <TElement, TEnumerator>(this IPush <TElement> collection, IGetEnumerator <TElement, TEnumerator>?elements) where TEnumerator : notnull, ICurrent <TElement>, IMoveNext
 {
     if (elements is not null)
     {
         foreach (TElement element in elements)
         {
             collection.Push(element);
         }
     }
 }
예제 #11
0
 /// <summary>
 /// Pushs the elements onto this collection, one by one.
 /// </summary>
 /// <typeparam name="TElement">The type of the elements in the collection.</typeparam>
 /// <param name="collection">This collection.</param>
 /// <param name="elements">The elements to push.</param>
 public static void Push <TElement>(this IPush <TElement> collection, Collections.Generic.IEnumerable <TElement>?elements)
 {
     if (elements is not null)
     {
         foreach (TElement element in elements)
         {
             collection.Push(element);
         }
     }
 }
예제 #12
0
        public chatHub(ILifetimeScope lifetimeScope)
        {
            // Create a lifetime scope for the hub.
            _hubLifetimeScope = lifetimeScope.BeginLifetimeScope();

            _messagesRepo            = _hubLifetimeScope.Resolve <IRepository <ads_messages> >();
            _userRepo                = _hubLifetimeScope.Resolve <IRepository <user> >();
            _deviceTokensRepo        = _hubLifetimeScope.Resolve <IRepository <device_tokens> >();
            _pushNotificationService = _hubLifetimeScope.Resolve <IPush>();
        }
예제 #13
0
    //-------------------------------------------------------------------------
    public Push()
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        mIPush = new AndroidPush();
#elif UNITY_IOS
        mIPush = new IOSPush();
#else
        //Debug.LogError("Do not supported on this platform. ");
#endif
    }
 public void Execute(object command, IPush executor)
 {
     try
     {
         executor.Push(command);
     }
     finally
     {
         _container.Release(executor);
     }
 }
예제 #15
0
 public BlogController(IRepository <blog> blogRepo, IRepository <blog_sections> blogSectionsRepo, IRepository <place> placeRepo,
                       IRepository <user> userRepo, IRepository <rating> rateRepo, IPush push, IRepository <device_tokens> deviceTokenRepo)
 {
     _blogRepo         = blogRepo;
     _blogSectionsRepo = blogSectionsRepo;
     _deviceTokensRepo = deviceTokenRepo;
     _placeRepo        = placeRepo;
     _userRepo         = userRepo;
     _rateRepo         = rateRepo;
     _pushNotification = push;
 }
 public ApiPushIntegration(Guid key, long configurationId, ApiConfigurationIdentifier configuration, IntegrationClientIdentifier integrationClient, IntegrationContractIdentifier integrationContract,
     IntegrationPackageIdentifier packages, ClientIdentifier client, IPush<ApiInitializePushCommand> pusher)
 {
     Key = key;
     ConfigurationId = configurationId;
     Configuration = configuration;
     IntegrationClient = integrationClient;
     IntegrationContract = integrationContract;
     Packages = packages;
     Client = client;
     Pusher = pusher;
 }
예제 #17
0
 public PushExecutor(string name)
 {
     IPushAdapter adapter = PushManager.PushAdapter;
     if (adapter == null)
     {
         Logger.Warn(Resources.Push_NotInitialized);
     }
     else
     {
         _instance = adapter.GetPushInstance(name);
     }
 }
예제 #18
0
        public PushExecutor(string name)
        {
            IPushAdapter adapter = PushManager.PushAdapter;

            if (adapter == null)
            {
                Logger.Warn(Resources.Push_NotInitialized);
            }
            else
            {
                _instance = adapter.GetPushInstance(name);
            }
        }
예제 #19
0
        private IContainer DoPush(IPush tag, IContainer parent, IValueStack stack)
        {
            Type type = null;

            if (!string.IsNullOrEmpty(tag.Type))
            {
                type = GetType().Assembly.GetType(tag.Type, false, true);
            }

            object expr = stack.Evaluate(tag.Value, type);

            stack.Push(tag.Id, expr);
            return(parent);
        }
예제 #20
0
    static void Main(string[] args)
    {
        // create a GenericStack<T> using the base type
        GenericStack <Car> carStack = new GenericStack <Car>();

        // convert to the contravariant interface
        IPush <VolvoC30> volvoPush = carStack;

        // push in a value via the contravariant inteface
        volvoPush.Push(new VolvoC30());

        // wait for input before exiting
        Console.WriteLine("Press enter to finish");
        Console.ReadLine();
    }
예제 #21
0
    protected void Awake()
    {
        if (m_Instance != null)
        {
            Destroy(gameObject);
            return;
        }
        m_Instance = this;
        DontDestroyOnLoad(this.gameObject);
#if UNITY_IOS
        __PushUnity3DBridge_init(this.gameObject.name, "OnCallBack");
#elif UNITY_ANDROID
        _androidPushManager.Call("init", this.gameObject.name, "OnCallBack");
#endif
    }
예제 #22
0
    protected void Awake()
    {
        if (m_Instance != null)
        {
            Destroy(gameObject);
            return;
        }
        m_Instance = this;
        DontDestroyOnLoad(this.gameObject);
        //Debug.LogError("=====Awake======"+ this.gameObject.name);
#if UNITY_IOS && !UNITY_EDITOR
        //__PushUnity3DBridge_init(this.gameObject.name, "OnCallBack");
#elif UNITY_ANDROID && !UNITY_EDITOR
        _androidPushManager.Call("init", this.gameObject.name, "OnCallBack");
#endif
    }
예제 #23
0
        /*
         * 为了确保用户发送的请求不被更改,我们设计了签名算法。该算法基本可以保证请求是合法者发送且参数没有被修改,但无法保证不被偷窥。 签名生成规则:
         * A)提取请求方法method(POST,全大写);
         * B)提取请求url信息,包括Host字段的域名(或ip:端口)和URI的path部分。注意不包括path的querystring。
         * 比如http://msg.umeng.com/api/send 或者 http://msg.umeng.com/api/status;
         * C)提取请求的post-body;
         * D)拼接请求方法、url、post-body及应用的app_master_secret;
         * E)将D形成字符串计算MD5值,形成一个32位的十六进制(字母小写)字符串,即为本次请求sign(签名)的值;
         * Sign=MD5($http_method$url$post-body$app_master_secret);
         */
        public static string GetSign(DeviceType type, string url, IPush postbody)
        {
            var app_master_secret = string.Empty;

            if (type == DeviceType.Andriod)
            {
                app_master_secret = "c02mxn27sntad8nr9am2dwd4ruddl4jf";
            }
            else if (type == DeviceType.IOS)
            {
                //57d0f6f8e0f55a1619000914
                //f1r4glcnnimzpfnqikdi5glntps8k1f7
                app_master_secret = "f1r4glcnnimzpfnqikdi5glntps8k1f7";
            }
            else if (type == DeviceType.IOS_APPStore)
            {
                app_master_secret = "6khvrxf6idmfwrythbjdo5rmwlcty0qq";
            }
            else if (type == DeviceType.Android_Center)
            {
                app_master_secret = "qnmiba5fthsf3eciqx6khxdxkomc136c";
            }
            ///易指控
            else if (type == DeviceType.YZK_IOS_APPStore)
            {
                app_master_secret = "xfldioemvvsewnkzcr45ge8s86knuihz";
            }

            if (!string.IsNullOrEmpty(app_master_secret))
            {
                var postbodyjson = JsonHelper <IPush> .GetJson(postbody);

                var sign = EncryptHelper.MD5Encoding("POST" + url + postbodyjson + app_master_secret);
                return(sign);
            }
            else
            {
                return(string.Empty);
            }
        }
예제 #24
0
 /// <summary>
 /// Get configuration.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 public static NotificationConfigResult GetConfig(this IPush operations, string ownerName, string appName)
 {
     return(operations.GetConfigAsync(ownerName, appName).GetAwaiter().GetResult());
 }
예제 #25
0
 /// <summary>
 /// Send notification.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='notificationIds'>
 /// List of notification ids
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 public static void Delete(this IPush operations, NotificationIdList notificationIds, string ownerName, string appName)
 {
     operations.DeleteAsync(notificationIds, ownerName, appName).GetAwaiter().GetResult();
 }
예제 #26
0
 /// <summary>
 /// Delete device/installId
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='installId'>
 /// device install id
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 public static void DeleteInstallId(this IPush operations, string installId, string ownerName, string appName)
 {
     operations.DeleteInstallIdAsync(installId, ownerName, appName).GetAwaiter().GetResult();
 }
예제 #27
0
 /// <summary>
 /// Delete device/installId
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='installId'>
 /// device install id
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeleteInstallIdAsync(this IPush operations, string installId, string ownerName, string appName, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.DeleteInstallIdWithHttpMessagesAsync(installId, ownerName, appName, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
예제 #28
0
 /// <summary>
 /// Get status of export operation.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='exportId'>
 /// The id of the export.
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 public static ExportStatusResult ExportDevicesStatus(this IPush operations, string exportId, string ownerName, string appName)
 {
     return(operations.ExportDevicesStatusAsync(exportId, ownerName, appName).GetAwaiter().GetResult());
 }
예제 #29
0
 /// <summary>
 /// Returns whether push config exists.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task ConfigExistsAsync(this IPush operations, string ownerName, string appName, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.ConfigExistsWithHttpMessagesAsync(ownerName, appName, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
예제 #30
0
        private IContainer DoPush(IPush tag, IContainer parent, IValueStack stack)
        {
            Type type = null;
            if (!string.IsNullOrEmpty(tag.Type))
                type = GetType().Assembly.GetType(tag.Type, false, true);

            object expr = stack.Evaluate(tag.Value, type);
            stack.Push(tag.Id, expr);
            return parent;
        }
예제 #31
0
 /// <summary>
 /// Returns whether push config exists.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 public static void ConfigExists(this IPush operations, string ownerName, string appName)
 {
     operations.ConfigExistsAsync(ownerName, appName).GetAwaiter().GetResult();
 }
예제 #32
0
 /// <summary>
 /// Exports information of all the devices that are using Push to an Azure Blob
 /// Storage
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='properties'>
 /// Export configurations.
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 public static ExportStartedResult ExportDevices(this IPush operations, ExportConfig properties, string ownerName, string appName)
 {
     return(operations.ExportDevicesAsync(properties, ownerName, appName).GetAwaiter().GetResult());
 }
예제 #33
0
 /// <summary>
 /// Send notification.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='notificationIds'>
 /// List of notification ids
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeleteAsync(this IPush operations, NotificationIdList notificationIds, string ownerName, string appName, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.DeleteWithHttpMessagesAsync(notificationIds, ownerName, appName, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
예제 #34
0
 /// <summary>
 /// Send notification.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='properties'>
 /// Notification specifications.
 /// </param>
 /// <param name='ownerName'>
 /// The name of the owner
 /// </param>
 /// <param name='appName'>
 /// The name of the application
 /// </param>
 public static NotificationSendSucceededResult Send(this IPush operations, NotificationDefinition properties, string ownerName, string appName)
 {
     return(operations.SendAsync(properties, ownerName, appName).GetAwaiter().GetResult());
 }