コード例 #1
0
        public async Task TestDiffFtp()
        {
            var skinDrive   = new FtpSkinDrive();
            var diffManager = new DiffManager(skinDrive, @"G:\Steam\steamapps\common\IL-2 Sturmovik Battle of Stalingrad");
            var diffs       = await diffManager.GetDiffAsync();

            await diffManager.ExecuteDiff(diffs);
        }
コード例 #2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            DiffManager.Init();
        }
コード例 #3
0
        public HttpResponseMessage right(int id, DataEntry rightEntry)
        {
            if (rightEntry.Data == null)
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }

            DiffManager.AddRightValue(id, rightEntry.Data);

            return(new HttpResponseMessage(HttpStatusCode.Created));
        }
コード例 #4
0
        public void Diffing_Algorithm_Performs_Diff(string left, string right, DiffResult.DiffResultType expected)
        {
            List <DiffEntry> testDiff = new List <DiffEntry>();

            testDiff.Add(new DiffEntry(1, left, right));

            DiffManager.test_Init(testDiff);

            DiffResult result = DiffManager.Compare(1);

            Assert.AreEqual(expected, result.ResultType);
        }
コード例 #5
0
        private async Task GetDiff()
        {
            label_Status.Text = "Checking for skin updates...";

            if (_diffManager == null)
            {
                _diffManager = new DiffManager(new FtpSkinDrive(), _configuration.Il2Path);
            }

            _diffs = (await _diffManager.GetDiffAsync()).OrderBy(x => x.GroupId).ToList();
            PopulateListView(_diffs);
            label_Status.Text = $"{_diffs.Count} updated items found";
        }
コード例 #6
0
    void Start()
    {
        if (PlayerPrefs.GetInt("Difficulty") == 0)
        {
            DiffManager = GameObject.FindGameObjectWithTag("Controller").GetComponent <DiffManager>();
        }
        Player  = GameObject.FindGameObjectWithTag("Player");
        rooms   = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
        enemies = GameObject.FindGameObjectWithTag("Controller").GetComponent <EnemyList>();
        list    = enemies.enimesList;
        System.Random rnd = new System.Random(System.DateTime.Now.Millisecond);
        list     = list.OrderBy(x => rnd.Next()).ToArray();
        bossList = enemies.bosses;
        bossList = bossList.OrderBy(x => rnd.Next()).ToArray();

        playerDetector = gameObject.GetComponent <BoxCollider2D>();
    }
コード例 #7
0
        public HttpResponseMessage GetById(int id)
        {
            HttpResponseMessage comparisonResponse = new HttpResponseMessage();

            DiffResult result = DiffManager.Compare(id);

            if (result.Valid == false)
            {
                comparisonResponse.StatusCode = HttpStatusCode.NotFound;

                return(comparisonResponse);
            }

            comparisonResponse.Content = new StringContent(JsonConvert.SerializeObject(result));
            comparisonResponse.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            comparisonResponse.StatusCode = HttpStatusCode.OK;

            return(comparisonResponse);
        }
コード例 #8
0
ファイル: MainFrm.cs プロジェクト: smoluks/RequestTester
        private void DataGridViewResults_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row = (DataGridViewRow)dataGridViewResults.Rows[e.RowIndex];

            DiffManager.ShowDiff((RequestCase)row.DataBoundItem);
        }
