public void Start() { Interlocked.Increment(ref Jobs._instancesOfParent); lock (this.jobList.SyncRoot) { if (this.jobList.Count == 0) { HiConfiguration config = HiConfiguration.GetConfig(); XmlNode configSection = config.GetConfigSection("Hishop/Jobs"); bool flag = true; XmlAttribute xmlAttribute = configSection.Attributes["singleThread"]; if (xmlAttribute != null && !string.IsNullOrEmpty(xmlAttribute.Value) && string.Compare(xmlAttribute.Value, "false", true, CultureInfo.InvariantCulture) == 0) { flag = false; } XmlAttribute xmlAttribute2 = configSection.Attributes["minutes"]; if (xmlAttribute2 != null && !string.IsNullOrEmpty(xmlAttribute2.Value)) { int num = 1; if (int.TryParse(xmlAttribute2.Value, out num)) { this.Interval = num * 60000; } } foreach (XmlNode childNode in configSection.ChildNodes) { if (configSection.NodeType != XmlNodeType.Comment && childNode.NodeType != XmlNodeType.Comment) { XmlAttribute xmlAttribute3 = childNode.Attributes["type"]; XmlAttribute xmlAttribute4 = childNode.Attributes["name"]; Type type = Type.GetType(xmlAttribute3.Value); if (type != (Type)null && !this.jobList.Contains(xmlAttribute4.Value)) { Job job = new Job(type, childNode); if (flag && job.SingleThreaded) { job.InitializeTimer(); } else { this.jobList[xmlAttribute4.Value] = job; } } } } if (this.jobList.Count > 0) { this.singleTimer = new Timer(this.call_back, null, this.Interval, this.Interval); } } } }
public void Start() { Interlocked.Increment(ref _instancesOfParent); lock (this.jobList.SyncRoot) { if (this.jobList.Count == 0) { XmlNode configSection = HiConfiguration.GetConfig().GetConfigSection("Hishop/Jobs"); bool flag = true; XmlAttribute attribute = configSection.Attributes["singleThread"]; if (((attribute != null) && !string.IsNullOrEmpty(attribute.Value)) && (string.Compare(attribute.Value, "false", true, CultureInfo.InvariantCulture) == 0)) { flag = false; } XmlAttribute attribute2 = configSection.Attributes["minutes"]; if ((attribute2 != null) && !string.IsNullOrEmpty(attribute2.Value)) { int result = 1; if (int.TryParse(attribute2.Value, out result)) { this.Interval = result * 0xea60; } } foreach (XmlNode node2 in configSection.ChildNodes) { if ((configSection.NodeType != XmlNodeType.Comment) && (node2.NodeType != XmlNodeType.Comment)) { XmlAttribute attribute3 = node2.Attributes["type"]; XmlAttribute attribute4 = node2.Attributes["name"]; Type ijob = Type.GetType(attribute3.Value); if ((ijob != null) && !this.jobList.Contains(attribute4.Value)) { Job job = new Job(ijob, node2); if (flag && job.SingleThreaded) { job.InitializeTimer(); } else { this.jobList[attribute4.Value] = job; } } } } if (this.jobList.Count > 0) { this.singleTimer = new Timer(new TimerCallback(this.call_back), null, this.Interval, this.Interval); } } } }