Skip to content

Commit 6cf8424

Browse files
committed
Don't move copied back, we're in a RO box
1 parent 321c04b commit 6cf8424

File tree

1 file changed

+31
-48
lines changed

1 file changed

+31
-48
lines changed

plugin_Kinect360/Fixes/NotReadyFix.cs

Lines changed: 31 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -166,105 +166,88 @@ private async Task<bool> InstallDrivers(IProgress<InstallationProgress> progress
166166
Assembly.GetExecutingAssembly().Location)!.FullName, "Assets", "Resources", "Dependencies", "Drivers");
167167

168168
var driverTemp = (await ApplicationData.Current.TemporaryFolder.CreateFolderAsync(
169-
Guid.NewGuid().ToString().ToUpper(), CreationCollisionOption.OpenIfExists)).Path;
169+
"Drivers", CreationCollisionOption.OpenIfExists)).Path;
170+
171+
try
172+
{
173+
Directory.Delete(driverTemp, true);
174+
}
175+
catch (Exception ex)
176+
{
177+
Host.Log(ex);
178+
}
170179

171180
Directory.CreateDirectory(driverTemp);
172181

173182
// Device Driver
174183
{
175-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Device_cat"), Path.Combine(driverTemp, "kinect.cat"));
176-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Device_inf"), Path.Combine(driverTemp, "kinectdevice.inf"));
177-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Device_WdfCo"), Path.Combine(driverTemp, "WdfCoInstaller01009.dll"));
178-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Device_WinUsbCo"), Path.Combine(driverTemp, "WinUSBCoInstaller.dll"));
184+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Device_cat"), Path.Combine(driverTemp, "kinect.cat"));
185+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Device_inf"), Path.Combine(driverTemp, "kinectdevice.inf"));
186+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Device_WdfCo"), Path.Combine(driverTemp, "WdfCoInstaller01009.dll"));
187+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Device_WinUsbCo"), Path.Combine(driverTemp, "WinUSBCoInstaller.dll"));
179188

180189
progress.Report(new InstallationProgress
181190
{ IsIndeterminate = true, StageTitle = Host.RequestLocalizedString("/Plugins/Kinect360/Fixes/NotReady/Stage/InstallDeviceDriver") });
182191
AssignDriverToDeviceId("USB\\VID_045E&PID_02B0&REV_0107", Path.Combine(driverTemp, "kinectdevice.inf"), Host);
183192
progress.Report(new InstallationProgress
184193
{ IsIndeterminate = true, StageTitle = Host.RequestLocalizedString("/Plugins/Kinect360/Fixes/NotReady/Stage/InstallDeviceDriverSuccess") });
185-
186-
File.Move(Path.Combine(driverTemp, "kinect.cat"), Path.Combine(pathToDriversDirectory, "Driver_Device_cat"));
187-
File.Move(Path.Combine(driverTemp, "kinectdevice.inf"), Path.Combine(pathToDriversDirectory, "Driver_Device_inf"));
188-
File.Move(Path.Combine(driverTemp, "WdfCoInstaller01009.dll"), Path.Combine(pathToDriversDirectory, "Driver_Device_WdfCo"));
189-
File.Move(Path.Combine(driverTemp, "WinUSBCoInstaller.dll"), Path.Combine(pathToDriversDirectory, "Driver_Device_WinUsbCo"));
190194
}
191195

