ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/HostUpdateSharp/HostUpdateSharp.cs
(Generate patch)

Comparing HostUpdateSharp/HostUpdateSharp.cs (file contents):
Revision 98 by Douglas Thrift, 2004-03-02T01:17:58-08:00 vs.
Revision 930 by douglas, 2007-06-19T14:07:50-07:00

# Line 23 | Line 23 | public class HostUpdateSharp
23                          case "-D":
24                                  debug = true;
25                                  break;
26 +                        default:
27 +                                uname = arg;
28 +                                break;
29                          }
30                  }
31  
# Line 30 | Line 33 | public class HostUpdateSharp
33                  {
34                          new HostUpdateSharp();
35                  }
36 <                catch (Exception exception) { Console.Error.WriteLine(exception); }
36 >                catch (Exception exception)
37 >                {
38 >                        Console.Error.WriteLine(exception);
39 >                        Environment.Exit(1);
40 >                }
41          }
42          public HostUpdateSharp()
43          {
44 <                StringBuilder host = new StringBuilder("host=" + Dns.GetHostName());
44 >                StringBuilder host = new StringBuilder("host=" +
45 >                        Dns.GetHostName().ToLower());
46                  string url = "http://topsecret.douglasthrift.net/auth/hostupdate.cgi";
47  
48                  if ((host + "").IndexOf('.') < 0)
49                  {
50 <                        host.Append(".local.douglasthrift.net");
50 >                        host.Append(".douglasthrift.net");
51                  }
52  
53                  WebHeaderCollection headers = new WebHeaderCollection();
# Line 78 | Line 86 | public class HostUpdateSharp
86                  content.Close();
87          }
88          private static bool debug = false;
89 +        private static string uname = "";
90   #if _FreeBSD_
91 <        private string platform() { return "FreeBSD 4.9-STABLE i386"; }
83 < #else
84 <        private string platform()
91 >        private static string platform()
92          {
93 <                OperatingSystem os = Environment.OSVersion;
87 <                string system = "Unknown";
88 <
89 <                switch (os.Platform)
93 >                if (uname == "")
94                  {
95 <                case PlatformID.Win32NT:
92 <                        system = "Windows NT";
93 <                        break;
94 <                case PlatformID.Win32Windows:
95 <                        system = "Windows";
96 <                        break;
95 >                        uname = "Unknown";
96                  }
97  
98 <                int major = os.Version.Major, minor = os.Version.Minor;
99 <                string version = os + "";
100 <
101 <                switch (system)
98 >                return uname;
99 >        }
100 > #else
101 >        private static string platform()
102 >        {
103 >                if (uname == "")
104                  {
105 <                case "Windows NT":
106 <                        switch (major)
105 >                        OperatingSystem os = Environment.OSVersion;
106 >                        string system = "Unknown";
107 >
108 >                        switch (os.Platform)
109                          {
110 <                        case 5:
111 <                                switch (minor)
112 <                                {
113 <                                case 0:
114 <                                        version = "Windows 2000";
112 <                                        break;
113 <                                case 1:
114 <                                        version = "Windows XP";
115 <                                        break;
116 <                                case 2:
117 <                                        version = "Windows .NET Server";
118 <                                        break;
119 <                                }
110 >                        case PlatformID.Win32NT:
111 >                                system = "Windows NT";
112 >                                break;
113 >                        case PlatformID.Win32Windows:
114 >                                system = "Windows";
115                                  break;
116                          }
117 <                        break;
118 <                case "Windows":
119 <                        if (major == 4)
125 <                        {
126 <                                switch (minor)
127 <                                {
128 <                                case 10:
129 <                                        version = " Windows 98";
130 <                                        break;
131 <                                case 90:
132 <                                        version = " Windows ME";
133 <                                        break;
134 <                                }
135 <                        }
136 <                        break;
117 >
118 >                        uname = system + ' ' + os.Version.Major + '.' + os.Version.Minor +
119 >                                " x86";
120                  }
121  
122 <                return system + ' ' + major + '.' + minor + " [" + version + "] ix86";
122 >                return uname;
123          }
124   #endif
125   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines