public string[] get_data_for_datagridview()
 {
     string[] strx = new string[8];
     strx[0] = drive_id.ToString();
     strx[1] = DEFS.getDataInStringRep(drive_size);
     strx[2] = DateTime.FromBinary(ctime).ToShortTimeString() + " " + DateTime.FromBinary(ctime).ToShortDateString();
     strx[3] = "-";
     strx[4] = "-";
     strx[5] = drive_state;
     strx[6] = remote_ip;
     strx[7] = "-";
     return(strx);
 }
示例#2
0
        public string[] get_data_for_datagridview()
        {
            lock (data)
            {
                Random r        = new Random();
                long   ctime    = get_long(CFSvalueoffsets.fsid_created);
                long   rtime    = get_long(CFSvalueoffsets.fsid_lastrefresh);
                long   adeltime = get_long(CFSvalueoffsets.fsid_lastrefresh);

                string[] row = new string[10];
                row[0] = m_dbn.ToString();
                row[1] = get_string(CFSvalueoffsets.fsid_namel, CFSvalueoffsets.fsid_name_str);
                row[2] = get_string(CFSvalueoffsets.fsid_bnamel, CFSvalueoffsets.fsid_bname_str);
                row[3] = DateTime.FromBinary(ctime).ToShortTimeString() + " " + DateTime.FromBinary(ctime).ToShortDateString();
                row[4] = " - "; // DateTime.FromBinary(adeltime).ToShortTimeString() + " " + DateTime.FromBinary(adeltime).ToShortDateString();
                row[5] = " - "; // DateTime.FromBinary(rtime).ToShortTimeString() + " " + DateTime.FromBinary(rtime).ToShortDateString();
                row[6] = DEFS.getDataInStringRep(get_logical_data());
                row[7] = " - ";
                row[8] = " - ";
                return(row);
            }
        }
示例#3
0
        private void worker_thread()
        {
            /*
             * First check the folder for the last job exists/
             */
            update_ui(1, 0, "Working..");
            string oldjobpath = null;

            for (int id = (m_bt.JobCount - 1); id >= 0; id--)
            {
                string jobname = m_bt.fetch_job_name(id);
                if (jobname == null)
                {
                    continue;
                }
                else
                {
                    oldjobpath = "\\" + m_bt.TaskName + "\\" + jobname;
                    break;
                }
            }

            string newjobpath = "\\" + m_bt.TaskName + "\\" + newjobname;

            DEFS.DEBUG("BACKUP", "Found current job path = " + oldjobpath);

            //MessageBox.Show("Backup folders " + oldjobpath + "->" + newjobpath);
            if (oldjobpath != null)
            {
                if (REDDY.ptrIFSDMux.CloneDirectoryTlock(2, oldjobpath, 2, newjobpath) != true)
                {
                    MessageBox.Show("failed to create new job dir " + oldjobpath + "->" + newjobpath);
                    thread_stopped = true;
                    update_ui(0, 0, null);
                    return;
                }
            }
            else
            {
                if (REDDY.ptrIFSDMux.CreateDirectory(2, newjobpath, null) != 0)
                {
                    MessageBox.Show("failed to create new job dir");
                    thread_stopped = true;
                    update_ui(0, 0, null);
                    return;
                }
            }
            update_ui(1, 0, "[DONE]");

            update_ui(2, 0, "Working..");

            long totaldatasetsize = fetch_total_data_to_scan();

            DEFS.DEBUG("BACKUP", "Inititing target directory, " + newjobpath);

            /*
             * Now create a new checksum file, and start writing new checksums there.
             */
            string oldchecksumfilepath = "\\" + m_bt.TaskName + "\\" + newjobname + "\\checksumfile";
            string newchecksumfilepath = "\\" + m_bt.TaskName + "\\" + newjobname + "\\checksumfile.new";

            REDDY.ptrIFSDMux.CreateFile(2, newchecksumfilepath, FileAccess.ReadWrite, FileShare.ReadWrite, FileMode.CreateNew, FileOptions.None, null);

            bool isfirstjob = (oldjobpath == null);

            if (stop_thread == true)
            {
                thread_stopped = true;
                update_ui(0, 0, null);
                return;
            }

            int curroffset = 0;

            update_ui(2, 0, "[DONE] " + DEFS.getDataInStringRep(totaldatasetsize));


            for (int i = 0; i < m_bt.BackupPaths.Count; i++)
            {
                backup_pair bp = m_bt.BackupPaths.ElementAt(i);
                if (bp.IsFile)
                {
                    string destfile = "\\" + m_bt.TaskName + "\\" + newjobname + "\\" + bp.DestinationPath;
                    bool   ret      = backup_file(isfirstjob, oldchecksumfilepath, newchecksumfilepath, ref curroffset, bp.SourcePath, destfile);
                    if (ret == false)
                    {
                        DEFS.DEBUG("BACKUP", "Backup of file " + bp.SourcePath + " failed!");
                        break;
                    }
                }
                else
                {
                    string destfolder = "\\" + m_bt.TaskName + "\\" + newjobname + "\\" + bp.DestinationPath;
                    backup_folder(isfirstjob, oldchecksumfilepath, newchecksumfilepath, ref curroffset, bp.SourcePath, destfolder);
                }
            }
            REDDY.ptrIFSDMux.DeleteFile(2, oldchecksumfilepath, null);
            REDDY.ptrIFSDMux.RenameInode2a(2, newchecksumfilepath, "checksumfile");
            update_ui(5, 0, "[OKAY]");
            thread_stopped = true;
            update_ui(0, 0, null);
        }
        public BackupJobDetailsUI(string name, List <backup_pair> pairs, List <job_item> joblist)
        {
            InitializeComponent();
            textBox3.Text = name;

            if (pairs != null)
            {
                for (int i = 0; i < pairs.Count; i++)
                {
                    backup_pair bp = pairs.ElementAt(i);
                    dgv_fldlist.Rows.Add(new string[] { bp.SourcePath, bp.DestinationPath, (bp.IsFile)? "Y": "N" });
                }
                dgv_fldlist.Invalidate();
            }

            if (joblist != null)
            {
                for (int i = 0; i < joblist.Count; i++)
                {
                    job_item ji = joblist.ElementAt(i);
                    dgv_joblist.Rows.Add(new string[] { ji.JobID.ToString(), ji.JobName, ji.StartTime, DEFS.getDataInStringRep(ji.NewCopiedData) });
                }
                dgv_joblist.Invalidate();
            }
        }