コード例 #9
0
        public async Task ResurrectEntities()
        {
            // this test messes with the publish table so it should not be run on production accounts
            Assert.IsFalse(Utils.ProdConfiguration.IsProduction(TestConstants.AzureStorageConnectionString));

            string runId = RunId.GenerateTestRunId();

            // clean the publish table so that we are working with known state
            StorageManager publishStorage = new StorageManager(TestConstants.AzureStorageConnectionString, TableNames.TableType.Publish, runId);
            await TestUtilities.CleanPublishStorage(publishStorage);

            // setup download storage
            StorageManager downloadStorage = new StorageManager(TestConstants.AzureStorageConnectionString, TableNames.TableType.Download, runId);
            await downloadStorage.CreateTables();

            // create region
            RegionEntity region = TestUtilities.FakeRegionEntity();
            await downloadStorage.RegionStore.Insert(new List <RegionEntity>() { region });

            // create agency
            AgencyEntity agency = TestUtilities.FakeAgencyEntity(region.Id);
            await downloadStorage.AgencyStore.Insert(new List <AgencyEntity>() { agency });

            // create 1 route and 1 stop in download table that also exist in the publish table as deleted entities
            RouteEntity existingRoute = TestUtilities.FakeRouteEntity(region.Id, agency.Id);
            await downloadStorage.RouteStore.Insert(existingRoute);

            existingRoute.RowState = DataRowState.Delete.ToString();
            await publishStorage.RouteStore.Insert(existingRoute);

            StopEntity existingStop = TestUtilities.FakeStopEntity(region.Id);
            await downloadStorage.StopStore.Insert(existingStop);

            existingStop.RowState = DataRowState.Delete.ToString();
            await publishStorage.StopStore.Insert(existingStop);

            // setup diff manager
            DiffManager diffManager = new DiffManager(TestConstants.AzureStorageConnectionString, runId);
            await diffManager.InitializeStorage();

            // execute diff manager
            await diffManager.DiffAndStore();

            // sleep between the insert and the query otherwise Azure sometimes returns no records
            Thread.Sleep(TestConstants.AzureTableDelay);

            // query results
            StorageManager            diffStorage = new StorageManager(TestConstants.AzureStorageConnectionString, TableNames.TableType.Diff, runId);
            IEnumerable <RouteEntity> diffRoutes  = await diffStorage.RouteStore.GetAllRoutes(existingRoute.RegionId);

            IEnumerable <StopEntity> diffStops = await diffStorage.StopStore.GetAllStops(existingStop.RegionId);

            StorageManager            diffMetadataStorage = new StorageManager(TestConstants.AzureStorageConnectionString, TableNames.TableType.DiffMetadata, runId);
            List <DiffMetadataEntity> diffMetadata        = diffMetadataStorage.DiffMetadataStore.Get(runId).ToList();

            // clean up
            await diffManager.DeleteDiff();

            await downloadStorage.DeleteDataTables();

            await publishStorage.DeleteTables();

            // check route
            Assert.IsNotNull(diffRoutes);
            Assert.AreEqual(diffRoutes.Count(), 1);
            Assert.AreEqual(diffRoutes.First().Id, existingRoute.Id);
            Assert.AreEqual(diffRoutes.First().ShortName, existingRoute.ShortName);
            Assert.AreEqual(diffRoutes.First().LongName, existingRoute.LongName);
            Assert.AreEqual(diffRoutes.First().Description, existingRoute.Description);
            Assert.AreEqual(diffRoutes.First().Url, existingRoute.Url);
            Assert.AreEqual(diffRoutes.First().AgencyId, existingRoute.AgencyId);
            Assert.AreEqual(diffRoutes.First().RegionId, existingRoute.RegionId);
            Assert.AreEqual(diffRoutes.First().RecordType, existingRoute.RecordType);
            Assert.AreEqual(diffRoutes.First().RowState, DataRowState.Resurrect.ToString());
            Assert.AreEqual(diffRoutes.First().RawContent, existingRoute.RawContent);

            // check stop
            Assert.IsNotNull(diffStops);
            Assert.AreEqual(diffStops.Count(), 1);
            Assert.AreEqual(diffStops.First().Id, existingStop.Id);
            Assert.AreEqual(diffStops.First().Lat, existingStop.Lat);
            Assert.AreEqual(diffStops.First().Lon, existingStop.Lon);
            Assert.AreEqual(diffStops.First().Direction, existingStop.Direction);
            Assert.AreEqual(diffStops.First().Name, existingStop.Name);
            Assert.AreEqual(diffStops.First().Code, existingStop.Code);
            Assert.AreEqual(diffStops.First().RegionId, existingStop.RegionId);
            Assert.AreEqual(diffStops.First().RecordType, existingStop.RecordType);
            Assert.AreEqual(diffStops.First().RowState, DataRowState.Resurrect.ToString());
            Assert.AreEqual(diffStops.First().RawContent, existingStop.RawContent);

            // check metadata
            Assert.IsNotNull(diffMetadata);
            Assert.AreEqual(diffMetadata.Count, 2);
            int routeIndex = -1;
            int stopIndex  = -1;

            if (diffMetadata[0].RecordType == RecordType.Route.ToString())
            {
                routeIndex = 0;
                stopIndex  = 1;
            }
            else
            {
                routeIndex = 1;
                stopIndex  = 0;
            }

            Assert.AreEqual(diffMetadata[routeIndex].AddedCount, 0);
            Assert.AreEqual(diffMetadata[routeIndex].AgencyId, existingRoute.AgencyId);
            Assert.AreEqual(diffMetadata[routeIndex].DeletedCount, 0);
            Assert.AreEqual(diffMetadata[routeIndex].RecordType, RecordType.Route.ToString());
            Assert.AreEqual(diffMetadata[routeIndex].RegionId, existingRoute.RegionId);
            Assert.AreEqual(diffMetadata[routeIndex].ResurrectedCount, 1);
            Assert.AreEqual(diffMetadata[routeIndex].RunId, runId);
            Assert.AreEqual(diffMetadata[routeIndex].UpdatedCount, 0);

            Assert.AreEqual(diffMetadata[stopIndex].AddedCount, 0);
            Assert.AreEqual(diffMetadata[stopIndex].AgencyId, string.Empty);
            Assert.AreEqual(diffMetadata[stopIndex].DeletedCount, 0);
            Assert.AreEqual(diffMetadata[stopIndex].RecordType, RecordType.Stop.ToString());
            Assert.AreEqual(diffMetadata[stopIndex].RegionId, existingStop.RegionId);
            Assert.AreEqual(diffMetadata[stopIndex].ResurrectedCount, 1);
            Assert.AreEqual(diffMetadata[stopIndex].RunId, runId);
            Assert.AreEqual(diffMetadata[stopIndex].UpdatedCount, 0);
        }