Пример #1
0
 // --------------------------- LogMessage ---------------------------------
 private void LogMessage(NetworkRole InRole, string InFullMsg)
 {
     if (DetailLogger != null)
     {
         DetailLogger.Add(InRole.ToString( ) + " " + InFullMsg);
     }
 }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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;
        }
Пример #6
0
 internal FunctionCompiler(DetailLogger log, FunctionBuilder parent = null, string fileName = null)
 {
     this.log = log;
     builder = new FunctionBuilder(parent, fileName);
 }
Пример #7
0
 internal CompilerException(DetailLogger log)
     : base(string.Format("Compilation failed with {0} errors and {1} warnings.", log.ErrorCount, log.WarningCount))
 {
     this.log = log;
 }
Пример #8
0
 internal Lexer(DetailLogger log)
 {
     this.log = log;
 }
Пример #9
0
 /// <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;
 }
Пример #10
0
 internal KitCompiler(DetailLogger log, string fileName = null)
     : base(log, null, fileName)
 {
 }
Пример #11
0
 internal Parser(DetailLogger log)
 {
     this.log = log;
 }