示例#1
0
        protected override void Play()
        {
            if (string.IsNullOrEmpty(InputPath))
            {
                MessageBox.Show("Select a valid input file or URL first");
                return;
            }

            if (_playbackState == StreamingPlaybackState.Stopped)
            {
                _playbackState        = StreamingPlaybackState.Buffering;
                _bufferedWaveProvider = null;

                // streaming play from HTTP protocol
                if (InputPath.StartsWith("http", StringComparison.OrdinalIgnoreCase))
                {
                    Task.Run(() => DownloadMp3(InputPath));
                }
                else // streaming play from File protocol
                {
                    Task.Run(() => OpenMp3File(InputPath));
                }

                PlayerTimer.Start();
            }
            else if (_playbackState == StreamingPlaybackState.Paused)
            {
                _playbackState = StreamingPlaybackState.Buffering;
            }

            UpdatePlayerState();
            SetTitle("Playing " + Path.GetFileName(InputPath));
        }
示例#2
0
            public ByNumber()
            {
                var files   = CheckPath(".ts");
                var outFile = Path.ChangeExtension(InputPath.Trim('.'), ".ts");

                FileHelper.FileMerge(files.ToArray(), outFile);
            }
示例#3
0
        public override string GenerateThumbnail()
        {
            // Get temp path where thumbnail should be stored
            string outputPath = GetTempFilename("jpg");

            // Get actual video dimensions
            m_Logger.DebugFormat("Video dimensions are: {0}x{1}", m_Width, m_Height);

            // Get dimensions of the thumbnail to be generated
            Size dimensions = GetAspectImageSize(m_Width, m_Height, ThumbnailSize.Width, ThumbnailSize.Height);

            m_Logger.DebugFormat("Thumbnail will be resized to: {0}x{1}", dimensions.Width, dimensions.Height);

            // Get settings
            string ffmpeg = GetSetting("FFmpegExecutablePath");
            string args   = GetSetting("FFmpegThumbnailArgs");

            // Replace keywords
            args = args.Replace("[INPUT]", InputPath.WrapInQuotes());
            args = args.Replace("[OUTPUT]", outputPath.WrapInQuotes());
            args = args.Replace("[WIDTH]", dimensions.Width.ToString());
            args = args.Replace("[HEIGHT]", dimensions.Height.ToString());

            // Execute FFmpeg command line
            CommandLineExecuter.Execute(ffmpeg, args);

            return(outputPath);
        }
示例#4
0
        public void Convert()
        {
            Process.StartInfo.Arguments = String.Format(
                "-y -i \"{0}\" -acodec {1} -metadata comment=\"{2}\" -vcodec copy -sample_fmt s16p -ar 44100 -ac 2 \"{3}\"",
                InputPath.Replace("\\", "/"),
                Codec,
                Hash,
                OutputPath.Replace("\\", "/")
                );
            //Process.StartInfo.RedirectStandardOutput = true;
            //Process.StartInfo.RedirectStandardError = true;

            // hookup the eventhandlers to capture the data that is received
            //Process.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data);
            //Process.ErrorDataReceived += (sender, args) => sb.AppendLine(args.Data);

            // direct start
            //Process.StartInfo.UseShellExecute = false;
            Process.StartInfo.WindowStyle            = ProcessWindowStyle.Hidden;
            Process.StartInfo.RedirectStandardOutput = false;
            Process.StartInfo.RedirectStandardError  = false;

            Process.Start();
            // start our event pumps
            //Process.BeginOutputReadLine();
            //Process.BeginErrorReadLine();

            // until we are done
            Process.WaitForExit();
        }
示例#5
0
 private void btn_Select_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(InputPath))
     {
         MessageBox.Show(this, "您未有选定文件夹,请选择目录或手动输入目录", "", MessageBoxButtons.OK, DialogResult.OK, 12);
         return;
     }
     if (!IO.PathHelper.IsPath(InputPath))
     {
         MessageBox.Show(this, "您输入的路径不合法,请检查", "", MessageBoxButtons.OK, DialogResult.OK, 12);
         pathTBox.Focus();
         return;
     }
     InputPath = InputPath.Trim();
     if (CheckPathExists && !Directory.Exists(InputPath))
     {
         if (MessageBox.Show(this, "您指定的文件夹不存在,是否继续?", "", MessageBoxButtons.YesNo, DialogResult.Yes, 12) == DialogResult.No)
         {
             pathTBox.Focus();
             return;
         }
     }
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
示例#6
0
        private void Reset()
        {
            tiStart.Enabled = true;
            tiStop.Enabled  = false;
            selectedonly    = false;

            for (int i = 0; i < lvInputList.Items.Count; i++)
            {
                InputPath ip = (InputPath)lvInputList.Items[i].Tag;
                if (ip.Type == 0)
                {
                    lvInputList.Items[i].SubItems[3].Text = File.Exists(lvInputList.Items[i].Text) ? "○" : "X";
                }
                else if (ip.Type == 1)
                {
                    string[] files = Directory.GetFiles(lvInputList.Items[i].Text);
                    int      fc    = 0;
                    foreach (string file in files)
                    {
                        if (File.Exists(file) && pd.ValidateExtention(file))
                        {
                            fc++;
                        }
                    }
                    lvInputList.Items[i].SubItems[3].Text = fc > 0 ? "○" : "X";
                }
            }
        }
示例#7
0
 private IDTSOutput100 FindOutput(InputPath inputPath)
 {
     if (!string.IsNullOrEmpty(inputPath.Source))
     {
         foreach (SsisComponent component in _componentList)
         {
             if (string.Compare(inputPath.Source, component.Component.Name, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
             {
                 foreach (IDTSOutput100 dtsOutput in component.Component.OutputCollection)
                 {
                     if (string.Compare(inputPath.Name, dtsOutput.Name, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
                     {
                         return(dtsOutput);
                     }
                 }
             }
         }
         this._message.Trace(Severity.Error, Resources.InputPathError1, inputPath.Source, inputPath.Name);
     }
     else
     {
         foreach (SsisComponent component in _componentList)
         {
             foreach (IDTSOutput100 dtsOutput in component.Component.OutputCollection)
             {
                 if (string.Compare(inputPath.Name, dtsOutput.Name, true, System.Globalization.CultureInfo.InvariantCulture) == 0)
                 {
                     return(dtsOutput);
                 }
             }
         }
         this._message.Trace(Severity.Error, Resources.InputPathError2, inputPath.Name);
     }
     return(null);
 }
示例#8
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((base.GetHashCode() * 397) ^ (InputPath != null ? InputPath.GetHashCode() : 0));
     }
 }
示例#9
0
            public ByName()
            {
                var ex      = SystemConsole.GetInputStr("请输入文件后缀(如\"cs,cpp\":");
                var files   = CheckPath("*.*").Where(p => p.EndsWith(ex)).ToArray();
                var outFile = Path.ChangeExtension(InputPath.Trim('.'), ex);

                FileHelper.FileMerge(files.ToArray(), outFile);
            }
示例#10
0
        private void lkAddManully_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            NetpathInputForm ibf = new NetpathInputForm();

            ibf.ShowDialog();
            if (ibf.Confirmed)
            {
                lastSelectedFolder = Path.GetDirectoryName(ibf.NetPath);
                InputPath ip = new InputPath(ibf.NetPath);
                AddDistinctToListBox(ip);
            }
        }
示例#11
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = InputPath != null?InputPath.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (OutputPath != null ? OutputPath.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ Amount.GetHashCode();
                hashCode = (hashCode * 397) ^ (ResetEvent != null ? ResetEvent.GetHashCode() : 0);
                return(hashCode);
            }
        }
示例#12
0
        private void lkAddFolder_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            FolderBrowserDialog fb = new FolderBrowserDialog();

            fb.SelectedPath = lastSelectedFolder;
            if (fb.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                lastSelectedFolder = fb.SelectedPath;
                InputPath ip = new InputPath(lastSelectedFolder, 1);
                AddDistinctToListBox(ip);
            }
        }
