コード例 #1
0
    public void PortName_LPT()
    {
        Type expectedException = _dosDevices.CommonNameExists("LPT") ? typeof(ArgumentException) : typeof(ArgumentException);

        Debug.WriteLine("Verifying setting PortName=LPT");
        VerifyException("LPT", ThrowAt.Open, expectedException, typeof(InvalidOperationException));
    }
コード例 #2
0
ファイル: PortName.cs プロジェクト: maikahj/corefx
    private bool PortName_LPT()
    {
        Type expectedException;

        if (IsWinXPOrHigher())
        {
            expectedException = _dosDevices.CommonNameExists("LPT") ? typeof(ArgumentException) : typeof(System.ArgumentException);
        }
        else
        {
            //			This is not Reliable on Win2K so for now we will assume that the machine does NOT have this device
            //			expectedException = dosDevices.InternalNameExists(@"\DosDevices\LPT") ? typeof(ArgumentException) :  typeof(System.ArgumentException);

            expectedException = typeof(System.ArgumentException);
        }

        Console.WriteLine("Verifying setting PortName=LPT");
        if (!VerifyException("LPT", ThrowAt.Open, expectedException, typeof(System.InvalidOperationException)))
        {
            Console.WriteLine("Err_0982sakhoe!!! Verifying setting PortName=LPT FAILED");
            return(false);
        }

        return(true);
    }
コード例 #3
0
ファイル: DosDevices.cs プロジェクト: maikahj/corefx
    public static void Main()
    {
        DosDevices dosDevices = new DosDevices();

        foreach (KeyValuePair <string, string> keyValuePair in dosDevices)
        {
            Console.WriteLine("'{0}'='{1}'", keyValuePair.Key, keyValuePair.Value.Trim());
        }

        Console.WriteLine("CommonNameExists(\"LPT1\")={0}", dosDevices.CommonNameExists("LPT1"));
        Console.WriteLine("CommonNameExists(\"A:\")={0}", dosDevices.CommonNameExists("A:"));

        Console.WriteLine("CommonNameExists(\"LPT\")={0}", dosDevices.CommonNameExists("LPT"));

        string s = dosDevices["LPT1"];

        for (int i = 0; i < s.Length; ++i)
        {
            Console.WriteLine("{0}({1})", (int)s[i], s[i]);
        }
    }