ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/gr2lib/trunk/gr2lib/core/coretypes/implementation/ExporterInfo.cs
Revision: 106
Committed: Sat Jul 17 14:52:37 2010 UTC (12 years, 4 months ago) by william
File size: 3653 byte(s)
Log Message:
implement Granny2ExceptionWriter

File Contents

# User Rev Content
1 william 71 using System;
2     using System.Collections.Generic;
3     using System.Text;
4     using gr2lib.core.helpers;
5     using gr2lib.core.typedefs;
6 william 79 using gr2lib.core.interfaces;
7 william 95 using System.Diagnostics;
8 william 106 using gr2lib.core.exceptions;
9 william 71 namespace gr2lib.core.coretypes.implementation
10     {
11 william 79
12 william 71 public class ExporterInfo : IExporterInfo
13     {
14 william 82 private string exporterName;
15     private int exporterMajorRevision;
16     private int exporterMinorRevision;
17     private int exporterCustomization;
18     private int exporterBuildNumber;
19 william 71
20    
21     public ExporterInfo()
22     {
23 william 73 this.ExporterName = "";
24     this.ExporterMajorRevision = 0;
25     this.ExporterMinorRevision = 0;
26     this.ExporterCustomization = 0;
27     this.ExporterBuildNumber = 0;
28 william 83 //this.ExtendedData = IntPtr.Zero;
29     //this.NativePointer = IntPtr.Zero;
30 william 71 }
31     internal static ExporterInfo ReadFromMemory(IntPtr pointer)
32     {
33 william 86 try
34     {
35     if (pointer == IntPtr.Zero) return null;
36     native.ExporterInfo native = Helpers.ReadFromMemory<native.ExporterInfo>(pointer);
37     ExporterInfo managed = ReadFromNative(native);
38     managed.NativePointer = pointer;
39     return managed;
40     }
41 william 106 catch (Exception ex)
42 william 86 {
43 william 95 StackTrace st = new StackTrace(true);
44 william 102 #if ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
45 william 106 Granny2ExceptionWriter.WriteToConsole(ex,st);
46 william 102 #endif
47 william 86 return default(ExporterInfo);
48     }
49 william 71 }
50    
51     internal static ExporterInfo ReadFromNative(native.ExporterInfo native)
52     {
53 william 86 try
54     {
55 william 71 ExporterInfo managed = new ExporterInfo();
56     managed.exporterName = string.IsNullOrEmpty(native.ExporterName) ? "{null}" : native.ExporterName;
57     managed.exporterMajorRevision = native.ExporterMajorRevision;
58     managed.exporterMinorRevision = native.ExporterMinorRevision;
59     managed.exporterCustomization = native.ExporterCustomization;
60     managed.exporterBuildNumber = native.ExporterBuildNumber;
61     return managed;
62 william 86 }
63 william 106 catch (Exception ex)
64 william 86 {
65 william 95 StackTrace st = new StackTrace(true);
66 william 102 #if ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
67 william 106 Granny2ExceptionWriter.WriteToConsole(ex,st);
68 william 102 #endif
69 william 86 return default(ExporterInfo);
70     }
71 william 71 }
72    
73     #region IExporterInfo Members
74     public string ExporterName { get { return exporterName; } set { exporterName = value; } }
75     public granny_int32 ExporterMajorRevision { get { return exporterMajorRevision; } set { exporterMajorRevision = value; } }
76     public granny_int32 ExporterMinorRevision { get { return exporterMinorRevision; } set { exporterMinorRevision = value; } }
77     public granny_int32 ExporterCustomization { get { return exporterCustomization; } set { exporterCustomization = value; } }
78     public granny_int32 ExporterBuildNumber { get { return exporterBuildNumber; } set { exporterBuildNumber = value; } }
79     #endregion
80 william 79
81     #region INativePointer Members
82     private IntPtr _NativePointer;
83     public IntPtr NativePointer { get { return _NativePointer; } set { _NativePointer = value; } }
84     #endregion
85 william 82
86     #region IExtendedData Members
87     private IntPtr _ExtendedData;
88     public IntPtr ExtendedData { get { return _ExtendedData; } set { _ExtendedData = value; } }
89     #endregion
90 william 71 }
91     }