Exemplo n.º 1
0
        private async Task <IEnumerable <User> > GetLikeList(uint startIndex, int page)
        {
            UserListViewModel.UserList.NoMore();
            IsLoading = true;

            List <User> list = new List <User>();

            try
            {
                list = await PinApi.GetLikeList(Pin.pin_id, UserListViewModel.GetMaxID());

                if (list.Count == 0)
                {
                    UserListViewModel.UserList.NoMore();
                }
                else
                {
                    UserListViewModel.UserList.HasMore();
                }

                UserListViewModel.NotifyPropertyChanged("Count");
            }
            catch (Exception ex)
            {
                string a = ex.Message;
            }
            finally
            {
                IsLoading = false;
            }
            return(list);
        }
Exemplo n.º 2
0
        private async Task <IEnumerable <Board> > GetBoardList(uint startIndex, int page)
        {
            BoardListViewModel.BoardList.NoMore();
            IsLoading = true;

            List <Board> list = new List <Board>();

            try
            {
                list = await PinApi.GetRelatedBoards(Pin?.pin_id, BoardListViewModel.GetMaxSeq());

                if (list.Count == 0)
                {
                    BoardListViewModel.BoardList.NoMore();
                }
                else
                {
                    BoardListViewModel.BoardList.HasMore();
                }
                BoardListViewModel.NotifyPropertyChanged("Count");
            }
            catch (Exception ex)
            {
                string a = ex.Message;
            }
            finally
            {
                IsLoading = false;
            }
            return(list);
        }
