// --------------------------- LogMessage --------------------------------- private void LogMessage(NetworkRole InRole, string InFullMsg) { if (DetailLogger != null) { DetailLogger.Add(InRole.ToString( ) + " " + InFullMsg); } }
public static T ClonePrototype <T>(T prototype) where T : class { T clone = prototype.GetType().GetConstructor(Type.EmptyTypes).Invoke(null) as T; ParameterSet parameters = new ParameterSet(new ObjectTree(prototype)); parameters.Rebind(new ObjectTree(clone)); parameters.SaveValues(); DetailLogger.CopyHooks(prototype, clone); return(clone); }
SkeletonBuilder ProcessSkeleton(string name, BinaryMap binary) { SkeletonBuilder skeleton = null; DetailLogger.RunInContext(name, delegate() { Logger.Log("Binarized", binary); BinaryMap thinned = Thinner.Thin(binary); skeleton = new SkeletonBuilder(); RidgeTracer.Trace(thinned, skeleton); DotRemover.Filter(skeleton); PoreRemover.Filter(skeleton); GapRemover.Filter(skeleton); TailRemover.Filter(skeleton); FragmentRemover.Filter(skeleton); BranchMinutiaRemover.Filter(skeleton); }); return(skeleton); }
SkeletonBuilder ProcessSkeleton(string name, BinaryMap binary) { SkeletonBuilder skeleton = null; DetailLogger.RunInContext(name, delegate() { Logger.Log("Binarized", binary); BinaryMap thinned = Thinner.Thin(binary); skeleton = new SkeletonBuilder(); RidgeTracer.Trace(thinned, skeleton); ////Testing Start //var outFileDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "outputSkeletonRidgeTracer-" + name + DateTime.UtcNow.Millisecond + ".bin"); //var file = new FileStream(outFileDir, FileMode.CreateNew); //var binWrite = new BinaryWriter(file); //binWrite.Write(skeleton.Minutiae.Count()); //Console.WriteLine(skeleton.Minutiae.Count()); //foreach (var minutia in skeleton.Minutiae) //{ // binWrite.Write(minutia.Valid); // Console.WriteLine(minutia.Valid); // binWrite.Write(minutia.Position.X); // Console.WriteLine(minutia.Position.X); // binWrite.Write(minutia.Position.Y); // Console.WriteLine(minutia.Position.Y); // binWrite.Write(minutia.Ridges.Count); // Console.WriteLine(minutia.Ridges.Count); //} //binWrite.Close(); //file.Close(); ////Testing Finish DotRemover.Filter(skeleton); PoreRemover.Filter(skeleton); GapRemover.Filter(skeleton); TailRemover.Filter(skeleton); FragmentRemover.Filter(skeleton); BranchMinutiaRemover.Filter(skeleton); }); Count++; return(skeleton); }
internal static DetailLogger Compile(string filePath, Encoding encoding, out LayeKit kit) { filePath = Path.GetFullPath(filePath); if (!File.Exists(filePath)) throw new ArgumentException("filePath"); if (compiledKits.ContainsKey(filePath)) { kit = compiledKits[filePath]; return null; } var log = new DetailLogger(); var lexer = new Lexer(log); var tokens = lexer.GetTokens(filePath, encoding); if (log.ErrorCount != 0) throw new CompilerException(log); var parser = new Parser(log); var ast = parser.GenerateAST(tokens); if (log.ErrorCount != 0) throw new CompilerException(log); var compiler = new KitCompiler(log, Path.GetFileName(filePath)); ast.Visit(compiler); if (log.ErrorCount != 0) throw new CompilerException(log); var proto = compiler.GetPrototype(); kit = new LayeKit(Directory.GetParent(filePath).FullName, proto); compiledKits[filePath] = kit; return log; }
internal FunctionCompiler(DetailLogger log, FunctionBuilder parent = null, string fileName = null) { this.log = log; builder = new FunctionBuilder(parent, fileName); }
internal CompilerException(DetailLogger log) : base(string.Format("Compilation failed with {0} errors and {1} warnings.", log.ErrorCount, log.WarningCount)) { this.log = log; }
internal Lexer(DetailLogger log) { this.log = log; }
/// <summary> /// Create a new stream of tokens. /// This instance assumes control over the given list. /// </summary> /// <param name="tokens"></param> internal TokenStream(DetailLogger log, List<Token> tokens) { this.log = log; this.tokens = tokens; }
internal KitCompiler(DetailLogger log, string fileName = null) : base(log, null, fileName) { }
internal Parser(DetailLogger log) { this.log = log; }