コード例 #1
0
        public UpdateFiles GetUpdateFiles()
        {
            string Value = NetworkTools.ReadString(new NetworkTools.PHP(GetAddressPHP,
                                                                        new NetworkTools.PHP.Argument[] { new NetworkTools.PHP.Argument(TitleName, DownloadValue) }));

            try
            {
                UpdateFiles   Files = null;
                XmlSerializer des   = new XmlSerializer(typeof(UpdateFiles));
                using (StringReader sr = new StringReader(NetworkTools.ReadString(Value)))
                {
                    Files = (UpdateFiles)des.Deserialize(sr);
                }

                return(Files);
            }
            catch (Exception) { return(null); }
        }
コード例 #2
0
        public VersionInfo CheckUpdate()
        {
            LAP.Dialogs.LogWindow.Append("Checking update");
            try
            {
                string Value = NetworkTools.ReadString(new NetworkTools.PHP(GetAddressPHP,
                                                                            new NetworkTools.PHP.Argument[] { new NetworkTools.PHP.Argument(TitleName, LatestValue) }));

                if (!string.IsNullOrEmpty(Value))
                {
                    Latest latest = null;

                    try
                    {
                        XmlSerializer des = new XmlSerializer(typeof(Latest));
                        using (StringReader sr = new StringReader(NetworkTools.ReadString(Value)))
                        {
                            latest = (Latest)des.Deserialize(sr);
                        }

                        if (latest.Maintenance)
                        {
                            return(VersionInfo.Maintenance());
                        }
                        else
                        {
                            Version     Latest = new Version(latest.Major, latest.Minor, latest.Build, latest.Revision);
                            VersionInfo vi     = new VersionInfo(Latest, latest.ShortMessage);
                            return(vi);
                        }
                    }
                    catch (Exception ex) { return(new VersionInfo(ex)); }
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex) { return(new VersionInfo(ex)); }
        }