Make Gst.Version a static class

This commit is contained in:
Sebastian Dröge 2009-04-07 10:31:03 +02:00
parent 867973a0bf
commit c073068ad4
2 changed files with 14 additions and 31 deletions

View file

@ -77,18 +77,6 @@ namespace Gst
} }
} }
private static Version version = null;
public static Version Version {
get {
if(version == null) {
version = new Version();
}
return version;
}
}
[DllImport("gstreamer-0.10")] [DllImport("gstreamer-0.10")]
private static extern void gst_init(ref int argc, ref IntPtr argv); private static extern void gst_init(ref int argc, ref IntPtr argv);

View file

@ -12,27 +12,22 @@ using System.Runtime.InteropServices;
namespace Gst namespace Gst
{ {
public class Version public static class Version
{ {
private uint major; private static uint major;
private uint minor; private static uint minor;
private uint micro; private static uint micro;
private uint nano; private static uint nano;
private string version_string; private static string version_string;
internal Version() static Version()
{ {
gst_version(out major, out minor, out micro, out nano); gst_version(out major, out minor, out micro, out nano);
} }
public override string ToString() public static string Description {
{
return String.Format("{0}.{1}.{2}.{3}", major, minor, micro, nano);
}
public string Description {
get { get {
if(version_string == null) { if (version_string == null) {
IntPtr version_string_ptr = gst_version_string(); IntPtr version_string_ptr = gst_version_string();
version_string = GLib.Marshaller.Utf8PtrToString(version_string_ptr); version_string = GLib.Marshaller.Utf8PtrToString(version_string_ptr);
} }
@ -41,19 +36,19 @@ namespace Gst
} }
} }
public uint Major { public static uint Major {
get { return major; } get { return major; }
} }
public uint Minor { public static uint Minor {
get { return minor; } get { return minor; }
} }
public uint Micro { public static uint Micro {
get { return micro; } get { return micro; }
} }
public uint Nano { public static uint Nano {
get { return nano; } get { return nano; }
} }