コード例 #1
0
ファイル: ServerInfo.cs プロジェクト: Chang228/SDCPublish
 public ServerInfoModel(ServerInfo info,object endpoint)
 {
     if (info != null)
     {
         ComputerName = info.ComputerName;
         IPAddress = Dns.GetHostAddresses(computerName)[0].ToString();
         NickName = info.NickName;
         Version = info.Version;
         ToVersion = info.ToVersion;
         NeedRestart = info.NeedRestart;
         UpdateTime = info.UpdateTime;
         CreateTime = info.CreateTime;
         EndPoint = endpoint;
     }
 }
コード例 #2
0
ファイル: ServerInfo.cs プロジェクト: Chang228/SDCPublish
        public void SetInfo(ServerInfo info)
        {
            if(info.Version!=null)
            {
                if(!string.IsNullOrEmpty(info.Version.Database))
                {
                    registry.WriteRegistry(@"SOFTWARE\SDCPublish", "DatabaseVersion", info.Version.Database);
                }
                if (!string.IsNullOrEmpty(info.Version.Server))
                {
                    registry.WriteRegistry(@"SOFTWARE\SDCPublish", "ServerVersion", info.Version.Server);
                }
                if (!string.IsNullOrEmpty(info.Version.Client))
                {
                    registry.WriteRegistry(@"SOFTWARE\SDCPublish", "ClientVersion", info.Version.Client);
                }
                if (info.UpdateTime!=null)
                {
                    registry.WriteRegistry(@"SOFTWARE\SDCPublish", "UpdateTime", DateTime.Now.ToString());
                    if(string.IsNullOrEmpty(registry.ReadRegistry(@"SOFTWARE\SDCPublish", "CreateTime")))
                    {
                        registry.WriteRegistry(@"SOFTWARE\SDCPublish", "CreateTime", DateTime.Now.ToString());
                    }

                }
            }
        }
コード例 #3
0
ファイル: ServerInfo.cs プロジェクト: Chang228/SDCPublish
        public ServerInfo GetInfo()
        {
            ServerInfo info = new ServerInfo();
            info.ComputerName = Dns.GetHostName();
            info.Version = new Version();

            info.Version.Database = registry.ReadRegistry(@"SOFTWARE\SDCPublish", "DatabaseVersion");
            info.Version.Server = registry.ReadRegistry(@"SOFTWARE\SDCPublish", "ServerVersion");
            info.Version.Client = registry.ReadRegistry(@"SOFTWARE\SDCPublish", "ClientVersion");
            string time = registry.ReadRegistry(@"SOFTWARE\SDCPublish", "UpdateTime");
            if(time!=null)
                info.UpdateTime = DateTime.Parse(time);
            time = registry.ReadRegistry(@"SOFTWARE\SDCPublish", "CreateTime");
            if (time != null)
                info.CreateTime = DateTime.Parse(time);
            info.ServerBasePath = uploadPath;
            return info;
        }