示例#1
0
        public GifskiInterop()
        {
            #region Get Gifski version

            var info = new FileInfo(UserSettings.All.GifskiLocation);
            info.Refresh();

            //I really need another way to differentiate gifski versions.
            switch (info.Length)
            {
            case 524_752:
                Version = new Version(1, 2, 0);
                break;

            case 502_720:
                Version = new Version(0, 10, 2);
                break;

            case 502_208:
                Version = new Version(0, 9, 3);
                break;

            default:
                Version = new Version(0, 0);
                break;
            }

            #endregion

            #region Load functions

            _new         = (NewDelegate)FunctionLoader.LoadFunction <NewDelegate>(UserSettings.All.GifskiLocation, "gifski_new");
            _addPngFrame = (AddPngFrameDelegate)FunctionLoader.LoadFunction <AddPngFrameDelegate>(UserSettings.All.GifskiLocation, "gifski_add_frame_png_file");
            //_addRgbaFrame = (AddRgbaFrameDelegate)FunctionLoader.LoadFunction<AddRgbaFrameDelegate>(UserSettings.All.GifskiLocation, "gifski_add_frame_rgba");

            if (Version.Major == 0 && Version.Minor < 10)
            {
                _addRgbFrame = (AddRgbFrameDelegate)FunctionLoader.LoadFunction <AddRgbFrameDelegate>(UserSettings.All.GifskiLocation, "gifski_add_frame_rgb");
            }
            else
            {
                _addRgb2Frame = (AddRgb2FrameDelegate)FunctionLoader.LoadFunction <AddRgb2FrameDelegate>(UserSettings.All.GifskiLocation, "gifski_add_frame_rgb");
            }

            if (Version.Major == 0 && Version.Minor < 9)
            {
                //Older versions of the library.
                _endAddingFrames = (EndAddingFramesDelegate)FunctionLoader.LoadFunction <EndAddingFramesDelegate>(UserSettings.All.GifskiLocation, "gifski_end_adding_frames");
                _write           = (WriteDelegate)FunctionLoader.LoadFunction <WriteDelegate>(UserSettings.All.GifskiLocation, "gifski_write");
                _drop            = (DropDelegate)FunctionLoader.LoadFunction <DropDelegate>(UserSettings.All.GifskiLocation, "gifski_drop");
            }
            else
            {
                //Newer versions.
                _setFileOutput = (SetFileOutputDelegate)FunctionLoader.LoadFunction <SetFileOutputDelegate>(UserSettings.All.GifskiLocation, "gifski_set_file_output");
                _finish        = (FinishDelegate)FunctionLoader.LoadFunction <FinishDelegate>(UserSettings.All.GifskiLocation, "gifski_finish");
            }

            #endregion
        }
示例#2
0
        public GifskiInterop()
        {
            #region Get Gifski version

            var info = new FileInfo(UserSettings.All.GifskiLocation);
            info.Refresh();

            Version = info.Length == 502_208 ? new Version(0, 9, 3) : new Version(0, 0);

            #endregion

            #region Load functions

            _new          = (NewDelegate)FunctionLoader.LoadFunction <NewDelegate>(UserSettings.All.GifskiLocation, "gifski_new");
            _addPngFrame  = (AddPngFrameDelegate)FunctionLoader.LoadFunction <AddPngFrameDelegate>(UserSettings.All.GifskiLocation, "gifski_add_frame_png_file");
            _addRgbaFrame = (AddRgbaFrameDelegate)FunctionLoader.LoadFunction <AddRgbaFrameDelegate>(UserSettings.All.GifskiLocation, "gifski_add_frame_rgba");

            if (Version.Major == 0 && Version.Minor < 9)
            {
                //Older versions of the library.
                _endAddingFrames = (EndAddingFramesDelegate)FunctionLoader.LoadFunction <EndAddingFramesDelegate>(UserSettings.All.GifskiLocation, "gifski_end_adding_frames");
                _write           = (WriteDelegate)FunctionLoader.LoadFunction <WriteDelegate>(UserSettings.All.GifskiLocation, "gifski_write");
                _drop            = (DropDelegate)FunctionLoader.LoadFunction <DropDelegate>(UserSettings.All.GifskiLocation, "gifski_drop");
            }
            else
            {
                //Newer versions.
                _setFileOutput = (SetFileOutputDelegate)FunctionLoader.LoadFunction <SetFileOutputDelegate>(UserSettings.All.GifskiLocation, "gifski_set_file_output");
                _finish        = (FinishDelegate)FunctionLoader.LoadFunction <FinishDelegate>(UserSettings.All.GifskiLocation, "gifski_finish");
            }

            #endregion
        }
 public DragAndDrop(PickDelegate pickDelegate, DropDelegate dropDelegate)
 {
     state             = State.None;
     offset            = Vector2.zero;
     this.dropDelegate = dropDelegate;
     this.pickDelegate = pickDelegate;
 }
示例#4
0
 internal static void Bind()
 {
     _openDelegate  = Library.GetProcAddress <OpenDelegate>("mdbx_dbi_open") as OpenDelegate;
     _closeDelegate = Library.GetProcAddress <CloseDelegate>("mdbx_dbi_close") as CloseDelegate;
     _putDelegate   = Library.GetProcAddress <PutDelegate>("mdbx_put") as PutDelegate;
     _getDelegate   = Library.GetProcAddress <GetDelegate>("mdbx_get") as GetDelegate;
     _delDelegate   = Library.GetProcAddress <DelDelegate>("mdbx_del") as DelDelegate;
     _dropDelegate  = Library.GetProcAddress <DropDelegate>("mdbx_drop") as DropDelegate;
 }
示例#5
0
        static Win32DnD()
        {
            // Required for all other OLE functions to work
            Win32OleInitialize(IntPtr.Zero);

            // We reuse those
            DragDropEventArgs     = new DragEventArgs(new DataObject(DataFormats.FileDrop, new string[0]), 0, 0, 0, DragDropEffects.None, DragDropEffects.None);
            DragFeedbackEventArgs = new GiveFeedbackEventArgs(DragDropEffects.None, true);
            DragContinueEventArgs = new QueryContinueDragEventArgs(0, false, DragAction.Continue);
            DragFormats           = new ArrayList();
            DragFormatArray       = new FORMATETC[0];
            DragMediums           = new ArrayList();

            // Set up delegates
            // IDataObject
            DOQueryInterface      = new QueryInterfaceDelegate(ComIDataObject.QueryInterface);
            DOAddRef              = new AddRefDelegate(ComIDataObject.AddRef);
            DORelease             = new ReleaseDelegate(ComIDataObject.Release);
            GetData               = new GetDataDelegate(ComIDataObject.GetData);
            GetDataHere           = new GetDataHereDelegate(ComIDataObject.GetDataHere);
            QueryGetData          = new QueryGetDataDelegate(ComIDataObject.QueryGetData);
            GetCanonicalFormatEtc = new GetCanonicalFormatEtcDelegate(ComIDataObject.GetCanonicalFormatEtc);
            SetData               = new SetDataDelegate(ComIDataObject.SetData);
            EnumFormatEtc         = new EnumFormatEtcDelegate(ComIDataObject.EnumFormatEtc);
            DAdvise               = new DAdviseDelegate(ComIDataObject.DAdvise);
            DUnadvise             = new DUnadviseDelegate(ComIDataObject.DUnadvise);
            EnumDAdvise           = new EnumDAdviseDelegate(ComIDataObject.EnumDAdvise);

            // IDropSource
            DSQueryInterface  = new QueryInterfaceDelegate(ComIDropSource.QueryInterface);
            DSAddRef          = new AddRefDelegate(ComIDropSource.AddRef);
            DSRelease         = new ReleaseDelegate(ComIDropSource.Release);
            QueryContinueDrag = new QueryContinueDragDelegate(ComIDropSource.QueryContinueDrag);
            GiveFeedback      = new GiveFeedbackDelegate(ComIDropSource.GiveFeedback);

            // IDropTarget
            DTQueryInterface = new QueryInterfaceDelegate(ComIDropTarget.QueryInterface);
            DTAddRef         = new AddRefDelegate(ComIDropTarget.AddRef);
            DTRelease        = new ReleaseDelegate(ComIDropTarget.Release);
            DragEnter        = new DragEnterDelegate(ComIDropTarget.DragEnter);
            DragOver         = new DragOverDelegate(ComIDropTarget.DragOver);
            DragLeave        = new DragLeaveDelegate(ComIDropTarget.DragLeave);
            Drop             = new DropDelegate(ComIDropTarget.Drop);
        }
