Ejemplo n.º 1
0
        public override void ReadBinary(ESPReader reader)
        {
            List <string> readTags = new List <string>();

            while (reader.BaseStream.Position < reader.BaseStream.Length)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "BPTN":
                    if (readTags.Contains("BPTN"))
                    {
                        return;
                    }
                    PartName.ReadBinary(reader);
                    break;

                case "BPNN":
                    if (readTags.Contains("BPNN"))
                    {
                        return;
                    }
                    BodyPart.ReadBinary(reader);
                    break;

                default:
                    return;
                }

                readTags.Add(subTag);
            }
        }
Ejemplo n.º 2
0
 public PipModel(PartName partName, int maxCap, int allocated, bool locked)
 {
     Name      = partName;
     MaxCap    = maxCap;
     Allocated = allocated;
     Locked    = locked;
 }
Ejemplo n.º 3
0
        public void Parsing()
        {
            Assert.True(PartName.TryParse("~1~02~492 Title.suffix", out PartName? name));
            Assert.NotNull(name);
            Assert.Equal(1, name.TopPart);
            Assert.Equal(2, name.MidPart);
            Assert.Equal(492, name.BottomPart);

            Assert.True(PartName.TryParse("~02~492 Title.suffix", out name));
            Assert.NotNull(name);
            Assert.Equal(2, name.TopPart);
            Assert.Equal(492, name.MidPart);
            Assert.Equal(PartName.None, name.BottomPart);

            Assert.True(PartName.TryParse("~492 Title.suffix", out name));
            Assert.NotNull(name);
            Assert.Equal(492, name.TopPart);
            Assert.Equal(PartName.None, name.MidPart);
            Assert.Equal(PartName.None, name.BottomPart);

            Assert.True(PartName.TryParse("~1 Title.suffix", out name));
            Assert.NotNull(name);
            Assert.Equal(1, name.TopPart);
            Assert.Equal(PartName.None, name.MidPart);
            Assert.Equal(PartName.None, name.BottomPart);

            Assert.True(PartName.TryParse("~1~02 Title.suffix", out name));
            Assert.NotNull(name);
            Assert.Equal(1, name.TopPart);
            Assert.Equal(2, name.MidPart);
            Assert.Equal(PartName.None, name.BottomPart);
        }
Ejemplo n.º 4
0
 public static Rotor CreateRotor(PartName name)
 {
     int[] wiring, notch;
     switch (name)
     {
         case PartName.RotorI:
             //EKMFLGDQVZNTOWYHXUSPAIBRCJ
             wiring = new int[26] { 4, 10, 12, 5, 11, 6, 3, 16, 21, 25, 13, 19, 14, 22, 24, 7, 23, 20, 18, 15, 0, 8, 1, 17, 2, 9 };
             //Q
             notch = new int[1] { 16 };
             break;
         case PartName.RotorII:
             //AJDKSIRUXBLHWTMCQGZNPYFVOE
             wiring = new int[26] { 0, 9, 3, 10, 18, 8, 17, 20, 23, 1, 11, 7, 22, 19, 12, 2, 16, 6, 25, 13, 15, 24, 5, 21, 14, 4 };
             //E
             notch = new int[1] { 4 };
             break;
         case PartName.RotorIII:
             //BDFHJLCPRTXVZNYEIWGAKMUSQO
             wiring = new int[26] { 1, 3, 5, 7, 9, 11, 2, 15, 17, 19, 23, 21, 25, 13, 24, 4, 8, 22, 6, 0, 10, 12, 20, 18, 16, 14 };
             //V
             notch = new int[1] { 21 };
             break;
         default:
             throw new ArgumentException("Invalid RotorType");
     }
     return new Rotor(wiring, notch, name);
 }
Ejemplo n.º 5
0
 private Rotor(int[] wiring, int[] notches, PartName type)
 {
     this.wiring = wiring;
     this.notches = notches;
     RingPosition = 0;
     CurrentPosition = 0;
 }
Ejemplo n.º 6
0
Archivo: Blow.cs Proyecto: NoGRo/SbBjT
        public void Do(PartName partName, bool putIn)
        {
            ToDoPart = partName;
            ToDoIn = putIn;

            TimerSpeed.Stop();
            TimerSpeed.Start();
        }
Ejemplo n.º 7
0
 public AItem(List <string> data, IProcessLogger logger)
 {
     PartNo          = int.Parse(data[0]);
     PartName        = data[1];
     PartDescription = data[2];
     PartPrice       = decimal.Parse(data[3]);
     PartSale        = decimal.Parse(data[4]);
     PartImage       = data[5];
     _logger         = logger;
     _logger.Log($"STORE No.: {PartNo} - {PartName.ToUpper()}", true);
 }
Ejemplo n.º 8
0
 public override void WriteBinary(ESPWriter writer)
 {
     if (PartName != null)
     {
         PartName.WriteBinary(writer);
     }
     if (BodyPart != null)
     {
         BodyPart.WriteBinary(writer);
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 ///     Gets the hash code
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (TranslationText != null ? TranslationText.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Text != null ? Text.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Background != null ? Background.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TextSize.GetHashCode();
         hashCode = (hashCode * 397) ^ (PartName != null ? PartName.GetHashCode() : 0);
         return(hashCode);
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Implements IComponent.Execute method.
        /// </summary>
        /// <param name="pc">Pipeline context</param>
        /// <param name="inmsg">Input message</param>
        /// <returns>Original input message</returns>
        /// <remarks>
        /// IComponent.Execute method is used to initiate
        /// the processing of the message in this pipeline component.
        /// </remarks>
        public IBaseMessage Execute(IPipelineContext pc, IBaseMessage inmsg)
        {
            int    PartCount    = inmsg.PartCount;
            string BodyPartName = inmsg.BodyPartName;

            string systemPropertiesNamespace = @"http://schemas.microsoft.com/BizTalk/2003/system-properties";

            try
            {
                for (int i = 0; i < inmsg.PartCount; i++)
                {
                    string           PartName;
                    IBaseMessagePart CurrentPart = inmsg.GetPartByIndex(i, out PartName);

                    if (!PartName.Equals(BodyPartName))
                    {
                        Stream CurrentPartSource = CurrentPart.GetOriginalDataStream();
                        byte[] CurrentPartBuffer = new byte[CurrentPartSource.Length];
                        CurrentPartSource.Read(CurrentPartBuffer, 0, CurrentPartBuffer.Length);

                        byte[] CompressedPartBuffer;
                        using (MemoryStream TempStream = new MemoryStream())
                        {
                            using (GZipStream CompressedStream = new GZipStream(TempStream, CompressionMode.Compress, true))
                            {
                                CompressedStream.Write(CurrentPartBuffer, 0, CurrentPartBuffer.Length);
                                CompressedStream.Close();
                            }
                            CompressedPartBuffer = TempStream.ToArray();
                        }

                        MemoryStream TempCompressedStream = new MemoryStream(CompressedPartBuffer);
                        inmsg.GetPartByIndex(i, out PartName).Data = TempCompressedStream;
                        string PropertyName   = "FileName";
                        string PropertySchema = "http://schemas.microsoft.com/BizTalk/2003/mime-properties";
                        string SourcePartName = inmsg.GetPartByIndex(i, out PartName).PartProperties.Read(PropertyName,
                                                                                                          PropertySchema).ToString();
                        SourcePartName += this.FileExtension;

                        inmsg.GetPartByIndex(i, out PartName).PartProperties.Write("FileName", PropertySchema, SourcePartName);
                    }
                }
            }
            catch
            {
                throw;
            }
            return(inmsg);
        }
Ejemplo n.º 11
0
        public override void WriteXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (PartName != null)
            {
                ele.TryPathTo("PartName", true, out subEle);
                PartName.WriteXML(subEle, master);
            }
            if (BodyPart != null)
            {
                ele.TryPathTo("BodyPart", true, out subEle);
                BodyPart.WriteXML(subEle, master);
            }
        }
Ejemplo n.º 12
0
        public override void ReadXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("PartName", false, out subEle))
            {
                if (PartName == null)
                {
                    PartName = new SimpleSubrecord <String>();
                }

                PartName.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("BodyPart", false, out subEle))
            {
                if (BodyPart == null)
                {
                    BodyPart = new BodyPart();
                }

                BodyPart.ReadXML(subEle, master);
            }
        }
Ejemplo n.º 13
0
 public void NextDo(PartName partName)
 {
     Next = partName;
 }
Ejemplo n.º 14
0
 public PunishSuckDo(B*****b b*****b, PartName partName)
 {
     B*****b = b*****b;
     PartName = partName;
 }
Ejemplo n.º 15
0
        public string KeyboardTilesToMusicXML(List <KeyboardTile> keyboardTiles, int frameCount)
        {
            // Downloaded youtube videos always have a fps of 23.98
            int videoLength = frameCount / 24;

            int measureCount = videoLength / 2;

            ScorePartwisePartMeasure[] measures = new ScorePartwisePartMeasure[measureCount];
            for (int i = 0; i < measureCount; i++)
            {
                measures[i]        = new ScorePartwisePartMeasure();
                measures[i].Number = i.ToString();
            }

            Dictionary <Note, int> NoteFrameDict = new Dictionary <Note, int>();

            foreach (var keyboardTile in keyboardTiles)
            {
                foreach (var press in keyboardTile.TilePresses)
                {
                    var startFrame = press.Item1;
                    var endFrame   = press.Item2;

                    Pitch keyboardPitch = new Pitch();
                    keyboardPitch.Octave = keyboardTile.Octave.ToString();
                    keyboardPitch.Step   = NotesToMusicXMLStep[keyboardTile.Note];
                    keyboardPitch.Alter  = NoteToAlter(keyboardTile.Note);
                    double startSec     = startFrame / 24;
                    int    measureIndex = (int)(startSec / 2);
                    var    measure      = measures[measureIndex];
                    Note   pressNote    = new Note();
                    pressNote.Pitch = keyboardPitch;
                    pressNote.Type  = DurationToNodeType(press);
                    measure.Note.Add(pressNote);
                    NoteFrameDict.Add(pressNote, startFrame);
                }
            }

            for (int i = 0; i < measures.Length; i++)
            {
                var measure = measures[i];

                Note[] notes        = new Note[measure.Note.Count];
                var    notesOrdered = notes.OrderBy(x => NoteFrameDict[x]).Select(x => x);

                measure.Note.CopyTo(notes, 0);

                while (measure.Note.Count > 0)
                {
                    measure.Note.RemoveAt(0);
                }

                foreach (var note in notesOrdered)
                {
                    measure.Note.Add(note);
                }

                var lastFrame = 0;

                foreach (var note in measure.Note)
                {
                    var startFrame = NoteFrameDict[note];

                    if (lastFrame == startFrame)
                    {
                        note.Chord = new Empty();
                    }

                    lastFrame = startFrame;
                }
            }

            ScorePartwise spw       = new ScorePartwise();
            PartList      partList  = new PartList();
            ScorePart     scorePart = new ScorePart();
            PartName      partName  = new PartName();

            partName.Value     = "NotesheetR";
            scorePart.PartName = partName;
            scorePart.Id       = "1";
            partList.ScorePart = scorePart;
            ScorePartwisePart part = new ScorePartwisePart();

            part.Id = "1";

            foreach (var measure in measures)
            {
                part.Measure.Add(measure);
            }

            spw.Part.Add(part);
            spw.PartList = partList;
            return(ParseToXml(spw));
        }
Ejemplo n.º 16
0
 public EveryRandom(int Do, int In, PartName partName)
 {
     this.Do = Do;
     this.In = In;
     PartName = partName;
 }
Ejemplo n.º 17
0
        //***************************************** Create Object Factory *******************************************//
        //The Object Factory, Used to create the elements of the score as required

        //***************************************** ScorePartwise *******************************************//
        // Create the top level Partwise Score Element


        public static ScorePartwise CreateScorePartwise(ScoreProperties i)
        {
            ObjectFactory factory = new ObjectFactory();

            //Create a scorepart
            ScorePartwise.Part part;
            Marshalling.getContext();
            ///////////////////// Following are the main components required for the Score in Phase 1


            //***************************************** ScorePartwise *******************************************//
            ScorePartwise scorePartwise = factory.createScorePartwise();

            // Set the version of MusicXML
            scorePartwise.setVersion("3.0");

            //***************************************** Set Work and Movement Titles *******************************************//
            // Create the work element and set its title
            Work work = factory.createWork();

            work.setWorkTitle(i.WorkTitle);


            //Setting some properties of the root element.
            scorePartwise.setMovementTitle(i.MovementTitle);

            //Set the work title of the scorepartwise
            scorePartwise.setWork(work);

            //***************************************** Create and set Identification Element *******************************************//

            //Create identification and set its properties
            Identification identification = factory.createIdentification();

            com.audiveris.proxymusic.Encoding encoding = factory.createEncoding();

            //set the software used for encoding
            encoding.getEncodingDateOrEncoderOrSoftware().add(factory.createEncodingSoftware(i.EncodingSoftware));

            // set the encoding
            identification.setEncoding(encoding);
            scorePartwise.setIdentification(identification);


            //***************************************** Set the Credit words *******************************************//

            Credit        credit         = factory.createCredit();
            FormattedText creditwordtext = new FormattedText();

            creditwordtext.setValue(i.CreditWords);
            credit.getCreditTypeOrLinkOrBookmark().add(creditwordtext);

            scorePartwise.getCredit().add(credit);
            //***************************************** Create a PartList *******************************************//

            PartList partlist = factory.createPartList();

            // create a scorepart
            ScorePart scorepart = factory.createScorePart();

            ////////////////////////Some Properties of the scorepart
            PartName partname = factory.createPartName();

            partname.setValue(i.PartDisplayName);
            scorepart.setPartName(partname);

            //set part abbreviation
            partname.setValue(i.PartAbbreviation);
            scorepart.setPartAbbreviation(partname);

            //set the scorepart id
            scorepart.setId(i.ScorePartID);

            // set the scorepart instrument
            ScoreInstrument scoreinstrument = factory.createScoreInstrument();

            scoreinstrument.setId(i.InstrumentID);
            scoreinstrument.setInstrumentName(i.InstrumentName);

            scorepart.getScoreInstrument().add(scoreinstrument);

            //set the midi device parameters
            MidiInstrument midiinstrument = factory.createMidiInstrument();

            //set midi instrument Id
            midiinstrument.setId(scoreinstrument);

            //set midi channel
            java.lang.Integer midichannel = i.MidiChannel; //channel number
            midiinstrument.setMidiChannel(midichannel);

            //set midi program
            java.lang.Integer midiprogram = i.MidiProgram; //program number
            midiinstrument.setMidiProgram(midiprogram);


            scorepart.getMidiDeviceAndMidiInstrument().add(midiinstrument);

            // add the scorepart to the partlist
            partlist.getPartGroupOrScorePart().add(scorepart); //Ambiguity

            scorePartwise.setPartList(partlist);

            //***************************************** Create a Part *******************************************//
            if (i.Part == null)
            {
                part = factory.createScorePartwisePart();
            }
            else
            {
                part = i.Part;
            }
            //set part id
            part.setId(scorepart);

            // Add the part to the score
            scorePartwise.getPart().add(part);

            return(scorePartwise);
        }
Ejemplo n.º 18
0
 public AndLast(IBlowJobBehavior behavior, int last, PartName partName)
 {
     this.Behavior = behavior;
     this.Last = last;
     PartName = partName;
 }
Ejemplo n.º 19
0
 private Reflector(int[] wiring, PartName name)
 {
     this.wiring = wiring;
 }
Ejemplo n.º 20
0
 public DickPart(PartName name)
 {
     Name = name;
 }
Ejemplo n.º 21
0
 public DickPart(PartName name,ColorDetector colorDetector )
 {
     ColorDetector = colorDetector;
     Name = name;
 }
Ejemplo n.º 22
0
Archivo: Blow.cs Proyecto: NoGRo/SbBjT
 public void Do(PartName partName)
 {
     Do(partName, true);
 }