public override void Load()
        {
            Assembly cAssembly = Assembly.GetExecutingAssembly();

            __cRuleItems = RulePropertyAttribute.GetRules(cAssembly);

            string sLocation   = cAssembly.Location;
            string sPath       = Path.GetDirectoryName(sLocation);
            string sTargetName = Path.GetFileNameWithoutExtension(sLocation) + ".set";
            string sFileName   = Path.Combine(sPath, sTargetName);

            string[] sDatas = File.ReadAllLines(sFileName, Encoding.UTF8);

            JObject cExchange = JsonConvert.DeserializeObject <JObject>(sDatas[0]);

            this.FullName   = cExchange["FullName"].Value <string>();
            this.ShortName  = cExchange["ShortName"].Value <string>();
            this.UpdateTime = cExchange["UpdateTime"].Value <DateTime>();

            this.Products = JsonConvert.DeserializeObject <Dictionary <string, Product> >(sDatas[1]);

            //讀取基礎商品屬性表
            this.BasePropertys = CreateProductPropertyList(sDatas[2]);

            //讀取使用者自訂商品屬性表
            this.CustomPropertys = new Dictionary <string, ProductPropertyList>(16);
            Dictionary <string, JToken> sCustoms = JsonConvert.DeserializeObject <Dictionary <string, JToken> >(sDatas[3]);

            foreach (string sDataSource in sCustoms.Keys)
            {
                JToken cToken = sCustoms[sDataSource];
                ProductPropertyList cPropertyList = CreateProductPropertyList(cToken.ToString(Formatting.None));
                this.CustomPropertys.Add(sDataSource, cPropertyList);
            }
        }
Beispiel #2
0
		/// <summary>
		///   讀取下單服務的參數
		/// </summary>
		public override void Load() {
			if (__cRuleItems == null) {
				Assembly cAssembly = Assembly.GetExecutingAssembly();
				__cRuleItems = RulePropertyAttribute.GetRules(cAssembly);
			}
		}