Пример #1
0
        /// <summary>
        /// When overridden in a descendant class, serializes the object into XML according to Aadhaar API specification.
        /// </summary>
        /// <param name="elementName">The name of the element.</param>
        /// <returns>An instance of <see cref="XElement"/>.</returns>
        protected override XElement SerializeXml(string elementName)
        {
            ValidateNull(Uses, nameof(Uses));
            ValidateNull(DeviceInfo, nameof(DeviceInfo));
            ValidateNull(KeyInfo, nameof(KeyInfo));
            ValidateNull(Data, nameof(Data));
            ValidateEmptyString(AadhaarNumber, nameof(AadhaarNumber));
            ValidateEmptyString(Hmac, nameof(Hmac));

            var authRequest = base.SerializeXml(elementName);

            authRequest.Add(new XAttribute("uid", AadhaarNumber),
                            new XAttribute("ver", AuthVersion),
                            Uses.ToXml("Uses"),
                            DeviceInfo.ToXml("Meta"),
                            KeyInfo.ToXml("Skey"),
                            Data.ToXml("Data"),
                            new XElement("Hmac", Hmac));
            if (Token != null)
            {
                authRequest.Add(Token.ToXml("Tkn"));
            }

            Signer?.ComputeSignature(authRequest);

            return(authRequest);
        }
Пример #2
0
        public async Task <IActionResult> DeleteApiUses(ApiUses apiUses)
        {
            Uses uses = new Uses
            {
                RecipeId = apiUses.RecipeId,
                IngrName = apiUses.IngrName,
                Quantity = apiUses.Quantity,
                UnitName = apiUses.UnitName
            };

            _context.Entry(uses).State = EntityState.Deleted;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ApiUsesExists(apiUses.RecipeId, apiUses.UnitName, apiUses.IngrName))
                {
                    return(NotFound());
                }

                throw;
            }

            return(NoContent());
        }
Пример #3
0
        public override void SubstituteUse(IRVariable variable, IRExpression expression)
        {
            if (ReferenceEquals(Address, variable))
            {
                Address = expression.CloneComplete();
            }
            else
            {
                Address.Substitute(variable, expression);
            }

            Uses.Clear();
            Uses.UnionWith(Address.GetAllVariables());

            if (ReferenceEquals(Operand, variable))
            {
                Operand = expression.CloneComplete();
            }
            else
            {
                Operand.Substitute(variable, expression);
            }

            Uses.UnionWith(Operand.GetAllVariables());
        }
Пример #4
0
 public IRReturn(IRBasicBlock parentBlock, IRExpression returnValue)
     : base(parentBlock)
 {
     ReturnValue = returnValue;
     if (!(ReturnValue is null))
     {
         Uses.UnionWith(ReturnValue.GetAllVariables());
     }
 }
Пример #5
0
 public override void draw(SpriteBatch sprite_batch, Vector2 draw_offset = default(Vector2))
 {
     Name.draw(sprite_batch, draw_offset - ((this.loc + draw_vector()) + new Vector2(16, 0) - offset));
     Uses.draw(sprite_batch, draw_offset - ((this.loc + draw_vector()) + new Vector2(112, 0) - offset));
     Slash.draw(sprite_batch, draw_offset - ((this.loc + draw_vector()) + new Vector2(160, 0) - offset));
     Use_Max.draw(sprite_batch, draw_offset - ((this.loc + draw_vector()) + new Vector2(200, 0) - offset));
     Convoy.draw(sprite_batch, draw_offset - ((this.loc + draw_vector()) + new Vector2(232, 0) - offset));
     Icon.draw(sprite_batch, draw_offset - ((this.loc + draw_vector()) - offset));
 }
Пример #6
0
        public override void set_text_color(bool useable)
        {
            change_text_color(useable ? "White" : "Grey");

            string color = useable ? "Blue" : "Grey";

            Uses.SetColor(Global.Content, color);
            Slash.SetColor(Global.Content, color);
            Use_Max.SetColor(Global.Content, color);
        }
Пример #7
0
        public Operand With(OperandKind kind, OperandType type = OperandType.None, ulong value = 0)
        {
            Kind = kind;
            Type = type;
            Value = value;

            Assignments.Clear();
            Uses.Clear();
            return this;
        }
Пример #8
0
 public override void draw(SpriteBatch sprite_batch, Vector2 draw_offset = default(Vector2))
 {
     Name.draw(sprite_batch, draw_offset - ((this.loc + draw_vector()) + new Vector2(16, 0) - offset));
     if (Uses != null)
     {
         Uses.draw(sprite_batch, draw_offset - ((this.loc + draw_vector()) + new Vector2(96, 0) - offset));
         Slash.draw(sprite_batch, draw_offset - ((this.loc + draw_vector()) + new Vector2(97, 0) - offset));
         Use_Max.draw(sprite_batch, draw_offset - ((this.loc + draw_vector()) + new Vector2(96, 0) - offset));
         Icon.draw(sprite_batch, draw_offset - ((this.loc + draw_vector()) - offset));
     }
 }
Пример #9
0
        protected virtual void set_text_color(bool useable, bool buyable)
        {
            change_text_color(useable ? "White" : "Grey");

            Uses.SetColor(Global.Content, useable ? "Blue" : "Grey");

            Slash.SetColor(Global.Content, buyable ? "Blue" : "Grey");
            Use_Max.SetColor(Global.Content, buyable ? "Blue" : "Grey");

            Convoy.SetColor(Global.Content, "Blue");
        }
Пример #10
0
 public IRAssignment(IRBasicBlock parentBlock, IRExpression destination, IRExpression source)
     : base(parentBlock)
 {
     Destination = destination;
     Source      = source;
     if (Destination is IRVariable v)
     {
         Defs.Add(v);
     }
     Uses.UnionWith(Source.GetAllVariables());
 }
Пример #11
0
 public IRStore(IRBasicBlock parentBlock, IRType type, IRExpression address, IRExpression operand)
     : base(parentBlock)
 {
     if (type == IRPrimitive.Void || type == IRPrimitive.Bool)
     {
         throw new IRTypeException();
     }
     Type    = type;
     Address = address;
     Operand = operand;
     Uses.UnionWith(Address.GetAllVariables());
     Uses.UnionWith(Operand.GetAllVariables());
 }
Пример #12
0
        AddProject(String Name, params IReadOnlyGenericPropertyVertex <String, Int64, String, String, Object,
                                                                       String, Int64, String, String, Object,
                                                                       String, Int64, String, String, Object,
                                                                       String, Int64, String, String, Object>[] Uses)

        {
            if (Uses == null)
            {
                return(graph.AddVertex(Name, "project"));
            }

            return(graph.AddVertex(Name, "project", v => Uses.ForEach(v2 => v.AddEdge_chainable("uses", v2))));
        }
Пример #13
0
        public override void SubstituteUse(IRVariable variable, IRExpression expression)
        {
            if (ReferenceEquals(ReturnValue, variable))
            {
                ReturnValue = expression.CloneComplete();
            }
            else
            {
                ReturnValue.Substitute(variable, expression);
            }

            Uses.Clear();
            Uses.UnionWith(ReturnValue.GetAllVariables());
        }
Пример #14
0
 public string ToLine()
 {
     return(string.Join("\t",
                        Filename,
                        Url,
                        ID.ToString(),
                        Title,
                        Description,
                        Author,
                        Featured.ToString(),
                        Uses.ToString(),
                        Favorites.ToString(),
                        Code.ToString()));
 }
Пример #15
0
 public Car(string vin, string licensePlate, string brand, string model, string version, ushort year,
            string color, Fuels fuel, Sizes size, Uses use, CarType carType, Customer customer)
 {
     Vin          = vin;
     LicensePlate = licensePlate;
     Brand        = brand;
     Model        = model;
     Version      = version;
     Year         = year;
     Color        = color;
     Fuel         = fuel;
     Size         = size;
     Use          = use;
     CarType      = carType;
     Customer     = customer;
 }
Пример #16
0
        /// <summary>
        /// When overridden in a descendant class, serializes the object into XML according to Aadhaar API specification.
        /// </summary>
        /// <param name="elementName">The name of the element.</param>
        /// <returns>An instance of <see cref="XElement"/>.</returns>
        protected override XElement SerializeXml(string elementName)
        {
            ValidateNull(Uses, nameof(Uses));

            var authContext = base.SerializeXml(elementName);

            authContext.Add(Uses.ToXml("Uses"));
            if (Info != null)
            {
                authContext.Add(new XAttribute("info", Info.InfoValue));
            }
            if (Token != null)
            {
                authContext.Add(Token.ToXml("Tkn"));
            }

            return(authContext);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (IncubatorType != 0)
            {
                hash ^= IncubatorType.GetHashCode();
            }
            if (Uses != 0)
            {
                hash ^= Uses.GetHashCode();
            }
            if (DistanceMultiplier != 0F)
            {
                hash ^= DistanceMultiplier.GetHashCode();
            }
            return(hash);
        }
Пример #18
0
        public Operand With(
            OperandKind kind,
            OperandType type = OperandType.None,
            ulong value      = 0,
            Symbol symbol    = default)
        {
            Kind = kind;
            Type = type;

            Value = value;

            Symbol = symbol;

            Assignments.Clear();
            Uses.Clear();

            return(this);
        }
Пример #19
0
Файл: Web.cs Проект: erenes/reko
        public void Add(SsaIdentifier sid)
        {
            if (Members.Contains(sid))          // should be a set!
            {
                return;
            }

            Members.Add(sid);
            if (this.Identifier == null)
            {
                this.Identifier = sid.Identifier;
            }
            else
            {
                if (string.Compare(sid.Identifier.Name, this.Identifier.Name) < 0)
                {
                    this.Identifier = sid.Identifier;
                }

                if (iv == null)
                {
                    iv = sid.InductionVariable;
                }
                else if (sid.InductionVariable == null)
                {
                    sid.InductionVariable = iv;
                }
                else
                {
                    iv = LinearInductionVariable.Merge(sid.InductionVariable, iv);
                    if (iv == null)
                    {
                        // Warning(string.Format("{0} and {1} are conflicting induction variables: {2} {3}",
                    }
                    sid.InductionVariable = iv;
                }
            }
            Definitions.Add(sid.DefStatement);
            DefExprs.Add(sid.DefExpression);
            foreach (Statement u in sid.Uses)
            {
                Uses.Add(u);
            }
        }
Пример #20
0
        /// <summary>
        /// When overridden in a descendant class, serializes the object into XML according to Aadhaar API specification.
        /// </summary>
        /// <param name="name">The name of the element.</param>
        /// <returns>An instance of <see cref="XElement"/>.</returns>
        /// <exception cref="ArgumentNullException"><see cref="Uses"/> is null.</exception>
        protected override XElement SerializeXml(XName name)
        {
            ValidateNull(Uses, nameof(Uses));

            var authContext = base.SerializeXml(name);

            authContext.Add(new XAttribute("rc", AadhaarHelper.YesUpper),
                            Uses.ToXml("Uses"));

            if (AuthInfo != null)
            {
                authContext.Add(new XAttribute("info", AuthInfo.Encode()));
            }
            if (Token != null)
            {
                authContext.Add(Token.ToXml("Tkn"));
            }

            return(authContext);
        }
        public void set_image(Game_Actor actor, Item_Data item_data, int active_item)
        {
            base.set_image(actor, item_data);
            if (!item_data.non_equipment)
            {
                Data_Equipment item = item_data.to_equipment;

                bool useable = false;
                if (active_item >= 0)
                {
                    var  usedItem  = actor.items[active_item].to_item;
                    bool canTarget = usedItem.can_target_item(item_data);
                    useable = canTarget;

                    if (usedItem.can_repair)
                    {
                        if (canTarget)
                        {
                            Arrow       = new Weapon_Triangle_Arrow();
                            Arrow.value = WeaponTriangle.Advantage;

                            int    repairUses = item_data.RepairAmount(usedItem);
                            int    uses       = item_data.UsesAfterRepair(false, repairUses);
                            string color      = uses == item_data.max_uses ? "Green" : "Blue";

                            Uses.SetColor(Global.Content, color);

                            RepairUses = new TextSprite(
                                Config.UI_FONT, Global.Content, color,
                                Vector2.Zero,
                                uses < 0 ? "--" : uses.ToString());

                            Slash.loc   += new Vector2(24, 0);
                            Use_Max.loc += new Vector2(24, 0);
                        }
                    }
                }

                set_text_color(useable);
            }
        }
Пример #22
0
        private static void MainUse()
        {
            //init of the Main Uses Class
            var uses = new Uses();


            WriteLn("User Ip Address");
            WriteLn("_______________");
            IoUses.Blank();
            WriteLn(uses.IpUserService.GetIp());
            IoUses.Blank();

            WriteLn("Diagnostics");
            WriteLn("_______________");
            IoUses.Blank();
            WriteLn(uses.CpuUserService.GetCpu());
            WriteLn(uses.CpuUserService.GetRam());
            WriteLn(uses.IpUserService.GetNetworkUsage());
            IoUses.Blank();

        }
Пример #23
0
 private void Init()
 {
     Units.Add(new KVPBase {
         id = 0, Name = "мл"
     });
     Units.Add(new KVPBase {
         id = 1, Name = "л"
     });
     Units.Add(new KVPBase {
         id = 2, Name = "г"
     });
     Units.Add(new KVPBase {
         id = 3, Name = "кг"
     });
     Units.Add(new KVPBase {
         id = 4, Name = "шт."
     });
     Uses.Add(new KVPBase {
         id = 0, Name = "Для всех"
     });
 }
Пример #24
0
        public async Task <ActionResult <ApiUses> > PostApiUses(Uses apiUses)
        {
            _context.Uses.Add(apiUses);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ApiUsesExists(apiUses.RecipeId, apiUses.UnitName, apiUses.IngrName))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(Created("", apiUses));
        }
Пример #25
0
            /// <summary>
            /// Outputs a list of the relations that this class has toward other classes.
            /// </summary>
            /// <param name="builder">the stringbuilder to render to</param>
            /// <returns></returns>
            public StringBuilder OutputRelations(StringBuilder builder)
            {
                foreach (var use in Uses.Where(u => u.Relevant))
                {
                    //Do not pretend to be 'using' a type that is equal to the inheriting types.
                    if (Inherits.Any(i => i.TypeName == use.TypeName))
                    {
                        continue; //don't output if using superclass, this is not a useful notation.
                    }


                    //Todo: any reference to a complex type (i.e. class) tends to get displayed as a compound reference when it is a member in\
                    //the class; this is not a correct logic; needs to be expanded for example by checking the contents of the 'refid' in question (if it is nested, it
                    //could probably be assumed to be a more than one relationship; i.e. composition)
                    use.Compound = false;

                    string arrowhead;
                    if (use.Compound)
                    {
                        arrowhead = "arrowhead=odiamond";
                        builder.AppendLine($@"""{ use.TypeName.NoNameSpaces()}""->""{Name.NoNameSpaces()}"" [{arrowhead}  {(use.node is InterfaceNode ? "style =dashed" : "")}  label=""{use.DeclaredName.NoNameSpaces()}"" ]");
                    }
                    else
                    {
                        arrowhead = "arrowhead = normal";
                        builder.AppendLine($@"""{ Name.NoNameSpaces()}""->""{use.TypeName.NoNameSpaces()}"" [{arrowhead}  {(use.node is InterfaceNode ? "style =dashed" : "")}  label=""{use.DeclaredName.NoNameSpaces()}"" ]");
                    }

                    //Create the actual arrow from this node to the used one, if the used node is an interface, make the line dashed to indicate dependency
                }


                foreach (var inheritee in Inherits)
                {
                    builder.AppendLine(@" edge [arrowtail = ""empty"" ]");
                    builder.AppendLine($"\"{inheritee.TypeName.NoNameSpaces()}\"->\"{Name.NoNameSpaces()}\" [{ (inheritee.node is InterfaceNode ? "style=dashed" : "style=solid")} { (inheritee == null ? ", label=\"??\"" : " ") } dir=back ]");
                }

                return(builder);
            }
Пример #26
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (IncubatorType != 0)
            {
                hash ^= IncubatorType.GetHashCode();
            }
            if (Uses != 0)
            {
                hash ^= Uses.GetHashCode();
            }
            if (DistanceMultiplier != 0F)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(DistanceMultiplier);
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #27
0
        public async Task <IActionResult> PutApiUses(ApiUses apiUses)
        {
            var query = from u in _context.Uses where u.IngrName == apiUses.IngrName select u;

            foreach (var u in query)
            {
                _context.Entry(u).State = EntityState.Deleted;
            }

            Uses uses = new Uses
            {
                RecipeId = apiUses.RecipeId,
                IngrName = apiUses.IngrName,
                Quantity = apiUses.Quantity,
                UnitName = apiUses.UnitName
            };
            await _context.Uses.AddAsync(uses);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException e)
            {
                System.Console.WriteLine(e.Message);
                if (!ApiUsesExists(apiUses.RecipeId, apiUses.UnitName, apiUses.IngrName))
                {
                    System.Console.WriteLine(apiUses.RecipeId);
                    System.Console.WriteLine(apiUses.UnitName);
                    System.Console.WriteLine(apiUses.IngrName);
                    return(NotFound());
                }

                throw;
            }

            return(NoContent());
        }
Пример #28
0
 internal void ReplaceWith(Asset asset) => Uses.ToList().ForEach(s => s.UpdateAsset(asset));
Пример #29
0
 public virtual void Use(Uses use, bool released = false)
 {
 }
Пример #30
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (MoveId != 0)
            {
                hash ^= MoveId.GetHashCode();
            }
            if (Category != 0)
            {
                hash ^= Category.GetHashCode();
            }
            if (U3 != 0)
            {
                hash ^= U3.GetHashCode();
            }
            if (User != 0)
            {
                hash ^= User.GetHashCode();
            }
            if (Group != 0)
            {
                hash ^= Group.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            if (Target != 0)
            {
                hash ^= Target.GetHashCode();
            }
            if (U8 != 0)
            {
                hash ^= U8.GetHashCode();
            }
            if (GaugeDrain != 0)
            {
                hash ^= GaugeDrain.GetHashCode();
            }
            if (Power != 0)
            {
                hash ^= Power.GetHashCode();
            }
            if (Accuracy != 0)
            {
                hash ^= Accuracy.GetHashCode();
            }
            if (Uses != 0)
            {
                hash ^= Uses.GetHashCode();
            }
            if (Tags != 0)
            {
                hash ^= Tags.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Пример #31
0
 public override string ToString(int uses_left)
 {
     return(String.Format("Item: {0}, Uses {1}",
                          full_name(), uses_left == 0 ? Uses.ToString() : string.Format("{0}/{1}", uses_left, Uses)));
 }