External/Aga.Controls/ResourceHelper.cs
author moel.mich
Tue, 30 Dec 2014 22:47:39 +0000
changeset 431 0e46e3ca812a
permissions -rw-r--r--
Fixed the following issue (present only on 32-bit systems):

Version: 0.7.0.0

System.NullReferenceException: Object reference not set to an instance of an object.
at OpenHardwareMonitor.GUI.MainForm.timer_Tick(Object sender, EventArgs e)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Common Language Runtime: 4.0.30319.18444
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
Process Type: 32-Bit
     1 using System;
     2 using System.IO;
     3 using System.Reflection;
     4 using System.Windows.Forms;
     5 using System.Collections.Generic;
     6 using System.Text;
     7 
     8 namespace Aga.Controls
     9 {
    10     public static class ResourceHelper
    11     {
    12         // VSpilt Cursor with Innerline (symbolisize hidden column)
    13         private static Cursor _dVSplitCursor = GetCursor(Properties.Resources.DVSplit);
    14         public static Cursor DVSplitCursor
    15         {
    16             get { return _dVSplitCursor; }
    17         }
    18 
    19 		private static GifDecoder _loadingIcon = GetGifDecoder(Properties.Resources.loading_icon);
    20 		public static GifDecoder LoadingIcon
    21 		{
    22 			get { return _loadingIcon; }
    23 		}
    24 
    25         /// <summary>
    26         /// Help function to convert byte[] from resource into Cursor Type 
    27         /// </summary>
    28         /// <param name="data"></param>
    29         /// <returns></returns>
    30         private static Cursor GetCursor(byte[] data)
    31         {
    32             using (MemoryStream s = new MemoryStream(data))
    33                 return new Cursor(s);
    34         }
    35 
    36 		/// <summary>
    37 		/// Help function to convert byte[] from resource into GifDecoder Type 
    38 		/// </summary>
    39 		/// <param name="data"></param>
    40 		/// <returns></returns>
    41 		private static GifDecoder GetGifDecoder(byte[] data)
    42 		{
    43 			using(MemoryStream ms = new MemoryStream(data))
    44 				return new GifDecoder(ms, true);
    45 		}
    46 
    47     }
    48 }