Esempio n. 1
0
        private static string GetArguments(AspiDeviceInfo deviceInfo, bool batchAllTracks, bool createInfoFiles, int trackNumber)
        {
            StringBuilder arguments = new StringBuilder();

            if (batchAllTracks)
            {
                arguments.AppendFormat("{0} ", FLAG_BATCH);
            }
            else
            {
                arguments.AppendFormat("{0}{1} ", FLAG_TRACK, trackNumber);
            }

            if (!createInfoFiles)
            {
                arguments.AppendFormat("{0} ", FLAG_NO_INFO);
            }

            arguments.AppendFormat("{0}{1} ", FLAG_DEVICE, deviceInfo);

            if (!batchAllTracks)
            {
                arguments.AppendFormat(FORMAT_TRACK_PATH, trackNumber);
            }

            return(arguments.ToString());
        }
Esempio n. 2
0
        private static void ParseOutput(string output, IList <AspiDeviceInfo> devices)
        {
            if (!string.IsNullOrEmpty(output))
            {
                string[] lines = output.Split(new char[] { LINE_BREAK }, StringSplitOptions.RemoveEmptyEntries);
                if (lines != null && lines.Length > 0)
                {
                    for (int i = 0; i < lines.Length; i++)
                    {
                        string line = lines[i];
                        if (line.Length > MIN_LINE_LENGTH)
                        {
                            //Look for commas to be sure that this is a device info line
                            if (line.Substring(POS_BUS + 1, 1) == "," && line.Substring(POS_ID + 1, 1) == ",")
                            {
                                AspiDeviceInfo device = new AspiDeviceInfo();

                                int bus = 0;
                                if (int.TryParse(line.Substring(POS_BUS, LEN_BUS), out bus))
                                {
                                    device.Bus = bus;
                                }

                                int id = 0;
                                if (int.TryParse(line.Substring(POS_ID, LEN_ID), out id))
                                {
                                    device.Id = id;
                                }

                                int lun = 0;
                                if (int.TryParse(line.Substring(POS_LUN, LEN_LUN), out lun))
                                {
                                    device.Lun = lun;
                                }

                                device.Manufacturer = line.Substring(POS_MANUFAC, LEN_MANUFAC).TrimEnd(' ');
                                device.Model        = line.Substring(POS_MODEL, LEN_MODEL).TrimEnd(' ');
                                device.Revision     = line.Substring(POS_REV, LEN_REV).TrimEnd(' ');
                                device.Type         = line.Substring(POS_TYPE, LEN_TYPE).TrimEnd(' ', '\r');

                                devices.Add(device);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
		private static string GetArguments(AspiDeviceInfo deviceInfo, bool batchAllTracks, bool createInfoFiles, int trackNumber)
		{
			StringBuilder arguments = new StringBuilder();
			
			if (batchAllTracks)
				arguments.AppendFormat("{0} ", FLAG_BATCH);
			else
				arguments.AppendFormat("{0}{1} ", FLAG_TRACK, trackNumber);
				
			if (!createInfoFiles)
				arguments.AppendFormat("{0} ", FLAG_NO_INFO);
			
			arguments.AppendFormat("{0}{1} ", FLAG_DEVICE, deviceInfo);
			
			if (!batchAllTracks)
				arguments.AppendFormat(FORMAT_TRACK_PATH, trackNumber);
			
			return arguments.ToString();
		}
Esempio n. 4
0
        private static void Rip(AspiDeviceInfo deviceInfo, int trackNumber, bool batchAllTracks, bool createInfoFiles)
        {
            try
            {
                Process ripProcess = new Process();
                ripProcess.StartInfo.CreateNoWindow  = true;
                ripProcess.StartInfo.UseShellExecute = false;
                //ripProcess.StartInfo.RedirectStandardOutput = true;
                ripProcess.StartInfo.FileName  = FILE_NAME;
                ripProcess.StartInfo.Arguments = GetArguments(deviceInfo, batchAllTracks, createInfoFiles, trackNumber);
                ripProcess.Start();

                //string output = ripProcess.StandardOutput.ReadToEnd();
                //ripProcess.WaitForExit();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
		private static void Rip(AspiDeviceInfo deviceInfo, int trackNumber, bool batchAllTracks, bool createInfoFiles)
		{
			try
			{
				Process ripProcess = new Process();
				ripProcess.StartInfo.CreateNoWindow = true;
				ripProcess.StartInfo.UseShellExecute = false;
				//ripProcess.StartInfo.RedirectStandardOutput = true;
				ripProcess.StartInfo.FileName = FILE_NAME;
				ripProcess.StartInfo.Arguments = GetArguments(deviceInfo, batchAllTracks, createInfoFiles, trackNumber);
				ripProcess.Start();

				//string output = ripProcess.StandardOutput.ReadToEnd();
				//ripProcess.WaitForExit();
			}
			catch (Exception ex)
			{
				throw ex;
			}
		} 
Esempio n. 6
0
		private static void ParseOutput(string output, IList<AspiDeviceInfo> devices)
		{
			if (!string.IsNullOrEmpty(output))
			{
				string[] lines = output.Split(new char[]{LINE_BREAK}, StringSplitOptions.RemoveEmptyEntries);
				if (lines != null && lines.Length > 0)
				{
					for(int i=0;i<lines.Length;i++)
					{
						string line = lines[i];
						if (line.Length > MIN_LINE_LENGTH)
						{
							//Look for commas to be sure that this is a device info line
							if (line.Substring(POS_BUS+1, 1) == "," && line.Substring(POS_ID+1, 1) == ",")
							{
								AspiDeviceInfo device = new AspiDeviceInfo();
								
								int bus = 0;
								if (int.TryParse(line.Substring(POS_BUS, LEN_BUS), out bus))
									device.Bus = bus;
								
								int id = 0;
								if (int.TryParse(line.Substring(POS_ID, LEN_ID), out id))
									device.Id = id;
								
								int lun = 0;
								if (int.TryParse(line.Substring(POS_LUN, LEN_LUN), out lun))
									device.Lun = lun;
									
								device.Manufacturer = line.Substring(POS_MANUFAC, LEN_MANUFAC).TrimEnd(' ');
								device.Model = line.Substring(POS_MODEL, LEN_MODEL).TrimEnd(' ');
								device.Revision = line.Substring(POS_REV, LEN_REV).TrimEnd(' ');
								device.Type = line.Substring(POS_TYPE, LEN_TYPE).TrimEnd(' ','\r');
								
								devices.Add(device);
							}
						}
					}
				}
			}
		}
Esempio n. 7
0
 public static void RipTrack(AspiDeviceInfo deviceInfo, int trackNumber)
 {
     Rip(deviceInfo, trackNumber, false, false);
 }
Esempio n. 8
0
		public TrackSource(Uri path, AspiDeviceInfo deviceInfo) : this(path)
		{
			this.deviceInfo = deviceInfo;
		}
Esempio n. 9
0
		public static void RipTrack(AspiDeviceInfo deviceInfo, int trackNumber)
		{
			Rip(deviceInfo, trackNumber, false, false);
		}