示例#1
0
 private Consist(ConsistFile consist, Locomotive locomotive, string fileName)
 {
     Locomotive = locomotive;
     if (string.IsNullOrEmpty(consist.Name))
     {
         Name = $"<{catalog.GetString("unnamed:")} {System.IO.Path.GetFileNameWithoutExtension(fileName)}>";
     }
     else
     {
         Name = consist.Name?.Trim();
     }
     FilePath = fileName;
 }
示例#2
0
        internal static Consist FromFile(string fileName, Folder folder, bool reverseConsist)
        {
            Consist result;

            try
            {
                ConsistFile conFile    = new ConsistFile(fileName);
                Locomotive  locomotive = GetLocomotive(conFile, folder, reverseConsist);
                result = new Consist(conFile, locomotive, fileName);
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch
#pragma warning restore CA1031 // Do not catch general exception types
            {
                result = new Consist($"<{catalog.GetString("load error:")} {System.IO.Path.GetFileNameWithoutExtension(fileName)}>", fileName);
            }
            return(result);
        }