示例#1
0
        public bool Add(Part p)
        {
            // check space available
            //foreach (Part existing in PartList)
            //{
            //    if (p.Intersects(existing))
            //    {
            //        return false;
            //    }
            //}
            PartList.Add(p);

            // update bounding box
            int newLeft  = Math.Min(p.Bounds.Left, Bounds.Left);
            int newTop   = Math.Min(p.Bounds.Top, Bounds.Top);
            int newRight = Math.Max(p.Bounds.Right, Bounds.Right);
            int newBot   = Math.Max(p.Bounds.Bottom, Bounds.Bottom);

            Bounds = Rectangle.FromLTRB(newLeft, newTop, newRight, newBot);

            // add heat capacity to total
            p.Get <HeatComponent>().MatchSome(hc =>
            {
                TotalHeatCapacity += hc.HeatCapacity;
                Coolant           += hc.MaxCoolant;
            });

            return(true);
        }
示例#2
0
        public static void Refresh(PartList partList)
        {
            if (partList == null)
            {
                return;
            }

            partList.partPacks = new List <PartPack>();
            List <string> sourcepath = GetSourcePath();

            foreach (string s in sourcepath)
            {
                List <Part> parts = EditorUtils.GetScriptables <Part>(s, true);
                foreach (Part p in parts)
                {
                    PartPack tpack = GetPack(p.category, partList.partPacks);
                    if (tpack == null)
                    {
                        tpack          = new PartPack();
                        tpack.category = p.category;
                        partList.partPacks.Add(tpack);
                    }

                    tpack.parts.Add(p);
                }
            }
            EditorUtility.SetDirty(partList);
            PartRefCustomMenu.RefreshPartReferers();
        }
示例#3
0
        /// <inheritdoc />
        protected override void BuildPartList()
        {
            base.BuildPartList();

            PartList.AppendPart(BlackboardVariablePart.Create(rowFieldPartName, Model, this, ussClassName));
            PartList.AppendPart(BlackboardVariablePropertiesPart.Create(rowPropertiesPartName, Model, this, ussClassName));
        }
示例#4
0
        private void btPartOK_Click(object sender, EventArgs e)
        {
            PartList.Items.Clear();
            if (this.listallPart.SelectedItems.Count < 1)
            {
                this.sMain.ShowPrgMsg("没有选择任何项..", MainParent.MsgType.Warning);
                return;
            }
            for (int i = 0; i < this.listallPart.SelectedItems.Count; i++)
            {
                string[] arr = new string[10];
                arr = this.listallPart.SelectedItems[i].ToString().Split('-');
                if (PartList.FindString(arr[0]) == -1)
                {
                    PartList.Items.Add(arr[0]);
                }
            }
            btpartselect_Click(null, null);


            listallwo.Items.Clear();
            string model = "";

            GetListStringPart(out model, PartList);
            DataTable dtwoid = FrmBLL.publicfuntion.getNewTable(mdt, string.Format("PartNumber in ({0})", model));

            foreach (DataRow dr in dtwoid.Rows)
            {
                listallwo.Items.Add(dr["woid"].ToString());
                NamesWo.Add(dr["woid"].ToString());
            }
            wolist.Items.Clear();
        }
示例#5
0
        public static void MoveThroughPartList(int step, PartList partList)
        {
            if (partList.parts.Count <= 0)
            {
                Logger.log.Debug("Part list is empty! Ensure mod part lists are installed in ../BeatSaber/SaberForgeParts");
                return;
            }

            partList.index += step;

            if (partList.index >= partList.parts.Count)
            {
                partList.index = 0;
            }

            else if (partList.index < 0)
            {
                partList.index = partList.parts.Count - 1;
            }

            //set text
            UIFunctions.UpdateAllPartLabels();

            if (step != 0)
            {
                onPartModelChange();
            }
        }
示例#6
0
 /// <inheritdoc />
 protected override void BuildPartList()
 {
     PartList.AppendPart(SinglePortContainerPart.Create(inputPortContainerPartName, ExtractInputPortModel(Model), this, ussClassName));
     PartList.AppendPart(IconTitleProgressPart.Create(titleIconContainerPartName, Model, this, ussClassName));
     PartList.AppendPart(ConstantNodeEditorPart.Create(constantEditorPartName, Model, this, ussClassName));
     PartList.AppendPart(SinglePortContainerPart.Create(outputPortContainerPartName, ExtractOutputPortModel(Model), this, ussClassName));
 }
示例#7
0
        public async Task Start()
        {
            Reset();

            try
            {
                this.Status = DownloadStatus.Downloading;

                await Download();

                //下载完成,开始合并和转换格式
                this.Status = DownloadStatus.Converting;
                await ProcessVideo(PartList.Select(part => part.StorePath).ToList(), this.StorePath, this.OutputFormat);

                this.Status = DownloadStatus.Success;
            }
            catch (TaskCanceledException e)
            {
                this.Status = DownloadStatus.New;
                return;
            }
            catch (Exception e)
            {
                this.Status = DownloadStatus.Error;
            }
        }
示例#8
0
        public override Task Prepare(HttpContext context)
        {
            Title = "Ops";
            CssUrls.Add("/.Face.css");
            JsUrls.Add("/.Face.js");

            PartList parts = new PartList {
                new HeadingElement(1)
                {
                    Content = new PlainText("Ops")
                },
                new PlainText("Here's an image"),
                new BreakElement(),
                new ImageElement()
                {
                    Classes   = new[] { "crabs" },
                    SourceUrl = "https://www.citarella.com/media/catalog/product/cache/1/image/97a78116f02a369697db694bbb2dfa59/0/2/024029200000_01_1.jpg"
                },
                ":D"
            };

            parts.Add(":D");

            Body.Append(new StandardBody {
                Content    = parts,
                ActiveHRef = "/ops"
            });
            return(Task.CompletedTask);
        }
 public async Task CancelAsync()
 {
     isCanceled = true;
     PartList.ForEach(x => x.Task.Cancel());
     DownloadPage.Current.activeDownloadList.Remove(this);
     await this.CacheFolder.DeleteAsync();
 }
示例#10
0
        public override Task Prepare(HttpContext context)
        {
            Title = "ERROR | Face";
            Body.Classes.Add("errorPage");
            CssUrls.Add("/.Face.css");
            JsUrls.Add("/.Face.js");

            PartList parts = new PartList {
                new DivElement()
                {
                    Classes = new[] { "panel" },
                    Content = new Part[] {
                        new HeadingElement(1)
                        {
                            Content = new[] { new PlainText("ERROR") },
                        },
                        new SectionElement()
                        {
                            Content = new Part[] {
                                new LabelElement()
                                {
                                    Content = new PlainText("0x" + _errorCode.ToString("X")),
                                },
                                new PlainText(getStatusDescription(_errorCode))
                            },
                        },
                    }
                }
            };

            Body.Append(new StandardBody {
                Content = parts,
            });
            return(Task.CompletedTask);
        }
示例#11
0
        public bool ExistPartList(string sDescription)
        {
            var chocorroles = new PartList();
            var swap        = chocorroles.getAll();
            var qbo         = (from s in swap where s.iNumber.Equals(sDescription) select s).Count();

            return(qbo >= 1);
        }
示例#12
0
 // Add current products associated parts to partlist.
 public static void LoadPartList()
 {
     PartList.Clear();
     foreach (Part i in CurrentProduct.AssociatedParts)
     {
         PartList.Add(i);
     }
 }
        /// <inheritdoc />
        protected override void BuildPartList()
        {
            PartList.AppendPart(VerticalPortContainerPart.Create(topPortContainerPartName, PortDirection.Input, Model, this, ussClassName));

            PartList.AppendPart(IconTitleProgressPart.Create(titleIconContainerPartName, Model, this, ussClassName));
            PartList.AppendPart(InOutPortContainerPart.Create(portContainerPartName, Model, this, ussClassName));

            PartList.AppendPart(VerticalPortContainerPart.Create(bottomPortContainerPartName, PortDirection.Output, Model, this, ussClassName));
        }
示例#14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IconTitleProgressPart"/> class.
 /// </summary>
 /// <param name="name">The name of the part.</param>
 /// <param name="model">The model displayed in this part.</param>
 /// <param name="ownerElement">The owner of the part.</param>
 /// <param name="parentClassName">The class name of the parent.</param>
 protected IconTitleProgressPart(string name, IGraphElementModel model, IModelUI ownerElement, string parentClassName)
     : base(name, model, ownerElement, parentClassName, multiline: false)
 {
     if (model.IsCollapsible())
     {
         var collapseButtonPart = NodeCollapseButtonPart.Create(collapseButtonPartName, model, ownerElement, ussClassName);
         PartList.AppendPart(collapseButtonPart);
     }
 }
示例#15
0
        internal void ValidateAndFix()
        {
            Validate();
            foreach (Part part in PartList.Where(p => p.Invalid).ToList())
            {
                Remove(part);
            }

            Bounds = CalculateBounds(0, 0, 0, 0);
        }
示例#16
0
    // Start is called before the first frame update
    void Awake()
    {
        // If we haven't parsed the JSON file, parse it
        if (partList == null)
        {
            partList = GetComponent <PartList>();
            partList.PopulatePartsFromJSON();

            SplitData();
        }
    }
示例#17
0
        //Reads the top level score
        static public ScoreProperties ReadScore(ScorePartwise scorePartwise)
        {
            //get the top level properties of the score
            ScoreProperties i = new ScoreProperties();

            if (scorePartwise.getWork() != null)
            {
                i.WorkTitle = scorePartwise.getWork().getWorkTitle();
            }
            if (scorePartwise.getMovementTitle() != null)
            {
                i.MovementTitle = scorePartwise.getMovementTitle();
            }

            if (scorePartwise.getIdentification().getEncoding().getEncodingDateOrEncoderOrSoftware().get(0) != null)
            {
                javax.xml.bind.JAXBElement x = (javax.xml.bind.JAXBElement)scorePartwise.getIdentification().getEncoding().getEncodingDateOrEncoderOrSoftware().get(0);
                i.EncodingSoftware = x.getValue().ToString();
            }
            if (scorePartwise.getCredit().size() > 0)
            {
                Credit credit = (Credit)scorePartwise.getCredit().get(0);
                if (credit.getCreditTypeOrLinkOrBookmark().get(0) is FormattedText)
                {
                    FormattedText ft = (FormattedText)credit.getCreditTypeOrLinkOrBookmark().get(0);
                    i.CreditWords = ft.getValue();
                }
            }
            PartList partlist = scorePartwise.getPartList();

            if (partlist.getPartGroupOrScorePart().get(0) is ScorePart)
            {
                ScorePart scorepart = (ScorePart)partlist.getPartGroupOrScorePart().get(0);
                i.ScorePartID      = scorepart.getId();
                i.PartDisplayName  = scorepart.getPartName().getValue();
                i.PartAbbreviation = scorepart.getPartAbbreviation() is PartName?scorepart.getPartAbbreviation().getValue() : "";

                ScoreInstrument scoreinstrument = (ScoreInstrument)scorepart.getScoreInstrument().get(0);
                i.InstrumentID   = scoreinstrument.getId();
                i.InstrumentName = scoreinstrument.getInstrumentName();
                if (scorepart.getMidiDeviceAndMidiInstrument().get(0) is MidiInstrument)
                {
                    MidiInstrument midiinstrument = (MidiInstrument)scorepart.getMidiDeviceAndMidiInstrument().get(0);
                    i.MidiChannel = midiinstrument.getMidiChannel();
                    i.MidiProgram = midiinstrument.getMidiProgram();
                }
            }
            if (scorePartwise.getPart().size() > 0)
            {
                i.Part = (ScorePartwise.Part)scorePartwise.getPart().get(0);
            }
            return(i);
        }
示例#18
0
        /// <summary>
        /// Creates save data from save locations
        /// </summary>
        /// <param name="file">save location</param>
        /// <exception cref="IOException"></exception>
        /// <exception cref="SaveFormatException"></exception>
        internal SaveData(string file)
        {
            _file = file + ".data";
            if (!Directory.Exists(_file))
            {
                Directory.CreateDirectory(_file).Create();
            }
            _partList   = new PartList(_file);
            _versionMap = new VersionMap(_file);

            CheckDataConsistency();
        }
示例#19
0
        public void CreateMasterListOfParts(PartList partList)
        {
            Part itemTemp = new PartWithWeight("Fasto Cap", "Fasto's pen cap", 0.010f);

            partList.Add(itemTemp);

            itemTemp = new PartWithWeight("Fasto Barrel", "Fasto's pen Barrel", 0.050f);
            partList.Add(itemTemp);

            itemTemp = new PartWithCount("Fasto Refill", "Fasto's pen Refill", 1);
            partList.Add(itemTemp);
        }
示例#20
0
        private void refresh()
        {
            PartList partlist = (PartList)target;

            if (partlist == null)
            {
                return;
            }

            RefreshPartPackage();
            Refresh(partlist);
        }
示例#21
0
 public List <PartPrice> GetPriceOutput(PartList model, string connString)
 {
     SqlParameter[] param =
     {
         new SqlParameter("@invoice_number", model.invoiceNumber),
         new SqlParameter("@part",           model.materialNumber),
         new SqlParameter("@SalesForceID",   model.dealerNumber),
         new SqlParameter("@BUName",         model.buName),
     };
     return(SqlHelper.ExtecuteProcedureReturnData <List <PartPrice> >(connString,
                                                                      "PartsCentral_Pricing", r => r.TranslateAsOutputList(), param));
 }
示例#22
0
    public void ChangePart(bool increasing)
    {
        PartList list = Resources.Load <PartList>("Part Database/Master List");
        int      a;

        switch (activePart)
        {
        case PartTypes.Hull:
            a          = list.allHulls.IndexOf(CurrentPresetData.hull);
            loadedData = null;
            a          = Helper.ChangeIndexNum(list.allHulls.Count, a, increasing);

            ChangeToPart(a);
            break;

        case PartTypes.Movement:
            a          = list.allMovements.IndexOf(CurrentPresetData.movement);
            loadedData = null;
            a          = Helper.ChangeIndexNum(list.allMovements.Count, a, increasing);

            ChangeToPart(a);
            break;

        case PartTypes.LeftWeapon:
            a          = list.allWeapons.IndexOf(CurrentPresetData.weapons[1 + CreatorPairer.indexAdjust]);
            loadedData = null;
            a          = Helper.ChangeIndexNum(list.allWeapons.Count, a, increasing);

            ChangeToPart(a);
            break;

        case PartTypes.RightWeapon:
            a          = list.allWeapons.IndexOf(CurrentPresetData.weapons[0 + CreatorPairer.indexAdjust]);
            loadedData = null;
            a          = Helper.ChangeIndexNum(list.allWeapons.Count, a, increasing);

            ChangeToPart(a);
            break;

        case PartTypes.Gadget:
            a          = list.allGadets.IndexOf(CurrentPresetData.gadget);
            loadedData = null;
            a          = Helper.ChangeIndexNum(list.allGadets.Count, a, increasing);

            ChangeToPart(a);
            break;

        default:
            Debug.LogError("No correct part type for activePart=" + activePart + " found!");
            break;
        }
    }
示例#23
0
文件: RSLT.cs 项目: yakoder/s3pi
 public RSLT(int APIversion, EventHandler handler, RSLT basis)
     : base(APIversion, handler, null)
 {
     this.version                      = basis.version;
     this.routes                       = new PartList(handler, basis.routes);
     this.routeOffsets                 = basis.routeOffsets == null ? null : new SlotOffsetList(handler, basis.routeOffsets);
     this.containers                   = basis.containers == null ? null : new SlottedPartList(handler, basis.containers);
     this.containerOffsets             = basis.containerOffsets == null ? null : new SlotOffsetList(handler, basis.containerOffsets);
     this.effects                      = basis.effects == null ? null : new PartList(handler, basis.effects);
     this.effectOffsets                = basis.effectOffsets == null ? null : new SlotOffsetList(handler, basis.effectOffsets);
     this.inverseKineticsTargets       = basis.inverseKineticsTargets == null ? null : new PartList(handler, basis.inverseKineticsTargets);
     this.inverseKineticsTargetOffsets = basis.inverseKineticsTargetOffsets == null ? null : new SlotOffsetList(handler, basis.inverseKineticsTargetOffsets);
 }
示例#24
0
        public void Remove(Part p)
        {
            PartList.Remove(p);

            if (p.Has <ActivateComponent>())
            {
                WeaponGroup.Remove(p);
            }

            // HACK: I don't know a way to fix the bounding box without recalculating it
            Bounds = CalculateBounds(0, 0, 0, 0);

            // update heat capacity
            p.Get <HeatComponent>().MatchSome(comp => TotalHeatCapacity -= comp.HeatCapacity);
        }
示例#25
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                var quickID = int.Parse(textBox1.Text);
                if (AllParts.Contains(quickID))
                {
                    throw new Exception();
                }
                AllParts.Add(quickID);

                using (var context = new InventoryContext())
                {
                    var part = context.Part.Where(x => x.QuickID == quickID).FirstOrDefault();
                    if (part == null)
                    {
                        throw new ArgumentNullException();
                    }
                    PartList.Add(part);

                    var grid = PartList.Select(x => new
                    {
                        QuickID      = x.QuickID,
                        PartNumber   = x.PartNumber,
                        SerialNumber = x.SerialNumber,
                        Description  = x.Description,
                        Location     = x.Location,
                        Category     = x.Category,
                        Quantity     = 1
                    }).ToList();

                    dataGridView1.DataSource = null;
                    dataGridView1.DataSource = grid;
                }
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("That QuickID was not found.");
            }
            catch (Exception ex)
            {
                MessageBox.Show($"You cannot add the same QuickID twice \r\n \r\n {ex.Message}");
            }
        }
示例#26
0
        public errorCompositeType UpdatePartList(int iIdPartList, String iNumber, String sDescription, String iNumberClient)
        {
            var lstError = new errorCompositeType();

            try
            {
                var r = new PartList();
                r.UpdatePartList(iIdPartList, iNumber, sDescription, iNumberClient);
                lstError.bError = true;
                lstError.sError = "";
                return(lstError);
            }
            catch (Exception ex)
            {
                lstError.bError = false;
                lstError.sError = ex.Message;
                return(lstError);
            }
        }
示例#27
0
        public errorCompositeType DeletePartList(int iIdPartList)
        {
            var lstError = new errorCompositeType();

            try
            {
                var r = new PartList();
                r.DeletePartList(iIdPartList);
                lstError.bError = true;
                lstError.sError = "";
                return(lstError);
            }
            catch (Exception ex)
            {
                lstError.bError = false;
                lstError.sError = ex.Message;
                return(lstError);
            }
        }
        public void PauseOrResume()
        {
            if (IsCompleted)
            {
                return;
            }
            PartList.ForEach(p =>
            {
                p.PauseOrResume();
            });
            IsPaused = !IsPaused;
            switch (IsPaused)
            {
            case true: ChineseStatus = "已暂停"; break;

            case false: ChineseStatus = "下载中"; break;
            }
            ;
        }
示例#29
0
        public void PrintPartList(PartList partList)
        {
            foreach (var itemTemp in partList.Parts)
            {
                //if (itemTemp.Type == PartTypeEnum.ptWeight)
                if (itemTemp is PartWithWeight)
                {
                    PartWithWeight item = (PartWithWeight)itemTemp;
                    System.Console.WriteLine("    By Weight Part -> Name: '{0}', Description: '{1}', Weight: {2}",
                                             item.Name, item.Description, item.Weight);
                }

                if (itemTemp is PartWithCount)
                {
                    PartWithCount item = (PartWithCount)itemTemp;
                    System.Console.WriteLine("    By Count Part -> Name: '{0}', Description: '{1}', Count: {2}",
                                             item.Name, item.Description, item.Count);
                }
            }
        }
示例#30
0
        public int Save(PartList PartList)
        {
            if (PartList.PartListID == 0)
            {
                //PartList _lastVersion = QueryByMoldNumber(PartList.MoldNumber, true).FirstOrDefault();
                //if (_lastVersion != null)
                //{
                //    _lastVersion.Latest = false;
                //    PartList.Version = _lastVersion.Version + 1;
                //    PartList.PrevVersion = _lastVersion.Version;
                //}
                //else
                //{
                //    PartList.Version = 1;
                //    PartList.PrevVersion = 0;
                //}

                PartList.Latest = true;
                //PartList.Released = false;
                _context.PartLists.Add(PartList);
            }
            else
            {
                PartList _dbEntry = _context.PartLists.Find(PartList.PartListID);
                if (_dbEntry != null)
                {
                    _dbEntry.MoldNumber  = PartList.MoldNumber;
                    _dbEntry.Version     = PartList.Version;
                    _dbEntry.Released    = PartList.Released;
                    _dbEntry.Enabled     = PartList.Enabled;
                    _dbEntry.PrevVersion = PartList.PrevVersion;
                    _dbEntry.Latest      = PartList.Latest;
                    _dbEntry.ProjectID   = PartList.ProjectID;
                    _dbEntry.UpdateDate  = PartList.UpdateDate == null? new DateTime(1900, 1, 1): PartList.UpdateDate;
                    _dbEntry.ReleaseDate = PartList.ReleaseDate == null ? new DateTime(1900, 1, 1) : PartList.ReleaseDate;
                }
            }
            _context.SaveChanges();
            return(PartList.PartListID);
        }