Exemple #1
0
        public override void write(byte[] s, int len)
        {
            TextPrinterException exception;

            try
            {
                this.dataToWrite    = s;
                this.dataToWriteLen = len;
                this.writeError     = null;
                Thread thread = new Thread(new ThreadStart(this.run));
                thread.Start();
                thread.Join(base.timeout);
                if (thread.IsAlive)
                {
                    thread.Interrupt();
                    exception = new TextPrinterException("Could not write to printer file. Timeout.");
                    throw exception;
                }
                if (this.writeError != null)
                {
                    exception = new TextPrinterException("Could not write to printer file. " + this.writeError);
                    throw exception;
                }
            }
            catch (Exception exception2)
            {
                exception = new TextPrinterException(exception2.Message);
                throw exception;
            }
        }
Exemple #2
0
 public override void close()
 {
     try
     {
         this.closed = true;
         this.os.Close();
     }
     catch (Exception exception)
     {
         TextPrinterException exception2 = new TextPrinterException(exception.Message);
         throw exception2;
     }
 }