Пример #1
0
        private void buttonAddAutoBackupFile_Click(object sender, EventArgs e)
        {
            var prevPaths = new List <string>();
            List <BackupFileInfo> infos = new List <BackupFileInfo>();

            foreach (ListViewItem i in listBackup.Items)
            {
                prevPaths.Add(i.Text);
            }

            listBackup.Items.Clear();
            List <string> targetFolders = new List <string>()
            {
                PathHelper.ActConfigFolderPath, PathHelper.HojorinFolderPath
            };

            foreach (var path in targetFolders)
            {
                var files = Directory.EnumerateFiles(path, "*", SearchOption.AllDirectories);
                foreach (var f in files)
                {
                    if (!f.EndsWith(".config") && !f.EndsWith(".xml"))
                    {
                        continue;
                    }
                    if (f.Contains(@"\Config\Backup\"))
                    {
                        continue;
                    }

                    string[] rows = new string[] { f, "- (未実装)" };
                    var      item = new ListViewItem(rows);
                    listBackup.Items.Add(item);

                    var info = new BackupFileInfo();
                    info.path = item.Text;
                    info.date = item.SubItems[0].Text;
                    infos.Add(info);
                }
            }

            foreach (ListViewItem i in listBackup.Items)
            {
                if (!prevPaths.Contains(i.Text))
                {
                    backupSetting.fileInfos = infos;
                    SaveBackupSettings();
                    break;
                }
            }
        }
Пример #2
0
        private void buttonBackup_Click(object sender, EventArgs e)
        {
            backupSetting.backupStarted = true;
            List <BackupFileInfo> infos = new List <BackupFileInfo>();

            foreach (ListViewItem item in listBackup.Items)
            {
                var info = new BackupFileInfo();
                info.path = item.Text;
                info.date = item.SubItems[0].Text;
                infos.Add(info);
            }
            backupSetting.fileInfos = infos;
            StartBackupFile();
        }