comparison org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/program/Program.d @ 9:950d84783eac

Removing direct tango deps.
author Frank Benoit <benoit@tionex.de>
date Mon, 09 Mar 2009 14:26:40 +0100
parents 6dd524f61e62
children d46287db17ed
comparison
equal deleted inserted replaced
8:2847134a5fc0 9:950d84783eac
16 import org.eclipse.swt.graphics.Image; 16 import org.eclipse.swt.graphics.Image;
17 import org.eclipse.swt.graphics.ImageData; 17 import org.eclipse.swt.graphics.ImageData;
18 import org.eclipse.swt.internal.win32.OS; 18 import org.eclipse.swt.internal.win32.OS;
19 19
20 import java.lang.all; 20 import java.lang.all;
21 static import tango.text.convert.Utf;
22 21
23 /** 22 /**
24 * Instances of this class represent programs and 23 * Instances of this class represent programs and
25 * their associated file extensions in the operating 24 * their associated file extensions in the operating
26 * system. 25 * system.
55 if (!OS.IsWinCE && expand) { 54 if (!OS.IsWinCE && expand) {
56 int length_ = OS.ExpandEnvironmentStrings (pszOut.ptr, null, 0); 55 int length_ = OS.ExpandEnvironmentStrings (pszOut.ptr, null, 0);
57 if (length_ !is 0) { 56 if (length_ !is 0) {
58 TCHAR[] lpDst = NewTCHARs (0, length_); 57 TCHAR[] lpDst = NewTCHARs (0, length_);
59 OS.ExpandEnvironmentStrings (pszOut.ptr, lpDst.ptr, length_); 58 OS.ExpandEnvironmentStrings (pszOut.ptr, lpDst.ptr, length_);
60 return tango.text.convert.Utf.toString( lpDst[ 0 .. Math.max (0, length_ - 1) ] ); 59 return String_valueOf( lpDst[ 0 .. Math.max (0, length_ - 1) ] );
61 } else { 60 } else {
62 return ""; 61 return "";
63 } 62 }
64 } else { 63 } else {
65 return tango.text.convert.Utf.toString( pszOut[ 0 .. Math.max (0, pcchOut [0] - 1)]); 64 return String_valueOf( pszOut[ 0 .. Math.max (0, pcchOut [0] - 1)]);
66 } 65 }
67 } 66 }
68 return null; 67 return null;
69 } 68 }
70 69
172 if (!OS.IsWinCE && expand) { 171 if (!OS.IsWinCE && expand) {
173 length_ = OS.ExpandEnvironmentStrings (lpData.ptr, null, 0); 172 length_ = OS.ExpandEnvironmentStrings (lpData.ptr, null, 0);
174 if (length_ !is 0) { 173 if (length_ !is 0) {
175 TCHAR[] lpDst = NewTCHARs (0, length_); 174 TCHAR[] lpDst = NewTCHARs (0, length_);
176 OS.ExpandEnvironmentStrings (lpData.ptr, lpDst.ptr, length_); 175 OS.ExpandEnvironmentStrings (lpData.ptr, lpDst.ptr, length_);
177 result = tango.text.convert.Utf.toString ( lpDst[0 .. Math.max (0, length_ - 1) ] ); 176 result = String_valueOf ( lpDst[0 .. Math.max (0, length_ - 1) ] );
178 } 177 }
179 } else { 178 } else {
180 length_ = Math.max (0, lpData.length - 1); 179 length_ = Math.max (0, lpData.length - 1);
181 result = tango.text.convert.Utf.toString ( lpData[0 .. length_]); 180 result = String_valueOf ( lpData[0 .. length_]);
182 } 181 }
183 } 182 }
184 } 183 }
185 } 184 }
186 if (phkResult [0] !is null) OS.RegCloseKey (phkResult [0]); 185 if (phkResult [0] !is null) OS.RegCloseKey (phkResult [0]);
230 TCHAR[] lpName = NewTCHARs (0, 1024); 229 TCHAR[] lpName = NewTCHARs (0, 1024);
231 uint [1] lpcName; lpcName[0] = lpName.length; 230 uint [1] lpcName; lpcName[0] = lpName.length;
232 FILETIME ft; 231 FILETIME ft;
233 int dwIndex = 0, count = 0; 232 int dwIndex = 0, count = 0;
234 while (OS.RegEnumKeyEx (cast(void*)OS.HKEY_CLASSES_ROOT, dwIndex, lpName.ptr, lpcName.ptr, null, null, null, &ft) !is OS.ERROR_NO_MORE_ITEMS) { 233 while (OS.RegEnumKeyEx (cast(void*)OS.HKEY_CLASSES_ROOT, dwIndex, lpName.ptr, lpcName.ptr, null, null, null, &ft) !is OS.ERROR_NO_MORE_ITEMS) {
235 String path = tango.text.convert.Utf.toString ( lpName[0 .. lpcName [0]]); 234 String path = String_valueOf ( lpName[0 .. lpcName [0]]);
236 lpcName [0] = lpName.length ; 235 lpcName [0] = lpName.length ;
237 Program program = getProgram (path, null); 236 Program program = getProgram (path, null);
238 if (program !is null) { 237 if (program !is null) {
239 if (count is programs.length) { 238 if (count is programs.length) {
240 Program [] newPrograms = new Program [programs.length + 1024]; 239 Program [] newPrograms = new Program [programs.length + 1024];