コード例 #1
0
ファイル: Resizer.cs プロジェクト: johanpolson/OAResize
 internal Phase(Tuple <int, int> inTextPlacement, RegisterMarksCoordinates inRegMarkCoord, ParsingInformation inParsingInfo, DirPaths inDirPaths, int inDPI, Action <string> inLog, MoveFile inMoveFile)
 {
     this.textPlacement = inTextPlacement;
     this.regMarkCoord  = inRegMarkCoord;
     this.parsingInfo   = inParsingInfo;
     this.dirPaths      = inDirPaths;
     this.DPI           = inDPI;
     this.logg          = inLog;
     this.moveFile      = inMoveFile;
 }
コード例 #2
0
ファイル: Resizer.cs プロジェクト: johanpolson/OAResize
        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"));
        }