예제 #1
0
 public override bool IsRelevant(Phrase phrase)
 {
     return
         (Subject.Equals(phrase.Subject, StringComparison.InvariantCultureIgnoreCase) &&
          Verb.Equals(phrase.Verb, StringComparison.InvariantCultureIgnoreCase) &&
          Object.Equals(phrase.Object, StringComparison.InvariantCultureIgnoreCase));
 }
예제 #2
0
        public HttpResponseMessage DoCall(string json, string endPoint, Verb verb)
        {
            var result = new HttpResponseMessage();

            using (var client = new HttpClient())
            {
                using (var content = new StringContent(json, Encoding.UTF8, "application/json"))
                {
                    if (verb.Equals(Verb.post))
                    {
                        result = client.PostAsync(endPoint, content).Result;
                    }

                    if (verb.Equals(Verb.get))
                    {
                        result = client.GetAsync(endPoint).Result;
                    }
                }
            }
            return(result);
        }
예제 #3
0
        public bool Equals(DestinyVendorActionDefinition input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     Description == input.Description ||
                     (Description != null && Description.Equals(input.Description))
                     ) &&
                 (
                     ExecuteSeconds == input.ExecuteSeconds ||
                     (ExecuteSeconds.Equals(input.ExecuteSeconds))
                 ) &&
                 (
                     Icon == input.Icon ||
                     (Icon != null && Icon.Equals(input.Icon))
                 ) &&
                 (
                     Name == input.Name ||
                     (Name != null && Name.Equals(input.Name))
                 ) &&
                 (
                     Verb == input.Verb ||
                     (Verb != null && Verb.Equals(input.Verb))
                 ) &&
                 (
                     IsPositive == input.IsPositive ||
                     (IsPositive != null && IsPositive.Equals(input.IsPositive))
                 ) &&
                 (
                     ActionId == input.ActionId ||
                     (ActionId != null && ActionId.Equals(input.ActionId))
                 ) &&
                 (
                     ActionHash == input.ActionHash ||
                     (ActionHash.Equals(input.ActionHash))
                 ) &&
                 (
                     AutoPerformAction == input.AutoPerformAction ||
                     (AutoPerformAction != null && AutoPerformAction.Equals(input.AutoPerformAction))
                 ));
        }
예제 #4
0
 /// <summary>
 /// Compares this IRCMessage to another one for equality.
 /// </summary>
 /// <param name="msg">The message to compare to.</param>
 /// <returns><c>true</c> if the messages are equal in tags, source, verb, and parameters. <c>false</c> otherwise.</returns>
 public bool Equals(IRCMessage msg) => Source.Equals(msg.Source) &&
 Verb.Equals(msg.Verb) &&
 Tags.Count == msg.Tags.Count &&
 Parameters.Length == msg.Parameters.Length &&
 !Tags.Except(msg.Tags).Any() &&
 Parameters.SequenceEqual(msg.Parameters);
예제 #5
0
        public virtual void ExploreMenuItem_Click(object sender, EventArgs e)
        {
            if (Verb.Equals(ConsoleVerb))
            {
                ConsoleForm cf = new ConsoleForm();
                cf.ShowDialog();
            }
            else
            if (Verb.Equals(PreferencesVerb))
            {
                ContextMenuEventArgs c = (ContextMenuEventArgs)e;

                //NativeWindow nativeWindow = new NativeWindow();
                //nativeWindow.AssignHandle(c.CommandInfo.hwnd);

                PreferencesForm pf = new PreferencesForm();
                pf.ShowDialog();
            }
            else if (Verb.Equals(ConnectVerb))
            {
                DeviseAddr addr = new DeviseAddr();
                if (!string.IsNullOrEmpty(addr.ConnectionType) && addr.ConnectionType.Equals("usb") &&
                    !string.IsNullOrEmpty(addr.UsbDevice))
                {
                    //ADBCommand commandD = new ADBCommand();
                    //CommandResult retD = commandD.Disconnect(true);
                }
                else
                {
                    ADBCommand    commandD = new ADBCommand();
                    CommandResult retD     = commandD.Disconnect();
                }

                ADBCommand    command = new ADBCommand();
                CommandResult ret     = command.Connect();
                ret.ShowMessage();
                ADBCommand    commandDev = new ADBCommand();
                CommandResult retDev     = commandDev.Devices();
                if (retDev.IsSuccess)
                {
                    Dictionary <string, string> dicDev = new Dictionary <string, string>();
                    foreach (var str in retDev.Message.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        if (!string.IsNullOrEmpty(str))
                        {
                            string[] s = str.Split(' ');
                            if (s.Any())
                            {
                                string sDevType = string.Empty;
                                if (s.Length > 1)
                                {
                                    sDevType = s[1];
                                }
                                if (!dicDev.ContainsKey(s[0]))
                                {
                                    dicDev.Add(s[0], sDevType);
                                }
                            }
                        }
                    }

                    if (dicDev.Count == 0)
                    {
                        MessageBox.Show("List of devices attached - is empty",
                                        "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    if (!dicDev.ContainsKey(commandDev.CurrentDevice()))
                    {
                        MessageBox.Show("List of devices attached - does not contain selected device",
                                        "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    if (dicDev.ContainsKey(commandDev.CurrentDevice()) && dicDev[commandDev.CurrentDevice()].Equals("unauthorized"))
                    {
                        MessageBox.Show("Please authorize this computer on dialog in device,\r\nAnd after that, click Ok button to continue",
                                        "Warning! " + retDev.Message.Replace("\t", " - "), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    IntPtr pParrent = ItemIdList.Create(null, _folderObj.PathData).Ptr;
                    Shell32.SHChangeNotify(ShellChangeEvents.UpdateDir,
                                           ShellChangeFlags.IdList | ShellChangeFlags.Flush,
                                           pParrent,
                                           IntPtr.Zero);
                    Marshal.FreeCoTaskMem(pParrent);
                }
            }
            else if (Verb.Equals(DisconnectVerb))
            {
                ADBCommand    command = new ADBCommand();
                CommandResult ret     = command.Disconnect();
                ret.ShowMessage();

                IntPtr pParrent = ItemIdList.Create(null, _folderObj.PathData).Ptr;
                Shell32.SHChangeNotify(ShellChangeEvents.UpdateDir,
                                       ShellChangeFlags.IdList | ShellChangeFlags.Flush,
                                       pParrent,
                                       IntPtr.Zero);
                Marshal.FreeCoTaskMem(pParrent);
            }
            else if (Verb.Equals(InstallApkVerb))
            {
                ADBCommand    command = new ADBCommand();
                CommandResult ret     = command.Install(_folderObj.PathString);
                ret.ShowMessage();
            }
            else if (Verb.Equals(CreateScreenshotVerb))
            {
                ADBCommand    command = new ADBCommand();
                CommandResult ret     = command.CreateScreenShot(_folderObj.PathString);
                ret.ShowMessage();
                // MessageBox.Show("Create Screenshot to: " + _folderObj.PathString);
            }
            else if (Verb.Equals(InfoVerb))
            {
                StringCollection sc = new StringCollection();

                PermissionsForm pf = new PermissionsForm();
                pf.SetData(_items, _folderObj);
                pf.ShowDialog();

                /*
                 * if (_folderObj.GetParrent() != null)
                 * {
                 *  _folderObj.GetParrent().RefreshItems(_items);
                 * }
                 */
                //_folderObj.RefreshItems(_items);
            }
            else if (Verb.Equals(NewFolderVerb))
            {
                _folderObj.NewFolder();
            }
            else if (Verb.Equals(RenameVerb))
            {
                using (Malloc m = Shell32.GetMalloc())
                {
                    byte[][]      clone = (byte[][])fqPidl.Clone();
                    List <byte[]> lsn   = clone.ToList();
                    lsn.RemoveAt(lsn.Count - 1);
                    clone = lsn.ToArray();
                    ItemIdList itemIdList       = ItemIdList.Create(m, fqPidl);
                    ItemIdList itemIdListFolder = ItemIdList.Create(m, clone);
                    Shell32.SHOpenFolderAndSelectItems(itemIdListFolder.Ptr, 1, new[] { itemIdList.Ptr }, Shell32.OFASI_EDIT);
                }
            }
            else if (Verb.Equals(CopyVerb))
            {
                DataObject       dobj      = new DataObject();
                List <string>    file_list = new List <string>();
                StringCollection sc        = new StringCollection();
                foreach (IFolderObject folderObject in _items)
                {
                    string sAdd = ((folderObject.Attributes & FolderAttributes.Folder) == FolderAttributes.Folder)
                            ? "[virtualfolder]"
                            : "[virtualfile]";
                    file_list.Add(string.Format("{0}{1}\\{2}", sAdd, CodePath.Code(folderObject.PathData), folderObject.PathString));
                    sc.Add(string.Format("{0}{1}\\{2}", sAdd, CodePath.Code(folderObject.PathData), folderObject.PathString));
                    //sc.Add(folderObject.PathString);
                    //file_list.Add(string.Format("{0}\\{1}", sAdd, folderObject.PathString));
                }
                dobj.SetData(DataFormats.FileDrop, (System.String[])file_list.ToArray());
                dobj.SetData(typeof(StringCollection), sc);
                Clipboard.SetDataObject(dobj, false);
                //Clipboard.SetFileDropList(sc);
            }
            else if (Verb.Equals(PasteLinkVerb))
            {
                List <string> lFiles = new List <string>();
                if (_folderObj.DataObject != null)
                {
                    DataObject       dobj = _folderObj.DataObject;
                    StringCollection z    = (StringCollection)dobj.GetData(typeof(StringCollection));
                    foreach (string s in z)
                    {
                        if (s.StartsWith("[virtualfolder]") || s.StartsWith("[virtualfile]"))
                        {
                            lFiles.Add(s);
                        }
                    }

                    lFiles.Add(_folderObj.PathString);
                    _folderObj.CopyItems(null, lFiles);

                    _folderObj.DataObject = null;
                }
                else
                if (Clipboard.ContainsData("DataObject"))
                {
                    DataObject       dobj = (DataObject)Clipboard.GetDataObject();
                    StringCollection z    = (StringCollection)dobj.GetData(typeof(StringCollection));
                    if (z != null)
                    {
                        foreach (string s in z)
                        {
                            if (s.StartsWith("[virtualfolder]"))
                            {
                                lFiles.Add(s);
                            }
                        }

                        lFiles.Add(_folderObj.PathString);
                        _folderObj.CopyItems(null, lFiles);
                    }
                }
            }
            else if (Verb.Equals(PasteVerb))
            {
                List <string> lFiles = new List <string>();
                //only for external
                if (Clipboard.ContainsFileDropList())
                {
                    StringCollection files = Clipboard.GetFileDropList();
                    foreach (string file in files)
                    {
                        if (!file.StartsWith("[virtualfolder]") && !file.StartsWith("[virtualfile]"))
                        {
                            lFiles.Add(file);
                        }
                    }
                }

                if (_folderObj.DataObject != null)
                {
                    DataObject       dobj = _folderObj.DataObject;
                    StringCollection z    = (StringCollection)dobj.GetData(typeof(StringCollection));
                    foreach (string s in z)
                    {
                        lFiles.Add(s);
                    }
                    _folderObj.DataObject = null;
                }
                else
                if (Clipboard.ContainsData("DataObject"))
                {
                    DataObject       dobj = (DataObject)Clipboard.GetDataObject();
                    StringCollection z    = (StringCollection)dobj.GetData(typeof(StringCollection));
                    if (z != null)
                    {
                        foreach (string s in z)
                        {
                            lFiles.Add(s);
                        }
                        //lFiles = DataObjectHelper.GetFiles(dobj);
                    }
                }

                string sr = string.Empty;
                foreach (string file in lFiles)
                {
                    sr += file + "\r\n";
                }
                sr += "to\r\n" + _folderObj.PathString;
                //MessageBox.Show(sr);
                Debug.WriteLine(sr);
                _folderObj.CopyItems(_folderObj, lFiles);
            }
            else if (Verb.Equals(DeleteVerb))
            {
                _folderObj.DeleteItems(_items);
            }
            else
            {
                using (Malloc m = Shell32.GetMalloc())
                {
                    ContextMenuEventArgs c = (ContextMenuEventArgs)e;

                    ShellExecuteInfo sei = new ShellExecuteInfo();
                    sei.cbSize = (uint)Marshal.SizeOf(typeof(ShellExecuteInfo));
                    sei.fMask  = ShellExecuteOptions.IdList | ShellExecuteOptions.ClassName;
                    ItemIdList itemIdList = ItemIdList.Create(m, fqPidl);
                    sei.lpIDList = itemIdList.Ptr;
                    sei.lpClass  = "folder";
                    sei.hwnd     = c.CommandInfo.hwnd;
                    sei.nShow    = c.CommandInfo.nShow;
                    sei.lpVerb   = Verb;

                    int result = Shell32.ShellExecuteEx(ref sei);

                    //m.Free(itemIdList.Ptr);

                    if (result == 0)
                    {
                        int lastError = Marshal.GetLastWin32Error();
                        throw new Exception("ShellExecuteEx failed; last error = " + lastError);
                    }
                }
            }
        }
예제 #6
0
 public bool IsVerb(string verb)
 {
     return(Verb.Equals(verb, StringComparison.OrdinalIgnoreCase));
 }