Commit d4074d08 authored by Талибов Сэрхан Махмад Оглы's avatar Талибов Сэрхан Махмад Оглы
Browse files

Started working on project_manager

1 merge request!12 of 4 services are donwe
Showing with 350 additions and 166 deletions
+350 -166
...@@ -5,221 +5,245 @@ ...@@ -5,221 +5,245 @@
static void Main(string[] args) static void Main(string[] args)
{ {
bool project_flag = false;
string project_name = ""; string project_name = "";
string project_location = ""; string project_location = "";
string project_new_name = "";
string project_action = "o";
bool project_open = false; bool graph_flag = false;
bool project_create = false;
bool project_erase = false;
string topology = ""; string topology = "";
List<int> generators = new List<int>(); List<int> generators = new List<int>();
string queue_type = ""; string queue_type = "";
string queue_position = ""; string queue_position = "";
string arbiter_type = ""; string arbiter_type = "";
string algorithm = ""; string algorithm = "";
int info_width = 0; int info_width = 0;
int queue_length = 0; int queue_length = 0;
bool create_verilog = false; bool create_verilog = false;
bool quartus_flag = false;
string device_name = "5CGXFC9E7F35C8"; string device_name = "5CGXFC9E7F35C8";
bool db_flag = false;
string db_ip = ""; string db_ip = "";
string db_username = ""; string db_username = "";
string db_password = ""; string db_password = "";
string db_name = ""; string db_name = "";
int db_port = 5432; int db_port = 5432;
bool settings_flag = false;
string quartus_path = ""; string quartus_path = "";
#region arguments #region arguments
for (int i = 0; i < args.Length; i++) try
{ {
switch (args[i]) for (int i = 0; i < args.Length; i++)
{ {
case "--project": switch (args[i])
bool project_breaker = false; {
while (!project_breaker) case "--project":
{ project_flag = true;
switch (args[++i])
bool project_breaker = false;
while (!project_breaker)
{ {
case "-n": switch (args[++i])
case "--name": {
project_name = args[++i]; case "-n":
break; case "--name":
case "-l": project_name = args[++i];
case "--location": break;
project_location = args[++i]; case "-l":
break; case "--location":
case "-o": project_location = args[++i];
case "--open": break;
project_open = true; case "-o":
break; case "--open":
case "-c": project_action = "o";
case "--create": break;
project_create = true; case "-c":
break; case "--create":
case "-e": project_action = "c";
case "--erase": break;
project_erase = true; case "-e":
break; case "--erase":
default: project_action = "e";
i--; break;
project_breaker = true; case "-r":
break; case "--rename":
project_action = "r";
project_new_name = args[++i];
break;
default:
i--;
project_breaker = true;
break;
}
} }
} break;
break; case "--graph":
case "--graph": graph_flag = true;
bool graph_breaker = false;
while (!graph_breaker) bool graph_breaker = false;
{
switch (args[++i]) while (!graph_breaker)
{ {
case "c": switch (args[++i])
topology = "c"; {
break; case "c":
case "m": topology = "c";
topology = "m"; break;
break; case "m":
case "t": topology = "m";
topology = "t"; break;
break; case "t":
case "--queue_type": topology = "t";
queue_type = args[++i]; break;
break; case "--queue_type":
case "--queue_position": queue_type = args[++i];
queue_position = args[++i]; break;
break; case "--queue_position":
case "--arbiter_type": queue_position = args[++i];
arbiter_type = args[++i]; break;
break; case "--arbiter_type":
case "--algorithm": arbiter_type = args[++i];
algorithm = args[++i]; break;
break; case "--algorithm":
case "--info_width": algorithm = args[++i];
try break;
{ case "--info_width":
info_width = Convert.ToInt32(args[++i]); try
} {
catch (Exception e) info_width = Convert.ToInt32(args[++i]);
{ }
Console.WriteLine("--info_width must be a number"); catch (Exception e)
} {
break; Console.WriteLine("--info_width must be a number");
case "--queue_length": }
try break;
{ case "--queue_length":
queue_length = Convert.ToInt32(args[++i]); try
} {
catch (Exception e) queue_length = Convert.ToInt32(args[++i]);
{ }
Console.WriteLine("--queue_lenght must be a number"); catch (Exception e)
} {
break; Console.WriteLine("--queue_lenght must be a number");
case "-v": }
case "--verilog": break;
create_verilog = true; case "-v":
break; case "--verilog":
default: create_verilog = true;
try break;
{ default:
generators.Add(Convert.ToInt32(args[i])); try
} {
catch (Exception e) generators.Add(Convert.ToInt32(args[i]));
{ }
i--; catch (Exception e)
graph_breaker = true; {
} i--;
break; graph_breaker = true;
}
break;
}
} }
} break;
break; case "--quartus":
case "--quartus": quartus_flag = true;
switch (args[++i])
{
case "-d":
case "--device":
device_name = args[++i];
break;
default:
i--;
break;
}
break;
case "--database":
bool db_breaker = false;
while (!db_breaker)
{
switch (args[++i]) switch (args[++i])
{ {
case "-i": case "-d":
case "--ip": case "--device":
db_ip = args[++i]; device_name = args[++i];
break;
case "-u":
case "--username":
db_username = args[++i];
break;
case "--pass":
case "--password":
db_password = args[++i];
break;
case "-n":
case "--name":
db_name = args[++i];
break;
case "--port":
try
{
db_port = Convert.ToInt32(args[++i]);
}
catch (Exception e)
{
Console.WriteLine("--port must be a number");
}
break; break;
default: default:
i--; i--;
db_breaker = true;
break; break;
} }
} break;
break; case "--database":
case "--settings": db_flag = true;
bool settings_breaker = false;
while (!settings_breaker) bool db_breaker = false;
{
if (i + 2 < args.Length) while (!db_breaker)
{ {
switch (args[++i]) switch (args[++i])
{ {
case "--qp": case "-i":
case "--quartus_path": case "--ip":
quartus_path = args[++i]; db_ip = args[++i];
break;
case "-u":
case "--username":
db_username = args[++i];
break;
case "--pass":
case "--password":
db_password = args[++i];
break;
case "-n":
case "--name":
db_name = args[++i];
break;
case "--port":
try
{
db_port = Convert.ToInt32(args[++i]);
}
catch (Exception e)
{
Console.WriteLine("--port must be a number");
}
break; break;
default: default:
i--; i--;
settings_breaker = true; db_breaker = true;
break; break;
} }
} }
else break;
case "--settings":
settings_flag = true;
bool settings_breaker = false;
while (!settings_breaker)
{ {
settings_breaker = true; if (i + 2 < args.Length)
{
switch (args[++i])
{
case "--qp":
case "--quartus_path":
quartus_path = args[++i];
break;
default:
i--;
settings_breaker = true;
break;
}
}
else
{
settings_breaker = true;
}
} }
} break;
break; default:
default: Console.WriteLine($"Argument {args[i]} does not exist. Check the spelling or check graph generator numbers\n");
Console.WriteLine($"Argument {args[i]} does not exist. Check the spelling or check graph generator numbers\n"); break;
break; }
} }
} }
catch (IndexOutOfRangeException e)
{
Console.WriteLine("No argument after an option that requires an argument\n");
Environment.Exit(1);
}
#endregion #endregion
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"profiles": { "profiles": {
"Broker": { "Broker": {
"commandName": "Project", "commandName": "Project",
"commandLineArgs": "--project --name s --location sd --open --create --erase --graph c 3 5 --queue_type f --queue_position fj --arbiter_type sdfj --algorithm sdfjk --info_width sdf --queue_length sdf -v --quartus --device lkfjsdklf --database --ip fj --username klsdf --password lksdf --name dsjkf --port sdf --settings --quartus_path sdljkfsldfj" "commandLineArgs": "--project -n"
} }
} }
} }
\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -14,7 +14,7 @@ using System.Reflection; ...@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Broker")] [assembly: System.Reflection.AssemblyCompanyAttribute("Broker")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+36bd3217a4e6a661467f138ea6e903ae2ab690b6")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+4cd3b18afa505411963c56b7964c48eba64c7648")]
[assembly: System.Reflection.AssemblyProductAttribute("Broker")] [assembly: System.Reflection.AssemblyProductAttribute("Broker")]
[assembly: System.Reflection.AssemblyTitleAttribute("Broker")] [assembly: System.Reflection.AssemblyTitleAttribute("Broker")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
......
164aa339aa5c02fff256d960be8c8a0193fc8384fd63fee486433b40d95b3a44 79aac4daba1ca8e4aa2a631eed25298276c6ac3c01f91f1cd3927d8b83cf09ea
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34728.123
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project_manager", "Project_manager\Project_manager.csproj", "{9F9B386D-F8AE-4769-B354-8CFA35604F1B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9F9B386D-F8AE-4769-B354-8CFA35604F1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9F9B386D-F8AE-4769-B354-8CFA35604F1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F9B386D-F8AE-4769-B354-8CFA35604F1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F9B386D-F8AE-4769-B354-8CFA35604F1B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0B379225-DB49-4567-A034-C88F889CE0B0}
EndGlobalSection
EndGlobal
using System.Runtime.CompilerServices;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
namespace HDLNoCGen
{
static class Program
{
static void Main(string[] args)
{
string location = "";
string name = "";
string action = "o";
string new_name = "";
try
{
for (int i = 0; i < args.Length; i++)
{
switch (args[i])
{
case "-l":
case "--location":
location = args[++i];
break;
case "-n":
case "--name":
name = args[++i];
break;
case "-o":
case "--open":
action = "o";
break;
case "-c":
case "--create":
action = "c";
break;
case "-e":
case "--erase":
action = "e";
break;
case "-r":
case "--rename":
action = "r";
new_name = args[++i];
break;
default:
Console.WriteLine($"Argument {args[i]} is invalid\n");
Environment.Exit(1);
break;
}
}
}
catch
{
Console.WriteLine("No argument after an option that requires an argument\n");
Environment.Exit(1);
}
/*
string metadata_location = $"{location}/{name}_metadata.json";
switch (action)
{
case "o":
if (!File.Exists(metadata_location))
{
Console.WriteLine("This project does not exist\n");
Environment.Exit(1);
}
using (StreamReader r = new StreamReader(metadata_location))
{
string json = r.ReadToEnd();
}
break;
case "c":
using (StreamReader r = new StreamReader("../../../project_metadata_template.json"))
{
string json = r.ReadToEnd();
}
break;
}
*/
}
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
{
"profiles": {
"Project_manager": {
"commandName": "Project",
"commandLineArgs": "-c"
}
}
}
\ No newline at end of file
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"Project_manager/1.0.0": {
"runtime": {
"Project_manager.dll": {}
}
}
}
},
"libraries": {
"Project_manager/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
\ No newline at end of file
File added
File added
File added
Supports Markdown
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