|
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.IO; |
|
19 using System.Threading; |
|
20 using System.Text; |
|
21 using System.Text.RegularExpressions; |
|
22 using System.Collections.Specialized; |
|
23 using System.Collections.Generic; |
|
24 using System.ComponentModel; |
|
25 using SymbianUtils; |
|
26 using SymbianUtils.SerializedOperations; |
|
27 using SymbolLib.Sources.Map.Parser; |
|
28 |
|
29 namespace SymbolLib.CodeSegDef |
|
30 { |
|
31 internal class CSROpScanSymbol : CodeSegResolverOperation |
|
32 { |
|
33 #region Constructors |
|
34 public CSROpScanSymbol( CodeSegResolver aResolver, bool aResetResolver, FileInfo aFile, IEnumerable<string> aBinaryNames ) |
|
35 : base( aResolver, aResetResolver ) |
|
36 { |
|
37 iFile = aFile; |
|
38 // |
|
39 foreach ( string binary in aBinaryNames ) |
|
40 { |
|
41 iBinaries.Add( binary ); |
|
42 } |
|
43 } |
|
44 #endregion |
|
45 |
|
46 #region From CSROperation |
|
47 protected override void Scan() |
|
48 { |
|
49 base.DriveLetter = Path.GetPathRoot( iFile.FullName ); |
|
50 foreach ( string binary in iBinaries ) |
|
51 { |
|
52 string envFileName = binary; |
|
53 if ( envFileName[ 0 ] == Path.DirectorySeparatorChar ) |
|
54 { |
|
55 envFileName = envFileName.Substring( 1 ); |
|
56 } |
|
57 envFileName = CombineWithDriveLetter( envFileName ); |
|
58 string imageFileName = CodeSegResolver.KROMBinaryPath + Path.GetFileName( envFileName ); |
|
59 // |
|
60 CodeSegResolverEntry entry = new CodeSegResolverEntry( envFileName, imageFileName ); |
|
61 // |
|
62 base.Add( entry ); |
|
63 } |
|
64 } |
|
65 #endregion |
|
66 |
|
67 #region API |
|
68 #endregion |
|
69 |
|
70 #region Properties |
|
71 #endregion |
|
72 |
|
73 #region Internal methods |
|
74 #endregion |
|
75 |
|
76 #region Internal constants |
|
77 private const string KRomDriveFileLetter = "Z:\\"; |
|
78 #endregion |
|
79 |
|
80 #region Data members |
|
81 private readonly FileInfo iFile; |
|
82 private List<string> iBinaries = new List<string>(); |
|
83 public static readonly Regex KMapParserRegex = new Regex( |
|
84 "(?<Type>.+)\r\n\\=\r\n(?<Host>.+?)(?:\\s+)\\x22(?<Device>.+)\\x2" + |
|
85 "2", |
|
86 RegexOptions.CultureInvariant |
|
87 | RegexOptions.IgnorePatternWhitespace |
|
88 | RegexOptions.Compiled |
|
89 ); |
|
90 #endregion |
|
91 } |
|
92 } |