Assembly Informationの取得サンプル
Assembly Informationを取得するサンプル。
AssemblyVersionAttribute以外は、だいたい同じ。
System::Reflection::Assembly * asse = System::Reflection::Assembly::GetExecutingAssembly();
//AssemblyTitleAttribute { //textBoxTitle Object * objs[] = asse->GetCustomAttributes( __typeof(System::Reflection::AssemblyTitleAttribute), false);
if (objs->Length == 1) { System::Reflection::AssemblyTitleAttribute * temp; temp = __try_cast<System::Reflection::AssemblyTitleAttribute*>( objs[0] ); textBoxTitle->Text = temp->Title; } else { textBoxTitle->Text = ""; } }
//AssemblyDescriptionAttribute { //textBoxDescription Object * objs[] = asse->GetCustomAttributes( __typeof(System::Reflection::AssemblyDescriptionAttribute), false);
if (objs->Length == 1) { System::Reflection::AssemblyDescriptionAttribute * temp; temp = __try_cast<System::Reflection::AssemblyDescriptionAttribute*>( objs[0] ); textBoxDescription->Text = temp->Description; } else { textBoxDescription->Text = ""; } }
//AssemblyConfigurationAttribute { //textBoxConfiguration Object * objs[] = asse->GetCustomAttributes( __typeof(System::Reflection::AssemblyConfigurationAttribute), false);
if (objs->Length == 1) { System::Reflection::AssemblyConfigurationAttribute * temp; temp = __try_cast<System::Reflection::AssemblyConfigurationAttribute*>( objs[0] ); textBoxConfiguration->Text = temp->Configuration; } else { textBoxConfiguration->Text = ""; } }
//AssemblyCompanyAttribute { //textBoxCompany Object * objs[] = asse->GetCustomAttributes( __typeof(System::Reflection::AssemblyCompanyAttribute), false);
if (objs->Length == 1) { System::Reflection::AssemblyCompanyAttribute * temp; temp = __try_cast<System::Reflection::AssemblyCompanyAttribute*>( objs[0] ); textBoxCompany->Text = temp->Company; } else { textBoxCompany->Text = ""; } }
//AssemblyProductAttribute { //textBoxProduct Object * objs[] = asse->GetCustomAttributes( __typeof(System::Reflection::AssemblyProductAttribute), false);
if (objs->Length == 1) { System::Reflection::AssemblyProductAttribute * temp; temp = __try_cast<System::Reflection::AssemblyProductAttribute*>( objs[0] ); textBoxProduct->Text = temp->Product; } else { textBoxProduct->Text = ""; } }
//AssemblyCopyrightAttribute { //textBoxCopyright Object * objs[] = asse->GetCustomAttributes( __typeof(System::Reflection::AssemblyCopyrightAttribute), false);
if (objs->Length == 1) { System::Reflection::AssemblyCopyrightAttribute * temp; temp = __try_cast<System::Reflection::AssemblyCopyrightAttribute*>( objs[0] ); textBoxCopyright->Text = temp->Copyright; } else { textBoxCopyright->Text = ""; } }
//AssemblyTrademarkAttribute { //textBoxTrademark Object * objs[] = asse->GetCustomAttributes( __typeof(System::Reflection::AssemblyTrademarkAttribute), false);
if (objs->Length == 1) { System::Reflection::AssemblyTrademarkAttribute * temp; temp = __try_cast<System::Reflection::AssemblyTrademarkAttribute*>( objs[0] ); textBoxTrademark->Text = temp->Trademark; } else { textBoxTrademark->Text = ""; } }
//AssemblyCultureAttribute { //textBoxCulture Object * objs[] = asse->GetCustomAttributes( __typeof(System::Reflection::AssemblyCultureAttribute), false);
if (objs->Length == 1) { System::Reflection::AssemblyCultureAttribute * temp; temp = __try_cast<System::Reflection::AssemblyCultureAttribute*>( objs[0] ); textBoxCulture->Text = temp->Culture; } else { textBoxCulture->Text = ""; } }
//AssemblyVersionAttribute { System::Reflection::AssemblyName * name = asse->GetName(); textBoxVersion->Text = name->Version->ToString(); }