~ruther/NosTale-PacketLogger

ref: 18df69cdbb20143d0bdcbc2ebcc39e135d0fc42f NosTale-PacketLogger/src/PacketLogger/Models/Packets/IPacketProvider.cs -rw-r--r-- 1.3 KiB
18df69cd — František Boháček feat: add packet providers 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
//  IPacketProvider.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Threading.Tasks;
using DynamicData;
using PacketLogger.Models.Filters;
using Remora.Results;

namespace PacketLogger.Models.Packets;

/// <summary>
/// Provides packets from some kind of a source.
/// </summary>
public interface IPacketProvider : INotifyPropertyChanged
{
    /// <summary>
    /// Gets whether <see cref="Open"/> was called and successfully finished.
    /// </summary>
    public bool IsOpen { get; }

    /// <summary>
    /// Gets the filtered packets from this provider.
    /// </summary>
    public SourceList<PacketInfo> Packets { get; }

    /// <summary>
    /// Open the provider/connection, load etc.
    /// </summary>
    /// <returns>A result that may or may not have succeeded.</returns>
    public Task<Result> Open();

    /// <summary>
    /// Close the connection, dispose.
    /// </summary>
    /// <returns>A result that may or may not have succeeded.</returns>
    public Task<Result> Close();

    /// <summary>
    /// Clear all packets.
    /// </summary>
    public void Clear();
}
Do not follow this link