public void RefreshImportFolders() { ImportFolders.Clear(); try { RepoFactory.ImportFolder.GetAll().ForEach(a => ImportFolders.Add(a)); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public void RefreshImportFolders() { ImportFolders.Clear(); if (!ServerOnline) { return; } try { ImportFolders = Instance.ShokoServices.GetImportFolders(); } catch (Exception ex) { BaseConfig.MyAnimeLog.Write("RefreshImportFolders: " + ex); } }
public void RefreshImportFolders() { ImportFolders.Clear(); if (!ServerOnline) { return; } try { List <JMMServerBinary.Contract_ImportFolder> importFolders = Instance.clientBinaryHTTP.GetImportFolders(); foreach (JMMServerBinary.Contract_ImportFolder ifolder in importFolders) { ImportFolderVM grpNew = new ImportFolderVM(ifolder); ImportFolders.Add(grpNew); } } catch (Exception ex) { BaseConfig.MyAnimeLog.Write("RefreshImportFolders: " + ex.ToString()); } }
public bool SetupClient() { ServerOnline = false; _shokoservices = null; ImportFolders.Clear(); if (!SettingsAreValid()) { return(false); } try { AnimePluginSettings settings = AnimePluginSettings.Instance; string url = string.Format(@"http://{0}:{1}/", settings.JMMServer_Address, settings.JMMServer_Port); BaseConfig.MyAnimeLog.Write("JMM Server URL: " + url); Dictionary <Type, Type> mappings = new Dictionary <Type, Type>(); //Mappings area. mappings.Add(typeof(CL_AniDB_Anime), typeof(VM_AniDB_Anime)); mappings.Add(typeof(CL_AniDB_Anime_DefaultImage), typeof(VM_AniDB_Anime_DefaultImage)); mappings.Add(typeof(CL_AniDB_AnimeCrossRefs), typeof(VM_AniDB_AnimeCrossRefs)); mappings.Add(typeof(CL_AnimeEpisode_User), typeof(VM_AnimeEpisode_User)); mappings.Add(typeof(CL_AnimeGroup_User), typeof(VM_AnimeGroup_User)); mappings.Add(typeof(CL_AnimeSeries_User), typeof(VM_AnimeSeries_User)); mappings.Add(typeof(CL_BookmarkedAnime), typeof(VM_BookmarkedAnime)); mappings.Add(typeof(CL_GroupFilter), typeof(VM_GroupFilter)); mappings.Add(typeof(MovieDB_Fanart), typeof(VM_MovieDB_Fanart)); mappings.Add(typeof(MovieDB_Poster), typeof(VM_MovieDB_Poster)); mappings.Add(typeof(CL_Recommendation), typeof(VM_Recommendation)); mappings.Add(typeof(Trakt_ImageFanart), typeof(VM_Trakt_ImageFanart)); mappings.Add(typeof(Trakt_ImagePoster), typeof(VM_Trakt_ImagePoster)); mappings.Add(typeof(TvDB_ImageFanart), typeof(VM_TvDB_ImageFanart)); mappings.Add(typeof(TvDB_ImagePoster), typeof(VM_TvDB_ImagePoster)); mappings.Add(typeof(TvDB_ImageWideBanner), typeof(VM_TvDB_ImageWideBanner)); mappings.Add(typeof(CL_VideoDetailed), typeof(VM_VideoDetailed)); mappings.Add(typeof(CL_VideoLocal), typeof(VM_VideoLocal)); _shokoservices = ClientFactory.Create <IShokoServer>( $"http://{settings.JMMServer_Address}:{settings.JMMServer_Port}/", mappings); // try connecting to see if the server is responding CL_ServerStatus status = Instance.ShokoServices.GetServerStatus(); ServerOnline = true; GetServerSettings(); RefreshImportFolders(); BaseConfig.MyAnimeLog.Write("JMM Server Status: " + status.GeneralQueueState); return(true); } catch (Exception ex) { //Utils.ShowErrorMessage(ex); BaseConfig.MyAnimeLog.Write(ex.ToString()); return(false); } }
public bool SetupBinaryClient() { ServerOnline = false; _clientBinaryHTTP = null; ImportFolders.Clear(); if (!SettingsAreValid()) { return(false); } try { AnimePluginSettings settings = new AnimePluginSettings(); string url = string.Format(@"http://{0}:{1}/JMMServerBinary", settings.JMMServer_Address, settings.JMMServer_Port); BaseConfig.MyAnimeLog.Write("JMM Server URL: " + url); BinaryMessageEncodingBindingElement encoding = new BinaryMessageEncodingBindingElement(); encoding.ReaderQuotas.MaxArrayLength = int.MaxValue; encoding.ReaderQuotas.MaxBytesPerRead = int.MaxValue; encoding.ReaderQuotas.MaxDepth = int.MaxValue; encoding.ReaderQuotas.MaxNameTableCharCount = int.MaxValue; encoding.ReaderQuotas.MaxStringContentLength = int.MaxValue; HttpTransportBindingElement transport = new HttpTransportBindingElement(); transport.MaxReceivedMessageSize = int.MaxValue; transport.MaxBufferPoolSize = int.MaxValue; transport.MaxBufferSize = int.MaxValue; transport.MaxReceivedMessageSize = int.MaxValue; Binding binding = new CustomBinding(encoding, transport); binding.SendTimeout = new TimeSpan(30, 0, 30); binding.ReceiveTimeout = new TimeSpan(30, 0, 30); binding.OpenTimeout = new TimeSpan(30, 0, 30); binding.CloseTimeout = new TimeSpan(30, 0, 30); EndpointAddress endpoint = new EndpointAddress(new Uri(url)); var factory = new ChannelFactory <JMMServerBinary.IJMMServerChannel>(binding, endpoint); foreach (OperationDescription op in factory.Endpoint.Contract.Operations) { var dataContractBehavior = op.Behaviors.Find <DataContractSerializerOperationBehavior>(); if (dataContractBehavior != null) { dataContractBehavior.MaxItemsInObjectGraph = int.MaxValue; } } _clientBinaryHTTP = factory.CreateChannel(); // try connecting to see if the server is responding JMMServerBinary.Contract_ServerStatus status = JMMServerVM.Instance.clientBinaryHTTP.GetServerStatus(); ServerOnline = true; GetServerSettings(); RefreshImportFolders(); BaseConfig.MyAnimeLog.Write("JMM Server Status: " + status.GeneralQueueState); return(true); } catch (Exception ex) { //Utils.ShowErrorMessage(ex); BaseConfig.MyAnimeLog.Write(ex.ToString()); return(false); } }