Beispiel #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());
        }
Beispiel #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);
                            }
                        }
                    }
                }
            }
        }
Beispiel #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();
		}
Beispiel #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;
            }
        }
Beispiel #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;
			}
		} 
		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);
							}
						}
					}
				}
			}
		}
Beispiel #7
0
 public static void RipTrack(AspiDeviceInfo deviceInfo, int trackNumber)
 {
     Rip(deviceInfo, trackNumber, false, false);
 }
		public TrackSource(Uri path, AspiDeviceInfo deviceInfo) : this(path)
		{
			this.deviceInfo = deviceInfo;
		}
Beispiel #9
0
		public static void RipTrack(AspiDeviceInfo deviceInfo, int trackNumber)
		{
			Rip(deviceInfo, trackNumber, false, false);
		}