// // ABSTRACT : �v���t�@�C��XML��ǂݍ��� // public static CmdLineInternalProfile LoadProfile(string name) { CmdLineInternalProfile prof = new CmdLineInternalProfile(); try { // XML�Ƀv���t�@�C����ۑ� string path; path = Path.Combine( ProfilePath, name.Trim() + @".XML" ); if (!File.Exists(path)) return null; XmlReader xr = new XmlTextReader(path); while (xr.Read()) { if (xr.NodeType == XmlNodeType.Element) { if (xr.LocalName.Equals("Execute")) { prof.ExecutePath = xr.ReadElementContentAsString(); } else if (xr.LocalName.Equals("Argument")) { prof.Argument = xr.ReadElementContentAsString(); } else if (xr.LocalName.Equals("Extension")) { prof.Extension = xr.ReadElementContentAsString(); } else if (xr.LocalName.Equals("Minimize")) { prof.Minimize = (xr.ReadElementContentAsInt() == 0) ? false : true; } else if ( xr.LocalName.Equals( "OutputType" ) ) { prof.OutputType = xr.ReadElementContentAsInt(); } } } prof.ProfileName = Path.GetFileNameWithoutExtension(path); xr.Close(); return prof; } catch (Exception e) { return null; } }
// // ABSTRACT : �G���R�[�_EXE����s // private void ExecEncoder( string sourcePath, string outputPath, CmdLineInternalProfile profile, Encoder.TvProgramAdditionalInfo ai) { string args; if (!File.Exists(profile.ExecutePath)) throw new Exception("�G���R�[�_�̎��s�t�@�C����������܂���"); // �G���R�[�_�ɓn���p�����[�^�̃Z�b�g if ( ai != null ) // �lj���� { string sourcePathWithoutEXT; string outputPathWithoutEXT; // �g���q�Ȃ��̃p�X��擾 sourcePathWithoutEXT = Path.Combine( Path.GetDirectoryName( sourcePath ) , Path.GetFileNameWithoutExtension( sourcePath ) ); outputPathWithoutEXT = Path.Combine( Path.GetDirectoryName( outputPath ) , Path.GetFileNameWithoutExtension( outputPath ) ); args = string.Format( profile.Argument , sourcePath , outputPath , ai.Title , ai.StoryNumber , ai.Subtitle , ai.TvStation , ai.StartDate , ai.StartTime , sourcePathWithoutEXT, outputPathWithoutEXT); } else // �lj����Ȃ� { args = string.Format( profile.Argument , sourcePath , outputPath ); } // ���s�t�@�C����Ăяo���ăG���R�[�h���� ProcessStartInfo psi = new ProcessStartInfo( profile.ExecutePath ); abortEncode = false; psi.Arguments = args; // ���� psi.WindowStyle = ( profile.Minimize ) ? ProcessWindowStyle.Minimized : ProcessWindowStyle.Normal; psi.WorkingDirectory = Path.GetDirectoryName( profile.ExecutePath ); // psi.UseShellExecute = false; process = Process.Start( psi ); Thread.Sleep(1000); if (profile.Minimize) // �E�B���h�E�ŏ��� { if( process.MainWindowHandle != null ) { KernelAPI.Window.SendMessage( process.MainWindowHandle , 34 , (IntPtr)0 , (IntPtr)0 ); // WM_ICONIFY���M } } process.WaitForExit(); if (abortEncode) throw new AbortException(); }