コード例 #1
0
        /// <summary>
        /// 更新版本信息
        /// </summary>
        /// <param name="degree"></param>
        /// <param name="newProductName"></param>
        /// <param name="newCopyRight"></param>
        /// <param name="newAuthor"></param>
        /// <param name="newDescription"></param>
        /// <param name="newContactInfo"></param>
        public void UpdateVersion(VersionMananger.UpdateDegree degree, string newProductName = "",
                                  string newCopyRight   = "", string newAuthor      = "",
                                  string newDescription = "", string newContactInfo = "")
        {
            //需要更新版本
            if (this.description != null &&
                !this.description.Equals(newDescription))
            {
                //将当前的关于信息加入到历史信息集合中
                VersionAbstract a = new VersionAbstract();

                a.Version     = this.version.GetVersionString();
                a.Description = this.description;

                this.historyInfoCollection.Add(a);

                //更新版本号
                this.version.UpdateVersion(degree);

                //更新程序描述信息
                if (!newProductName.Equals(""))
                {
                    this.productName = newProductName;
                }
                if (!newCopyRight.Equals(""))
                {
                    this.copyright = newCopyRight;
                }
                if (!newAuthor.Equals(""))
                {
                    this.author = newAuthor;
                }
                if (!newDescription.Equals(""))
                {
                    this.description = newDescription;
                }
                if (!newContactInfo.Equals(""))
                {
                    this.contactInfo = newContactInfo;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 从指定路径中读取内容,设置本实例的各个字段
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public bool Load(string path)
        {
            string[] strs = File_Operate.LoadFromHiddenTextFile(path, Encoding.Default);

            bool res = false;

            if (strs != null)
            {
                string[] ss = strs[0].Split('$');

                string[] s = ss[0].Split('#');

                if (s.Length >= 6)
                {
                    this.author      = s[0];
                    this.contactInfo = s[1];
                    this.copyright   = s[2];
                    this.description = s[3];
                    this.productName = s[4];
                    res = VersionMananger.TryParse(s[5], '*', out this.version);
                }

                for (int i = 1; i < ss.Length; i++)
                {
                    s = ss[i].Split('*');

                    if (s.Length >= 2)
                    {
                        VersionAbstract a = new VersionAbstract();

                        a.Version     = s[0];
                        a.Description = s[1];

                        this.historyInfoCollection.Add(a);
                    }
                }
            }

            return(res);
        }