public ActionResult Index(string id)
        {
            String        buildDir = System.Configuration.ConfigurationManager.AppSettings["BuildDirectory"];
            DirectoryView view     = new DirectoryView();

            if (id != null)
            {
                DirectoryInfo dInfo1 = new DirectoryInfo(buildDir + "/" + id);

                var files = dInfo1.GetFiles().ToList();
                view.Files       = files;
                view.Directories = false;
            }
            else
            {
                DirectoryInfo dInfo       = new DirectoryInfo(buildDir);
                var           directories = dInfo.GetDirectories().ToList();
                view.Directories = true;
                view.Dirs        = directories;
            }



            return(View(view));
        }
Esempio n. 2
0
        /// <summary>
        /// Обработчик выбора папки
        /// </summary>
        /// <param name="dirpath"></param>
        private void DirectoryView_FolderActivated(string dirpath)
        {
            DirectoryView.LoadDirectory(dirpath);

            // чтобы пользователю было легче ориентироваться, раскрываем путь к дереве
            DirectoriesTree.ExpandDirectory(dirpath);
        }
Esempio n. 3
0
        public override void Load(Call call, TabModel model)
        {
            if (!Directory.Exists(Tab.Path))
            {
                return;
            }

            model.Actions = new List <TaskCreator>()
            {
                new TaskDelegate("Delete", Delete, true),
            };


            var directories = new ItemCollection <DirectoryView>();

            foreach (string directoryPath in Directory.EnumerateDirectories(Tab.Path))
            {
                var listDirectory = new DirectoryView(directoryPath);
                directories.Add(listDirectory);
            }
            model.ItemList.Add(directories);

            var files = new ItemCollection <FileView>();

            foreach (string filePath in Directory.EnumerateFiles(Tab.Path))
            {
                var listFile = new FileView(filePath);
                files.Add(listFile);
            }
            if (files.Count > 0)
            {
                model.ItemList.Add(files);
            }
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Bienvenue ! Entrez 'test' pour charger un jeu de test sinon validez.");
            string state = Console.ReadLine();

            if (state != "test")
            {
                Console.WriteLine("Hosts");

                RegistrationView.GetForm(forGuest: false);

                Console.WriteLine("Guests");

                RegistrationView.GetForm();
            }
            else
            {
                People.LoadTestData();
            }

            DirectoryView.DetailledList();

            Console.ReadLine();

            var results = Calculation.ComputeTopTables();

            foreach (var table in results)
            {
                Console.WriteLine("Score : " + table.Item2);
                TableView.Display(table.Item1);
                Console.WriteLine();
            }

            Console.ReadLine();
        }
Esempio n. 5
0
        public MainForm()
        {
            InitializeComponent();

            Loader = CreateAsyncLoader();
            //Loader = CreateSyncLoader();

            // загрузка и инициализация дерева папок
            DirectoriesTree.Load();
            DirectoriesTree.AfterDirectorySelect += DirectoriesTree_AfterDirectorySelect;

            // добавление картинок в дереве
            ImageList treeImageList = new ImageList();

            treeImageList.Images.Add("folder-opened", LoadEmbeddedImage("ImageViewer.res.folder-opened.png"));
            treeImageList.Images.Add("folder-closed", LoadEmbeddedImage("ImageViewer.res.folder-closed.png"));
            DirectoriesTree.ImageList        = treeImageList;
            DirectoriesTree.ImageKey         = "folder-closed";
            DirectoriesTree.SelectedImageKey = "folder-opened";

            // инициализация окна просмотра содержимого папки
            Image defaultImageThumbnail = LoadEmbeddedImage("ImageViewer.res.image.png");
            Image folderThumbnail       = LoadEmbeddedImage("ImageViewer.res.folder.png");

            DirectoryView.InitializeComponent(Loader, defaultImageThumbnail, folderThumbnail);
            DirectoryView.ImageActivated  += DirectoryView_ImageActivated;
            DirectoryView.FolderActivated += DirectoryView_FolderActivated;
        }
