internal ExplicitDiscriminatorMap(System.Data.Mapping.ViewGeneration.DiscriminatorMap template)
 {
     m_typeMap = template.TypeMap;
     m_discriminatorProperty = template.Discriminator.Property;
     m_properties = template.PropertyMap.Select(propertyValuePair => propertyValuePair.Key)
         .ToList().AsReadOnly();
 }
        /// <summary>
        /// Initializes a new cellular automaton with false that has the specified rule.
        /// </summary>
        /// <param name="rule">A rule number</param>
        /// <param name="length">A length of cells</param>
        public LinearCellularAutomaton(byte rule, int length)
        {
            if (length < 3)
                throw new ArgumentOutOfRangeException("Length is must be more than or equal to 3");

            _ruleNumber = rule;
            _length = length;
            _density = 0.0;

            var rules = Convert.ToString(rule, 2).PadLeft(8, '0');
            _rules = new ReadOnlyDictionary<Tuple<bool, bool, bool>, bool>(new Dictionary<Tuple<bool, bool, bool>, bool>()
            {
                {Tuple.Create(true, true, true), rules[0] == '1' ? true : false},
                {Tuple.Create(true, true, false), rules[1] == '1' ? true : false},
                {Tuple.Create(true, false, true), rules[2] == '1' ? true : false},
                {Tuple.Create(true, false, false), rules[3] == '1' ? true : false},
                {Tuple.Create(false, true, true), rules[4] == '1' ? true : false},
                {Tuple.Create(false, true, false), rules[5] == '1' ? true : false},
                {Tuple.Create(false, false, true), rules[6] == '1' ? true : false},
                {Tuple.Create(false, false, false), rules[7] == '1' ? true : false}
            });
            state = Enumerable.Repeat(false, length).ToArray();
            _initialState = new System.Collections.ObjectModel.ReadOnlyCollection<bool>(state);
            time = 0;
        }
Esempio n. 3
0
        internal ParseResult(DbCommandTree commandTree, List<FunctionDefinition> functionDefs)
        {
            EntityUtil.CheckArgumentNull(commandTree, "commandTree");
            EntityUtil.CheckArgumentNull(functionDefs, "functionDefs");

            this._commandTree = commandTree;
            this._functionDefs = functionDefs.AsReadOnly();
        }
 /// <summary>
 /// Initializes a new cellular automaton with the specified initial density that has the specified rule.
 /// </summary>
 /// <param name="rule">A rule number</param>
 /// <param name="length">A length of cells</param>
 /// <param name="density">An initial density</param>
 public LinearCellularAutomaton(byte rule, int length, double density)
     : this(rule, length)
 {
     _density = density;
     foreach (var i in Enumerable.Range(0, length).OrderBy(n => Guid.NewGuid()).Take((int)(length * density)))
         state[i] = true;
     _initialState = new System.Collections.ObjectModel.ReadOnlyCollection<bool>(state);
 }
Esempio n. 5
0
 internal override IEnumerable<KeyValuePair<string, TypeUsage>> GetParameters()
 {
     if (this._parameters == null)
     {
         this._parameters = ParameterRetriever.GetParameters(this);
     }
     return this._parameters.Select(p => new KeyValuePair<string, TypeUsage>(p.ParameterName, p.ResultType));
 }
Esempio n. 6
0
        public ImportDirectiveInfo()
            : base("import")
        {
            _namespaceAttribute = new DirectiveAttributeInfo("namespace", DirectiveAttributeOptions.Required | DirectiveAttributeOptions.DisplayInCodeStructure);

            _supportedAttributes = Array.AsReadOnly(new[] {
                _namespaceAttribute
            });
        }
Esempio n. 7
0
		public AssemblyDirectiveInfo()
			: base("assembly") {

			_nameAttribute = new DirectiveAttributeInfo("name", DirectiveAttributeOptions.Required | DirectiveAttributeOptions.DisplayInCodeStructure);

			_supportedAttributes = Array.AsReadOnly(new[] {
				_nameAttribute
			});
		}
Esempio n. 8
0
        public void addAllObjectsInRange(QuadTree<Object.Object>.QuadNode currentNode, Rectangle bounds, List<Object.Object> result, List<SearchFlags.Searchflag> _SearchFlags)
        {
            System.Collections.ObjectModel.ReadOnlyCollection<Object.Object> var_Copy = new System.Collections.ObjectModel.ReadOnlyCollection<Object.Object>(currentNode.Objects);
            //TODO: Zusätzliche Informationen: Die Auflistung wurde geändert. Der Enumerationsvorgang kann möglicherweise nicht ausgeführt werden.
            try
            {
                foreach (Object.Object var_Object in var_Copy)
                {
                    if (!result.Contains(var_Object))// && !var_Object.IsDead)
                    {
                        Boolean containsAllFlags = true;
                        foreach (SearchFlags.Searchflag searchFlag in _SearchFlags)
                        {
                            if (!searchFlag.hasFlag(var_Object))
                                containsAllFlags = false;

                        }
                        if (!containsAllFlags)
                            continue;
                        if (var_Object is AnimatedObject)
                        {
                            if (Utility.Collision.Intersection.RectangleIntersectsRectangle(bounds, ((AnimatedObject)var_Object).Bounds)) ///DrawBounds ???
                            {
                                if (var_Object.CollisionBounds != null && var_Object.CollisionBounds.Count > 0)
                                {
                                    foreach (Rectangle collisionBound in var_Object.CollisionBounds)
                                    {
                                        if (Utility.Collision.Intersection.RectangleIntersectsRectangle(bounds, new Rectangle(collisionBound.X + var_Object.Bounds.X, collisionBound.Y + var_Object.Bounds.Y, collisionBound.Width, collisionBound.Height))) // collisionBound ???
                                        {
                                            result.Add(var_Object);
                                            break;
                                        }
                                    }
                                }
                                else
                                {
                                    result.Add(var_Object);
                                }
                            }
                        }
                    }
                }
                System.Collections.ObjectModel.ReadOnlyCollection<QuadTree<Object.Object>.QuadNode> var_Copy2 = new System.Collections.ObjectModel.ReadOnlyCollection<QuadTree<Object.Object>.QuadNode>(currentNode.Nodes);
                foreach (QuadTree<Object.Object>.QuadNode node in var_Copy2)
                {
                    if (node != null)
                        addAllObjectsInRange(node, bounds, result, _SearchFlags);
                }
            }
            catch (Exception e)
            {
                Logger.Logger.LogErr(e.ToString());
            }
        }
        protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
        {

            // First time _application is launched 
            _commandLine = eventArgs.CommandLine;


            _application = new SingleInstanceApplication();
            _application.Run();
            return false;
        }
 private DiscriminatorMap(DbPropertyExpression discriminator,
     List<KeyValuePair<object, EntityType>> typeMap,
     Dictionary<EdmProperty, DbExpression> propertyMap,
     Dictionary<Query.InternalTrees.RelProperty, DbExpression> relPropertyMap,
     EntitySet entitySet)
 {
     this.Discriminator = discriminator;
     this.TypeMap = typeMap.AsReadOnly();
     this.PropertyMap = propertyMap.ToList().AsReadOnly();
     this.RelPropertyMap = relPropertyMap.ToList().AsReadOnly();
     this.EntitySet = entitySet;
 }
        public ArrayType(TypeReference type, IEnumerable<ArrayDimension> dimensions)
            : base(type)
        {
            Mixin.CheckType(type);
            m_Dimensions = dimensions.ToReadOnlyCollectionOrNull();

            if (m_Dimensions.Count == 1
                && !m_Dimensions[0].IsSized)
                m_Dimensions = null;

            this.etype = MD.ElementType.Array;
        }
        public ArrayType(TypeReference type, int rank)
            : base(type)
        {
            Mixin.CheckType(type);

            if (rank == 1)
                return;

            m_Dimensions = new System.Collections.ObjectModel.ReadOnlyCollection<ArrayDimension>(new ArrayDimension[rank]);

            this.etype = MD.ElementType.Array;
        }
Esempio n. 13
0
    internal void SetThreadContext()
    {
      Csla.ApplicationContext.User = User;
      Csla.ApplicationContext.SetContext(ClientContext, GlobalContext);
#if NETFX_CORE
      var list = new System.Collections.ObjectModel.ReadOnlyCollection<string>(new List<string> { UICulture });
      ResourceManager.Current.DefaultContext.Languages = list;
      list = new System.Collections.ObjectModel.ReadOnlyCollection<string>(new List<string> { Culture });
      ResourceManager.Current.DefaultContext.Languages = list;
#else
      Thread.CurrentThread.CurrentUICulture = UICulture;
      Thread.CurrentThread.CurrentCulture = Culture;
#endif
    }
Esempio n. 14
0
 public BrowserEventArgs(DestinationEnum dest, string[] args)
 {
     switch (dest)
     {
         case DestinationEnum.TwStatsPlayer:
         case DestinationEnum.TwStatsTribe:
         case DestinationEnum.TwStatsVillage:
             _gameDestination = false;
             break;
         default:
             _gameDestination = true;
             break;
     }
     _destination = dest;
     _args = new List<string>(args).AsReadOnly();
 }
Esempio n. 15
0
        private DbQueryCommandTree(MetadataWorkspace metadata,
                                   DataSpace dataSpace, 
                                   DbExpression query,
                                   bool validate)
            : base(metadata, dataSpace)
        {
            // Ensure the query expression is non-null
            EntityUtil.CheckArgumentNull(query, "query");

            if (validate)
            {
                // Use the valid workspace and data space to validate the query expression
                DbExpressionValidator validator = new DbExpressionValidator(metadata, dataSpace);
                validator.ValidateExpression(query, "query");

                this._parameters = validator.Parameters.Select(paramInfo => paramInfo.Value).ToList().AsReadOnly();
            }
            this._query = query;
        }
        protected override void OnStartupNextInstance(StartupNextInstanceEventArgs eventArgs)
        {
            // Subsequent launches 
            //eventArgs.CommandLine.

            if (eventArgs.CommandLine.Count == 2)
            {
                base.OnStartupNextInstance(eventArgs);
                _commandLine = eventArgs.CommandLine;

                string tradingSysCode = _commandLine[0];
                string tokenNum = _commandLine[1];
                _application.Activate(tradingSysCode, tokenNum);
            }
            else
            {
                MessageBox.Show("Vault Viewer arguments are not proper");
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Construct DataRecordInfo with list of EdmMembers.
        /// Each memberInfo must be a member of metadata.
        /// </summary>
        /// <param name="metadata"></param>
        /// <param name="memberInfo"></param>
        public DataRecordInfo(TypeUsage metadata, IEnumerable<EdmMember> memberInfo)
        {
            EntityUtil.CheckArgumentNull(metadata, "metadata");
            IBaseList<EdmMember> members = TypeHelpers.GetAllStructuralMembers(metadata.EdmType);

            List<FieldMetadata> fieldList = new List<FieldMetadata>(members.Count);

            if (null != memberInfo)
            {
                foreach (EdmMember member in memberInfo)
                {
                    if ((null != member) &&
                        (0 <= members.IndexOf(member)) &&
                        ((BuiltInTypeKind.EdmProperty == member.BuiltInTypeKind) ||         // for ComplexType, EntityType; BuiltTypeKind.NaviationProperty not allowed
                         (BuiltInTypeKind.AssociationEndMember == member.BuiltInTypeKind))) // for AssociationType
                    {   // each memberInfo must be non-null and be part of Properties or AssociationEndMembers
                        //validate that EdmMembers are from the same type or base type of the passed in metadata.
                        if((member.DeclaringType != metadata.EdmType) && 
                            !member.DeclaringType.IsBaseTypeOf(metadata.EdmType))
                        {
                            throw EntityUtil.Argument(System.Data.Entity.Strings.EdmMembersDefiningTypeDoNotAgreeWithMetadataType);
                        }
                        fieldList.Add(new FieldMetadata(fieldList.Count, member));
                    }
                    else
                    {   // expecting empty memberInfo for non-structural && non-null member part of members if structural
                        throw EntityUtil.Argument("memberInfo");
                    }
                }
            }

            // expecting structural types to have something at least 1 property
            // (((null == structural) && (0 == fieldList.Count)) || ((null != structural) && (0 < fieldList.Count)))
            if (Helper.IsStructuralType(metadata.EdmType) == (0 < fieldList.Count))
            {
                _fieldMetadata = new System.Collections.ObjectModel.ReadOnlyCollection<FieldMetadata>(fieldList);
                _metadata = metadata;
            }
            else
            {
                throw EntityUtil.Argument("memberInfo");
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Constructs a new DbFunctionCommandTree that uses the specified metadata workspace, data space and function metadata
        /// </summary>
        /// <param name="metadata">The metadata workspace that the command tree should use.</param>
        /// <param name="dataSpace">The logical 'space' that metadata in the expressions used in this command tree must belong to.</param>
        /// <param name="edmFunction"></param>
        /// <param name="resultType"></param>
        /// <param name="parameters"></param>
        /// <exception cref="ArgumentNullException"><paramref name="metadata"/>, <paramref name="dataSpace"/> or <paramref name="edmFunction"/> is null</exception>
        /// <exception cref="ArgumentException"><paramref name="dataSpace"/> does not represent a valid data space or
        /// <paramref name="edmFunction">is a composable function</paramref></exception>
        /*CQT_PUBLIC_API(*/internal/*)*/ DbFunctionCommandTree(MetadataWorkspace metadata, DataSpace dataSpace, EdmFunction edmFunction, TypeUsage resultType, IEnumerable<KeyValuePair<string, TypeUsage>> parameters)
            : base(metadata, dataSpace)
        {
            EntityUtil.CheckArgumentNull(edmFunction, "edmFunction");

            _edmFunction = edmFunction;
            _resultType = resultType;

            List<string> paramNames = new List<string>();
            List<TypeUsage> paramTypes = new List<TypeUsage>();
            if (parameters != null)
            {
                foreach (KeyValuePair<string, TypeUsage> paramInfo in parameters)
                {
                    paramNames.Add(paramInfo.Key);
                    paramTypes.Add(paramInfo.Value);
                }
            }

            _parameterNames = paramNames.AsReadOnly();
            _parameterTypes = paramTypes.AsReadOnly();
        }
Esempio n. 19
0
        private void enterBut_Click(object sender, EventArgs e)
        {
            try
            {
                // Заходим в ВК
                vk.Authorize(4919033, userText.Text, passText.Text, scope);
                user = vk.Users.Get((long)vk.UserId, null, null);
                enterLabel.Text = "Успешный вход";

                // Получаем список собственных аудиозаписей и альбомов
                audiosList = vk.Audio.Get(user.Id, null, null, null, null);
                albumsList = vk.Audio.GetAlbums(user.Id, null, 0);
                foreach (var item in albumsList)
                    albumsListBox.Items.Add(item.Title);
                albumsListBox.Enabled = true;

                // Получаем инфу о группах
                groupsList = vk.Groups.Get(user.Id, true, GroupsFilters.Moderator);
                foreach (var item in groupsList)
                    groupsListBox.Items.Add(item.Name);

                // Включаем все нужные кнопки
                groupsListBox.Enabled = true;
            }
            catch (VkNet.Exception.VkApiAuthorizationException)
            {
                enterLabel.Text = "Неправильный логин/пароль";
            }
            catch (VkNet.Exception.VkApiException)
            {
                MessageBox.Show("Сбой со стороны ВКонтакте");
            }
            catch
            {
                MessageBox.Show("Что-то пошло не так, пните Митю!");
            }
        }
Esempio n. 20
0
 /// <summary>
 /// Get device information for a connected client. The device information
 /// returned is the device model as well as the free space, the total capacity
 /// and blocksize on the accessed disk partition.
 /// </summary>
 /// <param name="client">
 /// The client to get device info for.
 /// </param>
 /// <param name="device_information">
 /// A char list of device information terminated by an
 /// empty string or NULL if there was an error. Free with
 /// afc_dictionary_free().
 /// </param>
 /// <returns>
 /// AFC_E_SUCCESS on success or an AFC_E_* error value.
 /// </returns>
 public virtual AfcError afc_get_device_info(AfcClientHandle client, out System.Collections.ObjectModel.ReadOnlyCollection <string> deviceInformation)
 {
     return(AfcNativeMethods.afc_get_device_info(client, out deviceInformation));
 }
Esempio n. 21
0
 public sealed override System.Linq.Expressions.Expression Bind(object[] args, System.Collections.ObjectModel.ReadOnlyCollection <System.Linq.Expressions.ParameterExpression> parameters, System.Linq.Expressions.LabelTarget returnLabel)
 {
     throw null;
 }
Esempio n. 22
0
 public StyleInstance()
 {
     voices = vox.GetInstalledVoices();
 }
Esempio n. 23
0
        public static void dailyPoints(IWebDriver driver)
        {
            string[] titles = { "PrizeRebel.com | Earn" };
            bool     loop   = true;

            while (loop)
            {
                try
                {
                    System.Collections.ObjectModel.ReadOnlyCollection <string> windowHandles = driver.WindowHandles;

                    foreach (String window in windowHandles)
                    {
                        try
                        {
                            IWebDriver popup = driver.SwitchTo().Window(window);
                        }
                        catch { }

                        try
                        {
                            if (driver.Title.Contains("Facebook"))
                            {
                                driver.Close();
                            }
                        }
                        catch { }

                        try
                        {
                            if (driver.FindElement(By.Id("noDisplay")).Displayed)
                            {
                                loop = false;
                            }
                        }
                        catch { }

                        try
                        {
                            driver.SwitchTo().Frame(driver.FindElement(By.CssSelector("div#displayWrap iframe")));
                        }
                        catch { }

                        try
                        {
                            if (driver.FindElement(By.Id("offers_exhausted_message")).Displayed)
                            {
                                loop = false;
                            }
                        }
                        catch { }

                        try
                        {
                            IList <IWebElement> oLinks = driver.FindElements(By.ClassName("singleselectset_radio"));
                            Random random   = new Random();
                            int    rndClick = random.Next(1, oLinks.Count);
                            Console.WriteLine(rndClick);
                            int counterClick = 1;
                            foreach (IWebElement oLink in oLinks)
                            {
                                Console.WriteLine(counterClick);
                                if (counterClick == rndClick)
                                {
                                    oLink.Click();
                                }
                                counterClick++;
                            }
                        }
                        catch { }

                        try
                        {
                            IWebElement dropDownMonth = driver.FindElement(By.Id("dob_month"));
                            IWebElement dropDownDay   = driver.FindElement(By.Id("dob_day"));
                            IWebElement dropDownYear  = driver.FindElement(By.Id("dob_year"));
                            string[]    months        = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
                            Random      random        = new Random();
                            int         rndMonth      = random.Next(0, 11);
                            Console.WriteLine(rndMonth);
                            SelectElement clickThis = new SelectElement(dropDownMonth);
                            clickThis.SelectByText(months[rndMonth]);
                            Helpers.wait(1000);
                            int rndDay = random.Next(1, 28);
                            clickThis = new SelectElement(dropDownDay);
                            clickThis.SelectByText(rndDay.ToString());
                            Helpers.wait(1000);
                            int rndYear = random.Next(1974, 1994);
                            clickThis = new SelectElement(dropDownYear);
                            clickThis.SelectByText(rndYear.ToString());
                            Helpers.wait(1000);
                        }
                        catch { }

                        try
                        {
                            driver.FindElement(By.Id("demosubmitimg")).Click();
                        }
                        catch { }

                        try
                        {
                            driver.SwitchTo().Frame(driver.FindElement(By.CssSelector("div#displayWrap iframe")));
                        }
                        catch { }

                        Helpers.ById(driver, "webtraffic_popup_start_button");
                        Helpers.ById(driver, "webtraffic_popup_next_button");
                        Helpers.ByClass(driver, "webtraffic_start_button");
                        Helpers.ByClass(driver, "webtraffic_next_button");

                        // Chips Ad
                        Helpers.ById(driver, "compositor_placed_innerclip_cheddar");
                        Helpers.ById(driver, "compositor_placed_innerclip_gouda");
                        Helpers.ById(driver, "compositor_placed_innerclip_habanero");
                        Helpers.ById(driver, "compositor_placed_innerclip_flamin");
                        Helpers.ById(driver, "compositor_placed_innerclip_honeybbq");
                        Helpers.ById(driver, "compositor_placed_innerclip_korean");
                        Helpers.ById(driver, "compositor_placed_innerclip_oliveoil");
                        Helpers.ById(driver, "compositor_placed_innerclip_seasalt");
                        //

                        Helpers.ById(driver, "compositor_placed_innerclip_bajablast");

                        try
                        {
                            IWebElement rewardText = driver.FindElement(By.Id("ty_header"));
                            if (rewardText.Text == "You earned 1 Points!")
                            {
                                driver.Navigate().Refresh();
                                Helpers.closeWindows(driver, titles);
                            }
                        }
                        catch { }

                        try
                        {
                            if (driver.FindElement(By.Id("ty_headline")).Text == "Thanks for visiting great content!")
                            {
                                driver.Navigate().Refresh();
                                Helpers.closeWindows(driver, titles);
                            }
                        }

                        catch { }

                        try
                        {
                            Helpers.switchToBrowserByString(driver, "Now Exploring great content!");
                            while (driver.Title.Contains("Now Exploring"))
                            {
                                Helpers.switchToBrowserByString(driver, "Now Exploring great content!");
                                try
                                {
                                    IWebElement greatContent = driver.FindElement(By.ClassName("nextstepimg"));
                                    greatContent.Click();
                                }
                                catch
                                {
                                    Console.WriteLine("Waiting to finish");
                                    try
                                    {
                                        driver.FindElement(By.XPath("//img[@alt='Claim your reward']")).Click();
                                        Helpers.switchToBrowserByString(driver, "Offer Walls");
                                    }
                                    catch { }
                                    Helpers.wait(5000);
                                }
                            }
                        }
                        catch { }

                        try
                        {
                            driver.SwitchTo().Frame(driver.FindElement(By.CssSelector("div#displayWrap iframe")));
                        }
                        catch { }

                        try
                        {
                            if (driver.FindElement(By.Id("ty_header")).Text.Contains("Points"))
                            {
                                Helpers.closeWindows(driver, titles);
                                Console.WriteLine("I'm Here!!");
                                driver.SwitchTo().ParentFrame();
                                Console.WriteLine("Attempting Refresh");
                                driver.Navigate().GoToUrl("http://www.prizerebel.com/ripply.php");
                                Helpers.wait(1000);
                                driver.Navigate().GoToUrl("http://www.prizerebel.com/dailypoints.php");
                                driver.Navigate().Refresh();
                                Console.WriteLine("Refresh Complete");
                            }
                        }
                        catch { }

                        try
                        {
                            driver.SwitchTo().Frame(driver.FindElement(By.Id("vgPlayer")));
                        }
                        catch { }

                        Helpers.ByClass(driver, "closeBtn");

                        Helpers.switchFrameByNumber(driver, 0);

                        try
                        {
                            driver.SwitchTo().Frame(driver.FindElement(By.Id("player")));
                            driver.SwitchTo().Frame(driver.FindElement(By.Id("player")));
                        }
                        catch { }
                        //*/

                        try
                        {
                            driver.FindElement(By.ClassName("ytp-large-play-button")).Click();
                        }
                        catch { }

                        try
                        {
                            if (driver.FindElement(By.Id("ty_header")).Text.Contains("Points"))
                            {
                                Helpers.closeWindows(driver, titles);
                                Console.WriteLine("I'm Here!!");
                                driver.SwitchTo().ParentFrame();
                                Console.WriteLine("Attempting Refresh");
                                driver.Navigate().GoToUrl("http://www.prizerebel.com/ripply.php");
                                Helpers.wait(1000);
                                driver.Navigate().GoToUrl("http://www.prizerebel.com/dailypoints.php");
                                driver.Navigate().Refresh();
                                Console.WriteLine("Refresh Complete");
                            }
                        }
                        catch { }

                        try
                        {
                            if (driver.FindElement(By.Id("ty_body_text")).Displayed)
                            {
                                Helpers.closeWindows(driver, titles);
                                Console.WriteLine("I'm Here!!");
                                driver.SwitchTo().ParentFrame();
                                Console.WriteLine("Attempting Refresh");
                                driver.Navigate().GoToUrl("http://www.prizerebel.com/ripply.php");
                                Helpers.wait(1000);
                                driver.Navigate().GoToUrl("http://www.prizerebel.com/dailypoints.php");
                                driver.Navigate().Refresh();
                                Console.WriteLine("Refresh Complete");
                            }
                        }
                        catch { }

                        try
                        {
                            driver.SwitchTo().Frame(driver.FindElement(By.CssSelector("div#displayWrap iframe")));
                        }
                        catch { }
                        Helpers.wait(5000);

                        try
                        {
                            driver.SwitchTo().DefaultContent();
                        }
                        catch { }

                        try
                        {
                            IList <IWebElement> divs = driver.FindElements(By.TagName("div"));
                            Console.WriteLine(divs.Count);
                            foreach (IWebElement div in divs)
                            {
                                if (div.Text == "You have reached the limit for the day, please check back in 24 hrs.")
                                {
                                    loop = false;
                                }
                            }
                        }
                        catch { }


                        Helpers.switchFrameByNumber(driver, 0);
                        try
                        {
                            if (driver.FindElement(By.ClassName("jw-icon")).Displayed)
                            {
                                loop = false;
                            }
                        }
                        catch { }
                        Helpers.switchFrameByNumber(driver, 0);
                        Helpers.switchFrameByNumber(driver, 0);
                        Helpers.switchFrameByNumber(driver, 0);
                        Helpers.switchToBrowserFrameByString(driver, "player");
                        Helpers.switchToBrowserFrameByString(driver, "player");
                        try
                        {
                            driver.FindElement(By.ClassName("ytp-large-play-button")).Click();
                        }
                        catch { }

                        try
                        {
                            driver.SwitchTo().DefaultContent();
                        }
                        catch { }

                        Helpers.switchFrameByNumber(driver, 0);
                        Helpers.switchFrameByNumber(driver, 0);

                        try
                        {
                            if (driver.FindElement(By.ClassName("splash-divider")).Displayed)
                            {
                                driver.Navigate().Refresh();
                            }
                        }
                        catch { }

                        try
                        {
                            driver.SwitchTo().DefaultContent();
                        }
                        catch { }

                        Helpers.switchFrameByNumber(driver, 0);
                        IList <IWebElement> bolds = driver.FindElements(By.TagName("b"));
                        foreach (IWebElement bold in bolds)
                        {
                            if (bold.Text.Contains("No videos"))
                            {
                                loop = false;
                            }
                        }

                        try
                        {
                            driver.SwitchTo().DefaultContent();
                        }
                        catch { }

                        Helpers.switchFrameByNumber(driver, 0);

                        Helpers.ById(driver, "webtraffic_popup_start_button");
                        Helpers.ById(driver, "webtraffic_popup_next_button");
                        Helpers.ByClass(driver, "webtraffic_start_button");
                        Helpers.ByClass(driver, "webtraffic_next_button");

                        Helpers.ById(driver, "expository_image");

                        try
                        {
                            if (driver.FindElement(By.Id("compositor_placed_innerclip_cta")).Displayed)
                            {
                                driver.Navigate().Refresh();
                                Helpers.closeWindows(driver, titles);
                            }
                        }
                        catch { }

                        try
                        {
                            IWebElement rewardText = driver.FindElement(By.Id("ty_header"));
                            if (rewardText.Text == "You earned 1 Points!")
                            {
                                driver.Navigate().Refresh();
                                Helpers.closeWindows(driver, titles);
                            }
                        }
                        catch { }

                        try
                        {
                            if (driver.FindElement(By.Id("ty_headline")).Text.Contains("Thanks for visiting"))
                            {
                                driver.Navigate().Refresh();
                                Helpers.closeWindows(driver, titles);
                            }
                        }
                        catch { }

                        try
                        {
                            if (driver.FindElement(By.Id("ty_body_text")).Displayed)
                            {
                                driver.Navigate().Refresh();
                                Helpers.closeWindows(driver, titles);
                            }
                        }
                        catch { }
                    }
                }
                catch { }
            }
        }
 public abstract System.Linq.Expressions.Expression Bind(object[] args, System.Collections.ObjectModel.ReadOnlyCollection <System.Linq.Expressions.ParameterExpression> parameters, System.Linq.Expressions.LabelTarget returnLabel);
        public override System.Collections.ObjectModel.ReadOnlyCollection<EdmFunction> GetStoreFunctions()
        {
            if (this._functions == null)
            {
                if (this._version == StoreVersion.Sql9 || this._version == StoreVersion.Sql10)
                {
                    this._functions = base.GetStoreFunctions();
                }
                else
                {
                    throw new ArgumentException("Store version not supported via sample provider.");
                }
            }

            return this._functions;
        }
        static int _m_AsReadOnly(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                System.Collections.Generic.List <XLua.LuaTable> gen_to_be_invoked = (System.Collections.Generic.List <XLua.LuaTable>)translator.FastGetCSObj(L, 1);



                {
                    System.Collections.ObjectModel.ReadOnlyCollection <XLua.LuaTable> gen_ret = gen_to_be_invoked.AsReadOnly(  );
                    translator.Push(L, gen_ret);



                    return(1);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Esempio n. 27
0
        public void ValidateStatusCode200(string url)
        {
            Boolean          isValid = false;
            CookieCollection cookCol = new CookieCollection();

            System.Net.Cookie netCookie = new System.Net.Cookie();
            System.Collections.ObjectModel.ReadOnlyCollection <OpenQA.Selenium.Cookie> allCookies = driver.Manage().Cookies.AllCookies;
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

            request.AllowAutoRedirect = false;
            request.CookieContainer   = new CookieContainer();

            foreach (OpenQA.Selenium.Cookie selCook in driver.Manage().Cookies.AllCookies)
            {
                netCookie.Name   = selCook.Name;
                netCookie.Value  = selCook.Value;
                netCookie.Domain = selCook.Domain;
                netCookie.Path   = selCook.Path;
                cookCol.Add(netCookie);
                request.CookieContainer.Add(cookCol);
            }

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            //response.Cookies = request.CookieContainer.GetCookies(request.RequestUri);
            //if(response.Cookies != null)
            //{
            //    cookCol.Add(response.Cookies);
            //}
            //cookies.Add(cookCol);
            //foreach (System.Net.Cookie cookie in response.Cookies)
            //{
            //    cookCol.Add(response.Cookies);
            //    Console.WriteLine("Cookie:");
            //    Console.WriteLine("{0} = {1}", cookie.Name, cookie.Value);
            //    Console.WriteLine("Domain: {0}", cookie.Domain);
            //    Console.WriteLine("Path: {0}", cookie.Path);
            //    Console.WriteLine("Port: {0}", cookie.Port);
            //    Console.WriteLine("Secure: {0}", cookie.Secure);
            //}

            //cookies.Add(cookCol);
            if (response.StatusCode == HttpStatusCode.OK)
            {
                isValid = true;
                Assert.IsTrue(isValid);
            }
        }
        public static InstallationProxyError instproxy_lookup(InstallationProxyClientHandle client, System.Collections.ObjectModel.ReadOnlyCollection <string> appids, PlistHandle clientOptions, out PlistHandle result)
        {
            System.Runtime.InteropServices.ICustomMarshaler appidsMarshaler = NativeStringArrayMarshaler.GetInstance(null);
            System.IntPtr          appidsNative = appidsMarshaler.MarshalManagedToNative(appids);
            InstallationProxyError returnValue  = InstallationProxyNativeMethods.instproxy_lookup(client, appidsNative, clientOptions, out result);

            return(returnValue);
        }
Esempio n. 29
0
 public string GetAudioEndpoint()
 {
     if (aout != null)
     {
         Guid guid = ((DirectSoundOut)aout).Device;
         System.Collections.ObjectModel.ReadOnlyCollection <DirectSoundDevice> list = DirectSoundDeviceEnumerator.EnumerateDevices();
         DirectSoundDevice dsd = list.First(x => x.Guid == guid);
         return(dsd.Description);
     }
     else
     {
         return("");
     }
 }
Esempio n. 30
0
 /// <summary>
 /// Gets information about a specific file.
 /// </summary>
 /// <param name="client">
 /// The client to use to get the information of the file.
 /// </param>
 /// <param name="filename">
 /// The fully-qualified path to the file.
 /// </param>
 /// <param name="file_information">
 /// Pointer to a buffer that will be filled with a
 /// NULL-terminated list of strings with the file information. Set to NULL
 /// before calling this function. Free with afc_dictionary_free().
 /// </param>
 /// <returns>
 /// AFC_E_SUCCESS on success or an AFC_E_* error value.
 /// </returns>
 public virtual AfcError afc_get_file_info(AfcClientHandle client, string filename, out System.Collections.ObjectModel.ReadOnlyCollection <string> fileInformation)
 {
     return(AfcNativeMethods.afc_get_file_info(client, filename, out fileInformation));
 }
Esempio n. 31
0
 /// <summary>
 /// Gets a directory listing of the directory requested.
 /// </summary>
 /// <param name="client">
 /// The client to get a directory listing from.
 /// </param>
 /// <param name="path">
 /// The directory for listing. (must be a fully-qualified path)
 /// </param>
 /// <param name="directory_information">
 /// A char list of files in the directory
 /// terminated by an empty string or NULL if there was an error. Free with
 /// afc_dictionary_free().
 /// </param>
 /// <returns>
 /// AFC_E_SUCCESS on success or an AFC_E_* error value.
 /// </returns>
 public virtual AfcError afc_read_directory(AfcClientHandle client, string path, out System.Collections.ObjectModel.ReadOnlyCollection <string> directoryInformation)
 {
     return(AfcNativeMethods.afc_read_directory(client, path, out directoryInformation));
 }
        public override System.Collections.ObjectModel.ReadOnlyCollection<EdmFunction> GetStoreFunctions()
        {
            if (this._functions == null)
            {
                if (this._version == SqlVersion.Sql10)
                {
                    this._functions = base.GetStoreFunctions();
                }
                else
                {
                    //Remove the functions over katmai types from both Sql 9 and Sql 8.
                    IEnumerable<EdmFunction> functions = base.GetStoreFunctions().Where(f => !IsKatmaiOrNewer(f));
                    if(this._version == SqlVersion.Sql8)
                    {
                        // SQLBUDT 550998: Remove unsupported overloads from Provider Manifest on SQL 8.0
                        functions = functions.Where(f => !IsYukonOrNewer(f));      
                    }
                    this._functions = functions.ToList().AsReadOnly();
                }
            }

            return this._functions;
        }
        public override System.Collections.ObjectModel.ReadOnlyCollection<PrimitiveType> GetStoreTypes()
        {
            if (this._primitiveTypes == null)
            {
                //if (this._version == StoreVersion.Sql9 || this._version == StoreVersion.Sql10)
                //{
                this._primitiveTypes = base.GetStoreTypes();
                //}
                //else
                //{
                //    throw new ArgumentException("SQL Server 2000 not supported via sample provider.");
                //}
            }

            return this._primitiveTypes;
        }
Esempio n. 34
0
        public SelectEpubWindow()
        {
            InitializeComponent();

            int i = 0;

            for (i = 0; i < 32; i++)
            {
                epubName[i]  = null;
                epubCover[i] = null;
            }
            //epub内のパスを取得
            epubDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ContentsData\\epub";

            //epubファイルを、大文字小文字を区別して探す
            System.Collections.ObjectModel.ReadOnlyCollection <string> files =
                Microsoft.VisualBasic.FileIO.FileSystem.FindInFiles(
                    epubDirectory,
                    "",  //名前があったら名前を入力
                    false,
                    Microsoft.VisualBasic.FileIO.SearchOption.SearchAllSubDirectories,
                    new string[] { "*.epub" });


            i = 0;
            foreach (string f in files)
            {
                //MessageBox.Show(f);
                epubName[i] = f;
                epubName[i] = epubName[i].Replace(epubDirectory + "\\", "");

                //MessageBox.Show("epubName[" + i + "] = " + epubName[i]);
                i++;
            }

            //ここから解凍処理
            for (int a = 0; epubName[a] != null; a++)
            {
                ZipFile zip = new ZipFile(epubDirectory + "\\" + epubName[a], Encoding.GetEncoding("shift_jis"));
                //zipファイルのパスから解凍先を指定

                //epubのファイル名と同名のフォルダを作成する.ここが解凍先になる
                string epubFolderName = epubName[a].Replace(".epub", "");
                string thawPath       = epubDirectory + "\\" + epubFolderName;

                //すでに同名のディレクトリが存在しているときは、解凍しない
                if (!Directory.Exists(thawPath))
                {
                    //di=epubファイル内の情報
                    System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(@thawPath);
                    di.Create();

                    //解凍処理
                    zip.ExtractAll(@thawPath, ExtractExistingFileAction.OverwriteSilently);

                    //後始末。面倒ならusingしておいてもおk
                    zip.Dispose();
                }
            }

            //ここから、content.opfを解析し、カバー画像を探す
            for (int x = 0; epubName[x] != null; x++)
            {
                opfPath = epubDirectory + "\\" + epubName[x].Replace(".epub", "") + "\\OEBPS\\content.opf";
                //MessageBox.Show(opfPath);

                if (File.Exists(opfPath))
                {
                    XmlDocument xmlDoc = new XmlDocument();
                    // XmlDocumentオブジェクトを作成
                    xmlDoc.Load(@opfPath);

                    try
                    {
                        // ルートの要素を取得
                        XmlElement xmlRoot = xmlDoc.DocumentElement;

                        // <item>要素をセット
                        XmlNodeList xmlNode = xmlRoot.GetElementsByTagName("item");

                        String strItemHref = "start.";
                        String strItemId   = "start.";
                        int    y           = 0;
                        while (true)
                        {
                            try
                            {
                                // 取得した<item>要素はXmlNodeListなのでXmlElementにキャストする
                                XmlElement xmlName = (XmlElement)xmlNode.Item(y);

                                // <item>要素のhrefの属性値を取得します
                                strItemHref = xmlName.GetAttribute("href");
                                opfHref[y]  = strItemHref;

                                // <item>要素のhrefの属性値を取得します
                                strItemId = xmlName.GetAttribute("id");
                                opfId[y]  = strItemId;

                                //取得したitem要素のリストから、idがcover-imageのものを探す
                                if (opfId[y].Contains("cover-image") || opfId[y].Contains("cover_img"))
                                {
                                    epubCover[x] = epubDirectory + "\\" + epubName[x].Replace(".epub", "") + "\\OEBPS\\" + opfHref[y];
                                    //MessageBox.Show(epubCover[x]);
                                    break;
                                }

                                //MessageBox.Show("<item>の属性href=" + strItemHref);
                            }
                            catch
                            {
                                break;
                            }
                            y++;
                        }
                    }

                    catch (System.Xml.XmlException Ex)
                    {
                        MessageBox.Show(Ex.Message);
                    }
                }
                else
                {
                    MessageBox.Show("ERROR!ファイル" + opfPath + "は存在しません.", "ERROR!");
                }
            }

            //ボタンを生成
            int num = 0;

            for (num = 0; epubName[num] != null; num++)
            {
            }
            //MessageBox.Show("epubファイルは" + epubDirectory + "内に" + num + "個あります.");

            Button[] btn = new Button[num];

            int j = 0; //グリッドの列要素の位置
            int k = 0; //グリッドの行要素の位置

            for (i = 0; i < num; i++)
            {
                btn[i] = new Button()
                {
                    Content = epubName[i]
                };
                if (System.IO.File.Exists(epubCover[i]))
                {
                    btn[i].Background = new ImageBrush(new BitmapImage(new Uri(epubCover[i], UriKind.Relative)));
                }
                else
                {
                    btn[i].Background = new SolidColorBrush(Color.FromArgb(255, 200, 240, 190));
                }
                if (j < 5)
                {
                    ColumnDefinition cd1 = new ColumnDefinition()
                    {
                        Width = new GridLength(200)
                    };
                    grid1.ColumnDefinitions.Add(cd1);
                    j++;
                }
                else
                {
                    RowDefinition rd1 = new RowDefinition()
                    {
                        Height = new GridLength(200)
                    };
                    grid1.RowDefinitions.Add(rd1);
                    j = 1;
                    k++;
                }
                btn[i].Content = string.Format("{0}." + epubName[i], i + 1);

                Grid.SetColumn(btn[i], j - 1);                                                                        //j→j-1に変更
                Grid.SetRow(btn[i], k);
                grid1.Children.Add(btn[i]);
                btn[i].VerticalAlignment   = VerticalAlignment.Stretch;
                btn[i].HorizontalAlignment = HorizontalAlignment.Stretch;
                btn[i].Width  = double.NaN; //Autoという意味
                btn[i].Height = double.NaN; //Autoという意味

                btn[i].Click += new RoutedEventHandler(btn_Click);
            }
            // grid1.ShowGridLines = true;
        }
        public static System.ServiceModel.Security.Tokens.SecurityContextSecurityToken CreateCookieSecurityContextToken(System.Xml.UniqueId contextId, string id, byte[] key, DateTime validFrom, DateTime validTo, System.Collections.ObjectModel.ReadOnlyCollection <System.IdentityModel.Policy.IAuthorizationPolicy> authorizationPolicies, System.ServiceModel.Security.SecurityStateEncoder securityStateEncoder)
        {
            Contract.Ensures(Contract.Result <System.ServiceModel.Security.Tokens.SecurityContextSecurityToken>() != null);

            return(default(System.ServiceModel.Security.Tokens.SecurityContextSecurityToken));
        }
Esempio n. 36
0
            public override bool Matches(Element root, Element element)
            {
                System.Collections.ObjectModel.ReadOnlyCollection <NSoup.Nodes.Attribute> values = element.Attributes.AsList();

                foreach (NSoup.Nodes.Attribute attribute in values)
                {
                    if (attribute.Key.StartsWith(keyPrefix))
                    {
                        return(true);
                    }
                }

                return(false);
            }
Esempio n. 37
0
        public static void virool(IWebDriver driver)
        {
            int  currentHour = DateTime.Now.Hour;
            bool looping = true, looped = false;
            int  counter = 0;

            while (looping)
            {
                try
                {
                    System.Collections.ObjectModel.ReadOnlyCollection <string> windowHandles = driver.WindowHandles;

                    foreach (String window in windowHandles)
                    {
                        IWebDriver popup = driver.SwitchTo().Window(window);
                    }

                    try
                    {
                        if (driver.Title.Contains("Facebook"))
                        {
                            driver.Close();
                        }
                    }
                    catch { }

                    try
                    {
                        driver.SwitchTo().DefaultContent();
                    }
                    catch { }

                    try
                    {
                        if (driver.FindElement(By.Id("offerWallContent")).Text == "Please try back later.")
                        {
                            looping = false;
                        }
                    }
                    catch { }

                    Helpers.switchFrameByNumber(driver, 0);
                    counter = 0;

                    Helpers.wait(5000);

                    //ByClass(driver, "thumbnail");
                    IList <IWebElement> thumbnails = driver.FindElements(By.ClassName("thumbnail"));
                    Console.WriteLine("Thumbnails Count: " + thumbnails.Count);
                    if (thumbnails.Count == 0)
                    {
                        looping = false;
                    }
                    foreach (IWebElement thumbnail in thumbnails)
                    {
                        if (counter > thumbnails.Count - 2)
                        {
                            thumbnail.Click();
                            looped = true;
                        }

                        counter++;
                    }


                    while (looped)
                    {
                        //switchFrameByNumber(driver, 0);
                        Helpers.switchFrameByNumber(driver, 0);
                        Helpers.switchToBrowserFrameByString(driver, "widgetPlayer");
                        try
                        {
                            IList <IWebElement> h1s = driver.FindElements(By.TagName("h1"));
                            foreach (IWebElement h1 in h1s)
                            {
                                if (h1.Text.Contains("504 Gateway"))
                                {
                                    driver.SwitchTo().DefaultContent();
                                    Helpers.switchFrameByNumber(driver, 0);
                                    Helpers.ByClass(driver, "close");
                                    looped  = false;
                                    looping = false;
                                }
                            }
                        }
                        catch { }

                        try
                        {
                            IWebElement fbPageUp = driver.FindElement(By.ClassName("fb-share-btn"));
                            fbPageUp.SendKeys(Keys.PageUp);
                            Helpers.wait(1000);
                            fbPageUp.SendKeys(Keys.PageUp);
                            Helpers.wait(1000);
                            fbPageUp.SendKeys(Keys.PageUp);
                            Helpers.wait(1000);
                            fbPageUp.SendKeys(Keys.PageUp);
                            Helpers.wait(1000);
                        }
                        catch { }

                        try
                        {
                            if (driver.FindElement(By.LinkText("Opt out")).Displayed)
                            {
                                driver.FindElement(By.LinkText("Opt out")).Click();
                                driver.SwitchTo().DefaultContent();
                                Helpers.switchFrameByNumber(driver, 0);
                                Helpers.ByClass(driver, "close");
                                looped  = false;
                                looping = false;
                            }
                        }
                        catch { }

                        try
                        {
                            driver.SwitchTo().DefaultContent();
                            Helpers.switchFrameByNumber(driver, 0);
                            IWebElement closing = driver.FindElement(By.ClassName("close"));
                            closing.SendKeys(Keys.PageUp);
                            Helpers.wait(1000);
                            closing.SendKeys(Keys.PageUp);
                            Helpers.wait(1000);
                            closing.SendKeys(Keys.PageUp);
                            Helpers.wait(1000);
                            closing.SendKeys(Keys.PageUp);
                            Helpers.wait(1000);
                        }
                        catch { }
                        Helpers.switchFrameByNumber(driver, 0);
                        Helpers.switchToBrowserFrameByString(driver, "widgetPlayer");

                        Helpers.switchToBrowserFrameByString(driver, "player-container");

                        try
                        {
                            if (driver.FindElement(By.ClassName("videowall-still-info-bg")).Displayed)
                            {
                                driver.SwitchTo().DefaultContent();
                                Helpers.switchFrameByNumber(driver, 0);
                                Helpers.ByClass(driver, "close");
                                looped = false;
                            }
                        }
                        catch { }

                        Helpers.ByClass(driver, "ytp-large-play-button");

                        driver.SwitchTo().DefaultContent();
                        Helpers.switchFrameByNumber(driver, 0);
                        Helpers.switchFrameByNumber(driver, 0);

                        try
                        {
                            if (driver.FindElement(By.LinkText("Opt out")).Displayed)
                            {
                                driver.SwitchTo().DefaultContent();
                                Helpers.switchFrameByNumber(driver, 0);
                                Helpers.ByClass(driver, "close");
                                looped = false;
                            }
                        }
                        catch { }

                        try
                        {
                            if (driver.FindElement(By.ClassName("close")).Displayed)
                            {
                            }
                        }
                        catch { }

                        try
                        {
                            if (driver.FindElement(By.Id("share-overlay-facebook")).Displayed)
                            {
                                //driver.FindElement(By.Id("share-overlay-facebook")).SendKeys(Keys.PageUp);
                                driver.SwitchTo().DefaultContent();
                                Helpers.switchFrameByNumber(driver, 0);
                                IWebElement closing = driver.FindElement(By.ClassName("close"));
                                closing.SendKeys(Keys.PageUp);
                                Helpers.wait(1000);
                                closing.SendKeys(Keys.PageUp);
                                Helpers.wait(1000);
                                closing.SendKeys(Keys.PageUp);
                                Helpers.wait(1000);
                                closing.SendKeys(Keys.PageUp);
                                Helpers.wait(1000);
                                Helpers.ByClass(driver, "close");
                                looped = false;
                            }
                        }
                        catch { }

                        try
                        {
                            if (driver.FindElement(By.PartialLinkText("2 Gems")).Displayed)
                            {
                                driver.SwitchTo().DefaultContent();
                                Helpers.switchFrameByNumber(driver, 0);
                                Helpers.ByClass(driver, "close");
                                looped  = false;
                                looping = false;
                            }
                        }
                        catch { }


                        try
                        {
                            if (driver.FindElement(By.Id("yt-subscribe-btn")).Displayed)
                            {
                                driver.SwitchTo().DefaultContent();
                                Helpers.switchFrameByNumber(driver, 0);
                                Helpers.ByClass(driver, "close");
                                looping = false;
                                looped  = false;
                            }
                        }
                        catch { }

                        try
                        {
                            if (currentHour != DateTime.Now.Hour)
                            {
                                driver.SwitchTo().DefaultContent();
                                Helpers.switchFrameByNumber(driver, 0);
                                Helpers.ByClass(driver, "close");
                                driver.Navigate().GoToUrl("http://www.prizerebel.com/members.php");
                                looping = false;
                                looped  = false;
                            }
                        }
                        catch { }
                    }

                    driver.SwitchTo().DefaultContent();
                    Helpers.switchFrameByNumber(driver, 0);
                    Helpers.switchFrameByNumber(driver, 0);

                    Helpers.ByClass(driver, "close");
                }
                catch { }

                try
                {
                    if (currentHour != DateTime.Now.Hour)
                    {
                        driver.SwitchTo().DefaultContent();
                        Helpers.switchFrameByNumber(driver, 0);
                        Helpers.ByClass(driver, "close");
                        driver.Navigate().GoToUrl("http://www.prizerebel.com/members.php");
                        looping = false;
                        looped  = false;
                    }
                }
                catch { }
            }
        }
Esempio n. 38
0
        internal DbNewInstanceExpression(TypeUsage resultType, DbExpressionList attributeValues, System.Collections.ObjectModel.ReadOnlyCollection <DbRelatedEntityRef> relationships)
            : this(resultType, attributeValues)
        {
            Debug.Assert(TypeSemantics.IsEntityType(resultType), "An entity type is required to create a NewEntityWithRelationships expression");
            Debug.Assert(relationships != null, "Related entity ref collection cannot be null");

            this._relatedEntityRefs = (relationships.Count > 0 ? relationships : null);
        }
Esempio n. 39
0
        void encrave(IWebDriver driver)
        {
            bool clickPlayer = false;
            bool nCraveLoop  = true;
            bool checks      = false;

            string[] titles = { "PrizeRebel.com | Earn", "Entertainmentcrave.com" };

            Helpers.wait(5000);
            Helpers.switchToBrowserFrameByStringClass(driver, "iframeOfferWall");
            Helpers.wait(5000);
            Helpers.switchFrameByNumber(driver, 0);

            try
            {
                Helpers.wait(5000);
                int textCounters = 0;
                IList <IWebElement> disableTexts = driver.FindElements(By.ClassName("disableText"));
                foreach (IWebElement disableText in disableTexts)
                {
                    Helpers.wait(5000);
                    if (textCounters == disableTexts.Count - 1)
                    {
                        disableText.Click();
                    }
                    textCounters++;
                }
            }
            catch { }

            Helpers.switchToBrowserByString(driver, "Entertainmentcrave.com");

            int hr = DateTime.Now.Hour;

            while (nCraveLoop)
            {
                System.Collections.ObjectModel.ReadOnlyCollection <string> windowHandles = driver.WindowHandles;

                foreach (String window in windowHandles)
                {
                    try
                    {
                        IWebDriver popup = driver.SwitchTo().Window(window);
                    }
                    catch { }

                    try
                    {
                        driver.FindElement(By.Id("beginPromo")).Click();
                    }
                    catch { }

                    try
                    {
                        if (driver.Title.Contains("Facebook"))
                        {
                            driver.Close();
                        }
                    }
                    catch { }

                    if (hr != DateTime.Now.Hour)
                    {
                        nCraveLoop = false;
                    }
                    //Start of Slides
                    Helpers.switchToBrowserByString(driver, "Entertainmentcrave");
                    Helpers.switchToBrowserFrameByString(driver, "contIframe");

                    Helpers.ByClass(driver, "flite-close-button");

                    Helpers.switchToBrowserByString(driver, "Entertainmentcrave");
                    Helpers.switchToBrowserFrameByString(driver, "contIframe");

                    try
                    {
                        driver.FindElement(By.ClassName("next")).FindElement(By.CssSelector("a[href*='nextPage']")).Click();
                    }
                    catch { }

                    Helpers.wait(1000);

                    Helpers.ByClass(driver, "_next");

                    try
                    {
                        driver.FindElement(By.ClassName("wp-post-navigation-next")).Click();
                    }
                    catch { }

                    Helpers.wait(1000);

                    try
                    {
                        driver.FindElement(By.ClassName("wp-post-navigation-next-1")).Click();
                    }
                    catch { }

                    Helpers.wait(1000);

                    try
                    {
                        driver.FindElement(By.ClassName("bx-next")).Click();
                    }
                    catch { }

                    Helpers.wait(1000);

                    try
                    {
                        driver.FindElement(By.ClassName("start-slideshow_btn")).Click();
                    }
                    catch { }

                    Helpers.wait(1000);

                    try
                    {
                        driver.FindElement(By.ClassName("next_btn")).Click();
                    }
                    catch { }

                    Helpers.wait(1000);

                    try
                    {
                        driver.FindElement(By.ClassName("GalleryBig-nextArrow")).Click();
                    }
                    catch { }

                    Helpers.wait(1000);

                    try
                    {
                        driver.FindElement(By.ClassName("GalleryBig")).Click();
                    }
                    catch { }

                    Helpers.wait(1000);

                    try
                    {
                        Helpers.switchToBrowserByString(driver, "Entertainmentcrave");
                        Helpers.switchToBrowserFrameByString(driver, "contIframe");

                        driver.FindElement(By.ClassName("owl-buttons")).FindElement(By.ClassName("owl-next")).Click();
                    }
                    catch { }

                    Helpers.wait(1000);

                    try
                    {
                        Helpers.switchToBrowserByString(driver, "Entertainmentcrave");
                        Helpers.switchToBrowserFrameByString(driver, "contIframe");

                        driver.FindElement(By.ClassName("gallery-counters")).SendKeys(Keys.PageUp);
                        Helpers.wait(1000);
                        driver.FindElement(By.LinkText("Next")).Click();
                    }
                    catch { }

                    Helpers.wait(1000);

                    try
                    {
                        Helpers.switchToBrowserByString(driver, "Entertainmentcrave");
                        Helpers.switchToBrowserFrameByString(driver, "contIframe");

                        driver.FindElement(By.ClassName("gallery-counters")).SendKeys(Keys.PageUp);
                        Helpers.wait(1000);
                        driver.FindElement(By.ClassName("gallery-counters")).SendKeys(Keys.PageUp);
                        Helpers.wait(1000);
                        driver.FindElement(By.LinkText("Next")).Click();
                    }
                    catch { }

                    Helpers.wait(1000);

                    try
                    {
                        driver.FindElement(By.ClassName("btn-slideshow")).Click();
                    }
                    catch { }
                    //End of Slides

                    Helpers.wait(1000);

                    //Video
                    try
                    {
                        if (!clickPlayer)
                        {
                            IWebElement clickNext = driver.FindElement(By.ClassName("vdb_player"));
                            clickNext.Click();
                            clickPlayer = true;
                        }
                    }
                    catch { }
                    //End Video

                    Helpers.wait(1000);

                    //Check Marks
                    try
                    {
                        if (!driver.FindElement(By.ClassName("navPages")).Displayed)
                        {
                            checks = true;
                        }
                    }
                    catch { }

                    try
                    {
                        if (!checks)
                        {
                            IList <IWebElement> urlLinks = driver.FindElements(By.ClassName("url-link"));
                            if (urlLinks.Count > 0)
                            {
                                foreach (IWebElement urlLink in urlLinks)
                                {
                                    Random rnd = new Random();
                                    urlLink.Click();
                                    Helpers.wait(1000 * rnd.Next(60, 90));
                                    Helpers.switchToBrowserByString(driver, "Entertainmentcrave");
                                }

                                System.Collections.ObjectModel.ReadOnlyCollection <string> awindowHandles = driver.WindowHandles;

                                foreach (String awindow in awindowHandles)
                                {
                                    try
                                    {
                                        IWebDriver popup = driver.SwitchTo().Window(awindow);
                                    }
                                    catch { }

                                    if (driver.Title.Contains("Entertainmentcrave"))
                                    {
                                        Helpers.switchToBrowserByString(driver, driver.Title);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    catch { }

                    try
                    {
                        driver.SwitchTo().DefaultContent();
                    }
                    catch { }

                    //Link Up or Down
                    try
                    {
                        if (driver.FindElement(By.ClassName("active")).Displayed)
                        {
                            Random upDownRnd = new Random();
                            if (upDownRnd.Next(1, 2) < 2)
                            {
                                try
                                {
                                    IWebElement up = driver.FindElement(By.Id("link_up"));
                                    up.Click();
                                    clickPlayer = false;
                                }
                                catch { }
                            }
                            else
                            {
                                try
                                {
                                    IWebElement down = driver.FindElement(By.Id("link_down"));
                                    down.Click();
                                    clickPlayer = false;
                                }
                                catch { }
                            }
                        }
                    }
                    catch { }

                    //Keep Craving
                    try
                    {
                        driver.FindElement(By.ClassName("keepCraving")).Click();
                        Helpers.closeWindows(driver, titles);
                        clickPlayer = false;
                        checks      = false;
                    }
                    catch { }
                }
            }
        }
Esempio n. 40
0
 public static string Last(this System.Collections.ObjectModel.ReadOnlyCollection <string> handles, IWebDriver driver)
 {
     return(handles[handles.Count - 1]);
 }
 public static TimeZoneInfo TimezoneMap_StaThread(String organiserTz, TimeZoneInfo bestEffortTzi, System.Collections.ObjectModel.ReadOnlyCollection <TimeZoneInfo> sysTZ)
 {
     System.Threading.Thread tzThread = new System.Threading.Thread(() => new TimezoneMap(organiserTz, bestEffortTzi).ShowDialog());
     tzThread.SetApartmentState(System.Threading.ApartmentState.STA);
     tzThread.Start();
     tzThread.Join();
     return(GetSystemTimezone(organiserTz, sysTZ));
 }
Esempio n. 42
0
        public Image CreateImage()
        {
            using (Bitmap desktop = CaptureScreen.CaptureScreen.GetDesktopImage())
            {
                System.Windows.Media.Geometry shapeGeometry = GetCaptureShape();
                System.Windows.Rect           bounds        =
                    shapeGeometry.GetRenderBounds(new System.Windows.Media.Pen(System.Windows.Media.Brushes.Black, 1));

                System.Windows.Point screenTopLeft  = _surface.PointToScreen(bounds.TopLeft),
                                     screenBotRight = _surface.PointToScreen(bounds.BottomRight);


                RectangleF screenRect =
                    new RectangleF((float)screenTopLeft.X, (float)screenTopLeft.Y,
                                   (float)(screenBotRight.X - screenTopLeft.X),
                                   (float)(screenBotRight.Y - screenTopLeft.Y)),

                           dstRect = new RectangleF(0, 0, screenRect.Width, screenRect.Height);

                System.Drawing.Bitmap img = new Bitmap((int)dstRect.Width, (int)dstRect.Height);
                img.SetResolution(desktop.HorizontalResolution, desktop.VerticalResolution);
                using (Graphics g = Graphics.FromImage(img))
                {
                    g.Clear(Color.Transparent);
                    g.DrawImage(desktop, dstRect, screenRect, GraphicsUnit.Pixel);
                }

                System.Drawing.Imaging.BitmapData data = null;
                try
                {
                    data = img.LockBits(
                        new Rectangle(0, 0, (int)dstRect.Width, (int)dstRect.Height),
                        System.Drawing.Imaging.ImageLockMode.ReadWrite,
                        img.PixelFormat);

                    // Get the address of the first line.
                    IntPtr ptr = data.Scan0;
                    // Assume 4 channels - blue, green, red, alpha
                    int bytesPerPixel = 4;
                    // Declare an array to hold the bytes of the bitmap.
                    // This code is specific to a bitmap with 32 bits per pixels
                    // (32 bits = 4 bytes, 3 for RGB and 1 byte for alpha).
                    int    numBytes   = img.Width * img.Height * bytesPerPixel;
                    byte[] argbValues = new byte[numBytes];

                    // Copy the ARGB values into the array.
                    System.Runtime.InteropServices.Marshal.Copy(ptr, argbValues, 0, numBytes);

                    int stride = data.Stride,
                        bytes  = data.Stride * img.Height;

                    // Split the points into x and y vertices
                    System.Collections.ObjectModel.ReadOnlyCollection <System.Drawing.Point> points = _shape.Points;
                    List <float> vx = new List <float>(), vy = new List <float>();
                    foreach (System.Drawing.Point p in points)
                    {
                        vx.Add(p.X);
                        vy.Add(p.Y);
                    }

                    // Set alpha channel to 0 for all pixels not within the selected shape.
                    // This is the slowest part of the capture.
                    ScreenInfo si = ScreenInfo.AllScreenInfo;
                    for (int y = 0; y < data.Height; y++)
                    {
                        for (int x = 0; x < data.Width; x++)
                        {
                            // Offset by the lowest screen points
                            System.Windows.Point scr = new System.Windows.Point((float)(x + screenTopLeft.X - si.MinX),
                                                                                (float)(y + screenTopLeft.Y - si.MinY));
                            bool poly = pnpoly(points.Count, vx, vy, (float)scr.X, (float)scr.Y);
                            if (!poly)
                            {
                                argbValues[(y * stride) + (x * bytesPerPixel) + 3] = 0;
                            }
                        }
                    }

                    // Copy the ARGB values back to the bitmap
                    System.Runtime.InteropServices.Marshal.Copy(argbValues, 0, ptr, numBytes);
                }
                finally
                {
                    if (data != null)
                    {
                        img.UnlockBits(data);
                    }
                }

                return(img);
                //System.Windows.Media.Imaging.PngBitmapEncoder encoder =
                //    new System.Windows.Media.Imaging.PngBitmapEncoder();
            }
        }
Esempio n. 43
0
 public static ElementInit ElementInit(Aqua.TypeSystem.MethodInfo addMethod, System.Collections.ObjectModel.ReadOnlyCollection <Expression> arguments)
 {
     return(new ElementInit(addMethod, arguments));
 }
Esempio n. 44
0
        /// <summary>
        /// Construct FieldMetadata for structuralType.Members from TypeUsage
        /// </summary>
        internal DataRecordInfo(TypeUsage metadata)
        {
            Debug.Assert(null != metadata, "invalid attempt to instantiate DataRecordInfo with null metadata information");

            IBaseList<EdmMember> structuralMembers = TypeHelpers.GetAllStructuralMembers(metadata);
            FieldMetadata[] fieldList = new FieldMetadata[structuralMembers.Count];
            for (int i = 0; i < fieldList.Length; ++i)
            {
                EdmMember member = structuralMembers[i];
                Debug.Assert((BuiltInTypeKind.EdmProperty == member.BuiltInTypeKind) ||
                             (BuiltInTypeKind.AssociationEndMember == member.BuiltInTypeKind),
                             "unexpected BuiltInTypeKind for member");
                fieldList[i] = new FieldMetadata(i, member);
            }
            _fieldMetadata = new System.Collections.ObjectModel.ReadOnlyCollection<FieldMetadata>(fieldList);
            _metadata = metadata;

        }
        // Получение постов в группах и составление списка userIdsToGet
        /// <summary>
        /// Receives the group posts.
        /// </summary>
        /// <param name="userIdsToGet">The user ids to get.</param>
        /// <param name="vkPostsToProcess">The vk posts to process.</param>
        void ReceiveGroupPosts(List<long> userIdsToGet, List<Post> vkPostsToProcess)
        {
            for (int i = 0; i < 3; i++)
            {
                if (currentVkGroup == vkGroupsCount)
                {
                    try
                    {
                        GroupsGetParams vkGroupsParams = new GroupsGetParams();

                        vkGroupsParams.UserId = vk.UserId.Value;
                        vkGroupsParams.Extended = true;

                        var newVkGroups = vk.Groups.Get(vkGroupsParams);

                        vkGroups = newVkGroups;
                        vkGroupsCount = vkGroups.Count;
                    }
                    catch
                    {
                    }

                    currentVkGroup = 0;

                    if (vkGroupsCount == 0)
                        break;
                    else
                        continue;
                }

                Group vkGroup = vkGroups[currentVkGroup];
                long vkGroupId = vkGroup.Id;

                //Console.WriteLine("vkGroup.Name " + vkGroup.Name);

                if (!string.IsNullOrEmpty(vkGroup.Name))
                {
                    groupNamesDict[vkGroupId] = vkGroup.Name;
                }

                currentVkGroup++;

                if (lastReceivingDateForGroups.ContainsKey(vkGroupId) == false)
                    lastReceivingDateForGroups[vkGroupId] = DateTime.Now;

                WallGetParams vkWallParams = new WallGetParams();

                vkWallParams.Count = 50;
                vkWallParams.Offset = 0;
                vkWallParams.OwnerId = -vkGroup.Id; // needs to be negative

                WallGetObject vkWalls = null;

                try // useless, but it would throw an exception if the user is not a member (was deleted) or the group id is wrong.
                {
                    vkWalls = vk.Wall.Get(vkWallParams);
                }
                catch (Exception)
                {
                    continue;
                }

                var posts = vkWalls.WallPosts;
                foreach (var post in posts)
                {
                    if (post.Date.HasValue)
                    {
                        //Console.WriteLine("post.Date " + post.Date.Value.ToString() + " lastReceivingDateForGroups[vkGroupId] " + lastReceivingDateForGroups[vkGroupId].ToString());

                        if (post.Date.Value <= lastReceivingDateForGroups[vkGroupId])
                            continue;

                        if (post.Date.Value > lastReceivingDateForGroups[vkGroupId])
                            lastReceivingDateForGroups[vkGroupId] = post.Date.Value;
                    }
                    else continue;

                    // Составление списка userIdsToGet (id пользователей, которых надо получить с сервера) из постов
                    if (post.FromId.HasValue)
                    {
                        if (post.FromId.Value > 0)
                        {
                            long vkMessageUserId = post.FromId.Value;

                            if ((!usersDict.ContainsKey(vkMessageUserId)) && (!userIdsToGet.Contains(vkMessageUserId)))
                                userIdsToGet.Add(vkMessageUserId);
                        }
                    }

                    vkPostsToProcess.Add(post);
                }
            }
        }
 public SecurityContextSecurityToken(System.Xml.UniqueId contextId, string id, byte[] key, DateTime validFrom, DateTime validTo, System.Collections.ObjectModel.ReadOnlyCollection <System.IdentityModel.Policy.IAuthorizationPolicy> authorizationPolicies)
 {
 }
        /// <summary>
        /// Функция логина в вк.
        /// </summary>
        /// <param name="login">Логин.</param>
        /// <param name="password">Пароль.</param>
        /// <returns>True, если успешно, false, если нет.</returns>
        public bool LogInVk(string login, string password)
        {
            if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password)) return false;
            /*if (!CheckIfThisUserExistsInVK(login, password))
            {
                return false;
            }*/
            ClearMsgStack();
            usersDict.Clear();
            groupNamesDict.Clear();
            receivedPostsCounter = -1;
            vkGroups = null;
            vkGroupsCount = 0;
            currentVkGroup = 0;
            lastReceivingDateForGroups.Clear();

            try
            {
                var auth = new ApiAuthParams();

                Settings scope = Settings.All;
                auth.Login = login;
                auth.Password = password;
                auth.ApplicationId = 5322484;
                auth.Settings = scope;

                // Первое, что пришло в голову. Есть примеры лучше? Правим код!
                try
                {
                    vk.Authorize(auth);
                }
                catch (Exception)
                {
                    using (TwoFactorAuthForm authForm = new TwoFactorAuthForm())
                    {
                        auth.TwoFactorAuthorization = authForm.ShowDialogAndReturnKey;

                        vk.Authorize(auth);
                    }
                }

            }
            catch (Exception)
            {
                return false;
            }

            //lastReceivingDate = DateTime.Now;

            return (isLogged = true);
        }
Esempio n. 48
0
        private VectorTileLayer ProcessLineStringTile(ShapeFile shapeFile, int tileX, int tileY, int zoom, OutputTileFeatureDelegate outputTileFeature)
        {
            int        tileSize   = TileSize;
            RectangleD tileBounds = TileUtil.GetTileLatLonBounds(tileX, tileY, zoom, tileSize);

            //create a buffer around the tileBounds
            tileBounds.Inflate(tileBounds.Width * 0.05, tileBounds.Height * 0.05);

            int simplificationFactor = Math.Min(10, Math.Max(1, SimplificationPixelThreshold));

            System.Drawing.Point tilePixelOffset = new System.Drawing.Point((tileX * tileSize), (tileY * tileSize));

            List <int> indicies = new List <int>();

            shapeFile.GetShapeIndiciesIntersectingRect(indicies, tileBounds);
            GeometryAlgorithms.ClipBounds clipBounds = new GeometryAlgorithms.ClipBounds()
            {
                XMin = -20,
                YMin = -20,
                XMax = tileSize + 20,
                YMax = tileSize + 20
            };
            bool outputMeasureValues = this.OutputMeasureValues && (shapeFile.ShapeType == ShapeType.PolyLineM || shapeFile.ShapeType == ShapeType.PolyLineZ);

            System.Drawing.Point[] pixelPoints           = new System.Drawing.Point[1024];
            System.Drawing.Point[] simplifiedPixelPoints = new System.Drawing.Point[1024];
            double[] simplifiedMeasures = new double[1024];

            PointD[] pointsBuffer = new PointD[1024];

            VectorTileLayer tileLayer = new VectorTileLayer();

            tileLayer.Extent  = (uint)tileSize;
            tileLayer.Version = 2;
            tileLayer.Name    = !string.IsNullOrEmpty(shapeFile.Name) ? shapeFile.Name : System.IO.Path.GetFileNameWithoutExtension(shapeFile.FilePath);

            if (indicies.Count > 0)
            {
                foreach (int index in indicies)
                {
                    if (outputTileFeature != null && !outputTileFeature(shapeFile, index, zoom, tileX, tileY))
                    {
                        continue;
                    }

                    VectorTileFeature feature = new VectorTileFeature()
                    {
                        Id         = index.ToString(System.Globalization.CultureInfo.InvariantCulture),
                        Geometry   = new List <List <Coordinate> >(),
                        Attributes = new List <AttributeKeyValue>()
                    };

                    //get the point data
                    var recordPoints = shapeFile.GetShapeDataD(index);
                    System.Collections.ObjectModel.ReadOnlyCollection <double[]> recordMeasures = null;

                    if (outputMeasureValues)
                    {
                        recordMeasures = shapeFile.GetShapeMDataD(index);
                    }

                    List <double> outputMeasures = new List <double>();
                    int           partIndex      = 0;
                    foreach (PointD[] points in recordPoints)
                    {
                        double[] measures = recordMeasures != null ? recordMeasures[partIndex] : null;
                        //convert to pixel coordinates;
                        if (pixelPoints.Length < points.Length)
                        {
                            pixelPoints           = new System.Drawing.Point[points.Length + 10];
                            simplifiedPixelPoints = new System.Drawing.Point[points.Length + 10];
                            simplifiedMeasures    = new double[points.Length + 10];
                        }

                        for (int n = 0; n < points.Length; ++n)
                        {
                            Int64 x, y;
                            TileUtil.LLToPixel(points[n], zoom, out x, out y, tileSize);
                            pixelPoints[n].X = (int)(x - tilePixelOffset.X);
                            pixelPoints[n].Y = (int)(y - tilePixelOffset.Y);
                        }

                        int outputCount = 0;
                        SimplifyPointData(pixelPoints, measures, points.Length, simplificationFactor, simplifiedPixelPoints, simplifiedMeasures, ref pointsBuffer, ref outputCount);

                        //output count may be zero for short records at low zoom levels as
                        //the pixel coordinates wil be a single point after simplification
                        if (outputCount > 0)
                        {
                            List <int> clippedPoints = new List <int>();
                            List <int> parts         = new List <int>();

                            if (outputMeasureValues)
                            {
                                List <double> clippedMeasures = new List <double>();
                                GeometryAlgorithms.PolyLineClip(simplifiedPixelPoints, outputCount, clipBounds, clippedPoints, parts, simplifiedMeasures, clippedMeasures);
                                outputMeasures.AddRange(clippedMeasures);
                            }
                            else
                            {
                                GeometryAlgorithms.PolyLineClip(simplifiedPixelPoints, outputCount, clipBounds, clippedPoints, parts);
                            }
                            if (parts.Count > 0)
                            {
                                //output the clipped polyline
                                for (int n = 0; n < parts.Count; ++n)
                                {
                                    int index1 = parts[n];
                                    int index2 = n < parts.Count - 1 ? parts[n + 1] : clippedPoints.Count;

                                    List <Coordinate> lineString = new List <Coordinate>();
                                    feature.GeometryType = Tile.GeomType.LineString;
                                    feature.Geometry.Add(lineString);
                                    //clipped points store separate x/y pairs so there will be two values per measure
                                    for (int i = index1; i < index2; i += 2)
                                    {
                                        lineString.Add(new Coordinate(clippedPoints[i], clippedPoints[i + 1]));
                                    }
                                }
                            }
                        }
                        ++partIndex;
                    }

                    //add the record attributes
                    string[] fieldNames = shapeFile.GetAttributeFieldNames();
                    string[] values     = shapeFile.GetAttributeFieldValues(index);
                    for (int n = 0; n < values.Length; ++n)
                    {
                        feature.Attributes.Add(new AttributeKeyValue(fieldNames[n], values[n].Trim()));
                    }
                    if (outputMeasureValues)
                    {
                        string s = Newtonsoft.Json.JsonConvert.SerializeObject(outputMeasures, new DoubleFormatConverter(4));
                        feature.Attributes.Add(new AttributeKeyValue(this.MeasuresAttributeName, s));
                    }

                    if (feature.Geometry.Count > 0)
                    {
                        tileLayer.VectorTileFeatures.Add(feature);
                    }
                }
            }
            return(tileLayer);
        }
        public override System.Collections.ObjectModel.ReadOnlyCollection<PrimitiveType> GetStoreTypes()
        {
            if (this._primitiveTypes == null)
            {
                if (this._version == SqlVersion.Sql10)
                {
                    this._primitiveTypes = base.GetStoreTypes();
                }
                else
                {
                    List<PrimitiveType> primitiveTypes = new List<PrimitiveType>(base.GetStoreTypes());
                    Debug.Assert((this._version == SqlVersion.Sql8) || (this._version == SqlVersion.Sql9), "Found verion other than Sql 8, 9 or 10");
                    //Remove the Katmai types for both Sql8 and Sql9
                    primitiveTypes.RemoveAll(new Predicate<PrimitiveType>(
                                                        delegate(PrimitiveType primitiveType)
                                                        {
                                                            string name = primitiveType.Name.ToLowerInvariant();
                                                            return name.Equals("time", StringComparison.Ordinal) || 
                                                                   name.Equals("date", StringComparison.Ordinal) || 
                                                                   name.Equals("datetime2", StringComparison.Ordinal) || 
                                                                   name.Equals("datetimeoffset", StringComparison.Ordinal) ||
                                                                   name.Equals("geography", StringComparison.Ordinal) || 
                                                                   name.Equals("geometry", StringComparison.Ordinal);
                                                        }
                                                    )
                                        );
                    //Remove the types that won't work in Sql8
                    if (this._version == SqlVersion.Sql8)                    {
                        
                        // SQLBUDT 550667 and 551271: Remove xml and 'max' types for SQL Server 2000
                        primitiveTypes.RemoveAll(new Predicate<PrimitiveType>(
                                                            delegate(PrimitiveType primitiveType)
                                                            {
                                                                string name = primitiveType.Name.ToLowerInvariant();
                                                                return name.Equals("xml", StringComparison.Ordinal) || name.EndsWith("(max)", StringComparison.Ordinal);
                                                            }
                                                        )
                                            );                        
                    }
                    this._primitiveTypes = primitiveTypes.AsReadOnly();
                }
            }

            return this._primitiveTypes;
        }
Esempio n. 50
0
        private void SetContext(DataPortalContext context)
        {
            _oldLocation = Csla.ApplicationContext.LogicalExecutionLocation;
            ApplicationContext.SetLogicalExecutionLocation(ApplicationContext.LogicalExecutionLocations.Server);

            // if the dataportal is not remote then
            // do nothing
            if (!context.IsRemotePortal)
            {
                return;
            }

            // set the context value so everyone knows the
            // code is running on the server
            ApplicationContext.SetExecutionLocation(ApplicationContext.ExecutionLocations.Server);

            // set the app context to the value we got from the
            // client
            ApplicationContext.SetContext(context.ClientContext, context.GlobalContext);

            // set the thread's culture to match the client
#if !PCL46 && !PCL259 // rely on NuGet bait-and-switch for actual implementation
#if NETCORE
            System.Globalization.CultureInfo.CurrentCulture =
                new System.Globalization.CultureInfo(context.ClientCulture);
            System.Globalization.CultureInfo.CurrentUICulture =
                new System.Globalization.CultureInfo(context.ClientUICulture);
#elif NETFX_CORE
            var list = new System.Collections.ObjectModel.ReadOnlyCollection <string>(new List <string> {
                context.ClientUICulture
            });
            Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView().Languages = list;
            list = new System.Collections.ObjectModel.ReadOnlyCollection <string>(new List <string> {
                context.ClientCulture
            });
            Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView().Languages = list;
#else
            System.Threading.Thread.CurrentThread.CurrentCulture =
                new System.Globalization.CultureInfo(context.ClientCulture);
            System.Threading.Thread.CurrentThread.CurrentUICulture =
                new System.Globalization.CultureInfo(context.ClientUICulture);
#endif
#endif

            if (ApplicationContext.AuthenticationType == "Windows")
            {
                // When using integrated security, Principal must be null
                if (context.Principal != null)
                {
                    Csla.Security.SecurityException ex =
                        new Csla.Security.SecurityException(Resources.NoPrincipalAllowedException);
                    //ex.Action = System.Security.Permissions.SecurityAction.Deny;
                    throw ex;
                }
#if !(ANDROID || IOS) && !NETFX_CORE
                // Set .NET to use integrated security
                AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
#endif
            }
            else
            {
                // We expect the some Principal object
                if (context.Principal == null)
                {
                    Csla.Security.SecurityException ex =
                        new Csla.Security.SecurityException(
                            Resources.BusinessPrincipalException + " Nothing");
                    //ex.Action = System.Security.Permissions.SecurityAction.Deny;
                    throw ex;
                }
                ApplicationContext.User = context.Principal;
            }
        }
Esempio n. 51
0
        public void DebuggerProxy_FrameworkTypes_ReadOnlyCollection()
        {
            var obj = new System.Collections.ObjectModel.ReadOnlyCollection<int>(new[] { 1, 2, 3 });

            var str = CSharpObjectFormatter.Instance.FormatObject(obj, s_inline);
            Assert.Equal("ReadOnlyCollection<int>(3) { 1, 2, 3 }", str);
        }
Esempio n. 52
0
 public StartupEventArgs(System.Collections.ObjectModel.ReadOnlyCollection <string> args)
 {
 }
Esempio n. 53
0
 private PatternMatchRuleProcessor(System.Collections.ObjectModel.ReadOnlyCollection<PatternMatchRule> rules)
 {
     Debug.Assert(rules.Count() != 0, "At least one PatternMatchRule is required");
     Debug.Assert(rules.Where(r => r == null).Count() == 0, "Individual PatternMatchRules must not be null");
     
     this.ruleSet = rules;
 }
Esempio n. 54
0
 public StartupNextInstanceEventArgs(System.Collections.ObjectModel.ReadOnlyCollection <string> args, bool bringToForegroundFlag)
 {
 }
Esempio n. 55
0
 public override NHibernate.Hql.Ast.HqlTreeNode BuildHql(System.Reflection.MethodInfo method, System.Linq.Expressions.Expression targetObject, System.Collections.ObjectModel.ReadOnlyCollection <System.Linq.Expressions.Expression> arguments, NHibernate.Hql.Ast.HqlTreeBuilder treeBuilder, NHibernate.Linq.Visitors.IHqlExpressionVisitor visitor)
 {
     throw new NotImplementedException();
 }
Esempio n. 56
0
        /* Setting shapeCondition and positionCondition */
        private void CommandsParser(SpeechRecognizedEventArgs e)
        {
            var result = e.Result;

            System.Collections.ObjectModel.ReadOnlyCollection <RecognizedWordUnit> words = e.Result.Words;

            if (words[0].Text == "draw")
            {
                string colorObject = words[1].Text;
                switch (colorObject)
                {
                case "red":
                    objectColor = Colors.Red;
                    break;

                case "green":
                    objectColor = Colors.Green;
                    break;

                case "blue":
                    objectColor = Colors.Blue;
                    break;

                case "yellow":
                    objectColor = Colors.Yellow;
                    break;

                case "gray":
                    objectColor = Colors.Gray;
                    break;

                default:
                    return;
                }

                var shapeString = words[2].Text;
                switch (shapeString)
                {
                case "circle":
                    shapeCondition = 1;
                    width          = 30; height = 30;
                    break;

                case "square":
                    shapeCondition = 2;
                    width          = 30; height = 30;
                    break;

                case "rectangle":
                    shapeCondition = 2;
                    width          = 40; height = 20;
                    break;

                default:
                    return;
                }

                var handString = words[3].Text;
                switch (handString)
                {
                case "righthand":
                    positionCondition = 1;
                    break;

                case "lefthand":
                    positionCondition = 2;
                    break;
                }
            }

            if (words[0].Text == "close" && words[1].Text == "the" && words[2].Text == "application")
            {
                this.Close();
            }
        }
Esempio n. 57
0
 public Object.Object getObject(int _Id)
 {
     if (this.quadTreeObject != null)
     {
         List<QuadTree<Object.Object>.QuadNode> var_Copy = new List<QuadTree<Object.Object>.QuadNode>(this.quadTreeObject.GetAllNodes());
         foreach (QuadTree<Object.Object>.QuadNode var_QuadNode in var_Copy)
         {
             System.Collections.ObjectModel.ReadOnlyCollection<Object.Object> var_Copy2 = new System.Collections.ObjectModel.ReadOnlyCollection<Object.Object>(var_QuadNode.Objects);
             foreach (Object.Object var_Object in var_Copy2)
             {
                 if (var_Object.Id == _Id)
                 {
                     return var_Object;
                 }
             }
         }
     }
     return null;
 }
        public static AfcError afc_read_directory(AfcClientHandle client, string path, out System.Collections.ObjectModel.ReadOnlyCollection <string> directoryInformation)
        {
            System.Runtime.InteropServices.ICustomMarshaler directoryInformationMarshaler = AfcDictionaryMarshaler.GetInstance(null);
            System.IntPtr directoryInformationNative = System.IntPtr.Zero;
            AfcError      returnValue = AfcNativeMethods.afc_read_directory(client, path, out directoryInformationNative);

            directoryInformation = ((System.Collections.ObjectModel.ReadOnlyCollection <string>)directoryInformationMarshaler.MarshalNativeToManaged(directoryInformationNative));
            directoryInformationMarshaler.CleanUpNativeData(directoryInformationNative);
            return(returnValue);
        }
Esempio n. 59
0
        private void getObjectsInRange(Rectangle bounds, QuadTree<Object.Object>.QuadNode currentNode, List<Object.Object> result, List<SearchFlags.Searchflag> _SearchFlags)
        {
            if (Utility.Collision.Intersection.RectangleIsInRectangle(bounds, currentNode.Bounds))
            {
                System.Collections.ObjectModel.ReadOnlyCollection<QuadTree<Object.Object>.QuadNode> var_Copy = new System.Collections.ObjectModel.ReadOnlyCollection<QuadTree<Object.Object>.QuadNode>(currentNode.Nodes);

                foreach (QuadTree<Object.Object>.QuadNode node in var_Copy)
                {
                    if (node != null)
                    {
                        if (Utility.Collision.Intersection.RectangleIsInRectangle(bounds, node.Bounds))
                        {
                            getObjectsInRange(bounds, node, result, _SearchFlags);
                        }
                    }
                }

                //Aggrocircle fit into a subnode? then
                addAllObjectsInRange(currentNode, bounds, result, _SearchFlags);
                return;
            }
            if (currentNode.Equals(this.quadTreeObject.Root))
            {
                addAllObjectsInRange(currentNode, bounds, result, _SearchFlags);
            }
        }
        public static AfcError afc_get_file_info(AfcClientHandle client, string filename, out System.Collections.ObjectModel.ReadOnlyCollection <string> fileInformation)
        {
            System.Runtime.InteropServices.ICustomMarshaler fileInformationMarshaler = AfcDictionaryMarshaler.GetInstance(null);
            System.IntPtr fileInformationNative = System.IntPtr.Zero;
            AfcError      returnValue           = AfcNativeMethods.afc_get_file_info(client, filename, out fileInformationNative);

            fileInformation = ((System.Collections.ObjectModel.ReadOnlyCollection <string>)fileInformationMarshaler.MarshalNativeToManaged(fileInformationNative));
            fileInformationMarshaler.CleanUpNativeData(fileInformationNative);
            return(returnValue);
        }