Example #1
0
 public FrmHubList(LiveClient client, DcProvider dcProvider)
 {
     Icon        = Resources.livedc;
     _client     = client;
     _dcProvider = dcProvider;
     InitializeComponent();
 }
Example #2
0
        public TorrentProvider(LiveClient client)
        {
            _client = client;

            if (_client.Settings.AssocTorrentFiles)
            {
                string programName;
                string programPath;

                WindowsHelper.GetProgramAssociatedWithExt(false, ".torrent", out programName, out programPath);

                if (programPath != Application.ExecutablePath)
                {
                    WindowsHelper.RegisterExtension(false, "LiveDC", ".torrent");
                }

                WindowsHelper.GetProgramAssociatedWithExt(true, ".torrent", out programName, out programPath);

                if (programPath != Application.ExecutablePath && VistaSecurity.IsAdmin())
                {
                    WindowsHelper.RegisterExtension(true, "LiveDC", ".torrent");
                }

                NativeMethods.SHChangeNotify(HChangeNotifyEventID.SHCNE_ASSOCCHANGED, HChangeNotifyFlags.SHCNF_IDLIST, IntPtr.Zero, IntPtr.Zero);
            }
        }
Example #3
0
        /// <summary>
        ///     コンストラクタ
        /// </summary>
        /// <param name="clientId">Client ID (ライブラリには含まれまていません)</param>
        /// <param name="clientSecret">Client Secret (ライブラリには含まれていません)</param>
        public PixivClient(string clientId, string clientSecret)
        {
            ClientId     = clientId;
            ClientSecret = clientSecret;

            // 2018/03/30
            _httpClient = new HttpClient();
            _httpClient.DefaultRequestHeaders.Add("App-OS-Version", OsVersion);
            _httpClient.DefaultRequestHeaders.Add("App-OS", "ios");
            _httpClient.DefaultRequestHeaders.Add("App-Version", AppVersion);
            _httpClient.DefaultRequestHeaders.Add("User-Agent", $"PixivIOSApp/{AppVersion} (iOS {OsVersion}; iPhone9,2)");

            // Initialize accesors
            Application    = new ApplicationInfoClient(this);
            Authentication = new AuthenticationClient(this);
            Illust         = new IllustClient(this);
            IllustSeries   = new IllustSeriesClient(this);
            Live           = new LiveClient(this);
            Manga          = new MangaClient(this);
            Mute           = new MuteClient(this);
            Notification   = new NotificationClient(this);
            Novel          = new NovelClient(this);
            Search         = new SearchClient(this);
            Spotlight      = new SpotlightClient(this);
            TrendingTags   = new TrendingTagsClient(this);
            User           = new UserClient(this);
            Walkthrough    = new WalkthroughClient(this);
            File           = new FileClient(this);
        }
Example #4
0
 public MainViewModel()
 {
     client = new LiveClient();
     client.NewFrameRecived    += Client_NewFrameRecived;
     FilterStatus               = Status.All;
     LocalDataBase              = new DataBase();
     LocalDataBase.DataUpdated += LocalDataBase_DataUpdated;
 }
        public static void Run()
        {
            m_liveClient = new LiveClient(m_sHost, m_iPort, false, string.Empty, null);

            m_bRunning = true;

            ThreadHelper.RunThread(READER_THREAD_NAME, ReaderThread, ThreadPriority.BelowNormal);
            ThreadHelper.RunThread(WORKER_THREAD_NAME, WorkerThread, ThreadPriority.BelowNormal);
        }
Example #6
0
        public static void Initialize()
        {
            Image.Client = new Image.MemoryCacheClient(new Image.HttpClient(new System.Net.Http.HttpClient()), 20);

            var live = new LiveClient();

            live.StartAsync("ws://192.168.2.45:81");
            Development.Current = live;
        }
Example #7
0
 public DcProvider(Settings settings, LiveClient client)
 {
     _client  = client;
     Settings = settings;
     if (Settings.AssocMagnetLinks)
     {
         if (!WindowsHelper.IsMagnetHandlerAssigned)
         {
             WindowsHelper.RegisterMagnetHandler();
         }
     }
 }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            loginButton.Click += loginButton_Click;
            registerButton.Click += loginButton_Click;

            OAuthClient = new LiveClient(PortalId, Mode);

            loginItem.Visible = (Mode == AuthMode.Login);
            registerItem.Visible = (Mode == AuthMode.Register);
        }
