예제 #1
0
            public static String Description(FrameType type, CelestialBody selected)
            {
                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return("Non-rotating reference frame fixing the centre of " +
                           selected.theName);

                case FrameType.BARYCENTRIC_ROTATING:
                    if (selected.is_root())
                    {
                        throw Log.Fatal("Describing barycentric rotating frame of root body");
                    }
                    else
                    {
                        return("Reference frame fixing the barycentre of " +
                               selected.theName + " and " + selected.referenceBody.theName +
                               ", the plane in which they move about the barycentre, and" +
                               " the line between them");
                    }

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
예제 #2
0
        private void PriorityFrameDataTitleUI(int index, FrameType frameType)
        {
            switch (frameType)
            {
            case FrameType.PlayEffect:
                SpaceWithLabel(LabelEffect);
                break;

            case FrameType.Hit:
                SpaceWithLabel(LabelCollision);
                break;

            case FrameType.Grab:
                SpaceWithLabel(LabelGrab);
                break;

            case FrameType.Ungrab:
                SpaceWithLabel(LabelUngrab);
                break;

            case FrameType.BlockStart:
                SpaceWithLabel(LabelBlockStart);
                break;

            case FrameType.BlockEnd:
                SpaceWithLabel(LabelBlockEnd);
                break;

            case FrameType.Block:
                SpaceWithLabel(LabelBlock);
                break;

            case FrameType.TrackChange:
                SpaceWithLabel(LabelTrack);
                break;

            default:
                SpaceWithLabel(frameType.ToString());
                break;
            }
            SpaceWithLabel(LabelPriority);
            FrameData        frameData      = GetFrameData(index);
            IFieldValueTable table          = (IFieldValueTable)frameData.GetFieldValueTableValue(frameType.ToString());
            ushort           originPriority = (ushort)table.GetFieldValueTableValue(CommonFrameData.Key_Priority);
            ushort           newPriority    = (ushort)TextField(originPriority);

            if (newPriority != originPriority)
            {
                Controller.SetFramePriorityData(index, frameType, newPriority);
            }
            SpaceWithLabel(LabelLoop);
            ICommonFrameData commonFrameData = (ICommonFrameData)table;
            bool             isLoop          = Toggle(commonFrameData.GetLoop());

            Controller.SetFrameLoopData(index, frameType, isLoop);
            if (SpaceWithButton(BtnDelete))
            {
                Controller.DeletePriorityFrameData(index, frameType);
            }
        }
예제 #3
0
            private static string SelectorText(FrameType type,
                                               CelestialBody selected)
            {
                string abbreviation = Abbreviation(type, selected);

                if (abbreviation != null)
                {
                    return(abbreviation);
                }
                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return(L10N.CacheFormat(
                               "#Principia_ReferenceFrameSelector_SelectorText_BodyCentredNonRotating"));

                case FrameType.BARYCENTRIC_ROTATING:
                    return("DEPRECATED");

                case FrameType.BODY_CENTRED_PARENT_DIRECTION:
                    return(L10N.CacheFormat(
                               "#Principia_ReferenceFrameSelector_SelectorText_BodyCentredParentDirection"));

                case FrameType.BODY_SURFACE:
                    return(L10N.CacheFormat(
                               "#Principia_ReferenceFrameSelector_SelectorText_BodySurface"));

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
예제 #4
0
            private static string SelectorTooltip(FrameType type,
                                                  CelestialBody selected)
            {
                string name = Name(type, selected);

                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return(L10N.CacheFormat(
                               "#Principia_ReferenceFrameSelector_Tooltip_BodyCentredNonRotating",
                               name,
                               selected.Name()));

                case FrameType.BARYCENTRIC_ROTATING:
                    return("DEPRECATED");

                case FrameType.BODY_CENTRED_PARENT_DIRECTION:
                    return(L10N.CacheFormat(
                               "#Principia_ReferenceFrameSelector_Tooltip_BodyCentredParentDirection",
                               name,
                               selected.Name()));

                case FrameType.BODY_SURFACE:
                    return(L10N.CacheFormat(
                               "#Principia_ReferenceFrameSelector_Tooltip_BodySurface",
                               name,
                               selected.Name()));

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
예제 #5
0
            private static string Description(FrameType type,
                                              CelestialBody selected)
            {
                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return(L10N.CelestialString(
                               "#Principia_ReferenceFrameSelector_Description_BodyCentredNonRotating",
                               new[] { selected }));

                case FrameType.BARYCENTRIC_ROTATING:
                    return("DEPRECATED");

                case FrameType.BODY_CENTRED_PARENT_DIRECTION:
                    if (selected.is_root())
                    {
                        throw Log.Fatal(
                                  "Describing parent-direction rotating frame of root body");
                    }
                    else
                    {
                        return(L10N.CelestialString(
                                   "#Principia_ReferenceFrameSelector_Description_BodyCentredParentDirection",
                                   new[] { selected, selected.referenceBody }));
                    }

                case FrameType.BODY_SURFACE:
                    return(L10N.CelestialString(
                               "#Principia_ReferenceFrameSelector_Description_BodySurface",
                               new[] { selected }));

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
예제 #6
0
        // !! Not in C++ version

        /// <devdoc>
        ///    <para>
        ///       Converts the attributes of this <see cref='System.Drawing.Rectangle'/> to a
        ///       human readable string.
        ///    </para>
        /// </devdoc>
        public override string ToString()
        {
            return("{X=" + X.ToString(CultureInfo.CurrentCulture) + ",Y=" + Y.ToString(CultureInfo.CurrentCulture) +
                   ",Width=" + Width.ToString(CultureInfo.CurrentCulture) +
                   ",Height=" + Height.ToString(CultureInfo.CurrentCulture) +
                   ",Angle =" + Angle.ToString(CultureInfo.CurrentCulture) +
                   ",Type=" + FrameType.ToString() + "}");
        }
예제 #7
0
            public static string Description(FrameType type,
                                             CelestialBody selected,
                                             Vessel target_override)
            {
                if (target_override)
                {
                    return(Localizer.Format(
                               "#Principia_ReferenceFrameSelector_Description_Target",
                               target_override.vesselName,
                               selected.NameWithArticle()));
                }
                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return(Localizer.Format(
                               "#Principia_ReferenceFrameSelector_Description_BodyCentredNonRotating",
                               selected.NameWithArticle()));

                case FrameType.BARYCENTRIC_ROTATING:
                    if (selected.is_root())
                    {
                        throw Log.Fatal("Describing barycentric rotating frame of root body");
                    }
                    else
                    {
                        return(Localizer.Format(
                                   "#Principia_ReferenceFrameSelector_Description_BarycentricRotating",
                                   selected.NameWithArticle(),
                                   selected.referenceBody.NameWithArticle()));
                    }

                case FrameType.BODY_CENTRED_PARENT_DIRECTION:
                    if (selected.is_root())
                    {
                        throw Log.Fatal(
                                  "Describing parent-direction rotating frame of root body");
                    }
                    else
                    {
                        return(Localizer.Format(
                                   "#Principia_ReferenceFrameSelector_Description_BodyCentredParentDirection",
                                   selected.NameWithArticle(),
                                   selected.referenceBody.NameWithArticle()));
                    }

                case FrameType.BODY_SURFACE:
                    return(Localizer.Format(
                               "#Principia_ReferenceFrameSelector_Description_BodySurface",
                               selected.NameWithArticle()));

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
            public static String Description(FrameType type,
                                             CelestialBody selected,
                                             Vessel target_override)
            {
                if (target_override)
                {
                    return("Reference frame fixing the target vessel (" +
                           target_override.vesselName + "), the plane of its orbit around " +
                           selected.NameWithArticle() + ", and the line between them");
                }
                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return("Non-rotating reference frame fixing the centre of " +
                           selected.NameWithArticle());

                case FrameType.BARYCENTRIC_ROTATING:
                    if (selected.is_root())
                    {
                        throw Log.Fatal("Describing barycentric rotating frame of root body");
                    }
                    else
                    {
                        return("Reference frame fixing the barycentre of " +
                               selected.NameWithArticle() + " and " +
                               selected.referenceBody.NameWithArticle() +
                               ", the plane in which they move about the barycentre, and" +
                               " the line between them");
                    }

                case FrameType.BODY_CENTRED_PARENT_DIRECTION:
                    if (selected.is_root())
                    {
                        throw Log.Fatal(
                                  "Describing parent-direction rotating frame of root body");
                    }
                    else
                    {
                        return("Reference frame fixing the centre of " +
                               selected.NameWithArticle() +
                               ", the plane of its orbit around " +
                               selected.referenceBody.NameWithArticle() +
                               ", and the line between them");
                    }

                case FrameType.BODY_SURFACE:
                    return("Reference frame fixing the surface of " +
                           selected.NameWithArticle());

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
        //every parameter value for frame type except values of FrameType enumeration should throw InvalidFrameTypeException
        public void GetCommand_ValidFrameTypeParameterForStartGameCommand_ReturnsStartGameCommand([Values] FrameType frameType)
        {
            //arrange
            CommandManager testedCommandManager = new CommandManager(_gameCreatorStub.Object, _manipulatorStub.Object, _historyStub.Object);

            string[] testInput = { "start", "3", "easy", frameType.ToString() };

            //act
            ICommand returnedCommand = testedCommandManager.GetCommand(testInput);

            //assert
            Assert.AreEqual(returnedCommand.GetType(), typeof(StartGameCommand));
        }
예제 #10
0
            private static string NavballName(FrameType type,
                                              CelestialBody selected)
            {
                string result = Abbreviation(type, selected);

                if (result != null)
                {
                    return(result);
                }
                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    result = L10N.CelestialStringOrNull(
                        "#Principia_ReferenceFrameSelector_NavballName_BodyCentredNonRotating",
                        new[] { selected });
                    break;

                case FrameType.BARYCENTRIC_ROTATING:
                    result = "DEPRECATED";
                    break;

                case FrameType.BODY_CENTRED_PARENT_DIRECTION:
                    if (selected.is_root())
                    {
                        throw Log.Fatal(
                                  "Naming parent-direction rotating frame of root body");
                    }
                    else
                    {
                        result = L10N.CelestialStringOrNull(
                            "#Principia_ReferenceFrameSelector_NavballName_BodyCentredParentDirection",
                            new[] { selected, selected.referenceBody });
                    }
                    break;

                case FrameType.BODY_SURFACE:
                    result = L10N.CelestialStringOrNull(
                        "#Principia_ReferenceFrameSelector_NavballName_BodySurface",
                        new[] { selected });
                    break;

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
                if (result != null)
                {
                    return(result);
                }
                return(Name(type, selected));
            }
예제 #11
0
 public static String Name(FrameType type, CelestialBody selected) {
  switch (type) {
    case FrameType.BODY_CENTRED_NON_ROTATING:
      return selected.name + "-Centred Inertial";
    case FrameType.BARYCENTRIC_ROTATING:
       if (selected.is_root()) {
         throw Log.Fatal("Naming barycentric rotating frame of root body");
       } else {
         return selected.referenceBody.name + "-" + selected.name +
                " Barycentric";
       }
    default:
      throw Log.Fatal("Unexpected type " + type.ToString());
  }
 }
예제 #12
0
        public bool IsNullTable()
        {
            bool  isNullTable = true;
            Array array       = Enum.GetValues(typeof(FrameType));

            for (short index = 0; index < array.Length; index++)
            {
                FrameType frameType = (FrameType)array.GetValue(index);
                ITable    table     = (ITable)GetFieldValueTableValue(frameType.ToString());
                if (!table.IsNullTable())
                {
                    isNullTable = false;
                    break;
                }
            }
            return(isNullTable);
        }
            public static String Name(FrameType type,
                                      CelestialBody selected,
                                      Vessel target_override)
            {
                if (target_override)
                {
                    return("Target Local Vert./Horiz. at " + selected.NameWithArticle());
                }
                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return(selected.name + "-Centred Inertial");

                case FrameType.BARYCENTRIC_ROTATING:
                    if (selected.is_root())
                    {
                        throw Log.Fatal("Naming barycentric rotating frame of root body");
                    }
                    else
                    {
                        return(selected.referenceBody.name + "-" + selected.name +
                               " Barycentric");
                    }

                case FrameType.BODY_CENTRED_PARENT_DIRECTION:
                    if (selected.is_root())
                    {
                        throw Log.Fatal(
                                  "Naming parent-direction rotating frame of root body");
                    }
                    else
                    {
                        return(selected.name + "-Centred " + selected.referenceBody.name +
                               "-Aligned");
                    }

                case FrameType.BODY_SURFACE:
                    return(selected.name + "-Centred " + selected.name + "-Fixed");

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
            public static String ShortName(FrameType type,
                                           CelestialBody selected,
                                           Vessel target_override)
            {
                if (target_override)
                {
                    return("Tgt LVLH@" + selected.name[0]);
                }
                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return(selected.name[0] + "CI");

                case FrameType.BARYCENTRIC_ROTATING:
                    if (selected.is_root())
                    {
                        throw Log.Fatal("Naming barycentric rotating frame of root body");
                    }
                    else
                    {
                        return(selected.referenceBody.name[0] + (selected.name[0] + "B"));
                    }

                case FrameType.BODY_CENTRED_PARENT_DIRECTION:
                    if (selected.is_root())
                    {
                        throw Log.Fatal(
                                  "Naming parent-direction rotating frame of root body");
                    }
                    else
                    {
                        return(selected.name[0] + "C" + selected.referenceBody.name[0] +
                               "A");
                    }

                case FrameType.BODY_SURFACE:
                    return(selected.name[0] + "C" + selected.name[0] + "F");

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
예제 #15
0
            public static String ShortName(FrameType type, CelestialBody selected)
            {
                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return(selected.name[0] + "CI");

                case FrameType.BARYCENTRIC_ROTATING:
                    if (selected.is_root())
                    {
                        throw Log.Fatal("Naming barycentric rotating frame of root body");
                    }
                    else
                    {
                        return(selected.referenceBody.name[0] + (selected.name[0] + "B"));
                    }

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
예제 #16
0
            public static String Name(FrameType type, CelestialBody selected)
            {
                switch (type)
                {
                case FrameType.BODY_CENTRED_NON_ROTATING:
                    return(selected.name + "-Centred Inertial");

                case FrameType.BARYCENTRIC_ROTATING:
                    if (selected.is_root())
                    {
                        throw Log.Fatal("Naming barycentric rotating frame of root body");
                    }
                    else
                    {
                        return(selected.referenceBody.name + "-" + selected.name +
                               " Barycentric");
                    }

                case FrameType.BODY_CENTRED_PARENT_DIRECTION:
                    if (selected.is_root())
                    {
                        throw Log.Fatal(
                                  "Naming parent-direction rotating frame of root body");
                    }
                    else
                    {
                        // TODO(egg): find a proper name...
                        return(selected.name + "-Centred " + selected.referenceBody.name +
                               "-Fixed");
                    }

                case FrameType.BODY_SURFACE:
                    return(selected.name + "-Centred " + selected.name + "-Fixed");

                default:
                    throw Log.Fatal("Unexpected type " + type.ToString());
                }
            }
예제 #17
0
        /// <summary>
        /// Asynchrnously sends a frame over the connection
        /// </summary>
        /// <param name="type">DEBUG ONLY: The type of the frame being sent</param>
        /// <param name="frame">The binary of the frame to be sent</param>
        private void _sendFrame(FrameType type, byte[] frame)
        {
            if (State == ConnectionState.End || State == ConnectionState.ConnectionError)
            {
                return;
            }

            try
            {
                Log.DebugFormat("[{0}] Sending frame: Type [{1}]", ID, type.ToString());
                _networkStream.WriteAsync(frame, 0, frame.Length, _cts.Token).ConfigureAwait(false);
            }
            catch (Exception)
            {
                // change connection state to errored first
                State = ConnectionState.ConnectionError;

                // close dependent components and resources
                _closeInternal();

                // raise the OnError event - application should call Dispose()
                OnError?.Invoke(this, null);
            }
        }
예제 #18
0
        /// <summary>
        /// Search the given frame hierarchy for all frames of a given type (sockets, effectors, etc.).
        /// Return an array containing references to these frames, sorted in order, so that
        /// "skt0" is in array[0], etc. Used to give cells rapid access to their joints and effectors 
        /// for physics & animation. 
        /// Note: array will be no larger than is needed to contain all the named frames. Array may be of zero size but will never be null.
        /// If any indices are missing (e.g. anim0 and anim2 exist but not anim1) then the unused array entries will be null
        /// and a trace warning will be emitted.
        /// </summary>
        /// <param name="root">The root frame for the hierarchy</param>
        /// <param name="type">The type of frame to return</param>
        /// <returns>The array of JointFrames</returns>
        public static JointFrame[] IndexFrameType(JointFrame root, FrameType type)
        {
            int num = 0;
            JointFrame[] array = new JointFrame[50];							// A big enough array
            RecurseFrameType(type, array, root);								// fill the elements

            for (num=array.Length; (num>0)&&(array[num-1]==null); num--);		// find out how many entries were filled
            JointFrame[] array2 = new JointFrame[num];							// copy elements into a correctly-sized array
            Array.Copy(array,0,array2,0,num);									// (Possibly zero-length)
            for (int i=0; i<num; i++)											// scan the array for any missing elements and
            {																	// emit a trace warning - cell designer might have
                if (array2[i]==null)											// made a mistake!
                {
                    Trace.WriteLine("WARNING: Unable to find a frame of type "+type.ToString()+" with index "+i);
                }
            }
            return array2;														// any unused entries will be null
        }
예제 #19
0
 public static String Name(FrameType type, CelestialBody selected) {
  switch (type) {
    case FrameType.BODY_CENTRED_NON_ROTATING:
      return selected.name + "-Centred Inertial";
    case FrameType.BARYCENTRIC_ROTATING:
       if (selected.is_root()) {
         throw Log.Fatal("Naming barycentric rotating frame of root body");
       } else {
         return selected.referenceBody.name + "-" + selected.name +
                " Barycentric";
       }
    case FrameType.BODY_CENTRED_PARENT_DIRECTION:
       if (selected.is_root()) {
         throw Log.Fatal(
             "Naming parent-direction rotating frame of root body");
       } else {
         // TODO(egg): find a proper name...
         return selected.name + "-Centred " + selected.referenceBody.name +
                "-Fixed";
       }
    case FrameType.BODY_SURFACE:
      return selected.name + "-Centred " + selected.name + "-Fixed";
    default:
      throw Log.Fatal("Unexpected type " + type.ToString());
  }
 }
예제 #20
0
 public static String ShortName(FrameType type, CelestialBody selected) {
   switch (type) {
     case FrameType.BODY_CENTRED_NON_ROTATING:
       return selected.name[0] + "CI";
     case FrameType.BARYCENTRIC_ROTATING:
       if (selected.is_root()) {
         throw Log.Fatal(
             "Naming parent-direction rotating frame of root body");
       } else {
         return selected.referenceBody.name[0] + (selected.name[0] + "B");
       }
     case FrameType.BODY_CENTRED_PARENT_DIRECTION:
       if (selected.is_root()) {
         throw Log.Fatal("Naming barycentric rotating frame of root body");
       } else {
         return selected.name[0] + "C" + selected.referenceBody.name[0] +
                "F";
       }
     case FrameType.BODY_SURFACE:
       return selected.name[0] + "C" + selected.name[0] + "F";
     default:
       throw Log.Fatal("Unexpected type " + type.ToString());
   }
 }
예제 #21
0
        private ValidationResult ValidateFrame(Frame frame)
        {
            FrameType type = frame.Type;

            byte[] extendedHeader = frame.ExtendedHeader;
            byte[] payload        = frame.Payload;

            switch (type)
            {
            case FrameType.MessageJSON:
                if (extendedHeader != null && extendedHeader.Length != Constants.FrameHeaderConstants.MessageJSON.ExtendedHeaderSizeInBytes)
                {
                    return(new ValidationResult(String.Format(CultureInfo.CurrentCulture, "MessageJson frame extended header is not {0}", Constants.FrameHeaderConstants.MessageJSON.ExtendedHeaderSizeInBytes)));
                }

                if (payload == null || payload.Length == 0)
                {
                    return(new ValidationResult(String.Format(CultureInfo.CurrentCulture, "MessageJson payload is empty")));
                }

                string messageJsonPayload = Encoding.UTF8.GetString(payload);
                return(ValidateJsonContent(messageJsonPayload));

            case FrameType.Chunk:
                if (extendedHeader == null || extendedHeader.Length != Constants.FrameHeaderConstants.Chunk.ExtendedHeaderSizeInBytes)
                {
                    return(new ValidationResult(String.Format(CultureInfo.CurrentCulture, "Chunk frame extended header length is not {0}", Constants.FrameHeaderConstants.Chunk.ExtendedHeaderSizeInBytes)));
                }

                string frameChunkIdFromPayload        = new MemoryBlob(payload).BlobId;
                string frameChunkIdFromExtendedHeader = Convert.ToBase64String(extendedHeader);

                if (!string.Equals(frameChunkIdFromExtendedHeader, frameChunkIdFromPayload))
                {
                    return(new ValidationResult(String.Format(
                                                    CultureInfo.CurrentCulture,
                                                    "ChunkId calculated from extendedHeader:'{0}' is different from chunkId calculated from payload:{1}",
                                                    frameChunkIdFromExtendedHeader,
                                                    frameChunkIdFromPayload)));
                }

                return(new ValidationResult());

            case FrameType.ChunkRange:
                //TODO: Add support for other frame types
                return(new ValidationResult());

            case FrameType.EndFrame:
                return(new ValidationResult(String.Format(CultureInfo.CurrentCulture, "Parsed frame list shouldn't include EndFrame")));

            default:
                return(new ValidationResult(string.Format(CultureInfo.CurrentCulture, "Unknown frame type: '{0}'", type.ToString())));
            }
        }
예제 #22
0
        public void NextFrame(int frameNo, MovementType movementType, bool isLastFrame, AstroImage astroImage, int firstFrameInIntegrationPeriod, string frameFileName)
        {
            m_CurrentAstroImage = astroImage;
            m_FrameNumber       = frameNo;
            TangraContext.Current.CrashReportInfo.FrameNumber = frameNo;

            if (m_Running)
            {
                if (m_FramesDone < m_NumFrames)
                {
                    Pixelmap currPixelmap = astroImage.Pixelmap;
                    if (m_FramesDone == 0)
                    {
                        m_AveragedData = new float[currPixelmap.Width, currPixelmap.Height];
                    }

                    for (int x = 0; x < currPixelmap.Width; x++)
                    {
                        for (int y = 0; y < currPixelmap.Height; y++)
                        {
                            m_AveragedData[x, y] += currPixelmap[x, y];
                        }
                    }

                    m_FramesDone++;
                    m_ControlPanel.SetProgress(m_FramesDone);

                    if (m_FramesDone == m_NumFrames)
                    {
                        // Averaging
                        for (int x = 0; x < currPixelmap.Width; x++)
                        {
                            for (int y = 0; y < currPixelmap.Height; y++)
                            {
                                m_AveragedData[x, y] = (m_AveragedData[x, y] / (ulong)m_FramesDone);
                            }
                        }

                        m_ControlPanel.SetStopped();

                        string fileName = string.Format("{0}_{1}.fit", Path.GetFileNameWithoutExtension(m_VideoController.CurrentVideoFileName), m_FrameType.ToString());

                        if (m_VideoController.ShowSaveFileDialog(
                                "Save " + m_FrameType.ToString() + " fame",
                                "FITS Image (*.fit)|*.fit",
                                ref fileName) == DialogResult.OK)
                        {
                            string notes = string.Format("{0} generated from {1}", m_FrameType.ToString(), Path.GetFileNameWithoutExtension(m_VideoController.CurrentVideoFileName));

                            SaveDarkOrFlatFrame(fileName, currPixelmap.Width, currPixelmap.Height, notes, m_AveragedData, m_ExposureSeconds, m_NumFrames);
                        }

                        m_Running = false;
                        m_VideoController.StopVideo();

                        if (m_FrameType == FrameType.Dark)
                        {
                            UsageStats.Instance.DarkFramesProduced++;
                        }
                        if (m_FrameType == FrameType.MasterFlat)
                        {
                            UsageStats.Instance.FlatFramesProduced++;
                        }

                        UsageStats.Instance.Save();
                    }
                }
            }
        }
예제 #23
0
파일: Frame.cs 프로젝트: LagoVista/ZigBee
        public override string ToString()
        {
            var bld = new StringBuilder();

            if ((byte)FrameType < 0x7F)
            {
                bld.AppendFormat("\r\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\r\n");
            }
            else
            {
                bld.AppendFormat("\r\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\r\n");
            }


            bld.AppendFormat("Frame Type        \t: {0}\r\n", FrameType.ToString());

            if (FrameType == FrameTypes.RxModemStatus)
            {
                bld.AppendFormat("Modem Status      \t: {0}\r\n", ModemStatus.ToString());
            }

            if (FrameType == FrameTypes.RxTransmitStatus)
            {
                bld.AppendFormat("Retry Count       \t: {0}\r\n", TransmitRetryCount);
                bld.AppendFormat("Transmit Status   \t: {0}\r\n", DeliveryStatus);
                bld.AppendFormat("Discovery Status  \t: {0}\r\n", DiscoveryStatus);
            }

            if (FrameType == FrameTypes.TxATCommand)
            {
                bld.AppendFormat("AT Command        \t: {0}\r\n", ATCommandString);

                WritePayload(bld);
            }

            if (FrameType == FrameTypes.RxAtCommandResponse)
            {
                bld.AppendFormat("AT Command        \t: {0}\r\n", ATCommandString);
                bld.AppendFormat("Sending Frame Id  \t: {0}\r\n", FrameId);
                bld.AppendFormat("AT Status         \t: {0}\r\n", ATCommandStatus);

                WritePayload(bld);
            }

            if (FrameType == FrameTypes.RxReceivePacket)
            {
                bld.AppendFormat("Length            \t: {0}\r\n", FormatHex(Length));
                bld.AppendFormat("Payload Length    \t: {0}\r\n", FormatHex(Convert.ToUInt16(Length - 17)));
                bld.AppendFormat("Dest 64 Bit Addr  \t: {0}\r\n", FormatHex(DestinationAddress64Bit));
                bld.AppendFormat("Dest 16 Bit Addr  \t: {0}\r\n", FormatHex(DestinationAddress16Bit));

                bld.AppendFormat("Source End Point  \t: {0:X2}\r\n", SourceEndPoint);
                bld.AppendFormat("Dest End Point    \t: {0:X2}\r\n", DestinationEndPoint);

                bld.AppendFormat("Cluster ID        \t: {0}\r\n", FormatHex(ClusterId));
                bld.AppendFormat("Profile ID        \t: {0}\r\n", FormatHex(ProfileId));

                bld.AppendFormat("Receive Options   \t: {0:X2}\r\n", ReceiveOptions);

                WritePayload(bld);
            }

            if (FrameType == FrameTypes.TxExplicitAddressCommand)
            {
                bld.AppendFormat("Frame ID          \t: {0:X2}\r\n", FrameId);
                bld.AppendFormat("Dest 64 Bit Addr  \t: {0}\r\n", FormatHex(DestinationAddress64Bit));
                bld.AppendFormat("Dest 16 Bit Addr  \t: {0}\r\n", FormatHex(DestinationAddress16Bit));

                bld.AppendFormat("Source End Point  \t: {0:X2}\r\n", SourceEndPoint);
                bld.AppendFormat("Dest End Point    \t: {0:X2}\r\n", DestinationEndPoint);

                bld.AppendFormat("Cluster ID        \t: {0}\r\n", FormatHex(ClusterId));
                bld.AppendFormat("Profile ID        \t: {0}\r\n", FormatHex(ProfileId));

                bld.AppendFormat("Broadcast Radius  \t: {0:X2}\r\n", BroadcastRadius);
                bld.AppendFormat("Transmit Options  \t: {0:X2}\r\n", Options);

                bld.AppendFormat("Check Sum         \t: {0:X2}\r\n", CheckSum);

                WritePayload(bld);
            }

            if ((byte)FrameType < 0x7F)
            {
                bld.AppendFormat(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\r\n");
            }
            else
            {
                bld.AppendFormat("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\r\n");
            }

            bld.Append("\r\n");

            return(bld.ToString());
        }
예제 #24
0
    void configure(FrameType fType)
    {
        type                     = fType;
        numOfHardpoints          = new int[3];
        numOfAvailableHardpoints = new int[3];

        switch (fType)
        {
        case FrameType.LIGHT:
            break;

        case FrameType.MEDIUM:
            break;

        case FrameType.HEAVY:
            break;

        case FrameType.FLYING:
            break;

        default:
            Debug.Log("Invalid FrameType in MachineFrame-- Did you forgot to add a new case? FrameType: " + fType.ToString());
            break;
        }
    }
예제 #25
0
        private Frame NewFrameFromType(FrameType frameType, Status status = Status.Normal, string message = null)
        {
            Frame frame;

            switch (frameType)
            {
            case FrameType.HaproxyDisconnect:
                frame = new HaproxyDisconnectFrame();
                break;

            case FrameType.HaproxyHello:
                frame = new HaproxyHelloFrame();
                break;

            case FrameType.Notify:
                frame = new NotifyFrame();
                break;

            case FrameType.Unset:
                frame = new UnsetFrame();
                break;

            default:
                throw new ApplicationException("Unacceptable frame type in NewFrame: " + frameType.ToString());
            }

            return(frame);
        }
예제 #26
0
 public static String Description(FrameType type, CelestialBody selected) {
   switch (type) {
     case FrameType.BODY_CENTRED_NON_ROTATING:
       return "Non-rotating reference frame fixing the centre of " +
              selected.theName;
     case FrameType.BARYCENTRIC_ROTATING:
       if (selected.is_root()) {
         throw Log.Fatal("Describing barycentric rotating frame of root body");
       } else {
         return "Reference frame fixing the barycentre of " +
                selected.theName + " and " + selected.referenceBody.theName +
                ", the plane in which they move about the barycentre, and" +
                " the line between them";
       }
     default:
       throw Log.Fatal("Unexpected type " + type.ToString());
   }
 }
예제 #27
0
        private void FrameDataListUI(int frameIndex, FrameType frameType)
        {
            FrameData               frameData         = GetFrameData(frameIndex);
            IFieldValueTable        table             = (IFieldValueTable)frameData.GetFieldValueTableValue(frameType.ToString());
            CustomData <EffectData> defaultCustomData = default;
            object     customData               = table.GetFieldValueTableValue(defaultCustomData.GetKey());
            MethodInfo getTableListMethod       = customData.GetType().GetMethod("GetTableList");
            Array      dataList                 = getTableListMethod.Invoke(customData, null) as Array;
            Func <int, object, bool> uiFunction = default;

            switch (frameType)
            {
            case FrameType.PlayEffect:
                uiFunction = EffectDataUI;
                break;

            case FrameType.Hit:
                uiFunction = HitDataUI;
                break;

            case FrameType.Buff:
                uiFunction = BuffDataUI;
                break;

            case FrameType.Grab:
                uiFunction = GrabDataUI;
                break;

            case FrameType.Block:
                uiFunction = BlockDataUI;
                break;
            }
            if (dataList == null)
            {
                return;
            }
            for (int index = 0; index < dataList.Length; index++)
            {
                if (HorizontalLayoutUI(uiFunction, frameData.index - 1, dataList.GetValue(index)))
                {
                    break;
                }
            }
        }