Exemple #1
0
        private static void PrintUPSVarList(UPS ups)
        {
            UPSDClient client = new UPSDClient(ups.Host);

            try
            {
                client.Connect();
                Dictionary <string, string> vars = client.ListUPSVar(ups.Name);
                foreach (KeyValuePair <string, string> item in vars)
                {
                    Console.WriteLine(item.Key + ": " + item.Value);
                }
            }
            catch (SocketException sockex)
            {
                Console.WriteLine("Error: " + sockex.Message);
            }
            catch (UPSException upsex)
            {
                Console.WriteLine("Error: " + upsex.Description);
            }
            finally
            {
                client.Disconnect();
            }
        }