eda-viewer/EDA Viewer/Models/EdaHtmlDiff.cs

52 lines
1.5 KiB
C#

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;
}
}
}