Exemplo n.º 1
0
        private void rightButton_Click(object sender, EventArgs e)
        {
            if (rightTree.Nodes.Count > 0)
            {
                return;
            }

            executeCommand();
            System.Threading.Thread.Sleep(200);

            FolderBrowserDialog fbd = new FolderBrowserDialog();

            //上部に表示する説明テキストを指定する
            fbd.Description = "フォルダを指定してください。";
            //ルートフォルダを指定する
            //デフォルトでDesktop
            fbd.RootFolder = Environment.SpecialFolder.Desktop;
            //最初に選択するフォルダを指定する
            //fbd.SelectedPath = @"Z:\Interstage\J2EE\var\deployment\ijserver\Cloud11\apps\Cloud11.war\WEB-INF\classes\jp\fujitsu\saas";

            fbd.SelectedPath = System.Configuration.ConfigurationManager.AppSettings.Get("DefaultServerProjectPath");
            //ユーザーが新しいフォルダを作成できるようにする
            //デフォルトでTrue
            fbd.ShowNewFolderButton = true;

            //ダイアログを表示する
            if (fbd.ShowDialog(this) == DialogResult.OK)
            {
                rightRootPath = fbd.SelectedPath + "\\";
                List <string[]> fileNameList = FolderSupport.getFileNameList(rightRootPath, rightRootPath);
                NodeSupport.addRootNode(fileNameList, rightTree);
            }
        }
Exemplo n.º 2
0
        private void leftButton_Click(object sender, EventArgs e)
        {
            if (leftTree.Nodes.Count > 0)
            {
                return;
            }

            FolderBrowserDialog fbd = new FolderBrowserDialog();

            //上部に表示する説明テキストを指定する
            fbd.Description = "フォルダを指定してください。";
            //ルートフォルダを指定する
            //デフォルトでDesktop
            fbd.RootFolder = Environment.SpecialFolder.Desktop;
            //最初に選択するフォルダを指定する


            fbd.SelectedPath = System.Configuration.ConfigurationManager.AppSettings.Get("DefaultLocalProjectPath");
            //ユーザーが新しいフォルダを作成できるようにする
            //デフォルトでTrue
            fbd.ShowNewFolderButton = true;

            //ダイアログを表示する
            if (fbd.ShowDialog(this) == DialogResult.OK)
            {
                leftRootPath = fbd.SelectedPath + "\\";
                List <string[]> fileNameList = FolderSupport.getFileNameList(leftRootPath, leftRootPath);
                NodeSupport.addRootNode(fileNameList, leftTree);
            }
        }
Exemplo n.º 3
0
        private void rightTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            e.Node.Nodes.Clear();

            string          nodePath        = rightRootPath + NodeSupport.getNodePath(e.Node);
            List <string[]> subFileNameList = FolderSupport.getFileNameList(nodePath, nodePath);

            NodeSupport.addSubNode(subFileNameList, e.Node);
        }
Exemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <TreeNode> checkedNodes = NodeSupport.getCheckedNode(leftTree.Nodes);

            foreach (TreeNode selectedNode in checkedNodes)
            {
                //TreeNode selectedNode = leftTree.SelectedNode;
                string selectedNodePath = FolderSupport.removeLastSlash(NodeSupport.getNodePath(selectedNode));

                string leftFilePath = leftRootPath + selectedNodePath;

                if (File.Exists(leftFilePath))
                {
                    string rightDirectoryPath = rightRootPath + selectedNodePath;

                    DialogResult result = MessageBox.Show("from:" + leftFilePath + ";\n to:" + rightDirectoryPath, "warning", MessageBoxButtons.OKCancel);

                    if (result == DialogResult.OK)
                    {
                        try
                        {
                            System.IO.File.Copy(leftFilePath, rightDirectoryPath, true);
                        }
                        catch (DirectoryNotFoundException ed)
                        {
                            // if folder not exists, create it first
                            string folderPath = Path.GetDirectoryName(rightDirectoryPath);
                            result = MessageBox.Show("Remote Server にフォルダを作成する : " + folderPath, "warning", MessageBoxButtons.OKCancel);

                            if (result == DialogResult.OK)
                            {
                                Directory.CreateDirectory(folderPath);
                                System.IO.File.Copy(leftFilePath, rightDirectoryPath, true);
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                }
                else
                {
                    MessageBox.Show("folder selected !!!");
                }
            }
        }
Exemplo n.º 5
0
        private void leftTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            e.Node.Nodes.Clear();

            string          nodePath        = leftRootPath + NodeSupport.getNodePath(e.Node);
            List <string[]> subFileNameList = FolderSupport.getFileNameList(nodePath, nodePath);

            NodeSupport.addSubNode(subFileNameList, e.Node, leftTree);

            // フォルダの同期展開
            TreeNode[] rightNodes = rightTree.Nodes.Find(e.Node.Name, true);
            if (rightNodes.Length > 0)
            {
                TreeNode rightNode = rightNodes[0];
                rightNode.Nodes.Clear();
                string          rightNodePath        = rightRootPath + NodeSupport.getNodePath(rightNode);
                List <string[]> rightSubFileNameList = FolderSupport.getFileNameList(rightNodePath, rightNodePath);
                NodeSupport.addSubNode(rightSubFileNameList, rightNode);
            }
        }