• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SerializableDictionary类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SerializableDictionary的典型用法代码示例。如果您正苦于以下问题:C# SerializableDictionary类的具体用法?C# SerializableDictionary怎么用?C# SerializableDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SerializableDictionary类属于命名空间,在下文中一共展示了SerializableDictionary类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Figure

 public Figure()
 {
     PrepareBasePriorityTable();
     Lines = new List<LineSegment>();
     ForlornStartNodes = new List<Vector2>();
     SwitchPoints = new SerializableDictionary<Vector2, SwitchPoint>();
 }
开发者ID:jpires,项目名称:gta2net,代码行数:7,代码来源:Figure.cs


示例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>();
        }
开发者ID:DVitinnik,项目名称:UniversityApps,代码行数:11,代码来源:FrequencyAnalysis.cs


示例3: GetDefaultAspectFromVersion9

        private string GetDefaultAspectFromVersion9(SerializableDictionary<string, string> serializableDictionary, List<string> aspects, string defaultAspect) {
            if (serializableDictionary.ContainsKey("Schema")) {
                return GetAspectFromXml(aspects, defaultAspect);
            }

            return defaultAspect;
        }
开发者ID:krazana,项目名称:eXpand,代码行数:7,代码来源:Updater.cs


示例4: IsExist

        public bool IsExist(int id)
        {
            if (Items == null)
                Items = new SerializableDictionary<int, int>();

            return Items.ContainsKey(id);
        }
开发者ID:vesteksoftware,项目名称:VestekMachineUtility,代码行数:7,代码来源:CriticalAlarmManager.cs


示例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"]);
        }
开发者ID:ryanski44,项目名称:VM-Automation-Framework,代码行数:30,代码来源:TestJobManagerClient.cs


示例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();
 }
开发者ID:spritefun,项目名称:gta2net,代码行数:7,代码来源:CarInfo.cs


示例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;
            }
        }
开发者ID:hardborn,项目名称:MonitorManager,代码行数:27,代码来源:UC_HWConfig.cs


示例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;
	}
开发者ID:r618,项目名称:endgame-singularity-ii,代码行数:33,代码来源:Base.cs


示例9: AccountInfo

 public AccountInfo()
 {
     ConnectPort = 5222;
     AutoConnect = true;
     ProxyType = ProxyType.System;
     Properties = new SerializableDictionary<string, string>();
 }
开发者ID:jrudolph,项目名称:synapse,代码行数:7,代码来源:AccountService.cs


示例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;
            }
        }
开发者ID:jianfengye,项目名称:MouseMonitor,代码行数:29,代码来源:MouseState.cs


示例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;
        }
开发者ID:uQlust,项目名称:uQlust-ver1.0,代码行数:25,代码来源:ProfileAutomatic.cs


示例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;
 }
开发者ID:aries544,项目名称:eXpand,代码行数:7,代码来源:ModelValueConverter.cs


示例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;
        }
开发者ID:aries544,项目名称:eXpand,代码行数:26,代码来源:ModelValueConverter.cs


示例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;
        }
开发者ID:aries544,项目名称:eXpand,代码行数:29,代码来源:ModelValueConverter.cs


示例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;
        }
开发者ID:blmarket,项目名称:filehatchery,代码行数:28,代码来源:IConfig.cs


示例16: UserSettings

 public UserSettings(string dir)
 {
     filePath = Path.Combine(dir, FileName);
     Load(dir);
     if (_settings == null)
         _settings = new SerializableDictionary<string, string>();
 }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:7,代码来源:UserSettings.cs


示例17: Load

        /// <summary>
        /// Loads the settings from XML
        /// </summary>
        public static void Load()
        {
            _rand = new Random();

            // TODO: Real path
            if (File.Exists(Environment.CurrentDirectory + "\\list.xml"))
            {
                XmlSerializer s = new XmlSerializer(typeof(SerializableDictionary<string, List<string>>));
                TextReader r = new StreamReader(Environment.CurrentDirectory + "\\list.xml");

                try
                {
                    _messagesStore = (SerializableDictionary<string, List<string>>)s.Deserialize(r);
                    r.Close();
                }
                catch (Exception ex)
                {
                    // TODO: Let's tell the user about it or something
                    throw;
                }
            }
            else
            {
                _messagesStore = new SerializableDictionary<string, List<string>>();
            }
        }