示例#13
0
        private void tiAddPathManually_Click(object sender, EventArgs e)
        {
            NetpathInputForm ibf = new NetpathInputForm();

            ibf.ShowDialog();
            if (ibf.Confirmed)
            {
                lastSelectedFolder = Path.GetDirectoryName(ibf.NetPath);
                InputPath ip = new InputPath(ibf.NetPath);
                AddDistinctToListBox(ip);
                pd.Save();
            }
        }
示例#14
0
        public async void Start(object _)
        {
            try
            {
                ReadyState = ReadyState.IN_PROGRESS;

                if (InputPath.Equals(OutputPath, StringComparison.OrdinalIgnoreCase))
                {
                    // todo: wrap this in error object and centralize the error handling
                    handleError(ErrorState.EXACTLY_SAME_PATH_USED);
                    return;
                }

                var fileSystemEntries = OuyaUtils.ReadAllFilesFromDirectory(InputPath);
                var nameTagPairs      = fileSystemEntries.Select((entry) => {
                    var filename = Path.GetFileName(entry);
                    return(new
                    {
                        Path = entry,
                        Filename = filename,
                        Tag = OuyaUtils.ParseTag(entry),
                    });
                });

                var pairsToGo = nameTagPairs
                                .Where((entry) => entry.Tag != null)
                                .Select((entry) =>
                {
                    return(new
                    {
                        FromPath = entry.Path,
                        ToDirectoryPath = Path.Join(OutputPath, entry.Tag.NormalizedTag),
                        ToPath = Path.Join(OutputPath, entry.Tag.NormalizedTag, entry.Filename)
                    });
                });

                var copyTasks = pairsToGo.Select(async(entry) =>
                {
                    Directory.CreateDirectory(entry.ToDirectoryPath);
                    await OuyaUtils.MoveFile(entry.FromPath, entry.ToPath).ConfigureAwait(true);
                });

                await Task.WhenAll(copyTasks).ConfigureAwait(true);

                ReadyState = ReadyState.IDLE;
            }
            catch (Exception ex)
            {
                handleError(ErrorState.UNKNOWN, ex);
            }
        }
示例#15
0
 public void ChainComponent(SsisComponent component, InputPath inputPath)
 {
     if (inputPath == null || (string.IsNullOrEmpty(inputPath.Name) && string.IsNullOrEmpty(inputPath.Source)))
     {
         ChainComponent(component);
     }
     else
     {
         IDTSOutput100 dtsOutput = FindOutput(inputPath);
         MainPipe.PathCollection.New().AttachPathAndPropagateNotifications(dtsOutput, component.Component.InputCollection[0]);
         component.Flush();
         AddComponent(component);
     }
 }
示例#16
0
 public void ChainComponent(SsisComponent component, InputPath inputPath, IDTSInput100 input)
 {
     if (input == null)
     {
         ChainComponent(component, inputPath);
     }
     else
     {
         IDTSOutput100 dtsOutput = FindOutput(inputPath);
         MainPipe.PathCollection.New().AttachPathAndPropagateNotifications(dtsOutput, input);
         component.Flush();
         AddComponent(component);
     }
 }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (DestinationPassword != null ? DestinationPassword.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Overwrite.GetHashCode();
         hashCode = (hashCode * 397) ^ (InputPath != null ? InputPath.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OutputPath != null ? OutputPath.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DestinationUsername != null ? DestinationUsername.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DestinationPrivateKeyFile != null ? DestinationPrivateKeyFile.GetHashCode() : 0);
         return(hashCode);
     }
 }
示例#18
0
        public static DialogResult Show(out string path)
        {
            string strTemp = string.Empty;

            var inputDialog = new InputPath
            {
                InputPathHandler = (str) => { strTemp = str; }
            };

            DialogResult result = inputDialog.ShowDialog();

            path = strTemp;

            return(result);
        }
示例#19
0
        public override string GeneratePreview()
        {
            string extension = (Path.GetExtension(InputPath) ?? string.Empty).ToLower();

            // Get temp path where FLV should be stored
            string outputPath = GetTempFilename(GetExtensionGenerated(extension));

            // Get settings
            string ffmpeg = GetSetting("FFmpegExecutablePath");
            string args   = GetSetting("FFmpegPreviewArgs");

            // Replace keywords
            args = args.Replace("[INPUT]", InputPath.WrapInQuotes());
            args = args.Replace("[OUTPUT]", outputPath.WrapInQuotes());
            args = args.Replace("[WIDTH]", PreviewSize.Width.ToString());
            args = args.Replace("[HEIGHT]", PreviewSize.Height.ToString());

            // Apply watermark
            if (!String.IsNullOrEmpty(WatermarkPath) && File.Exists(WatermarkPath))
            {
                string watermarkArgs = GetSetting("FFmpegWatermarkArgs");

                if (String.IsNullOrEmpty(watermarkArgs))
                {
                    m_Logger.WarnFormat("Unable to apply watermark; no command arguments specified");
                }
                else
                {
                    watermarkArgs = watermarkArgs.Replace("[WATERMARK]", WatermarkPath.WrapInQuotes());
                    args          = args.Replace("[WATERMARK-ARGS]", watermarkArgs);
                }
            }

            // Remove watermark args placeholder, in case no watermark was requested or file not found
            args = args.Replace("[WATERMARK-ARGS]", string.Empty);

            // Execute FFmpeg command line
            CommandLineExecuter.Execute(ffmpeg, args);

            // Update FLV metadata (fixes duration & seek problems)
            string flvtool     = GetSetting("FLVToolExecutablePath");
            string flvtoolargs = string.Format("-U {0}", outputPath);

            CommandLineExecuter.Execute(flvtool, flvtoolargs);

            return(outputPath);
        }
示例#20
0
        public Boolean Initialise()
        {
            String SampleData;

            if (!InputPath.EndsWith("\\"))
            {
                InputPath += "\\";
            }
            SampleData = InputPath + "wqu.json";

            if (!ResponsePath.EndsWith("\\"))
            {
                ResponsePath += "\\";
            }

            return(true);
        }
示例#21
0
        public bool Clean()
        {
            if (!File.Exists(InputPath) || !InputPath.EndsWith(".cs"))
            {
                return(false);
            }

            SlnPath = SlnPath ?? FindSolution(InputPath, 5);
            if (!File.Exists(SlnPath) || !SlnPath.EndsWith(".sln"))
            {
                return(false);
            }

            OutputPath = OutputPath ?? InputPath.Substring(0, (InputPath.Length - ".cs".Length)) + ".swift";

            return(OutputPath.EndsWith(".swift"));
        }
示例#22
0
 public void ProcessInput(InputPath ip)
 {
     Thread.Sleep(100);
     LogList.Clear();
     try
     {
         currentInputPath = ip;
         if (ip.Type == 0)
         {
             ProcessFile(ip.path);
         }
         else
         {
             DealFolder(ip.path);
         }
     }
     catch (Exception ex) { Console.WriteLine(ex.Message); }
 }
示例#23
0
        private void tiAddFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.InitialDirectory = lastSelectedFolder;
            ofd.Filter           = pd.GetExtFilter();
            ofd.FilterIndex      = trans.pd.FilterIndex;
            ofd.Multiselect      = true;
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                lastSelectedFolder = Path.GetDirectoryName(ofd.FileNames[0]);
                for (int i = 0; i < ofd.FileNames.Length; i++)
                {
                    InputPath ip = new InputPath(ofd.FileNames[i], 0);
                    AddDistinctToListBox(ip);
                }
                pd.Save();
            }
        }
示例#24
0
        private bool ValidateInput()
        {
            ListObject foundObject = SettingsManager.Settings.ItemCollection.Find(x => x != cachedListObject && x.Name == InputName);

            if (foundObject != null)
            {
                MessageBox.Show("Name is already in use.");
                return(false);
            }

            // We only want to make sure it's an APK, it doesn't matter if the file doesn't exist
            if (!InputPath.EndsWith(".apk", StringComparison.InvariantCultureIgnoreCase))
            {
                MessageBox.Show("Invalid path, it must direct to a valid .apk");
                return(false);
            }

            return(true);
        }
