本文整理汇总了C#中SerializableDictionary类的典型用法代码示例。如果您正苦于以下问题:C# SerializableDictionary类的具体用法?C# SerializableDictionary怎么用?C# SerializableDictionary使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SerializableDictionary类属于命名空间,在下文中一共展示了SerializableDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Figure
public Figure()
{
PrepareBasePriorityTable();
Lines = new List<LineSegment>();
ForlornStartNodes = new List<Vector2>();
SwitchPoints = new SerializableDictionary<Vector2, SwitchPoint>();
}
示例2: FrequencyAnalysis
//private readonly SerializableDictionary<char, int> _ukrainianLetterCount;
//private int _textLength;
public FrequencyAnalysis()
{
LatinTable = new SerializableDictionary<char, double>();
//_latinLetterCount = new SerializableDictionary<char, int>();
UkrainianTable = new SerializableDictionary<char, double>();
//_ukrainianLetterCount = new SerializableDictionary<char, int>();
}
示例3: GetDefaultAspectFromVersion9
private string GetDefaultAspectFromVersion9(SerializableDictionary<string, string> serializableDictionary, List<string> aspects, string defaultAspect) {
if (serializableDictionary.ContainsKey("Schema")) {
return GetAspectFromXml(aspects, defaultAspect);
}
return defaultAspect;
}
示例4: IsExist
public bool IsExist(int id)
{
if (Items == null)
Items = new SerializableDictionary<int, int>();
return Items.ContainsKey(id);
}
示例5: JobFailPackageThrowsException
public void JobFailPackageThrowsException()
{
ExecutablePackage ep = new ExecutablePackage("mock.xml", null, "TestJobManager.dll", "TestJobManager.MockJobRunner", new SerializableDictionary<string, string>(), new SerializableDictionary<string, string>());
List<ExecutablePackage> eps = new List<ExecutablePackage>();
eps.Add(ep);
SerializableDictionary<string, string> properties = new SerializableDictionary<string, string>();
properties["Mock_ReportSuccess"] = "true";
properties["Mock_StringToLog"] = "Mock Logged String";
properties["Mock_ThrowException"] = "Expected Exception";
List<FileInfo> filesToCopy = new List<FileInfo>();
filesToCopy.Add(new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestJobManager.dll")));
JobStatus js = RunJob(filesToCopy, eps, properties, null);
mock.VerifyEventOccured(MockEventType.UpdateStatus, "Loading external test DLL: TestJobManager.dll , TestJobManager.MockJobRunner", false);
mock.VerifyEventOccured(MockEventType.UpdateStatus, "Executing Execute() method on external DLL", false);
mock.VerifyEventOccured(MockEventType.UpdateStatus, properties["Mock_ThrowException"], true);
mock.VerifyEventOccured(MockEventType.UpdateStatus, properties["Mock_StringToLog"], false);
Assert.That(js.Result.Completed, Is.False);
Assert.That(js.Result.Success, Is.False);
Assert.That(js.Result.ExecutionResults.Count, Is.EqualTo(1));
Assert.That(js.Result.Errors, Is.Not.Empty);
VerifyStringInList(js.Result.Errors, "System.Exception: " + properties["Mock_ThrowException"]);
VerifyLogContainsString(js.Result.Logs, properties["Mock_StringToLog"]);
VerifyLogContainsString(js.Result.Logs, properties["Mock_ThrowException"]);
}
示例6: Serialize
public static void Serialize(SerializableDictionary<int, CarInfo> carInfo, string fileName)
{
var textWriter = new StreamWriter(fileName);
var serializer = new XmlSerializer(typeof(SerializableDictionary<int, CarInfo>));
serializer.Serialize(textWriter, carInfo);
textWriter.Close();
}
示例7: crystalButton_FanCountSetting_Click
private void crystalButton_FanCountSetting_Click(object sender, EventArgs e)
{
SettingCommInfo commInfo = new SettingCommInfo();
commInfo.SameCount = (byte)numericUpDown_MCSameFanCount.Value;
commInfo.TypeStr = CommonUI.GetCustomMessage(HsLangTable,"HwFanName","风扇");
commInfo.IconImage = Nova.Monitoring.UI.MonitorFromDisplay.Properties.Resources.Fan;
commInfo.MaxCount = (byte)(MaxFanCount);
if (_vm.FanInfo.AllFanCountDif == null || _vm.FanInfo.AllFanCountDif.Count == 0)
{
SerializableDictionary<string, byte> moinfos = new SerializableDictionary<string, byte>();
SetCount(MonitorAllConfig.Instance().AllCommPortLedDisplayDic[_vm.SN],
_vm.SN.Replace("-",""), commInfo.SameCount, out moinfos);
_vm.FanInfo.AllFanCountDif = moinfos;
}
Frm_FanPowerAdvanceSetting setFanCntFrm = new Frm_FanPowerAdvanceSetting(
MonitorAllConfig.Instance().AllCommPortLedDisplayDic[_vm.SN],
string.IsNullOrEmpty(MonitorAllConfig.Instance().CurrentScreenName) ? _sn10 : MonitorAllConfig.Instance().CurrentScreenName,
_vm.SN.Replace("-", ""), _vm.FanInfo.AllFanCountDif, commInfo);
setFanCntFrm.StartPosition = FormStartPosition.CenterParent;
//setFanCntFrm.UpdateFont(Frm_MonitorStatusDisplay.CurrentFont);
setFanCntFrm.UpdateLanguage(CommonUI.LanguageName);
if (setFanCntFrm.ShowDialog() == DialogResult.OK)
{
_vm.FanInfo.AllFanCountDif = setFanCntFrm.CurAllSettingDic;
}
}
示例8: calc_discovery_chance
public SerializableDictionary<string, int> calc_discovery_chance (bool _accurate, float _extra_factor)
{
// Get the default settings for this base type.
SerializableDictionary<string, int> detect_chance_copy = new SerializableDictionary<string, int> (this.detect_chance);
// Adjust by the current suspicion levels ...
foreach(string group in this.detect_chance.Keys)
{
int suspicion = G.pl.groups[group].suspicion;
detect_chance_copy[group] *= 10000 + suspicion;
detect_chance_copy[group] /= 10000;
}
// ... and further adjust based on technology ...
foreach (string group in this.detect_chance.Keys)
{
int discover_bonus = G.pl.groups[group].discover_bonus;
detect_chance_copy[group] *= discover_bonus;
detect_chance_copy[group] /= 10000;
}
// ... and the given factor.
foreach(string group in this.detect_chance.Keys)
detect_chance_copy[group] = (int)(detect_chance_copy[group] * _extra_factor);
// Lastly, if we're told to be inaccurate, adjust the values to their
// nearest percent.
if (!_accurate)
foreach(string group in this.detect_chance.Keys )
detect_chance_copy[group] = G.nearest_percent(detect_chance_copy[group]);
return detect_chance_copy;
}
示例9: AccountInfo
public AccountInfo()
{
ConnectPort = 5222;
AutoConnect = true;
ProxyType = ProxyType.System;
Properties = new SerializableDictionary<string, string>();
}
示例10: loadClick
public void loadClick(DateTime time)
{
// 储存到文件,比如20130203.xml
string fileName = this.logFile;
string today = time.ToString("yyyyMMdd");
SerializableDictionary fileDatas = new SerializableDictionary();
using (FileStream stream = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Read))
{
stream.Lock(0, stream.Length);
XmlSerializer serializer = new XmlSerializer(typeof(SerializableDictionary));
if (stream.Length != 0)
{
fileDatas = (SerializableDictionary)serializer.Deserialize(stream);
if (!fileDatas.ContainsKey(today))
{
fileDatas[today] = new MouseState();
}
}
else
{
fileDatas = new SerializableDictionary();
fileDatas[today] = new MouseState();
}
this.leftClickCount = fileDatas[today].leftClickCount;
this.rightClickCount = fileDatas[today].rightClickCount;
this.middleClickCount = fileDatas[today].middleClickCount;
}
}
示例11: GenerateWeights
public static SerializableDictionary<string, SerializableDictionary<string, double>> GenerateWeights(List<string> states, SIMDIST weightFlag)
{
SerializableDictionary<string, SerializableDictionary<string, double>> weights = new SerializableDictionary<string, SerializableDictionary<string, double>>();
if (weightFlag == SIMDIST.SIMILARITY)
{
foreach (var item in states)
{
weights.Add(item, new SerializableDictionary<string, double>());
weights[item].Add(item, 1.0);
}
}
else
foreach (var item in states)
{
weights.Add(item, new SerializableDictionary<string, double>());
foreach (var item1 in states)
{
if (item != item1)
weights[item].Add(item1, 1.0);
}
}
return weights;
}
示例12: GetDefaultAspectFromVersion9
string GetDefaultAspectFromVersion9(SerializableDictionary<string, string> serializableDictionary, List<string> aspects, string defaultAspect) {
if (serializableDictionary.ContainsKey("Schema")){
var helper = new DictionaryHelper();
defaultAspect = helper.GetAspectFromXml(aspects, defaultAspect);
}
return defaultAspect;
}
示例13: ConvertFromStorageType
public override object ConvertFromStorageType(object value)
{
var masterModel = ModelDifferenceModule.MasterModel;
var layer = masterModel.CreatorInstance.CreateModelApplication();
if (!(string.IsNullOrEmpty(value as string)))
{
masterModel.AddLayerBeforeLast(layer);
var serializableDictionary = new SerializableDictionary<string, string>();
var xmlReader = XmlReader.Create(new StringReader((string)value), new XmlReaderSettings { ConformanceLevel = ConformanceLevel.Auto });
serializableDictionary.ReadXml(xmlReader);
var aspects = serializableDictionary["aspects"].Split(',').ToList();
var defaultAspect = serializableDictionary["DefaultAspect"];
defaultAspect = GetDefaultAspectFromVersion9(serializableDictionary, aspects, defaultAspect);
if (!string.IsNullOrEmpty(defaultAspect))
new ModelXmlReader().ReadFromString(layer, String.Empty, defaultAspect);
foreach (var aspect in aspects.Where(aspect => !string.IsNullOrEmpty(aspect) && !string.IsNullOrEmpty(serializableDictionary[aspect]))){
new ModelXmlReader().ReadFromString(layer, aspect, serializableDictionary[aspect]);
}
}
return layer;
}
示例14: ConvertToStorageType
public override object ConvertToStorageType(object value)
{
var model = value as ModelApplicationBase;
if (model != null)
{
var writer = new ModelXmlWriter();
var serializableDictionary = new SerializableDictionary<string, string>();
serializableDictionary["aspects"] = string.Empty;
for (int i = 0; i < model.AspectCount; ++i)
{
var aspect = model.GetAspect(i);
if (string.IsNullOrEmpty(aspect) || aspect == CaptionHelper.DefaultLanguage){
serializableDictionary["DefaultAspect"] = writer.WriteToString(model, i);
}
else{
serializableDictionary["aspects"] += aspect + ",";
serializableDictionary[aspect] = writer.WriteToString(model, i);
}
}
serializableDictionary["aspects"] = serializableDictionary["aspects"].TrimEnd(',');
var stringWriter = new StringWriter();
serializableDictionary.WriteXml(new XmlTextWriter(stringWriter));
return stringWriter.GetStringBuilder().ToString();
}
return null;
}
示例15: PortableConfig
public PortableConfig(string filename = "filehatchery.ini")
{
filepath = Util.getExecutablePath() + "\\" + filename;
XmlSerializer ser = new XmlSerializer(typeof(SerializableDictionary<string, string>));
if (File.Exists(filepath))
{
try
{
stream = File.Open(filepath, FileMode.Open);
Dict = ser.Deserialize(stream) as SerializableDictionary<string, string>;
}
catch
{
}
}
else
{
stream = File.Open(filepath, FileMode.CreateNew);
}
if (Dict == null)
Dict = new SerializableDictionary<string, string>();
ser = null;
stream.Flush();
stream.Close();
stream.Dispose();
stream = null;
}