Exemple #1
0
        /// <summary>
        /// Recursively adds a collection of directories to the treeview.
        /// </summary>
        /// <param name="directoryLookup">A cache of all the PhotoDirectory objects.</param>
        /// <param name="dirBrowser">A reference to a DirectoryBrowser object.</param>
        /// <param name="dirs">A collection of PhotoDirectory objects.</param>
        /// <param name="parentNode">A reference to the parent tree node object, or null if at the root of the tree view.</param>
        private void addDirectoryNodes(Hashtable directoryLookup, DirectoryBrowser dirBrowser,
                                       PhotoDirectories dirs, squishyWARE.WebComponents.squishyTREE.TreeNode parentNode)
        {
            IEnumerator enumerator = dirs.GetEnumerator();

            while (enumerator.MoveNext())
            {
                PhotoDirectory dir = (PhotoDirectory)enumerator.Current;

                squishyWARE.WebComponents.squishyTREE.TreeNode node;
                if (parentNode == null)
                {
                    node = tvwMain.AddNode(HttpUtility.HtmlEncode(dir.Name), dir.Id.ToString());
                }
                else
                {
                    node = parentNode.AddNode(HttpUtility.HtmlEncode(dir.Name), dir.Id.ToString());
                }

                addDirectoryNodes(directoryLookup, dirBrowser, dir.GetDirectories(), node);

                if (!directoryLookup.Contains(dir.Id))
                {
                    directoryLookup.Add(dir.Id, dir);
                }
            }
        }
        /// <summary>
        /// Displays the album treeview control.
        /// </summary>
        /// <param name="dirBrowser">A reference to the cached DirectoryBrowser object.</param>
        /// <param name="directoryLookup">A cache of all the PhotoDirectory objects.</param>
        private void DisplayTreeview(DirectoryBrowser dirBrowser, Hashtable directoryLookup)
        {
            PhotoDirectories dirs = dirBrowser.GetDirectories();

            tvwMain.Controls.Clear();
            addDirectoryNodes(directoryLookup, dirBrowser, dirs, null);
        }
Exemple #3
0
        /// <summary>
        /// Displays the album treeview control.
        /// </summary>
        /// <param name="dirBrowser">A reference to the cached DirectoryBrowser object.</param>
        /// <param name="directoryLookup">A cache of all the PhotoDirectory objects.</param>
        private void DisplayTreeview(DirectoryBrowser dirBrowser, Hashtable directoryLookup)
        {
            //PhotoDirectories dirs = dirBrowser.GetDirectories();

            // PhotoDirectories dirs = new PhotoDirectories();
            //dirs.Add(dirBrowser.Dir);
            tvwMain.Controls.Clear();
            addDirectoryNodes(directoryLookup, dirBrowser, dirBrowser.rootDir, null);
        }
Exemple #4
0
        private void button3_Click(object sender, EventArgs e)
        {
            DialogResult result = DirectoryBrowser.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                LocalUpdateDirDisplay.Text = DirectoryBrowser.SelectedPath;
            }
        }
        private void btnExampleFiles_Click(object sender, System.EventArgs e)
        {
            DirectoryBrowser dirBrowser = new DirectoryBrowser();

            if (dirBrowser.ShowDialog("Example File Path") == DialogResult.OK)
            {
                ExampleFiles = dirBrowser.DirectoryPath;
            }
        }
Exemple #6
0
        private void ClassifyLibrary_Click(object sender, RoutedEventArgs e)
        {
            string dir = directoryTextBox.Text;

            if (Directory.Exists(dir))
            {
                string[] songs = DirectoryBrowser.getSongs(dir);
                //will start automatically
                Framework.ClassifierThread worker = new ClassifierThread(songs);
            }
        }
Exemple #7
0
        public static void Main(string[] args)
        {
            string root = args[0];

            IFileReader       fileReader       = new FileReader();
            IDirectoryBrowser directoryBrowser = new DirectoryBrowser(root, fileReader, new string[] { "node_modules", "$tf", "packages" });

            IDatabaseParser  efDatabaseParser = new EntityFrameworkDatabaseParser();
            IProcedureParser procedureParser  = new InformixProcedureParser();

            IFileParser csFileParser  = new CSFileParser(efDatabaseParser);
            IFileParser sqlFileParser = new SQLFileParser(procedureParser);

            IProjectParser netCoreProjectParser = new NETCoreProjectParser(csFileParser);

            List <ProcedureParseReport> procedureList = new List <ProcedureParseReport>();
            List <ProjectParseReport>   projectList   = new List <ProjectParseReport>();

            int total = 0;

            DirFile file;

            while ((file = directoryBrowser.NextFile()) != null)
            {
                if (file.Extension == "csproj")
                {
                    ProjectParseReport projectReport = netCoreProjectParser.Parse(file);

                    if (projectReport != null)
                    {
                        projectList.Add(projectReport);
                    }
                }
                else if (file.Extension == "sql")
                {
                    FileParseReport procedureReport = sqlFileParser.Parse(file);

                    if (procedureReport != null)
                    {
                        procedureList.AddRange(procedureReport.Procedures);
                    }
                }

                total++;
                UpdateConsoleStatus(total, file.Path, root);
            }

            JsonFileWriter.WriteToFile(procedureList, "procedureReport.json");
            JsonFileWriter.WriteToFile(projectList, "projectReport.json");
        }
Exemple #8
0
        private void InitPage(HttpRequest request)
        {
            DirectoryBrowser dirBrowser       = (DirectoryBrowser)Session["photo_DirectoryBrowser"];
            PhotoDirectory   CurrentDirectory = (PhotoDirectory)Session["photo_CurrentDirectory"];

            if (dirBrowser == null || request.Params["method"] == null)
            {
//                string photosPath = request.ApplicationPath + Path.DirectorySeparatorChar;
                string mappedPhotosDbPath = request.MapPath("") + "\\photos";
                if (Session["photo_rootpath"] == null)
                {
                    Response.Write("错误的参数,通知管理员此异常现象");
                    Response.End();
                }
                string path = (string)Session["photo_rootpath"];
                dirBrowser = new DirectoryBrowser(mappedPhotosDbPath, path);
            }
            Hashtable directoryLookup = (Hashtable)Session["photo_DirectoryLookup"];

            if (directoryLookup == null)
            {
                directoryLookup = new Hashtable();
            }

            DisplayTreeview(dirBrowser, directoryLookup);
            // expand out the current directory node
            int directoryID = -1;

            if (CurrentDirectory != null)
            {
                directoryID = CurrentDirectory.Id;
            }
            else if (request.Params["directoryID"] != null)
            {
                directoryID = Int32.Parse(request.Params["directoryID"]);
            }
            else
            {
                PhotoObjectBase pd1 = dirBrowser.rootDir.GetByIndex(0);
                directoryID = pd1.Id;
            }
            squishyWARE.WebComponents.squishyTREE.TreeNode node = tvwMain.FindTreeNode(directoryID.ToString());
            ExpandNode(node);

            Session.Add("photo_DirectoryBrowser", dirBrowser);
            Session.Add("photo_DirectoryLookup", directoryLookup);

            // Must be called after DisplayTreeview
            ProcessMethod(request, directoryLookup, directoryID);
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            HttpRequest request = Context.Request;

            tvwMain.WindowsLafImageBase = @"PhotoBrowserRes\Treeview\";
            tvwMain.TreeOutputStyle     = TreeOutputStyle.WindowsLookAndFeel;
            tvwMain.NodeDisplayStyle    = NodeDisplayStyle.Standard;

            // We only get a post back if the user is navigating via the treeview control.
            // If we've not got a postback then we need to display correct state of the
            // control.
            if (!IsPostBack)
            {
                DirectoryBrowser dirBrowser = (DirectoryBrowser)Session["DirectoryBrowser"];
                if (dirBrowser == null || request.Params["method"] == null)
                {
                    string photosPath       = request.ApplicationPath + Path.DirectorySeparatorChar;
                    string mappedPhotosPath = request.MapPath(photosPath) + "photos";

                    dirBrowser = new DirectoryBrowser(mappedPhotosPath);
                }

                Hashtable directoryLookup = (Hashtable)Session["DirectoryLookup"];
                if (directoryLookup == null)
                {
                    directoryLookup = new Hashtable();
                }

                DisplayTreeview(dirBrowser, directoryLookup);

                // Must be called after DisplayTreeview
                ProcessMethod(request, directoryLookup);

                // expand out the current directory node
                if (request.Params["directoryID"] != null)
                {
                    int directoryID = Int32.Parse(request.Params["directoryID"]);
                    squishyWARE.WebComponents.squishyTREE.TreeNode node = tvwMain.FindTreeNode(directoryID.ToString());
                    ExpandNode(node);
                }

                Session.Add("DirectoryBrowser", dirBrowser);
                Session.Add("DirectoryLookup", directoryLookup);
            }

            pnlImageNavigationBottom.Visible = DISPLAY_BOTTOM_IMAGE_NAVIGATION;
        }
Exemple #10
0
        private void settingsButton_Click(object sender, RoutedEventArgs e)
        {
            Settings settingdlg = new Settings();

            settingdlg.ShowDialog();
            if (settingdlg.DialogResult.HasValue && settingdlg.DialogResult.Value)
            {
                string dir = settingdlg.directoryTextBox.Text;
                if (Directory.Exists(dir))
                {
                    string[] songs = DirectoryBrowser.getSongs(dir);
                    //will start automatically
                    worker = new ClassifierThread(songs);
                }
                //Handle the settings changed
            }
            UpdateButtonStates();
        }
Exemple #11
0
        public override void Load()
        {
            _directoryBrowser = new DirectoryBrowser(SceneManager, this);
            _directoryBrowser.AddFileSystem(new LocalFileSystem(SceneManager.Directories));
            _directoryBrowser.AddFileSystem(new SoundCloudFileSystem());

            // Find recent songs file path
            _recentSongsFile = ServiceLocator.Directories.Locate("AppData", RECENT_SONGS_FILE);

            // Load recent songs
            LoadRecentSongs();

            // Make sure to add recent file system last!
            _directoryBrowser.AddFileSystem(new RecentFileSystem(_recentSongs));

            _directoryBrowser.SwitchCurrentFileSystemIfEmpty();

            _directoryBrowser.Resize(WindowWidth, WindowHeight);
            Loaded = true;
        }
Exemple #12
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string projcode = Context.Request.Params["ProjectCode"];
//        string photosPath = Context.Request.FilePath + Path.DirectorySeparatorChar;
        string           mappedPhotosDbPath = Context.Request.MapPath("") + "\\photos";
        DirectoryBrowser dirBrowser         = new DirectoryBrowser(mappedPhotosDbPath, "");

        if (dirBrowser.RootPathExist(TextBox1.Text.Trim()))
        {
            Label1.Text = "目录名已存在,请换个名字输入";
        }
        else
        {
            if (dirBrowser.CreateRootDirectorie(projcode, TextBox1.Text.Trim()))
            {
                EnterAlbum(TextBox1.Text.Trim());
            }
            else
            {
                Label1.Text = "创建目录失败,请重试或通知管理员";
            }
        }
    }
Exemple #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["photo_CurrentDirectory"]  = null;
        Session["photo_DirectoryLookup"]   = null;
        Session["photo_DirectoryBrowser"]  = null;
        Session["photo_rootpath"]          = null;
        Session["photo_CurrentPageNumber"] = null;
        Session["photo_CurrentPhotos"]     = null;
        if (!IsPostBack)
        {
            string projcode = Context.Request.Params["ProjectCode"];
//            string photosPath = Context.Request.FilePath + Path.DirectorySeparatorChar;
            string           mappedPhotosDbPath = Context.Request.MapPath("") + "\\photos";
            DirectoryBrowser dirBrowser         = new DirectoryBrowser(mappedPhotosDbPath, "");
            if (projcode != null)
            {
                string rootpath = dirBrowser.GetRootPath(projcode);
                if (rootpath != null)
                {
                    EnterAlbum(rootpath);
                }
            }
        }
    }
        public ProjectParseReport Parse(DirFile file)
        {
            List <FileParseReport> fileReports = new List <FileParseReport>();

            //TODO: Inject
            string           root             = file.Path.Substring(0, file.Path.Length - file.Name.Length);
            DirectoryBrowser directoryBrowser = new DirectoryBrowser(root, new FileReader(), new string[] { "node_modules" });

            DirFile currFile;

            while ((currFile = directoryBrowser.NextFile()) != null)
            {
                List <FileParseReport> currFileReports = new List <FileParseReport>();

                foreach (IFileParser parser in _fileParsers)
                {
                    currFileReports.Add(parser.Parse(currFile));
                }

                fileReports.Add(new FileParseReport(currFile.Name, currFileReports.Where(x => x != null).SelectMany(x => x.Databases), currFileReports.Where(x => x != null).SelectMany(x => x.Procedures)));
            }

            return(new ProjectParseReport(file.Name, GetReferences(file.Content), fileReports));
        }
Exemple #15
0
 public ImageBrowserController()
 {
     directoryBrowser   = new DirectoryBrowser();
     contentInitializer = new ContentInitializer(contentFolderRoot, foldersToCopy, prettyName);
     thumbnailCreator   = new ThumbnailCreator();
 }
Exemple #16
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            HttpRequest request = Context.Request;

            tvwMain.WindowsLafImageBase = @"PhotoBrowserRes\Treeview\";
            tvwMain.TreeOutputStyle     = TreeOutputStyle.WindowsLookAndFeel;
            tvwMain.NodeDisplayStyle    = NodeDisplayStyle.Standard;

            // We only get a post back if the user is navigating via the treeview control.
            // If we've not got a postback then we need to display correct state of the
            // control.
            if (!IsPostBack)
            {
                InitPage(request);
            }
            else
            {
                string curfullpath = "";
                if (Session["photo_CurrentDirectory"] != null)
                {
                    curfullpath = this.MapPath(null) + "\\photos" + ((PhotoDirectory)Session["photo_CurrentDirectory"]).FullVirtualPath;
                }
                if (request.Params["PhotoBrowser1:DirMaintainType"] == "AddChildDir")
                {
                    if (Session["photo_CurrentDirectory"] == null)
                    {
                    }
                    else
                    {
                        string newpath = curfullpath + "\\" + txtDirName.Value;
                        labReport.Text = newpath;
                        System.IO.Directory.CreateDirectory(newpath);
                        InitPage(request);
                    }
                }
                else if (request.Params["PhotoBrowser1:DirMaintainType"] == "DelPhoto")
                {
                    int photoID     = Int32.Parse(request.Params["photoID"]);
                    int directoryID = Int32.Parse(request.Params["directoryID"]);

                    PhotoDirectory dir    = (PhotoDirectory)((Hashtable)Session["photo_DirectoryLookup"])[directoryID];
                    Photos         photos = dir.GetPhotos();
                    Photo          photo  = (Photo)photos[photoID];
                    string         newurl = Context.Request.Path;

                    //Photo nextPhoto = (Photo)photos.GetByIndex(photos.IndexOf(photo) + 1);
                    DirectoryBrowser dirBrowser = (DirectoryBrowser)Session["photo_DirectoryBrowser"];
                    dirBrowser.DeletePhoto(photo, this.MapPath(null) + "\\photos");
                    Response.Redirect(newurl);
                }
                else if (request.Params["PhotoBrowser1:DirMaintainType"] == "DirRename")
                {
                }
                else if (request.Params["PhotoBrowser1:DirMaintainType"] == "DelDir")
                {
                }
                else if (FileUpload1.HasFile)
                {
                    UploadFile(curfullpath);
                    InitPage(request);
                    ShowByDirectoryID(((PhotoDirectory)Session["photo_CurrentDirectory"]).Id);
                }
                ClearCmd();
            }
            pnlImageNavigationBottom.Visible = DISPLAY_BOTTOM_IMAGE_NAVIGATION;
        }
