Esempio n. 1
0
        private void btnDecodePath_Click(object sender, EventArgs e)
        {
            try
            {
                BrowseFlags flags = 0;

                Array arr = Enum.GetNames(typeof(BrowseFlags));

                for (int i = 0; i < arr.Length; i++)
                {
                    BrowseFlags flag = (BrowseFlags)Enum.Parse(typeof(BrowseFlags), arr.GetValue(i).ToString());
                    if ((flag & folderBrowser1.BrowseFlags) != 0)
                    {
                        flags |= (BrowseFlags)Enum.Parse(typeof(BrowseFlags), arr.GetValue(i).ToString());
                    }
                }

                folderBrowser1.BrowseFlags = flags;
                folderBrowser1.Title       = "Please select source folder to encode ";
                Boolean dialogResult = folderBrowser1.ShowDialog();
                if (dialogResult)
                {
                    txtDecodePath.Text = folderBrowser1.FolderPath;
                }
            }
            catch (Exception ExceptionErr)
            {
                MessageBox.Show(ExceptionErr.Message);
            }
        }
Esempio n. 2
0
        public IEnumerable <XPathNavigator> Browse(string objectId, BrowseFlags browseFlag, string filter, string sortCriteria)
        {
            object[] inArgs   = { objectId, browseFlag.ToString(), filter, 0u, 256u * 4, sortCriteria };
            object[] outArray = { "", 0u, uint.MaxValue, 0u };

            for (uint i = 0; i < (uint)outArray[2]; i += (uint)outArray[1])
            {
                inArgs.SetValue(i, 3);                                                                         // starting index
                inArgs.SetValue(Math.Min((uint)inArgs.GetValue(4), (uint)outArray[2] - (uint)outArray[1]), 4); // items to retrieve
                outArray = UPnP.InvokeAction(_service, "Browse", inArgs);

                string resultXml      = Convert.ToString(outArray.GetValue(0));
                uint   numberReturned = Convert.ToUInt32(outArray.GetValue(1));
                uint   totalMatches   = Convert.ToUInt32(outArray.GetValue(2));
                uint   updateId       = Convert.ToUInt32(outArray.GetValue(3));

                XPathDocument  doc = new XPathDocument(new StringReader(resultXml));
                XPathNavigator nav = doc.CreateNavigator();

                foreach (XPathNavigator node in nav.Select(XPath.Expressions.ContainerElements))
                {
                    yield return(node);
                }

                foreach (XPathNavigator node in nav.Select(XPath.Expressions.ItemsElements))
                {
                    yield return(node);
                }
            }
        }
Esempio n. 3
0
        public IEnumerable<XPathNavigator> Browse(string objectId, BrowseFlags browseFlag, string filter, string sortCriteria)
        {
            object[] inArgs = { objectId, browseFlag.ToString(), filter, 0u, 256u * 4, sortCriteria };
            object[] outArray = { "", 0u, uint.MaxValue, 0u };

            for (uint i = 0; i < (uint)outArray[2]; i += (uint)outArray[1])
            {
                inArgs.SetValue(i, 3); // starting index
                inArgs.SetValue(Math.Min((uint)inArgs.GetValue(4), (uint)outArray[2] - (uint)outArray[1]), 4); // items to retrieve
                outArray = UPnP.InvokeAction(_service, "Browse", inArgs);

                string resultXml = Convert.ToString(outArray.GetValue(0));
                uint numberReturned = Convert.ToUInt32(outArray.GetValue(1));
                uint totalMatches = Convert.ToUInt32(outArray.GetValue(2));
                uint updateId = Convert.ToUInt32(outArray.GetValue(3));

                XPathDocument doc = new XPathDocument(new StringReader(resultXml));
                XPathNavigator nav = doc.CreateNavigator();

                foreach (XPathNavigator node in nav.Select(XPath.Expressions.ContainerElements))
                {
                    yield return node;
                }

                foreach (XPathNavigator node in nav.Select(XPath.Expressions.ItemsElements))
                {
                    yield return node;
                }
            }
        }
Esempio n. 4
0
        public static String DoBrowse(IWin32Window pOwner, String pTitle, BrowseFlags pFlags, Action <Object, EventArgs> pInitialize = null, Action <Object, BrowseSelChangedEventArgs> pSelChanged = null,
                                      Action <Object, ValidationFailedEventArgs> pValidationFailure = null)
        {
            BrowseFolderDialogEx bfd = new BrowseFolderDialogEx();

            bfd.Title       = pTitle;
            bfd.BrowseFlags = pFlags;
            if (pInitialize != null)
            {
                bfd.Initialized += (EventHandler)((ob, e) => { pInitialize(ob, e); });
            }
            if (pSelChanged != null)
            {
                bfd.SelChanged += (EventHandler <BrowseSelChangedEventArgs>)((ob, e) => { pSelChanged(ob, e); });
            }
            if (pValidationFailure != null)
            {
                bfd.ValidateFailed += (EventHandler <ValidationFailedEventArgs>)((ob, e) => { pValidationFailure(ob, e); });
            }
            DialogResult result;

            if (pOwner != null)
            {
                result = bfd.ShowDialog(pOwner);
            }
            else
            {
                result = bfd.ShowDialog();
            }

            if (result == DialogResult.OK)
            {
                return(bfd.FolderPath);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 5
0
 public static String DoBrowse(String pTitle, BrowseFlags pFlags, Action <Object, EventArgs> pInitialize = null, Action <Object, BrowseSelChangedEventArgs> pSelChanged = null,
                               Action <Object, ValidationFailedEventArgs> pValidationFailure             = null)
 {
     return(DoBrowse(null, pTitle, pFlags, pInitialize, pSelChanged, pValidationFailure));
 }
Esempio n. 6
0
 public CFolderBrowser()
 {
     m_Flags    = BrowseFlags.BIF_DEFAULT;
     m_strTitle = "";
 }
Esempio n. 7
0
		public FolderBrowser()
		{
			m_Flags = BrowseFlags.BIF_DEFAULT;
			m_strTitle = "";
		}
Esempio n. 8
0
 public BrowseOptions(string title, string path, IEnumerable <BrowseFilter> filters, BrowseFlags flags)
 {
     this.Title   = title;
     this.Path    = path;
     this.Filters = filters;
     this.Flags   = flags;
 }