void newIndexer_OnSaveConfigurationRequested(IndexerInterface indexer, JToken obj) { var configFilePath = GetIndexerConfigFilePath(indexer); if (!Directory.Exists(IndexerConfigDirectory)) Directory.CreateDirectory(IndexerConfigDirectory); File.WriteAllText(configFilePath, obj.ToString()); }
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); }
void newIndexer_OnSaveConfigurationRequested(IndexerInterface indexer, JToken obj) { var configFilePath = GetIndexerConfigFilePath(indexer); if (!Directory.Exists(IndexerConfigDirectory)) { Directory.CreateDirectory(IndexerConfigDirectory); } File.WriteAllText(configFilePath, obj.ToString()); }
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(); }
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"); } }
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]; }
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(); }
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); }
string GetIndexerConfigFilePath(IndexerInterface indexer) { return(Path.Combine(IndexerConfigDirectory, indexer.GetType().Name.ToLower() + ".json")); }
public static int test() { var obj = new IndexerInterface(); return obj.method(); }
public static int test() { var obj = new IndexerInterface(); return(obj.method()); }
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"); }
string GetIndexerConfigFilePath(IndexerInterface indexer) { return Path.Combine(IndexerConfigDirectory, indexer.GetType().Name.ToLower() + ".json"); }