forked from florentbr/SeleniumBasic
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSize.cs
More file actions
63 lines (53 loc) · 1.66 KB
/
Size.cs
File metadata and controls
63 lines (53 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using Selenium.Core;
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace Selenium {
/// <summary>
/// Size structure
/// </summary>
[Guid("0277FC34-FD1B-4616-BB19-2108C1FE2EE9")]
[ComVisible(true), ClassInterface(ClassInterfaceType.None)]
[DebuggerDisplay("Width={Width} Height={Height}")]
public class Size : ComInterfaces._Size {
private int _width, _height;
/// <summary>
/// Get the size
/// </summary>
/// <param name="width"></param>
/// <param name="height"></param>
public Size(int width, int height) {
_width = width;
_height = height;
}
internal Size(Dictionary dict) {
try {
_width = Convert.ToInt32(dict["width"]);
_height = Convert.ToInt32(dict["height"]);
} catch (Errors.KeyNotFoundError ex) {
throw new DeserializeException(typeof(Size), ex);
} catch (InvalidCastException ex) {
throw new DeserializeException(typeof(Size), ex);
}
}
/// <summary>
/// Width
/// </summary>
public int Width {
get { return _width; }
}
/// <summary>
/// Height
/// </summary>
public int Height {
get { return _height; }
}
/// <summary>
/// Returns the text representaton of this instance.
/// </summary>
/// <returns></returns>
public override string ToString() {
return string.Format(@"{{width={0} height={1}}}", _width, _height);
}
}
}