예제 #1
0
 public frmGScriptManager(frmMain _parent, Compiler _compiler, ConfigReader _configReader)
     : base(_parent)
 {
     InitializeComponent();
     // Assigns the instance of the compiler which was created
     // when the main form was loading.
     compiler__ = _compiler;
     configReader__ = _configReader;
 }
예제 #2
0
 /* Sunny Chen Added 2008/07/01 <-- */
 public GuluWorkerParameter(GuluBase _gulu, IList<ListViewItem> _items
     /* Sunny Chen Added 2008/07/01 --> */
     , ConfigReader _configReader
     /* Sunny Chen Added 2008/07/01 <-- */
     )
 {
     gulu__ = _gulu;
     items__ = _items;
     /* Sunny Chen Added 2008/07/01 --> */
     configReader__ = _configReader;
     /* Sunny Chen Added 2008/07/01 <-- */
 }
예제 #3
0
파일: frmMain.cs 프로젝트: daxnet/guluwin
        /// <summary>
        /// Enumerates directories and files under a specific tree node
        /// </summary>
        /// <param name="_current">The tree node to enumerate</param>
        private void EnumerateChildrenElements(TreeNode _current)
        {
            try
            {
                ConfigReader configReader = new ConfigReader();
                FileTreeNodeProperty prop = (FileTreeNodeProperty)_current.Tag;
                if (prop.Type == FileTreeNodeType.Root)
                    return;

                DirectoryInfo root = new DirectoryInfo(prop.FullPath);
                _current.Nodes.Clear();

                // Enumerate directories
                foreach (DirectoryInfo directory in root.GetDirectories())
                {
                    if (!configReader.FileTreeShowHidden && ((directory.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden))
                        continue;

                    if (!configReader.FileTreeShowSystem && ((directory.Attributes & FileAttributes.System) == FileAttributes.System))
                        continue;

                    TreeNode nodeDirectory = _current.Nodes.Add(directory.Name, directory.Name, 3, 3);

                    nodeDirectory.Tag = new FileTreeNodeProperty(directory.Name,
                        FileTreeNodeType.Folder,
                        directory.FullName,
                        directory.Attributes);

                    if ((directory.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly ||
                        (directory.Attributes & FileAttributes.System) == FileAttributes.System)
                        nodeDirectory.ForeColor = Color.Silver;

                    nodeDirectory.Nodes.Add(string.Empty);
                }

                if (configReader.FileTreeShowFiles)
                {
                    // Enumerate files
                    foreach (FileInfo file in root.GetFiles())
                    {
                        if (!configReader.FileTreeShowHidden && ((file.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden))
                            continue;

                        if (!configReader.FileTreeShowSystem && ((file.Attributes & FileAttributes.System) == FileAttributes.System))
                            continue;

                        TreeNode nodeFile = _current.Nodes.Add(file.Name, file.Name, 5, 5);

                        nodeFile.Tag = new FileTreeNodeProperty(file.Name,
                            FileTreeNodeType.File,
                            file.FullName,
                            file.Attributes);

                        if ((file.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly ||
                            (file.Attributes & FileAttributes.System) == FileAttributes.System)
                            nodeFile.ForeColor = Color.Silver;
                    }
                }

            }
            catch (Exception ex)
            {
                ExceptionMessageBox.ShowDialog(ex, true);
            }
        }
예제 #4
0
 /// <summary>
 /// Parameterized constructor.
 /// </summary>
 /// <param name="_parent">The parent form in which the code editor creates.</param>
 /// <param name="_compiler">The compiler instance which was initialized when main form was loading.</param>
 /// <param name="_configReader">The configuration reader instance which was initailized when main form was loading.</param>
 public frmCodeEditor(frmMain _parent, Compiler _compiler, ConfigReader _configReader)
     : base(_parent)
 {
     InitializeComponent();
     compiler__ = _compiler;
     configReader__ = _configReader;
 }
예제 #5
0
        private void ThreadProc(object _parm)
        {
            Queue<string> queue = new Queue<string>();
            string rootPath = (string)_parm;
            string curPath = string.Empty;
            ConfigReader configReader = new ConfigReader();

            queue.Enqueue(rootPath);

            while (queue.Count > 0 && !shouldStop__)
            {
                try
                {
                    curPath = queue.Dequeue();

                    // Fires the DirectorySearching event
                    Delegated_DirectorySearching(Thread.CurrentThread, new DirectorySearchingEventArgs(curPath, items__.Count));

                    DirectoryInfo directoryInfo = new DirectoryInfo(curPath);
                    DirectoryInfo[] directories = directoryInfo.GetDirectories();
                    FileInfo[] files = directoryInfo.GetFiles();
                    foreach (FileInfo file in files)
                    {
                        if (shouldStop__) break;

                        if (!configReader.FileTreeShowHidden && ((file.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden))
                            continue;

                        if (!configReader.FileTreeShowSystem && ((file.Attributes & FileAttributes.System) == FileAttributes.System))
                            continue;

                        if (File.Exists(file.FullName) && filterManager__.Validate(file.FullName))
                        {
                            ListViewItem item = new ListViewItem(file.Name, iconListManager__.AddFileIcon(file.FullName));
                            item.SubItems.Add(string.Format("{0:#,0} KB", (file.Length / 1024)));
                            item.SubItems.Add(file.DirectoryName);
                            item.SubItems.Add(file.FullName);

                            item.Checked = true;
                            items__.Add(item);
                        }
                    }

                    if (shouldStop__) break;

                    if (configReader.SearchRecursivly)
                    {
                        foreach (DirectoryInfo directory in directories)
                        {
                            if (shouldStop__) break;
                            if (!directory.Name.Equals(".") && !directory.Name.Equals(".."))
                                queue.Enqueue(directory.FullName);
                        }
                    }
                }
                catch (ThreadAbortException)
                {
                    break;
                }
                catch
                {
                    continue;
                }
            }
            Delegated_OnAfterAddFolder(this, new FilesAddedEventArgs(items__.Count));
        }