Exemple #1
0
        //Constructor sets the paths to those from the config file.
        internal DirPaths(ReadConfig readConfig)
        {
            source = readConfig.ReadString("source");
            middle = readConfig.ReadString("middle");
            target = readConfig.ReadString("target");

            Log = readConfig.ReadString("Log");

            regMarks     = readConfig.ReadString("regMarks");
            leadRegMark  = readConfig.ReadString("leadRegMark");
            trailRegMark = readConfig.ReadString("trailRegMark");
            blankRegMark = readConfig.ReadString("blankRegMark");

            pressConfig = System.AppDomain.CurrentDomain.BaseDirectory;
            pressConfig = Path.Combine(pressConfig, readConfig.ReadString("pressConfig"));
        }
Exemple #2
0
        static void Main()
        {
            #region Instantiation of classes, structs and stuff.
            Log        Logg       = new Log();
            ReadConfig readConfig = new ReadConfig();
            DirPaths   dirPaths   = new DirPaths(readConfig);
            MoveFile   fileMove   = new MoveFile();

            ParsingInformation       parsingInfo  = new ParsingInformation();
            Action <string>          logg         = (str) => Logg.Text(str, dirPaths);
            RegisterMarksCoordinates regMarkCoord = new RegisterMarksCoordinates();
            #endregion

            #region Load a bunch of parameters from the config file and instanciate a phase class.
            //Load registermark coordinates from the config file.
            regMarkCoord.lead  = new Tuple <int, int>(readConfig.ReadNumber("leadRegMarkX"), readConfig.ReadNumber("leadRegMarkY"));
            regMarkCoord.trail = new Tuple <int, int>(readConfig.ReadNumber("trailRegMarkX"), readConfig.ReadNumber("trailRegMarkY"));

            //Load the sleepTime from the config file.
            int sleepTime = readConfig.ReadNumber("sleepTime");

            //Load parsing information for the files names from the config file.
            parsingInfo.towerStart  = readConfig.ReadNumber("parseTowerStart");
            parsingInfo.towerStart -= 1;                                                         //C# starts to count at zero.
            parsingInfo.towerLength = readConfig.ReadNumber("parseTowerLength");

            parsingInfo.cylinderStart  = readConfig.ReadNumber("parseCylinderStart");
            parsingInfo.cylinderStart -= 1;
            parsingInfo.cylinderLength = readConfig.ReadNumber("parseCylinderLength");

            parsingInfo.sectionStart  = readConfig.ReadNumber("parseSectionStart");
            parsingInfo.sectionStart -= 1;
            parsingInfo.sectionLength = readConfig.ReadNumber("parseSectionLength");

            parsingInfo.halfStart  = readConfig.ReadNumber("parseHalfStart");
            parsingInfo.halfStart -= 1;
            parsingInfo.halfLength = readConfig.ReadNumber("parseHalfLength");

            int DPI = readConfig.ReadNumber("DPI");

            Tuple <int, int> readTextPlacement = new Tuple <int, int>(readConfig.ReadNumber("textPlacementX"), readConfig.ReadNumber("textPlacementY"));

            Phase phase = new Phase(readTextPlacement, regMarkCoord, parsingInfo, dirPaths, DPI, logg, fileMove);
            #endregion

            //Forever loop for now. Main loop of the program.
            string toExitOrNot = @"Never Exit";
            do
            {
                //Checks that all the folders are present and then moves any file from the source to middle.
                string fileToProcess = phase.Input();

                //If there is a file in the source folder the processing begins.
                if (fileToProcess != null)
                {
                    phase.Process(fileToProcess);
                }

                //Any file in the middle should have by this time undergone processing and so is outputed.
                phase.Output();

                //Let the CPU get some rest. ("sleepTime" is set in OARConfig.txt)
                System.Threading.Thread.Sleep(sleepTime);
            } while (!toExitOrNot.Equals("Exit"));
        }