示例#1
0
        public void CountFiles(string sDir)
        {
            try
            {
                foreach (string d in Directory.GetDirectories(sDir))
                {
                    CountFiles(d);
                }


                DirectoryInfo dir     = new DirectoryInfo(sDir);
                FileInfo[]    myFiles = dir.GetFiles("*.package");
                filesToProcess += myFiles.Length;
                foreach (FileInfo f in myFiles)
                {
                    fileInfo fi = new fileInfo();
                    fi.filename   = f.FullName;
                    fi.foldername = this.masterDir;

                    this.fileList.Push(fi);

                    fi = null;
                }

                Application.DoEvents();
            }
            catch (System.Exception excpt)
            {
                Console.WriteLine(excpt.Message);
            }
        }
示例#2
0
        // *************************************************************************************************
        // Create the Billing Report
        // *************************************************************************************************
        private void createRptFile(ReportDataSource rds, int cltID, fileInfo finfo, List <ReportParameter> rptParams)
        {
            if (!string.IsNullOrEmpty(finfo.rdlcFilename))
            {
                try
                {
                    Warning[] warnings;
                    string[]  streamIds;
                    string    mimeType  = string.Empty;
                    string    encoding  = string.Empty;
                    string    extension = string.Empty;

                    string       rptReportPath = finfo.rptPath;
                    string       rptOutPath    = finfo.rptOutPath; // *FI*
                    ReportViewer viewer        = new ReportViewer();
                    viewer.LocalReport.EnableExternalImages = true;
                    viewer.ProcessingMode         = ProcessingMode.Local;
                    viewer.LocalReport.ReportPath = string.Concat(@rptReportPath, finfo.rdlcFilename); // *FI*
                    viewer.LocalReport.DataSources.Add(rds);                                           // Add datasource here
                    viewer.LocalReport.SetParameters(rptParams);
                    viewer.LocalReport.Refresh();
                    byte[] bytes    = viewer.LocalReport.Render(rptType(finfo.rptFileExt), null, out mimeType, out encoding, out extension, out streamIds, out warnings);
                    string filename = string.Concat(@rptOutPath, finfo.rptFileName + "." + finfo.rptFileExt);
                    using (var fs = new FileStream(filename, FileMode.Create))
                    {
                        fs.Write(bytes, 0, bytes.Length);
                        fs.Close();
                    }
                }
                catch
                {
                }
            }
        }
        public void CountFiles(string sDir)
        {
            try
            {

                foreach (string d in Directory.GetDirectories(sDir))
                {
                    CountFiles(d);
                }

                DirectoryInfo dir = new DirectoryInfo(sDir);
                FileInfo[] myFiles = dir.GetFiles("*.package");
                filesToProcess += myFiles.Length;
                foreach (FileInfo f in myFiles)
                {
                    fileInfo fi = new fileInfo();
                    fi.filename = f.FullName;
                    fi.foldername = this.masterDir;

                    this.fileList.Push(fi);

                    fi = null;
                }

                Application.DoEvents();

            }
            catch (System.Exception excpt)
            {
                Console.WriteLine(excpt.Message);
            }
        }
        public ActionResult DeleteConfirmed(long id)
        {
            fileInfo fileInfo = db.fileInfoes.Find(id);

            db.fileInfoes.Remove(fileInfo);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#5
0
 /// <remarks/>
 public System.IAsyncResult BeginVerification(fileInfo fileInfo, byte[] fileContent, System.DateTime verifAllaData, System.AsyncCallback callback, object asyncState)
 {
     return(this.BeginInvoke("Verification", new object[] {
         fileInfo,
         fileContent,
         verifAllaData
     }, callback, asyncState));
 }
示例#6
0
    public Return Verification([System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] fileInfo fileInfo, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, DataType = "base64Binary")] byte[] fileContent, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] System.DateTime verifAllaData)
    {
        object[] results = this.Invoke("Verification", new object[] {
            fileInfo,
            fileContent,
            verifAllaData
        });

        return((Return)(results[0]));
    }
 public ActionResult Edit([Bind(Include = "FID,volID,pciFlag,piiFlag,specFlag,retFlag,unknownFlag,publicFlag,internalFlag,confidentialFlag,confidentialsFlag,secretFlag")] fileInfo fileInfo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(fileInfo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.volID = new SelectList(db.volumes, "volID", "volumeName", fileInfo.volID);
     return(View(fileInfo));
 }
示例#8
0
 /// <remarks/>
 public void VerificationAsync(fileInfo fileInfo, byte[] fileContent, System.DateTime verifAllaData, object userState)
 {
     if ((this.VerificationOperationCompleted == null))
     {
         this.VerificationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnVerificationOperationCompleted);
     }
     this.InvokeAsync("Verification", new object[] {
         fileInfo,
         fileContent,
         verifAllaData
     }, this.VerificationOperationCompleted, userState);
 }
示例#9
0
        public int IsExist(ObservableCollection <fileInfo> fList, fileInfo f)
        {
            int i = -1;

            foreach (var item in fList)
            {
                if (item.Path == f.Path)
                {
                    return(++i);
                }
            }
            return(i);
        }
        // GET: fileInfoes/Details/5
        public ActionResult Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            fileInfo fileInfo = db.fileInfoes.Find(id);

            if (fileInfo == null)
            {
                return(HttpNotFound());
            }
            return(View(fileInfo));
        }
        // GET: fileInfoes/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            fileInfo fileInfo = db.fileInfoes.Find(id);

            if (fileInfo == null)
            {
                return(HttpNotFound());
            }
            ViewBag.volID = new SelectList(db.volumes, "volID", "volumeName", fileInfo.volID);
            return(View(fileInfo));
        }
示例#12
0
        private void btn_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Controls.Button btn = sender as System.Windows.Controls.Button;
            fileInfo file = btn.Tag as fileInfo;

            if (file.DownLoadStatus == "下载")
            {
                //这里可以设置是否打开文件存储路径,取消注释就会出现路径选择窗口
                //FolderBrowserDialog dia = new FolderBrowserDialog();
                //DialogResult result = dia.ShowDialog();
                //if (result == System.Windows.Forms.DialogResult.Cancel)
                //{ return; }
                //path = dia.SelectedPath;


                DownLoadProcess dp = new DownLoadProcess(FTP, file, path);
                this.OnDownLoadList.Add(dp);
                dp.StartDownLoad();//开始下载

                dp.OnDownloadStatusChanged += new DownLoadProcess.DownloadStatusChangeHandle(dp_OnDownloadStatusChanged);
            }
            //取消下载
            else if (file.DownLoadStatus == "打开")
            {
                try
                {
                    System.Diagnostics.Process.Start(path + "//" + file.fileName);
                }
                catch
                {
                    System.Windows.MessageBox.Show("文件已丢失,请重新下载!");
                }
            }
            else
            {
                foreach (DownLoadProcess d in OnDownLoadList)
                {
                    if (d.downloadFile == file)
                    {
                        d.StopDownload();
                        OnDownLoadList.Remove(d);
                        System.Windows.MessageBox.Show("已取消");
                        break;
                    }
                }
            }
        }
示例#13
0
        // *************************************************************************************************
        // ****  This process will get the information on how to process the billing report             ****
        // *************************************************************************************************
        private fileInfo GetBillFileInfo(int BillDeliveryID, int rptcltID, string billMonth, string billYear)
        {
            SQL02Billing billRptfile = new SQL02Billing();
            var          rptInfo     = (from c in billRptfile.GetBillDeliveryPrintCtrl(BillDeliveryID) select c).FirstOrDefault();
            fileInfo     finfo       = new fileInfo();

            finfo.rdlcFilename      = rptInfo.ReportName;                                                                                                                                //rdlc template name
            finfo.rptPath           = Properties.Settings.Default.reportPath;                                                                                                            // path of the rdlc template
            finfo.rptOutPath        = Properties.Settings.Default.exportedReports + Convert.ToString(rptcltID) + "\\" + Convert.ToString(billYear) + Convert.ToString(billMonth) + "\\"; // path of the created file
            finfo.rptReportGroup    = rptInfo.ReportGroup;                                                                                                                               // how the files will be seperated
            finfo.billToSend        = rptInfo.BillToSend;
            finfo.createNewFilename = rptInfo.ReportSeperateFile;                                                                                                                        // bool if the file should be in sep files
            finfo.rptFileExt        = cleanFileName(rptInfo.FileExt);
            if (!Directory.Exists(@finfo.rptOutPath))
            {
                Directory.CreateDirectory(@finfo.rptOutPath);
            }
            return(finfo);
        }
示例#14
0
        static void Main(string[] args)
        {
            var ctx = new Model1();

            var newEntry = new fileInfo()
            {
                volID = 1, pciFlag = 1, confidentialFlag = 1
            };

            ctx.fileInfoes.Add(newEntry);

            ctx.SaveChanges();

            //List<fileInfo> departments = new List<fileInfo>();

            //Data Source=DESKTOP-VSI09HO\SQLEXPRESS;Initial Catalog=V1;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False

            Console.WriteLine(newEntry);
            Console.ReadKey();
        }
示例#15
0
        static void Main(string[] args)
        {
            var path = @"c:\somefile.jpg";

            File.Copy(@"c:\temp\myfile.jpg", @"d:\temp\myfile.jpg", true);
            File.Delete(@"c:\temp\myfile.jpg", @"d:\temp\myfile.jpg", true);
            if (File.Exists(path))
            {
                //
            }
            var content = File.ReadAllText

                          var fileInfo = new fileInfo(path);

            fileInfo.CopyTo("...");
            fileInfoDelete();
            if (fileInfo.Exists)
            {
                //
            }
        }
示例#16
0
 //获取文件列表
 private void GetFiles(FTPHelper FTP)
 {
     if (FTP != null)
     {
         List <string> strFiles = FTP.GetFileList("*");
         if (strFiles == null)
         {
             ErroLable.Content = "很抱歉,文件夹为空!";
             return;
         }
         ErroLable.Content = "";
         files.Clear();
         for (int i = 0; i < strFiles.Count; i++)
         {
             fileInfo f = new fileInfo();
             f.fileName       = strFiles[i];
             f.DownLoadStatus = "下载";
             files.Add(f);
         }
     }
 }
示例#17
0
 /// <remarks/>
 public void VerificationAsync(fileInfo fileInfo, byte[] fileContent, System.DateTime verifAllaData)
 {
     this.VerificationAsync(fileInfo, fileContent, verifAllaData, null);
 }
