public switchSoft(FILEUTILS fileutils)
 {
     this.fileutils = fileutils;
     softName       = "ShutdownAndMouse.exe";
     string[] files = fileutils.searchFile(fileutils.ShutdownSoftFolderName, softName);
     version = files.OrderByDescending(path => File.GetLastWriteTime(path)).FirstOrDefault();
 }
        public OFFICE(FILEUTILS fileutils)
        {
            this.fileutils = fileutils;
            //search "Softs" floder for soft path, if exist multiple version, select the newer one
            string softName       = "Setup.exe";
            string second_keyword = "office";

            string[] files = fileutils.searchFile(fileutils.path, softName, second_keyword);
            version   = files.OrderByDescending(path => File.GetLastWriteTime(path)).FirstOrDefault();
            officeDir = System.IO.Path.GetDirectoryName(version);
            //office crack tool
            softName   = "Office 2010 Toolkit.exe";
            files      = fileutils.searchFile(fileutils.path, softName);
            toolkit    = files.OrderByDescending(path => File.GetLastWriteTime(path)).FirstOrDefault();
            toolkitDir = System.IO.Path.GetDirectoryName(toolkit);
        }
 public PlusbeZK(FILEUTILS fileutils)
 {
     this.fileutils = fileutils;
     if (Directory.Exists(fileutils.PlusbeZKFolderName))
     {
         KeyPath = fileutils.searchFile(fileutils.PlusbeZKFolderName, "key.txt")[0];
         //SN= HardJM.GetSN();
         //Key= HardJM.GetKey();
         SetConfigPath = fileutils.searchFile(fileutils.PlusbeZKFolderName, "SetConfig.xml")[0];
         SetConfig     = File.ReadAllText(SetConfigPath, System.Text.Encoding.Default);
         SoftPath      = fileutils.searchFile(fileutils.PlusbeZKFolderName, Soft)[0];
         XmlNodeList nodeList;
         xml.Load(SetConfigPath);
         nodeList   = xml.GetElementsByTagName("SetConfig");
         ParentNode = nodeList[0];
     }
 }
Example #4
0
        public FLASH(FILEUTILS fileutils)
        {
            this.fileutils = fileutils;
            //search "Softs" floder for soft path, if exist multiple version, select the newer one
            string softName = "*flash*.exe";

            files = fileutils.searchFile(fileutils.path, softName);
            //version = files.OrderByDescending(path => File.GetLastWriteTime(path)).FirstOrDefault();
        }
Example #5
0
 public KLITE(FILEUTILS fileutils)
 {
     this.fileutils = fileutils;
     //search "Softs" floder for soft path, if exist multiple version, select the newer one
     SoftName = "*K-Lite*.exe";
     string[] files = fileutils.searchFile(fileutils.path, SoftName);
     version  = files.OrderByDescending(path => File.GetLastWriteTime(path)).FirstOrDefault();
     SoftName = version.Split('\\').Last();
 }
Example #6
0
        public ProgramManager(FILEUTILS fileutils)
        {
            this.fileutils = fileutils;
            string fileName = @"\execludePublisher.txt";

            excludePublishers = File.ReadAllLines(fileutils.path + fileName, System.Text.Encoding.Default);
            string softName = "Unlocker.exe";

            string[] files = fileutils.searchFile(fileutils.path, softName);
            version = files.OrderByDescending(path => File.GetLastWriteTime(path)).FirstOrDefault();
        }
        public List <SHORTCUT> GetStartupList()
        {
            List <SHORTCUT> StartupItems = new List <SHORTCUT>();

            string[] StartupFolders =
            {
                System.Environment.GetFolderPath(Environment.SpecialFolder.CommonStartup),
                System.Environment.GetFolderPath(Environment.SpecialFolder.Startup)
            };
            string[] StartupRegistrys =
            {
                @"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run",
                @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run",
                @"HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Run",
            };
            foreach (string path in StartupFolders)
            {
                string[] lnks = fileutils.searchFile(path, "*.lnk", null, false);
                foreach (string lnk in lnks)
                {
                    SHORTCUT item = new SHORTCUT();
                    item.name   = System.IO.Path.GetFileName(lnk);
                    item.target = fileutils.GetShortcutTargetFile(lnk);
                    item.type   = "lnk";
                    item.path   = lnk;
                    StartupItems.Add(item);
                }
            }
            registry regedit = new registry();

            foreach (string reg in StartupRegistrys)
            {
                RegistryKey OurKey = regedit.open(reg);
                foreach (string Keyname in OurKey.GetValueNames())
                {
                    string   Keyvalue = OurKey.GetValue(Keyname).ToString();
                    SHORTCUT item     = new SHORTCUT();
                    item.name   = Keyname;
                    item.target = Keyvalue;
                    item.type   = "reg";
                    item.path   = OurKey + @"\" + Keyname;
                    StartupItems.Add(item);
                }
            }
            return(StartupItems);
        }