Example #9
0
        public static void Run()
        {
            m_liveClient = new LiveClient(m_sHost, m_iPort, false, string.Empty, null);

            m_bRunning = true;

            ThreadHelper.RunThread(READER_THREAD_NAME, ReaderThread, ThreadPriority.BelowNormal);
            ThreadHelper.RunThread(WORKER_THREAD_NAME, WorkerThread, ThreadPriority.BelowNormal);
            if (ConfigurationManager.AppSettings["betradar_xml_files"] != null)
            {
                ThreadHelper.RunThread(CLEANER_THREAD_NAME, CleanerThread, ThreadPriority.BelowNormal);
            }
        }
Example #10
0
        public void AuthenticateThreadMethod()
        {
            try
            {
                LiveClient client = null;
                BinaryMessageEncodingBindingElement binaryMessageEncoding = new BinaryMessageEncodingBindingElement()
                {
                    ReaderQuotas = new XmlDictionaryReaderQuotas()
                    {
                        MaxStringContentLength = int.MaxValue,
                        MaxBytesPerRead        = int.MaxValue,
                        MaxDepth       = int.MaxValue,
                        MaxArrayLength = int.MaxValue
                    }
                };

                HttpTransportBindingElement httpTransport = new HttpsTransportBindingElement()
                {
                    MaxBufferSize          = int.MaxValue,
                    MaxReceivedMessageSize = int.MaxValue,
                    AllowCookies           = false,
                };

                client = new LiveClient(new CustomBinding(binaryMessageEncoding, httpTransport), new EndpointAddress("https://api.groundspeak.com/LiveV6/Geocaching.svc/Silverlightsoap"));
                var req = new GetYourUserProfileRequest();
                req.AccessToken = this.Token;
                req.DeviceInfo  = new DeviceData()
                {
                    DeviceName                 = "GAPPChatService",
                    DeviceUniqueId             = "internal",
                    ApplicationSoftwareVersion = "V1.0.0.0"
                };

                var resp = client.GetYourUserProfile(req);
                if (resp.Status.StatusCode == 0)
                {
                    GeocachingComUserProfile = resp.Profile;
                }
                client.Close();
            }
            catch
            {
                GeocachingComUserProfile = null;
            }
            //_authenticateThread = null;
            _authentificationChecked = true;
            if (AuthentificationFinished != null && !_closed)
            {
                AuthentificationFinished(this, EventArgs.Empty);
            }
        }
    /****************************************************************************************************/
    private void CreateSaveGUI()
    {
        EditorGUILayout.BeginVertical("Box");         //Root layout group
        {
            EditorGUILayout.LabelField("Step 3: Save Your Character Setup File and Apply it to Character", titleStyle);
            EditorGUILayout.BeginHorizontal(); //Save as button region
            {
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Save and Apply to Character...", GUILayout.Width(496)))
                {
                    if (currentCharSetupFile != null)
                    {
                        if (currentCharSetupFile.rootObject != null)
                        {
                            LiveClient liveScript = currentCharSetupFile.rootObject.GetComponent <LiveClient>();

                            if (liveScript == null)
                            {
                                liveScript = currentCharSetupFile.rootObject.AddComponent <LiveClient>();
                                liveScript.ExpressionSetFile = currentCharSetupFile;
                            }
                            else
                            {
                                liveScript.ExpressionSetFile = currentCharSetupFile;
                            }

                            Selection.activeGameObject = currentCharSetupFile.rootObject;

                            EditorUtility.SetDirty(currentCharSetupFile);
                            AssetDatabase.SaveAssets();
                        }
                        else
                        {
                            EditorUtility.DisplayDialog("Character Setup Error", "Please click 'Get Controls From Selected Object' with your character selected at least once before attempting to apply!", "Ok");
                        }
                    }
                    else
                    {
                        ShowNoSetupFileMsg();
                    }
                }
                GUILayout.FlexibleSpace();
            }
            EditorGUILayout.EndHorizontal(); //End save as button region
        }
        CreateSpace(1);
        EditorGUILayout.EndVertical();
        CreateSpace(1);
    }
Example #12
0
        public FrmNotify(LiveClient client)
        {
            _client = client;
            InitializeComponent();

            NativeImageList.LargeExtensionImageLoaded += NativeImageListLargeExtensionImageLoaded;

            timer1.Tick    += Timer1Tick;
            timer1.Interval = 1000;
            timer1.Start();

            Activated += FrmNotify_Activated;

            label1.Text = "LiveDC " + Assembly.GetExecutingAssembly().GetName().Version.ToString(3);
        }
