当前位置: 首页>>代码示例>>C#>>正文


C# DText.DCOUNT方法代码示例

本文整理汇总了C#中OpenSource.UPnP.DText.DCOUNT方法的典型用法代码示例。如果您正苦于以下问题:C# DText.DCOUNT方法的具体用法?C# DText.DCOUNT怎么用?C# DText.DCOUNT使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSource.UPnP.DText的用法示例。


在下文中一共展示了DText.DCOUNT方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetURNPrefix

 public static string GetURNPrefix(string urn)
 {
     int len;
     DText p = new DText();
     p.ATTRMARK = ":";
     p[0] = urn;
     len = p[p.DCOUNT()].Length;
     return(urn.Substring(0, urn.Length - len));
 }
开发者ID:genielabs,项目名称:intel-upnp-dlna,代码行数:9,代码来源:UPnPStringFormatter.cs

示例2: PopulateMetaData

        public static MediaItem PopulateMetaData(MediaResource R, FileInfo F)
        {
            MediaItem RetVal;
            MediaBuilder.item Item = null;
            DText parser = new DText();
            parser.ATTRMARK = "-";
            parser.MULTMARK = ".";

            switch(F.Extension.ToUpper())
            {
                case ".MP3":
                    Item = ParseMP3_V1(F);
                    if(Item==null)
                    {
                        parser[0] = F.Name;
                        if(parser.DCOUNT()==2)
                        {
                            Item = new MediaBuilder.musicTrack(parser[2,1].Trim());
                            Item.creator = parser[1].Trim();
                            ((MediaBuilder.musicTrack)Item).artist = new PersonWithRole[1]{new PersonWithRole()};
                            ((MediaBuilder.musicTrack)Item).artist[0].Name = Item.creator;
                            ((MediaBuilder.musicTrack)Item).artist[0].Role = null;
                        }
                    }
                    break;
            }

            if(Item!=null)
            {
                RetVal = MediaBuilder.CreateItem(Item);
                RetVal.AddResource(R);
                return(RetVal);
            }
            else
            {
                // Create a Generic Item
                string fname = F.Name;
                int fnameidx = fname.IndexOf(".");
                if(fnameidx!=-1) fname=fname.Substring(0,fnameidx);
                MediaBuilder.item genericItem = new MediaBuilder.item(fname);
                RetVal = MediaBuilder.CreateItem(genericItem);
                RetVal.AddResource(R);
                return(RetVal);
            }
        }
开发者ID:amadare,项目名称:DeveloperToolsForUPnP,代码行数:45,代码来源:Finder.cs

示例3: ProcessPacket

        private void ProcessPacket(HTTPMessage msg, IPEndPoint src, IPEndPoint local)
        {
            if (OnSniffPacket != null) OnSniffPacket(src, null, msg);

            DText parser = new DText();
            parser.ATTRMARK = "::";

            bool Alive = false;
            String UDN = msg.GetTag("USN");

            parser[0] = UDN;
            String USN = parser[1];
            USN = USN.Substring(USN.IndexOf(":") + 1);
            String ST = parser[2];
            int MaxAge = 0;

            String NTS = msg.GetTag("NTS").ToUpper();
            if (NTS == "SSDP:ALIVE")
            {
                Alive = true;
                String ma = msg.GetTag("Cache-Control").Trim();
                if (ma != "")
                {
                    parser.ATTRMARK = ",";
                    parser.MULTMARK = "=";
                    parser[0] = ma;
                    for (int i = 1; i <= parser.DCOUNT(); ++i)
                    {
                        if (parser[i, 1].Trim().ToUpper() == "MAX-AGE")
                        {
                            MaxAge = int.Parse(parser[i, 2].Trim());
                            break;
                        }
                    }
                }
            }

            if (msg.Directive == "NOTIFY" && OnNotify != null)
            {
                Uri locuri = null;
                string location = msg.GetTag("Location");
                if (location != null && location.Length > 0) { try { locuri = new Uri(location); } catch (Exception) { } }
                OnNotify(src, msg.LocalEndPoint, locuri, Alive, USN, ST, MaxAge, msg);
            }
            else if (msg.Directive == "M-SEARCH" && OnSearch != null)
            {
                if (ValidateSearchPacket(msg) == false) return;
                int MaxTimer = int.Parse(msg.GetTag("MX"));
                SearchStruct SearchData = new SearchStruct();
                SearchData.ST = msg.GetTag("ST");
                SearchData.Source = src;
                SearchData.Local = local;
                SearchTimer.Add(SearchData, RandomGenerator.Next(0, MaxTimer));
            }
        }
