#develop (short for SharpDevelop) is a free IDE for .NET programming languages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

51 lines
1.3 KiB

// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Templates
{
/// <summary>
/// Contains values for localized properties.
/// </summary>
public sealed class StringParserPropertyContainer : IStringTagProvider
{
public static readonly StringParserPropertyContainer LocalizedProperty = new StringParserPropertyContainer();
public static readonly StringParserPropertyContainer FileCreation = new StringParserPropertyContainer();
private StringParserPropertyContainer()
{
StringParser.RegisterStringTagProvider(this);
}
ConcurrentDictionary<string, string> values = new ConcurrentDictionary<string, string>();
public string this[string key] {
get {
string val;
if (values.TryGetValue(key, out val))
return val;
else
return null;
}
set {
SD.MainThread.VerifyAccess();
if (value != null) {
values[key] = value;
} else {
string tmp;
values.TryRemove(key, out tmp);
}
}
}
public string ProvideString(string tag, StringTagPair[] customTags)
{
return this[tag];
}
}
}