Пример #1
0
 public Overloard()
 {
     InitializeComponent();
     machine        = Retriever.GetMachine();
     timer          = new Timer(1000 * 15);
     timer.Elapsed += Timer_Elapsed;
 }
    public void Update_ClaimedStandardEvidence_Add_EndChain_Succeeds()
    {
      var contact = Retriever.GetAllContacts(_policy).First();
      var std = Retriever.GetAllStandards(_policy).First();
      var claim = Creator.GetStandardsApplicable(claimId: std.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);
      ClearClaimedStandard();
      _solnEx.ClaimedStandard.Add(claim);

      var contId = GetContact().Id;
      var evidencePrev = Creator.GetStandardsApplicableEvidence(claimId: claim.Id, createdById: contId);
      _solnEx.ClaimedStandardEvidence.Add(evidencePrev);
      _datastore.Update(_solnEx);
      var evidence = Creator.GetStandardsApplicableEvidence(prevId: evidencePrev.Id, claimId: claim.Id, createdById: contId);
      _solnEx.ClaimedStandardEvidence.Add(evidence);

      _datastore.Update(_solnEx);

      var retrievedSolnEx = _datastore.BySolution(_solnEx.Solution.Id);
      retrievedSolnEx.ClaimedStandardEvidence
        .Should().HaveCount(2)
        .And.Subject
        .Should().BeEquivalentTo(new[] { evidence, evidencePrev },
          opts => opts
            .Excluding(ent => ent.CreatedOn));
    }
Пример #3
0
        static void Main(string[] args)
        {
            var testCase = new List <string>
            {
                "L.LL.LL.LL",
                "LLLLLLL.LL",
                "L.L.L..L..",
                "LLLL.LL.LL",
                "L.LL.LL.LL",
                "L.LLLLL.LL",
                "..L.L.....",
                "LLLLLLLLLL",
                "L.LLLLLL.L",
                "L.LLLLL.LL"
            };

            Seat[,] testGrid = GridifyInput(testCase);

            var roundExecutorTest = new RoundExecutor(testGrid);

            Console.WriteLine(roundExecutorTest.GetEquilibriumOccupiedSeatCount());

            SeatGrid = GridifyInput(Retriever.Retrieve(@"..//..//..//Day11PuzzleInput.txt"));

            Console.WriteLine();

            Console.WriteLine("Part 1 Solution: ");
            var roundExecutor = new RoundExecutor(SeatGrid);

            Console.WriteLine(roundExecutor.GetEquilibriumOccupiedSeatCount());
        }
Пример #4
0
        /// <summary>
        /// Visitor implementation. Processes the passed element
        /// adding the member elements defined in the customization.
        /// </summary>
        /// <param name="element"></param>
        public override void Visit(VisitableElementComplexType element)
        {
            base.Visit(element);

            #region Add Members to Type declarations
            if (CurrentType != null)
            {
                ArrayList nodes = Retriever.RetrieveCustomization(
                    element, NodeType.Type);
                ParseNodes(nodes, element.Name);
            }
            #endregion

            #region Add Members to Collection declarations
            string name = element.Name + Configuration.CollectionNaming;
            foreach (CodeTypeDeclaration type in CurrentNamespace.Types)
            {
                if (type.Name == name)
                {
                    CurrentType = type;
                    break;
                }
            }

            if (CurrentType != null)
            {
                ArrayList nodes = Retriever.RetrieveCustomization(
                    element, NodeType.Collection);
                ParseNodes(nodes, element.Name);
            }
            #endregion
        }
    public void Update_ClaimedCapabilityReview_Add_EndChain_Succeeds()
    {
      var contact = Retriever.GetAllContacts(_policy).First();
      var cap = Retriever.GetAllCapabilities(_policy).First();
      var claim = Creator.GetCapabilitiesImplemented(claimId: cap.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);
      ClearClaimedCapability();
      _solnEx.ClaimedCapability.Add(claim);

      var contId = GetContact().Id;
      var evidence = Creator.GetCapabilitiesImplementedEvidence(claimId: claim.Id, createdById: contId);
      var reviewPrev = Creator.GetCapabilitiesImplementedReviews(evidenceId: evidence.Id, createdById: contId);
      _solnEx.ClaimedCapabilityEvidence.Add(evidence);
      _solnEx.ClaimedCapabilityReview.Add(reviewPrev);
      _datastore.Update(_solnEx);
      var review = Creator.GetCapabilitiesImplementedReviews(prevId: reviewPrev.Id, evidenceId: evidence.Id, createdById: contId);
      _solnEx.ClaimedCapabilityReview.Add(review);

      _datastore.Update(_solnEx);

      var retrievedSolnEx = _datastore.BySolution(_solnEx.Solution.Id);
      retrievedSolnEx.ClaimedCapabilityReview
        .Should().HaveCount(2)
        .And.Subject
        .Should().BeEquivalentTo(new[] { review, reviewPrev },
          opts => opts
            .Excluding(ent => ent.CreatedOn));
    }