开发者ID:Tieske,项目名称:Developer-Tools-for-UPnP-Technologies,代码行数:55,代码来源:SSDP.cs

示例4: Generate

        /// <summary>
        /// Generates Device side implementation from SCPD XML
        /// </summary>
        /// <param name="ClassName">Class Name to build</param>
        /// <param name="ns">Namespace to use</param>
        /// <param name="SavePath">Path to save source</param>
        /// <param name="ServiceID">Service ID to use</param>
        /// <param name="ServiceURN">Service URN to use</param>
        /// <param name="SCPD_XML">SCPD XML String</param>
        public static void Generate(String ClassName, String ns, String SavePath, String ServiceID, String ServiceURN, String SCPD_XML)
        {
            UPnPService s = ServiceGenerator.GenerateServiceFromSCPD(SCPD_XML);
            UPnPDebugObject dobj = new UPnPDebugObject(s);

            int ServiceURversion = 1;
            string[] xx = ServiceURN.Split(':');
            if (xx.Length > 2) int.TryParse(xx[xx.Length - 1], out ServiceURversion);

            DText p = new DText();
            p.ATTRMARK = ":";
            p[0] = ServiceURN;

            string v = p[p.DCOUNT()];
            dobj.InvokeNonStaticMethod("SetVersion", new Object[1] { v });
            String cl = "\r\n";

            StringBuilder cs = new StringBuilder();
            UPnPArgument[] Args;
            UPnPArgument arg;
            UPnPStateVariable[] SV = s.GetStateVariables();

            cs.Append("using OpenSource.UPnP;" + cl + cl);
            cs.Append("namespace " + ns + cl);
            cs.Append("{\r\n");
            cs.Append("    /// <summary>" + cl);
            cs.Append("    /// Transparent DeviceSide UPnP Service" + cl);
            cs.Append("    /// </summary>" + cl);
            cs.Append("    public class " + ClassName + " : IUPnPService" + cl);
            cs.Append("    {" + cl + cl);
            cs.Append("        // Place your declarations above this line\r\n");
            cs.Append("\r\n");
            cs.Append("        #region AutoGenerated Code Section [Do NOT Modify, unless you know what you're doing]\r\n");
            cs.Append("        //{{{{{ Begin Code Block\r\n");
            cs.Append("\r\n");
            cs.Append("        private _" + ClassName + " _S;\r\n");
            cs.Append("        public static string URN = \"" + ServiceURN + "\";\r\n");
            cs.Append("        public double VERSION\r\n");
            cs.Append("        {\r\n");
            cs.Append("           get\r\n");
            cs.Append("           {\r\n");
            cs.Append("               return(double.Parse(_S.GetUPnPService().Version));\r\n");
            cs.Append("           }\r\n");
            cs.Append("        }\r\n\r\n");

            // Build Enumerations
            Hashtable elist = BuildEnumerations(SV);
            IDictionaryEnumerator el = elist.GetEnumerator();
            VarData vd;
            while (el.MoveNext())
            {
                vd = (VarData)el.Value;
                cs.Append("        public enum Enum_" + vd.VariableName + "\r\n");
                cs.Append("        {\r\n");
                foreach (EnumStruct vs in vd.Enumerations)
                {
                    cs.Append("            " + vs.EnumName + ",\r\n");
                }
                cs.Append("        }\r\n");

                cs.Append("        public Enum_" + vd.VariableName + " ");
                if (s.GetStateVariableObject(vd.VariableName).SendEvent == true)
                {
                    cs.Append("Evented_");
                }
                cs.Append(vd.VariableName + "\r\n");
                cs.Append("        {\r\n");
                cs.Append("            set\r\n");
                cs.Append("            {\r\n");
                cs.Append("               string v = \"\";\r\n");
                cs.Append("               switch(value)\r\n");
                cs.Append("               {\r\n");
                foreach (EnumStruct vs in vd.Enumerations)
                {
                    cs.Append("                  case Enum_" + vd.VariableName + "." + vs.EnumName + ":\r\n");
                    cs.Append("                     v = \"" + vs.EnumValue + "\";\r\n");
                    cs.Append("                     break;\r\n");
                }
                cs.Append("               }\r\n");
                cs.Append("               _S.SetStateVariable(\"" + vd.VariableName + "\",v);\r\n");
                cs.Append("            }\r\n");
                cs.Append("            get\r\n");
                cs.Append("            {\r\n");
                cs.Append("               Enum_" + vd.VariableName + " RetVal = 0;\r\n");
                cs.Append("               string v = (string)_S.GetStateVariable(\"" + vd.VariableName + "\");\r\n");
                cs.Append("               switch(v)\r\n");
                cs.Append("               {\r\n");
                foreach (EnumStruct vs in vd.Enumerations)
                {
                    cs.Append("                  case \"" + vs.EnumValue + "\":\r\n");
                    cs.Append("                     RetVal = Enum_" + vd.VariableName + "." + vs.EnumName + ";\r\n");
//.........这里部分代码省略.........
开发者ID:Tieske,项目名称:Developer-Tools-for-UPnP-Technologies,代码行数:101,代码来源:ServiceGenerator.cs

示例5: UPnPDevice

        internal UPnPDevice(double version, String UDN)
        {
            // Full Device
            IsRoot = false;

            VirtualDir_Table = new Hashtable();
            VirtualDir_Header_Table = new Hashtable();

            parent = null;
            HasPresentation = true;
            ControlPointOnly = false;
            RootPath = "";

            if (version == 0)
            {
                Major = 1;
                Minor = 0;
            }
            else
            {
                DText TempNum = new DText();
                TempNum.ATTRMARK = ".";
                TempNum[0] = version.ToString();

                Major = int.Parse(TempNum[1]);
                if (TempNum.DCOUNT() == 2)
                {
                    Minor = int.Parse(TempNum[2]);
                }
                else
                {
                    Minor = 0;
                }
            }
            Services = new UPnPService[0];
            if (UDN == "")
            {
                UniqueDeviceName = Guid.NewGuid().ToString();
            }
            else
            {
                UniqueDeviceName = UDN;
            }

            SSDPServer = new SSDP(ExpirationTimeout);
            SSDPServer.OnRefresh += new SSDP.RefreshHandler(SendNotify);
            SSDPServer.OnSearch += new SSDP.SearchHandler(HandleSearch);
        }
开发者ID:nothingmn,项目名称:UPnP-for-C---Intel-,代码行数:48,代码来源:UPnPDevice.cs

示例6: startMenuItem_Click

        private void startMenuItem_Click(object sender, System.EventArgs e)
        {
            startMenuItem.Enabled = false;
            foreach (MenuItem i in pfcMenuItem.MenuItems) {i.Enabled = false;}
            foreach (MenuItem i in menuItem3.MenuItems) {i.Enabled = false;}
            InfoStringBox.Enabled = false;

            device = UPnPDevice.CreateRootDevice(900,1,"");
            device.UniqueDeviceName = Guid.NewGuid().ToString();
            device.StandardDeviceType = "MediaRenderer";
            device.FriendlyName = "Media Renderer (" + System.Net.Dns.GetHostName() + ")";
            device.HasPresentation = false;

            device.Manufacturer = "OpenSource";
            device.ManufacturerURL = "http://opentools.homeip.net/";
            device.PresentationURL = "/";
            device.HasPresentation = true;
            device.ModelName = "AV Renderer";
            device.ModelDescription = "Media Renderer Device";
            device.ModelURL = new Uri("http://opentools.homeip.net/");

            UPnPService ts = new UPnPService(1, "EmptyService", "EmptyService", true, this);
            ts.AddMethod("NullMethod");
            //device.AddService(ts);

            DText p = new DText();
            p.ATTRMARK = "\r\n";
            p[0] = this.InfoStringBox.Text;
            int len = p.DCOUNT();
            ProtocolInfoString[] istring = new ProtocolInfoString[len];
            for(int i=1;i<=len;++i)
            {
                istring[i-1] = new ProtocolInfoString(p[i]);
            }
            r = new AVRenderer(MaxConnections, istring, new AVRenderer.ConnectionHandler(NewConnectionSink));

            r.OnClosedConnection += new AVRenderer.ConnectionHandler(ClosedConnectionSink);

            if (supportRecordMenuItem.Checked == false)
            {
                r.AVT.RemoveAction_Record();
            }

            if (supportRecordQualityMenuItem.Checked == false)
            {
                r.AVT.RemoveAction_SetRecordQualityMode();
            }

            if (supportNextContentUriMenuItem.Checked == false)
            {
                r.AVT.RemoveAction_SetNextAVTransportURI();
            }

            if (MaxConnections == 0)
            {
                r.Manager.RemoveAction_PrepareForConnection();
                r.Manager.RemoveAction_ConnectionComplete();
            }

            r.AVT.GetUPnPService().GetStateVariableObject("CurrentPlayMode").AllowedStringValues = new String[3]{"NORMAL","REPEAT_ALL","INTRO"};

            r.Control.GetUPnPService().GetStateVariableObject("A_ARG_TYPE_Channel").AllowedStringValues = new String[3]{"Master","LF","RF"};
            r.Control.GetUPnPService().GetStateVariableObject("RedVideoBlackLevel").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("GreenVideoBlackLevel").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("BlueVideoBlackLevel").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("RedVideoGain").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("GreenVideoGain").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("BlueVideoGain").SetRange((ushort)0,(ushort)100,(ushort)1);

            r.Control.GetUPnPService().GetStateVariableObject("Brightness").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("Contrast").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("Sharpness").SetRange((ushort)0,(ushort)100,(ushort)1);
            r.Control.GetUPnPService().GetStateVariableObject("Volume").SetRange((UInt16)0,(UInt16)100,(ushort)1);

            device.AddService(r.Control);
            device.AddService(r.AVT);
            device.AddService(r.Manager);

            //device.AddDevice(r);

            device.StartDevice();

            //r.Start();
        }
开发者ID:amadare,项目名称:DeveloperToolsForUPnP,代码行数:84,代码来源:MainForm.cs

示例7: GenerateControlSchemas


//.........这里部分代码省略.........

                    if (!cleanSchema)
                    {
                        X.WriteStartElement("xsd","any",null);
                        X.WriteAttributeString("namespace","##other");
                        X.WriteAttributeString("minOccurs","0");
                        X.WriteAttributeString("maxOccurs","unbounded");
                        X.WriteAttributeString("processContents","lax");
                        X.WriteEndElement(); // any
                    }

                    X.WriteEndElement(); // sequence

                    if (!cleanSchema)
                    {
                        X.WriteStartElement("xsd","anyAttribute",null);
                        X.WriteAttributeString("namespace","##other");
                        X.WriteAttributeString("processContents","lax");
                        X.WriteEndElement(); // anyAttribute
                    }
                    X.WriteEndElement(); // complexType

                    // ActionResponse
                    X.WriteStartElement("xsd","complexType",null);
                    X.WriteAttributeString("name",a.Name+"ResponseType");
                    X.WriteStartElement("xsd","sequence",null);

                    foreach(UPnPArgument arg in a.Arguments)
                    {
                        if (arg.Direction=="out" || arg.IsReturnValue)
                        {
                            X.WriteStartElement("xsd","element",null);
                            X.WriteAttributeString("name",arg.Name);
                            if (arg.RelatedStateVar.ComplexType==null)
                            {
                                // Simple
                                X.WriteStartElement("xsd","complexType",null);
                                X.WriteStartElement("xsd","simpleContent",null);
                                X.WriteStartElement("xsd","extension",null);
                                X.WriteAttributeString("base","upnp:"+arg.RelatedStateVar.ValueType);
                                if (!cleanSchema)
                                {
                                    X.WriteStartElement("xsd","anyAttribute",null);
                                    X.WriteAttributeString("namespace","##other");
                                    X.WriteAttributeString("processContents","lax");
                                    X.WriteEndElement(); // anyAttribute
                                }
                                X.WriteEndElement(); // extension
                                X.WriteEndElement(); // simpleContent
                                X.WriteEndElement(); // complexType
                            }
                            else
                            {
                                // Complex
                                X.WriteAttributeString("type",h[arg.RelatedStateVar.ComplexType.Name_NAMESPACE].ToString()+":"+arg.RelatedStateVar.ComplexType.Name_LOCAL);
                            }
                            X.WriteEndElement(); // Element
                        }
                    }
                    // After all arguments
                    if (!cleanSchema)
                    {
                        X.WriteStartElement("xsd","any",null);
                        X.WriteAttributeString("namespace","##other");
                        X.WriteAttributeString("minOccurs","0");
                        X.WriteAttributeString("maxOccurs","unbounded");
                        X.WriteAttributeString("processContents","lax");
                        X.WriteEndElement(); // any
                    }
                    X.WriteEndElement(); // sequence
                    if (!cleanSchema)
                    {
                        X.WriteStartElement("xsd","anyAttribute",null);
                        X.WriteAttributeString("namespace","##other");
                        X.WriteAttributeString("processContents","lax");
                        X.WriteEndElement(); // anyAttribute
                    }
                    X.WriteEndElement(); // complexType
                }

                X.WriteEndElement(); //schema
                X.WriteEndDocument();

                StreamWriter writer3;

                DText PP = new DText();
                PP.ATTRMARK = ":";
                PP[0] = s.ServiceURN;
                writer3 = File.CreateText(dirInfo.FullName + "\\"+PP[PP.DCOUNT()-1]+".xsd");

                System.Text.UTF8Encoding U = new System.Text.UTF8Encoding();
                X.Flush();
                ms.Flush();
                writer3.Write(U.GetString(ms.ToArray(),2,ms.ToArray().Length-2));
                writer3.Close();
                ms = new MemoryStream();
                X = new System.Xml.XmlTextWriter(ms,System.Text.Encoding.UTF8);
                X.Formatting = System.Xml.Formatting.Indented;
            }
        }
开发者ID:amadare,项目名称:DeveloperToolsForUPnP,代码行数:101,代码来源:CodeGenerationForm.cs

示例8: ParseEventURL

        private Uri[] ParseEventURL(String URLList)
        {
            DText parser = new DText();
            String temp;
            ArrayList TList = new ArrayList();

            parser.ATTRMARK = ">";
            parser[0] = URLList;

            int cnt = parser.DCOUNT();
            for (int x = 1; x <= cnt; ++x)
            {
                temp = parser[x];
                try
                {
                    temp = temp.Substring(temp.IndexOf("<") + 1);
                    TList.Add(new Uri(temp));
                }
                catch (Exception) { }
            }
            Uri[] RetVal = new Uri[TList.Count];
            for (int x = 0; x < RetVal.Length; ++x) RetVal[x] = (Uri)TList[x];
            return RetVal;
        }
开发者ID:rvodden,项目名称:upnp-developertools-old,代码行数:24,代码来源:UPnPService.cs

示例9: UPnPService

        internal UPnPService(double version)
        {
            OpenSource.Utilities.InstanceTracker.Add(this);
            InvocationPipeline.OnResponse += new HTTPRequest.RequestHandler(HandleInvokeRequest);

            this.SubscribeCycleCallback = new LifeTimeMonitor.LifeTimeHandler(SubscribeCycleSink);
            SubscribeCycle.OnExpired += this.SubscribeCycleCallback;
            VarAssociation = new Hashtable();
            LocalMethodList = new Hashtable();
            RemoteMethods = new SortedList();
            SIDLock = new object();
            EventSID = 0;

            StateVariables = Hashtable.Synchronized(new Hashtable());
            SubscriberTable = Hashtable.Synchronized(new Hashtable());
            CurrentSID = "";

            if (version == 0)
            {
                Major = 1;
                Minor = 0;
            }
            else
            {
                DText TempNum = new DText();
                TempNum.ATTRMARK = ".";
                TempNum[0] = version.ToString();

                Major = int.Parse(TempNum[1]);
                Minor = 0;
                if (TempNum.DCOUNT() == 2) int.TryParse(TempNum[2], out Minor);
            }
        }
开发者ID:rvodden,项目名称:upnp-developertools-old,代码行数:33,代码来源:UPnPService.cs

示例10: GetNonRootDeviceXML

        private void GetNonRootDeviceXML(IPEndPoint local, XmlTextWriter XDoc)
        {
            IDictionaryEnumerator de = CustomField.GetEnumerator();
            DText pp = new DText();
            ;
            pp.ATTRMARK = ":";

            XDoc.WriteStartElement("device");

            //
            // Always advertise version :1
            //
            XDoc.WriteElementString("deviceType", DeviceURN);

            if (HasPresentation == true)
            {
                XDoc.WriteElementString("presentationURL", PresentationURL);
            }

            while (de.MoveNext())
            {
                IDictionaryEnumerator ede = ((Hashtable)de.Value).GetEnumerator();
                while (ede.MoveNext())
                {
                    string localName = (string)ede.Key;
                    string elementValue = (string)ede.Value;
                    string ns = (string)de.Key;

                    pp[0] = localName;
                    if (pp.DCOUNT() == 2)
                    {
                        XDoc.WriteStartElement(pp[1], pp[2], ns);
                        XDoc.WriteString(elementValue);
                        XDoc.WriteEndElement();
                    }
                    else
                    {
                        if (ns != "")
                        {
                            XDoc.WriteElementString(localName, ns, elementValue);
                        }
                        else
                        {
                            XDoc.WriteElementString(localName, elementValue);
                        }
                    }
                }
            }

            XDoc.WriteElementString("friendlyName", FriendlyName);
            if (Manufacturer != null)
                XDoc.WriteElementString("manufacturer", Manufacturer);
            if (ManufacturerURL != null)
                XDoc.WriteElementString("manufacturerURL", ManufacturerURL);
            if (ModelDescription != null)
                XDoc.WriteElementString("modelDescription", ModelDescription);
            if (ModelName != null)
                XDoc.WriteElementString("modelName", ModelName);
            if (ModelNumber != null)
                XDoc.WriteElementString("modelNumber", ModelNumber);
            if (ModelURL != null)
                XDoc.WriteElementString("modelURL", HTTPMessage.UnEscapeString(ModelURL.AbsoluteUri));
            if (SerialNumber != null)
                XDoc.WriteElementString("serialNumber", SerialNumber);
            XDoc.WriteElementString("UDN", "uuid:" + UniqueDeviceName);

            /*
            if (_icon != null)
            {
                lock (_icon)
                {
                    XDoc.WriteStartElement("iconList");
                    XDoc.WriteStartElement("icon");
                    XDoc.WriteElementString("mimetype", "image/png");
                    XDoc.WriteElementString("width", _icon.Width.ToString());
                    XDoc.WriteElementString("height", _icon.Height.ToString());
                    XDoc.WriteElementString("depth", System.Drawing.Image.GetPixelFormatSize(_icon.PixelFormat).ToString());
                    XDoc.WriteElementString("url", "/icon.png");
                    XDoc.WriteEndElement();

                    XDoc.WriteStartElement("icon");
                    XDoc.WriteElementString("mimetype", "image/jpg");
                    XDoc.WriteElementString("width", _icon.Width.ToString());
                    XDoc.WriteElementString("height", _icon.Height.ToString());
                    XDoc.WriteElementString("depth", System.Drawing.Image.GetPixelFormatSize(_icon.PixelFormat).ToString());
                    XDoc.WriteElementString("url", "/icon.jpg");
                    XDoc.WriteEndElement();

                    if (_icon2 != null)
                    {
                        XDoc.WriteStartElement("icon");
                        XDoc.WriteElementString("mimetype", "image/png");
                        XDoc.WriteElementString("width", _icon2.Width.ToString());
                        XDoc.WriteElementString("height", _icon2.Height.ToString());
                        XDoc.WriteElementString("depth", System.Drawing.Image.GetPixelFormatSize(_icon.PixelFormat).ToString());
                        XDoc.WriteElementString("url", "/icon2.png");
                        XDoc.WriteEndElement();

                        XDoc.WriteStartElement("icon");
                        XDoc.WriteElementString("mimetype", "image/jpg");
//.........这里部分代码省略.........
开发者ID:genielabs,项目名称:intel-upnp-dlna,代码行数:101,代码来源:UPnPDevice.cs

示例11: CreateItemFromFormatedNameFile

        // For files with filenames that have the format: "creator - title"
        private DvMediaItem CreateItemFromFormatedNameFile(FileInfo file)
        {
            string mime, mediaClass;
            MimeTypes.ExtensionToMimeType(file.Extension, out mime, out mediaClass);

            string protInfo = new System.Text.StringBuilder().AppendFormat("http-get:*:{0}:*", mime).ToString();
            string ct = Path.GetFileNameWithoutExtension(file.Name);

            DText DT = new DText();
            DT.ATTRMARK = "-";
            string title;
            string creator;

            DT[0] = ct;
            if (DT.DCOUNT() == 1)
            {
                creator = "";
                title = DT[1].Trim();
            }
            else
            {
                creator = DT[1].Trim();
                title = DT[2].Trim();
            }

            MediaBuilder.item info = new MediaBuilder.item(title);
            info.creator = creator;
            DvMediaItem newMedia = DvMediaBuilder.CreateItem(info);

            //DvMediaResource res = DvResourceBuilder.CreateResource_HttpGet(file,false);
            ResourceBuilder.VideoItem resInfo = new ResourceBuilder.VideoItem();
            resInfo.contentUri = DvMediaResource.AUTOMAPFILE + file.FullName;
            resInfo.protocolInfo = new ProtocolInfoString(protInfo);
            resInfo.size = new _ULong((ulong)file.Length);
            DvMediaResource res = DvResourceBuilder.CreateResource(resInfo, true);
            res.Tag = file;
            newMedia.AddResource(res);

            return newMedia;
        }
开发者ID:amadare,项目名称:DeveloperToolsForUPnP,代码行数:41,代码来源:MediaServerCore.cs

示例12: ParseComplexType_SequenceChoice

        private static ItemCollection ParseComplexType_SequenceChoice(XmlTextReader X)
        {
            bool done = false;
            ItemCollection RetVal = null;
            string elementName = X.LocalName;
            DText p = new DText();
            p.ATTRMARK = ":";

            if (X.LocalName == "choice")
            {
                RetVal = new Choice();
            }
            else
            {
                RetVal = new Sequence();
            }

            if (X.HasAttributes)
            {
                for (int i = 0; i < X.AttributeCount; i++)
                {
                    X.MoveToAttribute(i);
                    switch (X.LocalName)
                    {
                    case "minOccurs":
                        RetVal.MinOccurs = X.Value;
                        break;
                    case "maxOccurs":
                        RetVal.MaxOccurs = X.Value;
                        break;
                    }
                }
                X.MoveToElement();
            }
            X.Read();

            do
            {
                switch (X.NodeType)
                {
                case XmlNodeType.Element:
                    switch (X.LocalName)
                    {
                    case "group":
                        if (X.HasAttributes)
                        {
                            for (int i = 0; i < X.AttributeCount; i++)
                            {
                                X.MoveToAttribute(i);
                                switch (X.LocalName)
                                {
                                case "ref":
                                    string sample = X.Value;
                                    break;
                                }
                            }
                            X.MoveToElement();
                        }
                        break;
                    case "sequence":
                    case "choice":
                        RetVal.AddCollection(ParseComplexType_SequenceChoice(X));
                        break;
                    case "element":
                        RetVal.AddContentItem(new Element());
                        if (X.HasAttributes)
                        {
                            for (int i = 0; i < X.AttributeCount; i++)
                            {
                                X.MoveToAttribute(i);
                                switch (X.LocalName)
                                {
                                case "name":
                                    RetVal.CurrentItem.Name = X.Value;
                                    break;
                                case "type":
                                    p[0] = X.Value;
                                    if (p.DCOUNT() == 1)
                                    {
                                        RetVal.CurrentItem.Type = X.Value;
                                        RetVal.CurrentItem.TypeNS = X.LookupNamespace("");
                                    }
                                    else
                                    {
                                        RetVal.CurrentItem.Type = p[2];
                                        RetVal.CurrentItem.TypeNS = X.LookupNamespace(p[1]);
                                    }
                                    break;
                                case "minOccurs":
                                    RetVal.CurrentItem.MinOccurs = X.Value;
                                    break;
                                case "maxOccurs":
                                    RetVal.CurrentItem.MaxOccurs = X.Value;
                                    break;
                                }
                            }
                            X.MoveToElement();
                        }
                        break;
                    case "attribute":
//.........这里部分代码省略.........
开发者ID:genielabs,项目名称:intel-upnp-dlna,代码行数:101,代码来源:UPnPComplexType.cs

示例13: networkOpenMenuItem_Click

        private void networkOpenMenuItem_Click(object sender, System.EventArgs e)
        {
            UPnPDeviceLocator devicelocator = new UPnPDeviceLocator();
            if (devicelocator.ShowDialog(this) == DialogResult.OK && devicelocator.SelectedDevice != null)
            {
                //				ClearTreeNodeTags(deviceRootTreeNode);
                //				deviceRootTreeNode.Text = devicelocator.SelectedDevice.FriendlyName;
                //				treeView.Nodes.Clear();
                //				deviceRootTreeNode.Nodes.Clear();

                UPnPDevice device = UPnPDevice.CreateRootDevice(6000, 1.0, ".");
                device.FriendlyName = devicelocator.SelectedDevice.FriendlyName;
                device.DeviceURN = devicelocator.SelectedDevice.DeviceURN;
                device.Manufacturer = devicelocator.SelectedDevice.Manufacturer;
                device.ManufacturerURL = devicelocator.SelectedDevice.ManufacturerURL;
                device.ModelDescription = devicelocator.SelectedDevice.ModelDescription;
                device.ModelName = devicelocator.SelectedDevice.ModelName;
                device.ModelNumber = devicelocator.SelectedDevice.ModelNumber;
                device.ProductCode = devicelocator.SelectedDevice.ProductCode;
                device.SerialNumber = devicelocator.SelectedDevice.SerialNumber;
                device.User = new ServiceGenerator.Configuration("UPnP", ServiceGenerator.ConfigurationType.DEVICE);

                TreeNode n = new TreeNode(device.FriendlyName);
                n.Tag = device;

                treeView.Nodes.Add(n);

                foreach (UPnPDevice embeddeddevice in devicelocator.SelectedDevice.EmbeddedDevices)
                {
                    AddEmbeddedDevice(n, embeddeddevice);
                }

                foreach (UPnPService service in devicelocator.SelectedDevice.Services)
                {
                    DText p = new DText();
                    p.ATTRMARK = ":";

                    string servicename = service.ServiceURN;
                    p[0] = servicename;

                    servicename = p[p.DCOUNT() - 1];

                    service.User = new ServiceGenerator.ServiceConfiguration(servicename, service);
                    TreeNode serviceTreeNode = new TreeNode(servicename, 2, 2);
                    serviceTreeNode.Tag = service;
                    n.Nodes.Add(serviceTreeNode);
                }

                treeView.SelectedNode = n;
                selectedItem = n.Tag;
                n.Expand();

                this.Text = AppTitle;
                saveMenuItem.Enabled = false;
                saveAsMenuItem.Enabled = true;

                treeView_AfterSelect(this, null);
                updateStatusText();
            }
        }
开发者ID:evolution124,项目名称:Developer-Tools-for-UPnP-Technologies,代码行数:60,代码来源:MainForm.cs

示例14: ParseComplexType

        private static UPnPComplexType ParseComplexType(XmlTextReader X, UPnPComplexType RetVal)
        {
            string elementName = X.LocalName;
            int count = 0;
            bool done = false;
            DText P = new DText();
            P.ATTRMARK = ":";

            RetVal.AddContainer(new GenericContainer());

            do
            {
                switch (X.NodeType)
                {
                case XmlNodeType.Element:
                    switch (X.LocalName)
                    {
                    case "complexType":
                    case "group":
                        ++count;
                        if (X.HasAttributes)
                        {
                            for (int i = 0; i < X.AttributeCount; i++)
                            {
                                X.MoveToAttribute(i);
                                if (X.Name == "name")
                                {
                                    P[0] = X.Value;
                                    if (P.DCOUNT() == 1)
                                    {
                                        RetVal.LocalName = X.Value;
                                        RetVal.NameSpace = X.LookupNamespace("");
                                    }
                                    else
                                    {
                                        RetVal.LocalName = P[2];
                                        RetVal.NameSpace = X.LookupNamespace(P[1]);
                                    }
                                }
                                else if (X.Name == "ref")
                                {
                                    // NOP
                                }
                            }
                            X.MoveToElement();
                        }
                        break;
                    case "sequence":
                    case "choice":
                        RetVal.CurrentContainer.AddCollection(ParseComplexType_SequenceChoice(X));
                                //ParseComplexType_Sequence(X,RetVal);
                        break;
                    case "complexContent":
                        RetVal.AddContainer(new ComplexContent());
                        break;
                    case "simpleContent":
                        RetVal.AddContainer(new SimpleContent());
                        break;
                    case "restriction":
                        Restriction r = new Restriction();
                        if (RetVal.CurrentContainer.GetType() == typeof(ComplexContent))
                        {
                            ((ComplexContent)RetVal.CurrentContainer).RestExt = r;
                        }
                        else if (RetVal.CurrentContainer.GetType() == typeof(SimpleContent))
                        {
                            ((SimpleContent)RetVal.CurrentContainer).RestExt = r;
                        }
                        if (X.HasAttributes)
                        {
                            for (int i = 0; i < X.AttributeCount; i++)
                            {
                                X.MoveToAttribute(i);
                                if (X.Name == "base")
                                {
                                    P[0] = X.Value;
                                    if (P.DCOUNT() == 1)
                                    {
                                        r.baseType = X.Value;
                                        r.baseTypeNS = X.LookupNamespace("");
                                    }
                                    else
                                    {
                                        r.baseType = P[2];
                                        r.baseTypeNS = X.LookupNamespace(P[1]);
                                    }
                                }
                            }
                            X.MoveToElement();
                        }
                        break;
                    }
                    break;
                case XmlNodeType.EndElement:
                    if (X.LocalName == elementName)
                    {
                        --count;
                        if (count == 0)
                        {
                            done = true;
//.........这里部分代码省略.........
开发者ID:genielabs,项目名称:intel-upnp-dlna,代码行数:101,代码来源:UPnPComplexType.cs

示例15: UpdateProtocolInfoSet

        /// <summary>
        /// This method changes the source or sink protocolInfo sets 
        /// for the media server.
        /// </summary>
        /// <param name="sourceProtocolInfo">true, if changing source protocolInfo set</param>
        /// <param name="protocolInfoSet">new protocolInfo strings, separated by commas</param>
        private void UpdateProtocolInfoSet(bool sourceProtocolInfo, string protocolInfoSet)
        {
            DText parser = new DText();
            parser.ATTRMARK = ",";
            parser[0] = protocolInfoSet;

            int cnt = parser.DCOUNT();
            ArrayList prots = new ArrayList();

            for (int i=1; i <= cnt; i++)
            {
                string val = parser[i].Trim();

                if (val != "")
                {
                    ProtocolInfoString protInfo = new ProtocolInfoString("*:*:*:*");
                    bool error = false;
                    try
                    {
                        protInfo = new ProtocolInfoString(val);
                    }
                    catch
                    {
                        error = true;
                    }

                    if (error == false)
                    {
                        prots.Add(protInfo);
                    }
                }
            }

            ProtocolInfoString[] protArray = null;

            if (prots.Count > 0)
            {
                protArray = (ProtocolInfoString[]) prots.ToArray(prots[0].GetType());
            }

            this.UpdateProtocolInfoSet(sourceProtocolInfo, protArray);
        }
开发者ID:amadare,项目名称:DeveloperToolsForUPnP,代码行数:48,代码来源:MediaServerDevice.cs


注:本文中的OpenSource.UPnP.DText.DCOUNT方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。