Пример #1
0
        public void Save(string productName)
        {
            this.Info.Name               = productName;
            this.Info.Modify             = DateTime.Now;
            FilePath                     = Path + productName + "\\";
            AppConfig.CurrentProductName = productName;
            foreach (var item in this.GetType().GetProperties())
            {
                if (typeof(ProductBase).IsAssignableFrom(item.PropertyType))
                {
                    ProductBase       pro       = item.GetValue(this) as ProductBase;
                    AppLevelAttribute attribute = item.GetCustomAttribute <AppLevelAttribute>();
                    if (attribute != null)
                    {
                        string filename = AppDomain.CurrentDomain.BaseDirectory + "Config\\" + item.Name + ".config";
                        pro.Save(filename + item.Name);
                    }
                    else
                    {
                        pro.Save(FilePath + item.Name);
                    }
                }
            }

            if (SaveEvent != null)
            {
                SaveEvent(this, EventArgs.Empty);
            }

            AppConfig.Save(Inst.Path + "app.config");
        }
Пример #2
0
        public void Save(string productName)
        {
            this.Info.Name   = productName;
            this.Info.Modify = DateTime.Now;
            string filePath = Path + productName + "\\";

            foreach (var item in this.GetType().GetProperties())
            {
                if (typeof(ProductBase).IsAssignableFrom(item.PropertyType))
                {
                    ProductBase pro = item.GetValue(this) as ProductBase;
                    pro.Save(filePath + item.Name);
                }
            }

            AppConfig.CurrentProductName = productName;
            AppConfig.Save(Inst.Path + "app.config");

            if (SaveEvent != null)
            {
                SaveEvent(this, EventArgs.Empty);
            }
        }