private ImageLoader() { chainLoader = new Texture2DLoader(); chainLoader.AddChild(new MemoryCacheLoader()) .AddChild(new CacheFileLoader()) .AddChild(new FileChainLoader(new FileLoader())); }
public void SetLayerChainItems(PrefabInterpretationLogic logic) { if (logic is LayerInterpretationLogic) { LayerInterpretationLogic layerLog = logic as LayerInterpretationLogic; List <string> layernames = new List <string>(); List <Dictionary <string, object> > parameters = new List <Dictionary <string, object> >(); ChainLoader.GetLayerNamesAndParameters(layerLog.LayerDirectory, layernames, parameters); LayerChainItems = new ObservableCollection <LayerChainItem>(); if (layerLog.Layers != null) { for (int i = 0; i < layernames.Count; i++) { LayerChainItem item = new LayerChainItem(); item.Name = System.IO.Path.GetFileNameWithoutExtension(layernames[i]); item.FullPath = layernames[i]; foreach (string key in parameters[i].Keys) { string val = parameters[i][key] as string; if (val != null) { item.ParameterKeys.Add(key); item.ParameterValues.Add(val); } } LayerChainItems.Add(item); } } //List<string> dirs = new List<string>(); //dirs.Add(layerLog.LayerDirectory); //var alllayers = ChainLoader.GetAllLayerNames(dirs); //AllLayers = new ObservableCollection<LayerChainItem>(); //foreach (string layer in alllayers) //{ // LayerChainItem item = new LayerChainItem(); // item.Name = System.IO.Path.GetFileNameWithoutExtension(layer); // string path = System.IO.Path.GetDirectoryName(layer); // if (System.IO.Path.Equals(path, layerLog.LayerDirectory)) // { // item.FullPath = item.Name; // }else // item.FullPath = layer; // AllLayers.Add(item); //} } else { Visibility = System.Windows.Visibility.Collapsed; } }
public void Load() { _layers = ChainLoader.LoadChain("prefab_single", LayerDirectory); PythonScriptHost.Instance.LoadAssembly(typeof(PrefabSingleLogic).Assembly); _interpreter = LoadSingleLayer(_singleLayerName); UpdateLogic(); }
public TriggerHappyPlugin(Main game) : base(game) { this.chainLoader = new ChainLoader(this); }
public ChainLoader AddChild(ChainLoader chainLoader) { chainLoader.parentLoader = this; this.childLoader = chainLoader; return(chainLoader); }
public void SetLayerChainItems(PrefabInterpretationLogic logic) { LayerChainItems = new ObservableCollection <LayerChainItem>(); if (logic is LayerInterpretationLogic) { LayerInterpretationLogic layerLog = logic as LayerInterpretationLogic; _layerInterpretLogic = layerLog; List <string> layernames = new List <string>(); List <Dictionary <string, object> > parameters = new List <Dictionary <string, object> >(); ChainLoader.GetLayerNamesAndParameters(layerLog.LayerDirectory, layernames, parameters); for (int i = 0; i < layernames.Count; i++) { LayerChainItem item = new LayerChainItem(); item.Name = System.IO.Path.GetFileName(layernames[i]); item.RelativePath = layernames[i]; item.FullPath = System.IO.Path.GetFullPath(layerLog.LayerDirectory + "/" + layernames[i]); foreach (string key in parameters[i].Keys) { object val = parameters[i][key]; if (val != null) { item.ParameterKeys.Add(key); item.ParameterValues.Add(val); } } LayerChainItems.Add(item); } //List<string> dirs = new List<string>(); //dirs.Add(layerLog.LayerDirectory); //var alllayers = ChainLoader.GetAllLayerNames(dirs); //AllLayers = new ObservableCollection<LayerChainItem>(); //foreach (string layer in alllayers) //{ // LayerChainItem item = new LayerChainItem(); // item.Name = System.IO.Path.GetFileName(layer); // string path = System.IO.Path.GetDirectoryName(layer); // if (System.IO.Path.Equals(path, layerLog.LayerDirectory)) // { // item.RelativePath = item.Name; // }else // item.RelativePath = layer; // item.FullPath = System.IO.Path.GetFullPath(layerLog.LayerDirectory + "/" + layer); // AllLayers.Add(item); //} } else { LayerChainItem item = new LayerChainItem(); item.Name = "prefab_identification_layers"; item.RelativePath = "..\\prefab_identification_layers"; item.FullPath = System.IO.Path.GetFullPath(logic.LayerDirectory + "/" + item.RelativePath); item.DeleteButtonVisibility = System.Windows.Visibility.Collapsed; LayerChainItems.Add(item); item = new LayerChainItem(); item.Name = "interpret_tree.py"; item.RelativePath = "interpret_tree.py"; item.FullPath = System.IO.Path.GetFullPath(logic.LayerDirectory + "/" + item.RelativePath); item.DeleteButtonVisibility = System.Windows.Visibility.Collapsed; LayerChainItems.Add(item); AddLayerButton.Visibility = Visibility.Collapsed; LibrariesPanel.Visibility = Visibility.Collapsed; } }
public void Load() { _layers = ChainLoader.LoadChain("prefab_layers", LayerDirectory); }