Commit 98996813 authored by BORNON Théophile's avatar BORNON Théophile

Simple arguement handling

parent 4ff17f98
......@@ -264,3 +264,6 @@ __pycache__/
/S04_Projet/bin/Debug/edge1.bmp
/S04_Projet/bin/Debug/blur.bmp
/ImageProcessing_Benchmark/bin/Debug/ImageProcessing_Benchmark.exe.config
*.csv
*.xlsx
/ImageProcessing_Benchmark/bin/Debug/flocon.bmp
......@@ -11,18 +11,20 @@ namespace ImageProcessing_Benchmark
Stopwatch sw = new Stopwatch();
System.Console.WriteLine("Benchmarking");
for (int i = 0; i < 100; i++)
for (int i = 0; i < 10; i++)
{
sw.Restart();
Process.Start("S04_Projet.exe");
while (Process.GetProcessesByName("S04_Projet").Length != 0);
ProcessStartInfo processStartInfo = new ProcessStartInfo();
processStartInfo.Arguments = "--input flocon.bmp --multithreading";
processStartInfo.FileName = "S04_Projet.exe";
Process.Start(processStartInfo);
while (Process.GetProcessesByName("S04_Projet").Length != 0) System.Threading.Thread.Sleep(20);
sw.Stop();
results += sw.ElapsedMilliseconds + "\n";
}
File.WriteAllText("bench.csv", results);
System.Console.WriteLine("Done");
System.Console.Read();
}
}
}
......@@ -21,6 +21,8 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
......@@ -54,4 +56,7 @@
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy $(TargetPath) $(SolutionDir)ImageProcessing_Benchmark\bin\Debug</PostBuildEvent>
</PropertyGroup>
</Project>
\ No newline at end of file
......@@ -56,27 +56,63 @@ namespace S04_Projet
{ 0, -1, 0 }
};
#endregion
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("#############################################################");
Console.WriteLine("### Bienvenue ###");
Console.WriteLine("#############################################################");
Console.WriteLine();
MyImage img = Display.LoadImage();
Display.Operation ToDo = Display.AskForOperation();
MyImage newImg = Display.PerformOperation(ToDo, img);
while (newImg != null)
if (args.Length > 0)
{
ToDo = Display.AskForOperation();
newImg = Display.PerformOperation(ToDo, newImg);
MULTITHREADING = false;
string inputPath = "";
string outputPath = "";
for (int i = 0; i < args.Length; i++)
{
if (args[i].Equals("--input"))
{
inputPath = args[i + 1];
i++;
}
else if (args[i].Equals("--output"))
{
outputPath = args[i + 1];
i++;
}
else if (args[i].Equals("--multithreading")) MULTITHREADING = true;
}
if(inputPath != "")
{
MyImage img = new MyImage(inputPath);
if (outputPath != "")
{
img.Save(outputPath);
} else
{
Console.WriteLine("No output specified, program will only load image in memory and stop");
}
} else
{
Console.WriteLine("--input argument required");
}
}
else
{
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("#############################################################");
Console.WriteLine("### Bienvenue ###");
Console.WriteLine("#############################################################");
Console.WriteLine();
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Image sauvegardée en {0}ms!", Display.elapsedTime);
MyImage img = Display.LoadImage();
Display.Operation ToDo = Display.AskForOperation();
MyImage newImg = Display.PerformOperation(ToDo, img);
Console.Read();
while (newImg != null)
{
ToDo = Display.AskForOperation();
newImg = Display.PerformOperation(ToDo, newImg);
}
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Image sauvegardée en {0}ms!", Display.elapsedTime);
Console.Read();
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment