Match TFS Changeset 303362
This commit is contained in:
16
EDA Viewer/Blazor/Counter.razor
Normal file
16
EDA Viewer/Blazor/Counter.razor
Normal file
@ -0,0 +1,16 @@
|
||||
<h3>Counter</h3>
|
||||
|
||||
<p>
|
||||
Current Count: @i
|
||||
</p>
|
||||
|
||||
<button @onclick="IncrementCounter" class="btn btn-primary">Click Me</button>
|
||||
|
||||
@code {
|
||||
int i = 0;
|
||||
|
||||
private void IncrementCounter()
|
||||
{
|
||||
i += 1;
|
||||
}
|
||||
}
|
167
EDA Viewer/Controllers/HomeController.cs
Normal file
167
EDA Viewer/Controllers/HomeController.cs
Normal file
@ -0,0 +1,167 @@
|
||||
using EDAViewer.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace EDAViewer.Controllers
|
||||
{
|
||||
|
||||
public class HomeController : Controller, IHomeController
|
||||
{
|
||||
|
||||
private readonly Log _Log;
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly IsEnvironment _IsEnvironment;
|
||||
private readonly Singleton.IBackground _Background;
|
||||
|
||||
public HomeController(ILogger<HomeController> logger, IsEnvironment isEnvironment, Singleton.IBackground background, AppSettings appSettings)
|
||||
{
|
||||
_Log = new Log(logger);
|
||||
_Background = background;
|
||||
_AppSettings = appSettings;
|
||||
_IsEnvironment = isEnvironment;
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Privacy()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||
public IActionResult Error()
|
||||
{
|
||||
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
|
||||
}
|
||||
|
||||
public IActionResult Encode(string value = null)
|
||||
{
|
||||
string result = string.Empty;
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
result = HttpUtility.UrlEncode(value);
|
||||
return Content(result, "text/plain");
|
||||
}
|
||||
|
||||
public IActionResult Background(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null, int? invoke_eda_dcp = null)
|
||||
{
|
||||
_Background.SendStatusOk();
|
||||
if (message_clear.HasValue && message_clear.Value)
|
||||
_Background.ClearMessage();
|
||||
if (exceptions_clear.HasValue && exceptions_clear.Value)
|
||||
_Background.Exceptions.Clear();
|
||||
if (set_is_primary_instance.HasValue)
|
||||
{
|
||||
if (set_is_primary_instance.Value)
|
||||
_Background.SetIsPrimaryInstance();
|
||||
else
|
||||
_Background.ClearIsPrimaryInstance();
|
||||
}
|
||||
string message;
|
||||
if (string.IsNullOrWhiteSpace(_Background.Message))
|
||||
message = "N/A";
|
||||
else
|
||||
message = _Background.Message;
|
||||
//Response.AppendToLog(_Background.Message);
|
||||
List<Exception> exceptions = new();
|
||||
foreach (Exception exception in _Background.Exceptions)
|
||||
exceptions.Add(exception);
|
||||
ViewBag.Message = message;
|
||||
ViewBag.Exceptions = exceptions;
|
||||
ViewBag.URLs = _AppSettings.URLs;
|
||||
ViewBag.Profile = _IsEnvironment.Profile;
|
||||
ViewBag.WorkingDirectory = _Background.WorkingDirectory;
|
||||
ViewBag.IsPrimaryInstance = _Background.IsPrimaryInstance();
|
||||
ViewBag.ExceptionsCount = string.Concat("Exception(s) - ", exceptions.Count);
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult<IEnumerable<SelectListItem>> GetDirectoriesOrFiles(string path = null, bool? upDirectory = null, string filter = null)
|
||||
{
|
||||
List<SelectListItem> results = new();
|
||||
//System.Threading.Thread.Sleep(1500);
|
||||
//path = @"D:\Tmp";
|
||||
if (string.IsNullOrEmpty(path))
|
||||
path = string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA");
|
||||
if (string.IsNullOrEmpty(filter))
|
||||
filter = "*";
|
||||
if (upDirectory.HasValue && upDirectory.Value && path.Contains('|'))
|
||||
{
|
||||
string[] segments = path.Split('|');
|
||||
path = segments[^1];
|
||||
}
|
||||
//System.IO.File.AppendAllText(string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA\a.txt"), path);
|
||||
string gold = "Gold";
|
||||
if (System.IO.File.Exists(path))
|
||||
{
|
||||
string[] files = Directory.GetFiles(Path.GetDirectoryName(path), filter, SearchOption.TopDirectoryOnly);
|
||||
foreach (string item in files)
|
||||
results.Add(new SelectListItem() { Value = item, Text = Path.GetFileName(item), Group = new SelectListGroup() { Name = "File(s)" } });
|
||||
if (results.Count > 1)
|
||||
results.Insert(0, new SelectListItem() { Value = string.Empty, Text = string.Concat("Select - ", 0, " - ", files.Length) });
|
||||
}
|
||||
else if (Directory.Exists(path))
|
||||
{
|
||||
string[] files = Directory.GetFiles(path, filter, SearchOption.TopDirectoryOnly);
|
||||
string[] directories = Directory.GetDirectories(path, filter, SearchOption.TopDirectoryOnly).Where(l => Path.GetFileName(l) != gold).ToArray();
|
||||
for (short i = 0; i < short.MaxValue; i++)
|
||||
{
|
||||
if (directories.Length != 1 || files.Length != 0)
|
||||
break;
|
||||
else
|
||||
{
|
||||
path = directories[0];
|
||||
files = Directory.GetFiles(path, filter, SearchOption.TopDirectoryOnly);
|
||||
directories = Directory.GetDirectories(path, filter, SearchOption.TopDirectoryOnly).Where(l => Path.GetFileName(l) != gold).ToArray();
|
||||
if (directories.Length == 0 && files.Length == 0)
|
||||
{
|
||||
directories = new string[] { path };
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (string item in directories)
|
||||
results.Add(new SelectListItem() { Value = item, Text = Path.GetFileName(item), Group = new SelectListGroup() { Name = "Directorie(s)" } });
|
||||
foreach (string item in files)
|
||||
results.Add(new SelectListItem() { Value = item, Text = Path.GetFileName(item), Group = new SelectListGroup() { Name = "File(s)" } });
|
||||
if (results.Count > 1)
|
||||
results.Insert(0, new SelectListItem() { Value = string.Empty, Text = string.Concat("Select - ", directories.Length, " - ", files.Length) });
|
||||
}
|
||||
//System.IO.File.AppendAllText(string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA\b.txt"), results.Count.ToString());
|
||||
if (!results.Any())
|
||||
results.Add(new SelectListItem() { Value = path, Text = string.Concat("Nothing Found *{", path, "}") });
|
||||
return results;
|
||||
}
|
||||
|
||||
public IActionResult ViewEdaHtmlDiff(WithEnvironment withEnvironment = null)
|
||||
{
|
||||
if (withEnvironment is null)
|
||||
withEnvironment = new WithEnvironment();
|
||||
string path = string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA");
|
||||
if (!Directory.Exists(path))
|
||||
path = @"C:\";
|
||||
EdaHtmlDiff model = new(withEnvironment, path);
|
||||
ViewBag.message = model.message;
|
||||
return View(model);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// dotnet publish --configuration Release --runtime win-x64 --verbosity normal --self-contained true -o "L:\net5.0\EDAViewer"
|
||||
// dotnet publish --configuration Release --runtime win-x64 --verbosity normal --self-contained true -o "D:\net5.0\EDAViewer"
|
||||
// dotnet publish --configuration Release --runtime win-x64 --verbosity normal --self-contained true -o "D:\.jenkins\publish\manual-Mesa-0\EDAViewer"
|
||||
//http://eaf-dev.mes.infineon.com:8080/job/Mesa/buildWithParameters?token=DotnetRules&projectName=EDA%20Viewer
|
||||
//http://eaf-prod.mes.infineon.com:8080/job/Mesa/buildWithParameters?token=DotnetRules&projectName=EDA%20Viewer
|
||||
//sc create EDAViewer_5003 binPath="D:\.jenkins\publish\manual-Mesa-0\EDAViewer\EDA Viewer.exe"
|
59
EDA Viewer/EDA Viewer.csproj
Normal file
59
EDA Viewer/EDA Viewer.csproj
Normal file
@ -0,0 +1,59 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup Label="Globals">
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>EDAViewer</RootNamespace>
|
||||
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
|
||||
<UserSecretsId>d71a673c-be39-45b5-ae5f-4c22639be045</UserSecretsId>
|
||||
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
|
||||
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
|
||||
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsWindows)'=='true'">
|
||||
<DefineConstants>Windows</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsOSX)'=='true'">
|
||||
<DefineConstants>OSX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(IsLinux)'=='true'">
|
||||
<DefineConstants>Linux</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Infineon.Monitoring.MonA" Version="2.0.0" />
|
||||
<PackageReference Include="Log4net" Version="2.0.12" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.5" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="5.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.1" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.1.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="6.1.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.1.4" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\images\" />
|
||||
<Folder Include="wwwroot\js\html5shiv\3.7.2\" />
|
||||
<Folder Include="wwwroot\js\respond\1.4.2\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="appsettings.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="appsettings.Staging.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="appsettings.Development.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
10
EDA Viewer/GlobalSuppressions.cs
Normal file
10
EDA Viewer/GlobalSuppressions.cs
Normal file
@ -0,0 +1,10 @@
|
||||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~P:EDAViewer.Models.WithEnvironment.message")]
|
||||
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~P:EDAViewer.Models.WithEnvironment.now_ticks")]
|
||||
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~P:EDAViewer.Models.WithEnvironment.user_name")]
|
||||
[assembly: SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "<Pending>", Scope = "member", Target = "~P:EDAViewer.Models.WithEnvironment.machine_name")]
|
174
EDA Viewer/HostedService/TimedHostedService.cs
Normal file
174
EDA Viewer/HostedService/TimedHostedService.cs
Normal file
@ -0,0 +1,174 @@
|
||||
using EDAViewer.Singleton;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EDAViewer.HostedService
|
||||
{
|
||||
|
||||
public class TimedHostedService : IHostedService, IDisposable
|
||||
{
|
||||
|
||||
private readonly int _ExecutionCount;
|
||||
private readonly Background _Background;
|
||||
private readonly IsEnvironment _IsEnvironment;
|
||||
private readonly ILogger<TimedHostedService> _Log;
|
||||
|
||||
private Timer _EDAOutputArchiveTimer;
|
||||
private Timer _LogPathCleanUpByWeekTimer;
|
||||
private Timer _EdaDataCollectionPlansTimer;
|
||||
|
||||
public TimedHostedService(IsEnvironment isEnvironment, Background background, IServiceProvider serviceProvider)
|
||||
{
|
||||
_ExecutionCount = 0;
|
||||
_Background = background;
|
||||
_IsEnvironment = isEnvironment;
|
||||
_Log = serviceProvider.GetRequiredService<ILogger<TimedHostedService>>();
|
||||
_EDAOutputArchiveTimer = new Timer(EDAOutputArchiveCallback, null, Timeout.Infinite, Timeout.Infinite);
|
||||
_LogPathCleanUpByWeekTimer = new Timer(LogPathCleanUpByWeekCallback, null, Timeout.Infinite, Timeout.Infinite);
|
||||
_EdaDataCollectionPlansTimer = new Timer(EdaDataCollectionPlansCallback, null, Timeout.Infinite, Timeout.Infinite);
|
||||
}
|
||||
|
||||
public Task StartAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
_Log.LogInformation(string.Concat("Timed Hosted Service: ", nameof(Background), ":", _IsEnvironment.Profile, ":", Environment.ProcessId, " running."));
|
||||
_Background.Update(_Log);
|
||||
if (_IsEnvironment.Development)
|
||||
{
|
||||
int milliSeconds = 3000;
|
||||
_EdaDataCollectionPlansTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_EdaDataCollectionPlansTimer);
|
||||
milliSeconds += 2000;
|
||||
}
|
||||
else if (_IsEnvironment.Staging)
|
||||
{
|
||||
int milliSeconds = 3000;
|
||||
_LogPathCleanUpByWeekTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_LogPathCleanUpByWeekTimer);
|
||||
milliSeconds += 2000;
|
||||
_EdaDataCollectionPlansTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_EdaDataCollectionPlansTimer);
|
||||
milliSeconds += 2000;
|
||||
_EDAOutputArchiveTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_EDAOutputArchiveTimer);
|
||||
milliSeconds += 2000;
|
||||
}
|
||||
else if (_IsEnvironment.Production)
|
||||
{
|
||||
int milliSeconds = 3000;
|
||||
_LogPathCleanUpByWeekTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_LogPathCleanUpByWeekTimer);
|
||||
milliSeconds += 2000;
|
||||
_EdaDataCollectionPlansTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_EdaDataCollectionPlansTimer);
|
||||
milliSeconds += 2000;
|
||||
_EDAOutputArchiveTimer.Change(milliSeconds, Timeout.Infinite);
|
||||
;
|
||||
_Background.Timers.Add(_EDAOutputArchiveTimer);
|
||||
milliSeconds += 2000;
|
||||
}
|
||||
else
|
||||
throw new Exception();
|
||||
if (_IsEnvironment.Staging || _IsEnvironment.Production)
|
||||
{
|
||||
string countDirectory = _Background.GetCountDirectory("Start");
|
||||
string checkDirectory = Path.GetPathRoot(countDirectory);
|
||||
if (Directory.Exists(checkDirectory))
|
||||
Directory.CreateDirectory(countDirectory);
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task StopAsync(CancellationToken stoppingToken)
|
||||
{
|
||||
_Log.LogInformation(string.Concat("Timed Hosted Service: ", nameof(Background), ":", _IsEnvironment.Profile, ":", Environment.ProcessId, " is stopping."));
|
||||
_Background.Stop(immediate: true);
|
||||
for (short i = 0; i < short.MaxValue; i++)
|
||||
{
|
||||
Thread.Sleep(500);
|
||||
if (_ExecutionCount == 0)
|
||||
break;
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_Background.Dispose();
|
||||
}
|
||||
|
||||
private void LogPathCleanUpByWeekCallback(object state)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_Background.IsPrimaryInstance())
|
||||
_Background.LogPathCleanUpByWeekCallback();
|
||||
}
|
||||
catch (Exception e) { _Background.Catch(e); }
|
||||
try
|
||||
{
|
||||
TimeSpan timeSpan;
|
||||
if (!_Background.IsPrimaryInstance())
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
|
||||
else
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddHours(6).Ticks - DateTime.Now.Ticks);
|
||||
_LogPathCleanUpByWeekTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||
}
|
||||
catch (Exception e) { _Background.Catch(e); }
|
||||
}
|
||||
|
||||
private void EDAOutputArchiveCallback(object state)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_Background.IsPrimaryInstance())
|
||||
_Background.EDAOutputArchiveCallback();
|
||||
}
|
||||
catch (Exception e) { _Background.Catch(e); }
|
||||
try
|
||||
{
|
||||
TimeSpan timeSpan;
|
||||
if (!_Background.IsPrimaryInstance())
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
|
||||
else
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddHours(6).Ticks - DateTime.Now.Ticks);
|
||||
_EDAOutputArchiveTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||
}
|
||||
catch (Exception e) { _Background.Catch(e); }
|
||||
}
|
||||
|
||||
private void EdaDataCollectionPlansCallback(object state)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_Background.IsPrimaryInstance())
|
||||
_Background.EdaDataCollectionPlansCallback();
|
||||
}
|
||||
catch (Exception e) { _Background.Catch(e); }
|
||||
try
|
||||
{
|
||||
TimeSpan timeSpan;
|
||||
if (!_Background.IsPrimaryInstance())
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddSeconds(15).Ticks - DateTime.Now.Ticks);
|
||||
else
|
||||
timeSpan = new TimeSpan(DateTime.Now.AddHours(2).Ticks - DateTime.Now.Ticks);
|
||||
_EdaDataCollectionPlansTimer.Change((int)timeSpan.TotalMilliseconds, Timeout.Infinite);
|
||||
}
|
||||
catch (Exception e) { _Background.Catch(e); }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.Core
|
||||
{
|
||||
public class BackboneComponent
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.Core
|
||||
{
|
||||
public class BackboneStatusCache
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.Core
|
||||
{
|
||||
public interface ILoggingSetupManager
|
||||
{
|
||||
}
|
||||
}
|
6
EDA Viewer/Library/Eaf/Core/AutoGenerated/StatusItem.cs
Normal file
6
EDA Viewer/Library/Eaf/Core/AutoGenerated/StatusItem.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.Core
|
||||
{
|
||||
public class StatusItem
|
||||
{
|
||||
}
|
||||
}
|
48
EDA Viewer/Library/Eaf/Core/Backbone.cs
Normal file
48
EDA Viewer/Library/Eaf/Core/Backbone.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using Library.PeerGroup.GCL.Annotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Eaf.Core
|
||||
{
|
||||
public class Backbone
|
||||
{
|
||||
public const string STATE_ERROR = "Error";
|
||||
public const string STATE_OFFLINE = "Offline";
|
||||
public const string STATE_RUNNING = "Running";
|
||||
public const string STATE_SHUTDOWN = "Shutting Down";
|
||||
public const string STATE_STARTING = "Starting";
|
||||
|
||||
protected Backbone() { }
|
||||
|
||||
[NotNull]
|
||||
public static Backbone Instance { get; }
|
||||
[NotNull]
|
||||
public ILoggingSetupManager LoggingConfigurationManager { get; set; }
|
||||
public BackboneStatusCache Status { get; }
|
||||
public bool IsAutomatedRestartActive { get; }
|
||||
public bool IsReadyForRestart { get; }
|
||||
public string StartTime { get; }
|
||||
public string State { get; }
|
||||
public string Name { get; }
|
||||
public string ConfigurationServiceAddress { get; }
|
||||
public string CellName { get; }
|
||||
protected bool IsInitialized { get; set; }
|
||||
protected Dictionary<string, BackboneComponent> BackboneComponents { get; }
|
||||
|
||||
public void AddBackboneComponent(BackboneComponent backboneComponent) { }
|
||||
public bool ContainsBackboneComponent(string id) { throw new NotImplementedException(); }
|
||||
[Obsolete("Use the capabilities exposed via the Status property -> GetAll. Will be removed with next major release.")]
|
||||
public List<StatusItem> GetAllStatuses() { throw new NotImplementedException(); }
|
||||
public BackboneComponent GetBackboneComponentById(string id) { throw new NotImplementedException(); }
|
||||
public List<T> GetBackboneComponentsOfType<T>() { throw new NotImplementedException(); }
|
||||
public List<BackboneComponent> GetBackboneComponentsOfType(Type type) { throw new NotImplementedException(); }
|
||||
public void RegisterSubprocess(int pid) { }
|
||||
[Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")]
|
||||
public void SetStatus(string statusName, string statusValue) { }
|
||||
[Obsolete("Use the capabilities exposed via the Status property -> SetValue. Will be removed with next major release.")]
|
||||
public void SetStatus(BackboneComponent source, string statusName, string statusValue) { }
|
||||
protected void CloseConnectionOfComponents(List<BackboneComponent> components) { }
|
||||
protected virtual void StopAllComponents() { }
|
||||
protected void StopComponents(List<BackboneComponent> components) { }
|
||||
}
|
||||
}
|
24
EDA Viewer/Library/Eaf/Core/Smtp/EmailMessage.cs
Normal file
24
EDA Viewer/Library/Eaf/Core/Smtp/EmailMessage.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace Library.Eaf.Core.Smtp
|
||||
{
|
||||
|
||||
public class EmailMessage
|
||||
{
|
||||
public EmailMessage() { }
|
||||
public EmailMessage(string subject, string body, MailPriority priority = MailPriority.Normal) { }
|
||||
|
||||
public string Body { get; }
|
||||
public MailPriority Priority { get; }
|
||||
public string Subject { get; }
|
||||
|
||||
public EmailMessage PriorityHigh() { throw new NotImplementedException(); }
|
||||
public EmailMessage PriorityLow() { throw new NotImplementedException(); }
|
||||
public EmailMessage PriorityNormal() { throw new NotImplementedException(); }
|
||||
public EmailMessage SetBody(string body) { throw new NotImplementedException(); }
|
||||
public EmailMessage SetPriority(MailPriority priority) { throw new NotImplementedException(); }
|
||||
public EmailMessage SetSubject(string subject) { throw new NotImplementedException(); }
|
||||
|
||||
}
|
||||
|
||||
}
|
9
EDA Viewer/Library/Eaf/Core/Smtp/ISmtp.cs
Normal file
9
EDA Viewer/Library/Eaf/Core/Smtp/ISmtp.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace Library.Eaf.Core.Smtp
|
||||
{
|
||||
|
||||
public interface ISmtp
|
||||
{
|
||||
void Send(EmailMessage message);
|
||||
}
|
||||
|
||||
}
|
11
EDA Viewer/Library/Eaf/Core/Smtp/MailPriority.cs
Normal file
11
EDA Viewer/Library/Eaf/Core/Smtp/MailPriority.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Library.Eaf.Core.Smtp
|
||||
{
|
||||
|
||||
public enum MailPriority
|
||||
{
|
||||
Low = 0,
|
||||
Normal = 1,
|
||||
High = 2
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class ChangeDataCollectionHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class DataCollectionRequest
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class EquipmentEvent
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class EquipmentException
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class EquipmentSelfDescription
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class GetParameterValuesHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IConnectionControl
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IDataTracingHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IEquipmentCommandService
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using Library.PeerGroup.GCL.Annotations;
|
||||
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IEquipmentControl : IPackageSource
|
||||
{
|
||||
[NotNull]
|
||||
IEquipmentSelfDescriptionBuilder SelfDescriptionBuilder { get; }
|
||||
[NotNull]
|
||||
IEquipmentDataCollection DataCollection { get; }
|
||||
[NotNull]
|
||||
IEquipmentCommandService Commands { get; }
|
||||
[NotNull]
|
||||
IConnectionControl Connection { get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IEquipmentSelfDescriptionBuilder
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IPackage
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface ISelfDescriptionLookup
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IVirtualParameterValuesHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class SetParameterValuesHandler
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public class TraceRequest
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
using Library.Eaf.EquipmentCore.DataCollection.Reporting;
|
||||
using Library.Eaf.EquipmentCore.SelfDescription.ElementDescription;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IEquipmentDataCollection
|
||||
{
|
||||
IVirtualParameterValuesHandler VirtualParameterValuesHandler { get; }
|
||||
ISelfDescriptionLookup SelfDescriptionLookup { get; }
|
||||
EquipmentSelfDescription SelfDescription { get; }
|
||||
IEnumerable<DataCollectionRequest> ActiveRequests { get; }
|
||||
IDataTracingHandler DataTracingHandler { get; }
|
||||
|
||||
ParameterValue CreateParameterValue(EquipmentParameter parameter, object value);
|
||||
void NotifyDataTracingAvailable(bool isAvailable);
|
||||
void RegisterChangeDataCollectionHandler(ChangeDataCollectionHandler handler);
|
||||
void RegisterDataTracingHandler(IDataTracingHandler handler);
|
||||
void RegisterGetParameterValuesHandler(GetParameterValuesHandler handler);
|
||||
void RegisterSetParameterValuesHandler(SetParameterValuesHandler handler);
|
||||
void TriggerDeactivate(DataCollectionRequest deactivateRequest);
|
||||
void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters);
|
||||
void TriggerEvent(EquipmentEvent equipmentEvent, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
||||
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters);
|
||||
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
||||
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride);
|
||||
void TriggerExceptionClear(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage);
|
||||
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride, IPackage sourcePackage);
|
||||
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, string severityOverride, string descriptionOverride);
|
||||
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
||||
void TriggerExceptionSet(EquipmentException equipmentException, IEnumerable<ParameterValue> parameters);
|
||||
void TriggerPerformanceRestored();
|
||||
void TriggerPerformanceWarning();
|
||||
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters);
|
||||
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, IPackage sourcePackage);
|
||||
void TriggerTraceSample(TraceRequest traceRequest, long sampleId, IEnumerable<ParameterValue> parameters, DateTime equipmentTimeStamp);
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.EquipmentCore.Control
|
||||
{
|
||||
public interface IPackageSource
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using Library.Eaf.EquipmentCore.SelfDescription.ElementDescription;
|
||||
using Library.PeerGroup.GCL.Annotations;
|
||||
using System;
|
||||
|
||||
namespace Library.Eaf.EquipmentCore.DataCollection.Reporting
|
||||
{
|
||||
public class ParameterValue
|
||||
{
|
||||
public ParameterValue(EquipmentParameter definition, object value) { }
|
||||
public ParameterValue(EquipmentParameter definition, object value, DateTime timestamp) { }
|
||||
|
||||
public virtual object Value { get; protected internal set; }
|
||||
[NotNull]
|
||||
public EquipmentParameter Definition { get; }
|
||||
public DateTime Timestamp { get; protected set; }
|
||||
|
||||
public virtual ParameterValue Clone(EquipmentParameter newDefinition) { throw new NotImplementedException(); }
|
||||
public override string ToString() { return base.ToString(); }
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
using Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
||||
|
||||
namespace Library.Eaf.EquipmentCore.SelfDescription.ElementDescription
|
||||
{
|
||||
public class EquipmentParameter
|
||||
{
|
||||
public EquipmentParameter(EquipmentParameter source, ParameterTypeDefinition typeDefinition) { }
|
||||
public EquipmentParameter(string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { }
|
||||
public EquipmentParameter(string id, string name, ParameterTypeDefinition typeDefinition, string description, bool isTransient = false, bool isReadOnly = true) { }
|
||||
|
||||
public string Name { get; }
|
||||
public string Id { get; }
|
||||
public string Description { get; }
|
||||
public string SourcePath { get; }
|
||||
public string SourceEquipment { get; }
|
||||
public ParameterTypeDefinition TypeDefinition { get; }
|
||||
public bool IsTransient { get; }
|
||||
public bool IsReadOnly { get; }
|
||||
|
||||
public override string ToString() { return base.ToString(); }
|
||||
public string ToStringWithDetails() { return base.ToString(); }
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
namespace Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes
|
||||
{
|
||||
public class Field
|
||||
{
|
||||
public Field(string name, string description, bool canBeNull, ParameterTypeDefinition typeDefinition) { }
|
||||
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
public ParameterTypeDefinition TypeDefinition { get; }
|
||||
public bool CanBeNull { get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
namespace Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes
|
||||
{
|
||||
public abstract class ParameterTypeDefinition
|
||||
{
|
||||
public ParameterTypeDefinition(string name, string description) { }
|
||||
|
||||
public string Name { get; }
|
||||
public string Description { get; }
|
||||
|
||||
public override string ToString() { return base.ToString(); }
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes
|
||||
{
|
||||
public class StructuredType : ParameterTypeDefinition
|
||||
{
|
||||
|
||||
public StructuredType(string name, string description, IList<Field> fields) : base(name, description) { }
|
||||
|
||||
public IList<Field> Fields { get; }
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Library.Eaf.Management.ConfigurationData.CellAutomation
|
||||
{
|
||||
public interface IConfigurationObject
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
|
||||
namespace Library.Eaf.Management.ConfigurationData.CellAutomation
|
||||
{
|
||||
[System.Runtime.Serialization.DataContractAttribute(IsReference = true)]
|
||||
public class ModelObjectParameterDefinition : IConfigurationObject
|
||||
{
|
||||
public ModelObjectParameterDefinition() { }
|
||||
public ModelObjectParameterDefinition(string name, ModelObjectParameterType valueType, object defaultValue) { }
|
||||
public ModelObjectParameterDefinition(string name, Type enumType, object defaultValue) { }
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long Id { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual string Name { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual string Value { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual ModelObjectParameterType ValueType { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual string EnumType { get; set; }
|
||||
|
||||
public virtual ModelObjectParameterDefinition Clone() { return null; }
|
||||
public virtual bool IsValidValue(string value) { return false; }
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
namespace Library.Eaf.Management.ConfigurationData.CellAutomation
|
||||
{
|
||||
public enum ModelObjectParameterType
|
||||
{
|
||||
String = 0,
|
||||
Bool = 1,
|
||||
Byte = 2,
|
||||
SignedByte = 3,
|
||||
Integer = 4,
|
||||
UnsignedInteger = 5,
|
||||
LongInteger = 6,
|
||||
UnsignedLongInteger = 7,
|
||||
Double = 8,
|
||||
Float = 9,
|
||||
Enum = 10
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
using Library.PeerGroup.GCL.SecsDriver;
|
||||
using System;
|
||||
|
||||
namespace Library.Eaf.Management.ConfigurationData.Semiconductor.CellInstances
|
||||
{
|
||||
[System.Runtime.Serialization.DataContractAttribute]
|
||||
public class SecsConnectionConfiguration
|
||||
{
|
||||
public SecsConnectionConfiguration() { }
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T6HsmsControlMessage { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T5ConnectionSeperation { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T4InterBlock { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T3MessageReply { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T2Protocol { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T1InterCharacter { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual SerialBaudRate? BaudRate { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual SecsTransportType? PortType { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? Port { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan LinkTestTimer { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual string Host { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? DeviceId { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual HsmsSessionMode? SessionMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual HsmsConnectionMode? ConnectionMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T7ConnectionIdle { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual TimeSpan T8NetworkIntercharacter { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
namespace Library.Ifx.Eaf.Common.Configuration
|
||||
{
|
||||
[System.Runtime.Serialization.DataContractAttribute]
|
||||
public class ConnectionSetting
|
||||
{
|
||||
public ConnectionSetting(string name, string value) { }
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string Name { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Ifx.Eaf.EquipmentConnector.File.Component
|
||||
{
|
||||
public class File
|
||||
{
|
||||
public File(string filePath) { throw new NotImplementedException(); }
|
||||
public File(string filePath, DateTime timeFileFound) { throw new NotImplementedException(); }
|
||||
|
||||
public string Path { get; }
|
||||
public DateTime TimeFound { get; }
|
||||
public bool IsErrorFile { get; }
|
||||
public Dictionary<string, string> ContentParameters { get; }
|
||||
|
||||
public File UpdateContentParameters(Dictionary<string, string> contentParameters) { throw new NotImplementedException(); }
|
||||
public File UpdateParsingStatus(bool isErrorFile) { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
using Library.Ifx.Eaf.EquipmentConnector.File.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Ifx.Eaf.EquipmentConnector.File.Component
|
||||
{
|
||||
public class FilePathGenerator
|
||||
{
|
||||
public const char PLACEHOLDER_IDENTIFIER = '%';
|
||||
public const char PLACEHOLDER_SEPARATOR = ':';
|
||||
public const string PLACEHOLDER_NOT_AVAILABLE = "NA";
|
||||
public const string PLACEHOLDER_ORIGINAL_FILE_NAME = "OriginalFileName";
|
||||
public const string PLACEHOLDER_ORIGINAL_FILE_EXTENSION = "OriginalFileExtension";
|
||||
public const string PLACEHOLDER_DATE_TIME = "DateTime";
|
||||
public const string PLACEHOLDER_SUB_FOLDER = "SubFolder";
|
||||
public const string PLACEHOLDER_CELL_NAME = "CellName";
|
||||
|
||||
public FilePathGenerator(FileConnectorConfiguration config, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
|
||||
public FilePathGenerator(FileConnectorConfiguration config, File file, bool isErrorFile = false, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
|
||||
public FilePathGenerator(FileConnectorConfiguration config, string sourceFilePath, bool isErrorFile = false, Dictionary<string, string> customPattern = null) { throw new NotImplementedException(); }
|
||||
|
||||
protected string SubFolderPath { get; }
|
||||
protected FileConnectorConfiguration Configuration { get; }
|
||||
protected File File { get; }
|
||||
protected bool IsErrorFile { get; }
|
||||
protected string DefaultPlaceHolderValue { get; }
|
||||
|
||||
public string GetFullTargetPath() { throw new NotImplementedException(); }
|
||||
public virtual string GetTargetFileName() { throw new NotImplementedException(); }
|
||||
public string GetTargetFolder(bool throwExceptionIfNotExist = true) { throw new NotImplementedException(); }
|
||||
protected virtual string GetSubFolder(string folderPattern, string subFolderPath) { throw new NotImplementedException(); }
|
||||
protected virtual string PrepareFolderPath(string targetFolderPath, string subFolderPath) { throw new NotImplementedException(); }
|
||||
protected string ReplacePlaceholder(string inputPath) { throw new NotImplementedException(); }
|
||||
}
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
using Library.Ifx.Eaf.Common.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Ifx.Eaf.EquipmentConnector.File.Configuration
|
||||
{
|
||||
[System.Runtime.Serialization.DataContractAttribute]
|
||||
public class FileConnectorConfiguration
|
||||
{
|
||||
public const ulong IDLE_EVENT_WAIT_TIME_DEFAULT = 360;
|
||||
public const ulong FILE_HANDLE_TIMEOUT_DEFAULT = 15;
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual bool? TriggerOnChanged { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? PostProcessingRetries { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual bool? CopySourceFolderStructure { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public IfPostProcessingFailsEnum? IfPostProcessingFailsAction { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string AlternateTargetFolder { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public long? FileHandleTimeout { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public bool? DeleteEmptySourceSubFolders { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public long? IdleEventWaitTimeInSeconds { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string FileAgeThreshold { get; set; }
|
||||
public bool? FolderAgeCheckIndividualSubFolders { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual ZipModeEnum? ZipMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public FileAgeFilterEnum? FileAgeFilterMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string ZipTargetFileName { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string ZipErrorTargetFileName { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public long? ZipFileSubFolderLevel { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string DefaultPlaceHolderValue { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public bool? UseZip64Mode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public List<ConnectionSetting> ConnectionSettings { get; set; }
|
||||
public string SourceDirectoryCloaking { get; set; }
|
||||
public string FolderAgeThreshold { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? FileScanningIntervalInSeconds { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual bool? TriggerOnCreated { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? ZipFileTime { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string SourceFileLocation { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string SourceFileFilter { get; set; }
|
||||
public List<string> SourceFileFilters { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual bool? IncludeSubDirectories { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual FileScanningOptionEnum? FileScanningOption { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string TargetFileLocation { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string ErrorTargetFileLocation { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string TargetFileName { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? FileHandleWaitTime { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public IfFileExistEnum? IfFileExistAction { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public long? ConnectionRetryInterval { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public PreProcessingModeEnum? PreProcessingMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public PostProcessingModeEnum? PostProcessingMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public PostProcessingModeEnum? ErrorPostProcessingMode { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public virtual long? ZipFileAmount { get; set; }
|
||||
[System.Runtime.Serialization.DataMemberAttribute]
|
||||
public string ErrorTargetFileName { get; set; }
|
||||
|
||||
public void Initialize() { throw new NotImplementedException(); }
|
||||
|
||||
public enum PostProcessingModeEnum
|
||||
{
|
||||
None = 0,
|
||||
Move = 1,
|
||||
Copy = 2,
|
||||
Rename = 3,
|
||||
Zip = 4,
|
||||
Delete = 5,
|
||||
MoveFolder = 6,
|
||||
CopyFolder = 7,
|
||||
DeleteFolder = 8
|
||||
}
|
||||
public enum PreProcessingModeEnum
|
||||
{
|
||||
None = 0,
|
||||
Process = 1
|
||||
}
|
||||
public enum IfFileExistEnum
|
||||
{
|
||||
Overwrite = 0,
|
||||
LeaveFiles = 1,
|
||||
Delete = 2
|
||||
}
|
||||
public enum IfPostProcessingFailsEnum
|
||||
{
|
||||
LeaveFiles = 0,
|
||||
Delete = 1
|
||||
}
|
||||
public enum FileScanningOptionEnum
|
||||
{
|
||||
FileWatcher = 0,
|
||||
TimeBased = 1
|
||||
}
|
||||
public enum ZipModeEnum
|
||||
{
|
||||
ZipByAmountOrTime = 0,
|
||||
ZipByFileName = 1,
|
||||
ZipBySubFolderName = 2
|
||||
}
|
||||
public enum FileAgeFilterEnum
|
||||
{
|
||||
IgnoreNewer = 0,
|
||||
IgnoreOlder = 1
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
using Library.Eaf.EquipmentCore.SelfDescription.ParameterTypes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Library.Ifx.Eaf.EquipmentConnector.File.SelfDescription
|
||||
{
|
||||
public class FileConnectorParameterTypeDefinitionProvider
|
||||
{
|
||||
public FileConnectorParameterTypeDefinitionProvider() { }
|
||||
|
||||
public IEnumerable<ParameterTypeDefinition> GetAllParameterTypeDefinition() { return null; }
|
||||
public ParameterTypeDefinition GetParameterTypeDefinition(string name) { return null; }
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace Library.PeerGroup.GCL.Annotations
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.Delegate, AllowMultiple = false, Inherited = true)]
|
||||
public sealed class NotNullAttribute : Attribute
|
||||
{
|
||||
public NotNullAttribute() { }
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace Library.PeerGroup.GCL.SecsDriver
|
||||
{
|
||||
public enum HsmsConnectionMode
|
||||
{
|
||||
Active = 0,
|
||||
Passive = 1
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace Library.PeerGroup.GCL.SecsDriver
|
||||
{
|
||||
public enum HsmsSessionMode
|
||||
{
|
||||
MultiSession = 0,
|
||||
SingleSession = 1
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
namespace Library.PeerGroup.GCL.SecsDriver
|
||||
{
|
||||
public enum SecsTransportType
|
||||
{
|
||||
HSMS = 0,
|
||||
Serial = 1
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
namespace Library.PeerGroup.GCL.SecsDriver
|
||||
{
|
||||
public enum SerialBaudRate
|
||||
{
|
||||
Baud9600 = 0,
|
||||
Baud19200 = 1,
|
||||
Baud4800 = 2,
|
||||
Baud2400 = 3,
|
||||
Baud1200 = 4,
|
||||
Baud300 = 5,
|
||||
Baud150 = 6,
|
||||
Baud38400 = 7,
|
||||
Baud57600 = 8,
|
||||
Baud115200 = 9
|
||||
}
|
||||
}
|
15
EDA Viewer/Models/AppSettings.cs
Normal file
15
EDA Viewer/Models/AppSettings.cs
Normal file
@ -0,0 +1,15 @@
|
||||
namespace EDAViewer.Models
|
||||
{
|
||||
public class AppSettings
|
||||
{
|
||||
public string Company { get; set; }
|
||||
public string ECEDADatabasePassword { get; set; }
|
||||
public string EncryptedPassword { get; set; }
|
||||
public string IFXEDADatabasePassword { get; set; }
|
||||
public string MonARessource { get; set; }
|
||||
public string Server { get; set; }
|
||||
public string ServiceUser { get; set; }
|
||||
public string URLs { get; set; }
|
||||
public string WorkingDirectoryName { get; set; }
|
||||
}
|
||||
}
|
52
EDA Viewer/Models/EdaHtmlDiff.cs
Normal file
52
EDA Viewer/Models/EdaHtmlDiff.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using EDAViewer.Models;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace EDAViewer.Models
|
||||
{
|
||||
|
||||
public class EdaHtmlDiff : WithEnvironment
|
||||
{
|
||||
|
||||
public string Paths { get; set; }
|
||||
public string CurrentPath { get; set; }
|
||||
public string PathAndFileName { get; set; }
|
||||
|
||||
[Display(Name = "FileName")]
|
||||
[DisplayFormat(ConvertEmptyStringToNull = false)]
|
||||
[Required(ErrorMessage = "Please select an file name", AllowEmptyStrings = false)]
|
||||
public string FileName { get; set; }
|
||||
|
||||
public EdaHtmlDiff()
|
||||
{
|
||||
Common(path: string.Empty);
|
||||
}
|
||||
|
||||
public EdaHtmlDiff(WithEnvironment withEnvironment, string path)
|
||||
{
|
||||
Common(path);
|
||||
if (string.IsNullOrEmpty(withEnvironment.user_name))
|
||||
user_name = "AUTO";
|
||||
else
|
||||
user_name = withEnvironment.user_name;
|
||||
if (string.IsNullOrEmpty(withEnvironment.machine_name))
|
||||
machine_name = "IFX";
|
||||
else
|
||||
machine_name = withEnvironment.machine_name;
|
||||
if (withEnvironment.now_ticks == 0)
|
||||
now_ticks = DateTime.Now.Ticks;
|
||||
else
|
||||
now_ticks = withEnvironment.now_ticks;
|
||||
message = withEnvironment.message;
|
||||
}
|
||||
|
||||
private void Common(string path)
|
||||
{
|
||||
Paths = string.Empty;
|
||||
CurrentPath = path;
|
||||
FileName = string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
9
EDA Viewer/Models/ErrorViewModel.cs
Normal file
9
EDA Viewer/Models/ErrorViewModel.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace EDAViewer.Models
|
||||
{
|
||||
public class ErrorViewModel
|
||||
{
|
||||
public string RequestId { get; set; }
|
||||
|
||||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
}
|
||||
}
|
46
EDA Viewer/Models/IBackground.cs
Normal file
46
EDA Viewer/Models/IBackground.cs
Normal file
@ -0,0 +1,46 @@
|
||||
namespace EDAViewer.Models
|
||||
{
|
||||
|
||||
public interface IBackground
|
||||
{
|
||||
void EdaDataCollectionPlansCallback();
|
||||
// public void EdaDataCollectionPlans()
|
||||
// {
|
||||
// long ticks = DateTime.Now.Ticks;
|
||||
// Logic2021Q1 logic2021Q1 = new Logic2021Q1(_Log);
|
||||
// string server = GetServer(debugIsNotEC: false);
|
||||
// string cSharpFormat = "yyyy-MM-dd_hh:mm:ss tt";
|
||||
// string oracleFormat = "yyyy-MM-dd_hh:mi:ss AM";
|
||||
// string edaDataCollectionPlansLastRun = "2020-07-02_10:45:01 AM";
|
||||
// logic2021Q1.EdaDataCollectionPlans(server, server.Contains("_ec_"), edaDataCollectionPlansLastRun, cSharpFormat, oracleFormat);
|
||||
// _Log.Debug(string.Concat("Took ", new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds, " second(s)"));
|
||||
// }
|
||||
void EDAOutputArchiveCallback();
|
||||
// public void EDAOutputArchive()
|
||||
// {
|
||||
// long ticks = DateTime.Now.Ticks;
|
||||
// string server = GetServer(debugIsNotEC: true);
|
||||
// string sourceDirectory = string.Concat(@"\\", server, @"\ec_eda\Staging\Traces");
|
||||
// if (!Directory.Exists(sourceDirectory))
|
||||
// _Log.Debug(string.Concat("// Source directory <", sourceDirectory, "> doesn't exist."));
|
||||
// else
|
||||
// {
|
||||
// Logic2019Q4 logic2019Q4 = new Logic2019Q4(_Log);
|
||||
// logic2019Q4.EDAOutputArchive(sourceDirectory);
|
||||
// }
|
||||
// _Log.Debug(string.Concat("Took ", new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds, " second(s)"));
|
||||
// }
|
||||
void LogPathCleanUpByWeekCallback();
|
||||
// public void LogPathCleanUpByWeek()
|
||||
// {
|
||||
// long ticks = DateTime.Now.Ticks;
|
||||
// string server = GetServer(debugIsNotEC: true);
|
||||
// Logic2019Q3 logic2019Q3 = new Logic2019Q3(_Log);
|
||||
// logic2019Q3.LogPathCleanUpByWeek(server, isEDA: true);
|
||||
// logic2019Q3.LogPathCleanUpByWeek(server, isEAFLog: true);
|
||||
// _Log.Debug(string.Concat("Took ", new TimeSpan(DateTime.Now.Ticks - ticks).TotalSeconds, " second(s)"));
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
17
EDA Viewer/Models/IHomeController.cs
Normal file
17
EDA Viewer/Models/IHomeController.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace EDAViewer.Models
|
||||
{
|
||||
public interface IHomeController
|
||||
{
|
||||
IActionResult Background(bool? message_clear = null, bool? exceptions_clear = null, bool? set_is_primary_instance = null, int? invoke_eda_dcp = null);
|
||||
IActionResult Encode(string value = null);
|
||||
IActionResult Error();
|
||||
IActionResult Index();
|
||||
IActionResult Privacy();
|
||||
IActionResult ViewEdaHtmlDiff(WithEnvironment withEnvironment = null);
|
||||
ActionResult<IEnumerable<SelectListItem>> GetDirectoriesOrFiles(string path = null, bool? upDirectory = null, string filter = null);
|
||||
}
|
||||
}
|
14
EDA Viewer/Models/WithEnvironment.cs
Normal file
14
EDA Viewer/Models/WithEnvironment.cs
Normal file
@ -0,0 +1,14 @@
|
||||
namespace EDAViewer.Models
|
||||
{
|
||||
|
||||
public class WithEnvironment
|
||||
{
|
||||
|
||||
public string message { get; set; }
|
||||
public string user_name { get; set; }
|
||||
public string machine_name { get; set; }
|
||||
public long now_ticks { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
33
EDA Viewer/Program.cs
Normal file
33
EDA Viewer/Program.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Shared;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace EDAViewer
|
||||
{
|
||||
|
||||
public class Program
|
||||
{
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args)
|
||||
{
|
||||
IHostBuilder result;
|
||||
IsEnvironment isEnvironment = new IsEnvironment(processesCount: null, nullASPNetCoreEnvironmentIsDevelopment: Debugger.IsAttached, nullASPNetCoreEnvironmentIsProduction: !Debugger.IsAttached);
|
||||
result = Host.CreateDefaultBuilder(args)
|
||||
.UseWindowsService()
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
3
EDA Viewer/Properties/AssemblyInfo.cs
Normal file
3
EDA Viewer/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,3 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("EDA Viewer.Tests")]
|
53
EDA Viewer/Shared/EquipmentType.cs
Normal file
53
EDA Viewer/Shared/EquipmentType.cs
Normal file
@ -0,0 +1,53 @@
|
||||
namespace Shared
|
||||
{
|
||||
|
||||
public enum EquipmentType
|
||||
{
|
||||
FileEquipment,
|
||||
SemiEquipment,
|
||||
//
|
||||
DEP08EGANAIXG5,
|
||||
//
|
||||
MET08ANLYSDIFAAST230_Semi,
|
||||
MET08DDUPSFS6420,
|
||||
MET08DDUPSP1TBI,
|
||||
MET08RESIHGCV,
|
||||
MET08RESIMAPCDE,
|
||||
MET08THFTIRQS408M,
|
||||
MET08THFTIRSTRATUS,
|
||||
//
|
||||
MET08AFMD3100,
|
||||
MET08BVHGPROBE,
|
||||
MET08CVHGPROBE802B150,
|
||||
MET08CVHGPROBE802B150_Monthly,
|
||||
MET08CVHGPROBE802B150_Weekly,
|
||||
MET08DDINCAN8620,
|
||||
MET08DDINCAN8620_Daily,
|
||||
MET08EBEAMINTEGRITY26,
|
||||
MET08HALLHL5580,
|
||||
MET08HALLHL5580_Monthly,
|
||||
MET08HALLHL5580_Weekly,
|
||||
MET08MESMICROSCOPE,
|
||||
MET08NDFRESIMAP151C,
|
||||
MET08NDFRESIMAP151C_Verification,
|
||||
MET08PLMAPRPM,
|
||||
MET08PLMAPRPM_Daily,
|
||||
MET08PLMAPRPM_Verification,
|
||||
MET08PLMPPLATO,
|
||||
MET08PRFUSB4000,
|
||||
MET08PRFUSB4000_Daily,
|
||||
MET08PRFUSB4000_Monthly,
|
||||
MET08PRFUSB4000_Weekly,
|
||||
MET08PRFUSB4000_Verification,
|
||||
MET08PRFUSB4000_Villach,
|
||||
MET08UVH44GS100M,
|
||||
MET08VPDSUBCON,
|
||||
MET08WGEOMX203641Q,
|
||||
MET08WGEOMX203641Q_Verification,
|
||||
MET08XRDXPERTPROMRDXL,
|
||||
MET08XRDXPERTPROMRDXL_Monthly,
|
||||
MET08XRDXPERTPROMRDXL_Weekly,
|
||||
METBRXRAYJV7300L
|
||||
}
|
||||
|
||||
}
|
171
EDA Viewer/Shared/IsEnvironment.cs
Normal file
171
EDA Viewer/Shared/IsEnvironment.cs
Normal file
@ -0,0 +1,171 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Shared
|
||||
{
|
||||
|
||||
public class IsEnvironment
|
||||
{
|
||||
|
||||
public enum Name
|
||||
{
|
||||
LinuxDevelopment,
|
||||
LinuxProduction,
|
||||
LinuxStaging,
|
||||
OSXDevelopment,
|
||||
OSXProduction,
|
||||
OSXStaging,
|
||||
WindowsDevelopment,
|
||||
WindowsProduction,
|
||||
WindowsStaging
|
||||
}
|
||||
|
||||
public bool DebuggerWasAttachedDuringConstructor { get; private set; }
|
||||
public bool Development { get; private set; }
|
||||
public bool Linux { get; private set; }
|
||||
public bool OSX { get; private set; }
|
||||
public bool Production { get; private set; }
|
||||
public bool Staging { get; private set; }
|
||||
public bool Windows { get; private set; }
|
||||
public string Profile { get; private set; }
|
||||
public string AppSettingsFileName { get; private set; }
|
||||
public string ASPNetCoreEnvironment { get; private set; }
|
||||
|
||||
public IsEnvironment(string testCategory)
|
||||
{
|
||||
if (testCategory.EndsWith(".json"))
|
||||
{
|
||||
Production = testCategory == "appsettings.json";
|
||||
Staging = testCategory.EndsWith(nameof(Staging));
|
||||
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
||||
Development = testCategory.EndsWith(nameof(Development));
|
||||
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
|
||||
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
|
||||
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
}
|
||||
else
|
||||
{
|
||||
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
|
||||
OSX = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(OSX));
|
||||
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
Linux = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Linux));
|
||||
Staging = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Staging));
|
||||
Windows = !string.IsNullOrEmpty(testCategory) && testCategory.StartsWith(nameof(Windows));
|
||||
Production = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Production));
|
||||
Development = !string.IsNullOrEmpty(testCategory) && testCategory.EndsWith(nameof(Development));
|
||||
}
|
||||
Profile = GetProfile();
|
||||
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
|
||||
}
|
||||
|
||||
public IsEnvironment(bool isDevelopment, bool isStaging, bool isProduction)
|
||||
{
|
||||
Staging = isStaging;
|
||||
Production = isProduction;
|
||||
Development = isDevelopment;
|
||||
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
||||
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
|
||||
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
|
||||
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
Profile = GetProfile();
|
||||
AppSettingsFileName = GetAppSettingsFileName(processesCount: null);
|
||||
}
|
||||
|
||||
public IsEnvironment(int? processesCount, bool nullASPNetCoreEnvironmentIsDevelopment, bool nullASPNetCoreEnvironmentIsProduction)
|
||||
{
|
||||
OSX = RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
||||
Linux = RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
|
||||
DebuggerWasAttachedDuringConstructor = Debugger.IsAttached;
|
||||
Windows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||
ASPNetCoreEnvironment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
if (nullASPNetCoreEnvironmentIsDevelopment && nullASPNetCoreEnvironmentIsProduction)
|
||||
throw new Exception();
|
||||
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsProduction)
|
||||
Production = true;
|
||||
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && nullASPNetCoreEnvironmentIsDevelopment)
|
||||
Development = true;
|
||||
else if (string.IsNullOrEmpty(ASPNetCoreEnvironment) && !nullASPNetCoreEnvironmentIsDevelopment && !nullASPNetCoreEnvironmentIsProduction)
|
||||
throw new Exception();
|
||||
else
|
||||
{
|
||||
Staging = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Staging));
|
||||
Production = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Production));
|
||||
Development = ASPNetCoreEnvironment is not null && ASPNetCoreEnvironment.EndsWith(nameof(Development));
|
||||
}
|
||||
Profile = GetProfile();
|
||||
AppSettingsFileName = GetAppSettingsFileName(processesCount);
|
||||
}
|
||||
|
||||
private string GetProfile()
|
||||
{
|
||||
string result;
|
||||
if (Windows && Production)
|
||||
result = nameof(Production);
|
||||
else if (Windows && Staging)
|
||||
result = nameof(Staging);
|
||||
else if (Windows && Development)
|
||||
result = nameof(Development);
|
||||
else if (Linux && Production)
|
||||
result = nameof(Name.LinuxProduction);
|
||||
else if (Linux && Staging)
|
||||
result = nameof(Name.LinuxStaging);
|
||||
else if (Linux && Development)
|
||||
result = nameof(Name.LinuxDevelopment);
|
||||
else if (OSX && Production)
|
||||
result = nameof(Name.OSXProduction);
|
||||
else if (OSX && Staging)
|
||||
result = nameof(Name.OSXStaging);
|
||||
else if (OSX && Development)
|
||||
result = nameof(Name.OSXDevelopment);
|
||||
else
|
||||
throw new Exception();
|
||||
return result;
|
||||
}
|
||||
|
||||
private string GetAppSettingsFileName(int? processesCount)
|
||||
{
|
||||
string result;
|
||||
if (Production)
|
||||
{
|
||||
if (processesCount is null)
|
||||
result = "appsettings.json";
|
||||
else
|
||||
result = $"appsettings.{processesCount}.json";
|
||||
}
|
||||
else
|
||||
{
|
||||
string environment;
|
||||
if (Staging)
|
||||
environment = nameof(Staging);
|
||||
else if (Development)
|
||||
environment = nameof(Development);
|
||||
else
|
||||
throw new Exception();
|
||||
if (processesCount is null)
|
||||
result = $"appsettings.{environment}.json";
|
||||
else
|
||||
result = $"appsettings.{environment}.{processesCount}.json";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string GetEnvironmentName(IsEnvironment isEnvironment)
|
||||
{
|
||||
string result;
|
||||
if (isEnvironment.Windows)
|
||||
result = nameof(IsEnvironment.Windows);
|
||||
else if (isEnvironment.Linux)
|
||||
result = nameof(IsEnvironment.Linux);
|
||||
else if (isEnvironment.OSX)
|
||||
result = nameof(IsEnvironment.OSX);
|
||||
else
|
||||
throw new Exception();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
96
EDA Viewer/Shared/RijndaelEncryption.cs
Normal file
96
EDA Viewer/Shared/RijndaelEncryption.cs
Normal file
@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Shared
|
||||
{
|
||||
|
||||
public static class RijndaelEncryption
|
||||
{
|
||||
/// <summary>
|
||||
/// Change the Inputkey GUID when you use this code in your own program.
|
||||
/// Keep this inputkey very safe and prevent someone from decoding it some way!!
|
||||
/// Generated 2021-08-10
|
||||
/// </summary>
|
||||
internal const string Inputkey = "970CCEF6-4307-4F6A-9AC8-377DADB889BD";
|
||||
|
||||
/// <summary>
|
||||
/// Encrypt the given text and give the byte array back as a BASE64 string
|
||||
/// </summary>
|
||||
/// <param name="text">The text to encrypt</param>
|
||||
/// <param name="salt">The pasword salt</param>
|
||||
/// <returns>The encrypted text</returns>
|
||||
public static string Encrypt(string text, string salt)
|
||||
{
|
||||
string result;
|
||||
if (string.IsNullOrEmpty(text))
|
||||
throw new ArgumentNullException("text");
|
||||
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
|
||||
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
|
||||
MemoryStream msEncrypt = new MemoryStream();
|
||||
using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
|
||||
using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
|
||||
swEncrypt.Write(text);
|
||||
result = Convert.ToBase64String(msEncrypt.ToArray());
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a string is base64 encoded
|
||||
/// </summary>
|
||||
/// <param name="base64String">The base64 encoded string</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsBase64String(string base64String)
|
||||
{
|
||||
bool result;
|
||||
base64String = base64String.Trim();
|
||||
result = (base64String.Length % 4 == 0) && Regex.IsMatch(base64String, @"^[a-zA-Z0-9\+/]*={0,3}$", RegexOptions.None);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decrypts the given text
|
||||
/// </summary>
|
||||
/// <param name="cipherText">The encrypted BASE64 text</param>
|
||||
/// <param name="salt">The pasword salt</param>
|
||||
/// <returns>De gedecrypte text</returns>
|
||||
public static string Decrypt(string cipherText, string salt)
|
||||
{
|
||||
if (string.IsNullOrEmpty(cipherText))
|
||||
throw new ArgumentNullException("cipherText");
|
||||
if (!IsBase64String(cipherText))
|
||||
throw new Exception("The cipherText input parameter is not base64 encoded");
|
||||
string text;
|
||||
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
|
||||
ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
|
||||
byte[] cipher = Convert.FromBase64String(cipherText);
|
||||
using (MemoryStream msDecrypt = new MemoryStream(cipher))
|
||||
{
|
||||
using CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read);
|
||||
using StreamReader srDecrypt = new StreamReader(csDecrypt);
|
||||
text = srDecrypt.ReadToEnd();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new RijndaelManaged class and initialize it
|
||||
/// </summary>
|
||||
/// <param name="salt">The pasword salt</param>
|
||||
/// <returns></returns>
|
||||
private static RijndaelManaged NewRijndaelManaged(string salt)
|
||||
{
|
||||
if (salt == null)
|
||||
throw new ArgumentNullException("salt");
|
||||
byte[] saltBytes = Encoding.ASCII.GetBytes(salt);
|
||||
Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(Inputkey, saltBytes);
|
||||
RijndaelManaged aesAlg = new RijndaelManaged();
|
||||
aesAlg.Key = key.GetBytes(aesAlg.KeySize / 8);
|
||||
aesAlg.IV = key.GetBytes(aesAlg.BlockSize / 8);
|
||||
return aesAlg;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
912
EDA Viewer/Singleton/Background.cs
Normal file
912
EDA Viewer/Singleton/Background.cs
Normal file
@ -0,0 +1,912 @@
|
||||
using EDAViewer.Models;
|
||||
using EDAViewer.Singleton.Helper;
|
||||
using Infineon.Monitoring.MonA;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace EDAViewer.Singleton
|
||||
{
|
||||
|
||||
public partial class Background : IBackground
|
||||
{
|
||||
|
||||
public List<Timer> Timers => _Timers;
|
||||
public string Message { get; private set; }
|
||||
public string WorkingDirectory { get; private set; }
|
||||
public List<Exception> Exceptions { get; private set; }
|
||||
|
||||
private bool _ShuttingDown;
|
||||
private readonly object _Lock;
|
||||
private readonly Calendar _Calendar;
|
||||
private readonly List<Timer> _Timers;
|
||||
private readonly AppSettings _AppSettings;
|
||||
private readonly string[] _SiEquipmentTypes;
|
||||
private readonly string[] _GaNEquipmentTypes;
|
||||
private readonly IsEnvironment _IsEnvironment;
|
||||
|
||||
private const string _Site = "sjc";
|
||||
|
||||
private Log _Log;
|
||||
private DateTime _PrimaryInstanceSetAt;
|
||||
private string _EdaDataCollectionPlansLastRun;
|
||||
|
||||
public Background(IsEnvironment isEnvironment, AppSettings appSettings, string workingDirectory)
|
||||
{
|
||||
_Log = null;
|
||||
Exceptions = new();
|
||||
_IsEnvironment = isEnvironment;
|
||||
_Lock = new object();
|
||||
_ShuttingDown = false;
|
||||
if (_Lock is null)
|
||||
{ }
|
||||
Message = string.Empty;
|
||||
_AppSettings = appSettings;
|
||||
_Timers = new List<Timer>();
|
||||
_IsEnvironment = isEnvironment;
|
||||
WorkingDirectory = workingDirectory;
|
||||
_PrimaryInstanceSetAt = DateTime.MinValue;
|
||||
_EdaDataCollectionPlansLastRun = string.Empty;
|
||||
_SiEquipmentTypes = GetEquipmentTypes(isGaN: false, isSi: true);
|
||||
_GaNEquipmentTypes = GetEquipmentTypes(isGaN: true, isSi: false);
|
||||
CultureInfo cultureInfo = new CultureInfo("en-US");
|
||||
_Calendar = cultureInfo.Calendar;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
foreach (Timer timer in _Timers)
|
||||
timer.Dispose();
|
||||
}
|
||||
|
||||
void IBackground.Update(ILogger<object> logger)
|
||||
{
|
||||
Update(logger);
|
||||
}
|
||||
|
||||
internal void Update(ILogger<object> logger)
|
||||
{
|
||||
_Log = new Log(logger);
|
||||
//https://blog.magnusmontin.net/2018/11/05/platform-conditional-compilation-in-net-core/
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
_Log.Debug("Running on Linux!");
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
_Log.Debug("Running on macOS!");
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
_Log.Debug("Running on Windows!");
|
||||
#if Linux
|
||||
_Log.Debug("Built on Linux!");
|
||||
#elif OSX
|
||||
_Log.Debug("Built on macOS!");
|
||||
#elif Windows
|
||||
_Log.Debug("Built in Windows!");
|
||||
#else
|
||||
()("Built in unkown!");
|
||||
#endif
|
||||
if (string.IsNullOrEmpty(_AppSettings.URLs) && !_IsEnvironment.Development)
|
||||
throw new Exception("Invalid Application Settings URLs!");
|
||||
}
|
||||
|
||||
internal void Catch(Exception exception)
|
||||
{
|
||||
Exceptions.Add(exception);
|
||||
_Log.Error(exception);
|
||||
if (!string.IsNullOrEmpty(_AppSettings.MonARessource))
|
||||
{
|
||||
MonIn monIn = MonIn.GetInstance();
|
||||
monIn.SendStatus(_Site, _AppSettings.MonARessource, "Heartbeat", State.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendStatusOk()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_AppSettings.MonARessource))
|
||||
{
|
||||
MonIn monIn = MonIn.GetInstance();
|
||||
monIn.SendStatus(_Site, _AppSettings.MonARessource, "Heartbeat", State.Ok);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetCountDirectory(string verb)
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
CultureInfo cultureInfo = new("en-US");
|
||||
Calendar calendar = cultureInfo.Calendar;
|
||||
string weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
//string nameSpace = System.Reflection.Assembly.GetExecutingAssembly().EntryPoint.DeclaringType.Namespace;
|
||||
string nameSpace = GetType().Namespace.Split('.')[0];
|
||||
if (!string.IsNullOrEmpty(_AppSettings.MonARessource))
|
||||
{
|
||||
MonIn monIn = MonIn.GetInstance();
|
||||
monIn.SendStatus(_Site, _AppSettings.MonARessource, "Heartbeat", State.Up);
|
||||
}
|
||||
return string.Concat(@"\\", _AppSettings.Server, @"\EC_EDA\Counts\", dateTime.ToString("yyyy"), @"\", "Week_", weekOfYear, @"\", dateTime.ToString("yyyy - MM - dd"), @"\", "Application", @"\", nameSpace, @"\", verb, @"\", dateTime.Ticks);
|
||||
}
|
||||
|
||||
public void Stop(bool immediate)
|
||||
{
|
||||
_ShuttingDown = true;
|
||||
foreach (Timer timer in _Timers)
|
||||
timer.Change(Timeout.Infinite, 0);
|
||||
if (!_IsEnvironment.Development)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_AppSettings.MonARessource))
|
||||
{
|
||||
MonIn monIn = MonIn.GetInstance();
|
||||
monIn.SendStatus(_Site, _AppSettings.MonARessource, "Heartbeat", State.Down);
|
||||
}
|
||||
string countDirectory = GetCountDirectory("Stop");
|
||||
Directory.CreateDirectory(countDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearMessage()
|
||||
{
|
||||
Message = string.Empty;
|
||||
}
|
||||
|
||||
public void SetIsPrimaryInstance()
|
||||
{
|
||||
_PrimaryInstanceSetAt = DateTime.Now;
|
||||
}
|
||||
|
||||
public void ClearIsPrimaryInstance()
|
||||
{
|
||||
_PrimaryInstanceSetAt = DateTime.MinValue;
|
||||
}
|
||||
|
||||
public bool IsPrimaryInstance()
|
||||
{
|
||||
bool result;
|
||||
DateTime dateTime = DateTime.Now.AddDays(-1);
|
||||
result = _PrimaryInstanceSetAt > dateTime;
|
||||
return result;
|
||||
}
|
||||
|
||||
public void EdaDataCollectionPlansCallback()
|
||||
{
|
||||
string cSharpFormat = "yyyy-MM-dd_hh:mm:ss tt";
|
||||
string oracleFormat = "yyyy-MM-dd_hh:mi:ss AM";
|
||||
_Log.Debug(string.Concat("A) _EdaDataCollectionPlansLastRun = ", _EdaDataCollectionPlansLastRun));
|
||||
DataCollectionPlans(_AppSettings, _EdaDataCollectionPlansLastRun, cSharpFormat, oracleFormat);
|
||||
_EdaDataCollectionPlansLastRun = DateTime.Now.ToString(cSharpFormat);
|
||||
_Log.Debug(string.Concat("B) _EdaDataCollectionPlansLastRun = ", _EdaDataCollectionPlansLastRun));
|
||||
}
|
||||
private void DeleteEmptyDirectories(string directory)
|
||||
{
|
||||
string[] files = Directory.GetFiles(directory, "*", SearchOption.AllDirectories);
|
||||
string[] directories = Directory.GetDirectories(directory, "*", SearchOption.AllDirectories);
|
||||
if (files.Length == 0 && directories.Length == 0)
|
||||
Directory.Delete(directory);
|
||||
else
|
||||
{
|
||||
foreach (string subDirectory in Directory.GetDirectories(directory, "*", SearchOption.TopDirectoryOnly))
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
DeleteEmptyDirectories(subDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ZipFilesByDate(string sourceDirectory, SearchOption searchOption = SearchOption.TopDirectoryOnly, string dayFormat = null)
|
||||
{
|
||||
string key;
|
||||
bool addFile;
|
||||
string fileName;
|
||||
string[] segments;
|
||||
string[] subFiles;
|
||||
string weekOfYear;
|
||||
FileInfo fileInfo;
|
||||
DateTime creationTime;
|
||||
DateTime lastWriteTime;
|
||||
Regex regex = new Regex("[a-zA-Z0-9]{1,}");
|
||||
DateTime dateTime = DateTime.Now.AddDays(-6);
|
||||
DateTime firstEmail = new DateTime(2019, 3, 8);
|
||||
CultureInfo cultureInfo = new CultureInfo("en-US");
|
||||
Calendar calendar = cultureInfo.Calendar;
|
||||
int ticksLength = dateTime.Ticks.ToString().Length;
|
||||
Dictionary<string, DateTime> weeks = new Dictionary<string, DateTime>();
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
dateTime = firstEmail.AddDays(i);
|
||||
weekOfYear = calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
key = string.Concat(dateTime.ToString("yyyy"), "_Week_", weekOfYear);
|
||||
if (!weeks.ContainsKey(key))
|
||||
weeks.Add(key, dateTime);
|
||||
}
|
||||
weekOfYear = calendar.GetWeekOfYear(DateTime.Now, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
string skipKey = string.Concat(DateTime.Now.ToString("yyyy"), "_Week_", weekOfYear);
|
||||
Dictionary<string, List<string>> keyValuePairs = new Dictionary<string, List<string>>();
|
||||
string[] topDirectories = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
if (topDirectories.Length == 0)
|
||||
topDirectories = new string[] { sourceDirectory };
|
||||
foreach (string topDirectory in topDirectories)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
keyValuePairs.Clear();
|
||||
subFiles = Directory.GetFiles(topDirectory, "*", searchOption);
|
||||
foreach (string subFile in subFiles)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
addFile = false;
|
||||
if (subFile.EndsWith(".zip"))
|
||||
continue;
|
||||
fileName = Path.GetFileName(subFile);
|
||||
fileInfo = new FileInfo(subFile);
|
||||
creationTime = fileInfo.CreationTime;
|
||||
if (creationTime > dateTime)
|
||||
continue;
|
||||
lastWriteTime = fileInfo.LastWriteTime;
|
||||
if (fileName.Contains(lastWriteTime.ToString("yyyyMMdd")) || fileName.Contains(lastWriteTime.ToString("yyyy-MM-dd")) ||
|
||||
fileName.Contains(creationTime.ToString("yyyyMMdd")) || fileName.Contains(creationTime.ToString("yyyy-MM-dd")) ||
|
||||
fileName.Contains(lastWriteTime.ToString("yyMMdd")) || fileName.Contains(lastWriteTime.ToString("yy-MM-dd")) ||
|
||||
fileName.Contains(creationTime.ToString("yyMMdd")) || fileName.Contains(creationTime.ToString("yy-MM-dd")) ||
|
||||
fileName.Contains(lastWriteTime.AddDays(-1).ToString("yyyyMMdd")) || fileName.Contains(lastWriteTime.AddDays(-1).ToString("yyyy-MM-dd")) ||
|
||||
fileName.Contains(creationTime.AddDays(-1).ToString("yyyyMMdd")) || fileName.Contains(creationTime.AddDays(-1).ToString("yyyy-MM-dd")) ||
|
||||
fileName.Contains(lastWriteTime.AddDays(-1).ToString("yyMMdd")) || fileName.Contains(lastWriteTime.AddDays(-1).ToString("yy-MM-dd")) ||
|
||||
fileName.Contains(creationTime.AddDays(-1).ToString("yyMMdd")) || fileName.Contains(creationTime.AddDays(-1).ToString("yy-MM-dd")))
|
||||
addFile = true;
|
||||
if (!addFile && fileName.Length > ticksLength)
|
||||
{
|
||||
MatchCollection matches = regex.Matches(fileName);
|
||||
foreach (Match match in matches)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
if (match.Value.Length != ticksLength)
|
||||
continue;
|
||||
if (!long.TryParse(match.Value, out long ticks))
|
||||
continue;
|
||||
addFile = true;
|
||||
break;
|
||||
}
|
||||
if (addFile)
|
||||
break;
|
||||
}
|
||||
if (addFile)
|
||||
{
|
||||
weekOfYear = calendar.GetWeekOfYear(lastWriteTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
if (string.IsNullOrEmpty(dayFormat))
|
||||
key = string.Concat(lastWriteTime.ToString("yyyy"), "_Week_", weekOfYear);
|
||||
else
|
||||
key = string.Concat(lastWriteTime.ToString("yyyy"), "_Week_", weekOfYear, "_", lastWriteTime.ToString(dayFormat));
|
||||
if (key == skipKey)
|
||||
continue;
|
||||
if (!keyValuePairs.ContainsKey(key))
|
||||
keyValuePairs.Add(key, new List<string>());
|
||||
keyValuePairs[key].Add(subFile);
|
||||
}
|
||||
}
|
||||
foreach (KeyValuePair<string, List<string>> element in keyValuePairs)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
key = string.Concat(topDirectory, @"\", element.Key, ".zip");
|
||||
if (File.Exists(key))
|
||||
{
|
||||
for (short i = 101; i < short.MaxValue; i++)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
key = string.Concat(topDirectory, @"\", element.Key, "_", i, ".zip");
|
||||
if (!File.Exists(key))
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
lock (_Lock)
|
||||
{
|
||||
using (ZipArchive zip = ZipFile.Open(key, ZipArchiveMode.Create))
|
||||
{
|
||||
foreach (string file in element.Value)
|
||||
{
|
||||
zip.CreateEntryFromFile(file, Path.GetFileName(file));
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
subFiles = Directory.GetFiles(topDirectory, "*.zip", SearchOption.TopDirectoryOnly);
|
||||
foreach (string subFile in subFiles)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
fileName = Path.GetFileNameWithoutExtension(subFile);
|
||||
segments = fileName.Split('_');
|
||||
if (segments.Length > 2)
|
||||
fileName = string.Concat(segments[0], '_', segments[1], '_', segments[2]);
|
||||
if (weeks.ContainsKey(fileName))
|
||||
{
|
||||
try
|
||||
{ File.SetLastWriteTime(subFile, weeks[fileName]); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
if (topDirectory != sourceDirectory)
|
||||
try
|
||||
{ DeleteEmptyDirectories(topDirectory); }
|
||||
catch (Exception) { }
|
||||
//Print(topDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
public void LogPathCleanUpByWeek(string server, bool isEDA = false, bool isNA = false)
|
||||
{
|
||||
if (isEDA && isNA)
|
||||
throw new Exception();
|
||||
else if (!isEDA && !isNA)
|
||||
throw new Exception();
|
||||
string share;
|
||||
Tuple<string, string>[] tuples;
|
||||
if (isEDA)
|
||||
{
|
||||
share = string.Concat(@"\\", server, @"\ec_eda");
|
||||
tuples = new Tuple<string, string>[]
|
||||
{
|
||||
new Tuple<string, string>(@"\Staging\Traces\MET08ANLYSDIFAAST230\LogFile", string.Empty),
|
||||
//new Tuple<string, string>(@"\Staging\Traces\DEP08EGANAIXG5HT\R69-HSMS\LogFile", "yyyy_MM_dd"),
|
||||
//new Tuple<string, string>(@"\Staging\Traces\DEP08EGANAIXG5\LogFile\R69-HSMS", "yyyy_MM_dd"),
|
||||
//new Tuple<string, string>(@"\Staging\Traces\DEP08EGANAIXG5HT\R71-HSMS\LogFile", "yyyy_MM_dd"),
|
||||
//new Tuple<string, string>(@"\Staging\Traces\DEP08EGANAIXG5\LogFile\R71-HSMS", "yyyy_MM_dd"),
|
||||
new Tuple<string, string>(@"\Staging\Traces\MET08XRDXPERTPROMRDXL_Monthly\LogFile", string.Empty),
|
||||
new Tuple<string, string>(@"\Staging\Traces\MET08XRDXPERTPROMRDXL_Weekly\LogFile", string.Empty),
|
||||
new Tuple<string, string>(@"\Staging\Traces\MET08DDINCAN8620_Daily\LogFile", string.Empty),
|
||||
new Tuple<string, string>(@"\Staging\Traces\MET08PRFUSB4000\LogFile", string.Empty),
|
||||
};
|
||||
}
|
||||
else if (isNA)
|
||||
throw new Exception();
|
||||
else
|
||||
throw new Exception();
|
||||
string[] files;
|
||||
string weekOfYear;
|
||||
FileInfo fileInfo;
|
||||
string newDirectroy;
|
||||
string sourceDirectory;
|
||||
DateTime lastWriteTime;
|
||||
string[] topDirectories;
|
||||
long twoDays = DateTime.Now.AddDays(-2).Ticks;
|
||||
foreach (Tuple<string, string> tuple in tuples)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
sourceDirectory = string.Concat(share, tuple.Item1);
|
||||
if (!Directory.Exists(sourceDirectory))
|
||||
continue;
|
||||
if (isEDA)
|
||||
topDirectories = new string[] { sourceDirectory };
|
||||
else if (isNA)
|
||||
throw new Exception();
|
||||
else
|
||||
throw new Exception();
|
||||
if (topDirectories.Length == 0)
|
||||
topDirectories = new string[] { sourceDirectory };
|
||||
foreach (string topDirectory in topDirectories)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
files = Directory.GetFiles(topDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
if (file.EndsWith(".zip"))
|
||||
continue;
|
||||
fileInfo = new FileInfo(file);
|
||||
lastWriteTime = fileInfo.LastAccessTime;
|
||||
if (lastWriteTime.Ticks > twoDays)
|
||||
continue;
|
||||
weekOfYear = _Calendar.GetWeekOfYear(lastWriteTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
newDirectroy = string.Concat(topDirectory, @"\", lastWriteTime.ToString("yyyy"), "___Week_", weekOfYear, @"\", lastWriteTime.ToString("yyyy_MM_dd"));
|
||||
if (!Directory.Exists(newDirectroy))
|
||||
Directory.CreateDirectory(newDirectroy);
|
||||
if (!fileInfo.Exists)
|
||||
continue;
|
||||
if (!_ShuttingDown)
|
||||
{
|
||||
lock (_Lock)
|
||||
File.Move(file, string.Concat(newDirectroy, @"\", Path.GetFileName(file)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (Tuple<string, string> tuple in tuples)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
sourceDirectory = string.Concat(share, tuple.Item1);
|
||||
if (!Directory.Exists(sourceDirectory))
|
||||
continue;
|
||||
ZipFilesByDate(sourceDirectory, SearchOption.AllDirectories, tuple.Item2);
|
||||
}
|
||||
}
|
||||
|
||||
public void LogPathCleanUpByWeekCallback()
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
if (dateTime.Hour > 8 && dateTime.Hour < 17)
|
||||
{
|
||||
_Log.Debug(string.Concat("A) ", nameof(LogPathCleanUpByWeek)));
|
||||
LogPathCleanUpByWeek(_AppSettings.Server, isEDA: true);
|
||||
_Log.Debug(string.Concat("B) ", nameof(LogPathCleanUpByWeek)));
|
||||
}
|
||||
}
|
||||
|
||||
public void EDAOutputArchive(string sourceDirectory)
|
||||
{
|
||||
string key;
|
||||
string[] files;
|
||||
string[] cellIntaces;
|
||||
string fileWeekOfYear;
|
||||
DateTime fileDateTime;
|
||||
string checkDirectory;
|
||||
string cellInstancesName;
|
||||
string emptyFilesDirectory;
|
||||
int today = DateTime.Now.Day;
|
||||
string recipeArchiveDirectory;
|
||||
Dictionary<string, List<string>> keyValuePairs = new Dictionary<string, List<string>>();
|
||||
string[] equipmentTypes = Directory.GetDirectories(sourceDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string equipmentType in equipmentTypes)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
if (equipmentType.EndsWith(@"\_ Copy") || equipmentType.EndsWith(@"\_ Empty") || equipmentType.EndsWith(@"\CellInstance") || equipmentType.EndsWith(@"\IQS") || equipmentType.EndsWith(@"\Villach"))
|
||||
continue;
|
||||
checkDirectory = string.Concat(equipmentType, @"\Ignore\Recipe");
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
Directory.CreateDirectory(checkDirectory);
|
||||
cellIntaces = Directory.GetDirectories(checkDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string cellIntace in cellIntaces)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
keyValuePairs.Clear();
|
||||
cellInstancesName = Path.GetFileName(cellIntace);
|
||||
recipeArchiveDirectory = string.Concat(equipmentType, @"\Ignore\!Archive\Recipe\", cellInstancesName);
|
||||
if (!Directory.Exists(recipeArchiveDirectory))
|
||||
Directory.CreateDirectory(recipeArchiveDirectory);
|
||||
emptyFilesDirectory = string.Concat(equipmentType, @"\Ignore\!Archive\EmptyFiles\", cellInstancesName);
|
||||
if (!Directory.Exists(emptyFilesDirectory))
|
||||
Directory.CreateDirectory(emptyFilesDirectory);
|
||||
files = Directory.GetFiles(cellIntace, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
fileDateTime = new FileInfo(file).LastWriteTime;
|
||||
if (fileDateTime.Day != today)
|
||||
{
|
||||
fileWeekOfYear = _Calendar.GetWeekOfYear(fileDateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday).ToString("00");
|
||||
key = string.Concat(fileDateTime.ToString("yyyy-MM-dd"), "_Week_", fileWeekOfYear);
|
||||
if (!keyValuePairs.ContainsKey(key))
|
||||
keyValuePairs.Add(key, new List<string>());
|
||||
keyValuePairs[key].Add(file);
|
||||
}
|
||||
}
|
||||
foreach (KeyValuePair<string, List<string>> element in keyValuePairs)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
lock (_Lock)
|
||||
{
|
||||
key = string.Concat(recipeArchiveDirectory, @"\", element.Key.Split('-')[0]);
|
||||
if (!Directory.Exists(key))
|
||||
Directory.CreateDirectory(key);
|
||||
key = string.Concat(recipeArchiveDirectory, @"\", element.Key.Split('-')[0], @"\", element.Key, ".zip");
|
||||
if (File.Exists(key))
|
||||
{
|
||||
for (short i = 101; i < short.MaxValue; i++)
|
||||
{
|
||||
key = string.Concat(recipeArchiveDirectory, @"\", element.Key.Split('-')[0], @"\", element.Key, "_", i, ".zip");
|
||||
if (!File.Exists(key))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
lock (_Lock)
|
||||
{
|
||||
using ZipArchive zip = ZipFile.Open(key, ZipArchiveMode.Create);
|
||||
foreach (string file in element.Value)
|
||||
{
|
||||
zip.CreateEntryFromFile(file, Path.GetFileName(file));
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void EDAOutputArchiveCallback()
|
||||
{
|
||||
DateTime dateTime = DateTime.Now;
|
||||
if (dateTime.Hour > 8 && dateTime.Hour < 17)
|
||||
{
|
||||
string sourceDirectory = string.Concat(@"\\", _AppSettings.Server, @"\ec_eda\Staging\Traces");
|
||||
if (!Directory.Exists(sourceDirectory))
|
||||
_Log.Debug(string.Concat("// Source directory <", sourceDirectory, "> doesn't exist."));
|
||||
else
|
||||
EDAOutputArchive(sourceDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
public static string[] GetEquipmentTypes(bool isGaN = false, bool isSi = false)
|
||||
{
|
||||
string[] results;
|
||||
if (isGaN && isSi)
|
||||
throw new Exception();
|
||||
else if (!isGaN && !isSi)
|
||||
isGaN = true;
|
||||
if (isSi)
|
||||
{
|
||||
results = new string[]
|
||||
{
|
||||
Shared.EquipmentType.MET08ANLYSDIFAAST230_Semi.ToString(),
|
||||
Shared.EquipmentType.MET08DDUPSFS6420.ToString(),
|
||||
Shared.EquipmentType.MET08DDUPSP1TBI.ToString(),
|
||||
Shared.EquipmentType.MET08RESIHGCV.ToString(),
|
||||
Shared.EquipmentType.MET08RESIMAPCDE.ToString(),
|
||||
Shared.EquipmentType.MET08THFTIRQS408M.ToString(),
|
||||
Shared.EquipmentType.MET08THFTIRSTRATUS.ToString()
|
||||
};
|
||||
}
|
||||
else if (isGaN)
|
||||
{
|
||||
results = new string[]
|
||||
{
|
||||
Shared.EquipmentType.DEP08EGANAIXG5.ToString(),
|
||||
Shared.EquipmentType.MET08AFMD3100.ToString(),
|
||||
Shared.EquipmentType.MET08BVHGPROBE.ToString(),
|
||||
Shared.EquipmentType.MET08CVHGPROBE802B150.ToString(),
|
||||
Shared.EquipmentType.MET08CVHGPROBE802B150_Monthly.ToString(),
|
||||
Shared.EquipmentType.MET08CVHGPROBE802B150_Weekly.ToString(),
|
||||
Shared.EquipmentType.MET08DDINCAN8620.ToString(),
|
||||
Shared.EquipmentType.MET08DDINCAN8620_Daily.ToString(),
|
||||
Shared.EquipmentType.MET08EBEAMINTEGRITY26.ToString(),
|
||||
Shared.EquipmentType.MET08HALLHL5580.ToString(),
|
||||
Shared.EquipmentType.MET08HALLHL5580_Monthly.ToString(),
|
||||
Shared.EquipmentType.MET08HALLHL5580_Weekly.ToString(),
|
||||
Shared.EquipmentType.MET08MESMICROSCOPE.ToString(),
|
||||
Shared.EquipmentType.MET08NDFRESIMAP151C.ToString(),
|
||||
Shared.EquipmentType.MET08NDFRESIMAP151C_Verification.ToString(),
|
||||
Shared.EquipmentType.MET08PLMAPRPM.ToString(),
|
||||
Shared.EquipmentType.MET08PLMAPRPM_Daily.ToString(),
|
||||
Shared.EquipmentType.MET08PLMAPRPM_Verification.ToString(),
|
||||
Shared.EquipmentType.MET08PLMPPLATO.ToString(),
|
||||
Shared.EquipmentType.MET08PRFUSB4000.ToString(),
|
||||
Shared.EquipmentType.MET08UVH44GS100M.ToString(),
|
||||
Shared.EquipmentType.MET08VPDSUBCON.ToString(),
|
||||
Shared.EquipmentType.MET08WGEOMX203641Q.ToString(),
|
||||
Shared.EquipmentType.MET08WGEOMX203641Q_Verification.ToString(),
|
||||
Shared.EquipmentType.METBRXRAYJV7300L.ToString(),
|
||||
Shared.EquipmentType.MET08XRDXPERTPROMRDXL.ToString(),
|
||||
Shared.EquipmentType.MET08XRDXPERTPROMRDXL_Monthly.ToString(),
|
||||
Shared.EquipmentType.MET08XRDXPERTPROMRDXL_Weekly.ToString()
|
||||
};
|
||||
}
|
||||
else
|
||||
throw new Exception();
|
||||
return results;
|
||||
}
|
||||
|
||||
private Stream ToStream(string @this)
|
||||
{
|
||||
var stream = new MemoryStream();
|
||||
var writer = new StreamWriter(stream);
|
||||
writer.Write(@this);
|
||||
writer.Flush();
|
||||
stream.Position = 0;
|
||||
return stream;
|
||||
}
|
||||
|
||||
private T ParseXML<T>(string @this, bool throwExceptions) where T : class
|
||||
{
|
||||
object result = null;
|
||||
try
|
||||
{
|
||||
Stream stream = ToStream(@this.Trim());
|
||||
var reader = XmlReader.Create(stream, new XmlReaderSettings() { ConformanceLevel = ConformanceLevel.Document });
|
||||
//XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
|
||||
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T), typeof(T).GetNestedTypes());
|
||||
result = xmlSerializer.Deserialize(reader);
|
||||
stream.Dispose();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (throwExceptions)
|
||||
throw;
|
||||
}
|
||||
return result as T;
|
||||
}
|
||||
|
||||
public void DataCollectionPlans(AppSettings appSettings, string edaDataCollectionPlansLastRun, string cSharpFormat, string oracleFormat)
|
||||
{
|
||||
bool _ShuttingDown = false;
|
||||
object _Lock = new object();
|
||||
bool dev = appSettings.Server.Contains("_ec_");
|
||||
Dictionary<string, Dictionary<ModuleInstanceTypeName, List<List<object>>>> rows = new Dictionary<string, Dictionary<ModuleInstanceTypeName, List<List<object>>>>();
|
||||
//
|
||||
//int moduleinstancetypename = 0;
|
||||
int unitname = 1;
|
||||
//int modulename = 2;
|
||||
int containername = 3;
|
||||
int configurationstate = 4;
|
||||
int configurationproductivestate = 5;
|
||||
//int containermodifiername = 6;
|
||||
int containermodifieddate = 7;
|
||||
int containerconfiguration = 8;
|
||||
int configurationmodifieddate = 9;
|
||||
string objectTypeDirectory;
|
||||
string workingDirectory = string.Concat(@"\\", appSettings.Server, @"\EC_EDA");
|
||||
// ()
|
||||
{
|
||||
object @object;
|
||||
string @string;
|
||||
int fieldCount;
|
||||
List<object> row;
|
||||
string decrypted;
|
||||
string connectionName;
|
||||
string connectionString;
|
||||
StringBuilder sql = new StringBuilder();
|
||||
Array objectTypes = Enum.GetValues(typeof(ModuleInstanceTypeName));
|
||||
List<Tuple<string, string>> connections = new List<Tuple<string, string>>();
|
||||
if (dev)
|
||||
{
|
||||
connectionName = @"DEV";
|
||||
connectionString = EDAViewer.Singleton.Helper.Background.EDADatabase.GetEdaDevelopment();
|
||||
decrypted = RijndaelEncryption.Decrypt(appSettings.IFXEDADatabasePassword, appSettings.Company);
|
||||
connectionString = string.Concat(connectionString, decrypted, ";");
|
||||
connections.Add(new Tuple<string, string>(connectionName, connectionString));
|
||||
}
|
||||
else
|
||||
{
|
||||
connectionName = "Staging";
|
||||
connectionString = EDAViewer.Singleton.Helper.Background.EDADatabase.GetEdaStaging();
|
||||
decrypted = RijndaelEncryption.Decrypt(appSettings.ECEDADatabasePassword, appSettings.Company);
|
||||
connectionString = string.Concat(connectionString, decrypted, ";");
|
||||
connections.Add(new Tuple<string, string>(connectionName, connectionString));
|
||||
connectionName = "Production";
|
||||
connectionString = EDAViewer.Singleton.Helper.Background.EDADatabase.GetEdaProduction();
|
||||
connectionString = string.Concat(connectionString, decrypted, ";");
|
||||
connections.Add(new Tuple<string, string>(connectionName, connectionString));
|
||||
}
|
||||
foreach (Tuple<string, string> connection in connections)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
rows.Add(connection.Item1, new Dictionary<ModuleInstanceTypeName, List<List<object>>>());
|
||||
foreach (ModuleInstanceTypeName objectType in objectTypes)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
if (string.IsNullOrEmpty(edaDataCollectionPlansLastRun))
|
||||
{
|
||||
objectTypeDirectory = string.Concat(workingDirectory, @"\", connection.Item1, @"\", objectType);
|
||||
if (!Directory.Exists(objectTypeDirectory))
|
||||
Directory.CreateDirectory(objectTypeDirectory);
|
||||
else
|
||||
edaDataCollectionPlansLastRun = new DirectoryInfo(objectTypeDirectory).LastWriteTime.ToString(cSharpFormat);
|
||||
}
|
||||
if (!rows[connection.Item1].ContainsKey(objectType))
|
||||
rows[connection.Item1].Add(objectType, new List<List<object>>());
|
||||
using (Oracle.ManagedDataAccess.Client.OracleConnection oracleConnection = new Oracle.ManagedDataAccess.Client.OracleConnection(connection.Item2))
|
||||
{
|
||||
sql.Clear();
|
||||
oracleConnection.Open();
|
||||
sql.Append(" select v.moduleinstancetypename, v.unitname, ").
|
||||
Append(" v.modulename, v.containername, v.configurationstate, ").
|
||||
Append(" v.configurationproductivestate, v.containermodifiername, ").
|
||||
Append(" v.containermodifieddate, v.containerconfiguration, v.configurationmodifieddate ").
|
||||
Append(" from veditconfiguration v ").
|
||||
Append(" where v.moduleinstancetypename = '").Append(objectType.ToString()).Append("' ");
|
||||
//Append(" and v.containerversion in ('4.80', '4.111') ");
|
||||
if (!string.IsNullOrEmpty(edaDataCollectionPlansLastRun))
|
||||
sql.Append(" and greatest(v.containermodifieddate, v.configurationmodifieddate) >= to_date('").Append(edaDataCollectionPlansLastRun).Append("', '").Append(oracleFormat).Append("') ");
|
||||
//Print(sql.ToString());
|
||||
using (Oracle.ManagedDataAccess.Client.OracleCommand oracleCommand = new Oracle.ManagedDataAccess.Client.OracleCommand(sql.ToString(), oracleConnection))
|
||||
{
|
||||
using (Oracle.ManagedDataAccess.Client.OracleDataReader oracleDataReader = oracleCommand.ExecuteReader())
|
||||
{
|
||||
fieldCount = oracleDataReader.FieldCount;
|
||||
while (oracleDataReader.Read())
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
row = new List<object>();
|
||||
for (int c = 0; c < fieldCount; c++)
|
||||
{
|
||||
@object = oracleDataReader.GetValue(c);
|
||||
row.Add(@object);
|
||||
@string = @object.ToString();
|
||||
//if (@string.Length < 128)
|
||||
// _Log.Debug(@string);
|
||||
}
|
||||
rows[connection.Item1][objectType].Add(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rows.Any())
|
||||
{
|
||||
string csv;
|
||||
string xml;
|
||||
string json;
|
||||
string text;
|
||||
string html;
|
||||
Common common;
|
||||
string emptyAPC;
|
||||
string fileName;
|
||||
string edaObjectFile;
|
||||
string goldDirectory;
|
||||
string unitDirectory;
|
||||
string replace = "$$$";
|
||||
string edaObjectDirectory;
|
||||
DateTime lastModifiedDate;
|
||||
DateTime containerModifiedDate;
|
||||
PDSFConfiguration configuration;
|
||||
DateTime configurationModifiedDate;
|
||||
JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions { WriteIndented = true };
|
||||
foreach (KeyValuePair<string, Dictionary<ModuleInstanceTypeName, List<List<object>>>> databaseElement in rows)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
emptyAPC = string.Concat(workingDirectory, @"\", databaseElement.Key, @"\EmptyAPC.xlsx");
|
||||
foreach (KeyValuePair<ModuleInstanceTypeName, List<List<object>>> tableNameElement in databaseElement.Value)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
objectTypeDirectory = string.Concat(workingDirectory, @"\", databaseElement.Key, @"\", tableNameElement.Key);
|
||||
foreach (List<object> rowItem in tableNameElement.Value)
|
||||
{
|
||||
if (_ShuttingDown)
|
||||
break;
|
||||
//foreach (var item in rowItem)
|
||||
// Print(item.ToString());
|
||||
//if (!rowItem[containername].ToString().Contains("Plan_Pdsf_Health_Cp2Mg"))
|
||||
//if (!rowItem[unitname].ToString().Contains("XRD04") || !rowItem[containername].ToString().Contains("Plan_Pdsf"))
|
||||
// continue;
|
||||
containerModifiedDate = DateTime.Parse(rowItem[containermodifieddate].ToString());
|
||||
configurationModifiedDate = DateTime.Parse(rowItem[configurationmodifieddate].ToString());
|
||||
if (containerModifiedDate < configurationModifiedDate)
|
||||
lastModifiedDate = configurationModifiedDate;
|
||||
else
|
||||
lastModifiedDate = containerModifiedDate;
|
||||
goldDirectory = string.Concat(objectTypeDirectory, @"\", rowItem[unitname], @"\", rowItem[containername], @"\Gold");
|
||||
if (!Directory.Exists(goldDirectory))
|
||||
Directory.CreateDirectory(goldDirectory);
|
||||
edaObjectDirectory = string.Concat(objectTypeDirectory, @"\", rowItem[unitname], @"\", rowItem[containername], @"\", rowItem[configurationstate], @"\", rowItem[configurationproductivestate], @"\", lastModifiedDate.ToString("yyyy-MM-dd_"), new TimeSpan(lastModifiedDate.Ticks - new DateTime(lastModifiedDate.Year, lastModifiedDate.Month, lastModifiedDate.Day).Ticks).TotalSeconds);
|
||||
if (!Directory.Exists(edaObjectDirectory))
|
||||
Directory.CreateDirectory(edaObjectDirectory);
|
||||
edaObjectFile = string.Concat(edaObjectDirectory, @"\", rowItem[unitname], " ", rowItem[containername], " - ", replace, " - ", rowItem[configurationstate].ToString(), " ", rowItem[configurationproductivestate].ToString());
|
||||
xml = rowItem[containerconfiguration].ToString();
|
||||
//continue;
|
||||
lock (_Lock)
|
||||
{
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "Raw"), ".xml");
|
||||
File.WriteAllText(fileName, xml);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
common = new Common(ModuleInstanceTypeName.Pdsf, rowItem[unitname], rowItem[containername], rowItem[configurationstate], rowItem[configurationproductivestate]);
|
||||
configuration = ParseXML<PDSFConfiguration>(xml, throwExceptions: true);
|
||||
if (!Directory.Exists(Path.GetPathRoot(configuration.Settings.StoragePath)))
|
||||
continue;
|
||||
if (configuration is null)
|
||||
continue;
|
||||
else
|
||||
{
|
||||
common.Update(configuration);
|
||||
json = JsonSerializer.Serialize(configuration, configuration.GetType(), jsonSerializerOptions);
|
||||
if (!Directory.Exists(common.StoragePath))
|
||||
Directory.CreateDirectory(common.StoragePath);
|
||||
if (!common.StoragePath.Contains(common.UnitName) && (common.StoragePath.Contains(@"01EquipmentIntegration") || common.StoragePath.Contains(@"02BusinessIntegration")))
|
||||
{
|
||||
common.StoragePath = common.StoragePath.Replace("Traces", "Empty");
|
||||
if (!Directory.Exists(common.StoragePath))
|
||||
Directory.CreateDirectory(common.StoragePath);
|
||||
if (common.UnitName != "PRF01")
|
||||
{
|
||||
unitDirectory = string.Concat(Path.GetDirectoryName(common.StoragePath), @"\", common.UnitName);
|
||||
common.StoragePath = string.Concat(unitDirectory, @"\BadPath");
|
||||
if (!Directory.Exists(common.StoragePath))
|
||||
Directory.CreateDirectory(common.StoragePath);
|
||||
common.StoragePath = string.Concat(unitDirectory, @"\LogFile");
|
||||
if (!Directory.Exists(common.StoragePath))
|
||||
Directory.CreateDirectory(common.StoragePath);
|
||||
common.StoragePath = string.Concat(unitDirectory, @"\PollPath");
|
||||
if (!Directory.Exists(common.StoragePath))
|
||||
Directory.CreateDirectory(common.StoragePath);
|
||||
}
|
||||
}
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".csv");
|
||||
File.WriteAllText(fileName, common.ParametersAsCsv);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".json");
|
||||
File.WriteAllText(fileName, json);
|
||||
text = EDAViewer.Singleton.Helper.Background.EdaDCP.GetText(edaObjectFile, common, json);
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".txt");
|
||||
File.WriteAllText(fileName, text);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
html = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToHtml(edaObjectFile, common);
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "Partial"), ".html");
|
||||
File.WriteAllText(fileName, html);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
xml = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToDMSGridFormat(edaObjectFile, common, useAlias: false);
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "DMSGridFormat"), ".xml");
|
||||
File.WriteAllText(fileName, xml);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
xml = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToDMSGridFormat(edaObjectFile, common, useAlias: true);
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "DMSGridFormat - Alias"), ".xml");
|
||||
File.WriteAllText(fileName, xml);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
csv = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToAPCParameter(edaObjectFile, common);
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "APCParameter"), ".csv");
|
||||
File.WriteAllText(fileName, csv);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
csv = EDAViewer.Singleton.Helper.Background.EdaDCP.GetEdaObjectToAPCRunKeyNumber(edaObjectFile, common);
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "APCRunKeyNumber"), ".csv");
|
||||
File.WriteAllText(fileName, csv);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
fileName = string.Concat(edaObjectFile.Replace(replace, "APC"), ".xlsx");
|
||||
if (File.Exists(emptyAPC) && !File.Exists(fileName))
|
||||
{
|
||||
File.Copy(emptyAPC, fileName);
|
||||
try
|
||||
{ File.SetCreationTime(fileName, lastModifiedDate); File.SetLastWriteTime(fileName, lastModifiedDate); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try
|
||||
{ Directory.SetLastWriteTime(objectTypeDirectory, DateTime.Now); }
|
||||
catch (Exception) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
3821
EDA Viewer/Singleton/Helper/BackgroundEDA - A.cs
Normal file
3821
EDA Viewer/Singleton/Helper/BackgroundEDA - A.cs
Normal file
File diff suppressed because it is too large
Load Diff
29
EDA Viewer/Singleton/Helper/BackgroundEDADatabase.cs
Normal file
29
EDA Viewer/Singleton/Helper/BackgroundEDADatabase.cs
Normal file
@ -0,0 +1,29 @@
|
||||
namespace EDAViewer.Singleton.Helper
|
||||
{
|
||||
|
||||
public partial class Background
|
||||
{
|
||||
|
||||
public partial class EDADatabase
|
||||
{
|
||||
|
||||
public static string GetEdaDevelopment()
|
||||
{
|
||||
return "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimest-db.mes.infineon.com)(port=7001)))(connect_data=(sid=fimest))); User Id=edatest; Password=";
|
||||
}
|
||||
|
||||
public static string GetEdaStaging()
|
||||
{
|
||||
return "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimess-db.ec.local)(port=7001)))(connect_data=(sid=fimess))); User Id=edastag; Password=";
|
||||
}
|
||||
|
||||
public static string GetEdaProduction()
|
||||
{
|
||||
return "Data Source=(description=(address_list=(address=(protocol=tcp)(host=fimesp-db.ec.local)(port=7002)))(connect_data=(sid=fimesp))); User Id=edaprod; Password=";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
429
EDA Viewer/Singleton/Helper/BackgroundEdaDCP.cs
Normal file
429
EDA Viewer/Singleton/Helper/BackgroundEdaDCP.cs
Normal file
@ -0,0 +1,429 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace EDAViewer.Singleton.Helper
|
||||
{
|
||||
|
||||
public partial class Background
|
||||
{
|
||||
|
||||
public class EdaDCP
|
||||
{
|
||||
|
||||
internal static string GetEdaObjectToHtml(string edaObjectFile, Common common)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
string title = string.Concat(Path.GetFileName(edaObjectFile), " - ", common.Source);
|
||||
result.AppendLine("<!DOCTYPE html>");
|
||||
result.AppendLine("<html lang=\"en\">");
|
||||
result.AppendLine("<head>");
|
||||
result.AppendLine("<style>table, th, td{border:1px solid black;} td{padding:2px}</style>");
|
||||
result.Append("<title>").Append(title).AppendLine("</title>");
|
||||
result.AppendLine("</head>");
|
||||
result.AppendLine("<body>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Unit Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Container Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Configuration State").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Configuration Productive State").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("LogisticsEquipmentAlias").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Source").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("StoragePath").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("StartTimeFormat").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Filename").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<td nowrap>").Append(common.UnitName).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.ContainerName).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.ConfigurationState).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.ConfigurationProductiveState).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.LogisticsEquipmentAlias).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.Source).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.StoragePath).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.StartTimeFormat).AppendLine("</td>");
|
||||
result.Append("<td nowrap>").Append(common.Filename).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Use").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Order").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Key").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Placeholder").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.LogisticsAttributes)
|
||||
{
|
||||
if (item.Length > 2 && !item[2].StartsWith("Z_"))
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("ID").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Prefix").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.LogisticsColumns)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Use").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Order").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("FullName").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Alias").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("HardWareId").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Description").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Virtual").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Column#").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.Parameters)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Parent Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("ParameterName").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.GeneralTriggers)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("ResolveGlobalVariableBeforeTrigger").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.StartTriggersDCP)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Fixed").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Scenario").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("DefaultJobIndex").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("DefaultCarrierIndex").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("DefaultSlotIndex").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("DataPool").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.LogisticsTriggers)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("<td>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("KeyName").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("ParameterName").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (KeyValuePair<int, string[]> keyValuePair in common.LogisticsTriggersKeysKeyMapping)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in keyValuePair.Value)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("</td>");
|
||||
result.AppendLine("<td>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("LogisticsKey").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Source").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("MappedParameterName").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Formula").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (KeyValuePair<int, List<string[]>> keyValuePair in common.LogisticsTriggersCallDefinitionAttributes)
|
||||
{
|
||||
foreach (string[] values in keyValuePair.Value)
|
||||
{
|
||||
if (values.Length > 0 && !values[0].StartsWith("Z_"))
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in values)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
}
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("<table>");
|
||||
result.AppendLine("<tr>");
|
||||
result.Append("<th nowrap>").Append("Name").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("Rule").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("ResolveGlobalVariableBeforeTrigger").AppendLine("</th>");
|
||||
result.Append("<th nowrap>").Append("ResetGlobalVariablesAfterTrigger").AppendLine("</th>");
|
||||
result.AppendLine("</tr>");
|
||||
foreach (string[] item in common.StopTriggersDCP)
|
||||
{
|
||||
result.AppendLine("<tr>");
|
||||
foreach (string value in item)
|
||||
result.Append("<td nowrap>").Append(value).AppendLine("</td>");
|
||||
result.AppendLine("</tr>");
|
||||
}
|
||||
result.AppendLine("</table>");
|
||||
result.AppendLine("<hr>");
|
||||
result.AppendLine("</body>");
|
||||
result.AppendLine("</html>");
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
private static string ReplaceNull(object @object)
|
||||
{
|
||||
if (@object is null)
|
||||
return string.Empty;
|
||||
else
|
||||
return @object.ToString();
|
||||
}
|
||||
|
||||
private static void TextResolveEntry(StringBuilder result, dynamic expandoObject, int level, string super, int? i, bool group)
|
||||
{
|
||||
level += 1;
|
||||
foreach (dynamic entry in expandoObject)
|
||||
{
|
||||
if (entry.Value is ExpandoObject)
|
||||
TextResolveEntry(result, entry.Value, level, string.Concat(super, " : ", entry.Key), i, group);
|
||||
else
|
||||
{
|
||||
if (!(entry.Value is ICollection<object>))
|
||||
{
|
||||
if (i is null)
|
||||
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("--->").AppendLine(ReplaceNull(entry.Value));
|
||||
else
|
||||
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!group)
|
||||
{
|
||||
for (i = 0; i.Value < entry.Value.Count; i++)
|
||||
{
|
||||
if (entry.Value[i.Value] is ExpandoObject)
|
||||
TextResolveEntry(result, entry.Value[i.Value], level, string.Concat(super, " : ", entry.Key), i.Value, group);
|
||||
else
|
||||
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value[i.Value]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i.Value < entry.Value.Count; i++)
|
||||
{
|
||||
if (!(entry.Value[i.Value] is ExpandoObject))
|
||||
result.Append(level).Append(") ").Append(super).Append(" : ").Append(entry.Key).Append("[").Append(i.Value).Append("]--->").AppendLine(ReplaceNull(entry.Value[i.Value]));
|
||||
}
|
||||
for (i = 0; i.Value < entry.Value.Count; i++)
|
||||
{
|
||||
if (entry.Value[i.Value] is ExpandoObject)
|
||||
TextResolveEntry(result, entry.Value[i.Value], level, string.Concat(super, " : ", entry.Key), i.Value, group);
|
||||
}
|
||||
}
|
||||
i = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
level -= 1;
|
||||
}
|
||||
|
||||
internal static string GetText(string edaObjectFile, Common common, string json)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
if (result.Length > 0) //Skipping because System.Text.Json changed the way Expando works
|
||||
{
|
||||
string title = string.Concat(Path.GetFileName(edaObjectFile), " - ", common.Source);
|
||||
dynamic expandoObject = JsonSerializer.Deserialize<ExpandoObject>(json);
|
||||
result.AppendLine(title);
|
||||
result.AppendLine("Loop -> \"Normal\"");
|
||||
result.AppendLine(edaObjectFile);
|
||||
result.AppendLine();
|
||||
TextResolveEntry(result, expandoObject, 0, string.Empty, null, group: false);
|
||||
result.AppendLine();
|
||||
result.AppendLine();
|
||||
result.AppendLine();
|
||||
result.AppendLine(title);
|
||||
result.AppendLine("Loop -> \"Grouped\"");
|
||||
result.AppendLine(edaObjectFile);
|
||||
result.AppendLine();
|
||||
TextResolveEntry(result, expandoObject, 0, string.Empty, null, group: true);
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
internal static string GetEdaObjectToDMSGridFormat(string edaObjectFile, Common common, bool useAlias)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
string[] segments;
|
||||
int? recordStart = null;
|
||||
string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName);
|
||||
result.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
|
||||
result.Append("<Format Name=\"").Append(name).Append("\">").AppendLine();
|
||||
result.AppendLine(" <General RecordStart=\"\" RecordLength=\"0\" ReadCommand=\"\" DecimalSeparator=\".\">");
|
||||
result.AppendLine(" <RecordTerminator><13><10></RecordTerminator>");
|
||||
result.AppendLine(" <ColumnSeparator><9></ColumnSeparator>");
|
||||
result.AppendLine(" </General>");
|
||||
result.AppendLine(" <Fields>");
|
||||
for (int i = 0; i < common.Parameters.Count; i++)
|
||||
{
|
||||
if (recordStart is null && common.Parameters[i][3] == "RECORD_START")
|
||||
recordStart = i;
|
||||
if (recordStart.HasValue && common.Parameters[i][0] == "True")
|
||||
{
|
||||
if (useAlias && !string.IsNullOrEmpty(common.Parameters[i][3]))
|
||||
name = common.Parameters[i][3].Replace("'", string.Empty);
|
||||
else
|
||||
{
|
||||
segments = common.Parameters[i][2].Split('/');
|
||||
name = segments[segments.Length - 1];
|
||||
}
|
||||
result.Append(" <Field Name=\"").Append(name).Append("\" ColumnNumber=\"").Append(i + common.LogisticsColumns.Count + 2).Append("\" StartPosition=\"\" Length=\"\" DataType=\"Text\" NullReplacement=\"\" />").AppendLine();
|
||||
}
|
||||
}
|
||||
result.AppendLine(" </Fields>");
|
||||
result.AppendLine(" <Conditions>");
|
||||
result.AppendLine(" <Column />");
|
||||
result.AppendLine(" <Row>");
|
||||
result.AppendLine(" <Condition>");
|
||||
result.AppendLine(" <SkipHeaderCount>7</SkipHeaderCount>");
|
||||
result.AppendLine(" <SkipRowFilter>0</SkipRowFilter>");
|
||||
result.AppendLine(" <SkipRowValue>");
|
||||
result.AppendLine(" </SkipRowValue>");
|
||||
result.AppendLine(" </Condition>");
|
||||
result.AppendLine(" </Row>");
|
||||
result.AppendLine(" </Conditions>");
|
||||
result.AppendLine("</Format>");
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
internal static string GetEdaObjectToAPCParameter(string edaObjectFile, Common common)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
string parameter;
|
||||
string[] segments;
|
||||
string parameterSub35;
|
||||
string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName);
|
||||
result.AppendLine("ExportFileVersion=1.0.6");
|
||||
result.AppendLine("ExportFromTabsheet=Para");
|
||||
result.AppendLine("FieldName\tLongName\tMatchMode\tEquipment\tName\tPdsfNameConvCol\tPdsfNameDataType\tType\tChamberInfo\tUnifiedPara\tDateFormat\tUsername\tId\tWorkcenterId\tSite\tArea\tWorkcenter\tValidFrom\tValidTo");
|
||||
result.AppendLine("TIME_PREV_DIFF\tTIME_PREV_DIFF\tEXACT\t*\tTIME_PREV_DIFF\t\tNUMERIC\tRUN\t\tTIME_PREV_DIFF\t\tPHARES\t95069\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
|
||||
result.AppendLine("TIME\tTIME\tEXACT\t*\tTIME\t\tNUMERIC\tRUN\t\tTIME\t\tPHARES\t95070\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
|
||||
for (int i = 0; i < common.Parameters.Count; i++)
|
||||
{
|
||||
if (common.Parameters[i][0] == "True")
|
||||
{
|
||||
segments = common.Parameters[i][2].Split('/');
|
||||
parameter = segments[segments.Length - 1];
|
||||
if (parameter.Length < 35)
|
||||
parameterSub35 = parameter;
|
||||
else
|
||||
parameterSub35 = parameter.Substring(0, 35);
|
||||
result.Append(parameterSub35).Append("\tDIVERSE\tEXACT\t*\t").Append(parameterSub35).AppendLine("\t\tNUMERIC\tRUN\t\t\t\tPHARES\t9000000012\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
|
||||
}
|
||||
}
|
||||
result.AppendLine();
|
||||
result.AppendLine();
|
||||
result.AppendLine();
|
||||
for (int i = 0; i < common.Parameters.Count; i++)
|
||||
{
|
||||
if (common.Parameters[i][0] == "True")
|
||||
{
|
||||
segments = common.Parameters[i][2].Split('/');
|
||||
parameter = segments[segments.Length - 1];
|
||||
result.Append(parameter).Append("\tDIVERSE\tEXACT\t*\t").Append(parameter).AppendLine("\t\tNUMERIC\tRUN\t\t\t\tPHARES\t9000000012\t4571\tMesa\t\t\t4/15/2020 6:10 PM");
|
||||
}
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
internal static string GetEdaObjectToAPCRunKeyNumber(string edaObjectFile, Common common)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
string parameter;
|
||||
string[] segments;
|
||||
string parameterSub21;
|
||||
string parameterSub35;
|
||||
string name = string.Concat(common.LogisticsEquipmentAlias, "_", common.ContainerName);
|
||||
result.AppendLine("ExportFileVersion=1.0.6");
|
||||
result.AppendLine("ExportFromTabsheet=Run-Keynumbers");
|
||||
result.AppendLine("FeatureName\tShortName\tChamber\tComments\tVarMode\tPara\tExclude0\tTrigOn1\tTrigOn2\tTrigOn3\tTrigOff1\tTrigOff2\tTrigOff3\tTrigDelay\tTrigNorm\tTrigNvl\tTrigTrg\tAddCondOn\tActive\tFilter1\tFilter2\tFilter3\tFilter4\tUnit\tId\tWorkcenterId\tSite\tArea\tWorkcenter\tUsername\tValidFrom\tValidTo");
|
||||
for (int i = 0; i < common.Parameters.Count; i++)
|
||||
{
|
||||
if (common.Parameters[i][0] == "True")
|
||||
{
|
||||
segments = common.Parameters[i][2].Split('/');
|
||||
parameter = segments[segments.Length - 1];
|
||||
if (parameter.Length < 35)
|
||||
parameterSub35 = parameter;
|
||||
else
|
||||
parameterSub35 = parameter.Substring(0, 35);
|
||||
if (parameter.Length < 21)
|
||||
parameterSub21 = parameter;
|
||||
else
|
||||
parameterSub21 = parameter.Substring(0, 21);
|
||||
result.Append(parameterSub21).Append("_MIN\t").Append(parameterSub21).Append("_MIN\t\t\tMIN\t").Append(parameterSub35).AppendLine("\t0\tTIME\t=\tRUNSTART\tTIME\t=\tRUNEND\t\t\t\t\t\t1\t\t\t\t\t\t-1\t-1\t\t\t\tECPHARES\t5/2/2017 2:44 PM");
|
||||
}
|
||||
}
|
||||
result.AppendLine();
|
||||
result.AppendLine();
|
||||
result.AppendLine();
|
||||
for (int i = 0; i < common.Parameters.Count; i++)
|
||||
{
|
||||
if (common.Parameters[i][0] == "True")
|
||||
{
|
||||
segments = common.Parameters[i][2].Split('/');
|
||||
parameter = segments[segments.Length - 1];
|
||||
result.Append(parameter).Append("_MIN\t").Append(parameter).Append("_MIN\t\t\tMIN\t").Append(parameter).AppendLine("\t0\tTIME\t=\tRUNSTART\tTIME\t=\tRUNEND\t\t\t\t\t\t1\t\t\t\t\t\t-1\t-1\t\t\t\tECPHARES\t5/2/2017 2:44 PM");
|
||||
}
|
||||
}
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
164
EDA Viewer/Singleton/Helper/Common.cs
Normal file
164
EDA Viewer/Singleton/Helper/Common.cs
Normal file
@ -0,0 +1,164 @@
|
||||
using EDAViewer.Singleton.Helper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace EDAViewer.Singleton.Helper
|
||||
{
|
||||
|
||||
[Serializable]
|
||||
public class Common
|
||||
{
|
||||
|
||||
public ModuleInstanceTypeName? ObjectType { get; set; }
|
||||
public string ConfigurationState { get; set; }
|
||||
public string ConfigurationProductiveState { get; set; }
|
||||
public string UnitName { get; set; }
|
||||
public string ContainerName { get; set; }
|
||||
//
|
||||
public string StoragePath { get; set; }
|
||||
public string StartTimeFormat { get; set; }
|
||||
public string Filename { get; set; }
|
||||
//
|
||||
public string Source { get; set; }
|
||||
public string LogisticsEquipmentAlias { get; set; }
|
||||
public List<string[]> LogisticsAttributes { get; set; }
|
||||
public List<string[]> LogisticsColumns { get; set; }
|
||||
public List<string[]> Parameters { get; set; }
|
||||
public string ParametersAsCsv { get; set; }
|
||||
public List<string[]> GeneralTriggers { get; set; }
|
||||
public List<string[]> StartTriggersDCP { get; set; }
|
||||
public List<string[]> LogisticsTriggers { get; set; }
|
||||
public Dictionary<int, string[]> LogisticsTriggersKeysKeyMapping { get; set; }
|
||||
public Dictionary<int, List<string[]>> LogisticsTriggersCallDefinitionAttributes { get; set; }
|
||||
public List<string[]> StopTriggersDCP { get; set; }
|
||||
|
||||
[Obsolete("Only for DeserializeObject")]
|
||||
public Common()
|
||||
{
|
||||
ObjectType = null;
|
||||
ConfigurationState = string.Empty;
|
||||
ConfigurationProductiveState = string.Empty;
|
||||
UnitName = string.Empty;
|
||||
ContainerName = string.Empty;
|
||||
CommonLogic();
|
||||
}
|
||||
|
||||
public Common(ModuleInstanceTypeName objectType, object unitName, object containerName, object configurationState, object configurationProductiveState)
|
||||
{
|
||||
ObjectType = objectType;
|
||||
ConfigurationState = configurationState.ToString();
|
||||
ConfigurationProductiveState = configurationProductiveState.ToString();
|
||||
UnitName = unitName.ToString();
|
||||
ContainerName = containerName.ToString();
|
||||
CommonLogic(configurationState.ToString(), configurationProductiveState.ToString(), unitName.ToString(), containerName.ToString());
|
||||
}
|
||||
|
||||
private void CommonLogic(string configurationState = "", string configurationProductiveState = "", string unitName = "", string containerame = "")
|
||||
{
|
||||
LogisticsAttributes = new List<string[]>();
|
||||
LogisticsColumns = new List<string[]>();
|
||||
Parameters = new List<string[]>();
|
||||
ParametersAsCsv = string.Empty;
|
||||
GeneralTriggers = new List<string[]>();
|
||||
StartTriggersDCP = new List<string[]>();
|
||||
LogisticsTriggers = new List<string[]>();
|
||||
LogisticsTriggersKeysKeyMapping = new Dictionary<int, string[]>();
|
||||
LogisticsTriggersCallDefinitionAttributes = new Dictionary<int, List<string[]>>();
|
||||
StopTriggersDCP = new List<string[]>();
|
||||
}
|
||||
|
||||
public void Update(PDSFConfiguration configuration)
|
||||
{
|
||||
StoragePath = configuration.Settings.StoragePath;
|
||||
StartTimeFormat = configuration.Settings.StartTimeFormat;
|
||||
Filename = configuration.Settings.Filename;
|
||||
//
|
||||
Source = configuration.DataCollection.Source;
|
||||
LogisticsEquipmentAlias = configuration.DataCollection.Logistics.EquipmentAlias;
|
||||
//if (LogisticsEquipmentAlias == "R47-PLC")
|
||||
//{ }
|
||||
foreach (PDSFConfigurationDataCollectionLogisticsAttribute item in (from l in configuration.DataCollection.Logistics.Attributes orderby l.Use descending, l.Order select l))
|
||||
LogisticsAttributes.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.Key, item.Placeholder });
|
||||
foreach (PDSFConfigurationDataCollectionLogisticsColumn item in configuration.DataCollection.Logistics.Columns)
|
||||
LogisticsColumns.Add(new string[] { item.ID.ToString(), item.Prefix });
|
||||
foreach (PDSFConfigurationDataCollectionParameter1 item in (from l in configuration.DataCollection.VirtualParameters orderby l.Use descending, l.Order select l))
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.Alias) && !string.IsNullOrEmpty(item.Conditions.ConditionModel.Name))
|
||||
{
|
||||
if (item.Use)
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
else
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, string.Empty, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.Use)
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
else
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, string.Empty, true.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
}
|
||||
}
|
||||
foreach (PDSFConfigurationDataCollectionParameter item in (from l in configuration.DataCollection.Parameters orderby l.Use descending, l.Order select l))
|
||||
{
|
||||
if (string.IsNullOrEmpty(item?.Alias) && !string.IsNullOrEmpty(item?.Conditions?.ConditionModel?.Name))
|
||||
{
|
||||
if (item.Use)
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
else
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Conditions.ConditionModel.Name, item.HardWareId, item.Description, string.Empty, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.Use)
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, item.Conditions.ConditionModel.Formula, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
else
|
||||
Parameters.Add(new string[] { item.Use.ToString(), item.Order.ToString("000"), item.FullName, item.Alias, item.HardWareId, item.Description, string.Empty, false.ToString(), (configuration.DataCollection.Logistics.Columns.Length + 1 + item.Order).ToString("000") });
|
||||
}
|
||||
}
|
||||
Parameters = (from l in Parameters orderby l[0] descending, l[1] select l).ToList();
|
||||
StringBuilder text = new StringBuilder();
|
||||
//text.AppendLine("\"AliasName\";\"Condition\";\"EventId\";\"ExceptionId\";\"Formula\";\"HardwareId\";\"OrderId\";\"ParameterName\";\"Remark\";\"ReportName\";\"SourceId\";\"Use\"");
|
||||
//"Test";"";"";"";"";"";"1";"MICROSCOPE01/MET08MESMICROSCOPE/Test";"";"MICROSCOPE01/MET08MESMICROSCOPE/FileRead";"";"True""
|
||||
text.AppendLine("\"Use\";\"OrderId\";\"ReportName\";\"ParameterName\";\"AliasName\";\"HardwareId\";\"Remark\";\"Formula\"");
|
||||
foreach (string[] item in Parameters)
|
||||
{
|
||||
for (int i = 0; i < 7; i++)
|
||||
text.Append("\"").Append(item[i]).Append("\";");
|
||||
text.Remove(text.Length - 1, 1);
|
||||
text.AppendLine();
|
||||
}
|
||||
ParametersAsCsv = text.ToString();
|
||||
foreach (PDSFConfigurationDataCollectionGeneralTriggers item in configuration.DataCollection.GeneralTriggers)
|
||||
{
|
||||
foreach (PDSFConfigurationDataCollectionGeneralTriggersVariableModel gv in item.GlobalVariables)
|
||||
GeneralTriggers.Add(new string[] { item.Name, gv.Name, gv.ParameterName, gv.Formula });
|
||||
}
|
||||
{
|
||||
PDSFConfigurationDataCollectionStartTriggersDCP item = configuration.DataCollection.StartTriggers.DCP;
|
||||
if (!(item is null))
|
||||
StartTriggersDCP.Add(new string[] { item.Name, item.Rule, item.ResolveGlobalVariableBeforeTrigger.ToString() });
|
||||
}
|
||||
if (!(configuration.DataCollection.Logistics.Triggers.UpdateTrigger is null))
|
||||
{
|
||||
foreach (PDSFConfigurationDataCollectionLogisticsTriggersUpdateTriggerLogisticRequest item in configuration.DataCollection.Logistics.Triggers.UpdateTrigger.LogisticRequest)
|
||||
{
|
||||
LogisticsTriggers.Add(new string[] { item.Name.ToString(), item.LogisticsColumn.Fixed.ToString(), item.Rule, item.Keys.Scenario, item.Keys.DefaultJobIndex.ToString(), item.Keys.DefaultCarrierIndex.ToString(), item.Keys.DefaultSlotIndex.ToString(), item.DataPool.ToString() });
|
||||
if (!(item.Keys.KeyMapping is null))
|
||||
LogisticsTriggersKeysKeyMapping.Add(item.Name, new string[] { item.Keys.KeyMapping.KeyName, item.Keys.KeyMapping.ParameterName, item.Keys.KeyMapping.Formula });
|
||||
LogisticsTriggersCallDefinitionAttributes.Add(item.Name, new List<string[]>());
|
||||
foreach (PDSFConfigurationDataCollectionLogisticsTriggersUpdateTriggerLogisticRequestCallDefinitionLogisticCallDefinitionAttribute att in item.CallDefinition.Attributes)
|
||||
LogisticsTriggersCallDefinitionAttributes[item.Name].Add(new string[] { att.LogisticsKey, att.Source, att.MappedParameterName, att.Formula });
|
||||
}
|
||||
}
|
||||
{
|
||||
PDSFConfigurationDataCollectionStopTriggersDCP item = configuration.DataCollection.StopTriggers.DCP;
|
||||
if (!(item is null))
|
||||
StopTriggersDCP.Add(new string[] { item.Name, item.Rule, item.ResolveGlobalVariableBeforeTrigger.ToString(), item.ResetGlobalVariablesAfterTrigger.ToString() });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
8
EDA Viewer/Singleton/Helper/ModuleInstanceTypeName.cs
Normal file
8
EDA Viewer/Singleton/Helper/ModuleInstanceTypeName.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace EDAViewer.Singleton.Helper
|
||||
{
|
||||
public enum ModuleInstanceTypeName
|
||||
{
|
||||
Pdsf
|
||||
}
|
||||
|
||||
}
|
28
EDA Viewer/Singleton/IBackground.cs
Normal file
28
EDA Viewer/Singleton/IBackground.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using EDAViewer.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
|
||||
namespace EDAViewer.Singleton
|
||||
{
|
||||
|
||||
public interface IBackground : Models.IBackground, IDisposable
|
||||
{
|
||||
|
||||
void ClearMessage();
|
||||
void SendStatusOk();
|
||||
string Message { get; }
|
||||
bool IsPrimaryInstance();
|
||||
void SetIsPrimaryInstance();
|
||||
void ClearIsPrimaryInstance();
|
||||
string WorkingDirectory { get; }
|
||||
List<Exception> Exceptions { get; }
|
||||
void Update(ILogger<object> logger);
|
||||
string GetCountDirectory(string verb);
|
||||
void LogPathCleanUpByWeek(string server, bool isEDA = false, bool isNA = false);
|
||||
|
||||
}
|
||||
|
||||
}
|
156
EDA Viewer/Startup.cs
Normal file
156
EDA Viewer/Startup.cs
Normal file
@ -0,0 +1,156 @@
|
||||
using EDAViewer.HostedService;
|
||||
using EDAViewer.Models;
|
||||
using EDAViewer.Singleton;
|
||||
using Helper.Log;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Configuration.Json;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Shared;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
|
||||
namespace EDAViewer
|
||||
{
|
||||
|
||||
public class Startup
|
||||
{
|
||||
|
||||
private Background _Background;
|
||||
private AppSettings _AppSettings;
|
||||
private readonly IsEnvironment _IsEnvironment;
|
||||
private readonly IConfiguration _Configuration;
|
||||
private readonly IWebHostEnvironment _WebHostEnvironment;
|
||||
|
||||
public Startup(IConfiguration configuration, IWebHostEnvironment webHostEnvironment)
|
||||
{
|
||||
_Configuration = configuration;
|
||||
_WebHostEnvironment = webHostEnvironment;
|
||||
_IsEnvironment = new IsEnvironment(webHostEnvironment.IsDevelopment(), webHostEnvironment.IsStaging(), webHostEnvironment.IsProduction());
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
LogLevel defaultLogLevel;
|
||||
LogLevel log4netLogLevel;
|
||||
IConfigurationSection configurationSection;
|
||||
configurationSection = _Configuration.GetSection("Logging:LogLevel:Default");
|
||||
if (configurationSection is null || configurationSection.Value is null)
|
||||
defaultLogLevel = LogLevel.Debug;
|
||||
else if (!Enum.TryParse<LogLevel>(configurationSection.Value, out defaultLogLevel))
|
||||
defaultLogLevel = LogLevel.Debug;
|
||||
configurationSection = _Configuration.GetSection("Logging:LogLevel:Log4netProvider");
|
||||
if (configurationSection is null || configurationSection.Value is null)
|
||||
log4netLogLevel = defaultLogLevel;
|
||||
else if (!Enum.TryParse<LogLevel>(configurationSection.Value, out log4netLogLevel))
|
||||
log4netLogLevel = defaultLogLevel;
|
||||
_AppSettings = _Configuration.Get<AppSettings>();
|
||||
if (!_IsEnvironment.Production)
|
||||
_AppSettings.Server = _AppSettings.Server.Replace('.', '_');
|
||||
if (string.IsNullOrEmpty(_AppSettings.WorkingDirectoryName))
|
||||
throw new Exception("Working directory name must have a value!");
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
string workingDirectory = Log.GetWorkingDirectory(assembly.GetName().Name, _AppSettings.WorkingDirectoryName);
|
||||
services.AddLogging(logging =>
|
||||
{
|
||||
logging.AddProvider(new DebugProvider(defaultLogLevel));
|
||||
logging.AddProvider(new ConsoleProvider(defaultLogLevel));
|
||||
logging.AddProvider(new Log4netProvider(typeof(Startup), log4netLogLevel, workingDirectory));
|
||||
});
|
||||
|
||||
services.AddDirectoryBrowser();
|
||||
services.AddControllersWithViews().AddRazorRuntimeCompilation();
|
||||
services.AddServerSideBlazor();
|
||||
|
||||
// services.AddSingleton<WebClient, WebClient>();
|
||||
// services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
|
||||
_Background = new Background(_IsEnvironment, _AppSettings, workingDirectory);
|
||||
services.AddSingleton<Singleton.IBackground, Background>(b => _Background);
|
||||
services.AddSingleton<AppSettings, AppSettings>(appSettings => _AppSettings);
|
||||
services.AddSingleton<IsEnvironment, IsEnvironment>(isEnvironment => _IsEnvironment);
|
||||
services.AddHostedService(t => new TimedHostedService(_IsEnvironment, _Background, t.GetRequiredService<IServiceProvider>()));
|
||||
|
||||
services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1", new OpenApiInfo { Title = "EDAViewer", Version = "v1" });
|
||||
});
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
|
||||
{
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
if (string.IsNullOrEmpty(_AppSettings.URLs))
|
||||
{
|
||||
Environment.ExitCode = -1;
|
||||
lifetime.StopApplication();
|
||||
}
|
||||
|
||||
app.UseDeveloperExceptionPage();
|
||||
|
||||
app.UseSwagger(c =>
|
||||
{
|
||||
c.SerializeAsV2 = true;
|
||||
});
|
||||
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "EDA Viewer API V1");
|
||||
c.RoutePrefix = string.Empty;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
// The default HSTS value is 30 days.
|
||||
// You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||||
app.UseHsts();
|
||||
|
||||
app.UseSwagger(c =>
|
||||
{
|
||||
c.SerializeAsV2 = true;
|
||||
});
|
||||
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/EDAViewer/swagger/v1/swagger.json", "EDA Viewer API V1");
|
||||
c.RoutePrefix = string.Empty;
|
||||
});
|
||||
}
|
||||
|
||||
app.UseDirectoryBrowser(new DirectoryBrowserOptions
|
||||
{
|
||||
FileProvider = new PhysicalFileProvider(Path.Combine(env.WebRootPath, "images")),
|
||||
RequestPath = "/MyImages"
|
||||
});
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
//endpoints.MapBlazorHub();
|
||||
endpoints.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
47
EDA Viewer/Views/Home/Background.cshtml
Normal file
47
EDA Viewer/Views/Home/Background.cshtml
Normal file
@ -0,0 +1,47 @@
|
||||
@using EDAViewer.Controllers
|
||||
@{
|
||||
ViewBag.Title = "Background";
|
||||
int i = 0;
|
||||
string homeController = nameof(HomeController).Replace("Controller", string.Empty);
|
||||
}
|
||||
|
||||
<div class="jumbotron">
|
||||
<h1>EDA - @(ViewBag.IsPrimaryInstance) - @(ViewBag.Profile) - @(ViewBag.URLs) - 013</h1>
|
||||
<p class="lead">@(ViewBag.WorkingDirectory)</p>
|
||||
<p class="lead">@(ViewBag.Message)</p>
|
||||
<h1>@(ViewBag.ExceptionsCount)</h1>
|
||||
</div>
|
||||
<div>
|
||||
<ul>
|
||||
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))">Background Message</a></li>
|
||||
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-message_clear="true">Background Message Clear</a></li>
|
||||
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-exceptions_clear="true">Background Exceptions Clear</a></li>
|
||||
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-set_is_primary_instance="true">Background Set Is Primary Instance</a></li>
|
||||
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-set_is_primary_instance="false">Background Clear Primary Instance</a></li>
|
||||
<li><a asp-area="" asp-controller="@(homeController)" asp-action="@(nameof(HomeController.Background))" asp-route-invoke_eda_dcp="100">Background Invoke EDA DCP Plans Timer Change</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<p> </p>
|
||||
<hr />
|
||||
<div>
|
||||
<form action="">
|
||||
@foreach (Exception exception in ViewBag.Exceptions)
|
||||
{
|
||||
<p>
|
||||
@Html.Raw(string.Concat("<textarea name=\"message_", i, "\" rows='1' cols='400'>", exception.Message, "</textarea>"));
|
||||
</p>
|
||||
<p>
|
||||
@Html.Raw(string.Concat("<textarea name=\"stackTrace_", i, "\" rows='4' cols='400'>", exception.StackTrace, "</textarea>"));
|
||||
</p>
|
||||
<hr />
|
||||
@(i += 1);
|
||||
}
|
||||
</form>
|
||||
</div>
|
||||
@section scripts {
|
||||
<script>
|
||||
$(function () {
|
||||
console.log("ready!");
|
||||
});
|
||||
</script>
|
||||
}
|
12
EDA Viewer/Views/Home/Index.cshtml
Normal file
12
EDA Viewer/Views/Home/Index.cshtml
Normal file
@ -0,0 +1,12 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<component render-mode="ServerPrerendered" type="typeof(EDAViewer.Blazor.Counter)" />
|
||||
</div>
|
6
EDA Viewer/Views/Home/Privacy.cshtml
Normal file
6
EDA Viewer/Views/Home/Privacy.cshtml
Normal file
@ -0,0 +1,6 @@
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
182
EDA Viewer/Views/Home/ViewEdaHtmlDiff.cshtml
Normal file
182
EDA Viewer/Views/Home/ViewEdaHtmlDiff.cshtml
Normal file
@ -0,0 +1,182 @@
|
||||
@model EDAViewer.Models.EdaHtmlDiff
|
||||
@{
|
||||
ViewBag.Title = "EDA HTML Diff";
|
||||
string idForm = "Form";
|
||||
string idSubmit = "Submit";
|
||||
string idUp = "Up";
|
||||
string idRoot = "Root";
|
||||
string idRefresh = "Refresh";
|
||||
string background = "Background"; //Background
|
||||
string viewEdaHtmlDiff = "ViewEdaHtmlDiff"; //ViewEdaHtmlDiff
|
||||
string actionNameForForm = nameof(EDAViewer.Controllers.HomeController.ViewEdaHtmlDiff);
|
||||
string actionNameForList = nameof(EDAViewer.Controllers.HomeController.GetDirectoriesOrFiles);
|
||||
string homeController = nameof(EDAViewer.Controllers.HomeController).Replace("Controller", string.Empty);
|
||||
}
|
||||
|
||||
<div class="jumbotron">
|
||||
<h1>@(ViewBag.Message)</h1>
|
||||
</div>
|
||||
<div>
|
||||
@Html.Raw(ViewBag.Diff)
|
||||
<hr />
|
||||
@Html.Raw(ViewBag.OldText)
|
||||
<hr />
|
||||
@Html.Raw(ViewBag.NewText)
|
||||
<hr />
|
||||
<div style="min-height:44px;">
|
||||
<button id="@(idRoot)" style="margin-left: 50px; margin-bottom:10px" class="btn btn-info">Root Directory</button>
|
||||
<button id="@(idUp)" style="margin-left: 50px; margin-bottom:10px" class="btn btn-info">Up Directory</button>
|
||||
<button id="@(idRefresh)" style="margin-left: 50px; margin-bottom:10px" class="btn btn-info">Refresh List</button>
|
||||
</div>
|
||||
@using (Html.BeginForm(actionNameForForm, homeController, FormMethod.Post, new { id = idForm }))
|
||||
{
|
||||
@Html.AntiForgeryToken();
|
||||
@Html.ValidationSummary(true);
|
||||
@Html.HiddenFor(m => m.user_name)
|
||||
@Html.HiddenFor(m => m.machine_name)
|
||||
@Html.HiddenFor(m => m.now_ticks)
|
||||
@Html.HiddenFor(m => m.PathAndFileName)
|
||||
@Html.HiddenFor(m => m.Paths)
|
||||
<p>
|
||||
@Html.LabelFor(m => m.CurrentPath)
|
||||
@Html.DropDownListFor(m => m.CurrentPath, new SelectList(Enumerable.Empty<SelectListItem>()), htmlAttributes: new { style = "min-width:600px" })
|
||||
@Html.ValidationMessageFor(m => m.CurrentPath)
|
||||
</p>
|
||||
<p>
|
||||
@Html.LabelFor(m => m.FileName)
|
||||
@Html.TextBoxFor(m => m.FileName, htmlAttributes: new { style = "min-width:600px" })
|
||||
@Html.ValidationMessageFor(m => m.FileName)
|
||||
</p>
|
||||
<br />
|
||||
<input type="submit" value="Save" id="@(idSubmit)" class="btn btn-default" />
|
||||
}
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li>@Html.RouteLink("View EDA HTML Diff", new { action = viewEdaHtmlDiff, controller = homeController })</li>
|
||||
<li>@Html.RouteLink("Background Invoke EDA DCP Plans Timer Change", new { action = background, controller = homeController, invoke_eda_dcp = 100 })</li>
|
||||
</ul>
|
||||
</div>
|
||||
@section scripts {
|
||||
<script>
|
||||
//
|
||||
function getEncodedLastPath() {
|
||||
var encodedPath;
|
||||
var control = "@(nameof(Model.Paths))";
|
||||
encodedPath = $("#" + control).val().substr(0, $("#" + control).val().lastIndexOf("|"));
|
||||
$("#" + control).val(encodedPath)
|
||||
encodedPath = encodeURIComponent($("#" + control).val());
|
||||
return encodedPath;
|
||||
}
|
||||
//
|
||||
function getEncodedCurrentPath() {
|
||||
var encodedPath;
|
||||
var control = "@(nameof(Model.CurrentPath))";
|
||||
var pathSelected = $("#" + control).val();
|
||||
if (pathSelected == null) {
|
||||
encodedPath = "";
|
||||
}
|
||||
else {
|
||||
$("#@(nameof(Model.FileName))").val($("#" + control + " option:selected").text());
|
||||
$("#@(nameof(Model.PathAndFileName))").val(pathSelected);
|
||||
encodedPath = encodeURIComponent(pathSelected);
|
||||
}
|
||||
return encodedPath;
|
||||
}
|
||||
//
|
||||
function setList(prefix, encodedPath, upDirectory) {
|
||||
var actionName = prefix + "@(actionNameForList)?path=" + encodedPath + "&upDirectory=" + upDirectory + "&filter=";
|
||||
$('select').empty();
|
||||
$("#@(idUp)").hide();
|
||||
$("#@(idRoot)").hide();
|
||||
$("#@(idRefresh)").hide();
|
||||
$("#@(nameof(Model.CurrentPath))").hide();
|
||||
//
|
||||
$.ajax({
|
||||
url: actionName,
|
||||
type: "GET",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
datatype: JSON,
|
||||
success: function (result) {
|
||||
if (result.length > 7000) {
|
||||
setList("../", encodedPath, upDirectory);
|
||||
}
|
||||
else {
|
||||
var control = "@(nameof(Model.CurrentPath))";
|
||||
$(result).each(function (index, value) {
|
||||
$("#" + control).append($("<option></option>").val(value.value).html(value.text));
|
||||
});
|
||||
console.log("results lenght {" + result.length + "}");
|
||||
if (result.length == 1) {
|
||||
console.log("selecting first option");
|
||||
$("select#elem").attr('selectedIndex', 0);
|
||||
console.log("selected first option");
|
||||
}
|
||||
$("#@(nameof(Model.CurrentPath))").show();
|
||||
$("#@(idRefresh)").show();
|
||||
$("#@(idRoot)").show();
|
||||
$("#@(idUp)").show();
|
||||
}
|
||||
},
|
||||
error: function (data) {
|
||||
console.log(data);
|
||||
},
|
||||
always: function (data) {
|
||||
$("#@(nameof(Model.CurrentPath))").show();
|
||||
$("#@(idRefresh)").show();
|
||||
$("#@(idRoot)").show();
|
||||
$("#@(idUp)").show();
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).ready(function () {
|
||||
//
|
||||
console.log("ready!");
|
||||
//
|
||||
$("#@(idRefresh)").click(function (e) {
|
||||
$('#message').html('');
|
||||
var encodedPath = getEncodedCurrentPath();
|
||||
setList("", encodedPath, false);
|
||||
});
|
||||
//
|
||||
$("#@(idUp)").click(function (e) {
|
||||
$('#message').html('');
|
||||
var encodedPath = getEncodedLastPath();
|
||||
setList("", encodedPath, true);
|
||||
});
|
||||
//
|
||||
$("#@(idRoot)").click(function (e) {
|
||||
$('#message').html('');
|
||||
var encodedPath = "";
|
||||
setList("", encodedPath, false);
|
||||
});
|
||||
//
|
||||
$("#@(idSubmit)").click(function (e) {
|
||||
//$("#@(idSubmit)").hide();
|
||||
//e.preventDefault();
|
||||
});
|
||||
//
|
||||
$("select").change(function () {
|
||||
var str = "";
|
||||
$("select option:selected").each(function () {
|
||||
str += $(this).text() + " ";
|
||||
});
|
||||
console.debug(str);
|
||||
if (str.length > 0) {
|
||||
var control = "@(nameof(Model.CurrentPath))";
|
||||
var encodedPath = getEncodedCurrentPath();
|
||||
if (encodedPath.length > 0) {
|
||||
var pathsValue =$("#@(nameof(Model.Paths))").val();
|
||||
$("#@(nameof(Model.Paths))").val(pathsValue + "|" + $("#" + control).val());
|
||||
}
|
||||
setList("", encodedPath, false);
|
||||
}
|
||||
}).change();
|
||||
//
|
||||
$("#@(idForm)").removeAttr("novalidate");
|
||||
//
|
||||
setList("", encodeURIComponent("@(Model.CurrentPath.Replace(@"\",@"\\"))"), false);
|
||||
//
|
||||
});
|
||||
</script>
|
||||
}
|
25
EDA Viewer/Views/Shared/Error.cshtml
Normal file
25
EDA Viewer/Views/Shared/Error.cshtml
Normal file
@ -0,0 +1,25 @@
|
||||
@model ErrorViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Error";
|
||||
}
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (Model.ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@Model.RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
71
EDA Viewer/Views/Shared/_Layout.cshtml
Normal file
71
EDA Viewer/Views/Shared/_Layout.cshtml
Normal file
@ -0,0 +1,71 @@
|
||||
@using EDAViewer.Controllers
|
||||
@{
|
||||
string index = nameof(HomeController.Index);
|
||||
string privacy = nameof(HomeController.Privacy);
|
||||
string background = nameof(HomeController.Background);
|
||||
string homeController = nameof(HomeController).Replace("Controller", string.Empty);
|
||||
string schemeHostURL = string.Concat(Context.Request.Scheme, "://", Context.Request.Host);
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
@await RenderSectionAsync("Meta", required: false)
|
||||
<title>@ViewData["Title"] - EDAViewer</title>
|
||||
|
||||
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
|
||||
|
||||
<environment exclude="Staging,Development">
|
||||
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="@(schemeHostURL)/Common%20Shared%20Repository/HTML5Shiv/3.7.2/html5shiv.js"></script>
|
||||
<script src="@(schemeHostURL)/Common%20Shared%20Repository/Respond/1.4.2/respond.js"></script>
|
||||
<![endif]-->
|
||||
</environment>
|
||||
|
||||
<link href="~/css/bundles/css.css" rel="stylesheet" />
|
||||
<base href="~/" />
|
||||
@await RenderSectionAsync("Style", required: false)
|
||||
|
||||
<script src="~/js/bundles/modernizr.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" asp-area="" asp-controller="@(homeController)" asp-action="@(index)">EDA Viewer</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="@(homeController)" asp-action="@(background)">Background</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div class="container body-content">
|
||||
@RenderBody()
|
||||
</div>
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2021 - EDAViewer - <a asp-area="" asp-controller="@(homeController)" asp-action="@(privacy)">Privacy</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/js/bundles/jquery.js"></script>
|
||||
<script src="~/js/bundles/bootstrap.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
<!--script src="_framework/blazor.server.js" asp-append-version="true"></script-->
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
2
EDA Viewer/Views/Shared/_ValidationScriptsPartial.cshtml
Normal file
2
EDA Viewer/Views/Shared/_ValidationScriptsPartial.cshtml
Normal file
@ -0,0 +1,2 @@
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
|
3
EDA Viewer/Views/_ViewImports.cshtml
Normal file
3
EDA Viewer/Views/_ViewImports.cshtml
Normal file
@ -0,0 +1,3 @@
|
||||
@using EDAViewer
|
||||
@using EDAViewer.Models
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
3
EDA Viewer/Views/_ViewStart.cshtml
Normal file
3
EDA Viewer/Views/_ViewStart.cshtml
Normal file
@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
19
EDA Viewer/appsettings.Development.json
Normal file
19
EDA Viewer/appsettings.Development.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"Company": "Infineon Technologies Americas Corp.",
|
||||
"ECEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
|
||||
"EncryptedPassword": "K1RyLhaIRyJTDbWutsuWWEiO2hTD3h7fW0BV/Cp+Ftw=",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Debug",
|
||||
"Microsoft": "Warning",
|
||||
"Log4netProvider": "Debug",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"IFXEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
|
||||
"MonARessource": "EDA_Viewer_IFX",
|
||||
"Server": "messv02ecc1_ec_local",
|
||||
"ServiceUser": "mesedasvc",
|
||||
"URLs": "http://localhost:5000;",
|
||||
"WorkingDirectoryName": "IFXApps"
|
||||
}
|
19
EDA Viewer/appsettings.Staging.json
Normal file
19
EDA Viewer/appsettings.Staging.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"Company": "Infineon Technologies Americas Corp.",
|
||||
"ECEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
|
||||
"EncryptedPassword": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00=",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Log4netProvider": "Information",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"IFXEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
|
||||
"MonARessource": "EDA_Viewer_EC",
|
||||
"Server": "messv02ecc1.ec.local",
|
||||
"ServiceUser": "ECMESEAF",
|
||||
"URLs": "http://localhost:5002;",
|
||||
"WorkingDirectoryName": "IFXApps"
|
||||
}
|
19
EDA Viewer/appsettings.json
Normal file
19
EDA Viewer/appsettings.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"Company": "Infineon Technologies Americas Corp.",
|
||||
"ECEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
|
||||
"EncryptedPassword": "CUGygiPwahy4U3j+6KqqoMZ08STyVDR1rKm6MwPpt00=",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Log4netProvider": "Information",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"IFXEDADatabasePassword": "8vIs2nEZPkcdBUfXX0hHlA==",
|
||||
"MonARessource": "EDA_Viewer_EC",
|
||||
"Server": "messv02ecc1.ec.local",
|
||||
"ServiceUser": "ECMESEAF",
|
||||
"URLs": "http://localhost:5002;",
|
||||
"WorkingDirectoryName": "IFXApps"
|
||||
}
|
1
EDA Viewer/wwwroot/css/bundles/css.css
Normal file
1
EDA Viewer/wwwroot/css/bundles/css.css
Normal file
File diff suppressed because one or more lines are too long
71
EDA Viewer/wwwroot/css/site.css
Normal file
71
EDA Viewer/wwwroot/css/site.css
Normal file
@ -0,0 +1,71 @@
|
||||
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
|
||||
for details on configuring this project to bundle and minify static web assets. */
|
||||
|
||||
a.navbar-brand {
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* Provide sufficient contrast against white background */
|
||||
a {
|
||||
color: #0366d6;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
border-color: #1861ac;
|
||||
}
|
||||
|
||||
/* Sticky footer styles
|
||||
-------------------------------------------------- */
|
||||
html {
|
||||
font-size: 14px;
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
html {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top: 1px solid #e5e5e5;
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.box-shadow {
|
||||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
|
||||
}
|
||||
|
||||
button.accept-policy {
|
||||
font-size: 1rem;
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
/* Sticky footer styles
|
||||
-------------------------------------------------- */
|
||||
html {
|
||||
position: relative;
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
/* Margin bottom by footer height */
|
||||
margin-bottom: 60px;
|
||||
}
|
||||
.footer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
white-space: nowrap;
|
||||
line-height: 60px; /* Vertically center the text there */
|
||||
}
|
BIN
EDA Viewer/wwwroot/favicon.ico
Normal file
BIN
EDA Viewer/wwwroot/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
BIN
EDA Viewer/wwwroot/images/OnePixel.gif
Normal file
BIN
EDA Viewer/wwwroot/images/OnePixel.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 807 B |
1
EDA Viewer/wwwroot/js/bundles/bootstrap.js
vendored
Normal file
1
EDA Viewer/wwwroot/js/bundles/bootstrap.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
EDA Viewer/wwwroot/js/bundles/jquery.js
vendored
Normal file
1
EDA Viewer/wwwroot/js/bundles/jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
EDA Viewer/wwwroot/js/bundles/jqueryval.js
vendored
Normal file
1
EDA Viewer/wwwroot/js/bundles/jqueryval.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
EDA Viewer/wwwroot/js/bundles/modernizr.js
Normal file
1
EDA Viewer/wwwroot/js/bundles/modernizr.js
Normal file
File diff suppressed because one or more lines are too long
520
EDA Viewer/wwwroot/js/html5shiv/3.7.2/html5shiv-printshiv.js
Normal file
520
EDA Viewer/wwwroot/js/html5shiv/3.7.2/html5shiv-printshiv.js
Normal file
@ -0,0 +1,520 @@
|
||||
/**
|
||||
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
;(function(window, document) {
|
||||
/*jshint evil:true */
|
||||
/** version */
|
||||
var version = '3.7.2';
|
||||
|
||||
/** Preset options */
|
||||
var options = window.html5 || {};
|
||||
|
||||
/** Used to skip problem elements */
|
||||
var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
|
||||
|
||||
/** Not all elements can be cloned in IE **/
|
||||
var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
|
||||
|
||||
/** Detect whether the browser supports default html5 styles */
|
||||
var supportsHtml5Styles;
|
||||
|
||||
/** Name of the expando, to work with multiple documents or to re-shiv one document */
|
||||
var expando = '_html5shiv';
|
||||
|
||||
/** The id for the the documents expando */
|
||||
var expanID = 0;
|
||||
|
||||
/** Cached data for each document */
|
||||
var expandoData = {};
|
||||
|
||||
/** Detect whether the browser supports unknown elements */
|
||||
var supportsUnknownElements;
|
||||
|
||||
(function() {
|
||||
try {
|
||||
var a = document.createElement('a');
|
||||
a.innerHTML = '<xyz></xyz>';
|
||||
//if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles
|
||||
supportsHtml5Styles = ('hidden' in a);
|
||||
|
||||
supportsUnknownElements = a.childNodes.length == 1 || (function() {
|
||||
// assign a false positive if unable to shiv
|
||||
(document.createElement)('a');
|
||||
var frag = document.createDocumentFragment();
|
||||
return (
|
||||
typeof frag.cloneNode == 'undefined' ||
|
||||
typeof frag.createDocumentFragment == 'undefined' ||
|
||||
typeof frag.createElement == 'undefined'
|
||||
);
|
||||
}());
|
||||
} catch(e) {
|
||||
// assign a false positive if detection fails => unable to shiv
|
||||
supportsHtml5Styles = true;
|
||||
supportsUnknownElements = true;
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates a style sheet with the given CSS text and adds it to the document.
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @param {String} cssText The CSS text.
|
||||
* @returns {StyleSheet} The style element.
|
||||
*/
|
||||
function addStyleSheet(ownerDocument, cssText) {
|
||||
var p = ownerDocument.createElement('p'),
|
||||
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
|
||||
|
||||
p.innerHTML = 'x<style>' + cssText + '</style>';
|
||||
return parent.insertBefore(p.lastChild, parent.firstChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of `html5.elements` as an array.
|
||||
* @private
|
||||
* @returns {Array} An array of shived element node names.
|
||||
*/
|
||||
function getElements() {
|
||||
var elements = html5.elements;
|
||||
return typeof elements == 'string' ? elements.split(' ') : elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends the built-in list of html5 elements
|
||||
* @memberOf html5
|
||||
* @param {String|Array} newElements whitespace separated list or array of new element names to shiv
|
||||
* @param {Document} ownerDocument The context document.
|
||||
*/
|
||||
function addElements(newElements, ownerDocument) {
|
||||
var elements = html5.elements;
|
||||
if(typeof elements != 'string'){
|
||||
elements = elements.join(' ');
|
||||
}
|
||||
if(typeof newElements != 'string'){
|
||||
newElements = newElements.join(' ');
|
||||
}
|
||||
html5.elements = elements +' '+ newElements;
|
||||
shivDocument(ownerDocument);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data associated to the given document
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @returns {Object} An object of data.
|
||||
*/
|
||||
function getExpandoData(ownerDocument) {
|
||||
var data = expandoData[ownerDocument[expando]];
|
||||
if (!data) {
|
||||
data = {};
|
||||
expanID++;
|
||||
ownerDocument[expando] = expanID;
|
||||
expandoData[expanID] = data;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a shived element for the given nodeName and document
|
||||
* @memberOf html5
|
||||
* @param {String} nodeName name of the element
|
||||
* @param {Document} ownerDocument The context document.
|
||||
* @returns {Object} The shived element.
|
||||
*/
|
||||
function createElement(nodeName, ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createElement(nodeName);
|
||||
}
|
||||
if (!data) {
|
||||
data = getExpandoData(ownerDocument);
|
||||
}
|
||||
var node;
|
||||
|
||||
if (data.cache[nodeName]) {
|
||||
node = data.cache[nodeName].cloneNode();
|
||||
} else if (saveClones.test(nodeName)) {
|
||||
node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
|
||||
} else {
|
||||
node = data.createElem(nodeName);
|
||||
}
|
||||
|
||||
// Avoid adding some elements to fragments in IE < 9 because
|
||||
// * Attributes like `name` or `type` cannot be set/changed once an element
|
||||
// is inserted into a document/fragment
|
||||
// * Link elements with `src` attributes that are inaccessible, as with
|
||||
// a 403 response, will cause the tab/window to crash
|
||||
// * Script elements appended to fragments will execute when their `src`
|
||||
// or `text` property is set
|
||||
return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a shived DocumentFragment for the given document
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The context document.
|
||||
* @returns {Object} The shived DocumentFragment.
|
||||
*/
|
||||
function createDocumentFragment(ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createDocumentFragment();
|
||||
}
|
||||
data = data || getExpandoData(ownerDocument);
|
||||
var clone = data.frag.cloneNode(),
|
||||
i = 0,
|
||||
elems = getElements(),
|
||||
l = elems.length;
|
||||
for(;i<l;i++){
|
||||
clone.createElement(elems[i]);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shivs the `createElement` and `createDocumentFragment` methods of the document.
|
||||
* @private
|
||||
* @param {Document|DocumentFragment} ownerDocument The document.
|
||||
* @param {Object} data of the document.
|
||||
*/
|
||||
function shivMethods(ownerDocument, data) {
|
||||
if (!data.cache) {
|
||||
data.cache = {};
|
||||
data.createElem = ownerDocument.createElement;
|
||||
data.createFrag = ownerDocument.createDocumentFragment;
|
||||
data.frag = data.createFrag();
|
||||
}
|
||||
|
||||
|
||||
ownerDocument.createElement = function(nodeName) {
|
||||
//abort shiv
|
||||
if (!html5.shivMethods) {
|
||||
return data.createElem(nodeName);
|
||||
}
|
||||
return createElement(nodeName, ownerDocument, data);
|
||||
};
|
||||
|
||||
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
|
||||
'var n=f.cloneNode(),c=n.createElement;' +
|
||||
'h.shivMethods&&(' +
|
||||
// unroll the `createElement` calls
|
||||
getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
|
||||
data.createElem(nodeName);
|
||||
data.frag.createElement(nodeName);
|
||||
return 'c("' + nodeName + '")';
|
||||
}) +
|
||||
');return n}'
|
||||
)(html5, data.frag);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Shivs the given document.
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The document to shiv.
|
||||
* @returns {Document} The shived document.
|
||||
*/
|
||||
function shivDocument(ownerDocument) {
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
var data = getExpandoData(ownerDocument);
|
||||
|
||||
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
|
||||
data.hasCSS = !!addStyleSheet(ownerDocument,
|
||||
// corrects block display not defined in IE6/7/8/9
|
||||
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
|
||||
// adds styling not present in IE6/7/8/9
|
||||
'mark{background:#FF0;color:#000}' +
|
||||
// hides non-rendered elements
|
||||
'template{display:none}'
|
||||
);
|
||||
}
|
||||
if (!supportsUnknownElements) {
|
||||
shivMethods(ownerDocument, data);
|
||||
}
|
||||
return ownerDocument;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The `html5` object is exposed so that more elements can be shived and
|
||||
* existing shiving can be detected on iframes.
|
||||
* @type Object
|
||||
* @example
|
||||
*
|
||||
* // options can be changed before the script is included
|
||||
* html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };
|
||||
*/
|
||||
var html5 = {
|
||||
|
||||
/**
|
||||
* An array or space separated string of node names of the elements to shiv.
|
||||
* @memberOf html5
|
||||
* @type Array|String
|
||||
*/
|
||||
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video',
|
||||
|
||||
/**
|
||||
* current version of html5shiv
|
||||
*/
|
||||
'version': version,
|
||||
|
||||
/**
|
||||
* A flag to indicate that the HTML5 style sheet should be inserted.
|
||||
* @memberOf html5
|
||||
* @type Boolean
|
||||
*/
|
||||
'shivCSS': (options.shivCSS !== false),
|
||||
|
||||
/**
|
||||
* Is equal to true if a browser supports creating unknown/HTML5 elements
|
||||
* @memberOf html5
|
||||
* @type boolean
|
||||
*/
|
||||
'supportsUnknownElements': supportsUnknownElements,
|
||||
|
||||
/**
|
||||
* A flag to indicate that the document's `createElement` and `createDocumentFragment`
|
||||
* methods should be overwritten.
|
||||
* @memberOf html5
|
||||
* @type Boolean
|
||||
*/
|
||||
'shivMethods': (options.shivMethods !== false),
|
||||
|
||||
/**
|
||||
* A string to describe the type of `html5` object ("default" or "default print").
|
||||
* @memberOf html5
|
||||
* @type String
|
||||
*/
|
||||
'type': 'default',
|
||||
|
||||
// shivs the document according to the specified `html5` object options
|
||||
'shivDocument': shivDocument,
|
||||
|
||||
//creates a shived element
|
||||
createElement: createElement,
|
||||
|
||||
//creates a shived documentFragment
|
||||
createDocumentFragment: createDocumentFragment,
|
||||
|
||||
//extends list of elements
|
||||
addElements: addElements
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// expose html5
|
||||
window.html5 = html5;
|
||||
|
||||
// shiv the document
|
||||
shivDocument(document);
|
||||
|
||||
/*------------------------------- Print Shiv -------------------------------*/
|
||||
|
||||
/** Used to filter media types */
|
||||
var reMedia = /^$|\b(?:all|print)\b/;
|
||||
|
||||
/** Used to namespace printable elements */
|
||||
var shivNamespace = 'html5shiv';
|
||||
|
||||
/** Detect whether the browser supports shivable style sheets */
|
||||
var supportsShivableSheets = !supportsUnknownElements && (function() {
|
||||
// assign a false negative if unable to shiv
|
||||
var docEl = document.documentElement;
|
||||
return !(
|
||||
typeof document.namespaces == 'undefined' ||
|
||||
typeof document.parentWindow == 'undefined' ||
|
||||
typeof docEl.applyElement == 'undefined' ||
|
||||
typeof docEl.removeNode == 'undefined' ||
|
||||
typeof window.attachEvent == 'undefined'
|
||||
);
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Wraps all HTML5 elements in the given document with printable elements.
|
||||
* (eg. the "header" element is wrapped with the "html5shiv:header" element)
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @returns {Array} An array wrappers added.
|
||||
*/
|
||||
function addWrappers(ownerDocument) {
|
||||
var node,
|
||||
nodes = ownerDocument.getElementsByTagName('*'),
|
||||
index = nodes.length,
|
||||
reElements = RegExp('^(?:' + getElements().join('|') + ')$', 'i'),
|
||||
result = [];
|
||||
|
||||
while (index--) {
|
||||
node = nodes[index];
|
||||
if (reElements.test(node.nodeName)) {
|
||||
result.push(node.applyElement(createWrapper(node)));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a printable wrapper for the given element.
|
||||
* @private
|
||||
* @param {Element} element The element.
|
||||
* @returns {Element} The wrapper.
|
||||
*/
|
||||
function createWrapper(element) {
|
||||
var node,
|
||||
nodes = element.attributes,
|
||||
index = nodes.length,
|
||||
wrapper = element.ownerDocument.createElement(shivNamespace + ':' + element.nodeName);
|
||||
|
||||
// copy element attributes to the wrapper
|
||||
while (index--) {
|
||||
node = nodes[index];
|
||||
node.specified && wrapper.setAttribute(node.nodeName, node.nodeValue);
|
||||
}
|
||||
// copy element styles to the wrapper
|
||||
wrapper.style.cssText = element.style.cssText;
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shivs the given CSS text.
|
||||
* (eg. header{} becomes html5shiv\:header{})
|
||||
* @private
|
||||
* @param {String} cssText The CSS text to shiv.
|
||||
* @returns {String} The shived CSS text.
|
||||
*/
|
||||
function shivCssText(cssText) {
|
||||
var pair,
|
||||
parts = cssText.split('{'),
|
||||
index = parts.length,
|
||||
reElements = RegExp('(^|[\\s,>+~])(' + getElements().join('|') + ')(?=[[\\s,>+~#.:]|$)', 'gi'),
|
||||
replacement = '$1' + shivNamespace + '\\:$2';
|
||||
|
||||
while (index--) {
|
||||
pair = parts[index] = parts[index].split('}');
|
||||
pair[pair.length - 1] = pair[pair.length - 1].replace(reElements, replacement);
|
||||
parts[index] = pair.join('}');
|
||||
}
|
||||
return parts.join('{');
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the given wrappers, leaving the original elements.
|
||||
* @private
|
||||
* @params {Array} wrappers An array of printable wrappers.
|
||||
*/
|
||||
function removeWrappers(wrappers) {
|
||||
var index = wrappers.length;
|
||||
while (index--) {
|
||||
wrappers[index].removeNode();
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Shivs the given document for print.
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The document to shiv.
|
||||
* @returns {Document} The shived document.
|
||||
*/
|
||||
function shivPrint(ownerDocument) {
|
||||
var shivedSheet,
|
||||
wrappers,
|
||||
data = getExpandoData(ownerDocument),
|
||||
namespaces = ownerDocument.namespaces,
|
||||
ownerWindow = ownerDocument.parentWindow;
|
||||
|
||||
if (!supportsShivableSheets || ownerDocument.printShived) {
|
||||
return ownerDocument;
|
||||
}
|
||||
if (typeof namespaces[shivNamespace] == 'undefined') {
|
||||
namespaces.add(shivNamespace);
|
||||
}
|
||||
|
||||
function removeSheet() {
|
||||
clearTimeout(data._removeSheetTimer);
|
||||
if (shivedSheet) {
|
||||
shivedSheet.removeNode(true);
|
||||
}
|
||||
shivedSheet= null;
|
||||
}
|
||||
|
||||
ownerWindow.attachEvent('onbeforeprint', function() {
|
||||
|
||||
removeSheet();
|
||||
|
||||
var imports,
|
||||
length,
|
||||
sheet,
|
||||
collection = ownerDocument.styleSheets,
|
||||
cssText = [],
|
||||
index = collection.length,
|
||||
sheets = Array(index);
|
||||
|
||||
// convert styleSheets collection to an array
|
||||
while (index--) {
|
||||
sheets[index] = collection[index];
|
||||
}
|
||||
// concat all style sheet CSS text
|
||||
while ((sheet = sheets.pop())) {
|
||||
// IE does not enforce a same origin policy for external style sheets...
|
||||
// but has trouble with some dynamically created stylesheets
|
||||
if (!sheet.disabled && reMedia.test(sheet.media)) {
|
||||
|
||||
try {
|
||||
imports = sheet.imports;
|
||||
length = imports.length;
|
||||
} catch(er){
|
||||
length = 0;
|
||||
}
|
||||
|
||||
for (index = 0; index < length; index++) {
|
||||
sheets.push(imports[index]);
|
||||
}
|
||||
|
||||
try {
|
||||
cssText.push(sheet.cssText);
|
||||
} catch(er){}
|
||||
}
|
||||
}
|
||||
|
||||
// wrap all HTML5 elements with printable elements and add the shived style sheet
|
||||
cssText = shivCssText(cssText.reverse().join(''));
|
||||
wrappers = addWrappers(ownerDocument);
|
||||
shivedSheet = addStyleSheet(ownerDocument, cssText);
|
||||
|
||||
});
|
||||
|
||||
ownerWindow.attachEvent('onafterprint', function() {
|
||||
// remove wrappers, leaving the original elements, and remove the shived style sheet
|
||||
removeWrappers(wrappers);
|
||||
clearTimeout(data._removeSheetTimer);
|
||||
data._removeSheetTimer = setTimeout(removeSheet, 500);
|
||||
});
|
||||
|
||||
ownerDocument.printShived = true;
|
||||
return ownerDocument;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// expose API
|
||||
html5.type += ' print';
|
||||
html5.shivPrint = shivPrint;
|
||||
|
||||
// shiv for print
|
||||
shivPrint(document);
|
||||
|
||||
}(this, document));
|
4
EDA Viewer/wwwroot/js/html5shiv/3.7.2/html5shiv-printshiv.min.js
vendored
Normal file
4
EDA Viewer/wwwroot/js/html5shiv/3.7.2/html5shiv-printshiv.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=y.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=y.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),y.elements=c+" "+a,j(b)}function f(a){var b=x[a[v]];return b||(b={},w++,a[v]=w,x[w]=b),b}function g(a,c,d){if(c||(c=b),q)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():u.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||t.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),q)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return y.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(y,b.frag)}function j(a){a||(a=b);var d=f(a);return!y.shivCSS||p||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),q||i(a,d),a}function k(a){for(var b,c=a.getElementsByTagName("*"),e=c.length,f=RegExp("^(?:"+d().join("|")+")$","i"),g=[];e--;)b=c[e],f.test(b.nodeName)&&g.push(b.applyElement(l(b)));return g}function l(a){for(var b,c=a.attributes,d=c.length,e=a.ownerDocument.createElement(A+":"+a.nodeName);d--;)b=c[d],b.specified&&e.setAttribute(b.nodeName,b.nodeValue);return e.style.cssText=a.style.cssText,e}function m(a){for(var b,c=a.split("{"),e=c.length,f=RegExp("(^|[\\s,>+~])("+d().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),g="$1"+A+"\\:$2";e--;)b=c[e]=c[e].split("}"),b[b.length-1]=b[b.length-1].replace(f,g),c[e]=b.join("}");return c.join("{")}function n(a){for(var b=a.length;b--;)a[b].removeNode()}function o(a){function b(){clearTimeout(g._removeSheetTimer),d&&d.removeNode(!0),d=null}var d,e,g=f(a),h=a.namespaces,i=a.parentWindow;return!B||a.printShived?a:("undefined"==typeof h[A]&&h.add(A),i.attachEvent("onbeforeprint",function(){b();for(var f,g,h,i=a.styleSheets,j=[],l=i.length,n=Array(l);l--;)n[l]=i[l];for(;h=n.pop();)if(!h.disabled&&z.test(h.media)){try{f=h.imports,g=f.length}catch(o){g=0}for(l=0;g>l;l++)n.push(f[l]);try{j.push(h.cssText)}catch(o){}}j=m(j.reverse().join("")),e=k(a),d=c(a,j)}),i.attachEvent("onafterprint",function(){n(e),clearTimeout(g._removeSheetTimer),g._removeSheetTimer=setTimeout(b,500)}),a.printShived=!0,a)}var p,q,r="3.7.2",s=a.html5||{},t=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,u=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,v="_html5shiv",w=0,x={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",p="hidden"in a,q=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){p=!0,q=!0}}();var y={elements:s.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:r,shivCSS:s.shivCSS!==!1,supportsUnknownElements:q,shivMethods:s.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=y,j(b);var z=/^$|\b(?:all|print)\b/,A="html5shiv",B=!q&&function(){var c=b.documentElement;return!("undefined"==typeof b.namespaces||"undefined"==typeof b.parentWindow||"undefined"==typeof c.applyElement||"undefined"==typeof c.removeNode||"undefined"==typeof a.attachEvent)}();y.type+=" print",y.shivPrint=o,o(b)}(this,document);
|
322
EDA Viewer/wwwroot/js/html5shiv/3.7.2/html5shiv.js
vendored
Normal file
322
EDA Viewer/wwwroot/js/html5shiv/3.7.2/html5shiv.js
vendored
Normal file
@ -0,0 +1,322 @@
|
||||
/**
|
||||
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
;(function(window, document) {
|
||||
/*jshint evil:true */
|
||||
/** version */
|
||||
var version = '3.7.2';
|
||||
|
||||
/** Preset options */
|
||||
var options = window.html5 || {};
|
||||
|
||||
/** Used to skip problem elements */
|
||||
var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
|
||||
|
||||
/** Not all elements can be cloned in IE **/
|
||||
var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
|
||||
|
||||
/** Detect whether the browser supports default html5 styles */
|
||||
var supportsHtml5Styles;
|
||||
|
||||
/** Name of the expando, to work with multiple documents or to re-shiv one document */
|
||||
var expando = '_html5shiv';
|
||||
|
||||
/** The id for the the documents expando */
|
||||
var expanID = 0;
|
||||
|
||||
/** Cached data for each document */
|
||||
var expandoData = {};
|
||||
|
||||
/** Detect whether the browser supports unknown elements */
|
||||
var supportsUnknownElements;
|
||||
|
||||
(function() {
|
||||
try {
|
||||
var a = document.createElement('a');
|
||||
a.innerHTML = '<xyz></xyz>';
|
||||
//if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles
|
||||
supportsHtml5Styles = ('hidden' in a);
|
||||
|
||||
supportsUnknownElements = a.childNodes.length == 1 || (function() {
|
||||
// assign a false positive if unable to shiv
|
||||
(document.createElement)('a');
|
||||
var frag = document.createDocumentFragment();
|
||||
return (
|
||||
typeof frag.cloneNode == 'undefined' ||
|
||||
typeof frag.createDocumentFragment == 'undefined' ||
|
||||
typeof frag.createElement == 'undefined'
|
||||
);
|
||||
}());
|
||||
} catch(e) {
|
||||
// assign a false positive if detection fails => unable to shiv
|
||||
supportsHtml5Styles = true;
|
||||
supportsUnknownElements = true;
|
||||
}
|
||||
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Creates a style sheet with the given CSS text and adds it to the document.
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @param {String} cssText The CSS text.
|
||||
* @returns {StyleSheet} The style element.
|
||||
*/
|
||||
function addStyleSheet(ownerDocument, cssText) {
|
||||
var p = ownerDocument.createElement('p'),
|
||||
parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
|
||||
|
||||
p.innerHTML = 'x<style>' + cssText + '</style>';
|
||||
return parent.insertBefore(p.lastChild, parent.firstChild);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of `html5.elements` as an array.
|
||||
* @private
|
||||
* @returns {Array} An array of shived element node names.
|
||||
*/
|
||||
function getElements() {
|
||||
var elements = html5.elements;
|
||||
return typeof elements == 'string' ? elements.split(' ') : elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extends the built-in list of html5 elements
|
||||
* @memberOf html5
|
||||
* @param {String|Array} newElements whitespace separated list or array of new element names to shiv
|
||||
* @param {Document} ownerDocument The context document.
|
||||
*/
|
||||
function addElements(newElements, ownerDocument) {
|
||||
var elements = html5.elements;
|
||||
if(typeof elements != 'string'){
|
||||
elements = elements.join(' ');
|
||||
}
|
||||
if(typeof newElements != 'string'){
|
||||
newElements = newElements.join(' ');
|
||||
}
|
||||
html5.elements = elements +' '+ newElements;
|
||||
shivDocument(ownerDocument);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data associated to the given document
|
||||
* @private
|
||||
* @param {Document} ownerDocument The document.
|
||||
* @returns {Object} An object of data.
|
||||
*/
|
||||
function getExpandoData(ownerDocument) {
|
||||
var data = expandoData[ownerDocument[expando]];
|
||||
if (!data) {
|
||||
data = {};
|
||||
expanID++;
|
||||
ownerDocument[expando] = expanID;
|
||||
expandoData[expanID] = data;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a shived element for the given nodeName and document
|
||||
* @memberOf html5
|
||||
* @param {String} nodeName name of the element
|
||||
* @param {Document} ownerDocument The context document.
|
||||
* @returns {Object} The shived element.
|
||||
*/
|
||||
function createElement(nodeName, ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createElement(nodeName);
|
||||
}
|
||||
if (!data) {
|
||||
data = getExpandoData(ownerDocument);
|
||||
}
|
||||
var node;
|
||||
|
||||
if (data.cache[nodeName]) {
|
||||
node = data.cache[nodeName].cloneNode();
|
||||
} else if (saveClones.test(nodeName)) {
|
||||
node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
|
||||
} else {
|
||||
node = data.createElem(nodeName);
|
||||
}
|
||||
|
||||
// Avoid adding some elements to fragments in IE < 9 because
|
||||
// * Attributes like `name` or `type` cannot be set/changed once an element
|
||||
// is inserted into a document/fragment
|
||||
// * Link elements with `src` attributes that are inaccessible, as with
|
||||
// a 403 response, will cause the tab/window to crash
|
||||
// * Script elements appended to fragments will execute when their `src`
|
||||
// or `text` property is set
|
||||
return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a shived DocumentFragment for the given document
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The context document.
|
||||
* @returns {Object} The shived DocumentFragment.
|
||||
*/
|
||||
function createDocumentFragment(ownerDocument, data){
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
if(supportsUnknownElements){
|
||||
return ownerDocument.createDocumentFragment();
|
||||
}
|
||||
data = data || getExpandoData(ownerDocument);
|
||||
var clone = data.frag.cloneNode(),
|
||||
i = 0,
|
||||
elems = getElements(),
|
||||
l = elems.length;
|
||||
for(;i<l;i++){
|
||||
clone.createElement(elems[i]);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shivs the `createElement` and `createDocumentFragment` methods of the document.
|
||||
* @private
|
||||
* @param {Document|DocumentFragment} ownerDocument The document.
|
||||
* @param {Object} data of the document.
|
||||
*/
|
||||
function shivMethods(ownerDocument, data) {
|
||||
if (!data.cache) {
|
||||
data.cache = {};
|
||||
data.createElem = ownerDocument.createElement;
|
||||
data.createFrag = ownerDocument.createDocumentFragment;
|
||||
data.frag = data.createFrag();
|
||||
}
|
||||
|
||||
|
||||
ownerDocument.createElement = function(nodeName) {
|
||||
//abort shiv
|
||||
if (!html5.shivMethods) {
|
||||
return data.createElem(nodeName);
|
||||
}
|
||||
return createElement(nodeName, ownerDocument, data);
|
||||
};
|
||||
|
||||
ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
|
||||
'var n=f.cloneNode(),c=n.createElement;' +
|
||||
'h.shivMethods&&(' +
|
||||
// unroll the `createElement` calls
|
||||
getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
|
||||
data.createElem(nodeName);
|
||||
data.frag.createElement(nodeName);
|
||||
return 'c("' + nodeName + '")';
|
||||
}) +
|
||||
');return n}'
|
||||
)(html5, data.frag);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* Shivs the given document.
|
||||
* @memberOf html5
|
||||
* @param {Document} ownerDocument The document to shiv.
|
||||
* @returns {Document} The shived document.
|
||||
*/
|
||||
function shivDocument(ownerDocument) {
|
||||
if (!ownerDocument) {
|
||||
ownerDocument = document;
|
||||
}
|
||||
var data = getExpandoData(ownerDocument);
|
||||
|
||||
if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
|
||||
data.hasCSS = !!addStyleSheet(ownerDocument,
|
||||
// corrects block display not defined in IE6/7/8/9
|
||||
'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
|
||||
// adds styling not present in IE6/7/8/9
|
||||
'mark{background:#FF0;color:#000}' +
|
||||
// hides non-rendered elements
|
||||
'template{display:none}'
|
||||
);
|
||||
}
|
||||
if (!supportsUnknownElements) {
|
||||
shivMethods(ownerDocument, data);
|
||||
}
|
||||
return ownerDocument;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* The `html5` object is exposed so that more elements can be shived and
|
||||
* existing shiving can be detected on iframes.
|
||||
* @type Object
|
||||
* @example
|
||||
*
|
||||
* // options can be changed before the script is included
|
||||
* html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };
|
||||
*/
|
||||
var html5 = {
|
||||
|
||||
/**
|
||||
* An array or space separated string of node names of the elements to shiv.
|
||||
* @memberOf html5
|
||||
* @type Array|String
|
||||
*/
|
||||
'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video',
|
||||
|
||||
/**
|
||||
* current version of html5shiv
|
||||
*/
|
||||
'version': version,
|
||||
|
||||
/**
|
||||
* A flag to indicate that the HTML5 style sheet should be inserted.
|
||||
* @memberOf html5
|
||||
* @type Boolean
|
||||
*/
|
||||
'shivCSS': (options.shivCSS !== false),
|
||||
|
||||
/**
|
||||
* Is equal to true if a browser supports creating unknown/HTML5 elements
|
||||
* @memberOf html5
|
||||
* @type boolean
|
||||
*/
|
||||
'supportsUnknownElements': supportsUnknownElements,
|
||||
|
||||
/**
|
||||
* A flag to indicate that the document's `createElement` and `createDocumentFragment`
|
||||
* methods should be overwritten.
|
||||
* @memberOf html5
|
||||
* @type Boolean
|
||||
*/
|
||||
'shivMethods': (options.shivMethods !== false),
|
||||
|
||||
/**
|
||||
* A string to describe the type of `html5` object ("default" or "default print").
|
||||
* @memberOf html5
|
||||
* @type String
|
||||
*/
|
||||
'type': 'default',
|
||||
|
||||
// shivs the document according to the specified `html5` object options
|
||||
'shivDocument': shivDocument,
|
||||
|
||||
//creates a shived element
|
||||
createElement: createElement,
|
||||
|
||||
//creates a shived documentFragment
|
||||
createDocumentFragment: createDocumentFragment,
|
||||
|
||||
//extends list of elements
|
||||
addElements: addElements
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
// expose html5
|
||||
window.html5 = html5;
|
||||
|
||||
// shiv the document
|
||||
shivDocument(document);
|
||||
|
||||
}(this, document));
|
4
EDA Viewer/wwwroot/js/html5shiv/3.7.2/html5shiv.min.js
vendored
Normal file
4
EDA Viewer/wwwroot/js/html5shiv/3.7.2/html5shiv.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @preserve HTML5 Shiv 3.7.2 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.2",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b)}(this,document);
|
@ -0,0 +1,76 @@
|
||||
/*! matchMedia() polyfill addListener/removeListener extension. Author & copyright (c) 2012: Scott Jehl. Dual MIT/BSD license */
|
||||
(function (w) {
|
||||
"use strict";
|
||||
// Bail out for browsers that have addListener support
|
||||
if (w.matchMedia && w.matchMedia('all').addListener) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var localMatchMedia = w.matchMedia,
|
||||
hasMediaQueries = localMatchMedia('only all').matches,
|
||||
isListening = false,
|
||||
timeoutID = 0, // setTimeout for debouncing 'handleChange'
|
||||
queries = [], // Contains each 'mql' and associated 'listeners' if 'addListener' is used
|
||||
handleChange = function (evt) {
|
||||
// Debounce
|
||||
w.clearTimeout(timeoutID);
|
||||
|
||||
timeoutID = w.setTimeout(function () {
|
||||
for (var i = 0, il = queries.length; i < il; i++) {
|
||||
var mql = queries[i].mql,
|
||||
listeners = queries[i].listeners || [],
|
||||
matches = localMatchMedia(mql.media).matches;
|
||||
|
||||
// Update mql.matches value and call listeners
|
||||
// Fire listeners only if transitioning to or from matched state
|
||||
if (matches !== mql.matches) {
|
||||
mql.matches = matches;
|
||||
|
||||
for (var j = 0, jl = listeners.length; j < jl; j++) {
|
||||
listeners[j].call(w, mql);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 30);
|
||||
};
|
||||
|
||||
w.matchMedia = function (media) {
|
||||
var mql = localMatchMedia(media),
|
||||
listeners = [],
|
||||
index = 0;
|
||||
|
||||
mql.addListener = function (listener) {
|
||||
// Changes would not occur to css media type so return now (Affects IE <= 8)
|
||||
if (!hasMediaQueries) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up 'resize' listener for browsers that support CSS3 media queries (Not for IE <= 8)
|
||||
// There should only ever be 1 resize listener running for performance
|
||||
if (!isListening) {
|
||||
isListening = true;
|
||||
w.addEventListener('resize', handleChange, true);
|
||||
}
|
||||
|
||||
// Push object only if it has not been pushed already
|
||||
if (index === 0) {
|
||||
index = queries.push({
|
||||
mql: mql,
|
||||
listeners: listeners
|
||||
});
|
||||
}
|
||||
|
||||
listeners.push(listener);
|
||||
};
|
||||
|
||||
mql.removeListener = function (listener) {
|
||||
for (var i = 0, il = listeners.length; i < il; i++) {
|
||||
if (listeners[i] === listener) {
|
||||
listeners.splice(i, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return mql;
|
||||
};
|
||||
}(this));
|
4
EDA Viewer/wwwroot/js/respond/1.4.2/matchmedia.addListener.min.js
vendored
Normal file
4
EDA Viewer/wwwroot/js/respond/1.4.2/matchmedia.addListener.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
(function(n){"use strict";if(n.matchMedia&&n.matchMedia("all").addListener)return!1;var i=n.matchMedia,f=i("only all").matches,r=!1,u=0,t=[],e=function(){n.clearTimeout(u);u=n.setTimeout(function(){for(var f,h,r=0,e=t.length;r<e;r++){var u=t[r].mql,o=t[r].listeners||[],s=i(u.media).matches;if(s!==u.matches)for(u.matches=s,f=0,h=o.length;f<h;f++)o[f].call(n,u)}},30)};n.matchMedia=function(u){var s=i(u),o=[],h=0;return s.addListener=function(i){f&&(r||(r=!0,n.addEventListener("resize",e,!0)),h===0&&(h=t.push({mql:s,listeners:o})),o.push(i))},s.removeListener=function(n){for(var t=0,i=o.length;t<i;t++)o[t]===n&&o.splice(t,1)},s}})(this);
|
||||
/*
|
||||
//# sourceMappingURL=matchmedia.addListener.min.js.map
|
||||
*/
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"matchmedia.addListener.min.js",
|
||||
"lineCount":1,
|
||||
"mappings":"CACC,QAAS,CAACA,CAAD,CAAI,CACV,Y,CAEA,GAAIA,CAACC,WAAY,EAAGD,CAACC,WAAW,CAAC,KAAD,CAAOC,aACnC,MAAO,CAAA,CACX,CAEA,IAAIC,EAAkBH,CAACC,YACzBG,EAAkBD,CAAe,CAAC,UAAD,CAAYE,SAC7CC,EAAc,CAAA,EACdC,EAAY,EACZC,EAAU,CAAA,EACVC,EAAe,QAAS,CAAA,CAAM,CAE1BT,CAACU,aAAa,CAACH,CAAD,CAAW,CAEzBA,CAAU,CAAEP,CAACW,WAAW,CAAC,QAAS,CAAA,CAAG,CACjC,IAAK,IAUYC,EAAOC,EAVfC,EAAI,EAAGC,EAAKP,CAAOQ,OAAO,CAAEF,CAAE,CAAEC,CAAE,CAAED,CAAC,EAA9C,CAAkD,CAC9C,IAAIG,EAAMT,CAAQ,CAAAM,CAAA,CAAEG,KAC5BC,EAAYV,CAAQ,CAAAM,CAAA,CAAEI,UAAW,EAAG,CAAA,EACpCb,EAAUF,CAAe,CAACc,CAAGE,MAAJ,CAAWd,QAAQ,CAIpC,GAAIA,CAAQ,GAAIY,CAAGZ,SAGf,IAFAY,CAAGZ,QAAS,CAAEA,CAAO,CAEZO,CAAE,CAAE,C,CAAGC,CAAG,CAAEK,CAASF,OAAO,CAAEJ,CAAE,CAAEC,CAAE,CAAED,CAAC,EAAhD,CACIM,CAAU,CAAAN,CAAA,CAAEQ,KAAK,CAACpB,CAAC,CAAEiB,CAAJ,CAXqB,CADjB,CAgBpC,CAAE,EAhBqB,CAJE,CAqB7B,CAECjB,CAACC,WAAY,CAAEoB,QAAS,CAACF,CAAD,CAAQ,CAC5B,IAAIF,EAAMd,CAAe,CAACgB,CAAD,EAC9BD,EAAY,CAAA,EACZI,EAAQ,CAAC,CAkCJ,OAhCAL,CAAGf,YAAa,CAAEqB,QAAS,CAACC,CAAD,CAAW,CAE7BpB,C,GAMAE,C,GACDA,CAAY,CAAE,CAAA,CAAI,CAClBN,CAACyB,iBAAiB,CAAC,QAAQ,CAAEhB,CAAY,CAAE,CAAA,CAAzB,EAA8B,CAIhDa,CAAM,GAAI,C,GACVA,CAAM,CAAEd,CAAOkB,KAAK,CAAC,CACjB,GAAG,CAAET,CAAG,CACR,SAAS,CAAEC,CAFM,CAAD,EAGlB,CAGNA,CAASQ,KAAK,CAACF,CAAD,EArBoB,CAsBrC,CAEDP,CAAGU,eAAgB,CAAEC,QAAS,CAACJ,CAAD,CAAW,CACrC,IAAK,IAAIV,EAAI,EAAGC,EAAKG,CAASF,OAAO,CAAEF,CAAE,CAAEC,CAAE,CAAED,CAAC,EAAhD,CACQI,CAAU,CAAAJ,CAAA,CAAG,GAAIU,C,EACjBN,CAASW,OAAO,CAACf,CAAC,CAAE,CAAJ,CAHa,CAMxC,CAEMG,CArCqB,CAnCtB,EA0Eb,CAAC,IAAD,C",
|
||||
"sources":["matchmedia.addListener.js"],
|
||||
"names":["w","matchMedia","addListener","localMatchMedia","hasMediaQueries","matches","isListening","timeoutID","queries","handleChange","clearTimeout","setTimeout","j","jl","i","il","length","mql","listeners","media","call","w.matchMedia","index","mql.addListener","listener","addEventListener","push","removeListener","mql.removeListener","splice"]
|
||||
}
|
36
EDA Viewer/wwwroot/js/respond/1.4.2/matchmedia.polyfill.js
Normal file
36
EDA Viewer/wwwroot/js/respond/1.4.2/matchmedia.polyfill.js
Normal file
@ -0,0 +1,36 @@
|
||||
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
|
||||
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
|
||||
|
||||
(function (w) {
|
||||
"use strict";
|
||||
w.matchMedia = w.matchMedia || (function (doc, undefined) {
|
||||
|
||||
var bool,
|
||||
docElem = doc.documentElement,
|
||||
refNode = docElem.firstElementChild || docElem.firstChild,
|
||||
// fakeBody required for <FF4 when executed in <head>
|
||||
fakeBody = doc.createElement("body"),
|
||||
div = doc.createElement("div");
|
||||
|
||||
div.id = "mq-test-1";
|
||||
div.style.cssText = "position:absolute;top:-100em";
|
||||
fakeBody.style.background = "none";
|
||||
fakeBody.appendChild(div);
|
||||
|
||||
return function (q) {
|
||||
|
||||
div.innerHTML = "­<style media=\"" + q + "\"> #mq-test-1 { width: 42px; }</style>";
|
||||
|
||||
docElem.insertBefore(fakeBody, refNode);
|
||||
bool = div.offsetWidth === 42;
|
||||
docElem.removeChild(fakeBody);
|
||||
|
||||
return {
|
||||
matches: bool,
|
||||
media: q
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}(w.document));
|
||||
}(this));
|
4
EDA Viewer/wwwroot/js/respond/1.4.2/matchmedia.polyfill.min.js
vendored
Normal file
4
EDA Viewer/wwwroot/js/respond/1.4.2/matchmedia.polyfill.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
(function(n){"use strict";n.matchMedia=n.matchMedia||function(n){var u,i=n.documentElement,f=i.firstElementChild||i.firstChild,r=n.createElement("body"),t=n.createElement("div");return t.id="mq-test-1",t.style.cssText="position:absolute;top:-100em",r.style.background="none",r.appendChild(t),function(n){return t.innerHTML='­<style media="'+n+'"> #mq-test-1 { width: 42px; }<\/style>',i.insertBefore(r,f),u=t.offsetWidth===42,i.removeChild(r),{matches:u,media:n}}}(n.document)})(this);
|
||||
/*
|
||||
//# sourceMappingURL=matchmedia.polyfill.min.js.map
|
||||
*/
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"matchmedia.polyfill.min.js",
|
||||
"lineCount":1,
|
||||
"mappings":"CAGC,QAAS,CAACA,CAAD,CAAI,CACV,Y,CACAA,CAACC,WAAY,CAAED,CAACC,WAAY,EAAI,QAAS,CAACC,CAAD,CAAiB,CAEtD,IAAIC,EACTC,EAAUF,CAAGG,iBACbC,EAAUF,CAAOG,kBAAmB,EAAGH,CAAOI,YAE9CC,EAAWP,CAAGQ,cAAc,CAAC,MAAD,EAC5BC,EAAMT,CAAGQ,cAAc,CAAC,KAAD,CAAO,CAOzB,OALAC,CAAGC,GAAI,CAAE,WAAW,CACpBD,CAAGE,MAAMC,QAAS,CAAE,8BAA8B,CAClDL,CAAQI,MAAME,WAAY,CAAE,MAAM,CAClCN,CAAQO,YAAY,CAACL,CAAD,CAAK,CAElB,QAAS,CAACM,CAAD,CAAI,CAQhB,OANAN,CAAGO,UAAW,CAAE,qBAAuB,CAAED,CAAE,CAAE,yCAAyC,CAEtFb,CAAOe,aAAa,CAACV,CAAQ,CAAEH,CAAX,CAAmB,CACvCH,CAAK,CAAEQ,CAAGS,YAAa,GAAI,EAAE,CAC7BhB,CAAOiB,YAAY,CAACZ,CAAD,CAAU,CAEtB,CACH,OAAO,CAAEN,CAAI,CACb,KAAK,CAAEc,CAFJ,CARS,CAdkC,CA6BzD,CAACjB,CAACsB,SAAF,CA/BS,EAgCb,CAAC,IAAD,C",
|
||||
"sources":["matchmedia.polyfill.js"],
|
||||
"names":["w","matchMedia","doc","bool","docElem","documentElement","refNode","firstElementChild","firstChild","fakeBody","createElement","div","id","style","cssText","background","appendChild","q","innerHTML","insertBefore","offsetWidth","removeChild","document"]
|
||||
}
|
341
EDA Viewer/wwwroot/js/respond/1.4.2/respond.js
Normal file
341
EDA Viewer/wwwroot/js/respond/1.4.2/respond.js
Normal file
@ -0,0 +1,341 @@
|
||||
/*! Respond.js v1.4.0: min/max-width media query polyfill. (c) Scott Jehl. MIT Lic. j.mp/respondjs */
|
||||
(function (w) {
|
||||
|
||||
"use strict";
|
||||
|
||||
//exposed namespace
|
||||
var respond = {};
|
||||
w.respond = respond;
|
||||
|
||||
//define update even in native-mq-supporting browsers, to avoid errors
|
||||
respond.update = function () { };
|
||||
|
||||
//define ajax obj
|
||||
var requestQueue = [],
|
||||
xmlHttp = (function () {
|
||||
var xmlhttpmethod = false;
|
||||
try {
|
||||
xmlhttpmethod = new w.XMLHttpRequest();
|
||||
}
|
||||
catch (e) {
|
||||
xmlhttpmethod = new w.ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return function () {
|
||||
return xmlhttpmethod;
|
||||
};
|
||||
})(),
|
||||
|
||||
//tweaked Ajax functions from Quirksmode
|
||||
ajax = function (url, callback) {
|
||||
var req = xmlHttp();
|
||||
if (!req) {
|
||||
return;
|
||||
}
|
||||
req.open("GET", url, true);
|
||||
req.onreadystatechange = function () {
|
||||
if (req.readyState !== 4 || req.status !== 200 && req.status !== 304) {
|
||||
return;
|
||||
}
|
||||
callback(req.responseText);
|
||||
};
|
||||
if (req.readyState === 4) {
|
||||
return;
|
||||
}
|
||||
req.send(null);
|
||||
};
|
||||
|
||||
//expose for testing
|
||||
respond.ajax = ajax;
|
||||
respond.queue = requestQueue;
|
||||
|
||||
// expose for testing
|
||||
respond.regex = {
|
||||
media: /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi,
|
||||
keyframes: /@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,
|
||||
urls: /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,
|
||||
findStyles: /@media *([^\{]+)\{([\S\s]+?)$/,
|
||||
only: /(only\s+)?([a-zA-Z]+)\s?/,
|
||||
minw: /\([\s]*min\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/,
|
||||
maxw: /\([\s]*max\-width\s*:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/
|
||||
};
|
||||
|
||||
//expose media query support flag for external use
|
||||
respond.mediaQueriesSupported = w.matchMedia && w.matchMedia("only all") !== null && w.matchMedia("only all").matches;
|
||||
|
||||
//if media queries are supported, exit here
|
||||
if (respond.mediaQueriesSupported) {
|
||||
return;
|
||||
}
|
||||
|
||||
//define vars
|
||||
var doc = w.document,
|
||||
docElem = doc.documentElement,
|
||||
mediastyles = [],
|
||||
rules = [],
|
||||
appendedEls = [],
|
||||
parsedSheets = {},
|
||||
resizeThrottle = 30,
|
||||
head = doc.getElementsByTagName("head")[0] || docElem,
|
||||
base = doc.getElementsByTagName("base")[0],
|
||||
links = head.getElementsByTagName("link"),
|
||||
|
||||
lastCall,
|
||||
resizeDefer,
|
||||
|
||||
//cached container for 1em value, populated the first time it's needed
|
||||
eminpx,
|
||||
|
||||
// returns the value of 1em in pixels
|
||||
getEmValue = function () {
|
||||
var ret,
|
||||
div = doc.createElement('div'),
|
||||
body = doc.body,
|
||||
originalHTMLFontSize = docElem.style.fontSize,
|
||||
originalBodyFontSize = body && body.style.fontSize,
|
||||
fakeUsed = false;
|
||||
|
||||
div.style.cssText = "position:absolute;font-size:1em;width:1em";
|
||||
|
||||
if (!body) {
|
||||
body = fakeUsed = doc.createElement("body");
|
||||
body.style.background = "none";
|
||||
}
|
||||
|
||||
// 1em in a media query is the value of the default font size of the browser
|
||||
// reset docElem and body to ensure the correct value is returned
|
||||
docElem.style.fontSize = "100%";
|
||||
body.style.fontSize = "100%";
|
||||
|
||||
body.appendChild(div);
|
||||
|
||||
if (fakeUsed) {
|
||||
docElem.insertBefore(body, docElem.firstChild);
|
||||
}
|
||||
|
||||
ret = div.offsetWidth;
|
||||
|
||||
if (fakeUsed) {
|
||||
docElem.removeChild(body);
|
||||
}
|
||||
else {
|
||||
body.removeChild(div);
|
||||
}
|
||||
|
||||
// restore the original values
|
||||
docElem.style.fontSize = originalHTMLFontSize;
|
||||
if (originalBodyFontSize) {
|
||||
body.style.fontSize = originalBodyFontSize;
|
||||
}
|
||||
|
||||
|
||||
//also update eminpx before returning
|
||||
ret = eminpx = parseFloat(ret);
|
||||
|
||||
return ret;
|
||||
},
|
||||
|
||||
//enable/disable styles
|
||||
applyMedia = function (fromResize) {
|
||||
var name = "clientWidth",
|
||||
docElemProp = docElem[name],
|
||||
currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[name] || docElemProp,
|
||||
styleBlocks = {},
|
||||
lastLink = links[links.length - 1],
|
||||
now = (new Date()).getTime();
|
||||
|
||||
//throttle resize calls
|
||||
if (fromResize && lastCall && now - lastCall < resizeThrottle) {
|
||||
w.clearTimeout(resizeDefer);
|
||||
resizeDefer = w.setTimeout(applyMedia, resizeThrottle);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
lastCall = now;
|
||||
}
|
||||
|
||||
for (var i in mediastyles) {
|
||||
if (mediastyles.hasOwnProperty(i)) {
|
||||
var thisstyle = mediastyles[i],
|
||||
min = thisstyle.minw,
|
||||
max = thisstyle.maxw,
|
||||
minnull = min === null,
|
||||
maxnull = max === null,
|
||||
em = "em";
|
||||
|
||||
if (!!min) {
|
||||
min = parseFloat(min) * (min.indexOf(em) > -1 ? (eminpx || getEmValue()) : 1);
|
||||
}
|
||||
if (!!max) {
|
||||
max = parseFloat(max) * (max.indexOf(em) > -1 ? (eminpx || getEmValue()) : 1);
|
||||
}
|
||||
|
||||
// if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true
|
||||
if (!thisstyle.hasquery || (!minnull || !maxnull) && (minnull || currWidth >= min) && (maxnull || currWidth <= max)) {
|
||||
if (!styleBlocks[thisstyle.media]) {
|
||||
styleBlocks[thisstyle.media] = [];
|
||||
}
|
||||
styleBlocks[thisstyle.media].push(rules[thisstyle.rules]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//remove any existing respond style element(s)
|
||||
for (var j in appendedEls) {
|
||||
if (appendedEls.hasOwnProperty(j)) {
|
||||
if (appendedEls[j] && appendedEls[j].parentNode === head) {
|
||||
head.removeChild(appendedEls[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
appendedEls.length = 0;
|
||||
|
||||
//inject active styles, grouped by media type
|
||||
for (var k in styleBlocks) {
|
||||
if (styleBlocks.hasOwnProperty(k)) {
|
||||
var ss = doc.createElement("style"),
|
||||
css = styleBlocks[k].join("\n");
|
||||
|
||||
ss.type = "text/css";
|
||||
ss.media = k;
|
||||
|
||||
//originally, ss was appended to a documentFragment and sheets were appended in bulk.
|
||||
//this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one!
|
||||
head.insertBefore(ss, lastLink.nextSibling);
|
||||
|
||||
if (ss.styleSheet) {
|
||||
ss.styleSheet.cssText = css;
|
||||
}
|
||||
else {
|
||||
ss.appendChild(doc.createTextNode(css));
|
||||
}
|
||||
|
||||
//push to appendedEls to track for later removal
|
||||
appendedEls.push(ss);
|
||||
}
|
||||
}
|
||||
},
|
||||
//find media blocks in css text, convert to style blocks
|
||||
translate = function (styles, href, media) {
|
||||
var qs = styles.replace(respond.regex.keyframes, '').match(respond.regex.media),
|
||||
ql = qs && qs.length || 0;
|
||||
|
||||
//try to get CSS path
|
||||
href = href.substring(0, href.lastIndexOf("/"));
|
||||
|
||||
var repUrls = function (css) {
|
||||
return css.replace(respond.regex.urls, "$1" + href + "$2$3");
|
||||
},
|
||||
useMedia = !ql && media;
|
||||
|
||||
//if path exists, tack on trailing slash
|
||||
if (href.length) { href += "/"; }
|
||||
|
||||
//if no internal queries exist, but media attr does, use that
|
||||
//note: this currently lacks support for situations where a media attr is specified on a link AND
|
||||
//its associated stylesheet has internal CSS media queries.
|
||||
//In those cases, the media attribute will currently be ignored.
|
||||
if (useMedia) {
|
||||
ql = 1;
|
||||
}
|
||||
|
||||
for (var i = 0; i < ql; i++) {
|
||||
var fullq, thisq, eachq, eql;
|
||||
|
||||
//media attr
|
||||
if (useMedia) {
|
||||
fullq = media;
|
||||
rules.push(repUrls(styles));
|
||||
}
|
||||
//parse for styles
|
||||
else {
|
||||
fullq = qs[i].match(respond.regex.findStyles) && RegExp.$1;
|
||||
rules.push(RegExp.$2 && repUrls(RegExp.$2));
|
||||
}
|
||||
|
||||
eachq = fullq.split(",");
|
||||
eql = eachq.length;
|
||||
|
||||
for (var j = 0; j < eql; j++) {
|
||||
thisq = eachq[j];
|
||||
mediastyles.push({
|
||||
media: thisq.split("(")[0].match(respond.regex.only) && RegExp.$2 || "all",
|
||||
rules: rules.length - 1,
|
||||
hasquery: thisq.indexOf("(") > -1,
|
||||
minw: thisq.match(respond.regex.minw) && parseFloat(RegExp.$1) + (RegExp.$2 || ""),
|
||||
maxw: thisq.match(respond.regex.maxw) && parseFloat(RegExp.$1) + (RegExp.$2 || "")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
applyMedia();
|
||||
},
|
||||
|
||||
//recurse through request queue, get css text
|
||||
makeRequests = function () {
|
||||
if (requestQueue.length) {
|
||||
var thisRequest = requestQueue.shift();
|
||||
|
||||
ajax(thisRequest.href, function (styles) {
|
||||
translate(styles, thisRequest.href, thisRequest.media);
|
||||
parsedSheets[thisRequest.href] = true;
|
||||
|
||||
// by wrapping recursive function call in setTimeout
|
||||
// we prevent "Stack overflow" error in IE7
|
||||
w.setTimeout(function () { makeRequests(); }, 0);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
//loop stylesheets, send text content to translate
|
||||
ripCSS = function () {
|
||||
|
||||
for (var i = 0; i < links.length; i++) {
|
||||
var sheet = links[i],
|
||||
href = sheet.href,
|
||||
media = sheet.media,
|
||||
isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
|
||||
|
||||
//only links plz and prevent re-parsing
|
||||
if (!!href && isCSS && !parsedSheets[href]) {
|
||||
// selectivizr exposes css through the rawCssText expando
|
||||
if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
|
||||
translate(sheet.styleSheet.rawCssText, href, media);
|
||||
parsedSheets[href] = true;
|
||||
} else {
|
||||
if ((!/^([a-zA-Z:]*\/\/)/.test(href) && !base) ||
|
||||
href.replace(RegExp.$1, "").split("/")[0] === w.location.host) {
|
||||
// IE7 doesn't handle urls that start with '//' for ajax request
|
||||
// manually add in the protocol
|
||||
if (href.substring(0, 2) === "//") { href = w.location.protocol + href; }
|
||||
requestQueue.push({
|
||||
href: href,
|
||||
media: media
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
makeRequests();
|
||||
};
|
||||
|
||||
//translate CSS
|
||||
ripCSS();
|
||||
|
||||
//expose update for re-running respond later on
|
||||
respond.update = ripCSS;
|
||||
|
||||
//expose getEmValue
|
||||
respond.getEmValue = getEmValue;
|
||||
|
||||
//adjust on resize
|
||||
function callMedia() {
|
||||
applyMedia(true);
|
||||
}
|
||||
|
||||
if (w.addEventListener) {
|
||||
w.addEventListener("resize", callMedia, false);
|
||||
}
|
||||
else if (w.attachEvent) {
|
||||
w.attachEvent("onresize", callMedia);
|
||||
}
|
||||
})(this);
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user