Esempio n. 1
0
        protected void updatePathBarByTreeNode(PathTreeNode ANode)
        {
            String thisFullPath = "";

            bool IsRootNode = (ANode == this.RootNode);
            if (IsRootNode)
            {
                thisFullPath = ANode.Text;
            }
            else
            {
                thisFullPath = ANode.ExpandPath();
                thisFullPath = ukt4dotnet.shared.utilities.IO.Paths.MainModule.NormalizedPathToOSPath(thisFullPath);
            }

            // mostrar ruta en barra de direcciones
            thisFullPath += @"\";
            PathTextBox.Text = thisFullPath;
        }
Esempio n. 2
0
        protected void updateFilesByTreeNode(PathTreeNode AParentNode)
        {
            PathTreeNode thisParentNode = (PathTreeNode)AParentNode;
            String thisFullPath = AParentNode.ExpandPath();

            thisFullPath = ukt4dotnet.shared.utilities.IO.Paths.MainModule.NormalizedPathToOSPath(thisFullPath);
            thisFullPath += @"\";

            string[] Files = System.IO.Directory.GetFiles(thisFullPath);
            foreach (string eachFileFullPath in Files)
            {
                String eachPlainFileName = System.IO.Path.GetFileName(eachFileFullPath);
                String eachFileExtension = System.IO.Path.GetExtension(eachPlainFileName);

                bool IsLink = (eachFileExtension == ".lnk");
                if (! IsLink)
                {
                    ItemInfoStruct thisItemInfo = new ItemInfoStruct();

                    thisItemInfo.IsDrive = false;
                    thisItemInfo.Code = eachPlainFileName;
                    thisItemInfo.Text = eachPlainFileName;

                    thisItemInfo.LinkDestPath = "";

                    thisItemInfo.IsFile = true;
                    thisItemInfo.IsFolder = false;
                    thisItemInfo.IsLink = false;

                    String AFullPath =
                        ukt4dotnet.shared.utilities.IO.Paths.MainModule.OSPathToNormalizedPath(eachFileFullPath);
                    thisItemInfo.Code = AFullPath;

                    addItemsListviewNode(thisItemInfo);
                } // if (! IsLink)
            } // foreach

            foreach (ItemInfoStruct eachFileInfo in this.FileLinks)
            {
                addItemsListviewNode(eachFileInfo);
            } // foreach
        }
Esempio n. 3
0
        protected void updateFoldersByTreeNode(PathTreeNode AParentNode)
        {
            PathTreeNode thisParentNode = (PathTreeNode)AParentNode;
            String thisFullPath = AParentNode.ExpandPath();

            thisFullPath = ukt4dotnet.shared.utilities.IO.Paths.MainModule.NormalizedPathToOSPath(thisFullPath);
            thisFullPath += @"\";

            string[] Directories = System.IO.Directory.GetDirectories(thisFullPath);
            foreach (string eachFolderFullPath in Directories)
            {
                String eachPlainFolderName = System.IO.Path.GetFileName(eachFolderFullPath);

                ItemInfoStruct thisItemInfo = new ItemInfoStruct();

                thisItemInfo.IsDrive = false;
                thisItemInfo.Code    = eachPlainFolderName;
                thisItemInfo.Text    = eachPlainFolderName;
                thisItemInfo.LinkDestPath = "";

                thisItemInfo.IsFile = false;
                thisItemInfo.IsFolder = true;
                thisItemInfo.IsLink = false;

                PathTreeNode thisTreeNode =
                    addFoldersTreeviewNode(AParentNode, thisItemInfo);

                String AFullPath = thisTreeNode.ExpandPath();
                thisItemInfo.Code = AFullPath;
                addItemsListviewNode(thisItemInfo);
            } // foreach

            foreach (ItemInfoStruct eachFolderInfo in this.FolderLinks)
            {
                PathTreeNode thisTreeNode =
                    addFoldersTreeviewNode(AParentNode, eachFolderInfo);

                addItemsListviewNode(eachFolderInfo);
            } // foreach
        }
Esempio n. 4
0
        protected void loadLinksByTreeNode(PathTreeNode AParentNode)
        {
            PathTreeNode thisParentNode = (PathTreeNode)AParentNode;
            if (this.RootNode != thisParentNode)
            {
                String thisFullPath = AParentNode.ExpandPath();

                thisFullPath = ukt4dotnet.shared.utilities.IO.Paths.MainModule.NormalizedPathToOSPath(thisFullPath);
                thisFullPath += @"\";

                string[] Files = System.IO.Directory.GetFiles(thisFullPath);
                foreach (string eachFileFullPath in Files)
                {
                    String eachPlainFileName = System.IO.Path.GetFileName(eachFileFullPath);
                    String eachFileExtension = System.IO.Path.GetExtension(eachPlainFileName);

                    bool IsLink = (eachFileExtension == ".lnk");
                    if (IsLink)
                    {
                        ItemInfoStruct thisItemInfo = new ItemInfoStruct();
                        thisItemInfo.IsDrive = false;
                        thisItemInfo.IsLink = true;

                        String AOSPath = string.Empty;
                        String ADescr  = string.Empty;

                        // to-do: add showfilelinks, showfolderlinks

                        bool Result = GetShortcutTargetFile(eachFileFullPath, out AOSPath, out ADescr);
                        if (Result)
                        {
                            String ANormalizedPath =
                                ukt4dotnet.shared.utilities.IO.Paths.MainModule.OSPathToNormalizedPath(AOSPath);

                            thisItemInfo.LinkDestPath = ANormalizedPath;

                            // file or folder ?
                            thisItemInfo.IsFolder = (System.IO.Directory.Exists(AOSPath));
                            thisItemInfo.IsFile = (!thisItemInfo.IsFolder);

                            String AFullPath =
                                ukt4dotnet.shared.utilities.IO.Paths.MainModule.OSPathToNormalizedPath(eachFileFullPath);
                            thisItemInfo.Code = AFullPath;

                            String DestFullPath = System.IO.Path.GetFileName(AOSPath);
                            //thisItemInfo.Text = DestFullPath;

                            thisItemInfo.Text = ADescr;

                            if (thisItemInfo.IsFolder)
                            {
                                this.FolderLinks.Add(thisItemInfo);
                            }
                            else
                            {
                                this.FileLinks.Add(thisItemInfo);
                            }
                        }
                    } // if (IsLink)
                } // foreach
            } // if (this.RootNode != thisParentNode)
        }