Example #1
0
        public static void save_task(string tname, BackupTask bt)
        {
            MemoryStream  ms            = new MemoryStream();
            XmlSerializer SerializerObj = new XmlSerializer(typeof(BackupTask));

            SerializerObj.Serialize(ms, bt);

            byte[] buf       = ms.ToArray();
            uint   writesize = 0;

            REDDY.ptrIFSDMux.CreateFile(2, "\\" + tname + "\\task.xml", FileAccess.ReadWrite,
                                        FileShare.ReadWrite, FileMode.OpenOrCreate, FileOptions.None, null);
            REDDY.ptrIFSDMux.WriteFile(2, "\\" + tname + "\\task.xml", buf, ref writesize, 0, null);
            REDDY.ptrIFSDMux.CloseFile(2, "\\" + tname + "\\task.xml", null);
            DEFS.DEBUGYELLOW("TK", "Wrote file size = " + buf.Length);
        }
Example #2
0
        public static BackupTask load_task(string tname)
        {
            Inode_Info[] inodes = REDDY.ptrIFSDMux.FindFilesInternalAPI(2, "\\" + tname);

            for (int i = 0; i < inodes.Length; i++)
            {
                if (inodes[i].name.Equals("task.xml"))
                {
                    byte[] buffer   = new byte[inodes[i].size];
                    uint   readsize = 0;
                    REDDY.ptrIFSDMux.ReadFile(2, "\\" + tname + "\\task.xml", buffer, ref readsize, 0, null);
                    MemoryStream ms = new MemoryStream(buffer);
                    ms.Seek(0, SeekOrigin.Begin);
                    XmlSerializer SerializerObj = new XmlSerializer(typeof(BackupTask));
                    BackupTask    bt            = (BackupTask)SerializerObj.Deserialize(ms);
                    return(bt);
                }
            }
            return(null);
        }
Example #3
0
 public Backup_Worker(BackupTask bt, string njb)
 {
     InitializeComponent();
     m_bt       = bt;
     newjobname = njb;
 }