示例#1
0
 private void ImagePass(CollectorBase collector)
 {
     collector.I18NImages.ForEach(pair =>
     {
         MediaInfo.Images.Add(pair.Key);
         Sprite sprite = pair.Value.Value;
         var info      = new ImageInfo
         {
             PivotX  = sprite.pivot.x,
             PivotY  = sprite.pivot.y,
             Width   = (int)sprite.rect.width,
             Height  = (int)sprite.rect.height,
             Comment = pair.Value.Comment
         };
         SaveFile($"{OutputPath}/res/img/{Name}/{pair.Key}.json", JsonUtility.ToJson(info));
         var tex = new Texture2D((int)sprite.rect.width, (int)sprite.rect.height)
         {
             filterMode = FilterMode.Point,
             wrapMode   = TextureWrapMode.Clamp
         };
         tex.SetPixels(sprite.texture.GetPixels(
                           (int)sprite.rect.x,
                           (int)sprite.rect.y,
                           (int)sprite.rect.width,
                           (int)sprite.rect.height));
         tex.Apply();
         SaveFile($"{OutputPath}/res/img/{Name}/{pair.Key}.png", tex.EncodeToPNG());
     });
 }
示例#2
0
 public TrafficProcessor(IAuthentication authentication,
                         List <IRecordWriter> recordWriters,
                         GitHubHttpClient httpClient,
                         ITelemetryClient telemetryClient,
                         string apiDomain)
 {
     this.collector     = new GitHubCollector(httpClient, authentication, telemetryClient, recordWriters);
     this.recordWriters = recordWriters;
     this.apiDomain     = apiDomain;
 }
示例#3
0
 private void AudioPass(CollectorBase collector)
 {
     collector.I18NAudios.ForEach(pair =>
     {
         MediaInfo.Audios.Add(pair.Key);
         AudioClip audio = pair.Value.Value;
         string path     = AssetDatabase.GetAssetPath(audio);
         if (File.Exists($"{OutputPath}/res/audio/{Name}/{pair.Key}{Path.GetExtension(path)}"))
         {
             File.Delete($"{OutputPath}/res/audio/{Name}/{pair.Key}{Path.GetExtension(path)}");
         }
         FileUtil.CopyFileOrDirectory(path, $"{OutputPath}/res/audio/{Name}/{pair.Key}{Path.GetExtension(path)}");
     });
 }
    public OverheadTest(ITestOutputHelper testOutputHelper)
    {
        TestcontainersSettings.ResourceReaperEnabled = false;
        _testOutputHelper = testOutputHelper;

        var iterationResults = Path.Combine(Directory.GetCurrentDirectory(), "results",
                                            DateTime.UtcNow.ToString("yyyyMMddHHmmss"));

        // Creates directory for results specific to this run
        _iterationResults = Directory.CreateDirectory(iterationResults);

        _network   = BuildDefaultNetwork();
        _collector = CreateCollector(_iterationResults);
    }
