VintaSoft Twain .NET SDK 15.3: Руководство для .NET разработчика
Vintasoft.Twain Namespace / DeviceCapabilityCollection Class / Save(Stream) Method
Синтаксис Exceptions Ремарки Example Требования Смотрите также
В этом разделе
    Save(Stream) Метод (DeviceCapabilityCollection)
    В этом разделе
    Saves information about current values of capabilites to the stream.
    Синтаксис
    'Declaration
    
    Public Sub Save( _
    ByVal stream
    Stream to save the current values of capabilities.
    As System.IO.Stream _
    )
    public void Save(
    System.IO.Stream stream
    )
    public: void Save(
    System.IO.Stream* stream
    )
    public:
    void Save(
    System.IO.Stream^ stream
    )

    Parameters

    stream
    Stream to save the current values of capabilities.
    Исключения
    ИсключениеОписание
    Thrown if stream is null (Nothing in VB).
    Thrown if the stream does not support writing.
    Thrown if device is in wrong state.
    Thrown if device does not support capability.
    Thrown if the .NET debugger is used and the function evaluation requires all threads to run.
    Ремарки

    The method ignores the "custom" capabilities, i.e. capabilities, which are added using the Add(UInt16) method.

    Пример

    This C#/VB.NET code shows how to save values of current device capabilities to a file.

    
    ''' <summary>
    ''' Saves the device capability collection to a file.
    ''' </summary>
    Public Shared Sub SaveDeviceCapabilityCollection(device As Vintasoft.Twain.Device)
        ' open the device
        device.Open()
        ' open file
        Using fs As New System.IO.FileStream("scanner-capabilities.xml", System.IO.FileMode.Append, System.IO.FileAccess.Write)
            ' save the device capability collection to a file
            device.Capabilities.Save(fs)
        End Using
    End Sub
    
    
    
    /// <summary>
    /// Saves the device capability collection to a file.
    /// </summary>
    public static void SaveDeviceCapabilityCollection(Vintasoft.Twain.Device device)
    {
        // open the device
        device.Open();
        // open file
        using (System.IO.FileStream fs = new System.IO.FileStream("scanner-capabilities.xml", System.IO.FileMode.Append, System.IO.FileAccess.Write))
        {
            // save the device capability collection to a file
            device.Capabilities.Save(fs);
        }
    }
    
    

    Требования

    Целевые платформы: .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также