Esempio n. 6
0
        /// <summary>
        /// Обработчик выбора папки в дереве папок.
        /// Отображает содержимое папки в соответствующем окне
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void DirectoriesTree_AfterDirectorySelect(object sender, DirectoryTreeViewEventArgs args)
        {
            DirectoryView.LoadDirectory(args.DirectoryPath);

            // руками вызываем обработчик изменения выбранного графического файла
            DirectoryView_ImageActivated(null);
        }
 public DirectoryController(ILog log, ISizeConversion sizeConversion)
 {
     _log            = log;
     _sizeConversion = sizeConversion;
     // TODO - have one handler and just fill it with necessary commands
     _driveReaderCommandHandler = new DriveReaderCommandHandler(this);
     _currentCommandHandler     = new DriveLetterCommandHandler(this);
     _view = new DirectoryView();
     UIConsole.SetTitle("Directory Sizes Tool");
 }
Esempio n. 8
0
 public void ToStream(
     Stream targetStream,
     IStorageService storage,
     string path,
     string filter,
     bool includeSubDirs,
     DirectoryView directoryView)
 {
     ToStream(targetStream, storage, path, filter, null, includeSubDirs, directoryView);
 }
Esempio n. 9
0
        public static UserControl CreateView(string value)
        {
            switch (value.ToString())
            {
            case "Triggered by Battery Percent Changes":
                if (_batteryPercentView == null)
                {
                    _batteryPercentView = new BatteryPercentView();
                }
                return(_batteryPercentView);

            case "Triggered by Day Changes":
                if (_dayView == null)
                {
                    _dayView = new DayView();
                }
                return(_dayView);

            case "Triggered by Directory Changes":
                if (_dirView == null)
                {
                    _dirView = new DirectoryView();
                }
                return(_dirView);

            case "Triggered by File Changes":
                if (_fileView == null)
                {
                    _fileView = new FileView();
                }
                return(_fileView);

            case "Triggered by Internet Connectivity":
                if (_netView == null)
                {
                    _netView = new NetConnectivityView();
                }
                return(_netView);

            case "Triggered by Process":
                if (_procView == null)
                {
                    _procView = new ProcessView();
                }
                return(_procView);

            case "Triggered by Timezone Changes":
                if (_tzView == null)
                {
                    _tzView = new TimeZoneView();
                }
                return(_tzView);
            }
            return(null);
        }
Esempio n. 10
0
 private void PopulateDirTree()
 {
     DirectoryView.Nodes.Clear();
     for (var i = 0; i < _direntries[_filetreedepth].Count; i++)
     {
         DirectoryView.Nodes.Add(IntToHex(i, _direntries[_filetreedepth].Count <= 256), _direntries[_filetreedepth][i]);
     }
     DirectoryView.Sort();
     if (_filetreedepth > 0)
     {
         DirectoryView.Nodes.Insert(0, "..", "..");
     }
 }
Esempio n. 11
0
    public ExploreView(Driver driver, int stopAfter) : base("Explore")
    {
        int x, y, width, height, depth;

        RootWindow.GetGeometry(out x, out y, out width, out height, out depth);
        SetDefaultSize(width - 50, height - 40);

        VBox vBox = new VBox(false, 1);

        Add(vBox);

        HPaned hPaned = new HPaned();

        vBox.Add(hPaned);

        ScrolledWindow scrolledWindow = new ScrolledWindow();

        //scrolledWindow.SetDefaultSize (Convert.ToInt32((width - 50) * 0.4), height -40);
        hPaned.Add1(scrolledWindow);

        repositoryView = new RepositoryView(driver);
        scrolledWindow.Add(repositoryView);

        viewChildren = new Notebook();

        changesetView = new ChangesetView(driver, stopAfter);
        viewChildren.AppendPage(changesetView, new Label("Changeset View"));

        directoryView = new DirectoryView(driver);
        viewChildren.AppendPage(directoryView, new Label("Directory View"));

        fileView = new FileView(driver);
        viewChildren.AppendPage(fileView, new Label("File View"));

        hPaned.Add2(viewChildren);
        hPaned.Position = (width - 50) / 3;

        // add status bar
        Statusbar sb = new Statusbar();

        sb.HasResizeGrip = false;
        vBox.PackEnd(sb, false, false, 1);

        ShowAll();

        repositoryView.Selection.Changed += OnPathSelectionChanged;
        viewChildren.SwitchPage          += OnSwitchPage;
    }
Esempio n. 12
0
    public ExploreView(Driver driver, int stopAfter)
        : base("Explore")
    {
        int x, y, width, height, depth;
        RootWindow.GetGeometry (out x, out y, out width, out height, out depth);
        SetDefaultSize (width - 50, height - 40);

        VBox vBox = new VBox(false, 1);
        Add(vBox);

        HPaned hPaned = new HPaned();
        vBox.Add(hPaned);

        ScrolledWindow scrolledWindow = new ScrolledWindow();
        //scrolledWindow.SetDefaultSize (Convert.ToInt32((width - 50) * 0.4), height -40);
        hPaned.Add1(scrolledWindow);

        repositoryView = new RepositoryView(driver);
        scrolledWindow.Add(repositoryView);

        viewChildren = new Notebook ();

        changesetView = new ChangesetView(driver, stopAfter);
        viewChildren.AppendPage (changesetView, new Label ("Changeset View"));

        directoryView = new DirectoryView(driver);
        viewChildren.AppendPage (directoryView, new Label ("Directory View"));

        fileView = new FileView(driver);
        viewChildren.AppendPage (fileView, new Label ("File View"));

        hPaned.Add2(viewChildren);
        hPaned.Position = (width - 50) / 3;

        // add status bar
        Statusbar sb = new Statusbar ();
        sb.HasResizeGrip = false;
        vBox.PackEnd(sb, false, false, 1);

         		ShowAll();

        repositoryView.Selection.Changed += OnPathSelectionChanged;
        viewChildren.SwitchPage += OnSwitchPage;
    }
Esempio n. 13
0
        public void ToStream(
            Stream targetStream,
            IStorageService storage,
            string path,
            string filter,
            QueryBlobsFilterDelegate queryFilter,
            bool includeSubDirs,
            DirectoryView directoryView)
        {
            // Root is always included
            var directories = new List <string> {
                path
            };

            if (includeSubDirs)
            {
                directories.AddRange(storage.QuerySubDirs(
                                         path,
                                         true, // Include subdirs
                                         directoryView));
            }

            using (var zipStorer = ZipStorer.Create(targetStream))
            {
                // Handle all subdirs
                foreach (string subDir in directories)
                {
                    // Stream directory
                    DirToZipStream(
                        storage,
                        subDir,
                        filter,
                        queryFilter,
                        zipStorer);
                }
            }
        }
Esempio n. 14
0
 public void Activate()
 {
     DirectoryView.Activate();
 }
Esempio n. 15
0
        private void FileOpen(string file)
        {
            // Set status bar location for the file.
            tbStatusBarLocation.Text = file;

            // Parse the PE file
            if (!PeFile.IsPEFile(file))
            {
                ShowInvalidPeFileMsgBox();
                return;
            }

            _peFile = new PeFile(file);

            // Set all FileInfo fields.
            FileInfo.SetFileInfo(_peFile);

            // Set the DOS header fields
            DosNtHeader.SetDosHeader(_peFile);

            // Set the PE File fields
            DosNtHeader.SetNtHeader(_peFile);

            // Set the File header
            FileHeaderDebug.SetFileHeader(_peFile);

            // Set the Debug directory.
            FileHeaderDebug.SetDebug(_peFile);

            // Set the Optional header
            OptionalHeader.SetOptionalHeader(_peFile);

            // Set the imports.
            Imports.SetImports(_peFile);

            // Set the exports.
            Exports.SetExports(_peFile);

            // Set the resources.
            Resource.SetResources(_peFile);

            // Set the sections.
            SectionHeaders.SetSections(_peFile);

            // Set the Exception (only for x64)
            Exceptions.SetException(_peFile);

            // Set the Relocations.
            Relocation.SetRelocations(_peFile);

            // Set the Digital Signature information.
            Signature.SetDigSignature(_peFile);

            // Set the Bound Import directory.
            DebugBoundImport.SetBoundImport(_peFile);

            // Set the Delay Import descriptor.
            DebugBoundImport.SetDelayImport(_peFile);

            // Set the TLS directory.
            TlsDirectory.SetTlsDirectory(_peFile);

            // Set the Load Config Directory
            LoadConfig.SetLoadConfig(_peFile);

            // Set the Data Directory View
            DirectoryView.SetDirectoryView(_peFile);
        }
        public string[] QuerySubDirs(string path, bool recursive, DirectoryView enDirectoryView)
        {
            var result = m_StorageService.QuerySubDirs(m_RelativePath, recursive, enDirectoryView);

            return(result);
        }
Esempio n. 17
0
        private void ExplorerSample_Load(object sender, EventArgs e)
        {
            thumbnailsMenuItem.CheckOnClick = true;
            tilesMenuItem.CheckOnClick      = true;
            iconsMenuItem.CheckOnClick      = true;
            listMenuItem.CheckOnClick       = true;
            detailsMenuItem.CheckOnClick    = true;

            DataGridViewImageColumn dataGridViewIcon = new DataGridViewImageColumn
            {
                Name             = "Icon",
                DataPropertyName = "Icon",
                HeaderText       = "",
                Width            = 20
            };

            DataGridViewTextBoxColumn dataGridViewName = new DataGridViewTextBoxColumn
            {
                Name             = "Name",
                DataPropertyName = "Name",
                HeaderText       = "名称",
                Width            = 400
            };

            DataGridViewTextBoxColumn dataGridViewSize = new DataGridViewTextBoxColumn
            {
                Name             = "SizeCol",
                DataPropertyName = "Size",
                HeaderText       = "大小"
            };

            DataGridViewTextBoxColumn dataGridViewType = new DataGridViewTextBoxColumn
            {
                Name             = "Type",
                DataPropertyName = "Type",
                HeaderText       = "类型"
            };
            DataGridViewTextBoxColumn dataGridViewDateModified = new DataGridViewTextBoxColumn
            {
                Name             = "DateModified",
                DataPropertyName = "DateModified",
                HeaderText       = "修改日期"
            };

            dataGridView1.Columns.Add(dataGridViewIcon);
            dataGridView1.Columns.Add(dataGridViewName);
            dataGridView1.Columns.Add(dataGridViewSize);
            dataGridView1.Columns.Add(dataGridViewType);
            dataGridView1.Columns.Add(dataGridViewDateModified);

            _dir = new DirectoryView();
            this.FileViewBindingSource.DataSource = _dir;

            SetTitle(_dir.FileView);

            DataGridViewColumn col = this.dataGridView1.Columns["Size"];

            if (null != col)
            {
                DataGridViewCellStyle style = col.HeaderCell.Style;

                style.Padding   = new Padding(style.Padding.Left, style.Padding.Top, 6, style.Padding.Bottom);
                style.Alignment = DataGridViewContentAlignment.MiddleRight;
            }

            col = this.dataGridView1.Columns["Name"];

            if (null != col)
            {
                this.dataGridView1.Rows[0].Cells[col.Index].Selected = true;
            }
        }
        private UserControl GetPageUserControl(PageControl pageControl,
                                               object additionalData = null)
        {
            UserControl newPage = null;

            switch (pageControl)
            {
            case Enumerations.PageControl.None:
                break;

            case Enumerations.PageControl.Directory:
                newPage = new DirectoryView(this);
                break;

            case Enumerations.PageControl.Settings:
                newPage = new SettingsView(this);
                break;

            case Enumerations.PageControl.FileChecksum:

                if (additionalData is null)
                {
                    throw new ArgumentException($"The {nameof(FileChecksumView)} " +
                                                $"requires the {nameof(DirectoryItem)} parameter.");
                }

                DirectoryItem item = additionalData as DirectoryItem;

                if (item is null)
                {
                    throw new ArgumentException($"The additional data " +
                                                $"wasn't of type {nameof(DirectoryItem)}.");
                }

                newPage = new FileChecksumView(this, item);

                break;

            case PageControl.TreeChecksum:

                if (additionalData is null)
                {
                    throw new ArgumentException($"The {nameof(TreeChecksumView)}" +
                                                $" requires the {nameof(DirectoryItem)} parameter.");
                }

                DirectoryItem rootNode = additionalData as DirectoryItem;

                if (rootNode is null)
                {
                    throw new ArgumentException($"The additional data " +
                                                $"wasn't of type {nameof(DirectoryItem)}.");
                }

                newPage = new TreeChecksumView(this, rootNode);

                break;

            default:
                throw new DirectoryContentsException($"Unhandled PageControl" +
                                                     $" enumeration: {pageControl}");
            }

            return(newPage);
        }
