コード例 #1
0
ファイル: PartsManager.cs プロジェクト: ibinsigma/Nuclear
        internal bool HandlePart(Packet packet, out byte[] data)
        {
            data = null;
            byte code = packet.Data[0];

            byte[] ToStore = new byte[packet.Data.Length - 1];
            Array.Copy(packet.Data, 1, ToStore, 0, ToStore.Length);
            Parts.Add(ToStore);
            if (code == 0xFC)
            {
                return(false);
            }
            else
            {
                byte[][] Matrix = Parts.ToArray();
                Parts.Clear();
                byte[] result = new byte[Matrix.Sum(a => a.Length)];
                int    offset = 0;
                foreach (byte[] array in Matrix)
                {
                    Buffer.BlockCopy(array, 0, result, offset, array.Length);
                    offset += array.Length;
                }
                data = result;
                return(true);
            }
        }
コード例 #2
0
        public override string VisitASTParagraph(ASTParagraph astParagraph)
        {
            string result = Markdown.ToHtml(astParagraph.Content);

            Parts.Add(result);
            return(result);
        }
コード例 #3
0
        /// <summary>
        /// initialize feature
        /// </summary>
        public override void OnInitialInstance()
        {
            // UWP control preparation
            if (TargetListView == null)
            {
                Kill(new NullReferenceException("FeatureJitTemplateListPanel must have FeatureJitTemplateListPanel={Bind:****}"));
                return;
            }

            TargetListView.ItemsSource       = Hot.TemplateList;
            TargetListView.SelectionChanged += TargetListView_SelectionChanged;

            // Add default template chip
            DelayUtil.Start(TimeSpan.FromMilliseconds(200), () =>
            {
                AddTemplateChip("@Default", Colors.Yellow, "Free GUI space");
                TargetListView.SelectedItem = Hot.TemplateList.First();   // auto select the new item
            });

            // Template Name Parts
            Pane.Target = Pane["LogPanel"]; // to get priority draw layer
            BarParts    = new PartsActiveTemplate
            {
            };
            Parts.Add(Pane.Target, BarParts, LAYER.ActiveTemplate);
        }
コード例 #4
0
 public Invoice(Advertising ad)
     : this(ad.Payer)
 {
     Period = Date.ToPeriod();
     Parts.Add(PartForAd(ad));
     CalculateSum();
 }
コード例 #5
0
        private void ParsePath()
        {
            while (_currentIndex < Path.Length)
            {
                var currentChar = Path[_currentIndex];

                switch (currentChar)
                {
                case '[':
                    Parts.Add(ParseIndexer());
                    break;

                case '.':
                    if (_currentIndex + 1 < Path.Length && Path[_currentIndex + 1] == '.')
                    {
                        throw new InvalidReferencePathException(
                                  "Scan operation '..' are not allowed in reference paths");
                    }

                    Parts.Add(ParseProperty());
                    break;

                default:
                    throw new InvalidReferencePathException(
                              $"Unexpected character '{currentChar}' in Reference path at pos {_currentIndex}");
                }
            }
        }
コード例 #6
0
ファイル: Body.cs プロジェクト: zanderphh/Project
 public void Init(List <Point> path)
 {
     Vertices = Vertices.Create(this, path);
     Parts.Add(this);
     Parent = this;
     Render = new BodyRenderStruct(this);
 }
コード例 #7
0
ファイル: Monster.cs プロジェクト: zRandgris/SmartHunter
        public MonsterPart UpdateAndGetPart(ulong address, bool isRemovable, float maxHealth, float currentHealth, int timesBrokenCount)
        {
            MonsterPart part = Parts.SingleOrDefault(collectionPart => collectionPart.Address == address);

            if (part != null)
            {
                if (!float.IsNaN(currentHealth / maxHealth))
                {
                    part.IsRemovable      = isRemovable;
                    part.Health.Max       = maxHealth;
                    part.Health.Current   = currentHealth;
                    part.TimesBrokenCount = timesBrokenCount;
                }
            }
            else
            {
                part          = new MonsterPart(this, address, isRemovable, maxHealth, currentHealth, timesBrokenCount);
                part.Changed += PartOrStatusEffect_Changed;

                Parts.Add(part);
            }

            part.NotifyPropertyChanged(nameof(MonsterPart.IsVisible));

            return(part);
        }
コード例 #8
0
        public override void OnInitialInstance()
        {
            base.OnInitialInstance();

            Pane.Target = Pane.Main;

            for (var a = Angle.Zero; a.Deg < 360; a += Angle.FromDeg(360 / 12))
            {
                var parts = new PartsTestGeneral
                {
                    Location    = CodePos <Distance, Angle> .From(Distance.FromMeter(300), a),
                    PositionerX = MyPositionerX,
                    PositionerY = MyPositionerY,
                    CoderX      = MyCoderX,
                    CoderY      = MyCoderY,
                };
                if (a.Deg < 180)
                {
                    Parts.Add(Pane.Target, parts, LAYER.SampleLayer1);
                }
                else
                {
                    Parts.Add(Pane.Target, parts, LAYER.SampleLayer2);
                }
            }
        }
コード例 #9
0
ファイル: Song.cs プロジェクト: johnlace1986/DropboxProjects
        /// <summary>
        /// Initialises a new instance of the Song class with the properties loaded from the database
        /// </summary>
        /// <param name="songId">Unique identifier of the song</param>
        public Song(Int64 songId)
            : this()
        {
            using (SqlConnection conn = GetConnection())
            {
                try
                {
                    conn.Open();

                    Song clone = Data.Song.GetSongById(conn, songId);
                    CopyFromClone(clone);

                    foreach (MediaItemPart part in clone.Parts)
                    {
                        Parts.Add(part.Location, part.Size, part.Duration);
                    }

                    IsInDatabase = clone.IsInDatabase;
                }
                finally
                {
                    conn.Close();
                }
            }
        }
コード例 #10
0
ファイル: Package.cs プロジェクト: Dadstart/MOPE2
        public Package(string path, string tempDirPath)
        {
            ZipFile       = path;
            TempDirectory = Path.Combine(tempDirPath, "package");

            if (Directory.Exists(TempDirectory))
            {
                Directory.Delete(TempDirectory, true);
            }

            var tempDir = Directory.CreateDirectory(TempDirectory);
            var entries = ZipContainer.ExtractTo(ZipFile, TempDirectory, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

            // read [Content_Types].xml
            ContentTypes = LoadContentTypes();

            // loop through entries and create parts
            foreach (var entry in entries)
            {
                // ignore directory entries
                if (entry.FullName.EndsWith("/"))
                {
                    continue;
                }

                var part = new Part(this, entry.Name, entry.FullName, ContentTypes.GetContentType(entry.FullName), entry.Crc32, entry.Length, entry.CompressedLength);
                Parts.Add(part.Uri.Replace('\\', '/'), part);
            }

            Relationships = LoadRelationships();
        }
コード例 #11
0
 public override void CreateProduct(string productDescription)
 {
     Description = $"[{nameof(Laptop)}] " + productDescription;
     Parts.Add(new Processor());
     Parts.Add(new Screen());
     Parts.Add(new BigCase());
 }
コード例 #12
0
 public override void CreateProduct(string productDescription)
 {
     Description = $"{nameof(Tablet)}" + productDescription;
     Parts.Add(new SmallCase());
     Parts.Add(new Screen());
     Parts.Add(new Processor());
 }
コード例 #13
0
        internal override bool ParseNodeBodyElement(string id, VRMLParser parser)
        {
            int line = parser.Line;

            if (id == "parts")
            {
                List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue();
                foreach (X3DNode node in nodes)
                {
                    IX3DShaderPartNode shaderPart = node as IX3DShaderPartNode;
                    if (shaderPart == null)
                    {
                        parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line);
                    }
                    else
                    {
                        Parts.Add(shaderPart);
                    }
                }
            }
            else if (id == "language")
            {
                Language = parser.ParseStringValue();
            }
            else
            {
                return(false);
            }
            return(true);
        }
コード例 #14
0
ファイル: Video.cs プロジェクト: johnlace1986/DropboxProjects
        /// <summary>
        /// Initialises a new instance of the Video class with the properties loaded from the database
        /// </summary>
        /// <param name="videoId">Unique identifier of the video</param>
        public Video(Int64 videoId)
            : this()
        {
            using (SqlConnection conn = GetConnection())
            {
                try
                {
                    conn.Open();

                    Video clone = Data.Video.GetVideoById(conn, videoId);
                    CopyFromClone(clone);

                    foreach (MediaItemPart part in clone.Parts)
                    {
                        Parts.Add(part.Location, part.Size, part.Duration);
                    }

                    IsInDatabase = clone.IsInDatabase;
                }
                finally
                {
                    conn.Close();
                }
            }
        }
コード例 #15
0
 /// <summary>
 /// Append more mime parts to this one.
 /// </summary>
 /// <param name="parts">The parts to append.</param>
 public void Append(params MimeBasePart[] parts)
 {
     foreach (var p in parts ?? Enumerable.Empty <MimeBasePart>())
     {
         Parts.Add(p);
     }
 }
コード例 #16
0
        public Message(DbModel.Message dbMessage)
        {
            Id           = dbMessage.Id;
            From         = dbMessage.From;
            To           = dbMessage.To;
            ReceivedDate = dbMessage.ReceivedDate;
            Subject      = dbMessage.Subject;

            Parts = new List <ApiModel.MessageEntitySummary>();

            if (dbMessage.MimeParseError != null)
            {
                MimeParseError = dbMessage.MimeParseError;
                Headers        = new List <Header>();
                Parts          = new List <MessageEntitySummary>();
            }
            else
            {
                using (MemoryStream stream = new MemoryStream(dbMessage.Data))
                {
                    MimeMessage mime = MimeMessage.Load(stream);

                    Headers = mime.Headers.Select(h => new Header {
                        Name = h.Field, Value = h.Value
                    }).ToList();
                    Parts.Add(HandleMimeEntity(mime.Body));
                }
            }
        }
コード例 #17
0
        /// <summary>
        /// Initialize feature
        /// </summary>
        public override void OnInitialInstance()
        {
            base.OnInitialInstance();
            Pane.Target = Pane["ToolBox"];

            // Tool box background
            Parts.Add(Pane.Target, new PartsToolBox {
            }, LAYER.ToolButtonBox);

            var x       = ScreenX.From(0);
            var y       = ScreenY.From(48);
            var btnSize = ScreenSize.From(24, 24);
            var marginY = ScreenY.From(8);

            for (var i = 0; i < Buttons.Count; i++)
            {
                var btn = Buttons[i];
                btn.Name     = string.IsNullOrEmpty(btn.Name) ? btn.GetType().Name : btn.Name;
                btn.Size     = btnSize;
                btn.Location = CodePos <ScreenX, ScreenY> .From(x, y);

                var dmy = btn.Load(View);   // dmy = thread control
                Parts.Add(Pane.Target, btn, LAYER.ToolButtons);
                y += btnSize.Height + marginY;
            }
        }
コード例 #18
0
        /// <summary>
        /// Adds the column with name specified.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <returns>table instance.</returns>
        public override Column AddColumn(String columnName)
        {
            var column = base.AddColumn(columnName);

            Parts.Add(column);
            return(column);
        }
コード例 #19
0
 public void AddPartToModule(Part p, int q)
 {
     for (int i = 0; i < q; i++)
     {
         Parts.Add(p);
     }
 }
コード例 #20
0
        /// <summary>
        /// Changes the column with name specified.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <returns>table instance.</returns>
        public virtual Column ChangeColumn(String columnName)
        {
            var column = new ChangeColumn(columnName, Name);

            Parts.Add(column);
            return(column);
        }
コード例 #21
0
ファイル: BarShape00.cs プロジェクト: radtek/Shopdrawing
        public override void Create()
        {
            Parts.Clear();
            // Part1
            if (GetPart1Dependencies() != null)
            {
                var part1 = Factory.CreateSegment(Drawing, GetPart1Dependencies());
                if (part1 != null)
                {
                    Parts.Add(part1);
                }
            }

            // Cross Part
            if (GetCrossPartDependencies() != null)
            {
                var crossPart = Factory.CreateCircle(Drawing, GetCrossPartDependencies());
                Parts.Add(crossPart);
            }

            Dependencies.Clear();
            Children.Clear();
            if (Parts != null)
            {
                foreach (IFigure f in Parts)
                {
                    Children.Add(f);
                    foreach (IPoint p in f.Dependencies)
                    {
                        Dependencies.Add(p);
                    }
                }
            }
        }
コード例 #22
0
        /// <summary>
        /// Removes the column with name specified.
        /// </summary>
        /// <param name="columnName">Name of the column.</param>
        /// <returns>table instance.</returns>
        public virtual Column RemoveColumn(String columnName)
        {
            var column = new RemoveColumn(columnName, Name);

            Parts.Add(column);
            return(column);
        }
コード例 #23
0
        private void ReadPackages()
        {
            // add all parts in Left and matching parts in Right
            foreach (var leftPart in Left.Parts.Values)
            {
                Part rightPart = null;

                Right.Parts.TryGetValue(leftPart.Uri, out rightPart);
                var diffPart = new DiffPart(leftPart.Uri, leftPart, rightPart, OpenWith.GetCommandsForPart(leftPart));
                Parts.Add(diffPart.Uri, diffPart);
            }

            // ad all parts in Right not already added
            foreach (var rightPart in Right.Parts.Values)
            {
                // skip parts already added
                if (Parts.ContainsKey(rightPart.Uri))
                {
                    continue;
                }

                var diffPart = new DiffPart(rightPart.Uri, left: null, right: rightPart, OpenWith.GetCommandsForPart(rightPart));
                Parts.Add(diffPart.Uri, diffPart);
            }

            CreateFolders();
        }
コード例 #24
0
        /// <summary>
        /// Removes the foreign key with name specified.
        /// </summary>
        /// <param name="reference">Name of the relationship.</param>
        /// <returns>table instance.</returns>
        public virtual ForeignKey RemoveForeignKey(String reference)
        {
            var foreignKey = new RemoveForeignKey(reference, Name);

            Parts.Add(foreignKey);
            return(foreignKey);
        }
コード例 #25
0
        private void UnloadParts()
        {
            if (SelectedPartsOfTray.Count == 0)
            {
                return;
            }
            var indexs = SelectedPartsOfTray.Select(p => p.SlotNb).ToList();

            foreach (var item in indexs)
            {
                if (Tray.Parts[item - 1].Status == PartStatus.PS_Empty)
                {
                    continue;
                }
                //Tray.Parts[item - 1].Status = PartStatus.PS_Idle;
                int col = (item - 1) % Tray.ColumnCount;
                int row = (item - 1) / Tray.ColumnCount;
                Tray.Parts[item - 1].SlotNb = -1;
                Tray.Parts[item - 1].TrayNb = -1;
                Tray.Parts[item - 1].Placed = false;
                Parts.Add(Tray.Parts[item - 1]);
                Tray.Parts[item - 1] = new Part()
                {
                    SlotNb = item,
                    Status = PartStatus.PS_Empty
                };
                Tray.Parts[item - 1].ColumnId = Encoding.ASCII.GetString(new byte[] { (byte)(65 + col) });
                Tray.Parts[item - 1].RowId    = Encoding.ASCII.GetString(new byte[] { (byte)(49 + row) });
            }
            Tray.PartCount = Tray.Parts.Count(p => p.Status != PartStatus.PS_Empty);
        }
コード例 #26
0
        public CaliperGroup()
        {
            LoadTheme(System.IO.Path.Combine(ThemesRootDirectory, AppConfig.ThemeName));

            Parts.Add(PartBottom  = new CaliperPartBottom());
            Parts.Add(PartHead    = new CaliperPartHead());
            Parts.Add(PartDisplay = new CaliperPartDisplay());
            Parts.Add(PartScale   = new CaliperPartScale());

            //part2.rect.Y = 20;
            Distance = 100;
            PartScale.Rect.Location = ScaleOffset;

            SetContrastColor(JawColor);

            var color1 = new MenuItem("Color");

            Menu.Insert(color1, 0);
            color1.ButtonReleaseEvent += (o, e) =>
            {
                if (e.Event.Button == 1)
                {
                    ShowColorChooser();
                }
            };

            // TODO: Place in visible area
            // TODO: respect DPI
            //setWindowPosition(new POINT(3000, 0));
        }
コード例 #27
0
        public override string VisitASTChapter(ASTChapter astChapter)
        {
            string result = Markdown.ToHtml(astChapter.Content);

            Parts.Add(result);
            return(result);
        }
コード例 #28
0
        /// <summary>
        /// Used for Regex or String.Contains
        /// </summary>
        public StringMatch(String fullString, String matchString)
            : this()
        {
            int startIndex = fullString.IndexOf(matchString.ToLower(), StringComparison.OrdinalIgnoreCase);
            int length     = matchString.Length;

            // Get the 1st part of the String
            if (startIndex > 0)
            {
                Parts.Add(new StringPart(fullString.Substring(0, startIndex), false));
            }

            // Get the next matched part of the String
            Parts.Add(new StringPart(fullString.Substring(startIndex, length), true));

            // Get the last part of the String
            if (startIndex + length < fullString.Length)
            {
                Parts.Add(new StringPart(fullString.Substring(startIndex + length), false));
            }

            MatchCharacters = length;
            MatchFraction   = ((Double)MatchCharacters / (Double)fullString.Length);
            MatchPriority   = MatchCharacters + MatchFraction;
        }
コード例 #29
0
        protected override CrcCalculatorStream CreatePart(int partnum)
        {
            if (partnum > 1 && internalStream != null)
            {
                if (currentPart != null)
                {
                    currentPart.Crc = (uint)internalStream.Crc;
                }

                internalStream.Close();
                internalStream.Dispose();
            }

            string partName = GetPartName(partnum);

            // Create a new part
            PartialFile newPart = new PartialFile(partName, partSize, partnum, Position);

            Parts.Add(newPart);
            currentPart = newPart;

            // Create a new part
            positionInPart = 0;
            return(new CrcCalculatorStream(new FileStream(partName, mode, access), false));
        }
コード例 #30
0
 private void AddIfNotZero(string name, DiceRoll value)
 {
     if (value.GetFixedAmount() != 0 || (value.Dice != null && value.Dice.Any()))
     {
         Parts.Add(new KeyValuePair <string, DiceRoll>(name, value));
     }
 }