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, 2 months ago) by william
File size: 3653 byte(s)
Log Message:
implement Granny2ExceptionWriter

File Contents

# Content
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using gr2lib.core.helpers;
5 using gr2lib.core.typedefs;
6 using gr2lib.core.interfaces;
7 using System.Diagnostics;
8 using gr2lib.core.exceptions;
9 namespace gr2lib.core.coretypes.implementation
10 {
11
12 public class ExporterInfo : IExporterInfo
13 {
14 private string exporterName;
15 private int exporterMajorRevision;
16 private int exporterMinorRevision;
17 private int exporterCustomization;
18 private int exporterBuildNumber;
19
20
21 public ExporterInfo()
22 {
23 this.ExporterName = "";
24 this.ExporterMajorRevision = 0;
25 this.ExporterMinorRevision = 0;
26 this.ExporterCustomization = 0;
27 this.ExporterBuildNumber = 0;
28 //this.ExtendedData = IntPtr.Zero;
29 //this.NativePointer = IntPtr.Zero;
30 }
31 internal static ExporterInfo ReadFromMemory(IntPtr pointer)
32 {
33 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 catch (Exception ex)
42 {
43 StackTrace st = new StackTrace(true);
44 #if ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
45 Granny2ExceptionWriter.WriteToConsole(ex,st);
46 #endif
47 return default(ExporterInfo);
48 }
49 }
50
51 internal static ExporterInfo ReadFromNative(native.ExporterInfo native)
52 {
53 try
54 {
55 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 }
63 catch (Exception ex)
64 {
65 StackTrace st = new StackTrace(true);
66 #if ENABLE_EXCEPTION_OUTPUT_TO_CONSOLE
67 Granny2ExceptionWriter.WriteToConsole(ex,st);
68 #endif
69 return default(ExporterInfo);
70 }
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
81 #region INativePointer Members
82 private IntPtr _NativePointer;
83 public IntPtr NativePointer { get { return _NativePointer; } set { _NativePointer = value; } }
84 #endregion
85
86 #region IExtendedData Members
87 private IntPtr _ExtendedData;
88 public IntPtr ExtendedData { get { return _ExtendedData; } set { _ExtendedData = value; } }
89 #endregion
90 }
91 }