update gestione dizionario (da completare)
This commit is contained in:
@@ -159,36 +159,14 @@ namespace WebDoorCreator.Data.Services
|
||||
{
|
||||
await Task.Delay(1);
|
||||
int numMissing = 0;
|
||||
///dizionario componenti - directory
|
||||
Dictionary<string, string> DictCompoDir = new Dictionary<string, string>();
|
||||
// ciclo x tutti gli oggetti "FOLDER" della tabella
|
||||
try
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
|
||||
// in primis cerco le directory fisiche e la loro rappresentazione come nome componente...
|
||||
string[] hwDirectories = Directory.GetDirectories(defaultPath);
|
||||
foreach (var hw in hwDirectories)
|
||||
{
|
||||
string[] iniFiles = Directory.GetFiles(hw, "Config.ini");
|
||||
if (iniFiles != null && iniFiles.Length > 0)
|
||||
{
|
||||
List<string> lines = File.ReadAllLines(iniFiles[0]).ToList();
|
||||
IniFile fIni = new IniFile(iniFiles[0]);
|
||||
|
||||
var compoName = fIni.ReadString("Compo", "Name", "COMPONAME");
|
||||
string compoCode = compoName.Split("/")[0].Trim();
|
||||
|
||||
// aggiungo al dizionari
|
||||
if (!DictCompoDir.ContainsKey(compoName))
|
||||
{
|
||||
DictCompoDir.Add(compoName, hw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//var listFolder = await ListValuesGetAll("*", "Folder");
|
||||
// recupero dizionario componenti - directory
|
||||
Dictionary<string, string> DictCompoDir = getCompoDict(defaultPath);
|
||||
var listTemplate = await ListValuesGetAll("*", "template");
|
||||
if (listTemplate != null && listTemplate.Count > 0)
|
||||
{
|
||||
@@ -217,6 +195,34 @@ namespace WebDoorCreator.Data.Services
|
||||
Log.Error($"Exception during CompoCountMissing: {exc}{Environment.NewLine}");
|
||||
}
|
||||
return numMissing;
|
||||
|
||||
}
|
||||
protected Dictionary<string, string> getCompoDict(string defaultPath)
|
||||
{
|
||||
///dizionario componenti - directory
|
||||
Dictionary<string, string> DictCompoDir = new Dictionary<string, string>();
|
||||
// in primis cerco le directory fisiche e la loro rappresentazione come nome componente...
|
||||
string[] hwDirectories = Directory.GetDirectories(defaultPath);
|
||||
foreach (var hw in hwDirectories)
|
||||
{
|
||||
string[] iniFiles = Directory.GetFiles(hw, "Config.ini");
|
||||
if (iniFiles != null && iniFiles.Length > 0)
|
||||
{
|
||||
List<string> lines = File.ReadAllLines(iniFiles[0]).ToList();
|
||||
IniFile fIni = new IniFile(iniFiles[0]);
|
||||
|
||||
var compoName = fIni.ReadString("Compo", "Name", "COMPONAME");
|
||||
string compoCode = compoName.Split("/")[0].Trim();
|
||||
|
||||
// aggiungo al dizionari
|
||||
if (!DictCompoDir.ContainsKey(compoCode))
|
||||
{
|
||||
DictCompoDir.Add(compoCode, hw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return DictCompoDir;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -237,26 +243,8 @@ namespace WebDoorCreator.Data.Services
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
|
||||
// in primis cerco le directory fisiche e la loro rappresentazione come nome componente...
|
||||
string[] hwDirectories = Directory.GetDirectories(defaultPath);
|
||||
foreach (var hw in hwDirectories)
|
||||
{
|
||||
string[] iniFiles = Directory.GetFiles(hw, "Config.ini");
|
||||
if (iniFiles != null && iniFiles.Length > 0)
|
||||
{
|
||||
List<string> lines = File.ReadAllLines(iniFiles[0]).ToList();
|
||||
IniFile fIni = new IniFile(iniFiles[0]);
|
||||
|
||||
var compoName = fIni.ReadString("Compo", "Name", "COMPONAME");
|
||||
string compoCode = compoName.Split("/")[0].Trim();
|
||||
|
||||
// aggiungo al dizionari
|
||||
if (!DictCompoDir.ContainsKey(compoName))
|
||||
{
|
||||
DictCompoDir.Add(compoName, hw);
|
||||
}
|
||||
}
|
||||
}
|
||||
// recupero dizionario componenti - directory
|
||||
Dictionary<string, string> DictCompoDir = getCompoDict(defaultPath);
|
||||
|
||||
//var listFolder = await ListValuesGetAll("*", "Folder");
|
||||
var listTemplate = await ListValuesGetAll("*", "template");
|
||||
|
||||
Reference in New Issue
Block a user