Files
codeql/csharp/ql/test/utils/modelgenerator/dataflow/Sources.cs
2024-06-19 14:10:52 +02:00

68 lines
2.0 KiB
C#

using System;
namespace Sources;
public class NewSources
{
// New source
// source=Sources;NewSources;false;WrapConsoleReadLine;();;ReturnValue;local;df-generated
// neutral=Sources;NewSources;WrapConsoleReadLine;();summary;df-generated
public string? WrapConsoleReadLine()
{
return Console.ReadLine();
}
// New source
// source=Sources;NewSources;false;WrapConsoleReadLineAndProcees;(System.String);;ReturnValue;local;df-generated
// neutral=Sources;NewSources;WrapConsoleReadLineAndProcees;(System.String);summary;df-generated
public string WrapConsoleReadLineAndProcees(string prompt)
{
var s = Console.ReadLine();
return string.IsNullOrEmpty(s) ? "" : s.ToUpper();
}
// NOT new source as method is private
private string? PrivateWrapConsoleReadLine()
{
return Console.ReadLine();
}
// New source
// source=Sources;NewSources;false;WrapConsoleReadKey;();;ReturnValue;local;df-generated
// neutral=Sources;NewSources;WrapConsoleReadKey;();summary;df-generated
public ConsoleKeyInfo WrapConsoleReadKey()
{
return Console.ReadKey();
}
// Not a new source because a simple type is used in an intermediate step
// neutral=Sources;NewSources;WrapConsoleReadLineGetBool;();summary;df-generated
public bool WrapConsoleReadLineGetBool()
{
var s = Console.ReadLine();
return s == "hello";
}
public class MyConsoleReader
{
// source=Sources;NewSources+MyConsoleReader;false;ToString;();;ReturnValue;local;df-generated
// neutral=Sources;NewSources+MyConsoleReader;ToString;();summary;df-generated
public override string ToString()
{
return Console.ReadLine();
}
}
public class MyContainer<T>
{
public T Value { get; set; }
// summary=Sources;NewSources+MyContainer<T>;false;Read;();;Argument[this];ReturnValue;taint;df-generated
public string Read()
{
return Value.ToString();
}
}
}