| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 | 
							- namespace WCS.Core;
 
- public class DevicePath
 
- {
 
-     private List<string> points = new();
 
-     public string From { get; set; } = "";
 
-     public string To { get; set; } = "";
 
-     public List<Device> Points
 
-     {
 
-         get
 
-         {
 
-             var list = points.Select(v => Device.Find(v)).ToList();
 
-             return list;
 
-         }
 
-     }
 
-     public static DevicePath[] GetPaths(string from, string to)
 
-     {
 
-         var all = Device.All.ToDictionary(v => v.Code, v => v.Targets.Select(d => d.Code).ToList());
 
-         var pathList = new List<List<string>>();
 
-         recursion(from, to, all, pathList, new List<string>());
 
-         pathList.ForEach(path => path.Remove(from));
 
-         var arr = pathList.Select(v => new DevicePath { From = from, To = to, points = v }).ToArray();
 
-         return arr;
 
-     }
 
-     public static DevicePath? GetPath(string from, string to)
 
-     {
 
-         return GetPaths(from, to).OrderBy(v => v.Points.Count).FirstOrDefault();
 
-     }
 
-     private static void recursion(string from, string to, Dictionary<string, List<string>> all,
 
-         List<List<string>> pathList, List<string> points)
 
-     {
 
-         if (points.Count > 100)
 
-             return;
 
-         points.Add(from);
 
-         if (from.Contains(to))
 
-         {
 
-             pathList.Add(points);
 
-             return;
 
-         }
 
-         if (!all.ContainsKey(from)) return;
 
-         foreach (var code in all[from])
 
-         {
 
-             if (points.Contains(code))
 
-                 continue;
 
-             recursion(code, to, all, pathList, new List<string>(points));
 
-         }
 
-     }
 
- }
 
 
  |