192196
// Audio Driver
193197
{
194-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Audio_cat"), Path.Combine(driverTemp, "kinect.cat"));
195-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Audio_inf"), Path.Combine(driverTemp, "kinectaudio.inf"));
196-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Audio_WdfCo"), Path.Combine(driverTemp, "WdfCoInstaller01009.dll"));
197-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Audio_WinUsbCo"), Path.Combine(driverTemp, "WinUSBCoInstaller.dll"));
198+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Audio_cat"), Path.Combine(driverTemp, "kinect.cat"));
199+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Audio_inf"), Path.Combine(driverTemp, "kinectaudio.inf"));
200+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Audio_WdfCo"), Path.Combine(driverTemp, "WdfCoInstaller01009.dll"));
201+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Audio_WinUsbCo"), Path.Combine(driverTemp, "WinUSBCoInstaller.dll"));
198202

199203
progress.Report(new InstallationProgress
200204
{ IsIndeterminate = true, StageTitle = Host.RequestLocalizedString("/Plugins/Kinect360/Fixes/NotReady/Stage/InstallAudioDriver") });
201205
SetupApi.InstallDriverFromInf(Path.Combine(driverTemp, "kinectaudio.inf"));
202206
progress.Report(new InstallationProgress
203207
{ IsIndeterminate = true, StageTitle = Host.RequestLocalizedString("/Plugins/Kinect360/Fixes/NotReady/Stage/InstallAudioDriverSuccess") });
204-
205-
File.Move(Path.Combine(driverTemp, "kinect.cat"), Path.Combine(pathToDriversDirectory, "Driver_Audio_cat"));
206-
File.Move(Path.Combine(driverTemp, "kinectaudio.inf"), Path.Combine(pathToDriversDirectory, "Driver_Audio_inf"));
207-
File.Move(Path.Combine(driverTemp, "WdfCoInstaller01009.dll"), Path.Combine(pathToDriversDirectory, "Driver_Audio_WdfCo"));
208-
File.Move(Path.Combine(driverTemp, "WinUSBCoInstaller.dll"), Path.Combine(pathToDriversDirectory, "Driver_Audio_WinUsbCo"));
209208
}
210209

211210
// Audio Array Driver
212211
{
213-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_AudioArray_cat"), Path.Combine(driverTemp, "kinect.cat"));
214-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_AudioArray_inf"), Path.Combine(driverTemp, "kinectaudioarray.inf"));
215-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_AudioArray_WdfCo"), Path.Combine(driverTemp, "WdfCoInstaller01009.dll"));
216-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_AudioArray_WinUsbCo"), Path.Combine(driverTemp, "WinUSBCoInstaller.dll"));
212+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_AudioArray_cat"), Path.Combine(driverTemp, "kinect.cat"));
213+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_AudioArray_inf"), Path.Combine(driverTemp, "kinectaudioarray.inf"));
214+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_AudioArray_WdfCo"), Path.Combine(driverTemp, "WdfCoInstaller01009.dll"));
215+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_AudioArray_WinUsbCo"), Path.Combine(driverTemp, "WinUSBCoInstaller.dll"));
217216

218217
progress.Report(new InstallationProgress
219218
{ IsIndeterminate = true, StageTitle = Host.RequestLocalizedString("/Plugins/Kinect360/Fixes/NotReady/Stage/InstallAudioArrayDriver") });
220219
AssignDriverToDeviceId("USB\\VID_045E&PID_02BB&REV_0100&MI_00", Path.Combine(driverTemp, "kinectaudioarray.inf"), Host);
221220
progress.Report(new InstallationProgress
222221
{ IsIndeterminate = true, StageTitle = Host.RequestLocalizedString("/Plugins/Kinect360/Fixes/NotReady/Stage/InstallAudioArrayDriverSuccess") });
223-
224-
File.Move(Path.Combine(driverTemp, "kinect.cat"), Path.Combine(pathToDriversDirectory, "Driver_AudioArray_cat"));
225-
File.Move(Path.Combine(driverTemp, "kinectaudioarray.inf"), Path.Combine(pathToDriversDirectory, "Driver_AudioArray_inf"));
226-
File.Move(Path.Combine(driverTemp, "WdfCoInstaller01009.dll"), Path.Combine(pathToDriversDirectory, "Driver_AudioArray_WdfCo"));
227-
File.Move(Path.Combine(driverTemp, "WinUSBCoInstaller.dll"), Path.Combine(pathToDriversDirectory, "Driver_AudioArray_WinUsbCo"));
228222
}
229223

