public override Type ResolveUri(string uri, out LibraryFailure reason) { var base_name = uri.Substring(4).Replace('/', '.'); var type_name = "Flabbergast.Library." + base_name; foreach (var dll_file in Finder.FindAll(type_name, ".dll")) { var assembly = Assembly.LoadFrom(dll_file); if (assembly == null) { reason = LibraryFailure.Corrupt; return(null); } var type = assembly.GetType(type_name, false); if (type == null) { reason = LibraryFailure.Corrupt; return(null); } reason = LibraryFailure.None; return(type); } reason = LibraryFailure.Missing; return(null); }
private void OnFigureLoaded() { _figureSet = Finder.Find <FigureSetSolver>(); _figures = Finder.FindAll <FigureSolver>(); _areFiguresLoaded = true; }
public static void EnableAllInput() { foreach (var inputDelegate in Finder.FindAll <InputDelegate>()) { inputDelegate.enabled = true; } }
public override System.Type ResolveUri(string uri, out LibraryFailure reason) { if (cache.ContainsKey(uri)) { reason = cache[uri] == null ? LibraryFailure.Missing : LibraryFailure.None; return(cache[uri]); } var base_name = uri.Substring(4); var type_name = "Flabbergast.Library." + base_name.Replace('/', '.'); foreach (var src_file in Finder.FindAll(base_name, ".no_0", ".o_0")) { var parser = Parser.Open(src_file); var type = parser.ParseFile(collector, unit, type_name); reason = type == null ? LibraryFailure.Corrupt : LibraryFailure.None; cache[uri] = type; return(type); } cache[uri] = null; reason = LibraryFailure.Missing; return(null); }
public Computation ResolveUri(TaskMaster master, string uri, out LibraryFailure reason) { if (!uri.StartsWith("res:")) { reason = LibraryFailure.Missing; return(null); } var tail = HttpUtility.UrlDecode(uri.Substring(4)).Replace('/', Path.DirectorySeparatorChar); try { foreach (var filename in Finder.FindAll(tail, "")) { reason = LibraryFailure.None; return(new Precomputation(File.ReadAllBytes(filename))); } reason = LibraryFailure.Missing; return(null); } catch (Exception e) { reason = LibraryFailure.None; return(new FailureComputation(master, new NativeSourceReference(uri), e.Message)); } }