private static void GetPythonLayers(IEnumerable <string> files, List <LayerSeed> seeds, PythonScriptHost host) { foreach (string file in files) { string name = System.IO.Path.GetFileName(file); string path = System.IO.Path.GetFullPath(file); path = System.IO.Path.GetDirectoryName(path); host.AddPath(path); PythonLayer layer = new PythonLayer(host, File.ReadAllText(file), name); seeds.Add(new LayerSeed(layer, file)); } }
private static Layer CopyLayer(Layer seed) { try { Layer copy = null; if (seed is PythonLayer) { copy = new PythonLayer(((PythonLayer)seed).Host, ((PythonLayer)seed).Code, seed.Name); } else { copy = (Layer)Activator.CreateInstance(seed.GetType()); } return(copy); } catch (Exception e) { Console.Error.WriteLine(e.StackTrace); } return(null); }
private static Layer CopyLayer( Layer seed){ try { Layer copy = null; if (seed is PythonLayer) { copy = new PythonLayer(((PythonLayer)seed).Host, ((PythonLayer)seed).Code, seed.Name); }else copy = (Layer)Activator.CreateInstance (seed.GetType()); return copy; } catch (Exception e){ Console.Error.WriteLine (e.StackTrace); } return null; }
private static void GetPythonLayers(IEnumerable<string> files, List<LayerSeed> seeds, PythonScriptHost host) { foreach (string file in files) { string name = System.IO.Path.GetFileName(file); string path = System.IO.Path.GetFullPath(file); path = System.IO.Path.GetDirectoryName(path); host.AddPath(path); PythonLayer layer = new PythonLayer(host, File.ReadAllText(file), name); seeds.Add(new LayerSeed(layer, file)); } }