Пример #1
0
 public static List <RemoteMachine> Load(IniFile iniFile, string type, string kongge)
 {
     string[] infos = iniFile.ReadAllSectionNames();
     if (infos != null)
     {
         List <RemoteMachine> macs = new List <RemoteMachine>();
         foreach (string info in infos)
         {
             string        section = info.Substring(7, info.Length - 8);
             RemoteMachine mac     = RemoteMachine.Load(section, iniFile);
             //如果类型=选择类型,显示列表之中添加
             if (type == "默认")
             {
                 macs.Add(mac);
             }
             else
             if (mac.Type == type)
             {
                 macs.Add(mac);
             }
         }
         return(macs);
     }
     return(null);
 }
Пример #2
0
 public static List <RemoteMachine> Load(IniFile iniFile)
 {
     string[] infos = iniFile.ReadAllSectionNames();
     if (infos != null)
     {
         List <RemoteMachine> macs = new List <RemoteMachine>();
         foreach (string info in infos)
         {
             string        section = info.Substring(7, info.Length - 8);
             RemoteMachine mac     = RemoteMachine.Load(section, iniFile);
             macs.Add(mac);
         }
         return(macs);
     }
     return(null);
 }
Пример #3
0
        private void LoadIni(string path)
        {
            inipath = path;
            ini     = new IniFile(path);
            macs    = RemoteMachine.Load(ini);
            iRemoteDesktop.DropDownItems.Clear();
            iRemoteProcess.DropDownItems.Clear();
            iRemoteService.DropDownItems.Clear();
            iRemoteWMI.DropDownItems.Clear();
            iEdit.DropDownItems.Clear();

            if (macs != null)
            {
                foreach (RemoteMachine mac in macs)
                {
                    ToolStripMenuItem edit = new ToolStripMenuItem(mac.DesktopName);
                    edit.Tag    = mac;
                    edit.Click += edit_Click;
                    iEdit.DropDownItems.Add(edit);
                    ToolStripMenuItem wmi = new ToolStripMenuItem(mac.DesktopName);
                    wmi.Tag = mac;
                    iRemoteWMI.DropDownItems.Add(wmi);
                    wmi.Click += wmi_Click;
                    if (mac.RemoteAble)
                    {
                        ToolStripMenuItem desktop = new ToolStripMenuItem(mac.DesktopName);
                        desktop.Tag = mac;
                        iRemoteDesktop.DropDownItems.Add(desktop);
                        desktop.Click += desktop_Click;
                    }
                    if (mac.ShowProcess)
                    {
                        ToolStripMenuItem process = new ToolStripMenuItem(mac.DesktopName);
                        process.Tag = mac;
                        iRemoteProcess.DropDownItems.Add(process);
                        process.Click += process_Click;
                    }
                    if (mac.ShowService)
                    {
                        ToolStripMenuItem service = new ToolStripMenuItem(mac.DesktopName);
                        service.Tag = mac;
                        iRemoteService.DropDownItems.Add(service);
                        service.Click += service_Click;
                    }
                }
            }
        }