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 96 by Douglas Thrift, 2004-03-02T00:26:19-08:00 vs.
Revision 100 by Douglas Thrift, 2004-03-02T01:35:17-08:00

# Line 8 | Line 8 | using System;
8   using System.IO;
9   using System.Net;
10   using System.Text;
11 + #if !_FreeBSD_
12 + using System.Windows.Forms;
13 + #endif
14  
15   public class HostUpdateSharp
16   {
17          public static void Main(string[] args)
18          {
19 +                foreach (string arg in args)
20 +                {
21 +                        switch (arg)
22 +                        {
23 +                        case "-D":
24 +                                debug = true;
25 +                                break;
26 +                        default:
27 +                                uname = arg;
28 +                                break;
29 +                        }
30 +                }
31 +
32                  try
33                  {
34                          new HostUpdateSharp();
# Line 55 | Line 71 | public class HostUpdateSharp
71                  StreamReader content = new StreamReader(response.GetResponseStream(),
72                          Encoding.ASCII);
73  
74 <                Console.Write(content.ReadToEnd());
74 > #if _FreeBSD_
75 >                if (debug) Console.Write(content.ReadToEnd());
76 > #else
77 >                if (debug) MessageBox.Show(content.ReadToEnd(), "Host Update Sharp",
78 >                        MessageBoxButtons.OK, MessageBoxIcon.Information);
79 > #endif
80 >
81                  content.Close();
82          }
83 +        private static bool debug = false;
84 +        private static string uname = "";
85   #if _FreeBSD_
86 <        private string platform() { return "FreeBSD 4.9-STABLE i386"; }
63 < #else
64 <        private string platform()
86 >        private static string platform()
87          {
88 <                OperatingSystem os = Environment.OSVersion;
67 <                string system = "Unknown";
68 <
69 <                switch (os.Platform)
88 >                if (uname == "")
89                  {
90 <                case PlatformID.Win32NT:
72 <                        system = "Windows NT";
73 <                        break;
74 <                case PlatformID.Win32Windows:
75 <                        system = "Windows";
76 <                        break;
90 >                        "Unknown 0.0 x86";
91                  }
92 <
93 <                int major = os.Version.Major, minor = os.Version.Minor;
94 <                string version = os + "";
95 <
96 <                switch (system)
92 >        }
93 > #else
94 >        private static string platform()
95 >        {
96 >                if (uname == "")
97                  {
98 <                case "Windows NT":
99 <                        switch (major)
98 >                        OperatingSystem os = Environment.OSVersion;
99 >                        string system = "Unknown";
100 >
101 >                        switch (os.Platform)
102                          {
103 <                        case 5:
104 <                                switch (minor)
105 <                                {
106 <                                case 0:
107 <                                        version = "Windows 2000";
92 <                                        break;
93 <                                case 1:
94 <                                        version = "Windows XP";
95 <                                        break;
96 <                                case 2:
97 <                                        version = "Windows .NET Server";
98 <                                        break;
99 <                                }
103 >                        case PlatformID.Win32NT:
104 >                                system = "Windows NT";
105 >                                break;
106 >                        case PlatformID.Win32Windows:
107 >                                system = "Windows";
108                                  break;
109                          }
110 <                        break;
111 <                case "Windows":
112 <                        if (major == 4)
105 <                        {
106 <                                switch (minor)
107 <                                {
108 <                                case 10:
109 <                                        version = " Windows 98";
110 <                                        break;
111 <                                case 90:
112 <                                        version = " Windows ME";
113 <                                        break;
114 <                                }
115 <                        }
116 <                        break;
110 >
111 >                        uname = system + ' ' + os.Version.Major + '.' + os.Version.Minor +
112 >                                " x86";
113                  }
114  
115 <                return system + ' ' + major + '.' + minor + " [" + version + "] ix86";
115 >                return uname;
116          }
117   #endif
118   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines