示例#1
0
        /// <summary>
        /// Produces a list of arguments by scanning Flags and input/output file specs
        /// as appropriate for a given utility subclass.
        /// </summary>
        /// <returns>a collection of arguments suitable for presenting to the RunAsync method</returns>
        protected ICollection <string> GetUtilityArgs()
        {
            ICollection <string> args = new List <string>(Flags);
            string infile             = null;
            string outfile            = null;

            if ((InputFile != null) && InputFile.Exists)
            {
                infile = UsesSameDirectory(InputFile, SoundFileDirectory)
                    ? InputFile.Name
                    : BridgeToCpInvoke.wGetShortPathName(InputFile.FullName);
            }
            if (OutputFile != null)
            {//use -o?, insert before input, use name or shortpath: SADIR or working
                if (OutputFile.Exists)
                {
                    OutputFile.Delete();
                }
                outfile = BridgeToCpInvoke.wGetShortPathName(OutputFile.FullName);
            }
            if (!string.IsNullOrWhiteSpace(outfile))
            {
            }
            if (!string.IsNullOrWhiteSpace(infile))
            {
                args.Add(infile);
            }

            return(args);
        }
示例#2
0
        //Determines whether a complete path is superfluous.
        private bool UsesSameDirectory(FileInfo file, string dir)
        {
            bool same = false;

            if (!string.IsNullOrWhiteSpace(dir))
            {
                same = BridgeToCpInvoke.wGetShortPathName(file.DirectoryName).ToLower().Equals(BridgeToCpInvoke.wGetShortPathName(dir).ToLower());
            }
            return(same);
        }