Exemple #17
0
 public ImageBrowserController()
 {
     directoryBrowser = new DirectoryBrowser();
     thumbnailCreator = new ThumbnailCreator(new FitImageResizer());
 }
 public FileBrowserController()
 {
     directoryBrowser   = new DirectoryBrowser();
     contentInitializer = new ContentInitializer(contentFolderRoot, foldersToCopy, prettyName);
 }
Exemple #19
0
 public ImageBrowserController()
 {
     _directoryBrowser = new DirectoryBrowser();
     _thumbnailCreator = new ThumbnailCreator();
 }
Exemple #20
0
        public static void ExportTables(IEnumerable<string> selectedTables, string exportMethod, string separator, ProgressWindow progress)
        {
            var t = new DirectoryBrowser();
            if (!string.IsNullOrEmpty(_selectedPath))
                t.SelectedPath = _selectedPath;
            t.Show();

            if (t.DialogResult != DialogResult.OK) return;

            _selectedPath = t.SelectedPath;

            Logger.LogInfo("Exporting data to directory: {0}", _selectedPath);

            var dbPath = DBUtilities.DbPath;

            foreach (var selectedTable in selectedTables)
            {
                if (progress.Worker.CancellationPending)
                {
                    progress.Args.Cancel = true;
                    return;
                }

                var startInfo = new ProcessStartInfo
                                    {
                                        FileName = "SqlCeCmd40.exe",
                                        WorkingDirectory = Directory.GetCurrentDirectory() + "\\tools",
                                        CreateNoWindow = true,
                                        UseShellExecute = true,
                                        WindowStyle = ProcessWindowStyle.Hidden,
                                    };

                if (exportMethod == "CSV") //export CSV
                {
                    var outputFile = string.Format("{0}\\{1}.csv", _selectedPath, selectedTable);

                    startInfo.Arguments = string.Format(
                        "-d \"Data Source={0}\" -q \"SELECT * FROM {1}\" -o \"{2}\" -h {3} -s \"{4}\" -W",
                        dbPath, selectedTable, outputFile, Int32.MaxValue, separator);

                }
                else //export XML
                {
                    var outputFile = string.Format("{0}\\{1}.xml", _selectedPath, selectedTable);

                    startInfo.Arguments = string.Format(
                        "-d \"Data Source={0}\" -q \"SELECT * FROM {1}\" -o \"{2}\" -x",
                        dbPath, selectedTable, outputFile);
                }
                using (var process = Process.Start(startInfo))
                {
                    process.WaitForExit();
                }

                ++progress.Current;
                progress.InvokeUpdate(selectedTables.Count(), string.Format("Exporting table '{0}'", selectedTable));
            }
        }