Пример #6
0
        static void Main(string[] args)
        {
            var testInput = new List <string>
            {
                "mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X",
                "mem[8] = 11",
                "mem[7] = 101",
                "mem[8] = 0"
            };

            List <ICommand> testProgram     = ConvertToInitProgram(testInput);
            var             testInitialiser = new Initialiser(testProgram);

            testInitialiser.Part1Initialise();
            Console.WriteLine(testInitialiser.GetMemorySum());

            List <string> puzzleInput = Retriever.Retrieve(@"..//..//..//Day14PuzzleInput.txt");

            List <ICommand> initProgram = ConvertToInitProgram(puzzleInput);

            var initialiser = new Initialiser(initProgram);

            initialiser.Part1Initialise();
            Console.WriteLine(initialiser.GetMemorySum());
        }
        public void Update_ClaimedStandardReview_Remove_Chain_Succeeds()
        {
            var contact = Retriever.GetAllContacts(_policy).First();
            var std     = Retriever.GetAllStandards(_policy).First();
            var claim   = Creator.GetStandardsApplicable(claimId: std.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);

            ClearClaimedStandard();
            _solnEx.ClaimedStandard.Add(claim);

            var contId     = GetContact().Id;
            var evidence   = Creator.GetStandardsApplicableEvidence(claimId: claim.Id, createdById: contId);
            var reviewPrev = Creator.GetStandardsApplicableReviews(evidenceId: evidence.Id, createdById: contId);
            var review     = Creator.GetStandardsApplicableReviews(prevId: reviewPrev.Id, evidenceId: evidence.Id, createdById: contId);

            _solnEx.ClaimedStandardEvidence.Add(evidence);
            _solnEx.ClaimedStandardReview.Add(reviewPrev);
            _solnEx.ClaimedStandardReview.Add(review);
            _datastore.Update(_solnEx);
            _solnEx.ClaimedStandardReview.Clear();

            _datastore.Update(_solnEx);

            var retrievedSolnEx = _datastore.BySolution(_solnEx.Solution.Id);

            retrievedSolnEx.ClaimedStandardReview
            .Should().BeEmpty();
        }
        public void Update_ClaimedCapabilityReview_Remove_Chain_Succeeds()
        {
            var contact = Retriever.GetAllContacts(_policy).First();
            var cap     = Retriever.GetAllCapabilities(_policy).First();
            var claim   = Creator.GetCapabilitiesImplemented(claimId: cap.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);

            ClearClaimedCapability();
            _solnEx.ClaimedCapability.Add(claim);

            var contId     = GetContact().Id;
            var evidence   = Creator.GetCapabilitiesImplementedEvidence(claimId: claim.Id, createdById: contId);
            var reviewPrev = Creator.GetCapabilitiesImplementedReviews(evidenceId: evidence.Id, createdById: contId);
            var review     = Creator.GetCapabilitiesImplementedReviews(prevId: reviewPrev.Id, evidenceId: evidence.Id, createdById: contId);

            _solnEx.ClaimedCapabilityEvidence.Add(evidence);
            _solnEx.ClaimedCapabilityReview.Add(reviewPrev);
            _solnEx.ClaimedCapabilityReview.Add(review);
            _datastore.Update(_solnEx);
            _solnEx.ClaimedCapabilityReview.Clear();

            _datastore.Update(_solnEx);

            var retrievedSolnEx = _datastore.BySolution(_solnEx.Solution.Id);

            retrievedSolnEx.ClaimedCapabilityReview
            .Should().BeEmpty();
        }
