Example #1
0
 public virtual void PostNewItem
 (
     TSF dwFlags,
     IShellItem psiDestinationFolder,
     string pszNewName,
     string pszTemplateName,
     FILE_ATTRIBUTE dwFileAttributes,
     int hrNew,
     IShellItem psiNewItem
 )
 {
     this.fileOperation.OnPostNew?.Invoke
     (
         this.fileOperation,
         new PostNewEventArgs
         (
             (TransferSourceFlags)dwFlags,
             psiDestinationFolder.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING),
             pszNewName,
             pszTemplateName,
             (FileAttributes)dwFileAttributes,
             psiNewItem.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING),
             hrNew
         )
     );
 }
Example #2
0
 public TextBoxHelper(TSF _tsf, IntPtr _hWnd)
 {
     tsf = _tsf;
     tsf.Active();
     tsf.CreateContext(_hWnd);
     tsf.PushContext();
 }
Example #3
0
        /*********
        ** Public methods
        *********/
        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        public override void Entry(IModHelper helper)
        {
            monitor = this.Monitor;
            _helper = helper;

            RegCommand(helper);

            helper.Events.GameLoop.UpdateTicked += Overrides.HandleMouseEvents;

            tsf = new TSF();
            tsf.AssociateFocus(Game1.game1.Window.Handle);

            textbox_h = new TextBoxHelper(tsf, Game1.game1.Window.Handle);

            HarmonyInstance harmony = HarmonyInstance.Create(base.ModManifest.UniqueID);

            MethodInfo m_HookProc = typeof(KeyboardInput).GetMethod("HookProc", BindingFlags.NonPublic | BindingFlags.Static);

            harmony.Patch(m_HookProc, new HarmonyMethod(typeof(Overrides), "KeyboardInput_HookProc"));

            MethodInfo m_selected = typeof(KeyboardDispatcher).GetMethod("set_Subscriber", BindingFlags.Public | BindingFlags.Instance);

            harmony.Patch(m_selected, null, new HarmonyMethod(typeof(Overrides), "Subscriber_Set"));

            MethodInfo m_text = typeof(TextBox).GetMethod("set_Text", BindingFlags.Public | BindingFlags.Instance);

            harmony.Patch(m_text, null, new HarmonyMethod(typeof(Overrides), "TextBox_Text"));

            MethodInfo m_draw = typeof(TextBox).GetMethod("Draw", BindingFlags.Public | BindingFlags.Instance);

            harmony.Patch(m_draw, new HarmonyMethod(typeof(Overrides), "Draw"));

            MethodInfo m_draw2 = typeof(ChatTextBox).GetMethod("Draw", BindingFlags.Public | BindingFlags.Instance);

            harmony.Patch(m_draw2, new HarmonyMethod(typeof(Overrides), "Draw"));

            MethodInfo m_emoji = typeof(ChatTextBox).GetMethod("receiveEmoji", BindingFlags.Public | BindingFlags.Instance);

            harmony.Patch(m_emoji, new HarmonyMethod(typeof(Overrides), "receiveEmoji"));


            FieldInfo  host   = typeof(Game).GetField("host", BindingFlags.NonPublic | BindingFlags.Instance);
            Type       type   = host.GetValue(Game1.game1).GetType();
            MethodInfo m_idle = type.GetMethod("ApplicationIdle", BindingFlags.NonPublic | BindingFlags.Instance);

            harmony.Patch(m_idle, null, new HarmonyMethod(typeof(ModEntry), "HandleMsgFirst"));

            //compatible with ChatCommands
            if (Helper.ModRegistry.Get("cat.chatcommands") != null)
            {
                monitor.Log("Compatible with ChatCommands", LogLevel.Info);
                Compatibility.PatchChatCommands(monitor, harmony);
            }
        }
Example #4
0
 public virtual void PreDeleteItem(TSF dwFlags, IShellItem psiItem)
 {
     this.fileOperation.OnPreDelete?.Invoke
     (
         this.fileOperation,
         new PreDeleteEventArgs
         (
             (TransferSourceFlags)dwFlags,
             psiItem.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING)
         )
     );
 }
Example #5
0
 public virtual void PreRenameItem(TSF dwFlags, IShellItem psiItem, string pszNewName)
 {
     this.fileOperation.OnPreRename?.Invoke
     (
         this.fileOperation,
         new PreRenameEventArgs
         (
             (TransferSourceFlags)dwFlags,
             psiItem.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING),
             pszNewName
         )
     );
 }
        public static List<Mapping> createNewMappings(TSF.UmlToolingFramework.Wrappers.EA.Attribute attribute,string basepath,ElementWrapper targetRootElement)
        {
            List<Mapping> returnedMappings = new List<Mapping>();
            //connectors from owned attributes
            foreach (ConnectorWrapper mappedConnector in attribute.relationships.OfType<ConnectorWrapper>())
            {
                if (! mappedConnector.taggedValues.Any( x => x.name == mappingSourcePathName && x.tagValue.ToString() != basepath))
                {
                    //get the target base path
                    ConnectorMapping connectorMapping;
                    var targetTV = mappedConnector.taggedValues.FirstOrDefault(x => x.name == mappingTargetPathName);
                    string targetBasePath = string.Empty;
                    if (targetTV != null) targetBasePath = targetTV.tagValue.ToString();
                    if (! string.IsNullOrEmpty(targetBasePath))
                    {
                        connectorMapping = new ConnectorMapping(mappedConnector,basepath,targetBasePath);
                    }
                    else
                    {
                        connectorMapping = new ConnectorMapping(mappedConnector,basepath,targetRootElement);
                    }
                    returnedMappings.Add(connectorMapping);
                }
            }
            //tagged value references from owned attributes
            foreach (TaggedValue mappedTaggedValue in attribute.taggedValues.Where(x => x.tagValue is Element) )
            {
                string mappingSourcePath = getValueForKey(mappingSourcePathName,mappedTaggedValue.comment);
                string targetBasePath = getValueForKey(mappingTargetPathName,mappedTaggedValue.comment);

                //if not filled in or corresponds to the attributeBasePath
                if (string.IsNullOrEmpty(mappingSourcePath) || mappingSourcePath == basepath)
                {
                    TaggedValueMapping tagMapping;
                    if (! string.IsNullOrEmpty(targetBasePath))
                    {
                        tagMapping = new TaggedValueMapping(mappedTaggedValue,basepath,targetBasePath);
                    }
                    else
                    {
                        tagMapping = new TaggedValueMapping(mappedTaggedValue,basepath,targetRootElement);
                    }
                    returnedMappings.Add(tagMapping);
                }
            }
            //add the mappings for the type of the attribute
            var attributeType = attribute.type as ElementWrapper;
            if (attributeType != null) returnedMappings.AddRange(createOwnedMappings(attributeType,basepath + "." + attribute.name));
            return returnedMappings;
        }
Example #7
0
 public virtual void PostDeleteItem
 (
     TSF dwFlags,
     IShellItem psiItem,
     int hrDelete,
     IShellItem psiNewlyCreated
 )
 {
     this.fileOperation.OnPostDelete?.Invoke
     (
         this.fileOperation,
         new PostDeleteEventArgs
         (
             (TransferSourceFlags)dwFlags,
             psiItem.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING),
             psiNewlyCreated?.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING),
             hrDelete
         )
     );
 }
Example #8
0
 public virtual void PreCopyItem
 (
     TSF dwFlags,
     IShellItem psiItem,
     IShellItem psiDestinationFolder,
     string pszNewName
 )
 {
     this.fileOperation.OnPreCopy?.Invoke
     (
         this.fileOperation,
         new PreMoveCopyEventArgs
         (
             (TransferSourceFlags)dwFlags,
             psiItem.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING),
             psiDestinationFolder.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING),
             pszNewName
         )
     );
 }
Example #9
0
        private void InitTSF()
        {
            tsf = new TSF();                        //Need to init at STA Thread
            tsf.AssociateFocus(this.Window.Handle); //Window need to create in a STA Thread
            tsf.Active();
            tsf.CreateContext(this.Window.Handle);
            tsf.PushContext();
#if XNA
            FieldInfo  host    = typeof(Game).GetField("host", BindingFlags.NonPublic | BindingFlags.Instance);
            Type       type    = host.GetValue(Game1.game1).GetType();
            MethodInfo m_idle  = type.GetMethod("ApplicationIdle", BindingFlags.NonPublic | BindingFlags.Instance);
            Harmony    harmony = new Harmony("StardewValley_TSF");
            harmony.Patch(m_idle, null, new HarmonyMethod(typeof(Game1), "HandleMsgFirst"));
#endif
#if Mono
            Type       type    = Game1.game1.Window.GetType();
            MethodInfo m_idle  = type.GetMethod("TickOnIdle", BindingFlags.NonPublic | BindingFlags.Instance);
            Harmony    harmony = new Harmony("StardewValley_TSF");
            harmony.Patch(m_idle, null, new HarmonyMethod(typeof(Game1), "HandleMsgFirst"));//need to handle msg first, or the game will struck after IME actived
#endif
        }
Example #10
0
 public virtual void PostRenameItem
 (
     TSF dwFlags,
     IShellItem psiItem,
     string pszNewName,
     int hrRename,
     IShellItem psiNewlyCreated
 )
 {
     this.fileOperation.OnPostRename?.Invoke
     (
         this.fileOperation,
         new PostRenameEventArgs
         (
             (TransferSourceFlags)dwFlags,
             psiItem.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING),
             pszNewName,
             psiNewlyCreated.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING),
             psiNewlyCreated.GetDisplayName(SIGDN.PARENTRELATIVE),
             hrRename
         )
     );
 }
Example #11
0
 public virtual void PostMoveItem
 (
     TSF dwFlags,
     IShellItem psiItem,
     IShellItem psiDestinationFolder,
     string pszNewName,
     int hrMove,
     IShellItem psiNewlyCreated
 )
 {
     this.fileOperation.OnPostMove?.Invoke
     (
         this.fileOperation,
         new PostMoveCopyEventArgs
         (
             (TransferSourceFlags)dwFlags,
             psiItem.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING),
             psiDestinationFolder.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING),
             psiNewlyCreated.GetDisplayName(SIGDN.DESKTOPABSOLUTEPARSING),
             pszNewName,
             hrMove
         )
     );
 }
Example #12
0
 public Association(Model model, TSF.UmlCanvas.Association association)
 : base(model, association)
 {}
Example #13
0
 internal DiagramElement(Model model, TSF.ADL.Construct construct)
   : base(model,construct)
 {}
Example #14
0
 public Operation( Model model, TSF.UmlCanvas.Operation operation) 
   : base(model,operation)
 {}
Example #15
0
 public Dependency(Model model, TSF.UmlCanvas.Dependency dependency)
   : base(model, dependency)
 {}
Example #16
0
 internal Class(Model model, TSF.UmlCanvas.Class _class) 
   : base(model,_class)
 {}
Example #17
0
 public Attribute(Model model, TSF.UmlCanvas.Attribute attribute)
   : base(model, attribute)
 {}
Example #18
0
 internal Interface(Model model, TSF.UmlCanvas.Interface _interface)
   : base(model,_interface)
 {
   this.wrappedInterface = _interface;
 }
Example #19
0
 public RelationWrapper(Model model, TSF.UmlCanvas.Relation relation)
   : base(model, relation)
 {}