Exemplo n.º 3
0
 public UserProcessor(UserSessionData user,
                      IHttpRequestProcessor httpRequestProcessor, IPinLogger logger,
                      UserAuthValidate userAuthValidate, PinApi pinapi, HttpHelper httpHelper)
 {
     _user = user;
     _httpRequestProcessor = httpRequestProcessor;
     _logger           = logger;
     _userAuthValidate = userAuthValidate;
     _httpHelper       = httpHelper;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Informs when the user has restarted the playback
        /// </summary>
        /// <param name="code">View code retrieved from the data call</param>
        /// <param name="pingTime">Elapsed ping time in seconds from the previous ping</param>
        /// <param name="bitrate">Current bitrate in bps (bits per second)</param>
        /// <param name="time">Video's current time in seconds.</param>
        /// <param name="complete">Complete Action</param>
        /// <param name="error">Error Action</param>
        public static void Pin(
            string code,
            string pingTime,
            double bitrate,
            double time,
            string nodeHost,
            string nodeType,
            Action <string> complete,
            Action <Exception> error)
        {
            var url = PinApi.Pin(Host, code, pingTime, bitrate, time, nodeHost, nodeType);

            ApiClient.Post(url, complete, error);
        }
Exemplo n.º 5
0
    public static string get_pin_auto()
    {
        string result = "";

        result = PinApi.feeds_by_sport_id("29");
        IWindow.write(result);
        Log.create_log_file(result);

        // string result = Log.get_temp_file("ps_detail.txt");
        PinData.insert_odds(result);

        AnalyseEngine.select_pin();
        AnalyseEngine.select_event();
        AnalyseEngine.select_odd();
        return("COMPUTE OK!");
    }
Exemplo n.º 6
0
 /// <summary>
 ///   Creates a new instance of the <see cref="IpfsEngine"/> class.
 /// </summary>
 public IpfsEngine()
 {
     // Init the core api inteface.
     Bitswap    = new BitswapApi(this);
     Block      = new BlockApi(this);
     Config     = new ConfigApi(this);
     Dag        = new DagApi(this);
     Dht        = new DhtApi(this);
     FileSystem = new FileSystemApi(this);
     Generic    = new GenericApi(this);
     Key        = new KeyApi(this);
     Name       = new NameApi(this);
     Object     = new ObjectApi(this);
     Pin        = new PinApi(this);
     PubSub     = new PubSubApi(this);
     Swarm      = new SwarmApi(this);
 }
Exemplo n.º 7
0
        private async Task <IEnumerable <Pin> > GetRecommendList(uint startIndex, int page)
        {
            RecommendListViewModel.PinList.NoMore();

            var list = new List <Pin>();

            if (Pin == null)
            {
                return(list);
            }
            IsLoading = true;
            try
            {
                list = await PinApi.GetRecommendList(Pin.pin_id, page);

                foreach (var item in list)
                {
                    item.Width = RecommendListViewModel.ColumnWidth;
                    if (item.file != null)
                    {
                        item.Height = ((RecommendListViewModel.ColumnWidth - 0.8) * item.file.height / item.file.width);
                    }
                }
                if (list.Count == 0)
                {
                    RecommendListViewModel.PinList.NoMore();
                }
                else
                {
                    RecommendListViewModel.PinList.HasMore();
                }
                RecommendListViewModel.NotifyPropertyChanged("Count");
                return(list);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                IsLoading = false;
            }
            return(null);
        }
Exemplo n.º 8
0
        public async override void OnNavigatedTo(HBNavigationEventArgs e)
        {
            var pin = e.Parameter as Pin;

            if (e.NavigationMode == NavigationMode.New)
            {
                if (pin?.pin_id != Pin?.pin_id)
                {
                    Pin = await PinApi.GetPin(pin.pin_id);

                    await RecommendListViewModel.PinList.LoadMoreItemsAsync(0);

                    await Task.Delay(500);

                    await RecommendListViewModel.PinList.LoadMoreItemsAsync(0);
                }

                PivotSelectedIndex = 0;
            }
        }
Exemplo n.º 9
0
        public IPinApi Build()
        {
            _requestMessage = new ApiRequestMessage
            {
                password          = _user?.Password,
                username_or_email = _user?.UserName,
            };


            if (_user == null)
            {
                _user = UserSessionData.Empty;
            }

            if (_httpHandler == null)
            {
                _httpHandler = new HttpClientHandler();
            }

            if (_httpClient == null)
            {
                _httpClient = new HttpClient(_httpHandler)
                {
                    BaseAddress = new Uri(PinApiConstants.URL_BASE)
                }
            }
            ;


            if (_httpRequestProcessor == null)
            {
                _httpRequestProcessor =
                    new HttpRequestProcessor(_delay, _httpClient, _httpHandler, _requestMessage, _logger);
            }



            var instaApi = new PinApi(_user, _logger, _httpRequestProcessor);

            return(instaApi);
        }
Exemplo n.º 10
0
        private async Task <IEnumerable <Pin> > GetData(uint startIndex, int page)
        {
            PinListViewModel.PinList.NoMore();

            if (string.IsNullOrEmpty(KeyWord))
            {
                return(new List <Pin>());
            }

            IsLoading = true;
            try
            {
                var list = await PinApi.Search(KeyWord, page);

                foreach (var item in list)
                {
                    item.Width = PinListViewModel.ColumnWidth;
                    if (item.file != null)
                    {
                        item.Height = ((PinListViewModel.ColumnWidth - 0.8) * item.file.height / item.file.width);
                    }
                }
                if (list.Count == 0)
                {
                    PinListViewModel.PinList.NoMore();
                }
                else
                {
                    PinListViewModel.PinList.HasMore();
                }
                return(list);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                IsLoading = false;
            }
            return(null);
        }
Exemplo n.º 11
0
        void Init()
        {
            // Init the core api inteface.
            Bitswap         = new BitswapApi(this);
            Block           = new BlockApi(this);
            BlockRepository = new BlockRepositoryApi(this);
            Bootstrap       = new BootstrapApi(this);
            Config          = new ConfigApi(this);
            Dag             = new DagApi(this);
            Dht             = new DhtApi(this);
            Dns             = new DnsApi(this);
            FileSystem      = new FileSystemApi(this);
            Generic         = new GenericApi(this);
            Key             = new KeyApi(this);
            Name            = new NameApi(this);
            Object          = new ObjectApi(this);
            Pin             = new PinApi(this);
            PubSub          = new PubSubApi(this);
            Stats           = new StatsApi(this);
            Swarm           = new SwarmApi(this);

            // Async properties
            LocalPeer = new AsyncLazy <Peer>(async() =>
            {
                log.Debug("Building local peer");
                var keyChain = await KeyChain().ConfigureAwait(false);
                log.Debug("Getting key info about self");
                var self      = await keyChain.FindKeyByNameAsync("self").ConfigureAwait(false);
                var localPeer = new Peer
                {
                    Id              = self.Id,
                    PublicKey       = await keyChain.GetPublicKeyAsync("self").ConfigureAwait(false),
                    ProtocolVersion = "ipfs/0.1.0"
                };
                var version            = typeof(IpfsEngine).GetTypeInfo().Assembly.GetName().Version;
                localPeer.AgentVersion = $"net-ipfs/{version.Major}.{version.Minor}.{version.Revision}";
                log.Debug("Built local peer");
                return(localPeer);
            });
            SwarmService = new AsyncLazy <Swarm>(async() =>
            {
                log.Debug("Building swarm service");
                if (Options.Swarm.PrivateNetworkKey == null)
                {
                    var path = Path.Combine(Options.Repository.Folder, "swarm.key");
                    if (File.Exists(path))
                    {
                        using (var x = File.OpenText(path))
                        {
                            Options.Swarm.PrivateNetworkKey = new PreSharedKey();
                            Options.Swarm.PrivateNetworkKey.Import(x);
                        }
                    }
                }
                var peer     = await LocalPeer.ConfigureAwait(false);
                var keyChain = await KeyChain().ConfigureAwait(false);
                var self     = await keyChain.GetPrivateKeyAsync("self").ConfigureAwait(false);
                var swarm    = new Swarm
                {
                    LocalPeer        = peer,
                    LocalPeerKey     = PeerTalk.Cryptography.Key.CreatePrivateKey(self),
                    NetworkProtector = Options.Swarm.PrivateNetworkKey == null
                        ? null
                        : new Psk1Protector {
                        Key = Options.Swarm.PrivateNetworkKey
                    }
                };
                if (Options.Swarm.PrivateNetworkKey != null)
                {
                    log.Debug($"Private network {Options.Swarm.PrivateNetworkKey.Fingerprint().ToHexString()}");
                }

                log.Debug("Built swarm service");
                return(swarm);
            });
            BitswapService = new AsyncLazy <BlockExchange.Bitswap>(async() =>
            {
                log.Debug("Building bitswap service");
                var bitswap = new BlockExchange.Bitswap
                {
                    Swarm        = await SwarmService.ConfigureAwait(false),
                    BlockService = Block
                };
                log.Debug("Built bitswap service");
                return(bitswap);
            });
            DhtService = new AsyncLazy <PeerTalk.Routing.Dht1>(async() =>
            {
                log.Debug("Building DHT service");
                var dht = new PeerTalk.Routing.Dht1
                {
                    Swarm = await SwarmService.ConfigureAwait(false)
                };
                dht.Swarm.Router = dht;
                log.Debug("Built DHT service");
                return(dht);
            });
            PubSubService = new AsyncLazy <PeerTalk.PubSub.NotificationService>(async() =>
            {
                log.Debug("Building PubSub service");
                var pubsub = new PeerTalk.PubSub.NotificationService
                {
                    LocalPeer = await LocalPeer.ConfigureAwait(false)
                };
                pubsub.Routers.Add(new PeerTalk.PubSub.FloodRouter
                {
                    Swarm = await SwarmService.ConfigureAwait(false)
                });
                log.Debug("Built PubSub service");
                return(pubsub);
            });
        }
Exemplo n.º 12
0
        void Init()
        {
            // Init the core api inteface.
            Bitswap    = new BitswapApi(this);
            Block      = new BlockApi(this);
            Bootstrap  = new BootstrapApi(this);
            Config     = new ConfigApi(this);
            Dag        = new DagApi(this);
            Dht        = new DhtApi(this);
            Dns        = new DnsApi(this);
            FileSystem = new FileSystemApi(this);
            Generic    = new GenericApi(this);
            Key        = new KeyApi(this);
            Name       = new NameApi(this);
            Object     = new ObjectApi(this);
            Pin        = new PinApi(this);
            PubSub     = new PubSubApi(this);
            Stats      = new StatsApi(this);
            Swarm      = new SwarmApi(this);

            // Async properties
            LocalPeer = new AsyncLazy <Peer>(async() =>
            {
                log.Debug("Building local peer");
                var keyChain = await KeyChain();
                log.Debug("Getting key info about self");
                var self                  = await keyChain.FindKeyByNameAsync("self");
                var localPeer             = new Peer();
                localPeer.Id              = self.Id;
                localPeer.PublicKey       = await keyChain.GetPublicKeyAsync("self");
                localPeer.ProtocolVersion = "ipfs/0.1.0";
                var version               = typeof(IpfsEngine).GetTypeInfo().Assembly.GetName().Version;
                localPeer.AgentVersion    = $"net-ipfs/{version.Major}.{version.Minor}.{version.Revision}";
                log.Debug("Built local peer");
                return(localPeer);
            });
            SwarmService = new AsyncLazy <Swarm>(async() =>
            {
                log.Debug("Building swarm service");
                var peer     = await LocalPeer;
                var keyChain = await KeyChain();
                var self     = await keyChain.GetPrivateKeyAsync("self");
                var swarm    = new Swarm
                {
                    LocalPeer    = peer,
                    LocalPeerKey = PeerTalk.Cryptography.Key.CreatePrivateKey(self)
                };
                log.Debug("Built swarm service");
                return(swarm);
            });
            BitswapService = new AsyncLazy <BlockExchange.Bitswap>(async() =>
            {
                log.Debug("Building bitswap service");
                var bitswap = new BlockExchange.Bitswap
                {
                    Swarm        = await SwarmService,
                    BlockService = Block
                };
                log.Debug("Built bitswap service");
                return(bitswap);
            });
            DhtService = new AsyncLazy <PeerTalk.Routing.Dht1>(async() =>
            {
                log.Debug("Building DHT service");
                var dht = new PeerTalk.Routing.Dht1
                {
                    Swarm = await SwarmService
                };
                dht.Swarm.Router = dht;
                log.Debug("Built DHT service");
                return(dht);
            });
        }
Exemplo n.º 13
0
 private void btn_get_html_Click(object sender, EventArgs e)
 {
     this.txt_result.Text = PinApi.leagues();
     //this.txt_result.Text = PinApi.feeds_by_sport_id("29");
 }