Click or drag to resize

FileUtil Interface

This is an utility class for performing file operations on a device.

Namespace:  Zebra.Sdk.Device
Assembly:  SdkApi_Core (in SdkApi_Core.dll) Version: 2.14.1989
Syntax
public interface FileUtil

The FileUtil type exposes the following members.

Methods
  NameDescription
Public methodRetrieveFileNames
Retrieves the names of the files which are stored on the device.
Public methodRetrieveFileNames(String)
Retrieves the names of the files which are stored on the device.
Public methodRetrieveObjectsProperties
Retrieves the properties of the objects which are stored on the device.
Public methodSendFileContents(String)
Sends the contents of a file to the device.
Public methodSendFileContents(String, ProgressMonitor)
Sends the contents of a file to the device.
Top
Examples
using System;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Device;
using Zebra.Sdk.Printer;

public class FileUtilExample {

    public static void Main(string[] args) {
        Connection connection = new TcpConnection("192.168.1.100", TcpConnection.DEFAULT_ZPL_TCP_PORT);

        try {
            connection.Open();
            ZebraPrinter printer = ZebraPrinterFactory.GetInstance(connection);
            printer.SendFileContents("C:\\Users\\[user]\\Documents\\labels\\sample.lbl");
            string[] fileNames = printer.RetrieveFileNames();
            foreach (string filename in fileNames) {
                Console.WriteLine(filename);
            }
        } catch (ConnectionException e) {
            Console.WriteLine(e.ToString());
        } catch (ZebraPrinterLanguageUnknownException e) {
            Console.WriteLine(e.ToString());
        } catch (ZebraIllegalArgumentException e) {
            Console.WriteLine(e.ToString());
        } finally {
            connection.Close();
        }
    }
}
See Also