示例#25
0
        /// <summary>
        /// オーディオファイルを変換する(複数)
        /// </summary>
        protected override void ConvertMultiFile()
        {
            var filePathes = InputPath.GetSpecifiedTypeFiles(SourceFileType);

            // 圧縮に時間がかかるので並列処理する
            var lockObject = new object();

            Parallel.ForEach(filePathes, filePath =>
            {
                (var input, var output) = PathUtility.CreateMediaFile(filePath, OutputPath, SourceFileType, DestinationFileType);
                lock ( lockObject )
                {
                    using (var engine = new Engine()) { engine.Convert(input, output); }
                    TargetFilePath = filePath;
                    Status         = Running;
                }
            });
            Status = Complete;
        }
示例#26
0
        /// <summary>
        /// ZIPファイルに変換する(複数)
        /// </summary>
        protected override void ConvertMultiFile()
        {
            using (var zip = ZipFile.Open(OutputPath, ZipArchiveMode.Update, Encoding.GetEncoding("shift_jis")))
            {
                var filePathes = InputPath.GetSpecifiedTypeFiles(SourceFileType);

                // 圧縮に時間がかかるので並列処理する
                var lockObject = new object();
                Parallel.ForEach(filePathes, filePath =>
                {
                    lock ( lockObject )
                    {
                        zip.CreateEntryFromFile(filePath, Path.GetFileName(filePath), CompressionLevel.Optimal);
                        TargetFilePath = filePath;
                        Status         = Running;
                    }
                });
                Status = Complete;
            }
        }
示例#27
0
        public void AddDistinctToListBox(InputPath ip)
        {
            ListView lv = this.lvInputList;

            string[] strs = ip.ToStrings();
            foreach (ListViewItem item in lv.Items)
            {
                if (item.Text == ip.path)
                {
                    return;
                }
            }

            ListViewItem lvi = new ListViewItem(strs);

            lvi.Tag        = ip;
            lvi.ImageIndex = ip.Type;
            lv.Items.Add(lvi);

            pd.InputPaths.Add(ip);
        }
        /// <summary>
        /// Adds the desired input path to search for scripts.
        /// </summary>
        /// <param name="path"></param>
        public void AddPath(string path)
        {
            /* Valid input path is as follows:
             * C:\Skyrim\Data\Scripts\Source;C:\Skyrim\MO\(ModName)\scripts\source; ...
             */
            string[] allPaths = InputPath.Split(';');

            for (int i = 0; i < allPaths.Length; i++)
            {
                System.Console.WriteLine($"Path {i}: {allPaths[i]}");

                //If the path already exists, return, we don't want duplicates.
                if (path == allPaths[i])
                {
                    return;
                }
            }

            InputPath     += $";{path}";
            mostRecentPath = path;
        }
示例#29
0
        private void OnExecute()
        {
            var assetsManager = new AssetsManager();

            if (InputPath.EndsWith(".apk"))
            {
                assetsManager.LoadAPK(this.InputPath);
            }
            else
            {
                assetsManager.LoadFolder(this.InputPath);
            }

            System.Console.WriteLine("Load {0}", InputPath);

            foreach (var assetFile in assetsManager.assetsFileList)
            {
                foreach (var asset in assetFile.Objects)
                {
                    if (asset.type == ClassIDType.Sprite ||
                        asset.type == ClassIDType.SpriteAtlas)
                    {
                        var sprite         = (NamedObject)asset;
                        var name           = sprite.m_Name;
                        var exportFullName = Path.Combine(this.OutputPath, name + ".png");
                        try
                        {
                            var bitmap = (sprite as Sprite).GetImage();
                            bitmap.Save(exportFullName, ImageFormat.Png);
                            bitmap.Dispose();
                        }
                        catch
                        {
                            System.Console.WriteLine("catch exception.");
                        }
                    }
                }
            }
        }
示例#30
0
        public Boolean Initialise()
        {
            String SampleData;

            if (!InputPath.EndsWith("\\"))
            {
                InputPath += "\\";
            }
            SampleData = InputPath + "Getdata.json";

            if (!ResponsePath.EndsWith("\\"))
            {
                ResponsePath += "\\";
            }

            objReq = objJSON.ParseFile(SampleData);
            if (objReq == null)
            {
                return(false);
            }

            return(true);
        }