Example #13
0
    void OnEnable()
    {
        titleStyle                  = new GUIStyle();
        titleStyle.fontStyle        = FontStyle.Bold;
        titleStyle.fontSize         = 12;
        titleStyle.margin           = new RectOffset(5, 0, 6, 6);
        titleStyle.normal.textColor = new Color(0.7f, 0.7f, 0.7f);

        FwLive = (LiveClient)target;

        // Faceware Icon
        string iconPath = Utility.CombinePath("Assets", "Faceware", "Scripts", "Editor", "Icons");

        titleIcon = ( Texture )AssetDatabase.LoadAssetAtPath(Path.Combine(iconPath, "LiveClient_DeviceHeader.png"), typeof(Texture));
    }
Example #14
0
 public TimerViewModel(LiveClient liveClient, LapViewModel bestLap, IEnumerable <TrackSectorViewModel> trackSectors, GeolocatorFactory geolocatorFactory, ICamera camera, Dispatcher dispatcher)
 {
     Dispatcher        = dispatcher;
     LapCount          = 1;
     CurrentLapTime    = TimeSpan.Zero;
     CurrentLapStatus  = TimeSpan.Zero;
     GpsStatusText     = AppResources.Text_Unit_InternalGps;
     Laps              = new ObservableCollection <LapViewModel>();
     this.trackSectors = trackSectors;
     bestLapSectors    = new Dictionary <int, TimeSpan?>();
     SetBestLapSectorsFromLap(bestLap);
     this.geolocatorFactory = geolocatorFactory;
     this.camera            = camera;
     lapTimer = new LapTimer(geolocatorFactory, App.ViewModel.Settings.IsMetricUnits);
     lapTimer.GeolocatorStatusChanged      += lapTimer_GeolocatorStatusChanged;
     lapTimer.GeolocatorUnrecoverableError += lapTimer_GeolocatorUnrecoverableError;
 }
Example #15
0
        public void StartRecord()
        {
            var num = 0;

            Client = new LiveClient(RoomId);
            if (!Client.ConnectAsync().GetAwaiter().GetResult())
            {
                LogHelper.Error("Cannot connect to danmaku server.");
                return;
            }

            StillLive                     = true;
            Client.GotGiftEvent          += GotGiftEvent;
            Client.GotDanmuEvent         += GotDanmakuEvent;
            Client.SocketDisconnectEvent += client =>
            {
                if (StillLive)
                {
                    client.ConnectAsync().GetAwaiter().GetResult();
                }
            };
            Client.LiveStoppedEvent += client =>
            {
                StillLive = false;
                client.CloseConnect();
                LiveStoppedEvent?.Invoke(this);
            };
            new Thread(() =>
            {
                while (true)
                {
                    Thread.Sleep(10000);
                    if (!CacheManager.Manager.LastCheckLiveBStatus[Vtuber].AreLive)
                    {
                        StillLive = false;
                        Client.CloseConnect();
                        LiveStoppedEvent?.Invoke(this);
                        break;
                    }
                }
            }).Start();
        }
    void OnEnable()
    {
        titleStyle           = new GUIStyle();
        titleStyle.fontStyle = FontStyle.Bold;
        titleStyle.fontSize  = 12;
        titleStyle.margin    = new RectOffset(5, 0, 6, 6);

        FwLive = (LiveClient)target;

        // Faceware Icon
        string iconPath = Utility.CombinePath("Assets", "Faceware", "Scripts", "Editor", "Icons");

        titleIcon = ( Texture )AssetDatabase.LoadAssetAtPath(Path.Combine(iconPath, "LiveClient_DeviceHeader.png"), typeof(Texture));

        warningStyle                  = new GUIStyle();
        warningStyle.fontStyle        = FontStyle.Bold;
        warningStyle.normal.textColor = Color.red;
        warningStyle.wordWrap         = true;
        warningStyle.alignment        = TextAnchor.MiddleCenter;
    }
Example #17
0
        public DcHubManager(DcProvider provider, LiveClient client)
        {
            _provider = provider;
            _client   = client;

            _provider.Engine.Hubs.HubAdded       += HubsHubAdded;
            _provider.Engine.Hubs.HubRemoved     += HubsHubRemoved;
            _provider.Engine.ActiveStatusChanged += EngineActiveStatusChanged;

            if (!string.IsNullOrEmpty(Settings.Hubs))
            {
                var hubs = Settings.Hubs.Split(new[] { ";" }, StringSplitOptions.RemoveEmptyEntries);

                foreach (var hubAddress in hubs.Take(5))
                {
                    _allHubs.Add(hubAddress);
                    AddHub(hubAddress);
                }
            }
        }