示例#18
0
        // *************************************************************************************************
        // ****  This process will get the data for the billing report                                  ****
        // ****  The bills that are seperated into seperate files must create empty bills               ****
        // ****  There are some bill where the Datasource name and storedProc used are different        ****
        // ****  need to find a way to process these bills for clients                                  ****
        // ****  165,633,177
        // *************************************************************************************************
        private void GetRptData(int rptcltID, string billMonth, string billYear, int billDeliveryID)
        {
            fileInfo rptfileInfo            = GetBillFileInfo(billDeliveryID, rptcltID, billMonth, billYear);
            List <ReportParameter> rptparam = GetPBSParams(rptcltID, billMonth, billYear);
            var             sepFile         = rptfileInfo.rptReportGroup;
            BillingEntities billData        = new BillingEntities();
            int             qbillMonth      = Convert.ToInt32(billMonth);
            int             qbillYear       = Convert.ToInt32(billYear);
            var             tmprds          = (from brpt in billData.tblBillReportDatas
                                               where
                                               brpt.CltID == rptcltID &&
                                               brpt.BillDate.Value.Month == qbillMonth &&
                                               brpt.BillDate.Value.Year == qbillYear
                                               select brpt).ToList <tblBillReportData>();

            if (sepFile == "Location")
            {
                var cltFileSep = (from c in billData.v_CltLoc where c.CltID == rptcltID select c).ToList <v_CltLoc>();
                foreach (var l in cltFileSep)
                {
                    rptfileInfo.rptFileName = cleanFileName(l.LocName) + "_" + rptfileInfo.billToSend + Convert.ToString(billYear) + Convert.ToString(billMonth);
                    var temp             = from c in tmprds where c.LocID == l.FileSepCD select c;
                    ReportDataSource rds = new ReportDataSource("BillReportData", temp);
                    if (temp.Count() > 0)
                    {
                        createRptFile(rds, rptcltID, rptfileInfo, rptparam);
                    }
                }
            }
            if (sepFile == "Class")
            {
                var cltFileSep = (from c in billData.v_CltClass where c.CltID == rptcltID select c).ToList <v_CltClass>();
                foreach (var l in cltFileSep)
                {
                    rptfileInfo.rptFileName = cleanFileName(l.ClassName);
                    var temp             = from c in tmprds where c.ClassCD == l.FileSepCD select c;
                    ReportDataSource rds = new ReportDataSource("BillReportData", temp);
                    if (temp.Count() > 0)
                    {
                        createRptFile(rds, rptcltID, rptfileInfo, rptparam);
                    }
                }
            }
            if (sepFile == "Department")
            {
                var cltFileSep = (from c in billData.v_CltDept where c.CltID == rptcltID select c).ToList <v_CltDept>();
                foreach (var l in cltFileSep)
                {
                    rptfileInfo.rptFileName = cleanFileName(l.DeptNum);
                    var temp             = from c in tmprds where c.DeptNum == l.FileSepCD select c;
                    ReportDataSource rds = new ReportDataSource("BillReportData", temp);
                    if (temp.Count() > 0)
                    {
                        createRptFile(rds, rptcltID, rptfileInfo, rptparam);
                    }
                }
            }
            if (sepFile == "Carrier")
            {
                var cltFileSep = (from c in billData.v_CltCar where c.CltID == rptcltID select c).ToList <v_CltCar>();
                foreach (var l in cltFileSep)
                {
                    rptfileInfo.rptFileName = cleanFileName(l.CarName) + "_" + cleanFileName(l.CltShortName) + "_" + Convert.ToString(billYear) + Convert.ToString(billMonth);
                    var temp             = from c in tmprds where c.CarID == l.FileSepCD select c;
                    ReportDataSource rds = new ReportDataSource("BillReportData", temp);
                    if (temp.Count() > 0)
                    {
                        createRptFile(rds, rptcltID, rptfileInfo, rptparam);
                    }
                }
            }
            if (sepFile == "Master")
            {
                rptfileInfo.rptFileName = rptfileInfo.billToSend + Convert.ToString(billYear) + Convert.ToString(billMonth);
                var temp = (from brpt in billData.tblBillReportDatas
                            where
                            brpt.MasterCltID == rptcltID &&
                            brpt.BillDate.Value.Month == qbillMonth &&
                            brpt.BillDate.Value.Year == qbillYear
                            select brpt).ToList <tblBillReportData>();
                ReportDataSource rds = new ReportDataSource("BillReportData", temp);
                if (temp.Count() > 0)
                {
                    createRptFile(rds, rptcltID, rptfileInfo, rptparam);
                }
            }
            if (string.IsNullOrEmpty(sepFile))
            {
                if (tmprds.Any())
                {
                    // for regular bills if there is no data do not produce
                    rptfileInfo.rptFileName = rptfileInfo.billToSend + Convert.ToString(billYear) + Convert.ToString(billMonth);
                    ReportDataSource rds = new ReportDataSource("BillReportData", tmprds);
                    createRptFile(rds, rptcltID, rptfileInfo, rptparam);
                }
            }
        }
