I have been working on playing audio files on particular audio devices for a few days. On windows platform. the [C#]using Microsoft.DirectX.AudioVideoPlayback; only works for the default audio device. We need to work on a lower layer, using DirectShow.
I will post the detail of the implementation a few days later.
Wednesday, November 30, 2011
Wednesday, November 23, 2011
Get regex matched strings (Regex Capture) C#
Program that uses Match [C#]
using System; using System.Text.RegularExpressions; class Program { static void Main() { // A // The input string we are using string input = "OneTwoThree"; // B // The regular expression we use to match Regex r1 = new Regex(@"One([A-Za-z0-9\-]+)Three"); // C // Match the input and write results Match match = r1.Match(input); if (match.Success) { string v = match.Groups[1].Value; Console.WriteLine("Between One and Three: {0}", v); } } }Output Between One and Three: Two
Sunday, November 13, 2011
UI String Matching in XAML and CS
A few month ago, we were doing String Localization for our software. It is lame for us to manually find the strings in the .cs and .xaml files and replace them with localization resource files.
So I look for help from REGEX, which is always helpful when dealing with strings.
Below is the regex to match UI String in xaml and cs files:
for .cs files:
for .xaml files:
This may work in Visual Stdio only
So I look for help from REGEX, which is always helpful when dealing with strings.
Below is the regex to match UI String in xaml and cs files:
for .cs files:
^(~(ArgumentNullException|AddCMEventLog|//|dw\.add|OnPropertyChanged|Assembly\:|\[System\.|this\.RaisePropertyChanged|GeneratedCodeAttribute|throw\ new\ Exception).)+".*"(~(ArgumentNullException|AddCMEventLog).)+$
for .xaml files:
(Title="[^{])|(\ Text="[^{])|(Content="[^{])|(Header="[^{])|(ToolTip="[^{])|(Label="[^{])|(\ Value="[^{])|(Description="[^{])|(\>[^<>]+\<)
This may work in Visual Stdio only
Thursday, November 10, 2011
When you want to import dll
using System.Runtime.InteropServices;//DLLimport
[DllImport("winmm.dll", SetLastError = true)]
[DllImport("winmm.dll", SetLastError = true)]
Subscribe to:
Posts (Atom)