开发者ID:nerdshark,项目名称:mutinyirc,代码行数:29,代码来源:RandomMessages.cs


示例18: XmlCache

 public XmlCache()
 {
     try
     {
         // ensure directory exists in userdata
         DirectoryInfo folder = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + FOLDER_NAME);
         if (!folder.Exists)
         {
             folder.Create();
         }
         FileInfo cacheFile = new FileInfo(XmlFullFilePath);
         if (cacheFile.Exists)
         {
             try
             {
                 XmlSerializer ser = new XmlSerializer(typeof(SerializableDictionary<long, string>));
                 using (FileStream fs = File.Open(
                     XmlFullFilePath,
                     FileMode.Open,
                     FileAccess.Read,
                     FileShare.Read))
                 {
                     _tvdbShowTitles = (SerializableDictionary<long, string>) ser.Deserialize(fs);
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception("Could Not Serialize object to " + XmlFullFilePath, ex);
             }
         }
     }
     catch
     {
     }
 }
开发者ID:boyfonz,项目名称:tvrename-scraper,代码行数:35,代码来源:XmlCache.cs


示例19: Frm_FanPowerAdvanceSetting

 public Frm_FanPowerAdvanceSetting(List<ILEDDisplayInfo> oneLedInfos,string sn,string commPort,
                                   SerializableDictionary<string, byte> curAllSettingDic, 
                                   SettingCommInfo commInfo)
 {
     InitializeComponent();
     _oneLedInfos = oneLedInfos;
     _sn = sn;
     _commPort = commPort;
     _curConfigDic = new SerializableDictionary<string, byte>();
     if (curAllSettingDic != null)
     {
         foreach(string addr in curAllSettingDic.Keys)
         {
             _curConfigDic.Add(addr, curAllSettingDic[addr]);
         }
     }
     try
     {
         _commonInfo = (SettingCommInfo)commInfo.Clone();
     }
     catch
     {
         _commonInfo = new SettingCommInfo();
     }
 }
开发者ID:hardborn,项目名称:MonitorManager,代码行数:25,代码来源:Frm_FanPowerAdvanceSetting.cs


示例20: frmUserCatalog

        public frmUserCatalog()
        {
            InitializeComponent();
            m_DirectionSort.Add("Name", false);
            m_DirectionSort.Add("Catalog", false);
            m_DirectionSort.Add("RA", false);
            m_DirectionSort.Add("DEC", false);
            m_DirectionSort.Add("Visible", false);
            m_GeminiDirectionSort.Add("Name", false);
            m_GeminiDirectionSort.Add("Catalog", false);
            m_GeminiDirectionSort.Add("RA", false);
            m_GeminiDirectionSort.Add("DEC", false);
            m_GeminiDirectionSort.Add("Visible", false);

            m_GeminiObjects = new SerializableDictionary<string, CatalogObject>();
            CList.Add("Name", o => o.Name);
            CList.Add("Catalog", o => o.Catalog);
            CList.Add("RA", o => o.RA);
            CList.Add("DEC", o => o.DEC);
            CList.Add("Visible", o => o.Visible);

            m_GeminiCatalogs.Add("messier", "1");
            m_GeminiCatalogs.Add("ngc", "2");
            m_GeminiCatalogs.Add("ic", "3");
            m_GeminiCatalogs.Add("sharpless hii regions", "4");
            m_GeminiCatalogs.Add("sao catalog", "7");
            m_GeminiCatalogs.Add("lynds dark nebulae", ":");  
            m_GeminiCatalogs.Add("lynds bright nebulae", ";");


            gvAllObjects.RowHeadersVisible = false;
            gvGeminiCatalog.RowHeadersVisible = false;
            dtDateTime.Checked = false;
            numHorizon.Value = (decimal)GeminiHardware.Instance.HorizonAltitude;
        }
开发者ID:PKAstro,项目名称:Ascom.Gemini.Telescope,代码行数:35,代码来源:frmUserCatalog.cs



注:本文中的SerializableDictionary类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SerializableFile类代码示例发布时间:2022-05-24
下一篇:
C# SerialPort类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap