예제 #1
0
 private void report_job_status(int code, ConversionJob job)
 {
     if (this.OnJobStatusChange != null)
     {
         this.OnJobStatusChange(code, job);
     }
 }
예제 #2
0
        public void DoJob(ConversionJob job)
        {
            Tracing.StartMethodTrace();

            this.report_job_status(0, job);
            Log("");
            Log("Converting file #{0} ", job.SequenceNumber + 1);
            Log("Input file: {0} ", job.InputFile);
            Log("Output file: {0} ", job.OutputFile);

            bool skip_this_file = false;

            bool output_already_existed = System.IO.File.Exists(job.OutputFile);

            if (output_already_existed)
            {
                Log("Output file already exists; Skipping.");
                skip_this_file = true;
            }
            else
            {
                // Ensure that that is a path ready for the output file

                string path_for_file = System.IO.Path.GetDirectoryName(job.OutputFile);
                if (!System.IO.Directory.Exists(path_for_file))
                {
                    Log("Creating folder {0}", path_for_file);
                    System.IO.Directory.CreateDirectory(path_for_file);
                }
            }


            if (skip_this_file == false)
            {
                if (!((job.Options.Format.ID == FormatsEnum.PSDFormat.ID) || (job.Options.Format.ID == FormatsEnum.TIFFormat.ID)))
                {
                    Log(">>>Unknown Format {0}", job.Options.Format.ID);
                    throw new Errors.InvalidFormatError("Unknown format");
                }

                Log("File/Open");
                this.m_painter.FileOpen(job.InputFile);
                Log("File/Save");
                this.m_painter.FileSave(job.OutputFile, job.Options.SaveAlpha, job.Options.Colorspace, job.Options.Format);
                Log("File/Close");
                this.m_painter.FileClose( );
            }

            Log("Finished file #{0} ", job.SequenceNumber + 1);

            Tracing.EndMethodTrace();
        }
예제 #3
0
		private void report_job_status( int code, ConversionJob job )
		{
			if (this.OnJobStatusChange!=null)
			{
				this.OnJobStatusChange(code,job);
			}
		}
예제 #4
0
		public void DoJob( ConversionJob job )
		{
			Tracing.StartMethodTrace();

			this.report_job_status( 0, job );
			Log( "" );
			Log( "Converting file #{0} ", job.SequenceNumber +1 );
			Log( "Input file: {0} " , job.InputFile  );
			Log( "Output file: {0} " , job.OutputFile );

			bool skip_this_file=false;

			bool output_already_existed = System.IO.File.Exists( job.OutputFile );
			if ( output_already_existed )
			{
				Log( "Output file already exists; Skipping." );
				skip_this_file=true;
			}
			else
			{
				// Ensure that that is a path ready for the output file

				string path_for_file = System.IO.Path.GetDirectoryName(job.OutputFile  );
				if ( !System.IO.Directory.Exists( path_for_file ) )
				{
					Log( "Creating folder {0}", path_for_file );
					System.IO.Directory.CreateDirectory( path_for_file );
				}
			}


			if (skip_this_file==false)
			{
				if ( ! ( (job.Options.Format.ID ==FormatsEnum.PSDFormat.ID ) || (job.Options.Format.ID ==FormatsEnum.TIFFormat.ID )) )
				{
					Log(">>>Unknown Format {0}", job.Options.Format.ID );
					throw new Errors.InvalidFormatError( "Unknown format" );
				}

				Log("File/Open");
				this.m_painter.FileOpen( job.InputFile   );
				Log("File/Save");
				this.m_painter.FileSave( job.OutputFile  , job.Options.SaveAlpha  , job.Options.Colorspace   , job.Options.Format   );
				Log("File/Close");
				this.m_painter.FileClose( );

			}

			Log( "Finished file #{0} ", job.SequenceNumber +1  );

			Tracing.EndMethodTrace();

		}