Пример #9
0
        protected void Verify_Click(object sender, EventArgs e)
        {
            this.succ = this.z.a_tm_office(this.c_mark.log_staff, this.admin_status, this.rbValid.SelectedValue, this.comment.Text, "", "", "", this.admin);


            if (this.succ != "0")
            {
                if (this.rbValid.SelectedValue == "kiv")
                {
                    this.pID = base.Request.QueryString["x"].ToString();

                    this.c_mark = this.z.getMarkInfoByUserID(this.pID);

                    this.c_aos = this.t.getAddressServiceByID(this.c_p.ID);
                    this.c_rep = this.t.getRepByUserID(this.c_p.ID);
                    this.c_p   = this.z.getPwalletDetailsByID(this.c_mark.log_staff);
                    String    ssss  = "The Application with Tp number <b>" + this.c_mark.reg_number + "</b> Is at Acceptance unit Kiv Folder .  Reason for the action is <br/> <em>" + this.comment.Text + "</em>";
                    String    ssss4 = "Application " + this.c_mark.reg_number + " Status";
                    Retriever pp3   = new Retriever();
                    String    ss    = pp3.addEmail(ssss, ssss4, this.c_p.applicantID, this.c_mark.log_staff);

                    //  this.z.sendemail4(this.c_aos.email1, this.c_rep.xname, this.comment.Text, this.c_mark.reg_number);
                }

                base.Response.Write("<script language=JavaScript>alert('Data updated successfully')</script>");
                base.Response.Redirect("./acceptance.aspx");
            }
            else
            {
                base.Response.Write("<script language=JavaScript>alert('Data not verified, Please try again later')</script>");
            }
        }
        /**
         * Runs the post-processor.
         *
         * @param retriever the retriever to associate with the post-processor.
         *
         * @return a buffer containing the downloaded data, perhaps converted during content handling. null is returned if a
         *         fatal problem occurred during post-processing.
         *
         * @throws ArgumentException if the retriever is null.
         */
        public ByteBuffer run(Retriever retriever)
        {
            if (retriever == null)
            {
                String message = Logging.getMessage("nullValue.RetrieverIsNull");
                Logging.logger().severe(message);
                throw new ArgumentException(message);
            }

            this.retriever = retriever;

            if (!retriever.getState().Equals(Retriever.RETRIEVER_STATE_SUCCESSFUL))
            {
                this.handleUnsuccessfulRetrieval();
                return(null);
            }

            if (!this.validateResponseCode())
            {
                this.handleInvalidResponseCode();
                return(null);
            }

            return(this.handleSuccessfulRetrieval());
        }
Пример #11
0
        public override void Visit(VisitableElementComplexType element)
        {
            base.Visit(element);

            if (CurrentType == null)
            {
                ArrayList nodes = Retriever.RetrieveCustomization(element, NodeType.Type);

                if (nodes.Count != 0 || Retriever.Files.Count == 0)
                {
                    CodeTypeDeclaration type = new CodeTypeDeclaration(element.TypeName);
                    type.CustomAttributes.AddRange(CodeDomHelper.BuildCustomAttributes(nodes));
                    type.BaseTypes.AddRange(CodeDomHelper.BuildBaseTypes(nodes));
                    // Append unhandled attributes to the type UserData property, for use by custom visitors.
                    XmlAttribute[] attributes = element.SchemaObject.UnhandledAttributes;
                    if (attributes != null)
                    {
                        foreach (XmlAttribute attr in attributes)
                        {
                            type.UserData.Add(attr.LocalName, attr);
                        }
                    }

                    CurrentNamespace.Types.Add(type);
                }
            }
        }
Пример #12
0
        static async Task Main(string[] args)
        {
            SetUpConfiguration();
            AirtableCredentials airtableCredentials = GetAirtableCredentials();

            Console.WriteLine($"BaseId is {airtableCredentials.BaseId}. ApiKey is {airtableCredentials.ApiKey}");

            Retriever retriever = new Retriever(airtableCredentials.BaseId, airtableCredentials.ApiKey);

            string tableName = Configuration.GetSection("airtableOptions").GetValue <string>("tableName");

            DateOptions dateOptions = GetDateOptions();

            Console.WriteLine($"Date1 is {dateOptions.FirstDateNonInclusive}. Date2 is {dateOptions.LastDateNonInclusive}");

            await DownloadAllCovers(retriever, @"c:\temp\MagCovers", tableName);

            /* Add Covers to Issues within a Time Range */
            // await AddCoversToIssuesInTimeRange(retriever, dateOptions, tableName);

            // /* Get a single record */
            //string recordId = "recDDgkAWOdzhugCS";
            //string recordJson = await retriever.GetRecord(tableName, recordId);
            //Console.WriteLine(recordJson);

            // /* Get a number of records via a formula */
            //string formula = @"Issue='1970-01'";
            //var records = await retriever.GetRecordsFromFormula(tableName, formula);
            //foreach (string rec in records) {
            //    Console.WriteLine(rec);
            //}

            // /* add Cover to Record */
            // await AddCoverToRecord(retriever);
        } // end Main
Пример #13
0
        static async Task AddCoversToIssuesInTimeRange(Retriever retriever, DateOptions dateOptions, string tableName)
        {
            var ids = GetIdsForIssuesInTimeRange(retriever, dateOptions, tableName);

            if (ids != null)
            {
                string[] idArray        = ids.Result.ToArray();
                int      idArrayCounter = 0;

                MagazineIssueDate issueDate = new MagazineIssueDate(dateOptions.FirstDateNonInclusive);

                if (PromptForConfirmation(idArray.Count()))
                {
                    while (idArrayCounter < idArray.Count())
                    {
                        issueDate.IncrementMonth();
                        if (!issueDate.IsSkipMonth())
                        {
                            await AddCoverToRecord(retriever, idArray[idArrayCounter], issueDate);

                            idArrayCounter++;
                        }
                    }
                }
            }
        }
Пример #14
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            // Reset database and inject poe data
            using (var context = new PoeAppDbContext())
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();
            }

            var retriever = new Retriever();

            retriever.InitializeBaseItemTable();


            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
        }
