Index: /trunk/MacFaceFloat/AssemblyInfo.cs
===================================================================
--- /trunk/MacFaceFloat/AssemblyInfo.cs	(revision 72)
+++ /trunk/MacFaceFloat/AssemblyInfo.cs	(revision 73)
@@ -12,5 +12,5 @@
 [assembly: AssemblyCompany("Team MacFace")]
 [assembly: AssemblyProduct("MacFace for Windows")]
-[assembly: AssemblyCopyright("c 2005 Team MacFace, All rights reserved.")]
+[assembly: AssemblyCopyright("Copyright c 2005-2006 Team MacFace, All rights reserved.")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]		
@@ -27,5 +27,5 @@
 // rh¨æÑrWÔðùèlÉ·é±ÆªÅ«Ü·B
 
-[assembly: AssemblyInformationalVersion("At@Å(2005-09-09)")]
+[assembly: AssemblyInformationalVersion("At@Å(2005-09-09)+p3")]
 [assembly: AssemblyVersion("1.0.*")]
 
Index: /trunk/MacFaceFloat/MacFaceApp.cs
===================================================================
--- /trunk/MacFaceFloat/MacFaceApp.cs	(revision 72)
+++ /trunk/MacFaceFloat/MacFaceApp.cs	(revision 73)
@@ -39,4 +39,5 @@
 		private MenuItem menuItemTogglePatternWindow;
 		private MenuItem menuItemToggleStatusWindow;
+		private MacFace.FaceDef curFaceDef;
 
 		[STAThread]
@@ -51,8 +52,20 @@
 			config = Configuration.GetInstance();
 			config.Load();
-
+			
 			cpuStats = new CPUStatistics(81);
 			memStats = new MemoryStatistics(81);
 			pageio_count = 0;
+			// XXX: Îû@ªA·¬ÈÌð½Æ©·é
+			try 
+			{
+				// µÉJE^ðÀsµÄÝé
+				cpuStats.Update();
+			} 
+			catch (System.ComponentModel.Win32Exception e) 
+			{
+				// _¾Á½ÌÅptH[}XJE^ðgíÈ¢û@Ö
+				cpuStats = new CPUStatisticsGetSystemTime(61);
+				memStats = new MemoryStatisticsPSAPI(61);
+			}
 
 			updateTimer = new System.Windows.Forms.Timer();
@@ -125,5 +138,5 @@
 			if (!result)
 			{
-				string path = Path.Combine(Application.StartupPath, "default.plist");
+				string path = Path.Combine(Application.StartupPath, "default.mcface");
 
 				if (!LoadFaceDefine(path))
@@ -190,4 +203,6 @@
 				return false;
 			}
+			
+			curFaceDef = newFaceDef;
 
 			if (patternWindow != null) 
@@ -269,5 +284,6 @@
 			patternWindow.TransparentMouseMessage = config.TransparentMouseMessage;
 
-			LoadFaceDefine(config.FaceDefPath);
+			//LoadFaceDefine(config.FaceDefPath);
+			patternWindow.FaceDef = curFaceDef;
 
 			patternWindow.Show();
Index: /trunk/MacFaceFloat/PatternWindow.cs
===================================================================
--- /trunk/MacFaceFloat/PatternWindow.cs	(revision 72)
+++ /trunk/MacFaceFloat/PatternWindow.cs	(revision 73)
@@ -80,4 +80,5 @@
 			Graphics g = this.Graphics;
 			g.Clear(Color.FromArgb(0, 0, 0, 0));
+			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
 			curFaceDef.DrawPatternImage(g, curSuite, curPattern, curMarkers, patternSize);
 			base.Refresh();
Index: /trunk/MacFaceLibrary/CPUStatistics.cs
===================================================================
--- /trunk/MacFaceLibrary/CPUStatistics.cs	(revision 72)
+++ /trunk/MacFaceLibrary/CPUStatistics.cs	(revision 73)
@@ -5,5 +5,5 @@
 {
 	/// <summary>
-	/// CPUStats ÌTvÌà¾Å·B
+	/// CPUStats nngY
 	/// </summary>
 	public class CPUStatistics
@@ -71,5 +71,5 @@
 		}
 
-		protected CPUUsage NextValue()
+		protected virtual CPUUsage NextValue()
 		{
 			int user   = (int)userCounter.NextValue();
Index: /trunk/MacFaceLibrary/CPUStatisticsGetSystemTime.cs
===================================================================
--- /trunk/MacFaceLibrary/CPUStatisticsGetSystemTime.cs	(revision 73)
+++ /trunk/MacFaceLibrary/CPUStatisticsGetSystemTime.cs	(revision 73)
@@ -0,0 +1,54 @@
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace MacFace
+{
+	/// <summary>
+	/// CPUStatisticsGetSystemTime nngY
+	/// </summary>
+	public class CPUStatisticsGetSystemTime : CPUStatistics
+	{
+			
+		UInt64 idleTimePrev = 0;
+		UInt64 kernelTimePrev = 0;
+		UInt64 userTimePrev = 0;
+
+		public CPUStatisticsGetSystemTime(int historySize) : base(historySize)
+		{
+			NextValue();
+		}
+
+		protected override CPUUsage NextValue()
+		{
+			UInt64 idleTime;
+			UInt64 kernelTime;
+			UInt64 userTime;
+
+			GetSystemTimes(out idleTime, out kernelTime, out userTime);
+				
+			Int32 idleTimeDiff = (Int32)(idleTime - idleTimePrev);
+			Int32 userTimeDiff = (Int32)(userTime - userTimePrev);
+			Int32 kernelTimeDiff = (Int32)(kernelTime - kernelTimePrev);
+			Int32 systemTimeDiff = (Int32)(userTimeDiff + kernelTimeDiff);
+
+			idleTimePrev = idleTime;
+			kernelTimePrev = kernelTime;
+			userTimePrev = userTime;
+
+			return new CPUUsage(
+				(Int32)(100 - ((Double)idleTimeDiff / userTimePrev) * 100),
+				(Int32)(100 - ((Double)idleTimeDiff / kernelTimePrev) * 100),
+				(Int32)(((Double)idleTimeDiff / (systemTimeDiff)) * 100)
+			);
+		}
+
+		[DllImport("kernel32.dll")]
+		private extern static Boolean GetSystemTimes(
+			out UInt64 lpIdleTime,
+			out UInt64 lpKernelTime,
+			out UInt64 lpUserTime
+		);
+
+	}
+}
Index: /trunk/MacFaceLibrary/MacFaceLibrary.csproj
===================================================================
--- /trunk/MacFaceLibrary/MacFaceLibrary.csproj	(revision 72)
+++ /trunk/MacFaceLibrary/MacFaceLibrary.csproj	(revision 73)
@@ -105,4 +105,9 @@
                 />
                 <File
+                    RelPath = "CPUStatisticsGetSystemTime.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "CPUUsage.cs"
                     SubType = "Code"
@@ -121,4 +126,9 @@
                 <File
                     RelPath = "MemoryStatistics.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "MemoryStatisticsPSAPI.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
Index: /trunk/MacFaceLibrary/MemoryStatistics.cs
===================================================================
--- /trunk/MacFaceLibrary/MemoryStatistics.cs	(revision 72)
+++ /trunk/MacFaceLibrary/MemoryStatistics.cs	(revision 73)
@@ -5,5 +5,5 @@
 {
 	/// <summary>
-	/// MemoryStatistics ÌTvÌà¾Å·B
+	/// MemoryStatistics nngY
 	/// </summary>
 	public class MemoryStatistics
@@ -110,5 +110,5 @@
 		}
 
-		public ulong CommitLimit 
+		public virtual ulong CommitLimit 
 		{
 			get { return (ulong)commitLimitCounter.NextValue(); }
@@ -124,5 +124,5 @@
 		}
 
-		protected MemoryUsage NextValue()
+		protected virtual MemoryUsage NextValue()
 		{
 			int available      = (int)availableCounter.NextValue();
Index: /trunk/MacFaceLibrary/MemoryStatisticsPSAPI.cs
===================================================================
--- /trunk/MacFaceLibrary/MemoryStatisticsPSAPI.cs	(revision 73)
+++ /trunk/MacFaceLibrary/MemoryStatisticsPSAPI.cs	(revision 73)
@@ -0,0 +1,84 @@
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+namespace MacFace
+{
+	/// <summary>
+	/// MemoryStatisticsPSAPI ÌTvÌà¾Å·B
+	/// </summary>
+	public class MemoryStatisticsPSAPI : MemoryStatistics
+	{
+		public MemoryStatisticsPSAPI(int historySize) : base(historySize)
+		{
+		}
+
+		public override ulong CommitLimit 
+		{
+			get
+			{
+				Unmanaged.PERFORMANCE_INFORMATION pInfo;
+				pInfo.cb = (UInt32)Marshal.SizeOf(typeof(Unmanaged.PERFORMANCE_INFORMATION));
+				Unmanaged.GetPerformanceInfo(out pInfo, (UInt32)Marshal.SizeOf(typeof(Unmanaged.PERFORMANCE_INFORMATION)));
+				
+				return (ulong)pInfo.CommitLimit * pInfo.PageSize;
+			}
+		}
+
+		protected override MemoryUsage NextValue()
+		{
+			Unmanaged.PERFORMANCE_INFORMATION pInfo;
+			pInfo.cb = (UInt32)Marshal.SizeOf(typeof(Unmanaged.PERFORMANCE_INFORMATION));
+			Unmanaged.GetPerformanceInfo(out pInfo, (UInt32)Marshal.SizeOf(typeof(Unmanaged.PERFORMANCE_INFORMATION)));
+
+			int available      = (int)(pInfo.PhysicalAvailable * pInfo.PageSize);
+			int committed      = (int)(pInfo.CommitTotal * pInfo.PageSize);
+			
+			// TODO:
+			int pagein	       = (int)0;
+			int pageout        = (int)0;
+
+			int systemCache    = (int)(pInfo.SystemCache * pInfo.PageSize);
+			int kernelPaged    = (int)(pInfo.KernelPaged * pInfo.PageSize);
+			int kernelNonPaged = (int)(pInfo.KernelNonpaged * pInfo.PageSize);
+
+			// XXX: Æè ¦¸ÐûÉUèª¯ÄµÜ¤
+			// int kernelTotal = usage.KernelNonPaged + usage.KernelPaged + usage.DriverTotal + usage.SystemCodeTotal;
+			int driverTotal    = (int)0;
+			int systemCodeTotal = (int)((pInfo.KernelTotal - (pInfo.KernelNonpaged + pInfo.KernelPaged)) * pInfo.PageSize);
+
+			return new MemoryUsage(available, committed, pagein, pageout,
+				systemCache, kernelPaged, kernelNonPaged, driverTotal, systemCodeTotal);
+		}
+
+		private class Unmanaged
+		{
+			[DllImport("psapi.dll")]
+			public extern static Boolean GetPerformanceInfo(
+				[Out] out PERFORMANCE_INFORMATION pPerformanceInformation,
+				[In]  UInt32 cb
+			);
+			
+			[StructLayout(LayoutKind.Sequential)]
+			public struct PERFORMANCE_INFORMATION
+			{
+				public UInt32 cb;
+				// SIZE_T -> UInt32 (x86)
+				public UInt32 CommitTotal;
+				public UInt32 CommitLimit;
+				public UInt32 CommitPeak;
+				public UInt32 PhysicalTotal;
+				public UInt32 PhysicalAvailable;
+				public UInt32 SystemCache;
+				public UInt32 KernelTotal;
+				public UInt32 KernelPaged;
+				public UInt32 KernelNonpaged;
+				public UInt32 PageSize;
+				public UInt32 HandleCount;
+				public UInt32 ProcessCount;
+				public UInt32 ThreadCount;
+			}
+		}
+
+	}
+}
Index: /trunk/MacFaceLibrary/PropertyList.cs
===================================================================
--- /trunk/MacFaceLibrary/PropertyList.cs	(revision 72)
+++ /trunk/MacFaceLibrary/PropertyList.cs	(revision 73)
@@ -25,4 +25,5 @@
 			reader.XmlResolver = null;
 			doc.Load(reader);
+			reader.Close();
 
 			return ReadDictionary(doc.DocumentElement.FirstChild);