Example #8
0
        //main process
        public MainWindow()
        {
            //ProgramManager initialize
            InitializeComponent();
            ((INotifyCollectionChanged)lv_uninstalled.Items).CollectionChanged  += uninstalled_CollectionChanged;
            ((INotifyCollectionChanged)lv_dellnk.Items).CollectionChanged       += dellnk_CollectionChanged;
            ((INotifyCollectionChanged)lv_delstartmenu.Items).CollectionChanged += delstartmenu_CollectionChanged;

            //background process initialize
            m_BackgroundWorker = new BackgroundWorker();          // 实例化后台对象
            m_BackgroundWorker.WorkerReportsProgress      = true; // 设置可以通告进度
            m_BackgroundWorker.WorkerSupportsCancellation = true; // 设置可以取消
            m_BackgroundWorker.DoWork             += new DoWorkEventHandler(DoWork);
            m_BackgroundWorker.ProgressChanged    += new ProgressChangedEventHandler(UpdateProgress);
            m_BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CompletedWork);

            //ConsoleManager initialize
            ConsoleManager.Toggle();

            //ProgramManager initialize
            //ShortcutManager() must init before programManager()
            shortcutManager();
            programManager();


            //config store initialize
            tb_ip.Text = cfg.tb_ip;

            /*TreeViewItem item = (TreeViewItem)treeview_IP.SelectedItem;
             * IPDISTRIBUTION device=(IPDISTRIBUTION) item.Tag;
             * tb_ip.Text = device.ip;*/
            tb_gateway.Text               = cfg.tb_gateway;
            cb_waken.IsChecked            = cfg.cb_waken;
            cb_firewall.IsChecked         = cfg.cb_firewall;
            cb_ip.IsChecked               = cfg.cb_ip;
            cb_gateway.IsChecked          = cfg.cb_gateway;
            cb_swsoft_startup.IsChecked   = cfg.cb_swsoft_startup;
            cb_swsoft_privilege.IsChecked = cfg.cb_swsoft_privilege;
            cb_vnc.IsChecked              = cfg.cb_vnc;
            cb_klite.IsChecked            = cfg.cb_klite;
            cb_office.IsChecked           = cfg.cb_office;
            cb_power.IsChecked            = cfg.cb_power;
            cb_zoom.IsChecked             = cfg.cb_zoom;

            //flashdisk relate initialize
            //total path of self;
            string path = System.Reflection.Assembly.GetEntryAssembly().Location;

            string[] array       = path.Split(new[] { @"\" }, StringSplitOptions.None);
            string   name        = array.Last();
            string   folder      = path.Replace(name, "");
            string   currentdisk = array[0];

            currentdisk = Regex.Match(currentdisk, @"\w").Groups[0].Value;
            DriveInfo[] allDrives = DriveInfo.GetDrives();
            foreach (DriveInfo d in allDrives)
            {
                string disk = Regex.Match(d.Name, @"\w").Groups[0].Value;
                if (disk == currentdisk)
                {
                    if (d.DriveType.ToString() == "Removable")
                    {
                        //Copy file prompt
                        Prompt prompt = new Prompt(fileutils);
                        prompt.ShowDialog();
                        //System.Windows.Forms.MessageBox.Show("本软件目前运行与U盘,是否复制到" + fileutils.target + ",并打开文件夹?");
                        if (System.Windows.Forms.MessageBox.Show("Yes or no", "本软件目前运行与U盘,是否复制到" + fileutils.target + ",并打开文件夹?",
                                                                 MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                                                 MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                        {
                            fileutils.copyFolder(folder, fileutils.target);
                        }    // opens the folder in explorer
                        System.Diagnostics.Process.Start(fileutils.target);
                        System.Environment.Exit(1);
                    }
                    else
                    {
                        string drive = System.IO.Path.GetPathRoot(fileutils.path);
                        if (System.Windows.Forms.MessageBox.Show("Yes or no", "复制\"开关机软件\"/\"中控客户端\"到" + drive,
                                                                 MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                                                 MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                        {
                            fileutils.copyFolder(fileutils.path + @"\softs", drive);
                        }
                    }
                }
                if (d.DriveType.ToString() == "Removable")
                {
                    flashdisk = d;
                    string   keyword = "*IP分配*.txt";
                    string[] files   = fileutils.searchFile(flashdisk.Name + @"部署工具", keyword);
                    string   file    = files.OrderByDescending(pathx => File.GetLastWriteTime(pathx)).FirstOrDefault();
                    tb_ipfile.Text = file;
                    tb_save.Text   = tb_ipfile.Text;
                    IPDistribution();
                }
            }
        }