Пример #15
0
        public static void BuildLists()
        {
            Console.WriteLine("Building Binary File.");

            var stopwatch = new Stopwatch();

            stopwatch.Start();
            var fileLocation = Retriever.BuildProtoBufTrie(new[]
            {
                NicLists.arin,
                NicLists.apnic,
                NicLists.lacnic,
                NicLists.ripencc,
                NicLists.afrinic
            });

            stopwatch.Stop();
            Console.WriteLine("File Build in {0}ms", stopwatch.ElapsedMilliseconds);

            Console.WriteLine("FileLocation:");
            Console.WriteLine(fileLocation);
            Console.WriteLine(@"
IMPORTANT:

You must now place the geonet.bin file in the resources 
directory of your GeoNet project and compile.

");


            //GeoLookup.BuildFrom(lists);
        }
Пример #16
0
        public void GetResult_RetrieveStressAndStrain()
        {
            var       strategy      = new RetrieverStrategy_StressStrain();
            var       retrieverInfo = new RetrieverInfo_StressStrain(_model, _inputPolyline, _projectionVector, _tol, _delta, "0", 0, 0);
            Retriever sub           = new Retriever(strategy, retrieverInfo);



            var output = sub.GetResults(_outputPolylines, _outputCrossedFaces);



            Assert.AreEqual(output[ShellSecResult.Sig_tt][0][0][0], -0.0011520737327188996, _tol);
            Assert.AreEqual(output[ShellSecResult.Sig_tt][0][0][1], -0.00898617511520737, _tol);

            Assert.AreEqual(output[ShellSecResult.Sig_nn][0][0][0], -0.10115207373271895, _tol);
            Assert.AreEqual(output[ShellSecResult.Sig_nn][0][0][1], -0.098847926267281172, _tol);

            Assert.AreEqual(output[ShellSecResult.Sig_tn][0][0][0], 0.0011520737327189025, _tol);
            Assert.AreEqual(output[ShellSecResult.Sig_tn][0][0][1], -0.0011520737327189012, _tol);

            Assert.AreEqual(output[ShellSecResult.Eps_tt][0][0][0], 0.0026811897779639689, _tol);
            Assert.AreEqual(output[ShellSecResult.Eps_tt][0][0][1], -3.2132054729097926E-20, _tol);

            Assert.AreEqual(output[ShellSecResult.Eps_nn][0][0][0], -0.033682446585672404, _tol);
            Assert.AreEqual(output[ShellSecResult.Eps_nn][0][0][1], -0.032677000418935918, _tol);

            Assert.AreEqual(output[ShellSecResult.Eps_tn][0][0][0], 0.00041893590280687348, _tol);
            Assert.AreEqual(output[ShellSecResult.Eps_tn][0][0][1], -0.0004189359028068732, _tol);
        }
    public void Update_ClaimedStandardReview_Remove_EndChain_Succeeds()
    {
      var contact = Retriever.GetAllContacts(_policy).First();
      var std = Retriever.GetAllStandards(_policy).First();
      var claim = Creator.GetStandardsApplicable(claimId: std.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);
      ClearClaimedStandard();
      _solnEx.ClaimedStandard.Add(claim);

      var contId = GetContact().Id;
      var evidence = Creator.GetStandardsApplicableEvidence(claimId: claim.Id, createdById: contId);
      var reviewPrev = Creator.GetStandardsApplicableReviews(evidenceId: evidence.Id, createdById: contId);
      var review = Creator.GetStandardsApplicableReviews(prevId: reviewPrev.Id, evidenceId: evidence.Id, createdById: contId);
      _solnEx.ClaimedStandardEvidence.Add(evidence);
      _solnEx.ClaimedStandardReview.Add(reviewPrev);
      _solnEx.ClaimedStandardReview.Add(review);
      _datastore.Update(_solnEx);
      _solnEx.ClaimedStandardReview.Remove(review);

      _datastore.Update(_solnEx);

      var retrievedSolnEx = _datastore.BySolution(_solnEx.Solution.Id);
      retrievedSolnEx.ClaimedStandardReview
        .Should().ContainSingle()
        .And.Subject.Single()
        .Should().BeEquivalentTo(reviewPrev,
          opts => opts
            .Excluding(ent => ent.CreatedOn));
    }
    public void Update_ClaimedCapabilityEvidence_Remove_EndChain_Succeeds()
    {
      var contact = Retriever.GetAllContacts(_policy).First();
      var cap = Retriever.GetAllCapabilities(_policy).First();
      var claim = Creator.GetCapabilitiesImplemented(claimId: cap.Id, solnId: _solnEx.Solution.Id, ownerId: contact.Id);
      ClearClaimedCapability();
      _solnEx.ClaimedCapability.Add(claim);

      var contId = GetContact().Id;
      var evidencePrev = Creator.GetCapabilitiesImplementedEvidence(claimId: claim.Id, createdById: contId);
      var evidence = Creator.GetCapabilitiesImplementedEvidence(prevId: evidencePrev.Id, claimId: claim.Id, createdById: contId);
      _solnEx.ClaimedCapabilityEvidence.Add(evidence);
      _solnEx.ClaimedCapabilityEvidence.Add(evidencePrev);
      _datastore.Update(_solnEx);
      _solnEx.ClaimedCapabilityEvidence.Remove(evidence);

      _datastore.Update(_solnEx);

      var retrievedSolnEx = _datastore.BySolution(_solnEx.Solution.Id);
      retrievedSolnEx.ClaimedCapabilityEvidence
        .Should().ContainSingle()
        .And.Subject.Single()
        .Should().BeEquivalentTo(evidencePrev,
          opts => opts
            .Excluding(ent => ent.CreatedOn));
    }
Пример #19
0
        /// <summary>
        /// Visitor implementation. Processes the passed element
        /// adding the corresponding constructors.
        /// </summary>
        /// <param name="element"></param>
        public override void Visit(VisitableElementComplexType element)
        {
            base.Visit(element);

            if (CurrentType != null)
            {
                AddConstructor(element, Retriever.RetrieveCustomization(
                                   element, NodeType.Type));
            }

            ArrayList nodes = Retriever.RetrieveCustomization(
                element, NodeType.Collection);
            string name = element.Name + Configuration.CollectionNaming;

            if (nodes.Count != 0)
            {
                CurrentType = null;
                foreach (CodeTypeDeclaration type in CurrentNamespace.Types)
                {
                    if (type.Name == name)
                    {
                        CurrentType = type;
                        break;
                    }
                }
                if (CurrentType != null)
                {
                    AddConstructor(element, nodes);
                }
                // TODO: Constructor isn't added!!!
            }
        }
Пример #20
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Retriever retriever = new Retriever();

            dataGrid.ItemsSource   = retriever.GetAverageScores();
            dataGrid_2.ItemsSource = retriever.GetStudentsData();
        }
