-
Notifications
You must be signed in to change notification settings - Fork 524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add video dubbing client tool and API client sample code. #325
Open
DapengLi2016
wants to merge
2
commits into
Azure-Samples:master
Choose a base branch
from
DapengLi2016:poleli/0410VideoDubbing-3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
174 changes: 174 additions & 0 deletions
174
VideoDubbing/CSharp/APIClientTool/Common/CommonLib/CommandParser/ArgumentAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
namespace Microsoft.SpeechServices.CommonLib.CommandParser; | ||
|
||
using System; | ||
using System.Globalization; | ||
|
||
[AttributeUsage(AttributeTargets.Field, Inherited = false)] | ||
public sealed class ArgumentAttribute : Attribute | ||
{ | ||
private readonly string flag; | ||
private string description = string.Empty; | ||
private string usagePlaceholder; | ||
private bool optional; | ||
private bool hidden; | ||
private InOutType inoutType; | ||
private string requiredModes; | ||
private string optionalModes; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ArgumentAttribute"/> class. | ||
/// </summary> | ||
/// <param name="optionName">Flag string for this attribute.</param> | ||
public ArgumentAttribute(string optionName) | ||
{ | ||
if (optionName == null) | ||
{ | ||
throw new ArgumentNullException(nameof(optionName)); | ||
} | ||
|
||
this.flag = optionName; | ||
} | ||
|
||
/// <summary> | ||
/// Gets The parse recognising flag. | ||
/// </summary> | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "Ignore.")] | ||
public string OptionName | ||
{ | ||
get { return this.flag.ToLower(CultureInfo.InvariantCulture); } | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets Description will display in the PrintUsage method. | ||
/// </summary> | ||
public string Description | ||
{ | ||
get | ||
{ | ||
return this.description; | ||
} | ||
|
||
set | ||
{ | ||
if (value == null) | ||
{ | ||
throw new ArgumentNullException(nameof(value)); | ||
} | ||
|
||
this.description = value; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets In the PrintUsage method this will display a place hold for a parameter. | ||
/// </summary> | ||
public string UsagePlaceholder | ||
{ | ||
get | ||
{ | ||
return this.usagePlaceholder; | ||
} | ||
|
||
set | ||
{ | ||
if (value == null) | ||
{ | ||
throw new ArgumentNullException(nameof(value)); | ||
} | ||
|
||
this.usagePlaceholder = value; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether (optional = true) means not necessarily in the command-line. | ||
/// </summary> | ||
public bool Optional | ||
{ | ||
get { return this.optional; } | ||
set { this.optional = value; } | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether (Hidden = true) means this option will not be printed in the command-line. | ||
/// While one option is set with Hidden, the Optional must be true. | ||
/// </summary> | ||
public bool Hidden | ||
{ | ||
get { return this.hidden; } | ||
set { this.hidden = value; } | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets The in/out type of argument. | ||
/// </summary> | ||
public InOutType InOutType | ||
{ | ||
get { return this.inoutType; } | ||
set { this.inoutType = value; } | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets The modes require this argument. | ||
/// </summary> | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "Ignore.")] | ||
public string RequiredModes | ||
{ | ||
get | ||
{ | ||
return this.requiredModes; | ||
} | ||
|
||
set | ||
{ | ||
this.requiredModes = value?.ToLower(CultureInfo.InvariantCulture); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets The modes optionally require this argument. | ||
/// </summary> | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "Ignore.")] | ||
public string OptionalModes | ||
{ | ||
get | ||
{ | ||
return this.optionalModes; | ||
} | ||
|
||
set | ||
{ | ||
this.optionalModes = value?.ToLower(CultureInfo.InvariantCulture); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Get required modes in an array. | ||
/// </summary> | ||
/// <returns>Mode array.</returns> | ||
public string[] GetRequiredModeArray() | ||
{ | ||
string[] modes = null; | ||
if (!string.IsNullOrEmpty(this.requiredModes)) | ||
{ | ||
modes = this.requiredModes.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); | ||
} | ||
|
||
return modes; | ||
} | ||
|
||
/// <summary> | ||
/// Get optional modes in an array. | ||
/// </summary> | ||
/// <returns>Mode array.</returns> | ||
public string[] GetOptionalModeArray() | ||
{ | ||
string[] modes = null; | ||
if (!string.IsNullOrEmpty(this.optionalModes)) | ||
{ | ||
modes = this.optionalModes.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); | ||
} | ||
|
||
return modes; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/Azure-Samples/Cognitive-Speech-TTS is retiring. Please put sample code here https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/samples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved.