コード例 #1
0
        /// <summary>
        /// Convert FxCop log to SARIF format stream
        /// </summary>
        /// <param name="input">FxCop log stream</param>
        /// <param name="output">output stream</param>
        public void Convert(Stream input, IResultLogWriter output)
        {
            if (input == null)
            {
                throw (new ArgumentNullException("input"));
            }

            if (output == null)
            {
                throw (new ArgumentNullException("output"));
            }

            ToolInfo toolInfo = new ToolInfo();
            RunInfo  runInfo  = new RunInfo();

            toolInfo.Name = "FxCop";
            output.WriteToolAndRunInfo(toolInfo, runInfo);

            var context = new FxCopLogReader.Context();

            var reader = new FxCopLogReader();

            reader.IssueRead += (FxCopLogReader.Context current) => { output.WriteResult(CreateIssue(current)); };
            reader.Read(context, input);
        }
コード例 #2
0
        private RunInfo CreateRunInfo(XDocument doc, Report report)
        {
            if (doc.Element("assemblies") == null)
            {
                return(null);
            }

            RunInfo runInfo = new RunInfo();

            runInfo.TestRunner = report.TestRunner;

            XElement env = doc.Descendants("assembly").First();

            runInfo.Info.Add("Test results file", _resultsFile);
            runInfo.Info.Add("Test framework", env.Attribute("test-framework").Value);
            runInfo.Info.Add("Assembly name", env.Attribute("name").Value);
            runInfo.Info.Add("Run date", env.Attribute("run-date").Value);
            runInfo.Info.Add("Run time", env.Attribute("run-time").Value);

            // report counts
            report.Total   = double.Parse(env.Attribute("total").Value);
            report.Passed  = double.Parse(env.Attribute("passed").Value);
            report.Failed  = double.Parse(env.Attribute("failed").Value);
            report.Errors  = double.Parse(env.Attribute("errors").Value);
            report.Skipped = double.Parse(env.Attribute("skipped").Value);

            // report duration
            report.Duration = double.Parse(env.Attribute("time").Value);

            return(runInfo);
        }
コード例 #3
0
        /// <summary>
        ///  获取指令
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void TimergetCommandListTick(object sender, EventArgs e)
        {
            try{
                if (iscommandrun)
                {
                    return;
                }
                if (!runInfo.Islogin)
                {
                    return;
                }

                LoginWork loginWork = LoginWork.Instance;
                runInfo = loginWork.doGetCmd();
                if (runInfo.RetCode == RetCode.GETCMDSUCCESS)
                {
                    if (string.IsNullOrEmpty(runInfo.RetMsg))
                    {
                        iscommandrun = false;
                    }
                    else
                    {
                        iscommandrun = true;
                        if (!string.IsNullOrEmpty(runInfo.RetJson.RetData.Cmd))
                        {
                            doCmd.doSomething(runInfo.RetJson.RetData.Cmd, runInfo.RetJson);
                        }
                    }
                }
                iscommandrun = false;
            }
            catch (Exception ex) {
                LogHelper.WriteLog("获取指令出现错误", ex);
            }
        }
コード例 #4
0
ファイル: Singleton.cs プロジェクト: Ileha/Rolling-Ball
        public Singleton()
        {
            Load();

            screen = Camera.main.ScreenToWorldPoint(new Vector2(Camera.main.pixelWidth, Camera.main.pixelHeight)) - Camera.main.ScreenToWorldPoint(new Vector2(0, 0));
            screen.Set(Mathf.Abs(screen.x), Mathf.Abs(screen.y));
            TopBorder    = Resources.Load <Border>("prefub/TopBorder");
            BottomBorder = Resources.Load <Border>("prefub/BottomBorder");
            barrier      = Resources.Load <SpriteRenderer>("prefub/triangle");

            Particles onEnd = Resources.Load <Particles>("prefub/OnStar");

            onEndEmit = new ObjectPool(() => UnityEngine.Object.Instantiate(onEnd));

            Particles onGood = Resources.Load <Particles>("prefub/OnGood");

            onGoodEmit = new ObjectPool(() => UnityEngine.Object.Instantiate(onGood));

            Pause = Resources.Load <Sprite>("images/pause");
            Play  = Resources.Load <Sprite>("images/play");

            RunInfo uiInformation = Resources.Load <RunInfo>("prefub/UI/RunInfo");

            UIRunInformation = new ObjectPool(() => UnityEngine.Object.Instantiate(uiInformation));

            InfoText info = Resources.Load <InfoText>("prefub/UI/Info");

            InfoTexts = new ObjectPool(() => UnityEngine.Object.Instantiate(info));
        }
コード例 #5
0
 internal void Initialize(string FilePath, bool ReplaceExisting, DisplayOrder DisplayOrder)
 {
     this.displayOrder = DisplayOrder;
     this.filePath     = FilePath;
     if (!File.Exists(FilePath))
     {
         ReplaceExisting = true;
     }
     if (this.unifiedReportSource == null)
     {
         if (ReplaceExisting)
         {
             lock (this.sourcelock)
             {
                 this.unifiedReportSource = UnifiedFramework.UnifiedReports.Source.UnifiedReportHtmlTemplate.GetSource();
             }
         }
         else
         {
             lock (this.sourcelock)
             {
                 this.unifiedReportSource = File.ReadAllText(FilePath);
             }
         }
         this.runInfo             = new RunInfo();
         this.runInfo.StartedTime = DateTime.Now;
         this.categoryList        = new AttributeList();
         this.mediaList           = new MediaList();
     }
 }
コード例 #6
0
ファイル: NUnit.cs プロジェクト: smartcaveman/reportunit
        private RunInfo CreateRunInfo(XDocument doc, Report report)
        {
            if (doc.Element("environment") == null)
            {
                return(null);
            }

            var runInfo = new RunInfo();

            runInfo.TestRunner = report.TestRunner;

            var env = doc.Descendants("environment").First();

            runInfo.Info.Add("Test Results File", _resultsFile);
            if (env.Attribute("nunit-version") != null)
            {
                runInfo.Info.Add("NUnit Version", env.Attribute("nunit-version").Value);
            }
            runInfo.Info.Add("Assembly Name", report.AssemblyName);
            runInfo.Info.Add("OS Version", env.Attribute("os-version").Value);
            runInfo.Info.Add("Platform", env.Attribute("platform").Value);
            runInfo.Info.Add("CLR Version", env.Attribute("clr-version").Value);
            runInfo.Info.Add("Machine Name", env.Attribute("machine-name").Value);
            runInfo.Info.Add("User", env.Attribute("user").Value);
            runInfo.Info.Add("User Domain", env.Attribute("user-domain").Value);

            return(runInfo);
        }
コード例 #7
0
        private void evaluateButton_Click(object sender, System.EventArgs e)
        {
            Uri url;

            try {
                url = new Uri(urlToHit.Text);
            } catch (UriFormatException) {
                statusBar.Text = "Invalid URL!";
                return;
            }
            statusBar.Text = "Fetching uncompressed...";

            RunInfo[] results = new RunInfo[2];

            results[0]     = FetchUncompressedUrl(url);
            statusBar.Text = "Fetching compressed...";

            if (deflateOption.Checked)
            {
                results[1] = FetchCompressedUrl(url, "deflate");
            }
            else
            {
                results[1] = FetchCompressedUrl(url, "gzip");
            }

            resultsList.DataSource = results;

            statusBar.Text = "Done!";
        }
コード例 #8
0
ファイル: Form1.cs プロジェクト: 1907931256/MasterProject
        void buildParmsFromValues()
        {
            try
            {
                meshSize    = .003;
                jetDiameter = .110;
                double nominalSurfaceSpeed = 50.0;
                double depthPerPass        = .005;
                int    runs          = 10;
                int    iterations    = 1;
                int    equationIndex = 4;
                double searchRadius  = jetDiameter * .1;

                var jet         = new AbMachJet(meshSize, jetDiameter, equationIndex);
                var runInfo     = new RunInfo(runs, iterations, ModelRunType.RunAsIs);
                var removalRate = new RemovalRate(nominalSurfaceSpeed, depthPerPass);
                var depthInfo   = new DepthInfo(new Vector3(.456, .8254, 0), DepthSearchType.FindAveDepth, searchRadius);
                var op          = AbMachOperation.ROCKETCHANNEL;
                var mat         = new Material(
                    MaterialType.Metal,
                    "Aluminum",
                    thickness: .25,
                    millMachinabilityIndex: 1,
                    cutMachinabilityIndex: 1,
                    criticalAngleRadians: Math.PI * 70.0 / 180);
                parms = AbMachParamBuilder.Build(op, runInfo, removalRate, mat, jet, depthInfo, meshSize);
                AbMachParametersFile.Save(parms, "params.xml");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #9
0
        public void SetUp()
        {
            _project = new Project(Path.GetFullPath("someProject.csproj"), new ProjectDocument(ProjectType.CSharp));
            _project.Value.SetOutputPath("");
            _project.Value.SetAssemblyName("someAssembly.dll");
            _bus                   = MockRepository.GenerateMock <IMessageBus>();
            _listGenerator         = MockRepository.GenerateMock <IGenerateBuildList>();
            _configuration         = MockRepository.GenerateMock <IConfiguration>();
            _buildRunner           = MockRepository.GenerateMock <IBuildRunner>();
            _testRunner            = MockRepository.GenerateMock <ITestRunner>();
            _testAssemblyValidator = MockRepository.GenerateMock <IDetermineIfAssemblyShouldBeTested>();
            _optimizer             = MockRepository.GenerateMock <IOptimizeBuildConfiguration>();
            _fs       = MockRepository.GenerateMock <IFileSystemService>();
            _cache    = MockRepository.GenerateMock <ICache>();
            _runCache = MockRepository.GenerateMock <IRunResultCache>();
            _runInfo  = new RunInfo(_project);
            _runInfo.ShouldBuild();
            _runInfo.SetAssembly(_project.Value.AssemblyName);
            _optimizer.Stub(o => o.AssembleBuildConfiguration(new string[] {})).IgnoreArguments().Return(new RunInfo[] { _runInfo });
            _preProcessor = MockRepository.GenerateMock <IPreProcessTestruns>();
            _preProcessor.Stub(x => x.PreProcess(null)).IgnoreArguments().Return(new PreProcessedTesRuns(null, new RunInfo[] { _runInfo }));
            var preProcessors     = new IPreProcessTestruns[] { _preProcessor };
            var buildPreProcessor = MockRepository.GenerateMock <IPreProcessBuildruns>();

            buildPreProcessor.Stub(x => x.PreProcess(null)).IgnoreArguments().Return(new RunInfo[] { _runInfo });
            var buildPreProcessors = new IPreProcessBuildruns[] { buildPreProcessor };

            _removedTestLocator = MockRepository.GenerateMock <ILocateRemovedTests>();
            _buildSessionRunner = new BuildSessionRunner(new BuildConfiguration(null), _cache, _bus, _configuration, _buildRunner, buildPreProcessors, _fs, _runCache);
            _consumer           = new ProjectChangeConsumer(_bus, _listGenerator, _configuration, _buildSessionRunner, new ITestRunner[] { _testRunner }, _testAssemblyValidator, _optimizer, preProcessors, _removedTestLocator);
        }
コード例 #10
0
        private Dictionary <string, string> CreateRunInfo(XDocument doc, Report report, string resultsFile)
        {
            var result = new Dictionary <string, string>();

            if (doc.Root.Element("environment") == null)
            {
                return(result);
            }

            var runInfo = new RunInfo
            {
                TestParser = TypeName
            };

            var env = doc.Descendants("environment").First();

            runInfo.Info.Add("Test Results File", resultsFile);

            if (env.Attribute("nunit-version") != null)
            {
                runInfo.Info.Add("NUnit Version", env.GetAttributeValueOrDefault("nunit-version"));
            }
            runInfo.Info.Add("Assembly Name", report.AssemblyName);
            runInfo.Info.Add("OS Version", env.GetAttributeValueOrDefault("os-version"));
            runInfo.Info.Add("Platform", env.GetAttributeValueOrDefault("platform"));
            runInfo.Info.Add("CLR Version", env.GetAttributeValueOrDefault("clr-version"));
            runInfo.Info.Add("Machine Name", env.GetAttributeValueOrDefault("machine-name"));
            runInfo.Info.Add("User", env.GetAttributeValueOrDefault("user"));
            runInfo.Info.Add("User Domain", env.GetAttributeValueOrDefault("user-domain"));

            return(runInfo.Info);
        }
コード例 #11
0
        private RunInfo getItem(string assemblyName)
        {
            var info = new RunInfo(null);

            info.SetAssembly(assemblyName);
            return(info);
        }
コード例 #12
0
        /// <summary>
        /// 現在の処理を実行する。
        /// </summary>
        private void RunCurrent()
        {
            var info = this.current;

            info.observable.Subscribe(
                // OnCompleted,OnErrorが呼ばれたタイミングで次のキューを呼べる状態にする
                info.responser.OnNext,
                async(ex) => {
                // リトライ可能例外が投げられた場合、リトライする
                if (ex is RetryableException)
                {
                    // FIXME: 即エラーではなく、確認ダイアログ用のイベントに通知する
                    if (++info.retry >= this.MaxRetry)
                    {
                        info.responser.OnError(ex.InnerException);
                        this.current = null;
                    }
                    else
                    {
                        await Task.Delay(this.Wait);
                        this.RunCurrent();
                    }
                }
                else
                {
                    info.responser.OnError(ex);
                    this.current = null;
                }
            },
                () => {
                info.responser.OnCompleted();
                this.current = null;
            });
        }
コード例 #13
0
        private RunInfo getRunInfo(Project x)
        {
            var info = new RunInfo(x);

            info.SetAssembly(x.GetAssembly(_configuration.CustomOutputPath));
            return(info);
        }
コード例 #14
0
        /// <summary>
        /// Generates a complete set of static/non-interactive run reports for offline analysis.
        /// </summary>
        internal static void GenerateXmlReport(TestRecords tests, RunInfo runInfo, DirectoryInfo reportRoot, DirectoryInfo testBinRoot)
        {
            Profiler.StartMethod();

            ReportingUtilities.CreateScorchedDirectory(reportRoot);

            CopyStyleSheets(reportRoot, testBinRoot);

            TestRecords executedTests;
            TestRecords filteredTests;

            SeparateExecutedTests(tests, out executedTests, out filteredTests);

            //Note: Summary Report may well be superceded by the more elaborate Run Report...
            SummaryReportGenerator.Generate(executedTests, reportRoot);
            MachineSummaryReportGenerator.Generate(executedTests, reportRoot);
            VariationReportGenerator.Generate(executedTests, reportRoot);
            DrtReportGenerator.Generate(executedTests, reportRoot);
            InfraTrackingReportGenerator.Generate(executedTests, reportRoot);
            RunReportGenerator.Generate(executedTests, runInfo, reportRoot);
            XUnitReportGenerator.Generate(executedTests, reportRoot);

            FilteringReportGenerator.Generate(filteredTests, reportRoot);

            Profiler.EndMethod();
        }
コード例 #15
0
ファイル: DiagNasos.cs プロジェクト: rj128x/EDSProject2019
 public void calcAvg()
 {
     StayInfo.calcAVG();
     RunInfo.calcAVG();
     VInfo.calcAVGV();
     sumTime = StayInfo.filtered.Sum() + RunInfo.filtered.Sum();;
 }
コード例 #16
0
        /// <summary>
        /// Called when a test message is received.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// Event args
        /// </param>
        internal void TestMessageHandler(object sender, TestRunMessageEventArgs e)
        {
            ValidateArg.NotNull(sender, "sender");
            ValidateArg.NotNull(e, "e");

            RunInfo runMessage;

            switch (e.Level)
            {
            case TestMessageLevel.Informational:
                this.AddRunLevelInformationalMessage(e.Message);
                break;

            case TestMessageLevel.Warning:
                runMessage = new RunInfo(e.Message, null, Environment.MachineName, TrxLoggerObjectModel.TestOutcome.Warning);
                this.runLevelErrorsAndWarnings.Add(runMessage);
                break;

            case TestMessageLevel.Error:
                this.testRunOutcome = TrxLoggerObjectModel.TestOutcome.Failed;
                runMessage          = new RunInfo(e.Message, null, Environment.MachineName, TrxLoggerObjectModel.TestOutcome.Error);
                this.runLevelErrorsAndWarnings.Add(runMessage);
                break;

            default:
                Debug.Fail("TrxLogger.TestMessageHandler: The test message level is unrecognized: {0}", e.Level.ToString());
                break;
            }
        }
コード例 #17
0
        private RunInfo getRunInfo(string key)
        {
            var info = new RunInfo(new Project(key, new ProjectDocument(ProjectType.CSharp)));

            info.ShouldBuild();
            return(info);
        }
コード例 #18
0
ファイル: MakeReportCommand.cs プロジェクト: dotnet/wpf-test
        /// <summary>
        /// Encapsulates logic for reporting results for non-interactive analysis.
        /// </summary>
        public override void Execute()
        {
            TestRecords tests   = TestRecords.Load(RunDirectory);
            RunInfo     runInfo = RunInfo.Load(RunDirectory);

            tests.GenerateXmlReport(tests, runInfo, ReportDirectory, TestBinariesDirectory);
        }
コード例 #19
0
        public void paramFile_openSavedFile_parmsOK()
        {
            double meshSize            = .005;
            double diameter            = .04;
            double nominalSurfaceSpeed = 40;
            double depthPerPass        = .001;
            int    runs          = 3;
            int    iterations    = 1;
            int    equationIndex = 2;

            var jet         = new AbMachJet(diameter, equationIndex);
            var runInfo     = new RunInfo(runs, iterations, ModelRunType.NewFeedrates);
            var removalRate = new RemovalRate(nominalSurfaceSpeed, depthPerPass);
            var depthInfo   = new DepthInfo(new GeometryLib.Vector3(1, 1, 0), DepthSearchType.FindAveDepth, diameter / 10);
            var op          = AbMachOperation.ROCKETCHANNEL;
            var mat         = new AWJModel.Material(AWJModel.MaterialType.Metal, "Aluminum", .25, 123, 456, 789, 143, 345, 543, 1);

            AbMachParameters parms    = AbMachParamBuilder.Build(op, runInfo, removalRate, mat, jet, depthInfo, meshSize);
            string           fileName = "paramSaveTest.prx";

            AbMachParametersFile.Save(parms, fileName);
            AbMachParameters parmsOpen = AbMachParametersFile.Open(fileName);

            Assert.AreEqual(parms.Material.CriticalRemovalAngle, parmsOpen.Material.CriticalRemovalAngle);
        }
コード例 #20
0
 private string getProject(RunInfo x)
 {
     if (x.TemporaryBuildProject != null)
     {
         return(x.TemporaryBuildProject);
     }
     return(x.Project.Key);
 }
コード例 #21
0
ファイル: C_OpExcelImport.cs プロジェクト: Huitingorg/Huiting
 public C_OpExcelImport(RunInfo curRunInfo, DataImportOpType curImportType, ExcelColumnMappingConfig curColumnConfig, DataSet curExcelFileData)
 {
     this.opSourceDB       = opSourceDB;
     this.curRunInfo       = curRunInfo;
     this.curColumnConfig  = curColumnConfig;
     this.curExcelFileData = curExcelFileData;
     this.curImportType    = curImportType;
 }
コード例 #22
0
 private void notifyAboutBuild(RunInfo info)
 {
     _bus.Publish(new RunInformationMessage(
                      InformationType.Build,
                      info.Project.Key,
                      info.Assembly,
                      typeof(MSBuildRunner)));
 }
コード例 #23
0
        /// <summary>
        /// Encapsulates logic of merging results.
        /// </summary>
        public override void Execute()
        {
            CodeCoverageUtilities.ValidateForCodeCoverage(CodeCoverage, CodeCoverageImport);
            TestRecords.Merge(RunDirectory, CodeCoverage, CodeCoverageImport);

            //Record the lab Run information at this stage. We assume homogeneous configuration.
            RunInfo.FromEnvironment().Save(RunDirectory);
        }
コード例 #24
0
        // 4 lines
        public RunInfo MakeRunInfo()
        {
            this.distance = Int32.Parse(textBoxDistance.Text);
            this.time     = TimeSpan.Parse(textBoxTime.Text);
            RunInfo runInfoInvoer = new RunInfo(distance, time);

            return(runInfoInvoer);
        }
コード例 #25
0
ファイル: LabReportGenerator.cs プロジェクト: dotnet/wpf-test
 private static void AppendPaths(XmlTableWriter tableWriter, RunInfo runInfo, DirectoryInfo reportRoot)
 {
     tableWriter.WriteStartElement("Paths");
     tableWriter.WriteKeyValuePair("Results", reportRoot.FullName);
     tableWriter.WriteKeyValuePair("Build Location:", runInfo.InstallerPath);
     tableWriter.WriteKeyValuePair("Test Build Path", runInfo.TestBinariesPath);
     tableWriter.WriteEndElement();
 }
コード例 #26
0
ファイル: AIPlayer.cs プロジェクト: garf0134/ticattack
    /// <summary>
    /// Set each direction of each tile to the number of consecutive tiles
    /// available in that direction
    /// </summary>
    /// <param name="b">The board that all tiles belong to</param>
    /// <param name="runs">The two dimensional array corresponding to a board's tile layout.</param>
    private void InitializeRuns(Board b, RunInfo[,] runs)
    {
        // Handle vertical and horizontal runs
        for (int r = 0; r < b.rows; r++)
        {
            for (int c = 0; c < b.cols; c++)
            {
                runs[r, c] = new RunInfo();
                runs[r, c].run[(int)Board.Direction.Horizontal] = b.rows;
                runs[r, c].run[(int)Board.Direction.Vertical]   = b.cols;
                runs[r, c].tile        = b[r, c];
                b[r, c].OnPiecePlaced += OnPiecePlaced;
            }
        }

        // Handle diagonals runs from the left side
        for (int r = 0; r < b.rows; r++)
        {
            int c = 0, k = r;
            int sum = 0;
            while (k-- >= 0 && c++ < b.cols)
            {
                sum++;
            }
            c = 0;
            k = r;
            while (k >= 0 && c < b.cols)
            {
                runs[k, c].run[(int)Board.Direction.Diagonal_BottomUp]             = sum;
                runs[b.rows - k - 1, c].run[(int)Board.Direction.Diagonal_TopDown] = sum;
                k--;
                c++;
            }
        }

        // Handle diagonal runs from the bottom edge
        for (int c = 0; c < b.cols; c++)
        {
            int r   = b.rows - 1;
            int k   = c;
            int sum = 0;
            while (r-- >= 0 && k++ < b.cols)
            {
                sum++;
            }

            r = b.rows - 1;
            k = c;
            while (r >= 0 && k < b.cols)
            {
                runs[r, k].run[(int)Board.Direction.Diagonal_BottomUp]             = sum;
                runs[b.rows - r - 1, k].run[(int)Board.Direction.Diagonal_TopDown] = sum;
                k++;
                r--;
            }
        }
    }
コード例 #27
0
 public RunInfo[] GetRunInfoForPastThirtyDays()
 {
     RunInfo[] info = new RunInfo[30];
     for (int i = info.Length; i > 0; i--)
     {
         info[i - 1] = GetRunInfoForDate(CurrentDate.AddDays(-(30 - i)));
     }
     return(info);
 }
コード例 #28
0
 public RunInfo[] GetRunInfoForPastSevenDays()
 {
     RunInfo[] info = new RunInfo[7];
     for (int i = info.Length; i > 0; i--)
     {
         info[i - 1] = GetRunInfoForDate(CurrentDate.AddDays(-(7 - i)));
     }
     return(info);
 }
コード例 #29
0
        /// <summary>
        /// キューに処理を登録する。
        /// </summary>
        /// <typeparam name="T">処理の戻り値型。</typeparam>
        /// <param name="observable">登録する非同期処理。</param>
        /// <returns>処理結果を受け取るためのObservable。</returns>
        /// <remarks>
        /// Subscribeのタイミングで起動するCold Observableである必要があります。
        /// OnCompletedしないものは処理が終わらないため実行できません。
        /// </remarks>
        public IObservable <T> Enqueue <T>(IObservable <T> observable)
        {
            var info = new RunInfo();

            info.observable = (IObservable <object>)observable;
            info.responser  = new Subject <object>();
            this.queue.Enqueue(info);
            return(info.responser.Select((res) => (T)res));
        }
コード例 #30
0
 /// <summary>
 /// 构造函数
 /// </summary>
 private LoginWork()
 {
     //临时这样写,后续改到配置文件中
     runinfo          = new RunInfo();
     runinfo.Url      = ConfigurationManager.AppSettings["server.url"];
     runinfo.Username = ConfigurationManager.AppSettings["server.Username"];
     runinfo.Pwd      = ConfigurationManager.AppSettings["server.Pwd"];
     runinfo.Key01    = ConfigurationManager.AppSettings["server.Key01"];
 }
コード例 #31
0
        public SarifLogger(
            string outputFilePath,
            bool verbose,
            IEnumerable<string> analysisTargets,
            bool computeTargetsHash)
        {
            Verbose = verbose;

            _fileStream = new FileStream(outputFilePath, FileMode.Create, FileAccess.Write, FileShare.None);
            _textWriter = new StreamWriter(_fileStream);
            _jsonTextWriter = new JsonTextWriter(_textWriter);

            // for debugging it is nice to have the following line added.
            _jsonTextWriter.Formatting = Newtonsoft.Json.Formatting.Indented;

            _issueLogJsonWriter = new IssueLogJsonWriter(_jsonTextWriter);

            Version version = this.GetType().Assembly.GetName().Version;
            ToolInfo toolInfo = new ToolInfo();
            toolInfo.ToolName = "BinSkim";
            toolInfo.ProductVersion = version.Major.ToString() + "." + version.Minor.ToString();
            toolInfo.FileVersion = version.ToString();
            toolInfo.FullVersion = toolInfo.ProductVersion + " beta pre-release";

            RunInfo runInfo = new RunInfo();
            runInfo.AnalysisTargets = new List<FileReference>();

            foreach (string target in analysisTargets)
            {
                var fileReference = new FileReference()
                {
                    Uri = target.CreateUriForJsonSerialization(),
                };

                if (computeTargetsHash)
                {
                    string sha256Hash = PE.ComputeSha256Hash(target) ?? "[could not compute file hash]";
                    fileReference.Hashes = new List<Hash>(new Hash[]
                    {
                            new Hash()
                            {
                                Value = sha256Hash,
                                Algorithm = "SHA-256",
                            }
                    });
                }
                runInfo.AnalysisTargets.Add(fileReference);
            }
            _issueLogJsonWriter.WriteToolAndRunInfo(toolInfo, runInfo);
        }
コード例 #32
0
        public ResultLogger(
            Assembly assembly, 
            string outputFilePath,
            bool verbose,
            IEnumerable<string> analysisTargets,
            bool computeTargetsHash,
            string prereleaseInfo)
        {
            Verbose = verbose;

            _fileStream = new FileStream(outputFilePath, FileMode.Create, FileAccess.Write, FileShare.None);
            _textWriter = new StreamWriter(_fileStream);
            _jsonTextWriter = new JsonTextWriter(_textWriter);

            // for debugging it is nice to have the following line added.
            _jsonTextWriter.Formatting = Newtonsoft.Json.Formatting.Indented;

            _issueLogJsonWriter = new ResultLogJsonWriter(_jsonTextWriter);

            var toolInfo = new ToolInfo();
            toolInfo.InitializeFromAssembly(assembly, prereleaseInfo);

            RunInfo runInfo = new RunInfo();
            runInfo.AnalysisTargets = new List<FileReference>();

            foreach (string target in analysisTargets)
            {
                var fileReference = new FileReference()
                {
                    Uri = target.CreateUriForJsonSerialization(),
                };

                if (computeTargetsHash)
                {
                    string sha256Hash = HashUtilities.ComputeSha256Hash(target) ?? "[could not compute file hash]";
                    fileReference.Hashes = new List<Hash>(new Hash[]
                    {
                            new Hash()
                            {
                                Value = sha256Hash,
                                Algorithm = AlgorithmKind.Sha256,
                            }
                    });
                }
                runInfo.AnalysisTargets.Add(fileReference);
            }
            runInfo.InvocationInfo = Environment.CommandLine;

            _issueLogJsonWriter.WriteToolAndRunInfo(toolInfo, runInfo);
        }
コード例 #33
0
ファイル: MainForm.cs プロジェクト: shahr00z/HttpCompress
 RunInfo FetchUncompressedUrl(Uri url)
 {
     RunInfo ri = new RunInfo();
       HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
       request.UserAgent = userAgentToUse.Text;
       DateTime start = DateTime.Now;
       HttpWebResponse response = (HttpWebResponse)request.GetResponse();
       ri.TimeToFirstByte = DateTime.Now - start;
       ri.BytesReceived = DumpStream(response.GetResponseStream(), Stream.Null);
       ri.TimeToLastByte = DateTime.Now - start;
       return ri;
 }
コード例 #34
0
ファイル: MainForm.cs プロジェクト: shahr00z/HttpCompress
        private void evaluateButton_Click(object sender, System.EventArgs e)
        {
            Uri url;
              try {
            url = new Uri(urlToHit.Text);
              } catch(UriFormatException) {
            statusBar.Text = "Invalid URL!";
            return;
              }
              statusBar.Text = "Fetching uncompressed...";

              RunInfo[] results = new RunInfo[2];

              results[0] = FetchUncompressedUrl(url);
              statusBar.Text = "Fetching compressed...";

              if(deflateOption.Checked)
            results[1] = FetchCompressedUrl(url, "deflate");
              else
            results[1] = FetchCompressedUrl(url, "gzip");

              resultsList.DataSource = results;

              statusBar.Text = "Done!";
        }
コード例 #35
0
ファイル: MainForm.cs プロジェクト: shahr00z/HttpCompress
 RunInfo FetchCompressedUrl(Uri url, string algo)
 {
     RunInfo ri = new RunInfo(algo);
       HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
       request.Headers["Accept-Encoding"] = algo;
       request.UserAgent = userAgentToUse.Text;
       DateTime start = DateTime.Now;
       HttpWebResponse response = (HttpWebResponse)request.GetResponse();
       ri.TimeToFirstByte = DateTime.Now - start;
       ri.BytesReceived = DumpStream(response.GetResponseStream(), Stream.Null);
       ri.TimeToLastByte = DateTime.Now - start;
       return ri;
 }
コード例 #36
0
ファイル: RunFinder.cs プロジェクト: ricksladkey/Spider
        public void Find(Tableau tableau)
        {
            this.tableau = tableau;

            int n = tableau.NumberOfPiles;
            for (int column = 0; column < n; column++)
            {
                Pile pile = tableau[column];
                PileInfo pileInfo = pileInfoArray[column];
                int m = pile.Count;
                pileInfo.Count = m;
                pileInfo.RunInfoArray[m] = new RunInfo(m, m, 0);
                if (m == 0)
                {
                    pileInfo.RunUpAnySuitStart = 0;
                    pileInfo.RunUpAnySuitLength = 0;
                    continue;
                }
                if (m == 1)
                {
                    pileInfo.RunUpAnySuitStart = 0;
                    pileInfo.RunUpAnySuitLength = 1;
                    pileInfo.RunInfoArray[0] = new RunInfo(0, 1, 1);
                    continue;
                }

                RunInfo[] runInfoArray = pileInfo.RunInfoArray;
                int startRow = m - 1;
                int endRow = m;
                int suits = 1;
                Card previousCard = pile[endRow - 1];
                for (int currentRow = m - 2; currentRow >= 0; currentRow--)
                {
                    Card currentCard = pile[currentRow];
                    if (!currentCard.IsTargetFor(previousCard))
                    {
                        break;
                    }
                    if (currentCard.Suit == previousCard.Suit)
                    {
                        startRow = currentRow;
                    }
                    else
                    {
                        RunInfo runInfo = new RunInfo(startRow, endRow, suits);
                        for (int row = startRow; row < endRow; row++)
                        {
                            runInfoArray[row] = runInfo;
                        }
                        startRow = currentRow;
                        endRow = currentRow + 1;
                        suits++;
                    }
                    previousCard = currentCard;
                }
                {
                    RunInfo runInfo = new RunInfo(startRow, endRow, suits);
                    for (int row = startRow; row < endRow; row++)
                    {
                        runInfoArray[row] = runInfo;
                    }
                }
                pileInfo.RunUpAnySuitStart = startRow;
                pileInfo.RunUpAnySuitLength = m - startRow;
            }
        }
コード例 #37
0
        /// <summary>
        /// Write the sarif RunInfo to the log.
        /// </summary>
        /// <param name="invocationInfo"></param>
        public static void TraceRunInfo(string invocationInfo)
        {
            Assembly entryAssembly = Assembly.GetEntryAssembly();

            RunInfo runInfo = new RunInfo();
            runInfo.InvocationInfo = invocationInfo;

            string json = runInfo.ToJson();

            StatusTrace.TraceInformation("NG909", json);
        }
コード例 #38
0
        internal void Terminate(List<ExtentTest> TestList)
        {
            if (TestList != null)
            {
                foreach (ExtentTest t in TestList)
                {
                    if (!t.GetTest().HasEnded)
                    {
                        t.GetTest().InternalWarning = "Test did not end safely because endTest() was not called. There may be errors.";
                        AddTest(t.GetTest());
                    }
                }
            }

            WriteAllResources(null, null);

            extentSource = "";
            categoryList = null;
            runInfo = null;

            terminated = true;
        }
コード例 #39
0
        internal void Initialize(string FilePath, bool ReplaceExisting, DisplayOrder DisplayOrder)
        {
            this.displayOrder = DisplayOrder;
            this.filePath = FilePath;

            if (!File.Exists(FilePath))
            {
                ReplaceExisting = true;
            }

            if (extentSource != null)
            {
                return;
            }

            if (ReplaceExisting)
            {
                lock (sourcelock)
                {
                    extentSource = Standard.GetSource();
                }
            }
            else
            {
                lock (sourcelock)
                {
                    extentSource = File.ReadAllText(FilePath);
                }
            }

            runInfo = new RunInfo();
            runInfo.StartedTime = DateTime.Now;

            categoryList = new AttributeList();
            mediaList = new MediaList();
        }