コード例 #1
0
ファイル: ChainLoader.cs プロジェクト: nunb/code
        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));
            }
        }
コード例 #2
0
ファイル: ChainLoader.cs プロジェクト: nunb/code
        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);
        }
コード例 #3
0
ファイル: ChainLoader.cs プロジェクト: nunb/interpretation
		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;
		}
コード例 #4
0
ファイル: ChainLoader.cs プロジェクト: nunb/interpretation
 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));
     }
 }