Exemplo n.º 1
0
        private void ProcessFile(object sender, ScanEventArgs e)
        {
            if ((events_ != null) && (events_.ProcessFile != null))
            {
                events_.ProcessFile(sender, e);
            }

            if (e.ContinueRunning)
            {
                try
                {
                    // The open below is equivalent to OpenRead which guarantees that if opened the
                    // file will not be changed by subsequent openers, but precludes opening in some cases
                    // were it could succeed. ie the open may fail as its already open for writing and the share mode should reflect that.
                    using (FileStream stream = File.Open(e.Name, FileMode.Open, FileAccess.Read, FileShare.Read))
                    {
                        ZipEntry entry = entryFactory_.MakeFileEntry(e.Name);

                        // Set up AES encryption for the entry if required.
                        ConfigureEntryEncryption(entry);

                        outputStream_.PutNextEntry(entry);
                        AddFileContents(e.Name, stream);
                    }
                }
                catch (Exception ex)
                {
                    if (events_ != null)
                    {
                        continueRunning_ = events_.OnFileFailure(e.Name, ex);
                    }
                    else
                    {
                        continueRunning_ = false;
                        throw;
                    }
                }
            }
        }
Exemplo n.º 2
0
        void ProcessFile(object sender, ScanEventArgs e)
        {
            if ((events_ != null) && (events_.ProcessFile != null))
            {
                events_.ProcessFile(sender, e);
            }

            if (e.ContinueRunning)
            {
                try {
                    // The open below is equivalent to OpenRead which gaurantees that if opened the
                    // file will not be changed by subsequent openers, but precludes opening in some cases
                    // were it could succeed.
                    using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                    {
                        using (var stream = store.OpenFile(e.Name, FileMode.Open, FileAccess.Read, FileShare.Read))
                        {
                            ZipEntry entry = entryFactory_.MakeFileEntry(e.Name);
                            outputStream_.PutNextEntry(entry);
                            AddFileContents(e.Name, stream);
                        }
                    }
                }
                catch (Exception ex) {
                    if (events_ != null)
                    {
                        continueRunning_ = events_.OnFileFailure(e.Name, ex);
                    }
                    else
                    {
                        continueRunning_ = false;
                        throw;
                    }
                }
            }
        }
Exemplo n.º 3
0
 void ListFile(object sender, ScanEventArgs e)
 {
     Console.WriteLine("{0}", e.Name);
 }
Exemplo n.º 4
0
 void ProcessFile(object sender, ScanEventArgs e)
 {
     Console.WriteLine(e.Name);
 }
Exemplo n.º 5
0
 void OnCompletedFile(object sender, ScanEventArgs e)
 {
     ++mFileCompletedCount;
 }
Exemplo n.º 6
0
    private void Read()
    {
        while (serialPort.IsOpen)
        {
            try
            {
                string message = serialPort.ReadLine();

                switch (message [0])
                {
                case 'o':
                    string[] parameters = message.Split(',');

                    OdometryUpdateEventArgs args = new OdometryUpdateEventArgs(
                        Int32.Parse(parameters [1]),
                        Int32.Parse(parameters [2]),
                        Double.Parse(parameters [3]));

                    this.OnOdometryUpdate(args);
                    break;

                case 's':
                    string[]      stringReadings = message.Split(',');
                    List <double> readings       = new List <double> ();

                    // Somewhat inefficient. Start from 1 to skip first character
                    // which is the message header.
                    for (int i = 1; i < stringReadings.Length; i++)
                    {
                        readings.Add(Double.Parse(stringReadings [i]));
                    }

                    readings.Reverse();

                    ScanEventArgs args2 = new ScanEventArgs(readings);

                    OnScanPerformed(args2);
                    break;

                default:
                    break;
                }
            }
            catch (TimeoutException ex)
            {
                Console.WriteLine(ex.ToString());
            }
            catch (FormatException ex)
            {
                Console.WriteLine(ex.ToString());
            }
            catch (IndexOutOfRangeException ex)
            {
                Console.WriteLine(ex.ToString());
            }
            catch (ThreadAbortException)
            {
                // Ignore it.
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
    }
Exemplo n.º 7
0
 private void ProcessFile(object sender, ScanEventArgs e)
 {
     Log.LogMessage(Properties.Resources.UnzipExtracted, e.Name);
 }
Exemplo n.º 8
0
 public void ProcessFile(Object sender, ScanEventArgs e)
 {
     label2.SafeInvoke(d => d.Text = e.Name);
     changeprogressbar(progressBar2, 1);
     textBox4.SafeInvoke(d => d.Text = Convert.ToInt32(((Convert.ToDecimal(progressBar2.Value) / Convert.ToDecimal(progressBar2.Maximum)) * 100)).ToString() + "% concluído");
 }
Exemplo n.º 9
0
 public void Device_ScannerReader(object sender, ScanEventArgs e)
 {
     textBox1.Text = e.BarCode;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Handles a scan, simply updates the landmark database and map if required
 /// by extracting them using the EKF algorithm.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">E.</param>
 private void SerialProxy_Scan(object sender, ScanEventArgs e)
 {
 }
Exemplo n.º 11
0
 public void OnDeviceScanned(ScanEventArgs e)
 {
     if (DeviceScanned != null)
         DeviceScanned(this, e);
 }
 private void OnScanFail(object sender, ScanEventArgs e)
 {
 }
Exemplo n.º 13
0
 private void ProcessFile(object sender, ScanEventArgs e)
 {
     _output.Output("Processing file: " + e.Name);
 }
Exemplo n.º 14
0
 public static void CompletedFileHandler(object sender, ScanEventArgs e)
 {
 }
Exemplo n.º 15
0
 /// <summary>
 /// Callback for adding a new file.
 /// </summary>
 /// <param name="sender">The scanner calling this delegate.</param>
 /// <param name="args">The event arguments.</param>
 void ProcessFile(object sender, ScanEventArgs args)
 {
     activeZipFile_.Add(args.Name);
 }
Exemplo n.º 16
0
 internal FastZipArchiveScanEventArgs(ScanEventArgs e)
 {
     _scanEventArgs = e;
 }