This file contains hidden or 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
[TestCase("#EXTM3U")] | |
[TestCase("#EXTM3U:")] | |
[TestCase("#EXTM3U\n")] | |
[TestCase("#EXTM3U\n#EXTM3U")] | |
public void ShouldParseStringThatStartsWithPoundAsPlaylistTag(string input) | |
{ | |
string tagId = PlaylistGrammar.TagIdStringParser.Parse(input); | |
Assert.AreEqual("EXTM3U", tagId); | |
} |
This file contains hidden or 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
public class PlaylistGrammar | |
{ | |
public static readonly Parser<string> TagIdStringParser = | |
from tagStartDelimiter in Parse.Char('#').Once() | |
from tagId in Parse.AnyChar.Until(Parse.Char(':')).Text() | |
.Or(Parse.AnyChar.Until(Parse.LineTerminator)).Text() | |
select tagId; | |
} |
This file contains hidden or 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
public static readonly Parser<PlaylistTagAttribute> TagAttributeParser = | |
from attribute in AttributeWithQuotesParser | |
.Or(AttributeWithoutQuotesParser) | |
.Or(AttributeWithSingleValueParser) | |
select attribute; | |
public static readonly Parser<List<PlaylistTagAttribute>> MultipleTagAttributesParser = | |
from attributes in TagAttributeParser.Many() | |
select new List<PlaylistTagAttribute>(attributes); |
This file contains hidden or 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
[Test] | |
public void MultipleTagAttributesAreParsed() | |
{ | |
var input = @"TYPE=AUDIO,GROUP-ID=""audio"",NAME=""audio"",DEFAULT=YES"; | |
List<PlaylistTagAttribute> tagAttributes = | |
PlaylistGrammar.MultipleTagAttributesParser.Parse(input); | |
Assert.That(tagAttributes.Count, Is.EqualTo(4)); | |
Assert.AreEqual("TYPE", tagAttributes[0].Key); | |
Assert.AreEqual("AUDIO", tagAttributes[0].Value); | |
Assert.AreEqual("GROUP-ID", tagAttributes[1].Key); |
This file contains hidden or 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
$storageAccountName = "destinationStorageAccountName" | |
$storageAccountKey = "destinationStorageAccountKey" | |
$absoluteUri = "The URL of the exported snapshot" | |
$destContainer = "vhds" | |
$blobName = "sb-prd-sql-disk-os.vhd" | |
$destContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey | |
Start-AzureStorageBlobCopy -AbsoluteUri $absoluteUri -DestContainer $destContainer -DestContext $destContext -DestBlob $blobName |
This file contains hidden or 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
$virtualNetwork = New-AzureRmVirtualNetwork -Name $vnetName -ResourceGroupName $ResourceGroupNameProd -Location $Location -AddressPrefix "10.0.0.0/16" | |
$backendSubnet = Add-AzureRmVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix "10.0.0.0/24" -VirtualNetwork $virtualNetwork | |
$virtualNetwork | Set-AzureRmVirtualNetwork | |
$pip = New-AzureRmPublicIpAddress -Name $IpAddressName -ResourceGroupName $ResourceGroupNameProd -Location $Location -AllocationMethod Dynamic | |
$nic = New-AzureRmNetworkInterface -Name $nicName -ResourceGroupName $ResourceGroupNameProd -Location $Location -SubnetId "yoursubnetid" -PublicIpAddressId $pip.Id -PrivateIpAddress 10.0.0.101 | |
$vmConfig = New-AzureRmVMConfig -VMName $vmName -VMSize $VMSize | |
$vm = Add-AzureRmVMNetworkInterface -VM $vmConfig -Id $nic.Id | |
$osDisk = New-AzureRmDisk -DiskName $osDiskName |
This file contains hidden or 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
EndpointAddress endpointAddress = new EndpointAddress(Configuration.CreateServerUriString()); | |
ChannelFactory<IMessageSender> channelFactory = new ChannelFactory<IMessageSender>(Configuration.CreateBinding(), endpointAddress); | |
IMessageSender messageSender = channelFactory.CreateChannel(endpointAddress); | |
messageSender.ShowMessage("Test message"); | |
((IChannel)messageSender).Close(); |
This file contains hidden or 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
Server singleServerInstance = new Server(); | |
Uri baseUri = new Uri(Configuration.CreateServerUriString()); | |
ServiceHost serviceHost = new ServiceHost(singleServerInstance, baseUri); | |
serviceHost.AddServiceEndpoint(typeof(IMessageSender), Configuration.CreateBinding(), baseUri); | |
serviceHost.Open(); | |
Console.ReadLine(); | |
serviceHost.Close(); |
This file contains hidden or 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
public static class Configuration | |
{ | |
public static Binding CreateBinding() | |
{ | |
NetTcpBinding binding = new NetTcpBinding(); | |
binding.MaxReceivedMessageSize = 25 * 1024 * 1024; | |
binding.ReceiveTimeout = new TimeSpan(0, 2, 0); | |
return new NetTcpBinding(); | |
} | |
} |
This file contains hidden or 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
public interface IWcfConfiguration | |
{ | |
string RetrieveUriString(); | |
int RetrievePortNumber(); | |
TimeSpan RetrieveTimeOut(); | |
} |
OlderNewer