Пример #1
0
 //Constructor for Enumeration
 public SimpleType(string name, List<string> options)
 {
     Name = name;
     _restriction = Restriction.Enumeration;
     _basicType = BasicType.String;
     _options = options;
 }
Пример #2
0
 public IKJoint(Transform t)
 {
     this.transform = t;
     this.xRange = new Restriction();
     this.yRange = new Restriction();
     this.zRange = new Restriction();
 }
Пример #3
0
        public void Add(Restriction item)
        {
            List <Restriction> items = new List <Restriction>()
            {
                item
            };

            InsertItems(_folder, _type, items.ToList(), items.ConvertAll(i => i.Id.ToString()));
        }
Пример #4
0
 public static void InitQueryAllRows(MapiTable msgTable, Restriction restriction, ICollection <PropTag> propTags)
 {
     if (restriction != null)
     {
         msgTable.Restrict(restriction);
     }
     msgTable.SeekRow(BookMark.Beginning, 0);
     msgTable.SetColumns(propTags);
 }
Пример #5
0
 internal Restriction[] GetRestrictions()
 {
     Restriction[] array = new Restriction[this.Restrictions.Length];
     for (int i = 0; i < this.Restrictions.Length; i++)
     {
         array[i] = this.Restrictions[i].GetRestriction();
     }
     return(array);
 }
Пример #6
0
 protected void mfbQueryDescriptor1_QueryUpdated(object sender, FilterItemClicked fic)
 {
     if (fic == null)
     {
         throw new ArgumentNullException("fic");
     }
     mfbSearchForm1.Restriction = Restriction.ClearRestriction(fic.FilterItem);
     Refresh();
 }
Пример #7
0
 protected void mfbQueryDescriptor1_QueryUpdated(object sender, FilterItemClickedEventArgs fic)
 {
     if (fic == null)
     {
         throw new ArgumentNullException(nameof(fic));
     }
     Restriction.ClearRestriction(fic.FilterItem);
     UpdateRestriction();
 }
Пример #8
0
 protected static Restriction CreateCcToMeRestriction()
 {
     return(Restriction.And(new Restriction[]
     {
         Condition.CreateBooleanPropertyRestriction(PropTag.MessageCcMe, true, Restriction.RelOp.Equal),
         Condition.CreateBooleanPropertyRestriction(PropTag.MessageRecipMe, true, Restriction.RelOp.Equal),
         Condition.CreateBooleanPropertyRestriction(PropTag.MessageToMe, false, Restriction.RelOp.Equal)
     }));
 }
 internal override Restriction GetRestriction()
 {
     PropValue[] array = new PropValue[this.PropValues.Length];
     for (int i = 0; i < this.PropValues.Length; i++)
     {
         array[i] = DataConverter <PropValueConverter, PropValue, PropValueData> .GetNative(this.PropValues[i]);
     }
     return(Restriction.Comment(base.GetRestrictions()[0], array));
 }
Пример #10
0
 protected static Restriction CreateRecipientRestriction(IList <Participant> participants)
 {
     if (participants.Count > 0)
     {
         Restriction restriction = Rule.OrAddressList(participants, PropTag.DisplayName);
         return(new Restriction.RecipientRestriction(restriction));
     }
     return(null);
 }
Пример #11
0
 protected void ResolvePrintLink()
 {
     lnkPrintView.NavigateUrl = String.Format(CultureInfo.InvariantCulture, "~/Member/PrintView.aspx?po={0}&fq={1}",
                                              HttpUtility.UrlEncode(Convert.ToBase64String(JsonConvert.SerializeObject(PrintOptions1.Options, new JsonSerializerSettings()
     {
         DefaultValueHandling = DefaultValueHandling.Ignore
     }).Compress())),
                                              HttpUtility.UrlEncode(Restriction.ToBase64CompressedJSONString()));
 }
Пример #12
0
        public JsonResult setRegister(string tdoRegisterID, string jobNumber, string dateReceived, string expiryDate, string status, string cargoTypeID, string fileRef,
                                      string destinationID, string terminalID, string containerNo, string returnTerminal, string truckID, string tdoReceiptDate, string schDelDate,
                                      string remarks, string createdByID, string sessionID)
        {
            List <ClsUserDisplay> userDisplay = new List <ClsUserDisplay>();

            using (tdoEntities db = new tdoEntities())
            {
                userDisplay = db.uspGetUserDisplay(GetID()).ToList <ClsUserDisplay>();
            }
            List <string> editableForms = Restriction.GetEditableForms(userDisplay);
            List <string> addableForms  = Restriction.GetAddableForms(userDisplay);

            if (int.Parse(tdoRegisterID) == 0 && !addableForms.Contains("Register"))
            {
                return(Json(new { id = 0, isSuccess = false, msg = "You are not allowed to add new records." }));
            }
            else if (int.Parse(tdoRegisterID) != 0 && !editableForms.Contains("Register"))
            {
                return(Json(new { id = 0, isSuccess = false, msg = "You are not allowed to edit records." }));
            }

            if (tdoRegisterID == "")
            {
                tdoRegisterID = "0";
            }

            Guid Session = new Guid(GetSession()); //do not hard code session ID and createdbyID
            int  _id     = 0;

            try { _id = int.Parse(tdoRegisterID.Trim()); }
            catch { }
            ClsRegister obj = new ClsRegister()
            {
                tdoRegisterID  = _id,
                jobNumber      = jobNumber,
                dateReceived   = StringToArray.ConvertToDate(dateReceived),
                expiryDate     = StringToArray.ConvertToDate(expiryDate),
                status         = status,
                cargoTypeID    = int.Parse(cargoTypeID),
                fileRef        = fileRef,
                destinationID  = int.Parse(destinationID),
                terminalID     = int.Parse(terminalID),
                containerNo    = containerNo,
                returnTerminal = int.Parse(returnTerminal),
                truckID        = int.Parse(truckID),
                tdoReceiptDate = StringToArray.ConvertToDate(tdoReceiptDate),
                schDelDate     = StringToArray.ConvertToDate(schDelDate),
                remarks        = remarks,
                createdByID    = GetID(),
                sessionID      = Session
            };
            ClsReturnValues k = Modules.setRegister(obj);

            return(Json(new { id = k.ID, isSuccess = k.IsSuccess ?? false ? 1 : 0, msg = k.Response }));
        }
        protected override void ProcessJobs(MapiStore systemMbx, MapiTable contentsTable, RequestJobNamedPropertySet nps)
        {
            SortOrder sortOrder = new SortOrder(nps.PropTags[17], SortFlags.Descend);

            sortOrder.Add(nps.PropTags[7], SortFlags.Ascend);
            MrsTracer.Service.Debug("Searching for MRs to Rehome...", new object[0]);
            Restriction restriction = Restriction.And(new Restriction[]
            {
                Restriction.EQ(nps.PropTags[4], false),
                Restriction.EQ(nps.PropTags[20], true)
            });

            MrsTracer.Service.Debug("Searching for MRs to Suspend...", new object[0]);
            base.ProcessJobsInBatches(restriction, false, sortOrder, contentsTable, systemMbx, null);
            Restriction restriction2 = Restriction.And(new Restriction[]
            {
                Restriction.BitMaskNonZero(nps.PropTags[10], 256),
                Restriction.EQ(nps.PropTags[4], false),
                Restriction.EQ(nps.PropTags[20], false),
                Restriction.NE(nps.PropTags[0], RequestStatus.Failed),
                Restriction.NE(nps.PropTags[0], RequestStatus.Suspended),
                Restriction.NE(nps.PropTags[0], RequestStatus.AutoSuspended),
                Restriction.NE(nps.PropTags[0], RequestStatus.Completed),
                Restriction.NE(nps.PropTags[0], RequestStatus.CompletedWithWarning)
            });

            base.ProcessJobsInBatches(restriction2, false, sortOrder, contentsTable, systemMbx, null);
            MrsTracer.Service.Debug("Searching for MRs to Resume...", new object[0]);
            Restriction restriction3 = Restriction.And(new Restriction[]
            {
                Restriction.BitMaskZero(nps.PropTags[10], 256),
                Restriction.EQ(nps.PropTags[4], false),
                Restriction.EQ(nps.PropTags[20], false),
                Restriction.Or(new Restriction[]
                {
                    Restriction.EQ(nps.PropTags[0], RequestStatus.Failed),
                    Restriction.EQ(nps.PropTags[0], RequestStatus.Suspended),
                    Restriction.EQ(nps.PropTags[0], RequestStatus.AutoSuspended)
                })
            });

            base.ProcessJobsInBatches(restriction3, false, sortOrder, contentsTable, systemMbx, null);
            SortOrder sort   = new SortOrder(nps.PropTags[13], SortFlags.Ascend);
            DateTime  utcNow = DateTime.UtcNow;

            MrsTracer.Service.Debug("Searching for Completed MRs to clean up...", new object[0]);
            Restriction restriction4 = Restriction.And(new Restriction[]
            {
                Restriction.EQ(nps.PropTags[20], false),
                Restriction.EQ(nps.PropTags[4], false),
                Restriction.EQ(nps.PropTags[0], RequestStatus.Completed),
                Restriction.NE(nps.PropTags[13], SystemMailboxLightJobs.defaultDoNotPickUntil)
            });

            base.ProcessJobsInBatches(restriction4, false, sort, contentsTable, systemMbx, (MoveJob moveJob) => moveJob.DoNotPickUntilTimestamp > utcNow);
        }
Пример #14
0
        protected override void ProcessRecord()
        {
            Restriction newRestrict = this.ParametersToRestriction(this.MyInvocation.BoundParameters);

            if (base.ShouldProcess(string.Format(SHOULD_MSG, newRestrict.Ignored.ToJson(), newRestrict.Required.ToJson()), "New"))
            {
                Restriction restriction = base.SendSonarrPost <Restriction>(GetRestriction.EP, newRestrict);
                base.SendToPipeline(restriction);
            }
        }
        bool IDestinationFolder.SetSearchCriteria(RestrictionData restriction, byte[][] entryIds, SearchCriteriaFlags flags)
        {
            Restriction native = DataConverter <RestrictionConverter, Restriction, RestrictionData> .GetNative(restriction);

            using (base.Mailbox.RHTracker.Start())
            {
                base.Folder.SetSearchCriteria(native, entryIds, flags);
            }
            return(true);
        }
Пример #16
0
 public Help(string subModuleName, string commandName, Argument[] arguments, string description, string[] aliases, Restriction restriction, string example)
 {
     SubmoduleName = subModuleName;
     CommandName   = commandName;
     Arguments     = arguments;
     Description   = description;
     Aliases       = aliases;
     Restriction   = restriction;
     Example       = example;
 }
Пример #17
0
        protected static Restriction CreateOnlyToMeRestriction()
        {
            Restriction[] array = new Restriction[3];
            array[0] = Condition.CreateBooleanPropertyRestriction(PropTag.MessageToMe, true, Restriction.RelOp.Equal);
            Restriction restriction = Condition.CreateStringContentRestriction(PropTag.DisplayTo, ";", ContentFlags.SubString);

            array[1] = Restriction.Not(restriction);
            array[2] = Condition.CreatePropertyRestriction <string>(PropTag.DisplayCc, string.Empty);
            return(Restriction.And(array));
        }
        /// <summary>
        /// Get Restriction Test Data
        /// </summary>
        /// <returns></returns>
        private Restriction GetRestrictionTestData()
        {
            var res = new Restriction
            {
                Code        = 1,
                Description = "Test"
            };

            return(res);
        }
        public void ensureRemovingDuplicateRestrictionThrowsException()
        {
            Product         p    = new Product("#666", "der alte würfelt nicht", "product666.glb", PREDEFEFINED_CATEGORY, PREDEFINED_MATERIALS, PREDEFINED_MEASUREMENTS);
            ProductMaterial pm   = new ProductMaterial(p, PREDEFINED_MATERIAL2);
            Restriction     rest = new Restriction("restriction", new SameMaterialAndFinishAlgorithm());

            Action addNullRestrictionCreation = () => pm.removeRestriction(rest);

            Assert.Throws <ArgumentException>(addNullRestrictionCreation);
        }
        // Token: 0x060018D4 RID: 6356 RVA: 0x0002C6FC File Offset: 0x0002B6FC
        public bool IsPowerupRestricted(Restriction restriction, EntrantInfo entrantInfo, Event evnt)
        {
            if (entrantInfo == null)
            {
                return(true);
            }
            LocalHumanOpponent localHumanOpponent = entrantInfo.Opponent as LocalHumanOpponent;
            DragScoringState   dragScoringState   = entrantInfo.ScoringState as DragScoringState;

            if (dragScoringState == null)
            {
                return(true);
            }
            if (dragScoringState.EventDurationInSeconds < evnt.EventDef.PowerupBlackoutAtEventStart() && localHumanOpponent != null && !this.IsJumpStartActive(entrantInfo, evnt))
            {
                return(true);
            }
            switch (restriction)
            {
            case Restriction.kPowerupRestriction_NobodyHasFinishedEvent:
                foreach (EntrantInfo entrantInfo2 in evnt.Entrants)
                {
                    DragScoringState dragScoringState2 = entrantInfo2.ScoringState as DragScoringState;
                    if (dragScoringState2 != null && dragScoringState2.FractionCompleted > 0.95f)
                    {
                        return(true);
                    }
                }
                break;

            case Restriction.kPowerupRestriction_IAmNotInFirstPlace:
            {
                if (dragScoringState.Rank == 1)
                {
                    return(true);
                }
                int num = 999;
                foreach (EntrantInfo entrantInfo3 in evnt.Entrants)
                {
                    bool flag = entrantInfo3.Opponent.IsStatus(OpponentStatus.kOpponent_Disconnected);
                    RouteScoringState routeScoringState = entrantInfo3.ScoringState as RouteScoringState;
                    if (routeScoringState != null && routeScoringState.FinishReason == FinishReason.Unknown && !flag && routeScoringState.Rank < num)
                    {
                        num = routeScoringState.Rank;
                    }
                }
                if (num == dragScoringState.Rank)
                {
                    return(true);
                }
                break;
            }
            }
            return(false);
        }
        private Restriction GetExistingRestriction()
        {
            var existingRestriction = parent.Restrictions[this.countryCode];

            if (existingRestriction == null)
            {
                existingRestriction = new Restriction();
            }

            return(existingRestriction);
        }
Пример #22
0
        /// <summary>
        /// Checks whether a given <paramref name="UserID"/> which represents a user who has a set of restrictions <paramref name="Restriction"/>.
        /// </summary>
        /// <remarks>
        ///     <para>If <paramref name="MatchAny"/> is <see langword="true"/>, it will return <see langword="true"/> if the user has ANY of the restrictions flagged by <paramref name="Restriction"/>.</para>
        ///     <para>If <paramref name="MatchAny"/> is <see langword="false"/>, it will only return <see langword="true"/> if the user has ALL flagged restrictions.</para>
        /// </remarks>
        /// <param name="UserID">The Id of the target user to query the database for.</param>
        /// <param name="Restriction">The individual or multiple restriction(s) to check for.</param>
        /// <param name="MatchAny">Dictates the matching mode, if set to <see langword="true"/>, the matching becomes non-strict.</param>
        /// <returns><see langword="true"/> if the user has all restriction flags in <paramref name="Restriction"/>, otherwise <see langword="false"/>.</returns>

        public bool IsUserRestricted(ulong UserID, Restriction Restriction, bool MatchAny = false)
        {
            if (MatchAny)
            {
                return((GetUserRestrictions(UserID) & Restriction) != Restriction.None);
            }
            else
            {
                return((GetUserRestrictions(UserID) & Restriction) == Restriction);
            }
        }
Пример #23
0
        public void oneRestrictionTest()
        {
            Restriction r = RestrictionBuilder.blank()
                            .credDefId("SDFSDF")
                            .build();
            Attribute a            = new Attribute("test", r);
            JsonArray restrictions = a.data.getAsJsonArray("restrictions");

            Assert.AreEqual(1, restrictions.Count);
            Assert.AreEqual(restrictions.ToString(), "[{\"cred_def_id\": \"SDFSDF\"}]");
        }
Пример #24
0
 private static bool Contains(Restriction condition, Restriction[] conditionArray)
 {
     foreach (Restriction b in conditionArray)
     {
         if (ConditionComparer.Equals(condition, b))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #25
0
        private void restrictionsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (((ComboBox)sender).SelectedIndex < 0)
            {
                return;
            }

            Restriction restriction = (Restriction)((ComboBox)sender).Items[((ComboBox)sender).SelectedIndex];

            this.restrictionsListBox.Items.Add(restriction);
            this.restrictionsComboBox.SelectedIndex = -1;
        }
Пример #26
0
        internal override Restriction BuildRestriction()
        {
            byte[][] array = new byte[base.Text.Length][];
            for (int i = 0; i < base.Text.Length; i++)
            {
                string s = base.Text[i].ToUpperInvariant();
                array[i] = CTSGlobals.AsciiEncoding.GetBytes(s);
            }
            Restriction restriction = Condition.CreateORSearchKeyContentRestriction(array, PropTag.SearchKey, ContentFlags.SubString);

            return(new Restriction.RecipientRestriction(restriction));
        }
        private void Parse([NotNull] string response)
        {
            Debug.ArgumentNotNull(response, nameof(response));

            restrictions.Clear();
            publishingTargets.Clear();

            var root = response.ToXElement();

            if (root == null)
            {
                return;
            }

            ItemPublishable.IsChecked = root.GetAttributeValue("publishable") == @"1";
            ItemPublishFrom.Value     = ToDateTime(root, "publishfrom");
            ItemPublishTo.Value       = ToDateTime(root, "publishto");

            var versions = root.Element(@"versions");

            if (versions != null)
            {
                foreach (var element in versions.Elements())
                {
                    var restriction = new Restriction
                    {
                        Version     = element.GetAttributeInt("number", 0),
                        Publishable = element.GetAttributeValue("publishable") == @"1",
                        PublishFrom = ToDateTime(element, "publishfrom"),
                        PublishTo   = ToDateTime(element, "publishto"),
                    };

                    restrictions.Add(restriction);
                }
            }

            var targets = root.Element(@"targets");

            if (targets != null)
            {
                foreach (var element in targets.Elements())
                {
                    var publishingTarget = new PublishingTarget
                    {
                        Id         = element.GetAttributeValue("id"),
                        Name       = element.GetAttributeValue("name"),
                        IsSelected = element.GetAttributeValue("isselected") == @"1"
                    };

                    publishingTargets.Add(publishingTarget);
                }
            }
        }
Пример #28
0
        public void EqualsTest()
        {
            var color1       = new Color(1);
            var color2       = new Color(2);
            var variable1    = new Variable(new[] { color1 });
            var variable2    = new Variable(new[] { color2 });
            var restriction  = new Restriction(variable1, color1, variable2, color2);
            var restriction2 = new Restriction(variable1, color1, variable2, color2);

            Assert.True(restriction == restriction2);
            Assert.Equal(restriction, restriction2);
        }
Пример #29
0
        public IHttpActionResult PostRestriction(Restriction restriction)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Oc.Add(restriction);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = restriction.Id }, restriction));
        }
        public void ensureAddRestrictionSucceeds()
        {
            Product         p    = new Product("#666", "der alte würfelt nicht", "product666.glb", PREDEFEFINED_CATEGORY, PREDEFINED_MATERIALS, PREDEFINED_MEASUREMENTS);
            ProductMaterial pm   = new ProductMaterial(p, PREDEFINED_MATERIAL2);
            Restriction     rest = new Restriction("restriction", new SameMaterialAndFinishAlgorithm());

            Action addValidRestrictionAction = () => pm.addRestriction(rest);

            Exception exception = Record.Exception(addValidRestrictionAction);

            Assert.Null(exception);
            Assert.True(pm.hasRestriction(rest));
        }
Пример #31
0
        internal override Restriction BuildRestriction()
        {
            Restriction restriction = Condition.CreateORStringContentRestriction(base.Text, PropTag.MessageClass, ContentFlags.IgnoreCase | ContentFlags.Loose);

            if (Restriction.ResType.Content == restriction.Type)
            {
                return(Restriction.Or(new Restriction[]
                {
                    restriction
                }));
            }
            return(restriction);
        }
        /// <summary>
        /// Creates a model view with a restriction information
        /// </summary>
        /// <param name="restriction">Restriction with the restriction being created the model view</param>
        /// <returns>GetRestrictionModelView with the restriction information model view</returns>
        public static GetRestrictionModelView fromEntity(Restriction restriction)
        {
            if (restriction == null)
            {
                throw new ArgumentNullException(NULL_RESTRICTION);
            }

            GetRestrictionModelView restrictionModelView = new GetRestrictionModelView();

            restrictionModelView.id          = restriction.Id;
            restrictionModelView.description = restriction.description;
            throw new NotImplementedException();
        }
Пример #33
0
        //Constructor for Max/Min
        public SimpleType(string name, BasicType basicType, decimal min, decimal max)
        {
            Name = name;
            _restriction = Restriction.MaxMin;
            _basicType = basicType;
            _max = max;
            _min = min;

            // Handle decimal not able to check number equality. (precision is not required)
            if (basicType == BasicType.Decimal)
            {
                _min = _min - (1 / 999999999999);
                _max = _max + (1 / 999999999999);
            }
        }
        public static string GetMessage(Restriction restriction, int lcid, object input)
        {
            Dictionary<string, Dictionary<int, string>> msgs = LazyLoadMessages();
            Dictionary<int, string> local;
            string msg;

            if (msgs.TryGetValue(restriction.GetType().FullName, out local))
            {
                if (local.TryGetValue(lcid, out msg))
                    return string.Format(msg, input);
                else
                    return string.Format(restriction.RestrictionMessageFormat, input);
            }
            else
                return string.Format(restriction.RestrictionMessageFormat, input);
        }
Пример #35
0
        /// <summary>
        /// Adds unique restrictions and doesn't add restrictions which are alerady present
        /// </summary>
        private static void AddRestrictions(Restriction[] list, List<Restriction> res) {
            foreach (Restriction r in list) {
                bool found = false;
                for (int j = 0; j < res.Count; j++) {
                    if (res[j] == r) {
                        found = true;
                    }
                }

                if (!found) {
                    res.Add(r);
                }
            }
        }
Пример #36
0
 public void TestNormalizeBefore()
 {
     var restriction = new Restriction {Constraints = {new Constraint {Before = new ImplementationVersion("2.0")}}};
     restriction.Normalize();
     Assert.AreEqual(new VersionRange("..!2.0"), restriction.Versions);
 }
Пример #37
0
 public Attribute()
 {
     Restriction = new Restriction();
     SpecialLength = false;
 }
Пример #38
0
 public Game(string id, string title, decimal price, Genre genre, Restriction restriction = Restriction.Minor)
     : this(id, title, price, new List<Genre> { genre }, restriction)
 {
 }
Пример #39
0
 public Game(string id, string title, decimal price, IList<Genre> genres, Restriction restriction = Restriction.Minor)
     : base(id, title, price, genres)
 {
     this.AgeRestriction = restriction;
 }
Пример #40
0
 /// <summary>
 /// Define a mapping of integer levels and the restriction level names 
 /// and determine if the current restriction level is at the given
 /// level. The highest level of restriction is 1 the lowest and
 /// +infinity
 /// </summary>
 /// <param name="level"></param>
 /// <returns></returns>
 private bool isRestrictionLevel(Restriction level)
 {
     Debug.Assert(level > 0);
     String rlev = "";
     XmlPreferences.theXmlPreferences.GetPref("restrictionLevel", out rlev);
     if (rlev == null)
         return false;
     switch (level)
     {
         case Restriction.MINIMALLY_RESTRICTED:
             if (rlev == "minimum")
                 return true;
             break;
         case Restriction.SOMEWHAT_RESTRICTED:
             if (rlev == "intermediate")
                 return true;
             break;
         case Restriction.FULLY_RESTRICTED:
             if (rlev == "maximum")
                 return true;
             break;
     }
     return false;
 }
Пример #41
0
            private static String ProcessArray(Type type, XMLNamespace xns)
            {
                Util.Log("RealSchemaType.ProcessArray Enter "+type);
                String qname = null;
                bool bbinary = false;
                Type elementType = type.GetElementType();
                String elementTypeName = "ArrayOf";
                while (elementType.IsArray)
                {
                    elementTypeName = elementTypeName+"ArrayOf";
                    elementType = elementType.GetElementType();
                }

                qname = RealSchemaType.TypeName(elementType, true, xns);
                int index = qname.IndexOf(":");
                String prefix = qname.Substring(0, index);
                String wireName = qname.Substring(index+1);
                Util.Log("RealSchemaType.ProcessArray qname "+qname+" wirename "+wireName);
                int rank =  type.GetArrayRank();
                String rankStr = "";
                if (rank > 1)
                    rankStr = rank.ToString(CultureInfo.InvariantCulture);
                String csname =elementTypeName+wireName.Substring(0,1).ToUpper(CultureInfo.InvariantCulture)+wireName.Substring(1)+rankStr;
                csname = csname.Replace('+','N'); // need to get rid of + in nested classes
                ArraySchemaType ast = xns.LookupArraySchemaType(csname); 
                if (ast == null)
                {
                    ArraySchemaType cstype = new ArraySchemaType(type, csname, SchemaBlockType.ComplexContent, false);
                    Restriction restriction = new Restriction();
                    SchemaAttribute attribute = new SchemaAttribute();
                    if (bbinary)
                        attribute.AddArray(qname);
                    else
                    {
                        String arrayTypeName = type.Name;
                        index = arrayTypeName.IndexOf("[");
                        attribute.AddArray(qname+arrayTypeName.Substring(index));
                    }

                    restriction.AddArray(attribute);
                    cstype.AddParticle(restriction);
                    xns.AddArraySchemaType(cstype);
                }

                String returnStr = xns.Prefix+":"+csname;
                Util.Log("RealSchemaType.ProcessArray Exit "+returnStr);
                return returnStr;
            }
Пример #42
0
 //Constructor for General
 public SimpleType(string name, BasicType basicType)
 {
     Name = name;
     _restriction = Restriction.Basic;
     _basicType = basicType;
 }
Пример #43
0
            public RestrictionCollection(
				String name, int numberIdentifierParts, Restriction[] restrictions)
            {
                this.Name         = name;
                this.NumberIdentifierParts = numberIdentifierParts;
                this.Restrictions = restrictions;
            }
Пример #44
0
            public RestrictionCollection(
				String name, Restriction[] restrictions)
            {
                this.Name         = name;
                this.NumberIdentifierParts = restrictions.Length;
                this.Restrictions = restrictions;
            }
        private void ProcessAttributes(XmlSchemaComplexType schemaComplexType, Element element)
        {
            var enumerator = schemaComplexType.AttributeUses.GetEnumerator();

            while (enumerator.MoveNext())
            {
                var xmlAttribute = (XmlSchemaAttribute)enumerator.Value;
                var attribute = new Parts.Attribute
                {
                    Name = xmlAttribute.Name,
                    Type = xmlAttribute.SchemaTypeName.Name,
                    Default = xmlAttribute.DefaultValue ?? "",
                    Use = xmlAttribute.Use.ToString(),
                    Documentation = GetDocumentation(xmlAttribute.Annotation),
                    Parent = element,
                };
                attribute.IsAdvanced = SpecialCaseHandlers.IsAdvanced(attribute, element);
                attribute.SpecialLength = SpecialCaseHandlers.SpecialLength(attribute, element);
                attribute.RootObject = "Xsd";

                if (xmlAttribute.AttributeSchemaType.Content.GetType().ToString() == "System.Xml.Schema.XmlSchemaSimpleTypeRestriction")
                {
                    var xmlRestrication = xmlAttribute.AttributeSchemaType.Content as XmlSchemaSimpleTypeRestriction;
                    if (xmlRestrication != null)
                    {
                        var restriction = new Restriction();

                        foreach (var facet in xmlRestrication.Facets.Cast<XmlSchemaEnumerationFacet>())
                        {
                            restriction.Enumerations.Add(facet.Value);
                        }

                        attribute.Restriction = restriction;
                    }
                }

                element.Attributes.Add(attribute);
            }
        }
Пример #46
0
        //--- Methods ---
        public Opts(string[] argArray) {
            List<string> args = new List<string>(argArray);
            int index = 0;
            bool? archive = null;
            Func<XDoc> exportDocumentBuilder = null;
            while(index < args.Count) {
                if(WantUsage) {
                    break;
                }
                string key = args[index];
                string value = (index + 1 >= args.Count) ? null : args[index + 1];
                bool handled = false;
                if(key.StartsWith("-") || key.StartsWith("/")) {
                    handled = true;
                    key = key.Remove(0, 1);
                    switch(key) {
                    case "a":
                    case "archive":
                        archive = true;
                        break;
                    case "A":
                    case "authtoken":
                        AuthToken = value;
                        index++;
                        break;
                    case "C":
                    case "config":
                        index++;
                        List<string> extra = ConfigureFromXml(value);
                        extra.Reverse();
                        foreach(string opt in extra) {
                            args.Insert(index + 1, opt);
                        }
                        break;
                    case "c":
                    case "copy":
                        Mode = Mode.Copy;
                        break;
                    case "cap":
                        index++;
                        var split = value.Split(new[] { '=' }, 2);
                        var name = split[0];
                        var v = (split.Length == 2) ? split[1] : null;
                        Capabilities.Add(new KeyValuePair<string, string>(name,v));
                        break;
                    case "e":
                    case "export":
                        Mode = Mode.Export;
                        break;
                    case "p":
                    case "exportPath":
                        string exportPath = value;
                        ExportPath = exportPath;
                        exportDocumentBuilder = delegate() { return CreateExportDocumentFromSinglePath(exportPath); };
                        index++;
                        break;
                    case "D":
                    case "exportdoc":
                        string exportDocumentPath = value;
                        exportDocumentBuilder = delegate() { return LoadExportDocumentFromFile(exportDocumentPath); };
                        index++;
                        break;
                    case "f":
                    case "folder":
                        archive = false;
                        break;
                    case "L":
                    case "exportlist":
                        string exportListPath = value;
                        exportDocumentBuilder = delegate() { return CreateExportDocumentFromList(exportListPath); };
                        index++;
                        break;
                    case "l":
                    case "preservelocal":
                        PreserveLocalChanges = true;
                        break;
                    case "O":
                    case "overwritelocal":
                        PreserveLocalChanges = false;
                        break;
                    case "g":
                    case "genconfig":
                        GenConfig = true;
                        _genConfigPath = value;
                        index++;
                        break;
                    case "h":
                    case "host":
                        try {
                            if(!value.StartsWithInvariantIgnoreCase("http://") && !value.StartsWithInvariantIgnoreCase("https://")) {
                                DekiApi = Plug.New(string.Format("http://{0}/@api/deki", value));
                            } else {
                                DekiApi = Plug.New(new XUri(value).At("@api", "deki"));
                            }
                        } catch {
                            throw new ConfigurationException("Invalid host format {0}", value);
                        }
                        index++;
                        break;
                    case "I":
                    case "importreltopath":
                        ImportReltoPath = Title.FromUIUri(null, value).AsPrefixedDbPath();
                        index++;
                        break;
                    case "importrelto":
                        ImportRelto = int.Parse(value);
                        index++;
                        break;
                    case "X":
                    case "exportreltopath":
                        ExportReltoPath = Title.FromUIUri(null, value).AsPrefixedDbPath();
                        index++;
                        break;
                    case "exportrelto":
                        ExportRelto = int.Parse(value);
                        index++;
                        break;
                    case "P":
                    case "password":
                        Password = value;
                        index++;
                        break;
                    case "r":
                    case "recursive":
                        _exportRecursive = true;
                        break;
                    case "R":
                    case "retries":
                        Retries = int.Parse(value);
                        index++;
                        break;
                    case "s":
                    case "securityrestriction":
                        try {
                            Restriction = SysUtil.ChangeType<Restriction>(value);
                        } catch {
                            throw new ConfigurationException("invalid securityrestriction: {0}", value);
                        }
                        index++;
                        break;
                    case "U":
                    case "user":
                        User = value;
                        index++;
                        break;
                    case "u":
                    case "uri":
                        DekiApi = Plug.New(value);
                        index++;
                        break;
                    case "?":
                    case "usage":
                        WantUsage = true;
                        break;
                    case "t":
                        Test = true;
                        break;
                    default:
                        handled = false;
                        break;
                    }
                }
                if(!handled) {
                    if(index + 1 == args.Count && Mode != Mode.Copy) {
                        FilePath = key;
                    } else {
                        throw new ConfigurationException("Unknown option {0}", key);
                    }
                }
                index++;
            }
            if(WantUsage) {
                return;
            }
            if(!string.IsNullOrEmpty(FilePath)) {
                string ext = Path.GetExtension(FilePath);
                if(!archive.HasValue) {

                    // Note (arnec): .zip and .mtap are still being handled for backwards compatibility, but have been removed from docs
                    if(ext.EqualsInvariantIgnoreCase(".mtapp") || ext.EqualsInvariantIgnoreCase(".mtarc") ||
                       ext.EqualsInvariantIgnoreCase(".zip") || ext.EqualsInvariantIgnoreCase(".mtap")) {
                        archive = true;
                    }
                }
            }
            Archive = archive ?? false;
            if(Mode != Mode.Import && ExportDocument == null) {
                if(exportDocumentBuilder == null) {
                    exportDocumentBuilder = delegate() { return CreateExportDocumentFromSinglePath(ExportReltoPath); };
                }
                ExportDocument = exportDocumentBuilder();
            }

            if(Mode == Mode.Copy || !string.IsNullOrEmpty(FilePath)) {
                return;
            }
            if(Archive) {
                throw new ConfigurationException("Missing {0} Archive filepath", Mode);
            }
            throw new ConfigurationException("Missing {0} Directory", Mode);
        }
Пример #47
0
 public void TestNormalizeOverlap()
 {
     var restriction = new Restriction
     {
         Constraints =
         {
             new Constraint {NotBefore = new ImplementationVersion("1.0"), Before = new ImplementationVersion("2.0")},
             new Constraint {NotBefore = new ImplementationVersion("0.9"), Before = new ImplementationVersion("1.9")},
         }
     };
     restriction.Normalize();
     Assert.AreEqual(new VersionRange("1.0..!1.9"), restriction.Versions);
 }
Пример #48
0
 public void TestNormalizeRange()
 {
     var restriction = new Restriction {InterfaceUri = FeedTest.Test1Uri, Constraints = {new Constraint {NotBefore = new ImplementationVersion("1.0"), Before = new ImplementationVersion("2.0")}}};
     restriction.Normalize();
     restriction.Versions.Should().Be(new VersionRange("1.0..!2.0"));
 }
Пример #49
0
 private static string GetRestrictionString(Restriction restriction) {
     switch(restriction) {
     case Restriction.Private:
         return "Private";
     case Restriction.SemiPublic:
         return "Semi-Public";
     default:
         return "Public";
     }
 }
Пример #50
0
        private static UPnPComplexType ParseComplexType(XmlTextReader X, UPnPComplexType RetVal)
        {
            string elementName = X.LocalName;
            int count = 0;
            bool done = false;
            DText P = new DText();
            P.ATTRMARK = ":";

            RetVal.AddContainer(new GenericContainer());

            do
            {
                switch (X.NodeType)
                {
                case XmlNodeType.Element:
                    switch (X.LocalName)
                    {
                    case "complexType":
                    case "group":
                        ++count;
                        if (X.HasAttributes)
                        {
                            for (int i = 0; i < X.AttributeCount; i++)
                            {
                                X.MoveToAttribute(i);
                                if (X.Name == "name")
                                {
                                    P[0] = X.Value;
                                    if (P.DCOUNT() == 1)
                                    {
                                        RetVal.LocalName = X.Value;
                                        RetVal.NameSpace = X.LookupNamespace("");
                                    }
                                    else
                                    {
                                        RetVal.LocalName = P[2];
                                        RetVal.NameSpace = X.LookupNamespace(P[1]);
                                    }
                                }
                                else if (X.Name == "ref")
                                {
                                    // NOP
                                }
                            }
                            X.MoveToElement();
                        }
                        break;
                    case "sequence":
                    case "choice":
                        RetVal.CurrentContainer.AddCollection(ParseComplexType_SequenceChoice(X));
                                //ParseComplexType_Sequence(X,RetVal);
                        break;
                    case "complexContent":
                        RetVal.AddContainer(new ComplexContent());
                        break;
                    case "simpleContent":
                        RetVal.AddContainer(new SimpleContent());
                        break;
                    case "restriction":
                        Restriction r = new Restriction();
                        if (RetVal.CurrentContainer.GetType() == typeof(ComplexContent))
                        {
                            ((ComplexContent)RetVal.CurrentContainer).RestExt = r;
                        }
                        else if (RetVal.CurrentContainer.GetType() == typeof(SimpleContent))
                        {
                            ((SimpleContent)RetVal.CurrentContainer).RestExt = r;
                        }
                        if (X.HasAttributes)
                        {
                            for (int i = 0; i < X.AttributeCount; i++)
                            {
                                X.MoveToAttribute(i);
                                if (X.Name == "base")
                                {
                                    P[0] = X.Value;
                                    if (P.DCOUNT() == 1)
                                    {
                                        r.baseType = X.Value;
                                        r.baseTypeNS = X.LookupNamespace("");
                                    }
                                    else
                                    {
                                        r.baseType = P[2];
                                        r.baseTypeNS = X.LookupNamespace(P[1]);
                                    }
                                }
                            }
                            X.MoveToElement();
                        }
                        break;
                    }
                    break;
                case XmlNodeType.EndElement:
                    if (X.LocalName == elementName)
                    {
                        --count;
                        if (count == 0)
                        {
                            done = true;
                        }
                    }
                    break;
                case XmlNodeType.Text:
                    break;
                }
            } while(!done && X.Read());
            return(RetVal);
        }