Пример #21
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "CorePart")
        {
            CorePart i_corePart = other.GetComponent <CorePart>();
            //Find retriever of the alive player
            if (GameManager.alivePlayers.Count <= 1)
            {
                Retriever r = GameManager.alivePlayers[0].GetComponentInChildren <Retriever>();
                r.RetrieveCorePart(i_corePart);
            }
        }

        if (other.tag == "Player")
        {
            PlayerController player = other.GetComponent <PlayerController>();
            if (player == null)
            {
                return;
            }
            player.KillWithoutCorePart();
            if (GameManager.alivePlayers.Count <= 1)
            {
                Retriever r = GameManager.alivePlayers[0].GetComponentInChildren <Retriever>();
                r.AllowPlayerRevive(player);
            }
        }
    }
Пример #22
0
        static async Task DownloadAllCovers(Retriever retriever, string targetFolder, string tableName)
        {
            DateTime year1     = new DateTime(1981, 1, 1);
            DateTime year2     = new DateTime(1981, 12, 1);
            DateTime finalDate = new DateTime(2018, 1, 1);

            DateOptions dateOptions = new DateOptions()
            {
                FirstDateNonInclusive = year1.AddMonths(-1),
                LastDateNonInclusive  = year2.AddMonths(1)
            };

            var serviceProvider   = new ServiceCollection().AddHttpClient().BuildServiceProvider();
            var httpClientFactory = serviceProvider.GetService <IHttpClientFactory>();
            var httpClient        = httpClientFactory.CreateClient();

            while (dateOptions.FirstDateNonInclusive < finalDate)
            {
                List <(string, string)> idsAndUrls = await GetIdsAndCoverUrlsForIssuesInTimeRange(retriever, dateOptions, tableName);

                foreach ((_, string url) in idsAndUrls)
                {
                    await DownloadAndSaveAttachment(httpClient, targetFolder, url);
                }

                // download attachment
                // add 1 year to dateOptions dates
                dateOptions.FirstDateNonInclusive = dateOptions.FirstDateNonInclusive.AddYears(1);
                dateOptions.LastDateNonInclusive  = dateOptions.LastDateNonInclusive.AddYears(1);
                Console.WriteLine($"{dateOptions.FirstDateNonInclusive}. {dateOptions.LastDateNonInclusive}");
            }
        }
Пример #23
0
 /// <summary>
 /// Loads the entity of the specified type with the provided ID and assigns it to the DataSource property.
 /// </summary>
 /// <param name="id">The ID of the entity to load.</param>
 /// <returns>The loaded and activated entity.</returns>
 public IEntity Load(Guid id)
 {
     using (LogGroup logGroup = LogGroup.StartDebug("Loading entity with the ID: " + id.ToString()))
     {
         Load(Retriever.Retrieve("ID", id));
     }
     return(DataSource);
 }
Пример #24
0
 /// <summary>
 /// Loads the entity of the specified type with the provided ID and assigns it to the DataSource property.
 /// </summary>
 /// <param name="uniqueKey">The unique key of the entity to load.</param>
 /// <returns>The loaded and activated entity.</returns>
 public IEntity Load(string uniqueKey)
 {
     using (LogGroup logGroup = LogGroup.StartDebug("Loading entity with the unique key: " + uniqueKey))
     {
         Load(Retriever.Retrieve("UniqueKey", uniqueKey));
     }
     return(DataSource);
 }
Пример #25
0
        public static void Main(string[] args)
        {
            Retriever fetcher = new Retriever();
            Hero      abathur = fetcher.GetHero(37);

            Console.WriteLine(fetcher.GetHero(abathur).GetType());
            Match tmp = fetcher.GetMatch(7772);

            foreach (KeyValuePair <Player, Hero> kv in fetcher.GetPopulatedDraftDict(tmp.Drafts[0]))
            {
                Console.WriteLine($"{kv.Key}: {kv.Value}");
            }
            foreach (KeyValuePair <Player, Hero> kv in fetcher.GetPopulatedDraftDict(tmp.Drafts[1]))
            {
                Console.WriteLine($"{kv.Key}: {kv.Value}");
            }
            Console.WriteLine(fetcher.GetPlayer(468));
            Console.WriteLine(fetcher.GetTournament(83));
            foreach (Tournament tournament in fetcher.GetAllTournaments())
            {
                Console.WriteLine(tournament);
            }

            Console.WriteLine(fetcher.GetPatch(1));
            foreach (Patch patch in fetcher.GetAllPatches())
            {
                Console.WriteLine(patch);
            }

            Console.WriteLine(fetcher.GetAllMaps());

            Console.WriteLine(fetcher.GetHero(7));
            foreach (Hero hero in fetcher.GetAllHeroes())
            {
                Console.WriteLine(hero);
            }

            Console.WriteLine(fetcher.GetTeam(95));
            Console.WriteLine(fetcher.GetMatch(7772));
            Console.WriteLine(fetcher.GetMap(3));
            Console.WriteLine(fetcher.GetRegion(4));

            foreach (Team team in fetcher.GetAllTeams())
            {
                Console.WriteLine(team);
            }

            foreach (Match match in fetcher.GetRecentMatches())
            {
                Console.WriteLine(match);
            }

            foreach (Player player in fetcher.GetAllPlayers())
            {
                Console.WriteLine(player);
            }
            Console.ReadLine();
        }
Пример #26
0
        public void SaveRequest()
        {
            Log.Information("Saving job.");

            JobData.UpdateStatus(this.Request.ID, this.Request.Status);
            Retriever.UpdateRequests(new List <WikiJobRequest> {
                Request
            });
        }
Пример #27
0
        public EpisodeInfoResponse GetEpisodeInfo(int showID, string episodeLabel)
        {
            var rawResponse = Retriever.Get(GetURLForEpisoddeInfo(showID, episodeLabel));

            ValidateResponse(rawResponse);

            var response = XDocument.Load(rawResponse);

            return(_mapper.MapXMLToEpisodeInfoResponse(response));
        }
Пример #28
0
        public SeriesInfoResponse GetSeriesInfo(int seriesId)
        {
            var rawResponse = Retriever.Get(GetURLForSeriesInfo(seriesId));

            ValidateResponse <ShowNotFoundException>(rawResponse);

            var response = XDocument.Load(rawResponse);

            return(_mapper.MapXMLToSeriesInfo(response));
        }
Пример #29
0
        public FullShowInfoResponse GetFullShowInfo(int showId)
        {
            var rawResponse = Retriever.Get(GetURLForFullShowInfo(showId));

            ValidateResponse(rawResponse);

            var response = XDocument.Load(rawResponse);

            return(_mapper.MapXMLToFullShowInfoResponse(response));
        }
Пример #30
0
        public EpisodeListResponse GetEpisodeList(int seriesId)
        {
            var rawResponse = Retriever.Get(GetURLForEpisodeList(seriesId));

            ValidateResponse <ShowNotFoundException>(rawResponse);

            var response = XDocument.Load(rawResponse);

            return(_mapper.MapXMLToEpisodeList(response));
        }
Пример #31
0
    void Awake()
    {
        if(retriever == null)
        {
            retriever = this;
            DontDestroyOnLoad(gameObject);

        }
        else
        {
            Destroy(gameObject);
        }
    }
Пример #32
0
        //private List<string> _filters;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="apiKey"></param>
        /// <param name="settings"></param>
        /// <param name="configuration"></param>
        /// <param name="providers"></param>
        /// <param name="outputDir"></param>
        public Manager(string apiKey, 
                       Settings settings,
                       Configuration configuration,
                       List<Provider> providers)
        {
            _settings = settings;
            _configuration = configuration;
            _providers = providers;
            _retriever = new Retriever(apiKey);

            _shows = new BlockingCollection<Tuple<int, string>>(); // SeriesID, Path
            _downloads = new BlockingCollection<Tuple<int, int, int, string>>();
            _torrents = new BlockingCollection<Tuple<Series, Episode>>();

            Thread thread = new Thread(new ThreadStart(StartDownloads));
            thread.IsBackground = true;
            thread.Start();

            thread = new Thread(new ThreadStart(StartShows));
            thread.IsBackground = true;
            thread.Start();

            thread = new Thread(new ThreadStart(StartTorrentFinder));
            thread.IsBackground = true;
            thread.Start();

            _timerTvData = new System.Timers.Timer();
            _timerTvData.Interval = 6000; // 1 min
            //_timer.Interval = INTERVAL_DAILY; // 24 Hours
            _timerTvData.Elapsed += OnTimerTvData_Elapsed;
            _timerTvData.Enabled = true;

            _timerTorrents = new System.Timers.Timer();
            //_timer.Interval = INTERVAL_DAILY; // 24 Hours
            _timerTorrents.Interval = INTERVAL_DAILY;  //6000; // 1 min
            _timerTorrents.Elapsed += OnTimerTorrents_Elapsed;
            _timerTorrents.Enabled = true;
        }
