Here are the examples of the csharp api System.Console.WriteLine(int) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1106 Examples
19
View Source File : generic_types.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var _mocker = new AutoMocker();
var i = 0;
_mocker.Setup<ITestInterface>(x => x.Do(It.IsAny<int>())).Callback<int>(item => i++);
Console.WriteLine(i);
}
19
View Source File : no_types.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var _mocker = new AutoMocker();
var count = 0;
_mocker.Setup<ITestInterface, int>(x => x.BuildSomething(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<bool>()))
.Returns(0)
.Callback<int, string, bool>((i, s, arg3) => count += i);
Console.WriteLine(count);
}
19
View Source File : typeCountMismatch_return_after.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var _mocker = new AutoMocker();
var count = 0;
_mocker.Setup<ITestInterface, int>(x => x.BuildSomething(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<bool>()))
.Callback<int, string>((i, s, arg3) => count += i)
.Returns(0);
Console.WriteLine(count);
}
19
View Source File : typeCountMismatch_return_before.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var _mocker = new AutoMocker();
var count = 0;
_mocker.Setup<ITestInterface, int>(x => x.BuildSomething(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<bool>()))
.Returns(0)
.Callback<int, string>((i, s, arg3) => count += i);
Console.WriteLine(count);
}
19
View Source File : typeMismatch_generic.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var _mocker = new AutoMocker();
var i = 0;
_mocker.Setup<ITestInterface>(x => x.Do(It.IsAny<TheClreplaced>())).Callback<int>(item => i++);
Console.WriteLine(i);
}
19
View Source File : typeMismatch_return_after.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var _mocker = new AutoMocker();
var count = 0;
_mocker.Setup<ITestInterface, int>(x => x.BuildSomething(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<bool>()))
.Callback<int, string, string>((i, s, arg3) => count += i)
.Returns(0);
Console.WriteLine(count);
}
19
View Source File : typeMismatch_return_before.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var _mocker = new AutoMocker();
var count = 0;
_mocker.Setup<ITestInterface, int>(x => x.BuildSomething(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<bool>()))
.Returns(0)
.Callback<int, string, string>((i, s, arg3) => count += i);
Console.WriteLine(count);
}
19
View Source File : generic_types.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var temp = new Mock<ITestInterface>();
var i = 0;
temp.Setup(x => x.Do(It.IsAny<int>())).Callback<int>(item => i++);
Console.WriteLine(i);
}
19
View Source File : no_types.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var mock = new Mock<ITestInterface>();
var count = 0;
mock.Setup(x => x.BuildSomething(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<bool>()))
.Returns(0)
.Callback<int, string, bool>((i, s, arg3) => count += i);
Console.WriteLine(count);
}
19
View Source File : typeCountMismatch_return_after.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var mock = new Mock<ITestInterface>();
var count = 0;
mock.Setup(x => x.BuildSomething(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<bool>()))
.Callback<int, string>((i, s, arg3) => count += i)
.Returns(0);
Console.WriteLine(count);
}
19
View Source File : typeCountMismatch_return_before.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var mock = new Mock<ITestInterface>();
var count = 0;
mock.Setup(x => x.BuildSomething(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<bool>()))
.Returns(0)
.Callback<int, string>((i, s, arg3) => count += i);
Console.WriteLine(count);
}
19
View Source File : typeMismatch_generic.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var temp = new Mock<ITestInterface>();
var i = 0;
temp.Setup(x => x.Do(It.IsAny<TheClreplaced>())).Callback<int>(item => i++);
Console.WriteLine(i);
}
19
View Source File : typeMismatch_return_after.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var mock = new Mock<ITestInterface>();
var count = 0;
mock.Setup(x => x.BuildSomething(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<bool>()))
.Callback<int, string, string>((i, s, arg3) => count += i)
.Returns(0);
Console.WriteLine(count);
}
19
View Source File : typeMismatch_return_before.cs
License : MIT License
Project Creator : Abc-Arbitrage
License : MIT License
Project Creator : Abc-Arbitrage
public void METHOD()
{
var mock = new Mock<ITestInterface>();
var count = 0;
mock.Setup(x => x.BuildSomething(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<bool>()))
.Returns(0)
.Callback<int, string, string>((i, s, arg3) => count += i);
Console.WriteLine(count);
}
19
View Source File : Program.cs
License : MIT License
Project Creator : adamtiger
License : MIT License
Project Creator : adamtiger
public static void Main(string[] args)
{
// Keras speed with the same: 60 ms.
/*ReaderKerasModel reader = new ReaderKerasModel("test_cnn_model.json");
SequentialModel model = reader.GetSequentialExecutor();
Console.WriteLine((model.GetSummary() as SequentialModelData).GetStringRepresentation());
Console.ReadKey();
int[] idx = { 1,2,3};
Console.WriteLine(idx[1]);
Console.ReadKey();*/
// Convolution layer example
/*Conv2DLayer layer = new Conv2DLayer(0, 0, 1, 1);
Data2D input = new Data2D(6, 5, 3, 1);
input[0, 0, 0, 0] = 1; input[0, 1, 0, 0] = 2; input[0, 2, 0, 0] = 2; input[0, 3, 0, 0] = 1; input[0, 4, 0, 0] = 4;
input[1, 0, 0, 0] = 3; input[1, 1, 0, 0] = 1; input[1, 2, 0, 0] = 0; input[1, 3, 0, 0] = 2; input[1, 4, 0, 0] = 1;
input[2, 0, 0, 0] = 0; input[2, 1, 0, 0] = 2; input[2, 2, 0, 0] = 2; input[2, 3, 0, 0] = 5; input[2, 4, 0, 0] = 2;
input[3, 0, 0, 0] = 6; input[3, 1, 0, 0] = -2; input[3, 2, 0, 0] = -1; input[3, 3, 0, 0] = 3; input[3, 4, 0, 0] = 1;
input[4, 0, 0, 0] = 2; input[4, 1, 0, 0] = 1; input[4, 2, 0, 0] = 2; input[4, 3, 0, 0] = 4; input[4, 4, 0, 0] = 0;
input[5, 0, 0, 0] = 5; input[5, 1, 0, 0] = -3; input[5, 2, 0, 0] = -1; input[5, 3, 0, 0] = -4; input[5, 4, 0, 0] = 0;
input[0, 0, 1, 0] = 2; input[0, 1, 1, 0] = 0; input[0, 2, 1, 0] = 2; input[0, 3, 1, 0] = -1; input[0, 4, 1, 0] = 3;
input[1, 0, 1, 0] = 2; input[1, 1, 1, 0] = 5; input[1, 2, 1, 0] = -1; input[1, 3, 1, 0] = 3; input[1, 4, 1, 0] = 5;
input[2, 0, 1, 0] = 1; input[2, 1, 1, 0] = 1; input[2, 2, 1, 0] = 1; input[2, 3, 1, 0] = 0; input[2, 4, 1, 0] = 1;
input[3, 0, 1, 0] =-3; input[3, 1, 1, 0] = 2; input[3, 2, 1, 0] = -1; input[3, 3, 1, 0] = 4; input[3, 4, 1, 0] = 1;
input[4, 0, 1, 0] = 2; input[4, 1, 1, 0] = 1; input[4, 2, 1, 0] = 2; input[4, 3, 1, 0] = 2; input[4, 4, 1, 0] = 1;
input[5, 0, 1, 0] = 0; input[5, 1, 1, 0] = -3; input[5, 2, 1, 0] = 1; input[5, 3, 1, 0] = -2; input[5, 4, 1, 0] =-1;
input[0, 0, 2, 0] = 4; input[0, 1, 2, 0] = 5; input[0, 2, 2, 0] = 0; input[0, 3, 2, 0] =-1; input[0, 4, 2, 0] =-3;
input[1, 0, 2, 0] = 2; input[1, 1, 2, 0] = 3; input[1, 2, 2, 0] = 1; input[1, 3, 2, 0] = 6; input[1, 4, 2, 0] = 0;
input[2, 0, 2, 0] = 0; input[2, 1, 2, 0] =-4; input[2, 2, 2, 0] =-3; input[2, 3, 2, 0] =-2; input[2, 4, 2, 0] =-4;
input[3, 0, 2, 0] = 4; input[3, 1, 2, 0] = 2; input[3, 2, 2, 0] = 1; input[3, 3, 2, 0] = 0; input[3, 4, 2, 0] = 4;
input[4, 0, 2, 0] = 3; input[4, 1, 2, 0] = 3; input[4, 2, 2, 0] = 0; input[4, 3, 2, 0] = 1; input[4, 4, 2, 0] = 1;
input[5, 0, 2, 0] =-2; input[5, 1, 2, 0] = 1; input[5, 2, 2, 0] = 1; input[5, 3, 2, 0] = 0; input[5, 4, 2, 0] = 5;
Data2D kernel = new Data2D(3, 3, 3, 1);
kernel[0, 0, 0, 0] = 1; kernel[0, 1, 0, 0] = 1; kernel[0, 2, 0, 0] = 0;
kernel[1, 0, 0, 0] = 2; kernel[1, 1, 0, 0] = 0; kernel[1, 2, 0, 0] = 0;
kernel[2, 0, 0, 0] = 1; kernel[2, 1, 0, 0] = 2; kernel[2, 2, 0, 0] = 1;
kernel[0, 0, 1, 0] = 3; kernel[0, 1, 1, 0] = 1; kernel[0, 2, 1, 0] =-1;
kernel[1, 0, 1, 0] = 2; kernel[1, 1, 1, 0] =-1; kernel[1, 2, 1, 0] =-2;
kernel[2, 0, 1, 0] = 0; kernel[2, 1, 1, 0] = 1; kernel[2, 2, 1, 0] = 2;
kernel[0, 0, 2, 0] = 0; kernel[0, 1, 2, 0] = 1; kernel[0, 2, 2, 0] = 1;
kernel[1, 0, 2, 0] =-1; kernel[1, 1, 2, 0] = 2; kernel[1, 2, 2, 0] = 1;
kernel[2, 0, 2, 0] = 3; kernel[2, 1, 2, 0] = 0; kernel[2, 2, 2, 0] = 1;
layer.SetWeights(kernel);
layer.SetInput(input);
layer.Execute();
Data2D output = layer.GetOutput() as Data2D;*/
// Trying the binding functions.
IntPtr ptr = NativeFunctions.create_tensor_integer(5);
int v = NativeFunctions.tensor_integer_get(ptr, 0);
Console.WriteLine(v);
}
19
View Source File : StatisticsPlugin.cs
License : GNU General Public License v2.0
Project Creator : afrantzis
License : GNU General Public License v2.0
Project Creator : afrantzis
void OnMotionNotify(object o, MotionNotifyEventArgs args)
{
Gdk.EventMotion e = args.Event;
int x, y;
Gdk.ModifierType state;
if (e.IsHint)
this.GdkWindow.GetPointer(out x, out y, out state);
else {
x = (int)e.X;
y = (int)e.Y;
state = e.State;
}
Gdk.Rectangle alloc = this.Allocation;
//Console.WriteLine("x {0} freq {1} width{2}", x, freqWidth, alloc.Width);
currentHighlight = (int)((x / (freqWidth * alloc.Width))) + 1;
Console.WriteLine(currentHighlight);
if (previousHighlight != currentHighlight) {
UpdateHighlight();
previousHighlight = currentHighlight;
}
}
19
View Source File : MainWindow.cs
License : GNU General Public License v3.0
Project Creator : aglab2
License : GNU General Public License v3.0
Project Creator : aglab2
private void MainWindow_Resize(object sender, EventArgs e)
{
Console.WriteLine(this.Width);
if (starPicture != null)
starPicture.Width = this.Width;
if (gm != null)
{
gm.Width = Width;
gm.InvalidateCache();
}
}
19
View Source File : Program.cs
License : Apache License 2.0
Project Creator : akarnokd
License : Apache License 2.0
Project Creator : akarnokd
static void Main(string[] args)
{
for (var j = 0; j < 100000; j++)
{
if (j % 10 == 0)
{
Console.WriteLine(j);
}
var list = TimeSequence(0, 200, 400, 600)
.ConcatMapEager(v => AsyncEnumerable.Timer(TimeSpan.FromMilliseconds(100)))
.Take(1)
.GetAsyncEnumerator(default);
try
{
if (!list.MoveNextAsync().Result)
{
Console.WriteLine("Empty?");
}
if (list.Current != 0)
{
Console.WriteLine(list.Current);
Console.ReadLine();
break;
}
}
finally
{
list.DisposeAsync().AsTask().Wait();
}
}
}
19
View Source File : FlowableSampleTest.cs
License : Apache License 2.0
Project Creator : akarnokd
License : Apache License 2.0
Project Creator : akarnokd
[Test]
[Timeout(10000)]
public void Normal()
{
Flowable.Interval(TimeSpan.FromMilliseconds(2))
.Map(v => {
Console.WriteLine(1);
return 1;
})
.Sample(TimeSpan.FromMilliseconds(10))
.Take(10)
.Test()
.AwaitCount(10, () => Thread.Sleep(10), TimeSpan.FromSeconds(5))
.ThenCancel()
.replacedertValues(1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.replacedertNoError();
}
19
View Source File : SampleLauncher.cs
License : MIT License
Project Creator : AliakseiFutryn
License : MIT License
Project Creator : AliakseiFutryn
static void Main(string[] args)
{
ReversContainer<int> reversContainer = new ReversContainer<int>(3);
reversContainer.Add(1);
reversContainer.Add(2);
reversContainer.Add(3);
foreach (int value in reversContainer)
{
Console.WriteLine(value);
}
Console.ReadKey();
}
19
View Source File : Program.cs
License : GNU General Public License v3.0
Project Creator : Alois-xx
License : GNU General Public License v3.0
Project Creator : Alois-xx
static void StartReg(string cmdLine)
{
var proc = new ProcessStartInfo("reg.exe", cmdLine)
{
UseShellExecute = false,
RedirectStandardOutput = true,
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true
};
var p = Process.Start(proc);
Console.WriteLine($"Reg.exe Output from command {cmdLine}");
Console.WriteLine(p.StandardOutput.Read());
p.WaitForExit();
}
19
View Source File : MainTest.cs
License : GNU General Public License v3.0
Project Creator : AminEsmaeily
License : GNU General Public License v3.0
Project Creator : AminEsmaeily
[Description]
public void MainMethod()
{
//// Local clreplaced
MethodWithoutReturnValue(); // Should be ommitted, because of the clreplaced attribute
Console.WriteLine(MethodWithReturnValue()); // Expression Statement
var value1 = MethodWithReturnValue(); // Local Declaration Statement
try
{
if (MethodWithReturnValue() == 10) // If Statement
{
}
}
catch (ArgumentException)
{
}
while(MethodWithReturnValue() == 5) // While Statement
{ }
//////////////////////
//// Direct Clreplaced
var directClreplaced = new DirectClreplaced();
directClreplaced.MethodWithoutReturnValue(); // Should be ommitted, because of the method attribute
directClreplaced.MethodWithReturnValue();
//////////////////////
// Interface based
IInterfaceBased interfaceBased = new InterfaceBased();
interfaceBased.MethodWithoutReturnValue();
try
{
interfaceBased.MethodWithReturnValue();
}
catch (System.ArgumentOutOfRangeException)
{
}
//////////////////////
// Abstract based
AAbstractBased abstractBased = new AbstractBased();
abstractBased.MethodWithoutReturnValue();
abstractBased.MethodWithReturnValue();
abstractBased.MethodToHide();
//////////////////////
}
19
View Source File : Program.cs
License : MIT License
Project Creator : anastasios-stamoulis
License : MIT License
Project Creator : anastasios-stamoulis
List<string> download_and_read_lines() {
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
var url_format = "https://www.bgc-jena.mpg.de/wetter/mpi_roof_{0}{1}.zip";
var csv_filepaths = new List<string>();
// step 1: download .zip files, and extract them to .csv files
for (int year = 2009; year < 2017; year++) {
foreach (var c in new char[] { 'a', 'b' }) {
var url = String.Format(url_format, year, c);
var zip_filepath = url.Split(new char[] { '/' }).Last();
zip_filepath = Util.fullpathForDownloadedFile("roof_data", zip_filepath);
var csv_filepath = zip_filepath.Replace(".zip", ".csv");
if (System.IO.File.Exists(csv_filepath)) {
csv_filepaths.Add(csv_filepath);
continue;
}
if (System.IO.File.Exists(zip_filepath) == false) {
var success = FromStackOverflow.FileDownloader.DownloadFile(url, zip_filepath, timeoutInMilliSec: 360000);
if (!success) {
Console.WriteLine("Could not download " + url);
continue;
}
}
var basepath = System.IO.Path.GetDirectoryName(zip_filepath);
System.IO.Compression.ZipFile.ExtractToDirectory(zip_filepath, basepath);
csv_filepaths.Add(csv_filepath);
}
}
// step 2: read all .csv files, skipping the first line
var all_lines = new List<string>();
foreach (var csv_filepath in csv_filepaths) {
var file_lines = System.IO.File.ReadAllLines(csv_filepath);
for (int i = 1; i < file_lines.Length; i++) {
var comma_pos = file_lines[i].IndexOf(',');
all_lines.Add(file_lines[i].Substring(comma_pos + 1));
}
}
Console.WriteLine(all_lines.Count);
return all_lines;
}
19
View Source File : Stackflow.cs
License : The Unlicense
Project Creator : Anirban166
License : The Unlicense
Project Creator : Anirban166
static void excep(int value)
{
Console.WriteLine(value);
excep(++value);
}
19
View Source File : IList.cs
License : The Unlicense
Project Creator : Anirban166
License : The Unlicense
Project Creator : Anirban166
static void Display(IList<int> list)
{
Console.WriteLine("Count: {0}", list.Count);
foreach (int num in list)
{
Console.WriteLine(num);
}
}
19
View Source File : Lock.cs
License : The Unlicense
Project Creator : Anirban166
License : The Unlicense
Project Creator : Anirban166
static void TEST()
{
lock (_object)
{
Thread.Sleep(100);
Console.WriteLine(Environment.TickCount);
}
}
19
View Source File : DivideByZero.cs
License : The Unlicense
Project Creator : Anirban166
License : The Unlicense
Project Creator : Anirban166
static void Main()
{
try
{
int result = 15 / int.Parse("0");
Console.WriteLine(result);
}
catch (DivideByZeroException e)
{
Console.Write(e.Message);
Console.ReadLine();
}
}
19
View Source File : Program.cs
License : MIT License
Project Creator : AnkitSharma-007
License : MIT License
Project Creator : AnkitSharma-007
internal static void FindthirdLargeInArray(int[] arr)
{
int max1 = int.MinValue;
int max2 = int.MinValue;
int max3 = int.MinValue;
foreach (int i in arr)
{
if (i > max1)
{
max3 = max2;
max2 = max1;
max1 = i;
}
else if (i > max2)
{
max3 = max2;
max2 = i;
}
else if (i > max3)
{
max3 = i;
}
}
Console.WriteLine(max3); ;
}
19
View Source File : Program.cs
License : MIT License
Project Creator : AnkitSharma-007
License : MIT License
Project Creator : AnkitSharma-007
internal static void SumOfDigits(int num)
{
/* input:- 168 ; output:- 15
*
* */
int sum = 0;
while (num > 0)
{
sum += num % 10;
num /= 10;
}
Console.WriteLine(sum);
}
19
View Source File : Program.cs
License : MIT License
Project Creator : AnkitSharma-007
License : MIT License
Project Creator : AnkitSharma-007
internal static void FindSecondLargeInArray(int[] arr)
{
/* input :- 1 2 3 4 5 output :- 4
* */
int max1 = int.MinValue;
int max2 = int.MinValue;
foreach (int i in arr)
{
if (i > max1)
{
max2 = max1;
max1 = i;
}
else if (i > max2)
{
max2 = i;
}
}
Console.WriteLine(max2); ;
}
19
View Source File : FeaturesExtraction.cs
License : MIT License
Project Creator : aoso3
License : MIT License
Project Creator : aoso3
public void Extract_Featurers2(String vid, String save_path)
{
int mm = 0;
try
{
mag = new Mat();
ang = new Mat();
frame = new Mat();
prev_frame = new Mat();
cap = new VideoCapture(vid);
total_frames = Convert.ToInt32(cap.GetCaptureProperty(CapProp.FrameCount));
F_L = new List<int>();
frame = cap.QueryFrame();
prev_frame = frame;
Console.WriteLine(total_frames);
}
catch (NullReferenceException except)
{
Console.WriteLine(except.Message);
}
//17900
while (mm < total_frames - 2)
{
try
{
prev_frame = frame;
frame = cap.QueryFrame();
Bitmap image = new Bitmap(frame.Bitmap);
// Create a new FAST Corners Detector
FastCornersDetector fast = new FastCornersDetector()
{
Suppress = true, // suppress non-maximum points
Threshold = 70 // less leads to more corners
};
// Process the image looking for corners
List<IntPoint> points = fast.ProcessImage(image);
// Create a filter to mark the corners
PointsMarker marker = new PointsMarker(points);
// Apply the corner-marking filter
Bitmap markers = marker.Apply(image);
// Show on the screen
//Accord.Controls.ImageBox.Show(markers);
// Use it to extract interest points from the Lena image:
List<IntPoint> descriptors = fast.ProcessImage(image);
PointF[] features = new PointF[descriptors.Count];
int c = 0;
foreach (IntPoint p in descriptors)
{
features[c] = new PointF(p.X, p.Y);
c++;
}
ImageViewer viewer = new ImageViewer();
Image<Gray, Byte> prev_grey_img = new Image<Gray, byte>(frame.Width, frame.Height);
Image<Gray, Byte> curr_grey_img = new Image<Gray, byte>(frame.Width, frame.Height);
curr_grey_img = frame.ToImage<Gray, byte>();
prev_grey_img = prev_frame.ToImage<Gray, Byte>();
PointF[] shiftedFeatures;
Byte[] status;
float[] trackErrors;
CvInvoke.CalcOpticalFlowPyrLK(prev_grey_img, curr_grey_img, features, new Size(9, 9), 3, new MCvTermCriteria(20, 0.05),
out shiftedFeatures, out status, out trackErrors);
//Image<Gray, Byte> displayImage = cap.QueryFrame().ToImage<Gray, Byte>();
//for (int i = 0; i < features.Length; i++)
// displayImage.Draw(new LineSegment2DF(features[i], shiftedFeatures[i]), new Gray(), 2);
for (int i = 0; i < features.Length; i++)
{
CvInvoke.Circle(frame, System.Drawing.Point.Round(shiftedFeatures[i]), 4, new MCvScalar(0, 255, 255), 2);
}
int mean_X = 0;
int mean_Y = 0;
foreach (PointF p in shiftedFeatures)
{
mean_X += (int) p.X;
mean_Y += (int)p.Y;
}
mean_X /= shiftedFeatures.Length;
mean_Y /= shiftedFeatures.Length;
F_L.Add(mean_X);
F_L.Add(mean_Y);
//double[] inner = new double[] { mean_X, mean_Y };
//featuers_list[mm] = inner;
//viewer.Image = frame;
//viewer.ShowDialog();
//prev_frame = frame;
//Console.WriteLine("frame:{0} " + mm);
Console.WriteLine("frame:{0} " + mm + " X:{1} " + mean_X + " Y:{2} " + mean_Y);
mm++;
}
catch (Exception e)
{ Console.WriteLine(e.Message); }
}
//int go = 0;
//foreach (double[] arr in featuers_list)
//{
// Console.Write("frame:{0} ", go++);
// foreach (double d in arr)
// Console.Write(d + " ");
// Console.WriteLine();
//}
Serialize.SerializeObject(F_L, save_path);
}
19
View Source File : Program.cs
License : MIT License
Project Creator : apexsharp
License : MIT License
Project Creator : apexsharp
public static void FormatApexCode(string apexFolderName, bool returnJson)
{
DirectoryInfo directoryInfo = new DirectoryInfo(apexFolderName);
List<FileFormatDto> results = ApexCodeFormater.FormatApexCode(directoryInfo);
Console.WriteLine(results.Count);
}
19
View Source File : ExportQRCodes.cs
License : MIT License
Project Creator : architdate
License : MIT License
Project Creator : architdate
private void ExportQRCodes(object sender, EventArgs e)
{
SaveFile SAV = C_SAV.SAV;
var boxdata = SAV.BoxData;
if (boxdata == null)
{
WinFormsUtil.Alert("Box Data is null");
}
int ctr = 0;
Dictionary<string, Image> qrcodes = new Dictionary<string, Image>();
foreach (PKM pk in boxdata)
{
if (pk.Species == 0 || !pk.Valid || (pk.Box - 1) != C_SAV.Box.CurrentBox)
continue;
ctr++;
Image qr;
switch (pk.Format)
{
case 7:
qr = QR.GenerateQRCode7((PK7)pk);
break;
default:
if (pk.Format == 6 && !QR6Notified) // users should not be using QR6 injection
{
WinFormsUtil.Alert(MsgQRDeprecated, MsgQRAlternative);
QR6Notified = true;
}
qr = QR.GetQRImage(pk.EncryptedBoxData, QR.GetQRServer(pk.Format));
break;
}
if (qr == null) continue;
var sprite = dragout.Image;
var la = new Legalityreplacedysis(pk, C_SAV.SAV.Personal);
if (la.Parsed && pk.Species != 0)
{
var img = la.Valid ? Resources.valid : Resources.warn;
sprite = ImageUtil.LayerImage(sprite, img, 24, 0, 1);
}
string[] r = pk.QRText;
string refer = "PKHeX Auto Legality Mod";
qrcodes.Add(Util.CleanFileName(pk.FileName), RefreshImage(qr, sprite, r[0], r[1], r[2], $"{refer} ({pk.GetType().Name})"));
}
if (!Directory.Exists(Path.Combine(WorkingDirectory, "qrcodes")))
Directory.CreateDirectory(Path.Combine(WorkingDirectory, "qrcodes"));
int counter = 0;
foreach (KeyValuePair<string, Image> qrcode in qrcodes)
{
Console.WriteLine(counter);
counter++;
qrcode.Value.Save(Path.Combine(WorkingDirectory, "qrcodes", qrcode.Key + ".png"));
}
}
19
View Source File : Detector.cs
License : MIT License
Project Creator : architdate
License : MIT License
Project Creator : architdate
protected internal static int computeDimension(ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft, float moduleSize)
{
int tltrCentersDimension = round(ResultPoint.distance(topLeft, topRight) / moduleSize);
int tlblCentersDimension = round(ResultPoint.distance(topLeft, bottomLeft) / moduleSize);
int dimension = ((tltrCentersDimension + tlblCentersDimension) >> 1) + 7;
switch (dimension & 0x03)
{
// mod 4
case 0:
dimension++;
break;
// 1? do nothing
case 2:
dimension--;
break;
case 3:
throw ReaderException.Instance;
}
Console.WriteLine(dimension);
return dimension;
}
19
View Source File : QRCodeDumper.cs
License : MIT License
Project Creator : architdate
License : MIT License
Project Creator : architdate
public static void DumpQRCodes(IList<PKM> arr)
{
var qrcodes = GetQRCodeImages(arr);
var dir = Path.Combine(Directory.GetCurrentDirectory(), "qrcodes");
Directory.CreateDirectory(dir);
for (var i = 0; i < qrcodes.Count; i++)
{
var q = qrcodes[i];
Console.WriteLine(i);
var filename = $"{q.Source.FileNameWithoutExtension}.png";
q.Image.Save(Path.Combine(dir, filename));
}
}
19
View Source File : startup.cs
License : GNU General Public License v3.0
Project Creator : ashr
License : GNU General Public License v3.0
Project Creator : ashr
public static void Main(string[] args)
{
Console.WriteLine(args.Length);
if (args.Length != 4)
{
Worker.syntax();
return;
}
string filename = args[0];
string payloadURI = args[1];
string payloadMethod = args[2];
string payloadClreplaced = args[3];
if (!filename.EndsWith("dll"))
{
Worker.syntax();
return;
}
new Worker().HandleInjectionFlow(filename,payloadURI,payloadMethod, payloadClreplaced);
return;
/*
Console.WriteLine("START Running unmodified DLL");
ProcessStartInfo psi = new ProcessStartInfo("dotnet");
psi.WorkingDirectory = "../testconsole";
psi.Arguments = "run testconsole.csprj";
var p1 = Process.Start(psi);
p1.WaitForExit();
Console.WriteLine("END Running unmodified DLL");
replacedemblyDefinition targetAsm = replacedemblyDefinition.Readreplacedembly(filename);
TypeDefinition targetType = targetAsm.MainModule.Types.FirstOrDefault(x => x.Name == "Testclreplaced");
MethodDefinition m1 = targetType.Methods.FirstOrDefault(x => x.Name == "TestMethod");
Console.WriteLine("Modifying TestClreplaced");
ILProcessor ilp = m1.Body.GetILProcessor();
var ldstr = ilp.Create (OpCodes.Ldstr, "INJECTED EVIL");
var call = ilp.Create (OpCodes.Call,m1.Module.Import (typeof (Console).GetMethod ("WriteLine", new [] { typeof (string) })));
ilp.InsertBefore (m1.Body.Instructions [0], ldstr);
ilp.InsertAfter (m1.Body.Instructions [0], call);
targetAsm.Write("TESTASM.dll");
Console.WriteLine("Overwriting old version");
File.Copy("TESTASM.dll","../testconsole/bin/Debug/netcoreapp2.0/testlibrary.dll",true);
Console.WriteLine("START Running modified DLL");
psi = new ProcessStartInfo("dotnet");
psi.WorkingDirectory = "../testconsole";
psi.Arguments = "run --no-build testconsole.csprj";
var p2 = Process.Start(psi);
p2.WaitForExit();
*/
}
19
View Source File : Program.cs
License : MIT License
Project Creator : AshV
License : MIT License
Project Creator : AshV
static void Main(string[] args)
{
IStack stack = new LinkedStack();
Random r = new Random();
for (int i = 1; i <= 10; i++)
{
stack.push(r.Next(100) + 1);
}
IEnumerator<int> iterator = stack.iterator();
while (iterator.MoveNext())
WriteLine(iterator.Current);
WriteLine("\n" + stack.size() + "\n");
WriteLine(stack.pop());
WriteLine("\n" + stack.size() + "\n");
iterator = stack.iterator();
while (iterator.MoveNext())
WriteLine(iterator.Current);
}
19
View Source File : Program.cs
License : MIT License
Project Creator : AshV
License : MIT License
Project Creator : AshV
static void Main(string[] args)
{
IStack stack = new LinkedStack();
Random r = new Random();
for (int i = 1; i <= 10; i++)
{
stack.push(r.Next(100) + 1);
}
IEnumerator<int> iterator = stack.iterator();
while (iterator.MoveNext())
WriteLine(iterator.Current);
WriteLine("\n" + stack.size() + "\n");
WriteLine(stack.pop());
WriteLine("\n" + stack.size() + "\n");
iterator = stack.iterator();
while (iterator.MoveNext())
WriteLine(iterator.Current);
}
19
View Source File : ReadGeoJsonFromStream.cs
License : MIT License
Project Creator : aspose-gis
License : MIT License
Project Creator : aspose-gis
public static void Run()
{
//ExStart: ReadGeoJsonFromStream
const string geoJson = @"{""type"":""FeatureCollection"",""features"":[
{""type"":""Feature"",""geometry"":{""type"":""Point"",""coordinates"":[0, 1]},""properties"":{""name"":""John""}},
{""type"":""Feature"",""geometry"":{""type"":""Point"",""coordinates"":[2, 3]},""properties"":{""name"":""Mary""}}
]}";
using (var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(geoJson)))
using (var layer = VectorLayer.Open(AbstractPath.FromStream(memoryStream), Drivers.GeoJson))
{
Console.WriteLine(layer.Count); // 2
Console.WriteLine(layer[1].GetValue<string>("name")); // Mary
}
//ExEnd: ReadGeoJsonFromStream
}
19
View Source File : CountGeometriesInGeometry.cs
License : MIT License
Project Creator : aspose-gis
License : MIT License
Project Creator : aspose-gis
public static void Run()
{
//ExStart: CountGeometriesInGeometry
Point point = new Point(40.7128, -74.006);
LineString line = new LineString();
line.AddPoint(78.65, -32.65);
line.AddPoint(-98.65, 12.65);
GeometryCollection geometryCollection = new GeometryCollection();
geometryCollection.Add(point);
geometryCollection.Add(line);
int geometriesCount = geometryCollection.Count;
Console.WriteLine(geometriesCount); // 2
//ExEnd: CountGeometriesInGeometry
}
19
View Source File : CountPointsInGeometry.cs
License : MIT License
Project Creator : aspose-gis
License : MIT License
Project Creator : aspose-gis
public static void Run()
{
//ExStart: CountPointsInGeometry
LineString line = new LineString();
line.AddPoint(78.65, -32.65);
line.AddPoint(-98.65, 12.65);
int pointsCount = line.Count;
Console.WriteLine(pointsCount); // 2
//ExEnd: CountPointsInGeometry
}
19
View Source File : AddLayerToFileGdbDataset.cs
License : MIT License
Project Creator : aspose-gis
License : MIT License
Project Creator : aspose-gis
public static void Run()
{
//ExStart: AddLayerToFileGdbDataset
// -- copy test dataset, to avoid modification of test data.
var path = RunExamples.GetDataDir() + "ThreeLayers.gdb";
var datasetPath = RunExamples.GetDataDir() + "AddLayerToFileGdbDataset_out.gdb";
RunExamples.CopyDirectory(path, datasetPath);
// --
using (var dataset = Dataset.Open(datasetPath, Drivers.FileGdb))
{
Console.WriteLine(dataset.CanCreateLayers); // True
using (var layer = dataset.CreateLayer("data", SpatialReferenceSystem.Wgs84))
{
layer.Attributes.Add(new FeatureAttribute("Name", AttributeDataType.String));
var feature = layer.ConstructFeature();
feature.SetValue("Name", "Name_1");
feature.Geometry = new Point(12.21, 23.123, 20, -200);
layer.Add(feature);
}
using (var layer = dataset.OpenLayer("data"))
{
Console.WriteLine(layer.Count); // 1
Console.WriteLine(layer[0].GetValue<string>("Name")); // "Name_1"
}
}
//ExEnd: AddLayerToFileGdbDataset
}
19
View Source File : CreateFileGdbDataset.cs
License : MIT License
Project Creator : aspose-gis
License : MIT License
Project Creator : aspose-gis
public static void Run()
{
//ExStart: CreateFileGdbDataset
Console.WriteLine(Drivers.FileGdb.CanCreateDatasets); // True
var path = RunExamples.GetDataDir() + "CreateFileGdbDataset_out.gdb";
using (var dataset = Dataset.Create(path, Drivers.FileGdb))
{
Console.WriteLine(dataset.LayersCount); // 0
using (var layer = dataset.CreateLayer("layer_1"))
{
layer.Attributes.Add(new FeatureAttribute("value", AttributeDataType.Integer));
for (int i = 0; i < 10; ++i)
{
var feature = layer.ConstructFeature();
feature.SetValue("value", i);
feature.Geometry = new Point(i, i);
layer.Add(feature);
}
}
using (var layer = dataset.CreateLayer("layer_2"))
{
var feature = layer.ConstructFeature();
feature.Geometry = new LineString(new[]
{
new Point(1, 2),
new Point(3, 4),
});
layer.Add(feature);
}
Console.WriteLine(dataset.LayersCount); // 2
}
//ExEnd: CreateFileGdbDataset
}
19
View Source File : SpecifyLayerSpatialReference.cs
License : MIT License
Project Creator : aspose-gis
License : MIT License
Project Creator : aspose-gis
public static void Run()
{
string dataDir = RunExamples.GetDataDir();
string path = dataDir + "SpecifyLayerSpatialReference_out.shp";
//ExStart: SpecifyLayerSpatialReference
var srs = SpatialReferenceSystem.CreateFromEpsg(26918);
using (VectorLayer layer = VectorLayer.Create(path, Drivers.Shapefile, srs))
{
var feature = layer.ConstructFeature();
feature.Geometry = new Point(60, 24);
layer.Add(feature);
}
using (VectorLayer layer = VectorLayer.Open(path, Drivers.Shapefile))
{
Console.WriteLine(layer.SpatialReferenceSystem.EpsgCode); // 26918
Console.WriteLine(layer.SpatialReferenceSystem.Name); // NAD83_UTM_zone_18N
}
//ExEnd: SpecifyLayerSpatialReference
}
19
View Source File : ReadingESRIFileGeoDatabaseFileGDB.cs
License : MIT License
Project Creator : aspose-gis
License : MIT License
Project Creator : aspose-gis
public static void OpenShapefileAsDataset()
{
//ExStart: OpenShapefileAsDataset
//By the moment the only multi layer file format we support is FileGDB. But you can open files of other formats as datasets.
//In this case, the dataset will have one layer.
using (var dataset = Dataset.Open(dataDir + "PolygonShapeFile.shp", Drivers.Shapefile))
{
Console.WriteLine(dataset.LayersCount); // 1
Console.WriteLine(dataset.GetLayerName(0)); // "point"
using (var layer = dataset.OpenLayerAt(0))
// this 'using' is equivalent to
// using(var layer = VectorLayer.Open("point.shp", Drivrs.Shapefile))
{
foreach (var feature in layer)
{
Console.WriteLine(feature.Geometry.AsText());
}
}
}
//ExEnd: OpenShapefileAsDataset
}
19
View Source File : RemoveLayersFromFileGdbDataset.cs
License : MIT License
Project Creator : aspose-gis
License : MIT License
Project Creator : aspose-gis
public static void Run()
{
//ExStart: RemoveLayersFromFileGdbDataset
// -- copy test dataset, to avoid modification of test data.
//var datasetPath = GetOutputPath(".gdb");
var path = RunExamples.GetDataDir() + "ThreeLayers.gdb";
var datasetPath = RunExamples.GetDataDir() + "RemoveLayersFromFileGdbDataset_out.gdb";
RunExamples.CopyDirectory(path, datasetPath);
// --
using (var dataset = Dataset.Open(datasetPath, Drivers.FileGdb))
{
Console.WriteLine(dataset.CanRemoveLayers); // True
Console.WriteLine(dataset.LayersCount); // 3
// remove layer by index
dataset.RemoveLayerAt(2);
Console.WriteLine(dataset.LayersCount); // 2
// remove layer by name
dataset.RemoveLayer("layer1");
Console.WriteLine(dataset.LayersCount); // 1
}
//ExEnd: RemoveLayersFromFileGdbDataset
}
19
View Source File : SpecifyNamesOfObjectIdAndGeometryFields.cs
License : MIT License
Project Creator : aspose-gis
License : MIT License
Project Creator : aspose-gis
public static void Run()
{
//ExStart: SpecifyNamesOfObjectIdAndGeometryFields
var path = RunExamples.GetDataDir() + "NamesOfObjectIdAndGeometryFields_out.gdb";
using (var dataset = Dataset.Create(path, Drivers.FileGdb))
{
var options = new FileGdbOptions
{
// name object ID field 'OID' rather than the default 'OBJECTID'.
ObjectIdFieldName = "OID",
// name geometry field 'POINT' rather than the default 'SHAPE'.
GeometryFieldName = "POINT",
};
using (var layer = dataset.CreateLayer("layer_name", options, SpatialReferenceSystem.Wgs84))
{
var feature = layer.ConstructFeature();
feature.Geometry = new Point(12.32, 34.21);
layer.Add(feature);
}
using (var layer = dataset.OpenLayer("layer_name"))
{
var feature = layer[0];
Console.WriteLine(feature.GetValue<int>("OID")); // 1
}
}
//ExEnd: SpecifyNamesOfObjectIdAndGeometryFields
}
19
View Source File : ApplyMeteredLicense.cs
License : MIT License
Project Creator : aspose-pdf
License : MIT License
Project Creator : aspose-pdf
public static void Run()
{
// ExStart:1
// The path to the doreplacedents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_QuickStart();
// set metered public and private keys
Aspose.Pdf.Metered metered = new Aspose.Pdf.Metered();
// Access the setMeteredKey property and preplaced public and private keys as parameters
metered.SetMeteredKey("*****", "*****");
// Load the doreplacedent from disk.
Doreplacedent doc = new Doreplacedent(dataDir + "input.pdf");
//Get the page count of doreplacedent
Console.WriteLine(doc.Pages.Count);
// ExEnd:1
}
19
View Source File : GetPageProperties.cs
License : MIT License
Project Creator : aspose-pdf
License : MIT License
Project Creator : aspose-pdf
public static void Run()
{
// ExStart:GetPageProperties
// The path to the doreplacedents directory.
string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Pages();
// Open doreplacedent
PdfPageEditor pageEditor = new PdfPageEditor();
pageEditor.BindPdf(dataDir + "input.pdf");
// Get page properties
Console.WriteLine(pageEditor.GetPageRotation(1));
Console.WriteLine(pageEditor.GetPages());
Console.WriteLine(pageEditor.GetPageBoxSize(1, "trim"));
Console.WriteLine(pageEditor.GetPageBoxSize(1, "art"));
Console.WriteLine(pageEditor.GetPageBoxSize(1, "bleed"));
Console.WriteLine(pageEditor.GetPageBoxSize(1, "crop"));
Console.WriteLine(pageEditor.GetPageBoxSize(1, "media"));
// ExEnd:GetPageProperties
}
19
View Source File : Program.cs
License : Apache License 2.0
Project Creator : asynkron
License : Apache License 2.0
Project Creator : asynkron
public Task ReceiveAsync(IContext context)
{
switch (context.Message)
{
case Pong _:
_count++;
if (_count % 50000 == 0) Console.WriteLine(_count);
if (_count == _messageCount) _semapreplaced.Release();
break;
}
return Task.CompletedTask;
}
See More Examples