Ejemplo n.º 1
0
        public void TestSenderDate()
        {
            string file = @"AxisImportDbTests\TestData\36b9a4a6-5a25-4e40-b8e4-c3ebb427943b_20120301080529_Axis.xtf";

            DateTime?date = ImportFolders.ParseSenderDate(file);

            Assert.AreEqual(new DateTime(2012, 3, 1, 8, 5, 29), date);
        }
Ejemplo n.º 2
0
 public void RefreshImportFolders()
 {
     ImportFolders.Clear();
     try
     {
         RepoFactory.ImportFolder.GetAll().ForEach(a => ImportFolders.Add(a));
     }
     catch (Exception ex)
     {
         Utils.ShowErrorMessage(ex);
     }
 }
Ejemplo n.º 3
0
        //[Test]
        public void TestGetOldestFile()
        {
            List <string> files = new List <string>()
            {
                @"AxisImportDbTests\TestData\36b9a4a6-5a25-4e40-b8e4-c3ebb427943b_20120401172551_Axis.xtf",
                @"AxisImportDbTests\TestData\36b9a4a6-5a25-4e40-b8e4-c3ebb427943b_20120301080529_Axis.xtf",
                @"AxisImportDbTests\TestData\36b9a4a6-5a25-4e40-b8e4-c3ebb427943b_20120201110217_MbsInventory.xtf"
            };


            string oldest = ImportFolders.GetOldestFile(files);

            //Assert.AreEqual(oldest, @"AxisImportDbTests\TestData\36b9a4a6-5a25-4e40-b8e4-c3ebb427943b_20120301080529_Axis.xtf");
        }
Ejemplo n.º 4
0
        public void RefreshImportFolders()
        {
            ImportFolders.Clear();

            if (!ServerOnline)
            {
                return;
            }
            try
            {
                ImportFolders = Instance.ShokoServices.GetImportFolders();
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write("RefreshImportFolders: " + ex);
            }
        }
Ejemplo n.º 5
0
        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());
            }
        }
Ejemplo n.º 6
0
        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);
            }
        }
Ejemplo n.º 7
0
        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);
            }
        }