Example #18
0
        public FrmSearch(LiveClient client, DcProvider dcProvider)
        {
            _client     = client;
            _dcProvider = dcProvider;
            InitializeComponent();

            _comparer = new SourceComparer();

            SourcesColumn.HeaderCell.SortGlyphDirection = SortOrder.Descending;

            NativeImageList.LargeExtensionImageLoaded += NativeImageListLargeExtensionImageLoaded;

            _dcProvider.Engine.SearchManager.SearchStarted += SearchManagerSearchStarted;
            _dcProvider.Engine.SearchManager.SearchResult  += SearchManagerSearchResult;

            if (!SearchProvidersLoaded)
            {
                LoadSearchProviders(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Plugins"));
            }

            IntPtr h = tabControl1.Handle;

            foreach (var webSearchProvider in _providers)
            {
                var tab       = new TabPage(webSearchProvider.TabTitle);
                var flowPanel = new FlowLayoutPanel();
                tab.Controls.Add(flowPanel);
                flowPanel.Dock       = DockStyle.Fill;
                flowPanel.Padding    = new Padding(0, 0, SystemInformation.VerticalScrollBarWidth, 0);
                flowPanel.BackColor  = SystemColors.Window;
                flowPanel.AutoScroll = true;
                tab.Tag = webSearchProvider;
                tabControl1.TabPages.Insert(0, tab);
            }
            tabControl1.SelectTab(0);

            Disposed += FrmSearch_Disposed;
        }
Example #19
0
 public MirrorProvider(LiveClient client)
 {
     _client = client;
 }
Example #20
0
        public void MainLogic()
        {
            WXService wxs         = new WXService();
            JObject   init_result = wxs.WxInit(); //初始化

            List <object> contact_all = new List <object>();

            if (init_result != null)
            {
                _me                 = new WXUser();
                _me.UserName        = init_result["User"]["UserName"].ToString();
                _me.City            = "";
                _me.HeadImgUrl      = init_result["User"]["HeadImgUrl"].ToString();
                _me.NickName        = init_result["User"]["NickName"].ToString();
                _me.Province        = "";
                _me.PYQuanPin       = init_result["User"]["PYQuanPin"].ToString();
                _me.RemarkName      = init_result["User"]["RemarkName"].ToString();
                _me.RemarkPYQuanPin = init_result["User"]["RemarkPYQuanPin"].ToString();
                _me.Sex             = init_result["User"]["Sex"].ToString();
                _me.Signature       = init_result["User"]["Signature"].ToString();

                foreach (JObject contact in init_result["ContactList"])  //部分好友名单
                {
                    WXUser user = new WXUser();
                    user.UserName        = contact["UserName"].ToString();
                    user.City            = contact["City"].ToString();
                    user.HeadImgUrl      = contact["HeadImgUrl"].ToString();
                    user.NickName        = contact["NickName"].ToString();
                    user.Province        = contact["Province"].ToString();
                    user.PYQuanPin       = contact["PYQuanPin"].ToString();
                    user.RemarkName      = contact["RemarkName"].ToString();
                    user.RemarkPYQuanPin = contact["RemarkPYQuanPin"].ToString();
                    user.Sex             = contact["Sex"].ToString();
                    user.Signature       = contact["Signature"].ToString();

                    _contact_latest.Add(user);
                }
            }

            JObject contact_result = wxs.GetContact(); //通讯录

            if (contact_result != null)
            {
                foreach (JObject contact in contact_result["MemberList"])  //完整好友名单
                {
                    WXUser user = new WXUser();
                    user.UserName        = contact["UserName"].ToString();
                    user.City            = contact["City"].ToString();
                    user.HeadImgUrl      = contact["HeadImgUrl"].ToString();
                    user.NickName        = contact["NickName"].ToString();
                    user.Province        = contact["Province"].ToString();
                    user.PYQuanPin       = contact["PYQuanPin"].ToString();
                    user.RemarkName      = contact["RemarkName"].ToString();
                    user.RemarkPYQuanPin = contact["RemarkPYQuanPin"].ToString();
                    user.Sex             = contact["Sex"].ToString();
                    user.Signature       = contact["Signature"].ToString();

                    contact_all.Add(user);
                }
            }
            IOrderedEnumerable <object> list_all = contact_all.OrderBy(e => (e as WXUser).ShowPinYin);

            WXUser wx; string start_char;

            foreach (object o in list_all)
            {
                wx         = o as WXUser;
                start_char = wx.ShowPinYin == "" ? "" : wx.ShowPinYin.Substring(0, 1);
                if (!_contact_all.Contains(start_char.ToUpper()))
                {
                    _contact_all.Add(start_char.ToUpper());
                }
                _contact_all.Add(o);
            }


            JObject sync_flag;
            JObject sync_result;

            while (true)
            {
                sync_flag = wxs.WxSyncCheck();  //同步检查
                if (sync_flag == null)
                {
                    continue;
                }
                else if (sync_flag["retcode"].ToString() != "0")
                {
                    return;
                }
                //这里应该判断 sync_flag中selector的值
                else //有消息
                {
                    sync_result = wxs.WxSync();  //进行同步
                    if (sync_result != null)
                    {
                        if (sync_result["AddMsgCount"] != null && sync_result["AddMsgCount"].ToString() != "0")
                        {
                            Console.WriteLine(System.DateTime.Now.ToString() + sync_result["AddMsgCount"].ToString() + " Msg(s) Received");
                            foreach (JObject m in sync_result["AddMsgList"])
                            {
                                LiveClient.PrintData(m.ToString());
                                LiveClient.PrintData(",\n");
                            }
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                System.Threading.Thread.Sleep(10);
            }
        }
Example #21
0
 public static void WriteToClient(string msg, LiveClient targetClient)
 {
     byte[] msgBytes = Encoding.ASCII.GetBytes(msg);
     targetClient.NetStream.Write(msgBytes, 0, msgBytes.Length);
 }
Example #22
0
 public HttpProvider(LiveClient client)
 {
     _client = client;
 }
Example #23
0
 public AutoUpdateManager(LiveClient client)
 {
     _client = client;
 }
Example #24
0
        public void AuthenticateThreadMethod()
        {
            try
            {
                LiveClient client = null;
                BinaryMessageEncodingBindingElement binaryMessageEncoding = new BinaryMessageEncodingBindingElement()
                {
                    ReaderQuotas = new XmlDictionaryReaderQuotas()
                    {
                        MaxStringContentLength = int.MaxValue,
                        MaxBytesPerRead = int.MaxValue,
                        MaxDepth = int.MaxValue,
                        MaxArrayLength = int.MaxValue
                    }
                };

                HttpTransportBindingElement httpTransport = new HttpsTransportBindingElement()
                {
                    MaxBufferSize = int.MaxValue,
                    MaxReceivedMessageSize = int.MaxValue,
                    AllowCookies = false,
                };

                client = new LiveClient(new CustomBinding(binaryMessageEncoding, httpTransport), new EndpointAddress("https://api.groundspeak.com/LiveV6/Geocaching.svc/Silverlightsoap"));
                var req = new GetYourUserProfileRequest();
                req.AccessToken = this.Token;
                req.DeviceInfo = new DeviceData()
                            {
                                DeviceName = "GAPPChatService",
                                DeviceUniqueId = "internal",
                                ApplicationSoftwareVersion = "V1.0.0.0"
                            };

                var resp = client.GetYourUserProfile(req);
                if (resp.Status.StatusCode == 0)
                {
                    GeocachingComUserProfile = resp.Profile;
                }
                client.Close();
            }
            catch
            {
                GeocachingComUserProfile = null;
            }
            //_authenticateThread = null;
            _authentificationChecked = true;
            if (AuthentificationFinished != null && !_closed)
            {
                AuthentificationFinished(this, EventArgs.Empty);
            }
        }
 /// <summary>
 /// Initializes a new instance of the login form with a specified OAuth client.
 /// </summary>
 /// <param name="client">Instance of the OAuth client.</param>
 /// <param name="autoLogout">Disables saving and restoring authorization cookies in WebBrowser. Default: false.</param>
 /// <param name="loadUserInfo">Indicates the need to make a request for recive the user profile or not. Default: false.</param>
 /// <param name="responseType">Allows to set the type of response that is expected from the server. Default: <see cref="ResponseType.Token"/>.</param>
 public LiveLogin(LiveClient client, bool autoLogout = false, bool loadUserInfo = false, string responseType = "token") : base(client, autoLogout, loadUserInfo, responseType)
 {
     this.Width  = 700;
     this.Height = 650;
     this.Icon   = Properties.Resources.live;
 }
Example #26
0
 public FrmSettings(LiveClient client)
 {
     _client = client;
     InitializeComponent();
 }