protected virtual void DeserializeAttributes(PersistanceReader ip) { this.m_Flags = (OptionFlag)ip.GetInt32("flags"); this.m_NotoQuery = (NotoQueryType)ip.GetInt32("notoQuery"); this.m_HouseLevel = Math.Min(Math.Max(1, ip.GetInt32("houseLevel")), 5); this.m_Flags |= OptionFlag.HotkeysEnabled; }
protected virtual void SerializeAttributes(PersistanceWriter op) { OptionFlag optionFlag = this.m_Flags | OptionFlag.HotkeysEnabled; op.SetInt32("flags", (int)optionFlag); op.SetInt32("notoQuery", (int)this.m_NotoQuery); op.SetInt32("houseLevel", this.m_HouseLevel); }
protected string GetConvertOptions() { StringBuilder stringBuilder = new StringBuilder(); if (this.PageMargins != null) { stringBuilder.Append(this.PageMargins.ToString()); } PropertyInfo[] properties = base.GetType().GetProperties(); PropertyInfo[] array = properties; for (int i = 0; i < array.Length; i++) { PropertyInfo propertyInfo = array[i]; OptionFlag optionFlag = propertyInfo.GetCustomAttributes(typeof(OptionFlag), true).FirstOrDefault <object>() as OptionFlag; if (optionFlag != null) { object value = propertyInfo.GetValue(this, null); if (value != null) { if (propertyInfo.PropertyType == typeof(Dictionary <string, string>)) { Dictionary <string, string> dictionary = (Dictionary <string, string>)value; foreach (KeyValuePair <string, string> current in dictionary) { stringBuilder.AppendFormat(" {0} {1} {2}", optionFlag.Name, current.Key, current.Value); } } else if (propertyInfo.PropertyType == typeof(bool)) { if ((bool)value) { stringBuilder.AppendFormat(CultureInfo.InvariantCulture, " {0}", new object[] { optionFlag.Name }); } } else { stringBuilder.AppendFormat(CultureInfo.InvariantCulture, " {0} {1}", new object[] { optionFlag.Name, value }); } } } } return(stringBuilder.ToString().Trim()); }
public void Parse(String txt) { if (txt == "N") { Value = OptionFlag.Normal; } else if (txt == "F") { Value = OptionFlag.Power; } else { throw new Exception("KicadLibOptionFlag parse error."); } }
public KicadLibOptionFlag(OptionFlag val) { Value = val; }
public Options() { this.m_Flags = OptionFlag.Default; this.m_NotoQuery = NotoQueryType.On; this.m_HouseLevel = 1; }
public bool this[OptionFlag flag] { get { return((this.m_Flags & flag) == flag); } set { if (value) { this.m_Flags |= flag; } else { this.m_Flags &= ~flag; } string str = (string)null; switch (flag) { case OptionFlag.AlwaysLight: str = "Always light is"; break; case OptionFlag.HotkeysEnabled: str = "Hotkeys are"; break; case OptionFlag.ClearHandsBeforeCast: str = "Clear hands before cast is"; break; case OptionFlag.SmoothWalk: str = "Smooth movement is"; break; case OptionFlag.KeyPassthrough: str = "Key passthrough is"; break; case OptionFlag.MoongateConfirmation: str = "Moongate confirmation is"; break; case OptionFlag.Screenshots: str = "Death screenshots are"; break; case OptionFlag.MiniHealth: str = "Health icons are"; break; case OptionFlag.ContainerGrid: str = "Container grids are"; break; case OptionFlag.AlwaysRun: str = "Always run is"; break; case OptionFlag.IncomingNames: str = "Incoming names are"; break; case OptionFlag.NotorietyHalos: str = "Notoriety halos are"; break; case OptionFlag.QueueTargets: str = "Target queueing is"; break; case OptionFlag.Scavenger: str = "Scavenging is"; break; } if (str == null) { return; } Engine.AddTextMessage(string.Format("{0} now {1}.", (object)str, value ? (object)"enabled" : (object)"disabled")); } }
static extern bool InternetSetOption(IntPtr hInternet, OptionFlag dwOption, IntPtr lpBuffer, int dwBufferLength);