Exemplo n.º 1
0
        protected List <int> FindTwoByteValue(byte a, byte b)
        {
            var data = new DiscData();

            data.LoadData(RawData);
            return(data.FindTwoByteValue(a, b));
        }
Exemplo n.º 2
0
        protected List <int> FindBytesInVicinity(List <Tuple <byte, byte> > bytePairs, int range)
        {
            var data = new DiscData();

            data.LoadData(RawData);
            var indices         = data.FindTwoByteValue(bytePairs[0].Item2, bytePairs[0].Item1);
            var matchingIndices = new List <int>();

            foreach (var index in indices)
            {
                bool match = true;
                foreach (var bytePair in bytePairs)
                {
                    var matches = data.SearchVicinityForTwoBytes(index, range, bytePair.Item2, bytePair.Item1);
                    if (matches.Count == 0)
                    {
                        match = false;
                        break;
                    }
                }
                if (!match)
                {
                    continue;
                }
                matchingIndices.Add(index);
            }
            return(matchingIndices);
        }
Exemplo n.º 3
0
        protected List <int> FindByteSequence(List <byte> byteSequence)
        {
            var data = new DiscData();

            data.LoadData(RawData);
            return(data.FindByteSequence(byteSequence));
        }
Exemplo n.º 4
0
        // Add Persistant Order information to XML file
        public static void AddOrder(DiscData discOrder)
        {
            // Make sure file exists before attempting to add orders
            if (!File.Exists(GlobalVar.OrderTrackingFile))
            {
                CreateDocument();
            }

            XmlDocument document = new XmlDocument();

            document.Load(GlobalVar.OrderTrackingFile);
            // Create a document fragment to contain the XML to be inserted.
            XmlDocumentFragment order = document.CreateDocumentFragment();
            // Set the contents of the document fragment.
            XmlDocumentFragment orderxml = document.CreateDocumentFragment();

            string newOrder = "<order OrderId = \"" + discOrder.OrderID + "\"" + " ClientId=" + "\"" + discOrder.ClientID + "\"" +
                              " Status=" + "\"" + discOrder.OrderStatus + "\"" + " PercentComplete= " + "\"" + discOrder.PercentComplete + "\"" + " ProductionOrderPath= " + "\"" + discOrder.ProductionOrderPath + "\"" + " Durable=" + "\"" + discOrder.Durable + "\"" + "/>";

            orderxml.InnerXml = newOrder;
            XmlNode currNode = document.DocumentElement.FirstChild;

            currNode.InsertAfter(orderxml, currNode.LastChild);
            document.Save(GlobalVar.OrderTrackingFile);
        }
Exemplo n.º 5
0
        public DiscDataEx(DiscData disc, int slotId, int changerId)
        {
            this.DiscId      = disc.DiscId;
            this.DiscType    = disc.DiscType;
            this.DrivePath   = disc.DrivePath;
            this.VolumeLabel = disc.VolumeLabel;
            this.SlotId      = slotId;
            this.ChangerId   = changerId;

            if (disc.DiscType == DiscType.MovieDvd)
            {
                //load additional movie crud
                this.Director    = this.GetMetaString(disc.MediaMetadata, "Director");
                this.Title       = this.GetMetaString(disc.MediaMetadata, "Title");
                this.ReleaseDate = this.GetMetaString(disc.MediaMetadata, "ReleaseDate");
                this.MPAARating  = this.GetMetaString(disc.MediaMetadata, "MPAARating");
                this.Duration    = this.GetMetaString(disc.MediaMetadata, "Duration");
            }
        }
Exemplo n.º 6
0
        public ICollection <DiscViewModel> GetByName(String name)
        {
            List <DiscViewModel> vm = new List <DiscViewModel>();
            DiscViewModel        dvm;
            List <DiscDTO>       data = new DiscData().GetByName(name);

            foreach (DiscDTO item in data)
            {
                dvm = new DiscViewModel();

                dvm.DiscName = item.Title;
                dvm.Author   = item.Performer.PerformerName;
                dvm.TypeSet  = item.DiscTypeSet.Select(i => i.TypeElement.TypeName).ToList();
                dvm.Score    = item.ScoreSet.Sum(i => i.ScoreValue);

                vm.Add(dvm);
            }

            return(vm);
        }
        public DiscDataEx(DiscData disc, int slotId, int changerId)
        {
            this.DiscId = disc.DiscId;
            this.DiscType = disc.DiscType;
            this.DrivePath = disc.DrivePath;
            this.VolumeLabel = disc.VolumeLabel;
            this.SlotId = slotId;
            this.ChangerId = changerId;

            if (disc.DiscType == DiscType.MovieDvd)
            {
                //load additional movie crud
                this.Director = this.GetMetaString(disc.MediaMetadata, "Director");
                this.Title = this.GetMetaString(disc.MediaMetadata, "Title");
                this.ReleaseDate = this.GetMetaString(disc.MediaMetadata, "ReleaseDate");
                this.MPAARating = this.GetMetaString(disc.MediaMetadata, "MPAARating");
                this.Duration = this.GetMetaString(disc.MediaMetadata, "Duration");
            }
        }
Exemplo n.º 8
0
        public static string GetSaturnSerial(string cuePath)
        {
            if (!File.Exists(cuePath))
            {
                return("");
            }

            int  lba  = 0;
            Disc disc = Disc.LoadAutomagic(cuePath);

            if (disc == null)
            {
                // unable to mount disc - return null
                return("");
            }

            var discView = EDiscStreamView.DiscStreamView_Mode1_2048;

            if (disc.TOC.Session1Format == SessionFormat.Type20_CDXA)
            {
                discView = EDiscStreamView.DiscStreamView_Mode2_Form1_2048;
            }

            var  iso   = new ISOFile();
            bool isIso = iso.Parse(new DiscStream(disc, discView, 0));

            /*
             * if (isIso)
             * {
             *  var appId = System.Text.Encoding.ASCII.GetString(iso.VolumeDescriptors[0].ApplicationIdentifier).TrimEnd('\0', ' ');
             *
             *  var desc = iso.Root.Children;
             *
             *  ISONode ifn = null;
             *
             *  foreach (var i in desc)
             *  {
             *      if (i.Key.Contains("SYSTEM.CNF"))
             *          ifn = i.Value;
             *  }
             *
             *  if (ifn == null)
             *  {
             *      lba = 23;
             *  }
             *  else
             *  {
             *      lba = Convert.ToInt32(ifn.Offset);
             *  }
             * }
             * else
             * {
             *  lba = 23;
             * }
             *
             */

            DiscIdentifier di = new DiscIdentifier(disc);

            // start at lba 0 (saturn header information is usually there)
            byte[] data = di.GetPSXSerialNumber(lba);

            Dictionary <int, string> sDict = new Dictionary <int, string>();

            DiscData sd = new DiscData();

            for (int i = 0; i < 8; i++)
            {
                int    blockSize = 32;
                byte[] data32    = data.ToList().Skip(i * (blockSize)).Take(blockSize).ToArray();
                string sS        = System.Text.Encoding.Default.GetString(data32);
                sDict.Add(i, sS);
            }



            return("");
        }