public Figure() { PrepareBasePriorityTable(); Lines = new List<LineSegment>(); ForlornStartNodes = new List<Vector2>(); SwitchPoints = new SerializableDictionary<Vector2, SwitchPoint>(); }
public NotificationSettings() { Categories = new SerializableDictionary<NotificationCategory, NotificationCategorySettings>(); Categories[NotificationCategory.AccountNotInTraining] = new NotificationCategorySettings(ToolTipNotificationBehaviour.RepeatUntilClicked); EmailPortNumber = 25; }
public override void UpdateDatabaseBeforeUpdateSchema() { base.UpdateDatabaseBeforeUpdateSchema(); if (CurrentDBVersion > new Version(0, 0, 0, 0) && CurrentDBVersion <= new Version(10, 1, 6)) { var differenceObjects = new Dictionary<object, string>(); using (var reader = ExecuteReader("select [Oid], [Model] from [ModelDifferenceObject] where [Model] is not null", false)) { while (reader.Read()) { differenceObjects.Add(reader[0], reader[1] as string); } } using (var uow = new UnitOfWork(((ObjectSpace)ObjectSpace).Session.DataLayer)) { foreach (var differenceObject in differenceObjects) { var modelDifferenceObject = uow.GetObjectByKey<ModelDifferenceObject>(differenceObject.Key); var serializableDictionary = new SerializableDictionary<string, string>(); var xmlReader = XmlReader.Create(new StringReader(differenceObject.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)) modelDifferenceObject.AspectObjects.Add(new AspectObject(uow) { Name = CaptionHelper.DefaultLanguage, Xml = defaultAspect }); foreach (var aspect in aspects.Where(aspect => !string.IsNullOrEmpty(aspect) && !string.IsNullOrEmpty(serializableDictionary[aspect]))) { modelDifferenceObject.AspectObjects.Add(new AspectObject(uow) { Name = aspect, Xml = serializableDictionary[aspect] }); } } uow.CommitChanges(); } } }
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; }
private string GetDefaultAspectFromVersion9(SerializableDictionary<string, string> serializableDictionary, List<string> aspects, string defaultAspect) { if (serializableDictionary.ContainsKey("Schema")) { return GetAspectFromXml(aspects, defaultAspect); } return defaultAspect; }
/// <summary> /// Creates a new empty grid. /// </summary> public MapGrid(SwordeningGame game,InGame gameState) { _game = game; _gameState = gameState; _tiles = new SerializableDictionary<string, MapTile>(); }
//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>(); }
public void JobFailISOCopyFail() { string expectedException = "System.IO.FileNotFoundException: Could not find file"; SerializableDictionary<string, string> isos = new SerializableDictionary<string, string>(); isos["Main"] = "nonexistant.iso"; 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); List<FileInfo> filesToCopy = new List<FileInfo>(); filesToCopy.Add(new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestJobManager.dll"))); JobStatus js = RunJob(filesToCopy, eps, null, isos); mock.VerifyEventOccured(MockEventType.UpdateStatus, expectedException, true); 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, expectedException); VerifyLogContainsString(js.Result.Logs, expectedException); }
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"]); }
public HecRasModel() { rivers = new SerializableDictionary<string, River>("RiverReachDictionaryItem", "Key", "Value"); profiles = new List<string>(); controller = new HECRASController(); controller.Compute_HideComputationWindow(); }
public bool IsExist(int id) { if (Items == null) Items = new SerializableDictionary<int, int>(); return Items.ContainsKey(id); }
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(); } }
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; } }
/// <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>>(); } }
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(); }
public TaskInfo() { //初始化 FilePath = new List<string>(); SubFilePath = new List<string>(); Settings = new SerializableDictionary<string, string>(); }
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; }
private ItemData CreateItemDataFromGameObject(GameObject gameObject) { ValidateGameObject (gameObject); ItemData itemData = new ItemData (); itemData.transformData.position = gameObject.transform.position; itemData.transformData.rotation = gameObject.transform.eulerAngles; itemData.transformData.scale = gameObject.transform.localScale; itemData.name = gameObject.name; foreach (IPersistable persistable in gameObject.GetComponents<IPersistable>()) { SerializableDictionary<string, object> componentConfiguration = new SerializableDictionary<string, object> (); foreach (FieldInfo field in persistable.GetType().GetFields()) { componentConfiguration.Add (field.Name, field.GetValue (persistable)); } string componentName = persistable.GetType ().FullName; itemData.componentData.configurations.Add (componentName, componentConfiguration); } foreach (Transform child in gameObject.transform) { if (child.GetComponents<IPersistable> ().Length > 0) { itemData.children.Add (CreateItemDataFromGameObject (child.gameObject)); } } return itemData; }
public XgminerConfiguration() { AlgorithmFlags = new SerializableDictionary<CoinAlgorithm, string>(); Priority = ProcessPriorityClass.Normal; StartingApiPort = 4028; StratumProxyPort = 8332; }
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; }
public static SerializableDictionary<string, string> GetLanguageStrings(Stream javaMessagesStream) { var result = new SerializableDictionary<string, string>(); using (var reader = new StreamReader(javaMessagesStream)) { while (!reader.EndOfStream) { var line = reader.ReadLine(); var deviderIndex = line.IndexOf('='); if (deviderIndex != -1 && line[0] != '#') { var text = line.Substring(deviderIndex + 1); var regex = new Regex(@"\\u[A-Za-z0-9]{4}"); text = regex.Replace(text, m => ((Char)UInt16.Parse(m.Value.Substring(2), System.Globalization.NumberStyles.AllowHexSpecifier)).ToString()); var key = line.Substring(0, deviderIndex); if (!result.ContainsKey(key)) result.Add(key, text); } } } return result; }
public UserSettings(string dir) { filePath = Path.Combine(dir, FileName); Load(dir); if (_settings == null) _settings = new SerializableDictionary<string, string>(); }
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; }
public AccountInfo() { ConnectPort = 5222; AutoConnect = true; ProxyType = ProxyType.System; Properties = new SerializableDictionary<string, string>(); }
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; } }
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; }
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; }
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; }
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 { } }
public override object ConvertFromStorageType(object value){ if (!(string.IsNullOrEmpty(value as string))) { var settings = new XmlReaderSettings{ConformanceLevel = ConformanceLevel.Auto}; var reader = XmlReader.Create(new StringReader((string) value), settings); var serializableDictionary = new SerializableDictionary<string, string>(); serializableDictionary.ReadXml(reader); var schema = new Schema(new DictionaryXmlReader().ReadFromString(serializableDictionary["Schema"].Replace(":",""))); var commonSchema = Schema.GetCommonSchema(); commonSchema.CombineWith(schema); var helper = new DictionaryHelper(); var aspects = serializableDictionary["aspects"].Split(',').ToList(); string aspectFromXml = helper.GetAspectFromXml(aspects, serializableDictionary["DefaultAspect"]); var dictionary = new Dictionary(new DictionaryXmlReader().ReadFromString(aspectFromXml), commonSchema); foreach (var aspectValue in aspects.Where(s => !string.IsNullOrEmpty(s))){ string xml = serializableDictionary[aspectValue]; if (!(string.IsNullOrEmpty(xml))) dictionary.AddAspect(aspectValue, new DictionaryXmlReader().ReadFromString(xml)); } return dictionary; } return null; }
private IEnumerator Examples() { Log.Debug("ExampleAssistantV2.RunExample()", "Attempting to CreateSession"); service.CreateSession(OnCreateSession, assistantId); while (!createSessionTested) { yield return(null); } Log.Debug("ExampleAssistantV2.RunExample()", "Attempting to Message"); service.Message(OnMessage0, assistantId, sessionId); while (!messageTested0) { yield return(null); } Log.Debug("ExampleAssistantV2.RunExample()", "Are you open on Christmas?"); var input1 = new MessageInput() { Text = "Are you open on Christmas?", Options = new MessageInputOptions() { ReturnContext = true } }; service.Message(OnMessage1, assistantId, sessionId, input: input1); while (!messageTested1) { yield return(null); } Log.Debug("ExampleAssistantV2.RunExample()", "What are your hours?"); var input2 = new MessageInput() { Text = "What are your hours?", Options = new MessageInputOptions() { ReturnContext = true } }; service.Message(OnMessage2, assistantId, sessionId, input: input2); while (!messageTested2) { yield return(null); } Log.Debug("ExampleAssistantV2.RunExample()", "I'd like to make an appointment for 12pm."); var input3 = new MessageInput() { Text = "I'd like to make an appointment for 12pm.", Options = new MessageInputOptions() { ReturnContext = true } }; service.Message(OnMessage3, assistantId, sessionId, input: input3); while (!messageTested3) { yield return(null); } Log.Debug("ExampleAssistantV2.RunExample()", "On Friday please."); //Dictionary<string, string> userDefinedDictionary = new Dictionary<string, string>(); //userDefinedDictionary.Add("name", "Watson"); //Dictionary<string, object> skillDictionary = new Dictionary<string, object>(); //skillDictionary.Add("user_defined", userDefinedDictionary); //Dictionary<string, object> skills = new Dictionary<string, object>(); //skills.Add("main skill", skillDictionary); SerializableDictionary <string, string> userDefinedDictionary = new SerializableDictionary <string, string>(); userDefinedDictionary.Add("name", "Watson"); //MessageContextSkill skillDictionary = new MessageContextSkill(); //skillDictionary.UserDefined = userDefinedDictionary; //MessageContextSkills skills = new MessageContextSkills(); //skills.MainSkill = skillDictionary; var input4 = new MessageInput() { Text = "On Friday please.", Options = new MessageInputOptions() { ReturnContext = true } }; var context = new MessageContext() { //Skills = skills }; service.Message(OnMessage4, assistantId, sessionId, input: input4, context: context); while (!messageTested4) { yield return(null); } Log.Debug("ExampleAssistantV2.RunExample()", "Attempting to delete session"); service.DeleteSession(OnDeleteSession, assistantId, sessionId); while (!deleteSessionTested) { yield return(null); } Log.Debug("ExampleAssistantV2.Examples()", "Assistant examples complete."); }
public static bool ValidateMultiDatabaseData(MultiDbData dbData) { for (int i = 0; i < dbData.Count; i++) { if (dbData[i].OverrideSequence == null) { return(false); } SerializableDictionary <string, List <DatabaseOverride> > .Enumerator enumer = dbData[i].OverrideSequence.GetEnumerator(); while (enumer.MoveNext()) { if (!ConnectionHelper.ValidateDatabaseOverrides(dbData[i].OverrideSequence[enumer.Current.Key])) { return(false); } } } return(true); }
public QcDataCollection() { ProcessedRawFiles = new List <string>(); QcData = new SerializableDictionary <DateTime, QcDataContainer>(); }
public MenuSettings() { MainMenuGroupNames = new List <GroupItemSetting>(); MainMenuShortCuts = new List <GroupItemSetting>(); MenuItems = new SerializableDictionary <string, SerializableDictionary <Guid, HomeMenuModel.GridPosition> >(); }
private void saveCurrentDependenceRecord() { if (this.settingPrimaryVaraibleListBoxControl.SelectedIndex >= 0 && this.settingSecondaryVaraibleListBoxControl.SelectedIndex >= 0 && this.settingPrimaryItemListBoxControl.SelectedIndex >= 0) { string primaryVariableStr = this.settingPrimaryVaraibleListBoxControl.SelectedItem as string; string secondVariableStr = this.settingSecondaryVaraibleListBoxControl.SelectedItem as string; string primaryItemStr = this.settingPrimaryItemListBoxControl.SelectedItem as string; SerializableDictionary <string, SecondaryItem> secondaryItemDict = new SerializableDictionary <string, SecondaryItem>(); foreach (string temp in this.settingSecondaryItemListBoxControl.CheckedItems) { if (!temp.Equals("Select All")) { secondaryItemDict.Add(temp, new SecondaryItem(temp)); } } // the secondaryItemList has checked items if (this.variableRelation.containRecord(primaryVariableStr, secondVariableStr)) { VariableDependenceRecord record = this.variableRelation.getRecord(primaryVariableStr, secondVariableStr); if (record.ItemDependencDict.ContainsKey(primaryItemStr)) { // in case of the checked item change to be no one checked ,so we use the last state secondaryItemList to decide whether is a empty or not; if (record.ItemDependencDict[primaryItemStr].Count > 0) { //if the secondaryItemList is not empty we just set it if (secondaryItemDict.Count > 0) { record.ItemDependencDict[primaryItemStr] = secondaryItemDict; } // else the record item becomes empty ,we just need to delete it else { record.ItemDependencDict.Remove(primaryItemStr); } // if the record key related record has no item relation just remove it if (record.ItemDependencDict.Count == 0) { this.variableRelation.DependenceRecordDict.Remove(new VariableDependenceRecordKey(primaryVariableStr, secondVariableStr)); } } } else { if (secondaryItemDict.Count > 0) { record.ItemDependencDict.Add(primaryItemStr, secondaryItemDict); } } } else { if (secondaryItemDict.Count > 0) { VariableDependenceRecord record = new VariableDependenceRecord(); record.PrimaryVariable = primaryVariableStr; record.SecondaryVarialbe = secondVariableStr; record.ItemDependencDict.Add(primaryItemStr, secondaryItemDict); // new added function : auto select all //List<string> primaryData = this.settingPrimaryItemListBoxControl.DataSource as List<string>; //List<string> secondaryData = this.settingSecondaryItemListBoxControl.DataSource as List<string>; //SerializableDictionary<string, SecondaryItem> allSecondaryItemDict = new SerializableDictionary<string, SecondaryItem>(); //foreach (string temp in secondaryData) //{ // if (!temp.Equals("Select All")) // { // allSecondaryItemDict.Add(temp, new SecondaryItem(temp)); // } //} //foreach (string primaryItem in primaryData) //{ // if (primaryItem.Equals(primaryItemStr)) // { // record.ItemDependencDict.Add(primaryItemStr, secondaryItemDict); // } // else // { // record.ItemDependencDict.Add(primaryItem, allSecondaryItemDict); // } //} this.variableRelation.DependenceRecordDict.Add(new VariableDependenceRecordKey(primaryVariableStr, secondVariableStr), record); } } } }
public Players() { playerLogins = new SerializableDictionary <ulong, PlayerItem>(); }
// A LOT OF THIS IS NOT VERY GOOD PLEASE CLOSE YOUR EYES THANK YOU public static Fic GetFicData(string htmlCode) { // TODO look into more efficient value retrieval and assignment var fic = new Fic(); List <string> formats = new List <string>(); foreach (string fmt in Constants.AllowedExt) { formats.Add(fmt.ToUpper()); // Not sure if this is necessary, but it worked with uppercase before so nyeh } HtmlDocument htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml(htmlCode); // Single-value attributes string title = GetElementValue(htmlDoc, Xpaths.Title).Replace("\n", String.Empty).TrimStart(' ').TrimEnd(' '); string lengthString = GetElementValue(htmlDoc, Xpaths.Words); int length = int.Parse(lengthString); string chaptersString = GetElementValue(htmlDoc, Xpaths.Chapters); int chapters; try { chapters = int.Parse(chaptersString.Split('/')[1]); } catch (Exception) { chapters = int.Parse(chaptersString.Split('/')[0]); } string published = GetElementValue(htmlDoc, Xpaths.Published); string updated; try { updated = GetElementValue(htmlDoc, Xpaths.Updated); } catch (Exception) { updated = published; } string rating = GetElementValue(htmlDoc, Xpaths.Rating); // Multi-value attributes var authorElements = htmlDoc.DocumentNode.SelectNodes(Xpaths.Author); List <String> authors = new List <String>(); if (authorElements != null) { foreach (HtmlNode authorNode in authorElements) { string authorUrl; try { authorUrl = authorNode.Attributes["href"].Value; } catch (Exception) { authorUrl = ""; } string authorName; try { authorName = authorNode.InnerText; } catch (Exception) { authorName = "Anonymous"; } authors.Add(authorName + " : " + authorUrl); } } else { authors.Add("Anonymous"); } SerializableDictionary <string, string> downloadLinks = new SerializableDictionary <string, string>(); foreach (string format in formats) { string formatPath = string.Format(Xpaths.Download, format); string formatUrl = htmlDoc.DocumentNode.SelectSingleNode(formatPath).Attributes["href"].Value; downloadLinks.Add(format, Constants.BaseUrl + formatUrl); } List <String> categories = new List <String>(); try { var categoryElements = htmlDoc.DocumentNode.SelectNodes(Xpaths.Category); foreach (HtmlNode catNode in categoryElements) { string catName = catNode.InnerText; categories.Add(catName); } } catch (Exception) { } List <String> fandoms = new List <String>(); try { var fandomElements = htmlDoc.DocumentNode.SelectNodes(Xpaths.Fandom); foreach (HtmlNode fanNode in fandomElements) { string fandomName = fanNode.InnerText; fandoms.Add(fandomName); } } catch (Exception) { } List <String> relationships = new List <String>(); try { var relElements = htmlDoc.DocumentNode.SelectNodes(Xpaths.Relationship); foreach (HtmlNode relNode in relElements) { string relName = relNode.InnerText; relationships.Add(relName); } } catch (Exception) { } List <String> characters = new List <String>(); try { var charElements = htmlDoc.DocumentNode.SelectNodes(Xpaths.Characters); foreach (HtmlNode charNode in charElements) { string charName = charNode.InnerText; characters.Add(charName); } } catch (Exception) { } List <String> tags = new List <String>(); try { var tagElements = htmlDoc.DocumentNode.SelectNodes(Xpaths.Tags); foreach (HtmlNode tagNode in tagElements) { string tagName = tagNode.InnerText; tags.Add(tagName); } } catch (Exception) { } List <string> summary = new List <string>(); try { var parElements = htmlDoc.DocumentNode.SelectNodes(Xpaths.Summary); foreach (HtmlNode parNode in parElements) { string line = parNode.InnerText; summary.Add(line); } } catch (Exception) { } // Property assignment fic.Title = title; fic.Words = length; fic.Chapters = chapters; fic.Downloads = downloadLinks; fic.Published = published; fic.Updated = updated; fic.Rating = rating; fic.Author = authors.ToArray(); fic.Category = categories.ToArray(); fic.Fandom = fandoms.ToArray(); fic.Relationship = relationships.ToArray(); fic.Characters = characters.ToArray(); fic.AdditionalTags = tags.ToArray(); fic.Summary = String.Join(Environment.NewLine, summary); return(fic); }
public DictionaryActiveRequests() { this._solicitudesGeneradasEstados = new SerializableDictionary <long, RequestGenerated>(); this._solicitudesGeneradasSolicitudes = new SerializableDictionary <int, RequestGenerated>(); }
// init set equal weight public virtual void InitDefaultValue() { Controller controller = Controller.getInstance(); VariableRelation variableRelationSetting = Controller.getInstance().XMLDeserializeVariableRelation(); this.DependenceRecordDict = variableRelationSetting.DependenceRecordDict; foreach (KeyValuePair <VariableDependenceRecordKey, VariableDependenceRecord> kv in this.DependenceRecordDict) { VariableDependenceRecord record = kv.Value; SerializableDictionary <string, SerializableDictionary <string, SecondaryItem> > itemDependecDict = record.ItemDependencDict; foreach (KeyValuePair <string, SerializableDictionary <string, SecondaryItem> > kv2 in itemDependecDict) { SerializableDictionary <string, SecondaryItem> secondaryItemDict = kv2.Value; int number = secondaryItemDict.Count; double[] itemArray = ManualAssignmentPlatformWeightSetMethod.getAverageWeight(number); foreach (KeyValuePair <string, SecondaryItem> kv3 in secondaryItemDict) { kv3.Value.Weight = itemArray[0]; } string lastItemStr = new List <string>(secondaryItemDict.Keys)[secondaryItemDict.Count - 1]; secondaryItemDict[lastItemStr].Weight = itemArray[number - 1]; } } }
// Use this for initialization void Start() { animationCurves = new SerializableDictionary <string, RootCurve>(); Vector3 initPos = transform.position; Quaternion initRot = transform.rotation; initRootLocalPos = root.localPosition; Vector3 originalRootPos = root.position; Quaternion originalRootRot = root.rotation; Vector3 prevEndPos = transform.position; for (int i = 0; i < animationNames.Length; i++) { RootCurve animCurve; animCurve.xPos = new AnimationCurve(); animCurve.yPos = new AnimationCurve(); animCurve.zPos = new AnimationCurve(); animCurve.yRot = new AnimationCurve(); float initYRot = 0; transform.position = Vector3.zero; transform.rotation = Quaternion.identity; AnimationState anim = animation[animationNames[i]]; anim.enabled = true; anim.wrapMode = WrapMode.Loop; Vector3 initRootPos = root.position; // For every sample we want for (int s = 0; s < samples; s++) { // Sample the Animation until the end of our action anim.normalizedTime = s * time / (samples - 1); animation.Play(anim.name); animation.Sample(); if (s == 0) { initRootPos = root.position; Vector3 initForwardProj = new Vector3(-root.right.x, 0, -root.right.z); Vector3 initZVector = new Vector3(0, 0, 1); initYRot = AnimationAnalyzer.CalculateAngleOf2Vectors(initZVector, initForwardProj); } Vector3 rootDisplacement = root.position - initRootPos; animCurve.xPos.AddKey(s * time / (samples - 1), rootDisplacement.x); if (s == samples - 1) { animCurve.yPos.AddKey(s * time / (samples - 1), 0); } else { animCurve.yPos.AddKey(s * time / (samples - 1), rootDisplacement.y); } animCurve.zPos.AddKey(s * time / (samples - 1), rootDisplacement.z); Vector3 forwardProj = new Vector3(-root.right.x, 0, -root.right.z); Vector3 zVector = new Vector3(0, 0, 1); float yRot = AnimationAnalyzer.CalculateAngleOf2Vectors(zVector, forwardProj) - initYRot; animCurve.yRot.AddKey(s * time / (samples - 1), yRot); } animCurve.xPos.postWrapMode = WrapMode.Clamp; animCurve.xPos.preWrapMode = WrapMode.Clamp; animCurve.yPos.postWrapMode = WrapMode.Clamp; animCurve.yPos.preWrapMode = WrapMode.Clamp; animCurve.zPos.postWrapMode = WrapMode.Clamp; animCurve.zPos.preWrapMode = WrapMode.Clamp; animCurve.yRot.postWrapMode = WrapMode.Clamp; animCurve.yRot.preWrapMode = WrapMode.Clamp; animationCurves.Add(animationNames[i], animCurve); // We remove the animation anim.normalizedTime = 0.0f; anim.enabled = false; animation.Stop(); animation.Sample(); } root.rotation = originalRootRot; root.position = originalRootPos; transform.position = initPos; transform.rotation = initRot; currentAnimState = null; currentAnimIndex = -1; Vector3 position = transform.position; Quaternion rot = transform.rotation; for (int i = 0; i < animationNames.Length; i++) { Vector3 displacement = Vector3.zero; float rotY = 0; float currentTime = time; RootCurve animCurve = animationCurves[animationNames[i]]; displacement.x = animCurve.xPos.Evaluate(currentTime); displacement.y = animCurve.yPos.Evaluate(currentTime); displacement.z = animCurve.zPos.Evaluate(currentTime); rotY = animCurve.yRot.Evaluate(currentTime); position += rot * displacement; Quaternion rotation = Quaternion.Euler(0, rotY, 0); rot = rotation * rot; Instantiate(rootRepresentation, position, Quaternion.identity); } Destroy(rootRepresentation); changed = false; }
public override void InitDefaultValue() { Controller controller = Controller.getInstance(); VariableRelation variableRelationSetting = Controller.getInstance().XMLDeserializeVariableRelation(); this.DependenceRecordDict = variableRelationSetting.DependenceRecordDict; foreach (KeyValuePair <VariableDependenceRecordKey, VariableDependenceRecord> kv in this.DependenceRecordDict) { VariableDependenceRecord record = kv.Value; SerializableDictionary <string, SerializableDictionary <string, SecondaryItem> > itemDependecDict = record.ItemDependencDict; foreach (KeyValuePair <string, SerializableDictionary <string, SecondaryItem> > kv2 in itemDependecDict) { SerializableDictionary <string, SecondaryItem> secondaryItemDict = kv2.Value; foreach (KeyValuePair <string, SecondaryItem> kv3 in secondaryItemDict) { kv3.Value.Weight = 0; } } } }
public virtual void updateSecondaryItemData() { Controller controller = Controller.getInstance(); VariableRelation variableRelationSetting = Controller.getInstance().XMLDeserializeVariableRelation(); SerializableDictionary <VariableDependenceRecordKey, VariableDependenceRecord> newDependenceRecordDict = variableRelationSetting.DependenceRecordDict; // compare with the latest data from xml add the lack records and remove the redundant records. // add lack records foreach (KeyValuePair <VariableDependenceRecordKey, VariableDependenceRecord> kv in newDependenceRecordDict) { if (!this.DependenceRecordDict.ContainsKey(kv.Key)) { VariableDependenceRecord record = kv.Value; SerializableDictionary <string, SerializableDictionary <string, SecondaryItem> > itemDependecDict = record.ItemDependencDict; foreach (KeyValuePair <string, SerializableDictionary <string, SecondaryItem> > kv2 in itemDependecDict) { SerializableDictionary <string, SecondaryItem> secondaryItemDict = kv2.Value; int number = secondaryItemDict.Count; double[] itemArray = ManualAssignmentPlatformWeightSetMethod.getAverageWeight(number); foreach (KeyValuePair <string, SecondaryItem> kv3 in secondaryItemDict) { kv3.Value.Weight = itemArray[0]; } string lastItemStr = new List <string>(secondaryItemDict.Keys)[secondaryItemDict.Count - 1]; secondaryItemDict[lastItemStr].Weight = itemArray[number - 1]; } // add the new record this.DependenceRecordDict.Add(kv.Key, kv.Value); } } // remove the redundant records List <VariableDependenceRecordKey> keyList = new List <VariableDependenceRecordKey>(this.DependenceRecordDict.Keys); for (int i = 0; i < keyList.Count; i++) { if (!newDependenceRecordDict.ContainsKey(keyList[i])) { this.DependenceRecordDict.Remove(keyList[i]); } } }
public PrintSetting() { DisplayItems = new SerializableDictionary <string, DisplayItem>(); }
public ISecondaryItemWeightSetMethod( ) { this.DependenceRecordDict = new SerializableDictionary <VariableDependenceRecordKey, VariableDependenceRecord>(); this.DependenceRecordTestTimesDict = new SerializableDictionary <VariableDependenceRecordKey, SerializableDictionary <string, SerializableDictionary <string, int> > >(); InitDefaultValue(); }
void IMyInput.SaveControls(SerializableDictionary <string, object> controlsGeneral, SerializableDictionary <string, object> controlsButtons) { }
public override void analyzeFile() { com.drew.metadata.Metadata m; try { if (strExt.ToLower() == ".raw" || strExt.ToLower() == ".cr2" || strExt.ToLower() == ".crw") { m = TiffMetadataReader.ReadMetadata(stm); } else { m = JpegMetadataReader.ReadMetadata(stm); } IEnumerator <AbstractDirectory> lcDirectoryEnum = m.GetDirectoryIterator(); while (lcDirectoryEnum.MoveNext()) { if (lcDirectoryEnum.Current.GetName() != "Jpeg Makernote") { SerializableDictionary <string, string> dicTags = new SerializableDictionary <string, string>(); AbstractDirectory lcDirectory = lcDirectoryEnum.Current; IEnumerator <Tag> lcTagsEnum = lcDirectory.GetTagIterator(); while (lcTagsEnum.MoveNext()) { Tag tag = lcTagsEnum.Current; if (tag.GetTagName() == "Thumbnail Data") { Thumbnail = (byte[])tag.GetTagValue(); } string lcDescription = ""; try { lcDescription = tag.GetDescription(); } catch { }; string lcName = tag.GetTagName(); if (lcName.ToLower().StartsWith("unknown") || lcDescription.ToLower().StartsWith("unknown")) { continue; } lcName = Functions.RemoveAccentsWithNormalization(lcName); lcDescription = Functions.RemoveAccentsWithNormalization(lcDescription); if (lcName.ToLower() == "owner name" || lcName.ToLower() == "copyright") { if (!string.IsNullOrEmpty(lcDescription) && lcDescription.Trim() != string.Empty && !lcDescription.ToLower().Contains("digital") && !lcDescription.ToLower().Contains("camera") && !lcDescription.ToLower().Contains("(c)") && !lcDescription.ToLower().Contains("copyright")) { FoundUsers.AddUniqueItem(lcDescription, false, "Copyright/Owner name"); } } if (lcName.ToLower() == "software") { string strSoftware = Analysis.ApplicationAnalysis.GetApplicationsFromString(lcDescription.Trim()); if (!FoundMetaData.Applications.Items.Any(A => A.Name == strSoftware)) { FoundMetaData.Applications.Items.Add(new ApplicationsItem(strSoftware)); } } if (lcName.ToLower() == "model") { FoundMetaData.Model = lcDescription.Trim(); } dicTags.Add(lcName, lcDescription); } dicAnotherMetadata.Add(lcDirectory.GetName(), dicTags); } } } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Error analizing EXIF metadata ({0})", e.ToString()); } finally { this.stm.Close(); } }
internal static void ProcessBitcoinTransaction(JObject blockchainTransaction) { /* Format: * * { * "op": "utx", * "x": { * "lock_time": 0, * "ver": 1, * "size": 192, * "inputs": [ * { * "sequence": 4294967295, * "prev_out": { * "spent": true, * "tx_index": 99005468, * "type": 0, * "addr": "1BwGf3z7n2fHk6NoVJNkV32qwyAYsMhkWf", * "value": 65574000, * "n": 0, * "script": "76a91477f4c9ee75e449a74c21a4decfb50519cbc245b388ac" * }, * "script": "483045022100e4ff962c292705f051c2c2fc519fa775a4d8955bce1a3e29884b2785277999ed02200b537ebd22a9f25fbbbcc9113c69c1389400703ef2017d80959ef0f1d685756c012102618e08e0c8fd4c5fe539184a30fe35a2f5fccf7ad62054cad29360d871f8187d" * } * ], * "time": 1440086763, * "tx_index": 99006637, * "vin_sz": 1, * "hash": "0857b9de1884eec314ecf67c040a2657b8e083e1f95e31d0b5ba3d328841fc7f", * "vout_sz": 1, * "relayed_by": "127.0.0.1", * "out": [ * { * "spent": false, * "tx_index": 99006637, * "type": 0, * "addr": "1A828tTnkVFJfSvLCqF42ohZ51ksS3jJgX", * "value": 65564000, * "n": 0, * "script": "76a914640cfdf7b79d94d1c980133e3587bd6053f091f388ac" * } * ] * } * } */ Console.WriteLine(" - transaction received"); if (_transactionCache == null) { _transactionCache = new SerializableDictionary <string, JObject>(); } string txHash = (string)blockchainTransaction["x"]["hash"]; _transactionCache[txHash] = (JObject)blockchainTransaction["x"]; foreach (JObject outpoint in blockchainTransaction["x"]["out"]) { Satoshis satoshis = Int64.Parse((string)outpoint["value"]); string addressString = (string)outpoint["addr"]; HotBitcoinAddress hotAddress = null; try { hotAddress = HotBitcoinAddress.FromAddress(BitcoinChain.Cash, addressString); } catch (ArgumentException) { // Ignore this - it means the addressString isn't ours continue; } if (hotAddress != null) { JObject json = new JObject(); json["MessageType"] = "BitcoinReceived"; json["Address"] = addressString; json["Hash"] = txHash; Currency currency = hotAddress.Organization.Currency; json["OrganizationId"] = hotAddress.OrganizationId.ToString(); json["Currency"] = currency.Code; Swarmops.Logic.Financial.Money organizationCents = new Money(satoshis, Currency.BitcoinCore).ToCurrency(currency); json["Satoshis"] = satoshis.ToString(); json["Cents"] = organizationCents.Cents.ToString(); json["CentsFormatted"] = String.Format("{0:N2}", organizationCents.Cents / 100.0); _socketServer.WebSocketServices.Broadcast(json.ToString()); // TODO: Examine what address this is, handle accordingly } } }
/// <summary> /// コンストラクタ /// </summary> /// <param name="displaySettings">表示の設定名</param> public PrintSetting(string displaySettings) { DisplayItems = new SerializableDictionary <string, DisplayItem>(); DisplaySettings = displaySettings; }
private void secondaryRestoreButton_Click(object sender, EventArgs e) { BindingList <ItemWeightRecord> recordList = this.secondaryGridView.DataSource as BindingList <ItemWeightRecord>; int number = recordList.Count; double[] itemArray = ManualAssignmentPlatformWeightSetMethod.getAverageWeight(number); int variableSelectIndex = this.secondaryVariableDependenceListBoxControl.SelectedIndex; string variableRelationKey = secondaryVariableDependenceListBoxControl.SelectedItem as string; string[] keyArray = Regex.Split(variableRelationKey, " --- ", RegexOptions.IgnoreCase); string primaryKey = keyArray[0]; string secondaryKey = keyArray[1]; ManualAssignmentPlatformWeightSetMethod manualSet = (ManualAssignmentPlatformWeightSetMethod)this.Strategy.PlatformWeightSetMethod.Value; SerializableDictionary <VariableDependenceRecordKey, VariableDependenceRecord> secondaryWeightDict = manualSet.SecondaryItemWeightSetMethod.Value.DependenceRecordDict; VariableDependenceRecord record = secondaryWeightDict[new VariableDependenceRecordKey(primaryKey, secondaryKey)]; int itemSelectIndex = this.secondaryPrimaryVariableListBoxControl.SelectedIndex; string itemRelationKey = this.secondaryPrimaryVariableListBoxControl.SelectedItem as string; foreach (ItemWeightRecord itemRecord in recordList) { if (recordList.IndexOf(itemRecord) != recordList.Count - 1) { itemRecord.Weight = itemArray[0]; } else { itemRecord.Weight = itemArray[number - 1]; } string secondaryItemStr = itemRecord.Item; record.ItemDependencDict[itemRelationKey][secondaryItemStr].Weight = itemRecord.Weight; } this.secondarySecondaryVariablGridControl.DataSource = recordList; this.setSecondaryGridView(); this.secondarySecondaryVariablGridControl.RefreshDataSource(); }
void IMyInput.LoadData(SerializableDictionary <string, object> controlsGeneral, SerializableDictionary <string, object> controlsButtons) { }
public Enumerator(SerializableDictionary <K, V> dictionary) { m_Dictionary = dictionary; }
private void secondaryVariableDependenceListBoxControl_SelectedIndexChanged(object sender, EventArgs e) { ListBoxControl listBoxControl = sender as ListBoxControl; int selectIndex = listBoxControl.SelectedIndex; string temVariableStr = listBoxControl.SelectedItem as string; if (selectIndex >= 0 && listBoxControl.Focused) { string[] keyArray = Regex.Split(temVariableStr, " --- ", RegexOptions.IgnoreCase); if (keyArray.Length == 2) { string primaryKey = keyArray[0]; string secondaryKey = keyArray[1]; ManualAssignmentPlatformWeightSetMethod manualSet = (ManualAssignmentPlatformWeightSetMethod)this.Strategy.PlatformWeightSetMethod.Value; SerializableDictionary <VariableDependenceRecordKey, VariableDependenceRecord> primaryWeightDict = manualSet.SecondaryItemWeightSetMethod.Value.DependenceRecordDict; VariableDependenceRecord record = primaryWeightDict[new VariableDependenceRecordKey(primaryKey, secondaryKey)]; List <string> itemStrList = new List <string>(record.ItemDependencDict.Keys); this.secondaryPrimaryVariableListBoxControl.DataSource = itemStrList; this.secondaryPrimaryVariableListBoxControl.SelectedIndex = -1; this.secondarySecondaryVariablGridControl.DataSource = null; } else { throw new Exception("key array length error"); } } }
public static bool TryGetFloatEqual(this SerializableDictionary <string, string> hash, string key, float val) { float currenstring; return(hash.TryGetFloat(key, out currenstring) && currenstring == val); }
private void secondaryGridView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { GridView gridView = sender as GridView; if (e.Column.FieldName.Equals("Weight")) { string cellValue = e.Value.ToString(); int variableSelectIndex = this.secondaryVariableDependenceListBoxControl.SelectedIndex; string variableRelationKey = secondaryVariableDependenceListBoxControl.SelectedItem as string; if (variableSelectIndex >= 0) { string[] keyArray = Regex.Split(variableRelationKey, " --- ", RegexOptions.IgnoreCase); if (keyArray.Length == 2) { string primaryKey = keyArray[0]; string secondaryKey = keyArray[1]; ManualAssignmentPlatformWeightSetMethod manualSet = (ManualAssignmentPlatformWeightSetMethod)this.Strategy.PlatformWeightSetMethod.Value; SerializableDictionary <VariableDependenceRecordKey, VariableDependenceRecord> secondaryWeightDict = manualSet.SecondaryItemWeightSetMethod.Value.DependenceRecordDict; VariableDependenceRecord record = secondaryWeightDict[new VariableDependenceRecordKey(primaryKey, secondaryKey)]; int itemSelectIndex = this.secondaryPrimaryVariableListBoxControl.SelectedIndex; string itemRelationKey = this.secondaryPrimaryVariableListBoxControl.SelectedItem as string; if (itemSelectIndex >= 0) { string secondaryItemStr = gridView.GetRowCellValue(e.RowHandle, gridView.Columns["Item"]) as string; record.ItemDependencDict[itemRelationKey][secondaryItemStr].Weight = (double)e.Value; } } else { throw new Exception("key array length error"); } } } }
public ScanBdMonitorInfo() { CountType = ScanBdMonitoredParamCountType.SameForEachScanBd; SameCount = 4; CountDicOfScanBd = new SerializableDictionary <string, byte>(); }
public static bool TryGetBoolEqual(this SerializableDictionary <string, string> hash, string key, bool val) { bool currenstring; return(hash.TryGetBool(key, out currenstring) && currenstring == val); }
/// <summary> /// Initializes a new instance of the HospitalFacilityStatusType class Default Constructor - Initializes Lists (if applicable) /// </summary> public HospitalFacilityStatusType() { this.commentText = new List <string>(); this.additionalStatus = new SerializableDictionary <string, bool>(); }
public static bool TryGetStringEqual(this SerializableDictionary <string, string> hash, string key, string val) { string currenstring; return(hash.TryGetString(key, out currenstring) && currenstring == val); }