Exemple #1
0
 void newIndexer_OnSaveConfigurationRequested(IndexerInterface indexer, JToken obj)
 {
     var configFilePath = GetIndexerConfigFilePath(indexer);
     if (!Directory.Exists(IndexerConfigDirectory))
         Directory.CreateDirectory(IndexerConfigDirectory);
     File.WriteAllText(configFilePath, obj.ToString());
 }
Exemple #2
0
 void newIndexer_OnResultParsingError(IndexerInterface indexer, string results, Exception ex)
 {
     var fileName = string.Format("Error on {0} for {1}.txt", DateTime.Now.ToString("yyyyMMddHHmmss"), indexer.DisplayName);
     var spacing = string.Join("", Enumerable.Repeat(Environment.NewLine, 5));
     var fileContents = string.Format("{0}{1}{2}", ex, spacing, results);
     File.WriteAllText(Path.Combine(Program.AppConfigDirectory, fileName), fileContents);
 }
Exemple #3
0
        void newIndexer_OnResultParsingError(IndexerInterface indexer, string results, Exception ex)
        {
            var fileName     = string.Format("Error on {0} for {1}.txt", DateTime.Now.ToString("yyyyMMddHHmmss"), indexer.DisplayName);
            var spacing      = string.Join("", Enumerable.Repeat(Environment.NewLine, 5));
            var fileContents = string.Format("{0}{1}{2}", ex, spacing, results);

            File.WriteAllText(Path.Combine(Program.AppConfigDirectory, fileName), fileContents);
        }
Exemple #4
0
        void newIndexer_OnSaveConfigurationRequested(IndexerInterface indexer, JToken obj)
        {
            var configFilePath = GetIndexerConfigFilePath(indexer);

            if (!Directory.Exists(IndexerConfigDirectory))
            {
                Directory.CreateDirectory(IndexerConfigDirectory);
            }
            File.WriteAllText(configFilePath, obj.ToString());
        }
Exemple #5
0
        public void SettingExpectationOnIndexer()
        {
            MockRepository   mocks   = new MockRepository();
            IndexerInterface indexer = (IndexerInterface)mocks.StrictMock(typeof(IndexerInterface));

            Expect.On(indexer).Call(indexer["1"]).Return("First");
            mocks.ReplayAll();
            Assert.Equal("First", indexer["1"]);
            mocks.VerifyAll();
        }
Exemple #6
0
        public async Task TestIndexer(IndexerInterface indexer)
        {
            var browseQuery = new TorznabQuery();
            var results     = await indexer.PerformQuery(browseQuery);

            Program.LoggerInstance.Debug(string.Format("Found {0} releases from {1}", results.Length, indexer.DisplayName));
            if (results.Length == 0)
            {
                throw new Exception("Found no results while trying to browse this tracker");
            }
        }
Exemple #7
0
        public void SettingExpectationOnIndexer()
        {
            IndexerInterface indexer = MockRepository.Mock <IndexerInterface>();

            indexer.Expect(x => x["1"])
            .Return("First");

            Assert.Equal("First", indexer["1"]);

            indexer.VerifyAllExpectations();
        }
        public void Indexer2()
        {
            IndexerInterface proxy = (IndexerInterface)
                                     _generator.CreateProxy(typeof(IndexerInterface),
                                                            new StandardInterceptor(), new IndexerClass());

            Assert.IsNotNull(proxy);

            string dummy = proxy["1"];

            dummy = proxy[1];
        }
Exemple #9
0
        public void SettingExpectationOnIndexer()
        {
            IndexerInterface indexer = MockRepository.Mock <IndexerInterface>();

            indexer.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);

            indexer.Expect(x => x["1"])
            .Return("First");

            Assert.Equal("First", indexer["1"]);

            indexer.VerifyAllExpectations();
        }
Exemple #10
0
        void LoadIndexer(Type indexerType)
        {
            var name = indexerType.Name.Trim().ToLower();

            if (Indexers.ContainsKey(name))
            {
                return;
            }

            IndexerInterface newIndexer = (IndexerInterface)Activator.CreateInstance(indexerType);

            newIndexer.OnSaveConfigurationRequested += newIndexer_OnSaveConfigurationRequested;
            newIndexer.OnResultParsingError         += newIndexer_OnResultParsingError;

            var configFilePath = GetIndexerConfigFilePath(newIndexer);

            if (File.Exists(configFilePath))
            {
                var jsonString = JObject.Parse(File.ReadAllText(configFilePath));
                newIndexer.LoadFromSavedConfiguration(jsonString);
            }

            Indexers.Add(name, newIndexer);
        }
Exemple #11
0
 string GetIndexerConfigFilePath(IndexerInterface indexer)
 {
     return(Path.Combine(IndexerConfigDirectory, indexer.GetType().Name.ToLower() + ".json"));
 }
	public static int test() {
		var obj = new IndexerInterface();
		return obj.method();
	}
Exemple #13
0
    public static int test()
    {
        var obj = new IndexerInterface();

        return(obj.method());
    }
Exemple #14
0
        public async Task TestIndexer(IndexerInterface indexer)
        {
            var browseQuery = new TorznabQuery();
            var results = await indexer.PerformQuery(browseQuery);
            Program.LoggerInstance.Debug(string.Format("Found {0} releases from {1}", results.Length, indexer.DisplayName));
            if (results.Length == 0)
                throw new Exception("Found no results while trying to browse this tracker");

        }
Exemple #15
0
 string GetIndexerConfigFilePath(IndexerInterface indexer)
 {
     return Path.Combine(IndexerConfigDirectory, indexer.GetType().Name.ToLower() + ".json");
 }