Exemple #21
0
        static int Main(string[] args)
        {
            OpenEngSBConnectionManager.initInstance(xlinkServerURL, domainId, programname, hostIp, classNameOfOpenEngSBModel, openengsbContext);
            openengsbConnectionManager = OpenEngSBConnectionManager.getInstance();
            directoryBrowser           = new DirectoryBrowser();

            if (args.Length < 1)
            {
                exitProgramWithError("Missing Parameter\nUsage: " + programname + " {workingDirectory}");
            }
            if (!directoryBrowser.setWorkingDirectory(args[0]))
            {
                exitProgramWithError("Supplied Path \"" + args[0] + "\" is not a directory.");
            }
            openengsbContext = args[1];
            printWelcomeInformation();

            connectToOpenEngSBAndRegisterForXLink();

            outputLine("Insert your command:");

            String line;

            while ((line = Console.ReadLine()) != null)
            {
                if (line.StartsWith("changeWD"))
                {
                    string[] lineParams = line.Split(' ');
                    if (lineParams.Length < 2)
                    {
                        outputLine("changeWD <directoryPath> - directoryPath is missing");
                        continue;
                    }
                    string param = lineParams[1];
                    if (directoryBrowser.setWorkingDirectory(param))
                    {
                        outputLine("WorkingDirectory changed.");
                        directoryBrowser.reloadListOfWorkingDirectoryFiles();
                    }
                }
                else if (line.Equals("displayWD"))
                {
                    directoryBrowser.displayWorkingDirectory();
                }
                else if (line.Equals("help"))
                {
                    processHelp();
                }
                else if (line.StartsWith("changeFT"))
                {
                    string[] lineParams = line.Split(' ');
                    if (lineParams.Length < 2)
                    {
                        outputLine("changeFT <filetype> - filetype is missing");
                        continue;
                    }
                    directoryBrowser.changeFileType(lineParams[1]);
                }
                else if (line.Equals("displayFT"))
                {
                    directoryBrowser.displaySupportedFileTypes();
                }
                else if (line.Equals("displaySupportedFT"))
                {
                    directoryBrowser.displaySupportedFileTypes();
                }
                else if (line.Equals("list"))
                {
                    directoryBrowser.displayListOfWorkingDirectoryFiles();
                }
                else if (line.Equals("reload"))
                {
                    directoryBrowser.reloadListOfWorkingDirectoryFiles();
                }
                else if (line.StartsWith("open"))
                {
                    string[] lineParams = line.Split(' ');
                    if (lineParams.Length < 2)
                    {
                        outputLine("open <filename> - filename is missing");
                        continue;
                    }
                    directoryBrowser.openFile(lineParams[1]);
                }
                else if (line.StartsWith("exit"))
                {
                    break;
                }
                else if (line.StartsWith("xlink"))
                {
                    if (!openengsbConnectionManager.isConnected())
                    {
                        outputLine("No connection to the OpenEngSB.");
                        continue;
                    }
                    string[] lineParams = line.Split(' ');
                    if (lineParams.Length < 2)
                    {
                        outputLine("xlink <filename> - filename is missing");
                        continue;
                    }
                    directoryBrowser.createXLinkFromFileString(lineParams[1]);
                }
                else if (line.Equals("listLocalSwitch"))
                {
                    if (!openengsbConnectionManager.isConnected())
                    {
                        outputLine("No connection to the OpenEngSB.");
                        continue;
                    }
                    openengsbConnectionManager.listOtherLocalInstalledSoftwareTools();
                }
                else if (line.StartsWith("localSwitch"))
                {
                    if (!openengsbConnectionManager.isConnected())
                    {
                        outputLine("No connection to the OpenEngSB.");
                        continue;
                    }
                    string[] lineParams = line.Split(' ');
                    if (lineParams.Length < 4)
                    {
                        outputLine("missin parameters. Insert 'help' for usage.");
                        continue;
                    }
                    openengsbConnectionManager.triggerLocalSwitch(lineParams[1], lineParams[2], lineParams[3]);
                }
                else
                {
                    outputLine("Unknown command \"" + line + "\".\nType \"help\" to list all commands.");
                }
                outputLine("\nInsert your command:");
            }
            exitProgramWithSucces();
            return(0);
        }
 public DirectoriesController()
 {
     _dirBrowser = new DirectoryBrowser();
 }
 public FileManagerController()
 {
     directoryBrowser = new DirectoryBrowser();
 }
Exemple #24
0
 bool doSaveExampleFilesPathDialog()
 {
     DirectoryBrowser dirBrowser = new DirectoryBrowser();
     if (dirBrowser.ShowDialog("Example File Path") == DialogResult.OK)
     {
         m_strUserExampleFilesPath = dirBrowser.DirectoryPath;
         return true;
     }
     return false;
 }
 private void btnExampleFiles_Click(object sender, System.EventArgs e)
 {
     DirectoryBrowser dirBrowser = new DirectoryBrowser();
     if (dirBrowser.ShowDialog("Example File Path") == DialogResult.OK)
     {
         ExampleFiles = dirBrowser.DirectoryPath;
     }
 }