示例#19
0
        private void button2_Click(object sender, EventArgs e)
        {
            listView1.Items.Clear();

            if (this.needsUpgrade)
            {
                if (!chkFrameworkAmb.Checked)
                {
                    showMessage("Since you have a patch that supports a Global My Documents path, we need to move everything from the old folders to the new");
                    showMessage("First though, lets disable the old framework since it's not needed anymore...");

                    if (chkFrameworkTS3.Checked)
                    {
                        disableFramework(textBox1.Text);
                    }
                    if (chkFrameworkWA.Checked)
                    {
                        disableFramework(textBox2.Text);
                    }
                    if (chkFrameworkHELS.Checked)
                    {
                        disableFramework(textBox3.Text);
                    }

                    showMessage("Now attempt to install framework in My Documents...");
                    string globalModPath = Path.Combine(MadScience.Helpers.findMyDocs(), Path.Combine(@"Electronic Arts", MadScience.Helpers.gamesInstalled.baseName));
                    createFramework(globalModPath, false);
                    globalModPath = Path.Combine(globalModPath, Path.Combine("Mods", "Packages"));

                    checkLocations();

                    // TODO:REMOVE
                    chkFrameworkAmb.Checked = true;

                    if (chkFrameworkAmb.Checked)
                    {
                        // Check for explicit Mods\Packages folder
                        if (Directory.Exists(Path.Combine(MadScience.Helpers.gamesInstalled.baseGame.path, Path.Combine("Mods", "Packages"))))
                        {
                            this.masterDir = Path.Combine(MadScience.Helpers.gamesInstalled.baseGame.path, Path.Combine("Mods", "Packages"));
                            CountFiles(this.masterDir);
                        }
                        // Check for explicit Mods\Packages folder
                        if (Directory.Exists(Path.Combine(MadScience.Helpers.gamesInstalled.worldAdventures.path, Path.Combine("Mods", "Packages"))))
                        {
                            this.masterDir = Path.Combine(MadScience.Helpers.gamesInstalled.worldAdventures.path, Path.Combine("Mods", "Packages"));
                            CountFiles(this.masterDir);
                        }
                        // Check for explicit Mods\Packages folder
                        if (Directory.Exists(Path.Combine(MadScience.Helpers.gamesInstalled.highEndLoftStuff.path, Path.Combine("Mods", "Packages"))))
                        {
                            this.masterDir = Path.Combine(MadScience.Helpers.gamesInstalled.highEndLoftStuff.path, Path.Combine("Mods", "Packages"));
                            CountFiles(this.masterDir);
                        }


                        if (this.fileList.Count > 0)
                        {
                            label1.Text = "Copying old files to new mods folder, please wait...";
                            label1.Refresh();

                            // Start the process....
                            progressBar1.Maximum = this.fileList.Count;
                            //string myDocs = MadScience.Helpers.findMyDocs();
                            try
                            {
                                for (int i = 0; i < progressBar1.Maximum; i++)
                                {
                                    fileInfo fi = (fileInfo)this.fileList.Pop();
                                    FileInfo f  = new FileInfo(fi.filename);

                                    string folder = f.DirectoryName.Replace(fi.foldername, "");
                                    if (!String.IsNullOrEmpty(folder))
                                    {
                                        // create the directory
                                        if (!Directory.Exists(globalModPath + folder))
                                        {
                                            Directory.CreateDirectory(globalModPath + folder);
                                        }
                                    }
                                    //File.Move(f.filename, Path.Combine(globalModPath, fi.
                                    if (!File.Exists(Path.Combine(globalModPath + folder, f.Name)))
                                    {
                                        File.Copy(fi.filename, Path.Combine(globalModPath + folder, f.Name));
                                        //File.Move(fi.filename, Path.Combine(globalModPath + folder, f.Name));
                                    }
                                    progressBar1.Value++;
                                    progressBar1.Refresh();
                                }
                            }
                            catch (Exception ex)
                            {
                                showMessage("An error occured while trying to copy files to your My Documents folder!", Color.Salmon);
                                showMessage(ex.Message, Color.Salmon);
                            }
                        }
                    }
                }
            }
            else
            {
                if (!MadScience.Helpers.gamesInstalled.globalFramework.hasFramework)
                {
                    // Copy the DLL to each of the folders Game\Bin locations
                    if (!chkFrameworkTS3.Checked)
                    {
                        createFramework(textBox1.Text);
                    }
                    if (!chkFrameworkWA.Checked)
                    {
                        createFramework(textBox2.Text);
                    }
                    if (!chkFrameworkHELS.Checked)
                    {
                        createFramework(textBox3.Text);
                    }
                }
                else
                {
                    if (!chkFrameworkAmb.Checked)
                    {
                        createFramework(Path.Combine(MadScience.Helpers.findMyDocs(), Path.Combine(@"Electronic Arts", MadScience.Helpers.gamesInstalled.baseName)), false);
                    }
                }
            }
            checkLocations();
        }
示例#20
0
 var(fileInfo, expectedMessageCode) = info;