[fix]修正UdpServer在接收广播时连续启动接收的错误,在StarAgent中,此时可能收到广播包,SocketFlags是Broadcast,需要清空,否则报错“参考的对象类型不支持尝试的操作”; 无需设置SocketOptionName.PacketInformation,在ReceiveMessageFromAsync时会自动设置,并且支持ipv6;
石头 编写于 2024-10-10 00:36:00 石头 提交于 2024-10-10 00:45:43
X
using System;
using System.ComponentModel;
using System.Xml.Serialization;

namespace XUnitTest.Serialization
{
    [XmlRoot("StarAgent")]
    class StarSetting
    {
        #region 属性
        /// <summary>调试开关。默认true</summary>
        [Description("调试开关。默认true")]
        public Boolean Debug { get; set; } = true;

        /// <summary>证书</summary>
        [Description("证书")]
        public String Code { get; set; }

        /// <summary>密钥</summary>
        [Description("密钥")]
        public String Secret { get; set; }

        /// <summary>本地服务。默认udp://127.0.0.1:5500</summary>
        [Description("本地服务。默认udp://127.0.0.1:5500")]
        public String LocalServer { get; set; } = "udp://127.0.0.1:5500";

        /// <summary>更新通道。默认Release</summary>
        [Description("更新通道。默认Release")]
        public String Channel { get; set; } = "Release";

        /// <summary>应用服务集合</summary>
        [Description("应用服务集合")]
        public ServiceInfo[] Services { get; set; }
        #endregion
    }

    /// <summary>应用服务信息</summary>
    public class ServiceInfo
    {
        #region 属性
        /// <summary>名称。全局唯一,默认应用名,根据场景可以加dev等后缀</summary>
        [XmlAttribute]
        public String Name { get; set; }

        /// <summary>文件</summary>
        [XmlAttribute]
        public String FileName { get; set; }

        /// <summary>参数</summary>
        [XmlAttribute]
        public String Arguments { get; set; }

        /// <summary>工作目录</summary>
        [XmlAttribute]
        public String WorkingDirectory { get; set; }

        /// <summary>是否自动启动</summary>
        [XmlAttribute]
        public Boolean AutoStart { get; set; }

        /// <summary>启动失败时的重试次数,默认3次</summary>
        [XmlAttribute]
        public Int32 Retry { get; set; } = 3;

        /// <summary>是否自动重启。应用进程退出后,自动拉起,默认true</summary>
        [XmlAttribute]
        public Boolean AutoRestart { get; set; } = true;

        /// <summary>是否单实例。按文件路径确保唯一实例,默认false</summary>
        [XmlAttribute]
        public Boolean Singleton { get; set; }

        ///// <summary>重启退出代码。仅有该退出代码才会重启</summary>
        //[XmlAttribute]
        //public String RestartExistCodes { get; set; }
        #endregion
    }
}