示例#1
0
        // Источник исходного кода: https://www.codeproject.com/Articles/4544/Insert-Plain-Text-and-Images-into-RichTextBox-at-R
        // Insert Plain Text and Images into RichTextBox at Runtime

        /// <summary>
        /// Initializes the text colors, creates dictionaries for RTF colors and
        /// font families, and stores the horizontal and vertical resolution of
        /// the RichTextBox's graphics context.
        /// </summary>
        public RichTextBoxCustom() : base()
        {
            // Initialize default text and background colors
            textColor      = RtfColor.Black;
            highlightColor = RtfColor.White;

            // Initialize the dictionary mapping color codes to definitions
            rtfColor = new System.Collections.Specialized.HybridDictionary();
            rtfColor.Add(RtfColor.Aqua, RtfColorDef.Aqua);
            rtfColor.Add(RtfColor.Black, RtfColorDef.Black);
            rtfColor.Add(RtfColor.Blue, RtfColorDef.Blue);
            rtfColor.Add(RtfColor.Fuchsia, RtfColorDef.Fuchsia);
            rtfColor.Add(RtfColor.Gray, RtfColorDef.Gray);
            rtfColor.Add(RtfColor.Green, RtfColorDef.Green);
            rtfColor.Add(RtfColor.Lime, RtfColorDef.Lime);
            rtfColor.Add(RtfColor.Maroon, RtfColorDef.Maroon);
            rtfColor.Add(RtfColor.Navy, RtfColorDef.Navy);
            rtfColor.Add(RtfColor.Olive, RtfColorDef.Olive);
            rtfColor.Add(RtfColor.Purple, RtfColorDef.Purple);
            rtfColor.Add(RtfColor.Red, RtfColorDef.Red);
            rtfColor.Add(RtfColor.Silver, RtfColorDef.Silver);
            rtfColor.Add(RtfColor.Teal, RtfColorDef.Teal);
            rtfColor.Add(RtfColor.White, RtfColorDef.White);
            rtfColor.Add(RtfColor.Yellow, RtfColorDef.Yellow);

            // Initialize the dictionary mapping default Framework font families to
            // RTF font families
            rtfFontFamily = new System.Collections.Specialized.HybridDictionary();
            rtfFontFamily.Add(FontFamily.GenericMonospace.Name, RtfFontFamilyDef.Modern);
            rtfFontFamily.Add(FontFamily.GenericSansSerif, RtfFontFamilyDef.Swiss);
            rtfFontFamily.Add(FontFamily.GenericSerif, RtfFontFamilyDef.Roman);
            rtfFontFamily.Add(FF_UNKNOWN, RtfFontFamilyDef.Unknown);
        }
示例#2
0
        private void initBiList()
        {
            string bi;

            StreamReader sr = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("AdaptiveAlgorithm.confuse_data.txt"));

            while (sr.Peek() > -1)
            {
                bi = sr.ReadLine();



                if (h.Contains(bi.Substring(0, 2) + " " + bi.Substring(3, 2)))
                {
                }
                else
                {
                    h.Add(bi.Substring(0, 2) + " " + bi.Substring(3, 2), 1);
                }

                if (h.Contains(bi.Substring(3, 2) + " " + bi.Substring(0, 2)))
                {
                }
                else
                {
                    h.Add(bi.Substring(3, 2) + " " + bi.Substring(0, 2), 1);
                }
            }
            sr.Close();
        }
示例#3
0
        /// <summary>
        /// 获取实例
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        /// <returns></returns>
        public static TcpHost GetInstence(string ip = "127.0.0.1", int port = 12333)
        {
            if (tcpHosts == null)
            {
                tcpHosts = new System.Collections.Specialized.HybridDictionary();
            }

            TcpHost tcpHost = null;
            var     key     = ip + ":" + port;

            lock (tcpHosts)
            {
                if (tcpHosts.Contains(key))
                {
                    tcpHost = tcpHosts[key] as TcpHost;
                }
            }

            if (tcpHost == null)
            {
                tcpHost      = new TcpHost();
                tcpHost.IP   = ip;
                tcpHost.Port = port;
                tcpHost.Connection();
                lock (tcpHosts)
                {
                    tcpHosts.Add(key, tcpHost);
                }
            }

            return(tcpHost);
        }
示例#4
0
        /// <summary>
        /// 获取实例
        /// </summary>
        /// <param name="ip"></param>
        /// <param name="port"></param>
        /// <returns></returns>
        public static UdpHost GetInstence(string ip = "127.0.0.1", int port = 12333)
        {
            if (udpHosts == null)
            {
                udpHosts = new System.Collections.Specialized.HybridDictionary();
            }

            UdpHost udpHost = null;
            var     key     = ip + ":" + port;

            lock (udpHosts)
            {
                if (udpHosts.Contains(key))
                {
                    udpHost = udpHosts[key] as UdpHost;
                }
            }

            if (udpHost == null)
            {
                udpHost      = new UdpHost();
                udpHost.IP   = ip;
                udpHost.Port = port;
                udpHost.Receive();
                udpHost.Connection();
                lock (udpHosts)
                {
                    udpHosts.Add(key, udpHost);
                }
            }

            return(udpHost);
        }
        ///<summary>Validator deligate checks that there are no duplicate entries.</summary>
        protected void CheckDuplicate(ValidatorAttribute Source, ValidatingSerializerEventArgs e)
        {
            bool   IsValid = true;
            string key     = String.Empty;

            System.Collections.Specialized.HybridDictionary CheckList = new System.Collections.Specialized.HybridDictionary();

            foreach (InsuranceLineItem C in this)
            {
                key = C.ProductType.ToString() + " " + C.Policy + " " + C.RevenueType.ToString();
                if (CheckList.Contains(key))
                {
                    IsValid = false;
                }
                else
                {
                    CheckList.Add(key, C.RevenueType);
                }

                if (IsValid == false)
                {
                    e.Error = new ErrorInfo(Source, "Duplicates");
                }
            }
        }
示例#6
0
        public DataTable GetUserinfo(string username, string password)
        {
            DataTable Result = new DataTable();

            try
            {
                System.Collections.Specialized.HybridDictionary Parameters = new System.Collections.Specialized.HybridDictionary();
                Parameters.Add("user", username);
                Parameters.Add("pwd", password);
                Result = helper.ReturnDataTable("sp_getuserinfo", Parameters);
            }
            catch (Exception ex)
            {
                throw;
            }
            return(Result);
        }
示例#7
0
        public int Addrelease(string releaseticketno, string username)
        {
            int Result = -1;

            try
            {
                System.Collections.Specialized.HybridDictionary Parameters = new System.Collections.Specialized.HybridDictionary();
                Parameters.Add("releaseticketno", releaseticketno);
                Parameters.Add("username", username);

                Result = helper.ExecuteNonQuery("sp_addreleaseticket", Parameters);
            }
            catch (Exception ex)
            {
                throw;
            }
            return(Result);
        }
        /// <summary>
        /// Read in the arguments from the .xml file that we be used to run our model
        /// </summary>
        /// <param name="xmlPathFile">The full path and filename of the .xml file. Example: "C:\gp\RunModel.xml"</param>
        /// <returns>A HybridDictionary that contains the arguments to run our model.</returns>
        /// <remarks></remarks>
        public static System.Collections.Specialized.HybridDictionary ReadXMLConfigurationFile(System.String xmlPathFile)
        {
            System.Collections.Specialized.HybridDictionary modelParametersHybridDictionary = new System.Collections.Specialized.HybridDictionary();

            try
            {
                //Read the XML configuration file
                System.Xml.XmlDocument XMLdoc = new System.Xml.XmlDocument();
                XMLdoc.Load(xmlPathFile);

                // MY_CUSTOM_TOOLBOX
                System.Xml.XmlNode xMY_CUSTOM_TOOLBOX = XMLdoc["MY_CUSTOM_TOOLBOX"];

                // GolfFinder
                System.Xml.XmlNode xGolfFinder = xMY_CUSTOM_TOOLBOX["GolfFinder"];

                // BufferDistance
                System.Xml.XmlNode xBufferDistance = xGolfFinder["BufferDistance"];
                modelParametersHybridDictionary.Add("BufferDistance", xBufferDistance.InnerText);

                // Airports
                System.Xml.XmlNode xAirports = xGolfFinder["Airports"];
                modelParametersHybridDictionary.Add("Airports", xAirports.InnerText);

                // Golf
                System.Xml.XmlNode xGolf = xGolfFinder["Golf"];
                modelParametersHybridDictionary.Add("Golf", xGolf.InnerText);

                // AirportBuffer
                System.Xml.XmlNode xAirportBuffer = xGolfFinder["AirportBuffer"];
                modelParametersHybridDictionary.Add("AirportBuffer", xAirportBuffer.InnerText);

                // GolfNearAirports
                System.Xml.XmlNode xGolfNearAirports = xGolfFinder["GolfNearAirports"];
                modelParametersHybridDictionary.Add("GolfNearAirports", xGolfNearAirports.InnerText);

                return(modelParametersHybridDictionary);
            }
            catch (Exception ex)
            {
                //The XML read was unsuccessful. Return an empty HybridDictionary
                return(modelParametersHybridDictionary);
            }
        }
示例#9
0
        public DataTable Getbuildlogurl(string Type, string environment, string component, string version)
        {
            DataTable Result = new DataTable();

            try
            {
                System.Collections.Specialized.HybridDictionary Parameters = new System.Collections.Specialized.HybridDictionary();
                Parameters.Add("typename", Type);
                Parameters.Add("environmentname", environment);
                Parameters.Add("componentname", component);
                Parameters.Add("versionname", version);

                Result = helper.ReturnDataTable("sp_getdeployementdetails", Parameters);
            }
            catch (Exception ex)
            {
                throw;
            }
            return(Result);
        }
示例#10
0
 private void TestAvailableCultures()
 {
     availablecultures = new System.Collections.Specialized.HybridDictionary();
     foreach (System.Globalization.CultureInfo item in System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.AllCultures))
     {
         if (!item.Equals(System.Globalization.CultureInfo.InvariantCulture) && !availablecultures.Contains(item.Name) && resources.GetResourceSet(item, true, false) != null)
         {
             availablecultures.Add(item.Name, item.EnglishName);
         }
     }
 }
示例#11
0
 private void SpyWindow_Load(object sender, EventArgs e)
 {
     string[] enums  = Enum.GetNames(typeof(ShoWinCS.Win32.WindowMessages));
     int[]    values = (int[])Enum.GetValues(typeof(ShoWinCS.Win32.WindowMessages));
     for (int i = 0; i < enums.Length; i++)
     {
         myHibridDictionary.Add(enums[i], values[i]);
         comboBox_WmMessages.Items.Add(enums[i].ToString());
     }
     comboBox_WmMessages.Text = comboBox_WmMessages.Items[8].ToString();
 }
示例#12
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            var settings = LogCategoryConfigSection.GetConfig();

            if (settings == null)
            {
                throw new System.Configuration.ConfigurationErrorsException("未找到日志类别配置");
            }

            var nodeGenerl = new DeluxeTreeNode("用户操作", "G")
            {
                Expanded = true
            };

            var nodeAd = new DeluxeTreeNode("活动目录同步", "AD")
            {
                Expanded     = true,
                NodeCloseImg = "../images/ad.png",
                NodeOpenImg  = "../images/ad.png"
            };

            var nodeAdReverse = new DeluxeTreeNode("活动目录反向同步", "RAD");

            this.tree.Nodes.Add(nodeGenerl);
            this.tree.Nodes.Add(nodeAd);
            this.tree.Nodes.Add(nodeAdReverse);

            System.Collections.Specialized.HybridDictionary dic = new System.Collections.Specialized.HybridDictionary();

            foreach (LogCategoryConfigurationElement item in settings.Categories)
            {
                var node = new DeluxeTreeNode(item.Title, nodeGenerl.Value + "." + item.Name);
                node.Expanded = false;
                nodeGenerl.Nodes.Add(node);
                dic.Add(item.Name, node);
            }

            var categoris = LogCategoryAdapter.Instance.LoadCategories();

            foreach (var item in categoris)
            {
                if (dic.Contains(item.Category))
                {
                    var nodeParent = (DeluxeTreeNode)dic[item.Category];

                    var node = new DeluxeTreeNode(item.Description, nodeParent.Value + "." + item.OperationType);
                    nodeParent.Nodes.Add(node);
                }
            }
        }
示例#13
0
		protected override void OnPreRender(EventArgs e)
		{
			base.OnPreRender(e);

			var settings = LogCategoryConfigSection.GetConfig();

			if (settings == null)
				throw new System.Configuration.ConfigurationErrorsException("未找到日志类别配置");

			var nodeGenerl = new DeluxeTreeNode("用户操作", "G")
			{
				Expanded = true
			};

			var nodeAd = new DeluxeTreeNode("活动目录同步", "AD")
			{
				Expanded = true,
				NodeCloseImg = "../images/ad.png",
				NodeOpenImg = "../images/ad.png"
			};

			var nodeAdReverse = new DeluxeTreeNode("活动目录反向同步", "RAD");

			this.tree.Nodes.Add(nodeGenerl);
			this.tree.Nodes.Add(nodeAd);
			this.tree.Nodes.Add(nodeAdReverse);

			System.Collections.Specialized.HybridDictionary dic = new System.Collections.Specialized.HybridDictionary();

			foreach (LogCategoryConfigurationElement item in settings.Categories)
			{
				var node = new DeluxeTreeNode(item.Title, nodeGenerl.Value + "." + item.Name);
				node.Expanded = false;
				nodeGenerl.Nodes.Add(node);
				dic.Add(item.Name, node);
			}

			var categoris = LogCategoryAdapter.Instance.LoadCategories();

			foreach (var item in categoris)
			{
				if (dic.Contains(item.Category))
				{
					var nodeParent = (DeluxeTreeNode)dic[item.Category];

					var node = new DeluxeTreeNode(item.Description, nodeParent.Value + "." + item.OperationType);
					nodeParent.Nodes.Add(node);
				}
			}
		}
示例#14
0
        private void initBiList()
        {
            string bi;

            string[]     pieces;
            StreamReader sr = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("AdaptiveAlgorithm.confuse_data.txt"));

            while (sr.Peek() > -1)
            {
                bi     = sr.ReadLine();
                pieces = bi.Split(new Char[] { ' ' });
                h.Add(pieces[0] + " " + pieces[1], 1);
            }
            sr.Close();
        }
示例#15
0
        public DataTable Getreleasedetails(string releaseno)
        {
            DataTable Result = new DataTable();

            try
            {
                System.Collections.Specialized.HybridDictionary Parameters = new System.Collections.Specialized.HybridDictionary();
                Parameters.Add("releasename", releaseno);

                Result = helper.ReturnDataTable("sp_getreleasedetails", Parameters);
            }
            catch (Exception ex)
            {
                throw;
            }
            return(Result);
        }
示例#16
0
        public DataTable Getbuildversion(string component)
        {
            DataTable Result = new DataTable();

            try
            {
                System.Collections.Specialized.HybridDictionary Parameters = new System.Collections.Specialized.HybridDictionary();
                Parameters.Add("componentname", component);

                Result = helper.ReturnDataTable("sp_getbuildversionformapping", Parameters);
            }
            catch (Exception ex)
            {
                throw;
            }
            return(Result);
        }
示例#17
0
        public DataTable Getdeployementdata(string Type)
        {
            DataTable Result = new DataTable();

            try
            {
                System.Collections.Specialized.HybridDictionary Parameters = new System.Collections.Specialized.HybridDictionary();
                Parameters.Add("typename", Type);

                Result = helper.ReturnDataTable("sp_getdeployementdetails", Parameters);
            }
            catch (Exception ex)
            {
                throw;
            }
            return(Result);
        }
示例#18
0
        /// <summary>
        /// Parses the InnerMarkup as data nodes
        /// </summary>
        /// <returns></returns>
        protected System.Collections.Specialized.HybridDictionary ParseElementValues()
        {
            if (elementValuesParsed)
            {
                return(ElementValues);
            }
            elementValuesParsed = true;

            if (!IsParsed)
            {
                this.Parse();
            }
            if (IsEmptyTag || !InnerMarkup.Contains("<"))
            {
                _elementValues = new System.Collections.Specialized.HybridDictionary();
                return(ElementValues);
            }
            //TODO - Replace with brute force parser
            try
            {
                _elementValues = new System.Collections.Specialized.HybridDictionary();
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(this.RawTag);
                XmlNode rootElement = doc.SelectSingleNode("/*");

                for (int i = 0; i < rootElement.ChildNodes.Count; i++)
                {
                    XmlNode node = rootElement.ChildNodes.Item(i);
                    if (_elementValues.Contains(node.Name))
                    {
                        _elementValues[node.Name] += node.InnerXml;
                    }
                    else
                    {
                        _elementValues.Add(node.Name, node.InnerXml);
                    }
                }
            }
            catch
            {
                _elementValues = new System.Collections.Specialized.HybridDictionary();
                return(ElementValues);
            }
            return(ElementValues);
        }
示例#19
0
        public System.Collections.Generic.Dictionary <RecordType, DnsCacheMessageEntry> this[string key] {
            get {
                if (!list.Contains(key))
                {
                    return(null);
                }

                return((System.Collections.Generic.Dictionary <RecordType, DnsCacheMessageEntry>)list[key]);
            }
            set {
                if (!list.Contains(key))
                {
                    list.Add(key, value);
                }
                else
                {
                    list[key] = value;
                }
            }
        }
示例#20
0
        public static System.Collections.Specialized.HybridDictionary GetSchemaCatgoryDictionary()
        {
            System.Collections.Specialized.HybridDictionary dic = null;

            if (HttpContext.Current.Items.Contains(Util.TheDicKey) == false)
            {
                dic = new System.Collections.Specialized.HybridDictionary();

                foreach (ObjectSchemaConfigurationElement schema in ObjectSchemaSettings.GetConfig().Schemas)
                {
                    dic.Add(schema.Name, schema.Category);
                }

                HttpContext.Current.Items.Add(Util.TheDicKey, dic);
            }
            else
            {
                dic = (System.Collections.Specialized.HybridDictionary)HttpContext.Current.Items[Util.TheDicKey];
            }

            return(dic);
        }
示例#21
0
        /// <summary>
        /// Sets a new attribute value
        /// </summary>
        /// <param name="name"></param>
        /// <param name="value"></param>
        public void SetAttribute(string name, string value)
        {
            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            if (name.IndexOf(' ') > -1)
            {
                name = name.Trim();
            }

            if (null == _attributes)
            {
                _attributes = new System.Collections.Specialized.HybridDictionary();
                _attributesCaseSensitive = new System.Collections.Specialized.HybridDictionary();
            }

            string invariantName = name.ToLowerInvariant();

            if (_attributes.Contains(invariantName))
            {
                _attributes[invariantName] = value;
            }
            else
            {
                _attributes.Add(invariantName, value);
            }

            if (_attributesCaseSensitive.Contains(name))
            {
                _attributesCaseSensitive[name] = value;
            }
            else
            {
                _attributesCaseSensitive.Add(name, value);
            }
        }
 public void testMapKeys()
 {
 StringTemplateGroup group = new StringTemplateGroup("test", typeof(AngleBracketTemplateLexer));
 StringTemplate t = new StringTemplate(group, "<aMap.keys:{k|<k>:<aMap.(k)>}; separator=\", \">");
 HybridDictionary map = new HybridDictionary();
 map.Add("int", "0");
 map.Add("float", "0.0");
 t.SetAttribute("aMap", map);
 Assert.AreEqual("int:0, float:0.0", t.ToString());
 }
 public virtual void testLengthOpWithHybridDictionary()
 {
 StringTemplate e = new StringTemplate("$length(names)$");
 e = e.GetInstanceOf();
 IDictionary m = new HybridDictionary();
 m.Add("Tom", "Tom");
 m.Add("Sriram", "Sriram");
 m.Add("Doug", "Doug");
 e.SetAttribute("names", m);
 string expecting = "3";
 Assert.AreEqual(expecting, e.ToString());
 }
            public virtual void testDumpHashtableAndHybridDictionary()
            {
            StringTemplate st = new StringTemplate("$items; separator=\",\"$");
            IDictionary m = new Hashtable();
            m["a"] = "1";
            m["b"] = "2";
            m["c"] = "3";
            st.SetAttribute("items", m);
            string expecting = "1,2,3";
            Assert.AreEqual(expecting, st.ToString());

            st = st.GetInstanceOf();
            IDictionary s = new HybridDictionary();
            s.Add("1", "1");
            s.Add("2", "2");
            s.Add("3", "3");
            st.SetAttribute("items", s);
            expecting = "1,2,3";
            Assert.AreEqual(expecting, st.ToString());
            }
            public virtual void testApplyAnonymousTemplateToHashtableAndHybridDictionary()
            {
            StringTemplate st = new StringTemplate("$items:{<li>$it$</li>}$");
            IDictionary m = new Hashtable();
            m["a"] = "1";
            m["b"] = "2";
            m["c"] = "3";
            st.SetAttribute("items", m);
            string expecting = "<li>1</li><li>2</li><li>3</li>";
            Assert.AreEqual(expecting, st.ToString());

            st = st.GetInstanceOf();
            IDictionary s = new HybridDictionary();
            s.Add("1", "1");
            s.Add("2", "2");
            s.Add("3", "3");
            st.SetAttribute("items", s);
            expecting = "<li>1</li><li>2</li><li>3</li>";
            Assert.AreEqual(expecting, st.ToString());
            }
示例#26
0
        private void btnView_Click(object sender, System.EventArgs e)
        {
            frmSessionPlayback frmSP = new frmSessionPlayback();
            if(lvSearchResults.SelectedItems[0].Tag is OCL.RecordingSession)
            {
                try
                {
                    //					if(PreviewPlayer.IsUMPlayer)
                    //						((AxUMediaControlLib.AxUMediaPlayer)PreviewPlayer.Player).Stop();
                    //					else
                    ((AxWMPLib.AxWindowsMediaPlayer)PreviewPlayer.Player).Ctlcontrols.stop();
                }
                catch(Exception Err)
                {
                    string peek = Err.Message;
                }

                System.Collections.Specialized.HybridDictionary RecordingCollection = new System.Collections.Specialized.HybridDictionary(false);

                OCL.RecordingSession RS = (OCL.RecordingSession)lvSearchResults.SelectedItems[0].Tag;
                bool IsPresentation = RS.IsPresentation;
                frmSP.PreviewPlayer.Text = RS.Description;
                frmSP.RS = RS;
                int CamCount = 0;
                foreach(OCL.Recording R in RS.CurrentRecordings(LUser))
                {
                    OCL.VideoStorageServer VSS2 = R.CurrentVideoStorageServer;
                    string sDirectory = @"\Data";
                    try
                    {
                        string[] checkPath = VSS2.FileStorageDirectory.Split(@"\".ToCharArray());
                        if(checkPath[0] == "")
                            sDirectory = VSS2.FileStorageDirectory;
                        else
                            sDirectory = @"\" + VSS2.FileStorageDirectory;
                        if(checkPath.Length > 1)
                        {
                            if(checkPath[checkPath.Length - 1] != @"")
                                sDirectory += @"\";
                        }
                    }
                    catch(Exception Err)
                    {
                        String peekThisFunky = Err.Message;
                    }
                    string sURL = sLocalDrive + sDirectory + R.Description;
                    OysterPlaybackControls.PlayListItem PLI = null;
                    PreviewPlayer.CurrentPlayerType = OysterPlaybackControls.PlayerType.WindowMediaPlayer;
                    //					if(PreviewPlayer.IsUMPlayer)
                    //					{
                    //						PLI = new OysterPlaybackControls.PlayListItem(R.DisplayName,OysterPlaybackControls.PlaybackTransportType.TCP,
                    //							OysterPlaybackControls.PlaybackMediaType.File,sURL,VSS2.ControlAddress,VSS2.ControlPort);
                    //					}
                    //					else
                {
                    PLI = new OysterPlaybackControls.PlayListItem(R.DisplayName,OysterPlaybackControls.PlaybackTransportType.WMPStream,
                        OysterPlaybackControls.PlaybackMediaType.WMPFile,sURL,VSS2.ControlAddress,VSS2.ControlPort);
                }

                    //frmSP.PreviewPlayer.PlayList.Add(PLI);

                    /// IF CURRENT RECORDING IS THE DEFAULT CAMERA THEN SET THE PLAYLIST TO SHOW THIS RECORDING FIRST
                    if(R.IsPrimaryCamera)
                    {
                        RecordingCollection.Add("Primary",PLI);
                        //frmSP.PreviewPlayer.CurrentPlayListItem = frmSP.PreviewPlayer.PlayList.Count  - 1;
                    }
                    else if(R.IsDesktopCapture)
                    {
                        RecordingCollection.Add("Presentation",PLI);
                        //frmSP.psPlayer.Add(R.DisplayName,PLI,true);
                    }
                    else
                    {
                        RecordingCollection.Add("Camera" + CamCount.ToString(),PLI);
                        CamCount++;
                        //frmSP.psPlayer.Add(R.DisplayName,PLI,true);
                    }
                }
                ///////////////////////////////////////////////////////
                /// Load appropriate PlayerWindows in the correct Order
                OysterPlaybackControls.PlayListItem StoredPLI = null;
                /// Primary Camera
                if((StoredPLI = RetrieveRecording(RecordingCollection,"Primary")) != null)
                {
                    frmSP.PreviewPlayer.PlayList.Add(StoredPLI);
                }

                /// All Non-Primary Cameras
                for(int i=0;i<CamCount;i++)
                {
                    if((StoredPLI = RetrieveRecording(RecordingCollection,"Camera" + i.ToString())) != null)
                    {
                        frmSP.PreviewPlayer.PlayList.Add(StoredPLI);
                        if(!RS.IsPresentation)
                        {
                            frmSP.psPlayer.Add(StoredPLI.Name,StoredPLI,true);
                        }
                    }
                }

                /// Presentation Capture
                if((StoredPLI = RetrieveRecording(RecordingCollection,"Presentation")) != null)
                {
                    frmSP.PreviewPlayer.PlayList.Add(StoredPLI);
                    frmSP.psPlayer.Add(StoredPLI.Name,StoredPLI,true);
                }

                frmSP.PreviewPlayer.CurrentPlayListItem = 0;
                //				/// IF CURRENT RECORDING IS THE DEFAULT CAMERA THEN SET THE PLAYLIST TO SHOW THIS RECORDING FIRST
                //				if(R.IsPrimaryCamera)
                //				{
                //					frmSP.PreviewPlayer.CurrentPlayListItem = frmSP.PreviewPlayer.PlayList.Count  - 1;
                //				}
                //				else if(R.IsDesktopCapture)
                //				{
                //					frmSP.psPlayer.Add(R.DisplayName,PLI,true);
                //				}
                //				else
                //				{
                //					frmSP.psPlayer.Add(R.DisplayName,PLI,true);
                //				}
            }

            frmSP.lblRecordingIdentifier.Text = "1 of " + frmSP.PreviewPlayer.PlayList.Count.ToString();
            lblRecordingIdentifier.Visible = true;
            frmSP.PreviewPlayer.OpenPlayList();
            //this.Visible = false;
            frmSP.ShowDialog(this);

            this.Visible = true;
            frmSP.Dispose();
        }
        static void Main(string[] args)
        {
            System.Collections.Specialized.HybridDictionary hybridDictionary = new System.Collections.Specialized.HybridDictionary();
            hybridDictionary.Add("Test1", "Test@123");
            hybridDictionary.Add("Admin", "Admin@123");
            hybridDictionary.Add("Temp", "Temp@123");
            hybridDictionary.Add("Demo", "Demo@123");
            hybridDictionary.Add("Test2", "Test@123");
            hybridDictionary.Add("Test4", "Test@123");
            hybridDictionary.Add("Test3", "Test@123");
            hybridDictionary.Add("Test5", "Test@123");
            hybridDictionary.Add("Test12", "Test@123");
            hybridDictionary.Add("Test6", "Test@123");
            hybridDictionary.Add("Test7", "Test@123");
            hybridDictionary.Add("Test8", "Test@123");
            hybridDictionary.Add("Test9", "Test@123");
            hybridDictionary.Add("Test10", "Test@123");
            hybridDictionary.Add("Test11", "Test@123");

            hybridDictionary.Remove("Admin");
            if (hybridDictionary.Contains("Admin"))
            {
                Console.WriteLine("UserName already Esists");
            }
            else
            {
                hybridDictionary.Add("Admin", "Admin@123");
                Console.WriteLine("User added succesfully.");
            }
            // Copies the HybridDictionary to an array with DictionaryEntry elements.
            DictionaryEntry[] myArr = new DictionaryEntry[hybridDictionary.Count];
            hybridDictionary.CopyTo(myArr, 0);
            // Displays the values in the array.
            Console.WriteLine("Displays the elements in the array:");
            Console.WriteLine(" KEY VALUE");
            for (int i = 0; i < myArr.Length; i++)
            {
                Console.WriteLine("   {0} {1}", myArr[i].Key, myArr[i].Value);
            }
            Console.WriteLine();

            // Get a collection of the keys.
            Console.WriteLine("UserName" + ": " + "Password");
            foreach (DictionaryEntry entry in hybridDictionary)
            {
                Console.WriteLine(entry.Key + ": " + entry.Value);
            }
            Console.ReadKey();
        }
示例#28
0
        // Delegate everything to m_hybridDictionary

        public void Add(object key, object value)
        {
            m_hybridDictionary.Add(key, value);
        }
        /// <summary>
        /// Read in the arguments from the .xml file that we be used to run our model
        /// </summary>
        /// <param name="xmlPathFile">The full path and filename of the .xml file. Example: "C:\gp\RunModel.xml"</param>
        /// <returns>A HybridDictionary that contains the arguments to run our model.</returns>
        /// <remarks></remarks>
        public static System.Collections.Specialized.HybridDictionary ReadXMLConfigurationFile(System.String xmlPathFile)
        {

            System.Collections.Specialized.HybridDictionary modelParametersHybridDictionary = new System.Collections.Specialized.HybridDictionary();

            try
            {

                //Read the XML configuration file
                System.Xml.XmlDocument XMLdoc = new System.Xml.XmlDocument();
                XMLdoc.Load(xmlPathFile);

                // MY_CUSTOM_TOOLBOX
                System.Xml.XmlNode xMY_CUSTOM_TOOLBOX = XMLdoc["MY_CUSTOM_TOOLBOX"];

                // GolfFinder
                System.Xml.XmlNode xGolfFinder = xMY_CUSTOM_TOOLBOX["GolfFinder"];

                // BufferDistance
                System.Xml.XmlNode xBufferDistance = xGolfFinder["BufferDistance"];
                modelParametersHybridDictionary.Add("BufferDistance", xBufferDistance.InnerText);

                // Airports
                System.Xml.XmlNode xAirports = xGolfFinder["Airports"];
                modelParametersHybridDictionary.Add("Airports", xAirports.InnerText);

                // Golf
                System.Xml.XmlNode xGolf = xGolfFinder["Golf"];
                modelParametersHybridDictionary.Add("Golf", xGolf.InnerText);

                // AirportBuffer
                System.Xml.XmlNode xAirportBuffer = xGolfFinder["AirportBuffer"];
                modelParametersHybridDictionary.Add("AirportBuffer", xAirportBuffer.InnerText);

                // GolfNearAirports
                System.Xml.XmlNode xGolfNearAirports = xGolfFinder["GolfNearAirports"];
                modelParametersHybridDictionary.Add("GolfNearAirports", xGolfNearAirports.InnerText);

                return modelParametersHybridDictionary;
            }
            catch (Exception ex)
            {

                //The XML read was unsuccessful. Return an empty HybridDictionary
                return modelParametersHybridDictionary;

            }

        }
示例#30
0
        public static System.Collections.Specialized.HybridDictionary GetSchemaCatgoryDictionary()
        {
            System.Collections.Specialized.HybridDictionary dic = null;

            if (HttpContext.Current.Items.Contains(Util.TheDicKey) == false)
            {
                dic = new System.Collections.Specialized.HybridDictionary();

                foreach (ObjectSchemaConfigurationElement schema in ObjectSchemaSettings.GetConfig().Schemas)
                {
                    dic.Add(schema.Name, schema.Category);
                }

                HttpContext.Current.Items.Add(Util.TheDicKey, dic);
            }
            else
            {
                dic = (System.Collections.Specialized.HybridDictionary)HttpContext.Current.Items[Util.TheDicKey];
            }

            return dic;
        }
示例#31
0
 private void TestAvailableCultures()
 {
     availablecultures = new System.Collections.Specialized.HybridDictionary();
     foreach ( System.Globalization.CultureInfo item in System.Globalization.CultureInfo.GetCultures( System.Globalization.CultureTypes.AllCultures) )  {
         if ( !item.Equals(System.Globalization.CultureInfo.InvariantCulture) && !availablecultures.Contains(item.Name) && resources.GetResourceSet(item, true, false)!=null )
             availablecultures.Add(item.Name, item.EnglishName);
     }
 }
示例#32
0
        /// <summary>
        /// 根据关键字获取对应语言的文本
        /// </summary>
        /// <param name="key"></param>
        /// <param name="defaultvalue"></param>
        /// <param name="valueMark"></param>
        /// <returns></returns>
        public static string GetValue(string key, string defaultvalue = "", string valueMark = "value")
        {
            // 当前语言
            string currentLangFile = langPath + langFile;

            // 默认语言
            string defaultLangFile = langPath + langDefaultFile;

            //文本
            string value = defaultvalue;

            //没有key
            if (String.IsNullOrWhiteSpace(key))
            {
                return(value);
            }

            //缓存中获取
            if (dictionaryLangs == null)
            {
                dictionaryLangs = new System.Collections.Specialized.HybridDictionary();
            }

            lock (dictionaryLangs)
            {
                if (dictionaryLangs.Contains(key + valueMark))
                {
                    value = dictionaryLangs[key + valueMark].ToString();
                }
            }

            //优先获取指定的语言
            if (String.IsNullOrWhiteSpace(value) &&
                System.IO.File.Exists(currentLangFile))
            {
                value = XmlHelper.GetValue(currentLangFile, @"langs/lang[@key='" + key + "']", valueMark);
            }

            //若指定的语言没有值则获取默认语言
            if (String.IsNullOrWhiteSpace(value) &&
                System.IO.File.Exists(defaultLangFile))
            {
                value = XmlHelper.GetValue(defaultLangFile, @"langs/lang[@key='" + key + "']", valueMark);
            }

            if (!String.IsNullOrWhiteSpace(value))
            {
                lock (dictionaryLangs)
                {
                    if (!dictionaryLangs.Contains(key + valueMark))
                    {
                        dictionaryLangs.Add(key + valueMark, value);
                    }
                }
            }

            //如果没有获取到则返回默认值
            if (String.IsNullOrWhiteSpace(value))
            {
                value = defaultvalue;
            }

            return(value);
        }
示例#33
0
        IDictionary LoadProviders(ITypeResolutionService resolution)
        {
            if (Configuration.Arguments == null)
            {
                return(new System.Collections.Specialized.HybridDictionary(0));
            }

            try
            {
                // At most we will have a provider for each argument.
                IDictionary providers = new System.Collections.Specialized.HybridDictionary(Configuration.Arguments.Length);
                monitoredArguments = new System.Collections.Specialized.HybridDictionary(Configuration.Arguments.Length);
                bool hasmonitors            = false;
                IValueInfoService mdservice = GetService <IValueInfoService>(true);

                // Setup monitoring for dependent argument changes.
                foreach (Config.Argument argument in Configuration.Arguments)
                {
                    if (argument.ValueProvider != null)
                    {
                        IValueProvider provider = GetInstance <IValueProvider>(resolution, argument.ValueProvider.Type);

                        // Initialize the provider by passing the configuration for the argument it provides values to.
                        provider.Initialize(mdservice.GetInfo(argument.Name));
                        if (provider is IAttributesConfigurable)
                        {
                            Configure((IAttributesConfigurable)provider, argument.ValueProvider.AnyAttr);
                        }
                        providers.Add(argument.Name, provider);
                        // Site the provider so it can access all services.
                        if (provider is IComponent)
                        {
                            Add((IComponent)provider);
                        }

                        // Add to the argument-indexed list of providers monitoring arguments.
                        if (argument.ValueProvider.MonitorArgument != null)
                        {
                            hasmonitors = true;
                            foreach (Config.MonitorArgument monitored in argument.ValueProvider.MonitorArgument)
                            {
                                // Throw if the value provider is monitoring the same argument it's attached to.
                                if (monitored.Name == argument.Name)
                                {
                                    throw new System.Configuration.ConfigurationException(String.Format(
                                                                                              System.Globalization.CultureInfo.CurrentCulture,
                                                                                              Properties.Resources.Recipe_ArgumentCantMonitorItself,
                                                                                              argument.ValueProvider.Type,
                                                                                              argument.Name));
                                }

                                ArrayList monitoringproviders = (ArrayList)monitoredArguments[monitored.Name];
                                if (monitoringproviders == null)
                                {
                                    monitoringproviders = new ArrayList();
                                    monitoredArguments[monitored.Name] = monitoringproviders;
                                }
                                monitoringproviders.Add(provider);
                            }
                        }
                    }
                }

                if (providers.Count != 0 && hasmonitors)
                {
                    // Attach to change event if monitoring arguments.
                    IComponentChangeService changes = GetService <IComponentChangeService>(true);
                    changes.ComponentChanged += new ComponentChangedEventHandler(OnArgumentChanged);
                }

                return(providers);
            }
            catch (Exception ex)
            {
                throw new ValueProviderException(this.Configuration.Name,
                                                 Properties.Resources.Recipe_ValueProviderLoadFailed, ex);
            }
        }