aboutsummaryrefslogtreecommitdiffstats
path: root/QtVsTools.Package/Editors/DesignerSession.cs
blob: 4f9f5283722d9f007907ae574d2fb934d3bd95ae (plain)
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
// Copyright (C) 2025 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

using System;
using System.Diagnostics;
using System.Net;
using System.Net.Sockets;

namespace QtVsTools.Package.Editors
{
    internal sealed class DesignerSession : IDisposable
    {
        public Process Process { get; set; }
        public TcpListener Listener { get; } = new(IPAddress.Loopback, 0);
        public NetworkStream Stream { get; set; }

        public void Dispose()
        {
            try {
                Stream?.Dispose();
            } catch { /* ignored */ }

            try {
                Listener.Stop();
            } catch { /* ignored */ }
        }
    }
}