示例#5
0
    public EshopApp(IDockerNetwork network, CollectorBase collector, SqlServerBase sqlServer,
                    NamingConvention namingConvention, AgentConfig config)
    {
        if (network == null)
        {
            throw new ArgumentNullException(nameof(network));
        }
        if (collector == null)
        {
            throw new ArgumentNullException(nameof(collector));
        }
        if (sqlServer == null)
        {
            throw new ArgumentNullException(nameof(sqlServer));
        }
        if (namingConvention == null)
        {
            throw new ArgumentNullException(nameof(namingConvention));
        }
        if (config == null)
        {
            throw new ArgumentNullException(nameof(config));
        }

        _logStream    = File.Create(Path.Combine(namingConvention.ContainerLogs, "eshop-app.txt"));
        _resultStream = File.Create(Path.Combine(namingConvention.AgentResults, CounterResultsFile));

        var testcontainersBuilder = new TestcontainersBuilder <TestcontainersContainer>()
                                    .WithImage(config.DockerImageName)
                                    .WithName(ContainerName)
                                    .WithNetwork(network)
                                    .WithEnvironment("ASPNETCORE_ENVIRONMENT", "Development")
                                    .WithEnvironment("SIGNALFX_ENDPOINT_URL", collector.TraceReceiverUrl)
                                    .WithEnvironment("SIGNALFX_PROFILER_LOGS_ENDPOINT", collector.LogsReceiverUrl)
                                    .WithEnvironment("ConnectionStrings__CatalogConnection", sqlServer.CatalogConnection)
                                    .WithEnvironment("ConnectionStrings__IdentityConnection", sqlServer.IdentityConnection)
                                    .WithEnvironment("Logging__LogLevel__Microsoft", "Warning")
                                    .WithEnvironment("Logging__LogLevel__Default", "Warning")
                                    .WithEnvironment("Logging__LogLevel__System", "Warning")
                                    .WithEnvironment("Logging__LogLevel__Microsoft.Hosting.Lifetime", "Information")
                                    .WithWaitStrategy(Wait.ForUnixContainer().UntilPortIsAvailable(AppPort))
                                    .WithOutputConsumer(Consume.RedirectStdoutAndStderrToStream(_logStream, _logStream));

        foreach (var envVar in config.AdditionalEnvVars)
        {
            testcontainersBuilder = testcontainersBuilder.WithEnvironment(envVar.Name, envVar.Value);
        }
        _container = testcontainersBuilder.Build();
    }
示例#6
0
        public OnboardingProcessor(IAuthentication authentication,
                                   List <IRecordWriter> recordWriters,
                                   GitHubHttpClient httpClient,
                                   ICache <OnboardingTableEntity> cache,
                                   IQueue onboardingQueue,
                                   ITelemetryClient telemetryClient,
                                   string apiDomain)
        {
            this.collector = new GitHubCollector(httpClient, authentication, telemetryClient, recordWriters);

            this.recordWriters   = recordWriters;
            this.cache           = cache;
            this.onboardingQueue = onboardingQueue;
            this.telemetryClient = telemetryClient;
            this.apiDomain       = apiDomain;
        }
示例#7
0
        /// <summary>
        /// Set Collector
        /// </summary>
        public Collector SetCollector(CollectorBase collector)
        {
            var controller = "Collectors";

            string url = string.Format("http://{0}/{1}/{2}", _controllerServer, _restAPI, controller);
            var    uri = new Uri(url);

            _logger.Info(string.Format("Call Rest API - {0}", url));

            var PostData = JsonConvert.SerializeObject(collector);

            var response = _httpClient.PostAsync(uri, new StringContent(PostData, Encoding.UTF8, _contentType));

            string jsonResult = response.Result.Content.ReadAsStringAsync().Result;

            return(JsonConvert.DeserializeObject <Collector>(jsonResult));
        }
示例#8
0
        /// <summary>
        /// Get Collector by MAC Address
        /// </summary>
        public Collector GetCollectorByMACAddress(CollectorBase collector)
        {
            var controller = "Collectors/Search";

            UriBuilder builder = new UriBuilder(string.Format("http://{0}/{1}/{2}", _controllerServer, _restAPI, controller))
            {
                Query = string.Format("macAddress={0}", collector.macAddress)
            };

            _logger.Info(string.Format("Call Rest API - {0}", builder.Uri));

            var response = _httpClient.GetAsync(builder.Uri);

            string jsonResult = response.Result.Content.ReadAsStringAsync().Result;


            return(JsonConvert.DeserializeObject <Collector>(jsonResult));
        }
示例#9
0
 private void FontPass(CollectorBase collector)
 {
     collector.I18NFonts.ForEach(pair => {
         SaveFile($"{OutputPath}/res/font/{pair.Key}.json", JsonUtility.ToJson(pair.Value.Value));
     });
 }