fix update file template
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>WebDoorCreator - Egalware</i>
|
||||
<h4>Version: 0.9.2309.0512</h4>
|
||||
<h4>Version: 0.9.2309.0515</h4>
|
||||
<br /> Release note:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.9.2309.0512
|
||||
0.9.2309.0515
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>0.9.2309.0512</version>
|
||||
<version>0.9.2309.0515</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -2229,87 +2229,92 @@ namespace WebDoorCreator.Data.Services
|
||||
string compoTempOrShape = "";
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
string[] templateDirectories = Directory.GetDirectories(dir);
|
||||
//string[] templateDirectories = Directory.GetDirectories(dir);
|
||||
string[] hwDirectories = Directory.GetDirectories(dir);
|
||||
|
||||
string[] iniFiles = Directory.GetFiles(dir, "Config.ini");
|
||||
|
||||
int ordin = 1;
|
||||
foreach (string templateDirectory in templateDirectories)
|
||||
foreach (var hw in hwDirectories)
|
||||
{
|
||||
var tName = templateDirectory.Split("\\");
|
||||
var fName = templateDirectory.Split("\\");
|
||||
string[] iniFiles = Directory.GetFiles(hw, "Config.ini");
|
||||
string[] templateDirectories = Directory.GetDirectories(hw);
|
||||
|
||||
foreach (var file in iniFiles)
|
||||
foreach (string templateDirectory in templateDirectories)
|
||||
{
|
||||
List<string> lines = File.ReadAllLines(file).ToList();
|
||||
IniFile fIni = new IniFile(file);
|
||||
var tName = templateDirectory.Split("\\");
|
||||
var fName = templateDirectory.Split("\\");
|
||||
|
||||
var compoName = fIni.ReadString("Compo", "Name", "COMPONAME");
|
||||
var compoT = fIni.ReadString("Template", "Name", "TEMPSHAPE");
|
||||
compoCode = compoName.Split("/")[0].Trim();
|
||||
compoTempOrShape = compoT.Split("/")[0].Trim();
|
||||
}
|
||||
|
||||
string[] templateFiles = Directory.GetFiles(templateDirectory);
|
||||
if (templateFiles.Length > 0)
|
||||
{
|
||||
ListValuesTempModel folderNames = new ListValuesTempModel()
|
||||
foreach (var file in iniFiles)
|
||||
{
|
||||
TableName = $"{compoCode}".Replace(" ", "_"),
|
||||
FieldName = "Folder",
|
||||
Value = @$"{tName[tName.Length - 1]}",
|
||||
Label = @$"{tName[tName.Length - 1]}",
|
||||
Ordinal = 0,
|
||||
DefaultVal = " ",
|
||||
InputType = " ",
|
||||
};
|
||||
values.Add(folderNames);
|
||||
}
|
||||
List<string> lines = File.ReadAllLines(file).ToList();
|
||||
IniFile fIni = new IniFile(file);
|
||||
|
||||
foreach (string templateFile in templateFiles)
|
||||
{
|
||||
FileInfo fi = new FileInfo(templateFile);
|
||||
string defGpNum = "";
|
||||
var lines = File.ReadAllLines(templateFile).ToList();
|
||||
var compoName = fIni.ReadString("Compo", "Name", "COMPONAME");
|
||||
var compoT = fIni.ReadString("Template", "Name", "TEMPSHAPE");
|
||||
compoCode = compoName.Split("/")[0].Trim();
|
||||
compoTempOrShape = compoT.Split("/")[0].Trim();
|
||||
}
|
||||
|
||||
foreach (var line in lines)
|
||||
string[] templateFiles = Directory.GetFiles(templateDirectory);
|
||||
if (templateFiles.Length > 0)
|
||||
{
|
||||
if (line.StartsWith("--") && line.Contains("Default"))
|
||||
ListValuesTempModel folderNames = new ListValuesTempModel()
|
||||
{
|
||||
if (line.Split("=")[1] != null)
|
||||
TableName = $"{compoCode}".Replace(" ", "_"),
|
||||
FieldName = "Folder",
|
||||
Value = @$"{tName[tName.Length - 1]}",
|
||||
Label = @$"{tName[tName.Length - 1]}",
|
||||
Ordinal = 0,
|
||||
DefaultVal = " ",
|
||||
InputType = " ",
|
||||
};
|
||||
values.Add(folderNames);
|
||||
}
|
||||
|
||||
foreach (string templateFile in templateFiles)
|
||||
{
|
||||
FileInfo fi = new FileInfo(templateFile);
|
||||
string defGpNum = "";
|
||||
var lines = File.ReadAllLines(templateFile).ToList();
|
||||
|
||||
foreach (var line in lines)
|
||||
{
|
||||
if (line.StartsWith("--") && line.Contains("Default"))
|
||||
{
|
||||
defGpNum = line.Split("=")[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
defGpNum = " ";
|
||||
if (line.Split("=")[1] != null)
|
||||
{
|
||||
defGpNum = line.Split("=")[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
defGpNum = " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var fileName = "";
|
||||
if (Path.GetFileName(templateFile).Split(".")[1] == "lua")
|
||||
{
|
||||
fileName = Path.GetFileName(templateFile).Split(".")[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName = Path.GetFileName(templateFile);
|
||||
}
|
||||
var fileName = "";
|
||||
if (Path.GetFileName(templateFile).Split(".")[1] == "lua")
|
||||
{
|
||||
fileName = Path.GetFileName(templateFile).Split(".")[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
fileName = Path.GetFileName(templateFile);
|
||||
}
|
||||
|
||||
ListValuesTempModel temp = new ListValuesTempModel()
|
||||
{
|
||||
TableName = $"{compoCode}".Replace(" ", "_"),
|
||||
FieldName = compoTempOrShape,
|
||||
Value = @$"{tName[tName.Length - 1]}\{fileName}",
|
||||
Label = fileName,
|
||||
Ordinal = ordin,
|
||||
DefaultVal = defGpNum,
|
||||
InputType = " ",
|
||||
};
|
||||
var fileContent = File.ReadAllBytes(templateFile);
|
||||
var hash = md5.ComputeHash(fileContent);
|
||||
var oldMD5 = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
|
||||
ListValuesTempModel temp = new ListValuesTempModel()
|
||||
{
|
||||
TableName = $"{compoCode}".Replace(" ", "_"),
|
||||
FieldName = compoTempOrShape,
|
||||
Value = @$"{tName[tName.Length - 1]}\{fileName}",
|
||||
Label = fileName,
|
||||
Ordinal = ordin,
|
||||
DefaultVal = defGpNum,
|
||||
InputType = " ",
|
||||
};
|
||||
var fileContent = File.ReadAllBytes(templateFile);
|
||||
var hash = md5.ComputeHash(fileContent);
|
||||
var oldMD5 = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
|
||||
#if false
|
||||
DoorOpTypeModel tempType = new DoorOpTypeModel()
|
||||
{
|
||||
@@ -2325,18 +2330,19 @@ namespace WebDoorCreator.Data.Services
|
||||
};
|
||||
doorOpTypesList.Add(tempType);
|
||||
#endif
|
||||
if (values.Where(x => x.TableName == temp.TableName && x.FieldName == temp.FieldName && x.Value == temp.Value).Count() == 0 && temp.TableName != null && temp.FieldName != null && temp.Value != null)
|
||||
{
|
||||
values.Add(temp);
|
||||
ordin++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"ListValuesLuaNgeInsert | Duplicated key: {temp.TableName} {temp.FieldName} {temp.Value} ");
|
||||
if (values.Where(x => x.TableName == temp.TableName && x.FieldName == temp.FieldName && x.Value == temp.Value).Count() == 0 && temp.TableName != null && temp.FieldName != null && temp.Value != null)
|
||||
{
|
||||
values.Add(temp);
|
||||
ordin++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"ListValuesLuaNgeInsert | Duplicated key: {temp.TableName} {temp.FieldName} {temp.Value} ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
answ = await dbController.ListValuesAdd(values);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
@@ -3552,7 +3558,7 @@ namespace WebDoorCreator.Data.Services
|
||||
string rawData = JsonConvert.SerializeObject(filesDict);
|
||||
await redisDb.StringSetAsync(currKey, rawData);
|
||||
|
||||
|
||||
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Debug($"scanSrcDestDir in: {ts.TotalMilliseconds} ms");
|
||||
|
||||
@@ -204,6 +204,11 @@ namespace WebDoorCreator.UI.Components.FilesMan
|
||||
);
|
||||
await updTask1;
|
||||
sendDataVal = 30;
|
||||
var updTask2 = Task.Run(async () =>
|
||||
{
|
||||
await WDCService.ListValuesLuaNgeInsert(rootPathOld);
|
||||
});
|
||||
await updTask2;
|
||||
await doScan();
|
||||
sendDataVal = 90;
|
||||
}
|
||||
@@ -294,7 +299,7 @@ namespace WebDoorCreator.UI.Components.FilesMan
|
||||
}
|
||||
protected void ReplaceFile(string FileToMoveAndDelete, string FileToReplace)
|
||||
{
|
||||
|
||||
|
||||
File.Replace(FileToMoveAndDelete, FileToReplace, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>0.9.2309.0512</Version>
|
||||
<Version>0.9.2309.0515</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
Reference in New Issue
Block a user