示例#1
0
 public Move(StatusEffect oEffect, string sName, int iDamage, Enums.Type oType, StatEffect oStatEffect)
 {
     this.oEffect = oEffect;
     this.sName   = sName;
     this.iDamage = iDamage;
     this.oType   = oType;
 }
 public ConstantBlock(DTD.Entity.vCodes.Variable variable)
 {
     InitializeComponent();
     Constant = new Constant {
         VType = Enums.VType.Constant
     };
     variableType = variable.Type;
 }
示例#3
0
        public VariableDeclerationStatement(Enums.Type type, string variableName, GeneralSymbol symbol)
        {
            _variableSymbol = symbol;
            _variableName   = variableName;

            if (_variableSymbol.Type != type)
            {
                throw new Exception("Cannot declare type " + _variableSymbol.Type.ToString() + " as " + type);
            }
        }
示例#4
0
        public VariableDeclerationStatement(Enums.Type type, string variableName, Expression value)
        {
            _value        = value;
            _variableName = variableName;

            if (_value.Evaluate().Type != type)
            {
                throw new Exception("Cannot declare type " + _value.Evaluate().Type + " as " + type);
            }
        }
示例#5
0
        /// <summary>
        /// Encodes and writes a bar code to an image
        /// </summary>
        /// <param name="Data">Data string to encode</param>
        /// <param name="Width">Desired width of the image</param>
        /// <param name="Height">Desired height of the image</param>
        /// <param name="EncodingType">Encoding type to use</param>
        /// <returns>An image of a bar code corresponding to the data</returns>
        public static Bitmap Encode(string Data, int Width, int Height, Enums.Type EncodingType)
        {
            if (string.IsNullOrEmpty(Data))
            {
                throw new ArgumentNullException("Data can't be empty/null");
            }

            string EncodedData = GetSymbology(Data, EncodingType);

            return(GenerateImage(EncodingType, Width, Height, EncodedData));
        }
示例#6
0
 public InlineFunc(
     string name,
     Enums.Type returnType,
     Action <IEnv, IList <IExpr> > argsValidationAction,
     Func <IEnv, IList <IExpr>, object> execFunc)
 {
     _name                 = name;
     _returnType           = returnType;
     _execFunc             = execFunc;
     _argsValidationAction = argsValidationAction;
 }
示例#7
0
 public Card initFromInvocation(Invocation InvTemp)
 {
     this.name = InvTemp.name;
     this.manaCost = InvTemp.manaCost;
     this.type = InvTemp.type[0];
     this.subtype = InvTemp.subType[0];
     this.powers = InvTemp.powers;
     this.castLimit = InvTemp.castLimit;
     this.card = InvTemp.getCard();
     if (this.type == Enums.Type.Elemental)
     {
         Elemental ElemTemp = new Elemental(this.name);
         ElemTemp = (Elemental)this;
         ElemTemp.strength = InvTemp.strength;
         ElemTemp.constitution = InvTemp.constitution;
         ElemTemp.hp = ElemTemp.constitution;
         ElemTemp.rank = InvTemp.rank;
         if (ElemTemp.rank > 0)
             ElemTemp.from = InvTemp.from;
         ElemTemp.role = InvTemp.role;
         ElemTemp.properties = InvTemp.properties;
         ElemTemp.onAppear = InvTemp.onAppear;
         ElemTemp.onDeath = InvTemp.onDeath;
         return ElemTemp;
     }
     if (this.type == Enums.Type.Spirit)
     {
         Spirit SpiritTemp = new Spirit(this.name);
         SpiritTemp = (Spirit)this;
         SpiritTemp.essence = InvTemp.essence;
         SpiritTemp.onAppear = InvTemp.onAppear;
         SpiritTemp.onDeath = InvTemp.onDeath;
         return SpiritTemp;
     }
     return this;
 }     
示例#8
0
 public IFuncBuilder_ArgDefiningStep WithArg(Enums.Type type)
 {
     _sig.Add(type);
     return(this);
 }
示例#9
0
 public IFuncBuilder_ImplDefiningStep <string[]> ReturnStringArray()
 {
     _returnType = Enums.Type.StringArray;
     return(this);
 }
示例#10
0
 public RelationshipDTO(PersonDTO source, PersonDTO target, Enums.Type relationshipType)
 {
     SourcePerson     = source ?? throw new ArgumentNullException(nameof(source));
     TargetPerson     = target ?? throw new ArgumentNullException(nameof(target));
     RelationshipType = relationshipType;
 }
示例#11
0
        private static string GetSymbology(string Data, Enums.Type EncodingType)
        {
            ISymbology SymbologyUsing = null;

            switch (EncodingType)
            {
            case Enums.Type.UCC12:
            case Enums.Type.UPCA:
                SymbologyUsing = new UPCA(Data);
                break;

            case Enums.Type.UCC13:
            case Enums.Type.EAN13:
                SymbologyUsing = new EAN13(Data);
                break;

            case Enums.Type.Interleaved2of5:
                SymbologyUsing = new Interleaved2of5(Data);
                break;

            case Enums.Type.Industrial2of5:
            case Enums.Type.Standard2of5:
                SymbologyUsing = new Standard2of5(Data);
                break;

            case Enums.Type.LOGMARS:
            case Enums.Type.CODE39:
                SymbologyUsing = new Code39(Data);
                break;

            case Enums.Type.CODE39Extended:
                SymbologyUsing = new Code39(Data);
                break;

            case Enums.Type.Codabar:
                SymbologyUsing = new Codabar(Data);
                break;

            case Enums.Type.PostNet:
                SymbologyUsing = new Postnet(Data);
                break;

            case Enums.Type.ISBN:
            case Enums.Type.BOOKLAND:
                SymbologyUsing = new ISBN(Data);
                break;

            case Enums.Type.JAN13:
                SymbologyUsing = new JAN13(Data);
                break;

            case Enums.Type.UPC_SUPPLEMENTAL_2DIGIT:
                SymbologyUsing = new UPCSupplement2(Data);
                break;

            case Enums.Type.MSI_Mod10:
            case Enums.Type.MSI_2Mod10:
            case Enums.Type.MSI_Mod11:
            case Enums.Type.MSI_Mod11_Mod10:
            case Enums.Type.Modified_Plessey:
                SymbologyUsing = new MSI(Data);
                break;

            case Enums.Type.UPC_SUPPLEMENTAL_5DIGIT:
                SymbologyUsing = new UPCSupplement5(Data);
                break;

            case Enums.Type.UPCE:
                SymbologyUsing = new UPCE(Data);
                break;

            case Enums.Type.EAN8:
                SymbologyUsing = new EAN8(Data);
                break;

            case Enums.Type.USD8:
            case Enums.Type.CODE11:
                SymbologyUsing = new Code11(Data);
                break;

            case Enums.Type.CODE128:
                SymbologyUsing = new Code128(Data);
                break;

            case Enums.Type.CODE128A:
                SymbologyUsing = new Code128A(Data);
                break;

            case Enums.Type.CODE128B:
                SymbologyUsing = new Code128B(Data);
                break;

            case Enums.Type.CODE128C:
                SymbologyUsing = new Code128C(Data);
                break;

            case Enums.Type.ITF14:
                SymbologyUsing = new ITF14(Data);
                break;

            case Enums.Type.CODE93:
                SymbologyUsing = new Code93(Data);
                break;

            case Enums.Type.TELEPEN:
                SymbologyUsing = new Telepen(Data);
                break;
            }
            return(SymbologyUsing.Encode());
        }
        public async Task <MaterialsCollectionViewModel> GetMaterials(
            string searchText           = null, Enums.Auditory auditory = Enums.Auditory.Common,
            Enums.Theme theme           = Enums.Theme.Common,
            Enums.Type type             = Enums.Type.Common,
            Enums.MaterialStatus status = Enums.MaterialStatus.All, int page = 0,
            Guid?userId = null, Enums.SortType sortType = Enums.SortType.AlphabetAsc,
            int count   = 3)
        {
            var materials = await _unitOfWork.MaterialRepository.GetAll();

            materials = materials.ToList();

            if (status != Enums.MaterialStatus.All)
            {
                materials = materials.Where(m => m.Status == status).ToList();
            }

            if (auditory != Enums.Auditory.Common)
            {
                materials = materials.Where(m => m.Auditory == auditory).ToList();
            }

            if (type != Enums.Type.Common)
            {
                materials = materials.Where(m => m.Type == type).ToList();
            }

            if (theme != Enums.Theme.Common)
            {
                materials = materials.Where(m => m.Theme == theme).ToList();
            }

            if (!string.IsNullOrEmpty(searchText))
            {
                materials = materials.Where(m =>
                                            m.Name.IndexOf(searchText, StringComparison.OrdinalIgnoreCase) >= 0 ||
                                            m.Description.IndexOf(searchText, StringComparison.OrdinalIgnoreCase) >= 0 ||
                                            m.Theme.ToString("d").IndexOf(searchText, StringComparison.OrdinalIgnoreCase) >= 0);
            }

            if (userId != null)
            {
                materials = materials.Where(m => m.UserId == userId).ToList();
            }

            if (sortType == Enums.SortType.AlphabetAsc)
            {
                materials = materials.OrderBy(m => m.Name).ToList();
            }
            else if (sortType == Enums.SortType.AlphabetDesc)
            {
                materials = materials.OrderByDescending(m => m.Name).ToList();
            }
            else if (sortType == Enums.SortType.DateAsc)
            {
                materials = materials.OrderBy(m => m.PublishingDate).ToList();
            }
            else if (sortType == Enums.SortType.DateDesc)
            {
                materials = materials.OrderByDescending(m => m.PublishingDate).ToList();
            }
            else if (sortType == Enums.SortType.RateAsc)
            {
                materials = materials.OrderByDescending(m => m.Rating).ToList();
            }

            var materialsCount = materials.Count();

            if (page != 0)
            {
                materials = materials.Skip(0).Take(count * page);
            }

            var uiMaterials = materials.Select(m => new MaterialViewModel
            {
                Id                   = m.Id,
                Name                 = m.Name,
                UserId               = m.UserId,
                AuthorEmail          = _unitOfWork.UserRepository.GetUserById(m.UserId).Email,
                AuthorName           = _unitOfWork.UserRepository.GetUserById(m.UserId).Name,
                AuthorSurname        = _unitOfWork.UserRepository.GetUserById(m.UserId).Surname,
                Description          = m.Description,
                PublishingDate       = m.PublishingDate,
                PublishingDateString = m.PublishingDate.ToString("dd.MM.yyyy"),
                Status               = m.Status,
                StatusString         = Constants.Status[(int)m.Status],
                Auditory             = m.Auditory,
                Theme                = m.Theme,
                ThemeString          = Constants.Theme[(int)m.Theme],
                Type                 = m.Type,
                TypeString           = Constants.Type[(int)m.Type],
                DownloadingLink      = m.DownloadingLink,
                BytePicture          = m.Picture,
                Base64Picture        = Convert.ToBase64String(m.Picture),
                SourceOfInformation  = m.SourceOfInformation,
                Rating               = m.Rating,
                DownloadsCount       = m.DownloadsCount
            });

            return(new MaterialsCollectionViewModel
            {
                SearchText = searchText,
                Type = type,
                Theme = theme,
                ThemeString = Constants.Theme[(int)theme],
                Materials = uiMaterials,
                Page = page,
                TotalCount = materialsCount
            });
        }
示例#13
0
 public IFuncBuilder_ImplDefiningStep <double> ReturnNumber()
 {
     _returnType = Enums.Type.Number;
     return(this);
 }
示例#14
0
 public void IdentifyExactReturnType() =>
 _returnType = Helpers.GetArrayType(Elements);
示例#15
0
        private static Bitmap GenerateImage(Enums.Type EncodingType, int Width, int Height, string EncodedValue)
        {
            Bitmap ReturnValue     = new Bitmap(Width, Height);
            int    BarWidth        = 0;
            int    ShiftAdjustment = 0;

            if (EncodingType == Enums.Type.ITF14)
            {
                int BearerWidth = (int)(Width / 12.05);
                int QuietZone   = Convert.ToInt32(Width * 0.05);
                BarWidth        = (Width - (BearerWidth * 2) - (QuietZone * 2)) / EncodedValue.Length;
                ShiftAdjustment = ((Width - (BearerWidth * 2) - (QuietZone * 2)) % EncodedValue.Length) / 2;

                if (BarWidth <= 0 || QuietZone <= 0)
                {
                    throw new Exception("Image size is too small");
                }

                using (Graphics Graphics = Graphics.FromImage(ReturnValue))
                {
                    Graphics.Clear(Color.White);
                    using (Pen Pen = new Pen(Color.Black, BarWidth))
                    {
                        Pen.Alignment = PenAlignment.Right;
                        for (int x = 0; x < EncodedValue.Length; ++x)
                        {
                            if (EncodedValue[x] == '1')
                            {
                                Graphics.DrawLine(Pen,
                                                  new Point((x * BarWidth) + ShiftAdjustment + BearerWidth + QuietZone, 0),
                                                  new Point((x * BarWidth) + ShiftAdjustment + BearerWidth + QuietZone, Height));
                            }
                        }
                        Pen.Width     = (float)(Height / 8);
                        Pen.Color     = Color.Black;
                        Pen.Alignment = PenAlignment.Center;
                        Graphics.DrawLine(Pen, new Point(0, 0), new Point(Width, 0));
                        Graphics.DrawLine(Pen, new Point(0, Height), new Point(Width, Height));
                        Graphics.DrawLine(Pen, new Point(0, 0), new Point(0, Height));
                        Graphics.DrawLine(Pen, new Point(Width, 0), new Point(Width, Height));
                    }
                }
                return(ReturnValue);
            }

            BarWidth = Width / EncodedValue.Length;
            int BarWidthModifier = 1;

            if (EncodingType == Enums.Type.PostNet)
            {
                BarWidthModifier = 2;
            }

            ShiftAdjustment = (Width % EncodedValue.Length) / 2;

            if (BarWidth <= 0)
            {
                throw new Exception("Image size is too small");
            }

            using (Graphics Graphics = Graphics.FromImage(ReturnValue))
            {
                Graphics.Clear(Color.White);
                using (Pen Background = new Pen(Color.White, BarWidth / BarWidthModifier))
                {
                    using (Pen Foreground = new Pen(Color.Black, BarWidth / BarWidthModifier))
                    {
                        for (int x = 0; x < EncodedValue.Length; ++x)
                        {
                            if (EncodingType == Enums.Type.PostNet)
                            {
                                if (EncodedValue[x] != '1')
                                {
                                    Graphics.DrawLine(Foreground,
                                                      new Point(x * BarWidth + ShiftAdjustment + 1, Height),
                                                      new Point(x * BarWidth + ShiftAdjustment + 1, Height / 2));
                                }
                                Graphics.DrawLine(Background,
                                                  new Point(x * (BarWidth * BarWidthModifier) + ShiftAdjustment + BarWidth + 1, 0),
                                                  new Point(x * (BarWidth * BarWidthModifier) + ShiftAdjustment + BarWidth + 1, Height));
                            }

                            if (EncodedValue[x] == '1')
                            {
                                Graphics.DrawLine(Foreground,
                                                  new Point(x * BarWidth + ShiftAdjustment + 1, 0),
                                                  new Point(x * BarWidth + ShiftAdjustment + 1, Height));
                            }
                        }
                    }
                }
            }
            return(ReturnValue);
        }
示例#16
0
 public IFuncBuilder_ImplDefiningStep <object[]> ReturnArray()
 {
     _returnType = Enums.Type.Array;
     return(this);
 }
示例#17
0
 public IFuncBuilder_ImplDefiningStep <bool[]> ReturnBoolArray()
 {
     _returnType = Enums.Type.BoolArray;
     return(this);
 }
示例#18
0
 public Parameter(Enums.Type type, string name)
 {
     this.Type = type;
     this.Name = name;
 }
示例#19
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="Screen"></param>
            /// <param name="Edge"></param>
            /// <param name="Width"></param>
            /// <param name="Height"></param>
            /// <param name="Pixel"></param>
            /// <param name="Type"></param>
            /// <returns></returns>
            public static Point Location(Screen Screen, Enums.EdgeLocationType Edge, int Width, int Height, int Pixel = 32, Enums.Type Type = Enums.Type.Simple)
            {
                try
                {
                    Enums.LocationType LocationType = Type switch
                    {
                        Enums.Type.Advanced => Advanced.Position,
                        _ => Simple.Detect(Screen),
                    };

                    return(Edge switch
                    {
                        Enums.EdgeLocationType.TopLeft => LocationType switch
                        {
                            Enums.LocationType.Bot => new Point(Pixel, Pixel),
                            Enums.LocationType.Top => new Point(Pixel, Screen.Bounds.Height - Screen.WorkingArea.Height + Pixel),
                            Enums.LocationType.Left => new Point(Screen.Bounds.Width - Screen.WorkingArea.Width + Pixel, Pixel),
                            _ => new Point(Pixel, Pixel),
                        },
                        Enums.EdgeLocationType.TopCenter => LocationType switch
                        {
                            Enums.LocationType.Bot => new Point((Screen.Bounds.Width / 2) - (Width / 2), Pixel),
                            Enums.LocationType.Top => new Point((Screen.Bounds.Width / 2) - (Width / 2), Screen.Bounds.Height - Screen.WorkingArea.Height + Pixel),
                            Enums.LocationType.Left => new Point(Screen.Bounds.Width - Screen.WorkingArea.Width + (Screen.WorkingArea.Width / 2) - (Width / 2), Pixel),
                            _ => new Point((Screen.WorkingArea.Width / 2) - (Width / 2), Pixel),
                        },
示例#20
0
 protected AirConditioner(Type type, string manufacturer, string model)
 {
     this.Type         = type;
     this.Manufacturer = manufacturer;
     this.Model        = model;
 }
示例#21
0
 public PacketReceivedEventArgs(Enums.Type type, SPacket packet)
 {
     Type   = type;
     Packet = packet;
 }
示例#22
0
 public Token(Enums.Type myType, string text)
 {
     MyType = myType;
     Text   = text ?? throw new ArgumentNullException(nameof(text));
 }