Exemplo n.º 1
0
        private void SymLinkToBurn_Click(object sender, RoutedEventArgs e)
        {
            Process WipeStagingFolder = Process.Start("cmd.exe", "/c deltree.exe \"" + System.IO.Path.Combine(cbxBurnFolders.SelectedValue.ToString(), "*.*") + "\" & pause");

            WipeStagingFolder.WaitForExit();

            Regex rgx = new Regex("[;:]", RegexOptions.Compiled);

            using (WaitCursorWrapper w = new WaitCursorWrapper())
                using (DataView SelectedFiles = GetSelectedFiles())
                {
                    foreach (DataRowView r in SelectedFiles)
                    {
                        string fullpath = r["FullPath"].ToString();

                        string sympath = System.IO.Path.Combine(cbxBurnFolders.SelectedValue.ToString(), rgx.Replace(fullpath, ""));
                        Directory.CreateDirectory(sympath.Replace(System.IO.Path.GetFileName(sympath), ""));
                        if (rdoSymLink.IsChecked.Value)
                        {
                            Win32Helpers.CreateSymbolicLink(sympath, fullpath, Win32Helpers.SYMBOLIC_LINK_FLAG.File);
                        }
                        else
                        {
                            File.Copy(fullpath, sympath);
                        }
                    }
                }

            OpenStagingFolder_Click(null, null);
        }