using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using com.andoutomo.kybernetes.view; using com.andoutomo.kybernetes.data.accessor; using com.andoutomo.kybernetes.control; using System.Reflection; namespace WindowsFormsApplication1 { static class Program { /// /// アプリケーションのメイン エントリ ポイントです。 /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); setAppInfoContainer(); KybernetesLogger.CurrentLogMode = SettingDataAccessor.getObject.getLogMode(); KybernetesLogger.Log.debug("------------run version " + AppInfoContainer.VersionNo + "----------------"); //バージョン確認とアップグレード int version = AppInfoContainer.Version; int dbVersion = TaskDataAccessor.getObject.getDBVersion(); while (version > dbVersion) { upgradeApplication(dbVersion); dbVersion = TaskDataAccessor.getObject.getDBVersion(); } BaseForm form = new BaseForm(); Application.Run(CmdDispatcher.getDispatcher(form).getForm()); } static void setAppInfoContainer() { //AssemblyTitleの取得 AssemblyTitleAttribute asmttl = (System.Reflection.AssemblyTitleAttribute) Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute)); AppInfoContainer.Title = asmttl.Title; //AssemblyDescriptionの取得 AssemblyDescriptionAttribute asmdc = (System.Reflection.AssemblyDescriptionAttribute) Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyDescriptionAttribute)); AppInfoContainer.Description = asmdc.Description; //AssemblyCopyrightの取得 AssemblyCopyrightAttribute asmcpy = (System.Reflection.AssemblyCopyrightAttribute) Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute)); AppInfoContainer.CopyRight = asmcpy.Copyright; //自分自身のAssemblyを取得 System.Version ver = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; AppInfoContainer.VersionNo = ver.ToString(); } static void upgradeApplication(int dbVersion) { TaskDataAccessor.getObject.updateProgram(dbVersion); dbVersion++; TaskDataAccessor.getObject.setDBVersion(dbVersion); } } }