|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 using System; |
|
18 using System.Text; |
|
19 using System.Collections.Generic; |
|
20 using System.ComponentModel; |
|
21 using CrashItemLib.Crash; |
|
22 using CrashItemLib.Crash.Base; |
|
23 using CrashItemLib.Crash.Base.DataBinding; |
|
24 using CrashItemLib.Crash.Container; |
|
25 |
|
26 namespace CrashItemLib.Crash.Memory |
|
27 { |
|
28 [CIDBAttributeColumn( "Name", 0 )] |
|
29 [CIDBAttributeColumn( "Value", 1 )] |
|
30 public class CIMemoryInfo : CIElement |
|
31 { |
|
32 #region Type |
|
33 public enum TType |
|
34 { |
|
35 [Description( "Drive" )] |
|
36 ETypeDrive = 0, |
|
37 |
|
38 [Description( "RAM" )] |
|
39 ETypeRAM |
|
40 } |
|
41 #endregion |
|
42 |
|
43 #region Constructors |
|
44 public CIMemoryInfo( CIContainer aContainer ) |
|
45 : base( aContainer ) |
|
46 { |
|
47 } |
|
48 #endregion |
|
49 |
|
50 #region API |
|
51 #endregion |
|
52 |
|
53 #region Properties |
|
54 public int DriveNumber |
|
55 { |
|
56 get { return iDriveNumber; } |
|
57 set { iDriveNumber = value; } |
|
58 } |
|
59 |
|
60 public string DriveLetter |
|
61 { |
|
62 get |
|
63 { |
|
64 int driveLetterCharNumber = ( (int) 'A' ) + DriveNumber; |
|
65 char driveLetter = (char) driveLetterCharNumber; |
|
66 // |
|
67 return string.Format( "{0}:", driveLetter ); |
|
68 } |
|
69 } |
|
70 |
|
71 public ulong Capacity |
|
72 { |
|
73 get { return iCapacity; } |
|
74 set { iCapacity = value; } |
|
75 } |
|
76 |
|
77 public ulong Free |
|
78 { |
|
79 get { return iFree; } |
|
80 set { iFree = value; } |
|
81 } |
|
82 |
|
83 public ulong UID |
|
84 { |
|
85 get { return iUID; } |
|
86 set { iUID = value; } |
|
87 } |
|
88 |
|
89 public string VolumeName |
|
90 { |
|
91 get { return iVolumeName; } |
|
92 set { iVolumeName = value; } |
|
93 } |
|
94 |
|
95 public string Vendor |
|
96 { |
|
97 get { return iVendor; } |
|
98 set { iVendor = value; } |
|
99 } |
|
100 |
|
101 public TType Type |
|
102 { |
|
103 get { return iType; } |
|
104 set { iType = value; } |
|
105 } |
|
106 #endregion |
|
107 |
|
108 #region Internal methods |
|
109 #endregion |
|
110 |
|
111 #region From System.Object |
|
112 public override string ToString() |
|
113 { |
|
114 string ret = SymbianUtils.Enum.EnumUtils.ToString( Type ); |
|
115 if ( Type == TType.ETypeDrive ) |
|
116 { |
|
117 ret = DriveLetter; |
|
118 } |
|
119 return ret; |
|
120 } |
|
121 #endregion |
|
122 |
|
123 #region From CIElement |
|
124 public override void PrepareRows() |
|
125 { |
|
126 DataBindingModel.ClearRows(); |
|
127 |
|
128 DataBindingModel.Add( new CIDBRow( new CIDBCell( "Type" ), new CIDBCell( SymbianUtils.Enum.EnumUtils.ToString( this.Type ) ) ) ); |
|
129 |
|
130 if ( Type == TType.ETypeDrive ) |
|
131 { |
|
132 DataBindingModel.Add( new CIDBRow( new CIDBCell( "Drive Letter" ), new CIDBCell( DriveLetter ) ) ); |
|
133 if ( VolumeName.Length > 0 ) |
|
134 { |
|
135 DataBindingModel.Add( new CIDBRow( new CIDBCell( "Volume" ), new CIDBCell( VolumeName ) ) ); |
|
136 } |
|
137 if ( Vendor.Length > 0 ) |
|
138 { |
|
139 DataBindingModel.Add( new CIDBRow( new CIDBCell( "Vendor" ), new CIDBCell( Vendor ) ) ); |
|
140 } |
|
141 if ( UID != 0 ) |
|
142 { |
|
143 DataBindingModel.Add( new CIDBRow( new CIDBCell( "UID" ), new CIDBCell( UID.ToString() ) ) ); |
|
144 } |
|
145 } |
|
146 |
|
147 DataBindingModel.Add( new CIDBRow( new CIDBCell( "Free" ), new CIDBCell( Free.ToString() ) ) ); |
|
148 if ( Capacity != 0 ) |
|
149 { |
|
150 DataBindingModel.Add( new CIDBRow( new CIDBCell( "Capacity" ), new CIDBCell( Capacity.ToString() ) ) ); |
|
151 } |
|
152 } |
|
153 #endregion |
|
154 |
|
155 #region Data members |
|
156 private int iDriveNumber = 0; |
|
157 private ulong iCapacity = 0; |
|
158 private ulong iFree = 0; |
|
159 private ulong iUID = 0; |
|
160 private string iVolumeName = string.Empty; |
|
161 private string iVendor = string.Empty; |
|
162 private TType iType = TType.ETypeDrive; |
|
163 #endregion |
|
164 } |
|
165 } |