Exemplo n.º 1
0
        public static string ExportDir(DirRec rec)
        {
            if (!Iso9660.ReadFile(rec))
            {
                return(null);
            }

            byte[] data = new byte[rec.LenRecord];
            if (!RamDisk.Get(rec.GetPos(), rec.LenRecord, data))
            {
                return(null);
            }

            string[] parts = rec.GetUrl().Split(new char[] { ':' });
            string   dir   = AppDomain.CurrentDomain.BaseDirectory + "tmp/";
            string   path  = (dir + parts[1]).Replace('/', '\\');

            try {
                Directory.CreateDirectory(Path.GetDirectoryName(path));
                FileStream file = File.Create(path);
                file.Write(data, 0, rec.LenRecord);
                file.Close();
                return(path);
            } catch (Exception e) {
                Logger.Fail("Cannot create file " + path + " " + e.Message);
                return(null);
            }
        }
Exemplo n.º 2
0
 public static bool ImportFiles(DirRec dir, string[] files)
 {
     Console.WriteLine(dir.GetUrl());
     foreach (string file in files)
     {
         Console.WriteLine(file);
     }
     return(true);
     //if (!Iso9660.ReadFile(rec)) {
     //    return null;
     //}
     //byte[] data = new byte[rec.LenData];
     //if (!RamDisk.Get(rec.LbaData*2048, rec.LenData, data)) {
     //    return null;
     //}
     //string[] parts = rec.GetUrl().Split(new char[] {':'});
     //string dir = AppDomain.CurrentDomain.BaseDirectory+"tmp/";
     //string path = (dir+parts[1]).Replace('/', '\\');
     //try {
     //    Directory.CreateDirectory(Path.GetDirectoryName(path));
     //    FileStream file = File.Create(path);
     //    file.Write(data, 0, rec.LenData);
     //    file.Close();
     //    return path;
     //} catch (Exception e) {
     //    Logger.Fail("Cannot create file "+path+" "+e.Message);
     //    return null;
     //}
 }
Exemplo n.º 3
0
 public Actor(string url, int pos, DirRec rec,
              Zone zone, int zoneid, int actorid, DirRec zud_rec) :
     base(url, pos, rec)
 {
     this.zone    = zone;
     this.ZoneId  = zoneid;
     this.ActorId = actorid;
     zud          = Model.zuds[zud_rec.GetUrl()];
 }
Exemplo n.º 4
0
 public Room(string url, int pos, DirRec rec,
             Zone zone, int zoneid, int roomid) :
     base(url, pos, rec)
 {
     mpd       = Model.mpds[rec.GetUrl()];
     this.zone = zone;
     ZoneId    = zoneid;
     RoomId    = roomid;
     Name      = rec.GetFileName();
 }
Exemplo n.º 5
0
        public Zone(string url, int pos, DirRec rec) :
            base(url, pos, rec)
        {
            znd = Model.znds[rec.GetUrl()];

            string file = rec.GetFileName();
            string text = file.Substring(4, file.IndexOf('.') - 4);

            zoneid = int.Parse(text);
        }
Exemplo n.º 6
0
        public bool AddRoom(TreeNode root, int id, int pos)
        {
            int lba = RamDisk.GetS32(pos + 8 * id);

            try {
                string url = GetUrl() + "/Room/" + id;
                DirRec mpd = Iso9660.GetByLba(lba);
                Room   obj = new Room(mpd.GetUrl(), 0, mpd, this, zoneid, id);
                rooms.Add(obj);
                Model.Add(url, obj);
                Publisher.Register(obj);

                TreeNode node = root.Nodes.Add(url, mpd.GetFileName(), 1, 1);
                obj.AddRoom(node, url, id, pos);
                return(true);
            } catch {
                return(false);
            }
        }