示例#6
0
    public override void HandListener(
        SteamVR_Behaviour_Pose m_Pose,
        DropDelegate Drop,
        GrabDelegate Pickup
        )
    {
        // Down
        if (m_GrabAction.GetStateDown(m_Pose.inputSource))
        {
            // print(m_Pose.inputSource + " Trigger down");
            if (m_InContact)
            {
                m_InContact = Drop(m_InContact);
            }
            else
            {
                m_InContact = Pickup();
            }
        }

        // Use track pad right and left to change image seen
        // Use menu button or track pad north to see answer
        if (m_InContact)
        {
            if (m_NextAction.GetStateDown(m_Pose.inputSource))
            {
                ChangeCard(-1);
            }
            if (m_PrevAction.GetStateDown(m_Pose.inputSource))
            {
                ChangeCard(1);
            }
            // answer reveal
            if (m_RevealAction.GetStateDown(m_Pose.inputSource))
            {
                ShowAnswer();
            }
            if (m_RevealAction.GetStateUp(m_Pose.inputSource))
            {
                ShowQuestion();
            }
        }
    }
示例#7
0
 public abstract void HandListener(
     SteamVR_Behaviour_Pose p,
     DropDelegate d,
     GrabDelegate g
     );
 public SMSceneListDropTarget(DropDelegate dropHandler)
 {
     this.dropHandler = dropHandler;
 }
示例#9
0
文件: Win32DnD.cs 项目: nlhepler/mono
		static Win32DnD()
		{
			// Required for all other OLE functions to work
			Win32OleInitialize(IntPtr.Zero);

			// We reuse those
			DragDropEventArgs = new DragEventArgs(new DataObject(DataFormats.FileDrop, new string[0]), 0, 0, 0, DragDropEffects.None, DragDropEffects.None);
			DragFeedbackEventArgs = new GiveFeedbackEventArgs(DragDropEffects.None, true);
			DragContinueEventArgs = new QueryContinueDragEventArgs(0, false, DragAction.Continue);
			DragFormats = new ArrayList();
			DragFormatArray = new FORMATETC[0];
			DragMediums = new ArrayList();

			// Set up delegates
			// IDataObject
			DOQueryInterface = new QueryInterfaceDelegate(ComIDataObject.QueryInterface);
			DOAddRef = new AddRefDelegate(ComIDataObject.AddRef);
			DORelease = new ReleaseDelegate(ComIDataObject.Release);
			GetData = new GetDataDelegate(ComIDataObject.GetData);
			GetDataHere = new GetDataHereDelegate(ComIDataObject.GetDataHere);
			QueryGetData = new QueryGetDataDelegate(ComIDataObject.QueryGetData);
			GetCanonicalFormatEtc = new GetCanonicalFormatEtcDelegate(ComIDataObject.GetCanonicalFormatEtc);
			SetData = new SetDataDelegate(ComIDataObject.SetData);
			EnumFormatEtc = new EnumFormatEtcDelegate(ComIDataObject.EnumFormatEtc);
			DAdvise = new DAdviseDelegate(ComIDataObject.DAdvise);
			DUnadvise = new DUnadviseDelegate(ComIDataObject.DUnadvise);
			EnumDAdvise = new EnumDAdviseDelegate(ComIDataObject.EnumDAdvise);

			// IDropSource
			DSQueryInterface = new QueryInterfaceDelegate(ComIDropSource.QueryInterface);
			DSAddRef = new AddRefDelegate(ComIDropSource.AddRef);
			DSRelease = new ReleaseDelegate(ComIDropSource.Release);
			QueryContinueDrag = new QueryContinueDragDelegate(ComIDropSource.QueryContinueDrag);
			GiveFeedback = new GiveFeedbackDelegate(ComIDropSource.GiveFeedback);

			// IDropTarget
			DTQueryInterface = new QueryInterfaceDelegate(ComIDropTarget.QueryInterface);
			DTAddRef = new AddRefDelegate(ComIDropTarget.AddRef);
			DTRelease = new ReleaseDelegate(ComIDropTarget.Release);
			DragEnter = new DragEnterDelegate(ComIDropTarget.DragEnter);
			DragOver = new DragOverDelegate(ComIDropTarget.DragOver);
			DragLeave = new DragLeaveDelegate(ComIDropTarget.DragLeave);
			Drop = new DropDelegate(ComIDropTarget.Drop);
		}