230224
// Camera Driver
231225
{
232-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Camera_cat"), Path.Combine(driverTemp, "kinect.cat"));
233-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Camera_inf"), Path.Combine(driverTemp, "kinectcamera.inf"));
234-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Camera_sys"), Path.Combine(driverTemp, "kinectcamera.sys"));
235-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Camera_WdfCo"), Path.Combine(driverTemp, "WdfCoInstaller01009.dll"));
236-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Camera_WinUsbCo"), Path.Combine(driverTemp, "WinUSBCoInstaller.dll"));
226+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Camera_cat"), Path.Combine(driverTemp, "kinect.cat"));
227+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Camera_inf"), Path.Combine(driverTemp, "kinectcamera.inf"));
228+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Camera_sys"), Path.Combine(driverTemp, "kinectcamera.sys"));
229+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Camera_WdfCo"), Path.Combine(driverTemp, "WdfCoInstaller01009.dll"));
230+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Camera_WinUsbCo"), Path.Combine(driverTemp, "WinUSBCoInstaller.dll"));
237231

238232
progress.Report(new InstallationProgress
239233
{ IsIndeterminate = true, StageTitle = Host.RequestLocalizedString("/Plugins/Kinect360/Fixes/NotReady/Stage/InstallCameraDriver") });
240234
AssignDriverToDeviceId("USB\\VID_045E&PID_02AE&REV_010;", Path.Combine(driverTemp, "kinectcamera.inf"), Host);
241235
progress.Report(new InstallationProgress
242236
{ IsIndeterminate = true, StageTitle = Host.RequestLocalizedString("/Plugins/Kinect360/Fixes/NotReady/Stage/InstallCameraDriverSuccess") });
243-
244-
File.Move(Path.Combine(driverTemp, "kinect.cat"), Path.Combine(pathToDriversDirectory, "Driver_Camera_cat"));
245-
File.Move(Path.Combine(driverTemp, "kinectcamera.inf"), Path.Combine(pathToDriversDirectory, "Driver_Camera_inf"));
246-
File.Move(Path.Combine(driverTemp, "kinectcamera.sys"), Path.Combine(pathToDriversDirectory, "Driver_Camera_sys"));
247-
File.Move(Path.Combine(driverTemp, "WdfCoInstaller01009.dll"), Path.Combine(pathToDriversDirectory, "Driver_Camera_WdfCo"));
248-
File.Move(Path.Combine(driverTemp, "WinUSBCoInstaller.dll"), Path.Combine(pathToDriversDirectory, "Driver_Camera_WinUsbCo"));
249237
}
250238

251239
// Security Driver
252240
{
253-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Security_cat"), Path.Combine(driverTemp, "kinect.cat"));
254-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Security_inf"), Path.Combine(driverTemp, "kinectsecurity.inf"));
255-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Security_WdfCo"), Path.Combine(driverTemp, "WdfCoInstaller01009.dll"));
256-
File.Move(Path.Combine(pathToDriversDirectory, "Driver_Security_WinUsbCo"), Path.Combine(driverTemp, "WinUSBCoInstaller.dll"));
241+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Security_cat"), Path.Combine(driverTemp, "kinect.cat"));
242+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Security_inf"), Path.Combine(driverTemp, "kinectsecurity.inf"));
243+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Security_WdfCo"), Path.Combine(driverTemp, "WdfCoInstaller01009.dll"));
244+
File.Copy(Path.Combine(pathToDriversDirectory, "Driver_Security_WinUsbCo"), Path.Combine(driverTemp, "WinUSBCoInstaller.dll"));
257245

258246
progress.Report(new InstallationProgress
259247
{ IsIndeterminate = true, StageTitle = Host.RequestLocalizedString("/Plugins/Kinect360/Fixes/NotReady/Stage/InstallSecurityDriver") });
260248
AssignDriverToDeviceId("USB\\VID_045E&PID_02BB&REV_0100&MI_01", Path.Combine(driverTemp, "kinectsecurity.inf"), Host);
261249
progress.Report(new InstallationProgress
262250
{ IsIndeterminate = true, StageTitle = Host.RequestLocalizedString("/Plugins/Kinect360/Fixes/NotReady/Stage/InstallSecurityDriverSuccess") });
263-
264-
File.Move(Path.Combine(driverTemp, "kinect.cat"), Path.Combine(pathToDriversDirectory, "Driver_Security_cat"));
265-
File.Move(Path.Combine(driverTemp, "kinectsecurity.inf"), Path.Combine(pathToDriversDirectory, "Driver_Security_inf"));
266-
File.Move(Path.Combine(driverTemp, "WdfCoInstaller01009.dll"), Path.Combine(pathToDriversDirectory, "Driver_Security_WdfCo"));
267-
File.Move(Path.Combine(driverTemp, "WinUSBCoInstaller.dll"), Path.Combine(pathToDriversDirectory, "Driver_Security_WinUsbCo"));
268251
}
269252

270253
// Microphone driver

0 commit comments

Comments
 (0)