예제 #1
0
        private void btnCollectLinks_Click(object sender, EventArgs e)
        {
            lblStatus.Text = "Starting";
            //cFile oFile = new cFile("C:\\Users\\joshua\\Sync\\Dropbox\\Documents\\FF\\input");
            //string[] fileList = oFile.GetAllFileList("C:\\Users\\joshua\\Sync\\Dropbox\\Documents\\FF\\input");
            //cUrlCollector oUrlCollector = new cUrlCollector();
            List <string> sPaths = GetLinks();
            // oUrlCollector.GetLinks(fileList);
            cUrlTool oUrl = new cUrlTool();

            oUrl.ExportedLinkPath = "C:\\Users\\joshua\\Sync\\Dropbox\\Documents\\FF\\InputsAll.txt";
            int iCnt = 0;

            foreach (string sT in sPaths)
            {
                string sOutput = "FF" + iCnt.ToString() + ".txt";
                sPaths.Add(sT);
                oUrl.GetLinks(sT);
                oUrl.WriteLinks(sOutput);
                iCnt += 1;
            }
            //oUrl.GetLinks("C:\\Users\\joshua\\Sync\\Dropbox\\Documents\\FF\\input");
            //oUrl.WriteLinks(oUrl.UrlList);
            lblStatus.Text = "Finished";
        }
예제 #2
0
        private void importSortTextFileLinks()
        {
            cFile oFile = new cFile("FilesLoaded");

            try
            {
                string startupPath = Application.StartupPath;
                using (FolderBrowserDialog dialog = new FolderBrowserDialog())
                {
                    dialog.Description = "Open a folder which contains the xml output";
                    //  dialog.ShowNewFolderButton = false;
                    // dialog.RootFolder = Environment.SpecialFolder.MyComputer;
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        string folder = dialog.SelectedPath;
                        lblOutput.Text = dialog.SelectedPath;
                        foreach (string fileName in Directory.GetFiles(folder, "*.txt", SearchOption.AllDirectories))
                        {
                            oTool.ExportedLinkPath = "Input.txt";
                            List <string> sUrls = oTool.GetLinksFromFile(fileName);
                            oTool.WriteLinks(sUrls);
                            oTool.AddUrlList(sUrls);
                            oFile.Write(fileName);
                            //SQLGenerator.GenerateSQLTransactions(Path.GetFullPath(fileName));
                        }
                        oTool.Sort();
                    }
                }
                //using (OpenFileDialog dialog = new OpenFileDialog())
                //{
                //    dialog.Filter = "xml files (*.xml)|*.xml";
                //    dialog.Multiselect = false;
                //    dialog.InitialDirectory = ".";
                //    dialog.Title = "Select file (only in XML format)";
                //    if (dialog.ShowDialog() == DialogResult.OK)
                //    {
                //        SQLGenerator.GenerateSQLTransactions(Application.StartupPath + Settings.Default.xmlFile);
                //    }
                //}
                lblOutput.Text = "done";
            }
            catch (Exception exc)
            {
                MessageBox.Show("Import failed because " + exc.Message + " , please try again later.");
            }
        }
예제 #3
0
        private void btnCollectLinks_Click(object sender, EventArgs e)
        {
            lblStatus.Text = "Starting";
            string sPath = "";

            sPath = "E:\\sync\\Dropbox\\Documents\\FF\\input";
            //cFile oFile = new cFile("C:\\Users\\joshua\\Sync\\Dropbox\\Documents\\FF\\input");
            //string[] fileList = oFile.GetAllFileList("C:\\Users\\joshua\\Sync\\Dropbox\\Documents\\FF\\input");
            //cUrlCollector oUrlCollector = new cUrlCollector();
            // oUrlCollector.GetLinks(fileList);
            cUrlTool oUrl = new cUrlTool();

            oUrl.ExportedLinkPath = "E:\\sync\\Dropbox\\Documents\\FF\\InputsAll.txt";
            //oUrl.ExportedLinkPath = "C:\\Users\\joshua\\Sync\\Dropbox\\Documents\\FF\\InputsAll.txt";
            //oUrl.GetLinks("C:\\Users\\joshua\\Sync\\Dropbox\\Documents\\FF\\input");
            oUrl.GetLinks(sPath);
            oUrl.WriteLinks(oUrl.UrlList);
            lblStatus.Text = "Finished";
        }
예제 #4
0
        private Task ProcessFile(string fileName)
        {
            cFile oFile = new cFile("log");
            // use await here, like so
            Task task = new Task(() =>
            {
                try
                {
                    cUrlTool voTool = new cUrlTool();
                    voTool.GetLinksFromFile(fileName);
                    voTool.WriteLinks();
                }
                catch (Exception ex)
                {
                    oFile.Write(ex.Message);
                }
            });

            //Task<List<String>> voTask = new Task<List<String>>(() => GetLinksFromFile(vsFilepath));
            return(task);
        }