Esempio n. 19
0
        // Token: 0x06002432 RID: 9266 RVA: 0x000D1148 File Offset: 0x000CF348
        protected void RenderSecondaryNavigation(TextWriter output, bool showContacts)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            output.Write("<div id=\"{0}\" class=\"secNvPaneCont\">", this.lastModuleName);
            switch (this.navigationModule)
            {
            case NavigationModule.Mail:
                NavigationHost.RenderMailSecondaryNavigation(output, base.UserContext);
                goto IL_229;

            case NavigationModule.Calendar:
            {
                PropertyDefinition[] propsToReturn = new PropertyDefinition[]
                {
                    ViewStateProperties.CalendarViewType,
                    ViewStateProperties.DailyViewDays
                };
                using (CalendarFolder calendarFolder = CalendarFolder.Bind(base.UserContext.MailboxSession, DefaultFolderType.Calendar, propsToReturn))
                {
                    DailyView.RenderSecondaryNavigation(output, calendarFolder, base.UserContext);
                    goto IL_229;
                }
                break;
            }

            case NavigationModule.Contacts:
                break;

            case NavigationModule.Tasks:
                TaskView.RenderSecondaryNavigation(output, base.UserContext);
                goto IL_229;

            case NavigationModule.Options:
                goto IL_21D;

            case NavigationModule.AddressBook:
                this.recipientBlockType = ((AddressBook)this).RecipientBlockType;
                if (base.UserContext.IsFeatureEnabled(Feature.GlobalAddressList))
                {
                    bool isRoomPicker = ((AddressBook)this).IsRoomPicker && DirectoryAssistance.IsRoomsAddressListAvailable(base.UserContext);
                    output.Write("<div class=\"abNavPane\" style=\"height:");
                    output.Write(showContacts ? "30" : "100");
                    output.Write("%;top:0px;\"><div id=\"divMdNmAD\">");
                    output.Write(LocalizedStrings.GetHtmlEncoded(346766088));
                    output.Write("</div><div id=\"divSecNvAD\">");
                    DirectoryView.RenderSecondaryNavigation(output, base.UserContext, isRoomPicker);
                    output.Write("</div></div>");
                }
                if (showContacts)
                {
                    output.Write("<div class=\"abNavPane\" style=\"height:");
                    output.Write(base.UserContext.IsFeatureEnabled(Feature.GlobalAddressList) ? "70" : "100");
                    output.Write("%;bottom:0px;\"><div id=\"divMdNmC\">");
                    output.Write(LocalizedStrings.GetHtmlEncoded(-1165546057));
                    output.Write("</div><div id=\"divSecNvC\"");
                    bool isPicker = ((AddressBook)this).IsPicker;
                    if (isPicker)
                    {
                        output.Write(" class=\"noFltrsCntRg\"");
                    }
                    output.Write(">");
                    ContactView.RenderSecondaryNavigation(output, base.UserContext, isPicker);
                    output.Write("</div></div>");
                    goto IL_229;
                }
                goto IL_229;

            case NavigationModule.Documents:
                DocumentLibraryUtilities.RenderSecondaryNavigation(output, base.UserContext);
                goto IL_229;

            case NavigationModule.PublicFolders:
                NavigationHost.RenderPublicFolderSecondaryNavigation(output, base.UserContext);
                goto IL_229;

            default:
                goto IL_21D;
            }
            ContactView.RenderSecondaryNavigation(output, base.UserContext, false);
            goto IL_229;
IL_21D:
            NavigationHost.RenderMailSecondaryNavigation(output, base.UserContext);
IL_229:
            output.Write("</div>");
        }
        /// <summary>
        /// Shows the previous page with the given transition.
        /// </summary>
        /// <param name="transitionType">
        /// </param>
        internal void ShowPreviousPage(
            PageTransitionType transitionType = PageTransitionType.SlideBackAndFade,
            object additionalData             = null)
        {
            Log($"{nameof(MainWindowViewModel)}.{nameof(ShowPreviousPage)}: Start");

            UserControl newPageControl = null;

            if (m_PageList.Count > 0)
            {
                newPageControl = m_PageList.Pop();

                Log($"  Removed {newPageControl} from stack.");

                if (m_PageList.Count == 1)
                {
                    Log("  There is now 1 item in the stack.");
                }
                else
                {
                    Log($"  There are now {m_PageList.Count} items in the stack.");
                }
            }
            else
            {
                Log($"  The page list stack is empty.");
            }

            if (m_PageList.Count > 0)
            {
                newPageControl = m_PageList.Peek();

                Log($"  New page is {newPageControl}.");
            }

            if (additionalData != null)
            {
                if (newPageControl is DirectoryView)
                {
                    IHashAlgorithim hashAlgorithim = ((ChecksumAlgorithim)additionalData).GetAlgorithimInterface();

                    ((DirectoryView)newPageControl).SetHashAlgorithim(hashAlgorithim);
                }
            }

            // Set back button text.

            if (newPageControl is null)
            {
                newPageControl = new DirectoryView(this);
            }

            CurrentPage = GetPageEnumerationType(newPageControl);

            m_PageTransition.TransitionType = transitionType;
            m_PageTransition.ShowPage(newPageControl);

            ShowStatusMessage(string.Empty, false);

            Log($"{nameof(MainWindowViewModel)}.{nameof(ShowPreviousPage)}: End");
        }
        public virtual string[] QuerySubDirs(string path, bool bRecursive, DirectoryView enDirectoryView)
        {
            string[] Dirs = null;

            string basePath = SetBasePath();

            if (!bRecursive)
            {
                // Get local path
                string localPath = Path.Combine(basePath, path);

                // If path exists
                if (Directory.Exists(localPath))
                {
                    // One level query - simple
                    string[] FullPathDirs = Directory.GetDirectories(localPath, "*.*");

                    Dirs = new string[FullPathDirs.Length];

                    for (int i = 0; i < FullPathDirs.Length; i++)
                    {
                        string sDirName = FullPathDirs[i];

                        Dirs[i] = GetLowerLevelDir(sDirName);
                    }
                }
                else
                {
                    // Return empty array
                    Dirs = EmptyArrays.StringArray;
                }
            }
            else
            {
                // Recursive query

                // Get one direct subdirs of the provided path
                string[] OneLevelSubDirs = QuerySubDirs(path, false);

                List <string> AllSubDirs = new List <string>();

                // Perform recursive query on the direct subdirs
                foreach (string sSubDir in OneLevelSubDirs)
                {
                    string sSubDirPath = String.Empty;

                    if (path != String.Empty)
                    {
                        sSubDirPath = String.Format(
                            "{0}{1}{2}",
                            path,
                            Path.DirectorySeparatorChar,
                            sSubDir);
                    }
                    else
                    {
                        sSubDirPath = sSubDir;
                    }

                    if (basePath != String.Empty && sSubDirPath.IndexOf(basePath) > -1)
                    {
                        sSubDirPath =
                            sSubDirPath.Substring(basePath.Length + 1,
                                                  sSubDirPath.Length - basePath.Length - 1);
                    }

                    if (enDirectoryView == DirectoryView.Flat)
                    {
                        AllSubDirs.Add(sSubDir);
                    }
                    else
                    {
                        AllSubDirs.Add(sSubDirPath);
                    }

                    AllSubDirs.AddRange(
                        QuerySubDirs(sSubDirPath, true, enDirectoryView));
                }

                // Get all as array
                Dirs = AllSubDirs.ToArray();
            }

            return(Dirs);
        }