/[gr2lib]/trunk/gr2lib/core/coretypes/implementation/ExporterInfo.cs
ViewVC logotype

Contents of /trunk/gr2lib/core/coretypes/implementation/ExporterInfo.cs

Parent Directory Parent Directory | Revision Log Revision Log


Revision 102 - (show annotations) (download)
Sat Jul 17 13:54:18 2010 UTC (9 years, 4 months ago) by william
File size: 3568 byte(s)
add compiler directive to write exceptions to console or not

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

  ViewVC Help
Powered by ViewVC 1.1.22