//**************************************************************************************************
//
// CommonHelpers satellite library | Author: Sergei Y.Kitáev
//
// SHELL LINK PROPERTIES IMPLEMENTATION (FOR "$SysUtils" CODE-PACKAGE):
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#pragma once

namespace CommonHelpers {

//**************************************************************************************************
ref class SysHelpers_ShellLinkProperties: ISysHelpers_ShellLinkProperties {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// PUBLIC MEMEBERS OF "ISysHelpers_ShellLinkProperties" INTERFACE (WITHOUT XML-COMMENTS):

   /// <exception cref="ArgumentNullException" />
   virtual property String^ Arguments {
      String^ get() = ISysHelpers_ShellLinkProperties::Arguments::get;
      void set(String^ value) = ISysHelpers_ShellLinkProperties::Arguments::set; }
   /// <exception cref="ArgumentNullException" />
   virtual property String^ Description {
      String^ get() = ISysHelpers_ShellLinkProperties::Description::get;
      void set(String^ value) = ISysHelpers_ShellLinkProperties::Description::set; }
   virtual property UInt16 Hotkey {
      UInt16 get() = ISysHelpers_ShellLinkProperties::Hotkey::get;
      void set(UInt16 value) = ISysHelpers_ShellLinkProperties::Hotkey::set; }
   /// <exception cref="ArgumentNullException" />
   virtual property String^ Path {
      String^ get() = ISysHelpers_ShellLinkProperties::Path::get;
      void set(String^ value) = ISysHelpers_ShellLinkProperties::Path::set; }
   /// <exception cref="ArgumentNullException" />
   virtual property String^ DisplayName {
      String^ get() = ISysHelpers_ShellLinkProperties::DisplayName::get;
      void set(String^ value) = ISysHelpers_ShellLinkProperties::DisplayName::set; }
   virtual property Int32 ShowCmd {
      Int32 get() = ISysHelpers_ShellLinkProperties::ShowCmd::get;
      void set(Int32 value) = ISysHelpers_ShellLinkProperties::ShowCmd::set; }
   /// <exception cref="ArgumentNullException" />
   virtual property String^ WorkingDirectory {
      String^ get() = ISysHelpers_ShellLinkProperties::WorkingDirectory::get;
      void set(String^ value) = ISysHelpers_ShellLinkProperties::WorkingDirectory::set; }

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

   /// <exception cref="ArgumentNullException" />
   virtual String^ GetIconLocation([HOut] int% index);
   /// <exception cref="ArgumentNullException" />
   virtual void SetIconLocation(String^ path,int index);

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

   /// <exception cref="ArgumentNullException" />
   virtual void Load(String^ filePath,[HOut] HShellLinkSpecialProps^% specialProps);
   /// <exception cref="ArgumentNullException" />
   virtual void Save(String^ filePath,[HOptional] HShellLinkSpecialProps^ specialProps);

public:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// PUBLIC CONSTRUCTOR:
/// <exception cref="PlatformNotSupportedException" />
/// <exception cref="HOperationFailedException" />
   SysHelpers_ShellLinkProperties();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "IDisposable.Dispose" AS C++/CLI DESTRUCTOR:
   ~SysHelpers_ShellLinkProperties();

//==================================================================================================
protected:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "Object.Finalizer" METHOD IN C++/CLI NOTATION:
   !SysHelpers_ShellLinkProperties();

//==================================================================================================
private:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// PRIVATE PROPERTIES:

   property IShellLink* PSLInterface
      { IShellLink* get() { return _PSLInterface_; } }
   property IPersistFile* PPersistFileInterface
      { IPersistFile* get() { return _PPersistFileInterface_; } }
   property IShellLinkDataList* PSLDataListInterface
      { IShellLinkDataList* get() { return _PSLDataListInterface_; } }

private:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// PRIVATE METHODS:

/// <exception cref="ArgumentNullException" />
/// <exception cref="HOperationFailedException" />
   static String^ FileNameToAbsolute(String^ filePath);

/// <exception cref="ArgumentNullException" />
   static HOperationFailedException^ CreateOpFailedException_CantExtractSLProperty(
      String^ propertyName, String^ errorMessage );
/// <exception cref="ArgumentNullException" />
   static HOperationFailedException^ CreateOpFailedException_CantSetSLProperty(
      String^ propertyName, String^ errorMessage );

/// <exception cref="ArgumentNullException" />
   static HOperationFailedException^ CreateOpFailedException_CantExtractSLProperty(
   String^ propertyName, String^ errorMessageFmt, ... array<Object^>^ parameters );
/// <exception cref="ArgumentNullException" />
   static HOperationFailedException^ CreateOpFailedException_CantSetSLProperty(
   String^ propertyName, String^ errorMessageFmt, ... array<Object^>^ parameters );

/// <exception cref="ArgumentNullException" />
   static HOperationFailedException^ CreateOpFailedException_CantExtractSLProperty(
      String^ propertyName, HRESULT hResult );
/// <exception cref="ArgumentNullException" />
   static HOperationFailedException^ CreateOpFailedException_CantSetSLProperty(
      String^ propertyName, HRESULT hResult );

private:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// PRIVATE STATIC CONSTRUCTOR:
   static SysHelpers_ShellLinkProperties();

private:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// PRIVATE FIELDS:
   bool
      _FinalizerAccessed_;
   IShellLink
      *_PSLInterface_;
   IPersistFile
      *_PPersistFileInterface_;
   IShellLinkDataList
      *_PSLDataListInterface_;

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~w
}; // SysHelpers_ShellLinkProperties
//**************************************************************************************************

} // CommonHelpers
