private void CreateAdapterFiles(DeviceInfo deviceInfo) { string path = Paths.ADAPTERS; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string newPath = Path.Combine(path, deviceInfo.DeviceName); Directory.CreateDirectory(newPath); foreach (var file in Directory.GetFiles(deviceInfo.AdapterPath)) { string filename = Path.GetFileName(file); File.Copy(file, Path.Combine(newPath, filename), true); } string iniPath = Path.Combine(newPath, "adapter.ini"); string serviceName = deviceInfo.DeviceName + "-Adapter"; AdapterPort.Set(iniPath, deviceInfo.AdapterPort); AdapterFocusHost.Set(iniPath, deviceInfo.AdapterFocasIp); AdapterSeviceName.Set(iniPath, serviceName); string exePath = Path.Combine(newPath, "adapter.exe"); AdapterManagement.Install(exePath); AdapterManagement.Start(serviceName); }
public static AdapterInfo Read(string path) { var info = new AdapterInfo(); info.Path = path; info.DeviceName = Directory.GetParent(path).Name; info.ServiceName = AdapterSeviceName.Get(path); info.Port = AdapterPort.Get(path); info.FocusHost = AdapterFocusHost.Get(path); return(info); }