Пример #33
0
        /// <summary>
        /// 
        /// </summary>
        public FormNew(Retriever manager)
        {
            InitializeComponent();
            _manager = manager;

            // Load the quality values from the enum
            foreach (Global.EpisodeQuality result in Misc.EnumToList<Global.EpisodeQuality>())
            {
                if (result == Global.EpisodeQuality.Unknown |
                    result == Global.EpisodeQuality.None)
                {
                    continue;
                }

                Tuple<string, string> nameValue = new Tuple<string, string>(result.GetEnumDescription(), (result).ToString());
                cboPreferedEpisodeQuality.Items.Add(nameValue);
            }

            cboPreferedEpisodeQuality.DisplayMember = "Item1";
            cboPreferedEpisodeQuality.ValueMember = "Item2";
            cboPreferedEpisodeQuality.SelectedIndex = 0;

            cboInitialEpisodeStatus.SelectedIndex = 1; // Ignored
        }
Пример #34
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormMain_Load(object sender, EventArgs e)
        {
            using (new HourGlass(this))
            {
                this.Show();

                _settings = new Settings();
                string ret = _settings.Load();
                if (ret.Length > 0)
                {
                    Misc.DisplayErrorMessageBox("An error occurred whilst loading the settings: " + ret);
                    return;
                }

                if (_settings.TorrentFileDirectory.Length == 0)
                {
                    Misc.DisplayMessageBox("The torrent file directory has not been set. It must be set before the application can continue", MessageBoxIcon.Exclamation);
                }

                if (_settings.TorrentDirectory.Length == 0)
                {
                    Misc.DisplayMessageBox("The torrent directory has not been set. It must be set before the application can continue", MessageBoxIcon.Exclamation);
                    return;
                }

                _providers = new List<Provider>();
                //_providers.Add(new DailyTvTorrent(1));
                _providers.Add(new ShowRss(1));
                _retriever = new Retriever(API_KEY);
                _configuration = new Configuration();
                _manager = new Manager(API_KEY, _settings, _configuration, _providers);
                _manager.EpisodeFound += OnManager_EpisodeFound;
                _manager.SeriesFound += OnManager_SeriesFound;
                _manager.TorrentFound += OnManager_TorrentFound;
                _manager.Error += OnManager_Error;
                _manager.DownloadUpdate += OnManager_DownloadUpdate;
                _manager.Message += OnManager_Message;
                _fileSystemWatcher = new FileSystemWatcher(_settings.TorrentDirectory);
                _fileSystemWatcher.Created += OnFileSystemWatcher_Created;
                _fileSystemWatcher.EnableRaisingEvents = true;

                ret = _configuration.Load();
                if (ret.Length > 0)
                {
                    Misc.DisplayErrorMessageBox(this, "An error occurred whilst loading the configuration");
                    return;
                }

                // Ensure we have a base line server timestamp, used for updating with TVDB
                if (_configuration.LastUpdated == DateTime.MinValue)
                {
                    _configuration.LastUpdated = _retriever.ServerTime();
                }

                //listEpisodes.ShowGroups = true;

                LoadSeries();
            }
        }
Пример #35
0
 public DynamicStat(Retriever retriever, Character character)
 {
     this.retriever = retriever;
     this.character = character;
 }
Пример #36
0
 /// <summary>
 /// This method should be used in conjunction with <see cref="DynamicMethods"/>
 /// methods.
 /// </summary>
 /// <param name="retriever"></param>
 /// <returns></returns>
 public float this[Retriever retriever]
 {
     get { return this[retriever.Method.Name]; }
 }