Ejemplo n.º 1
0
        public GaleObject(string path)
        {
            Handle = gg.Open(path);

            if (Handle.ToInt64() == 0)
            {
                switch (gg.GetLastError())
                {
                case ERROR_CODE.NO_ERROR: break;

                case ERROR_CODE.FILE_NOT_FOUND: throw new FileNotFoundException("File not found!", path);

                case ERROR_CODE.FILE_INVALID_FORMAT: throw new Exception("Invalid format at file: " + path);

                default: throw new Exception("Unknow Error while read: " + path);
                }
            }

            Width  = gg.GetWidth(Handle);
            Height = gg.GetHeight(Handle);

            SinglePalette   = gg.IsSinglePalette(Handle);
            BackgroundColor = gg.GetBackgroundColor(Handle);

            DisabledBottomLayerTransparency = gg.IsBottomLayerTransparencyDisabled(Handle);

            BitsPerPixel = gg.GetBitsPerPixel(Handle);
            IndexedColor = BitsPerPixel <= 8;

            FrameCount       = gg.GetFrameCount(Handle);
            _ZeroDigitFormat = new String('0', FrameCount.ToString().Length);
        }
Ejemplo n.º 2
0
        private void Declare()
        {
            Action     = new MainMenu.Action(this);
            Button     = new ButtonItem(this);
            CreateMain = new Create(this);
            Keyboard   = new Keyboard(this);
            MainMenu   = new MainMenu.Menu(this);
            Mouse      = new Mouse(this);
            Nav        = new Navigation(this);
            Shutter    = new Shutter(this);
            SubAction  = new SubMenu.Action(this);
            SubMenu    = new SubMenu.Menu(this);

            SubSelectMenu = new SubSelectMenu.Menu(this);
            SubSelectVar  = new SubSelectMenu.Var();
            SubNav        = new SubSelectMenu.Navigation(this);

            Var         = new Variables();
            Data        = new Interaction();
            Fps         = new FrameCount();
            Gamepad     = new Gamepad(this);
            User        = new User();
            DrawGui     = new DrawGraph();
            Display     = new Display(this);
            VideoDevice = new CaptureDevice(this);
            Profiles    = new Profiles(this);

            RemapMenu    = new Remap.Remap(this);
            RemapGamepad = new Remap.Gamepad(this);
            RemapNav     = new Remap.Navigation(this);

            ConfigVr     = new VR.Config(this);
            ResizeVr     = new Resize(this);
            RepositionVr = new Reposition(this);
        }
Ejemplo n.º 3
0
        private void DoRun()
        {
            string CurPath;

            CurPath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "DesktopEarlab.exe");
            if (File.Exists(CurPath))
            {
                mExecutionProcess = new Process();
                mExecutionProcess.StartInfo.WorkingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
            }
            else
            {
                CurPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"EarLab\Desktop EarLab\DesktopEarlab.exe");
                if (File.Exists(CurPath))
                {
                    mExecutionProcess = new Process();
                    mExecutionProcess.StartInfo.WorkingDirectory = Path.GetDirectoryName(CurPath);
                }
                else
                {
                    MessageBox.Show("Could not find necessary simulation environment file \"DesktopEarlab.exe\".  Please reinstall the Desktop EarLab environment and try again.", "Error running simulation", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            mExecutionProcess.StartInfo.FileName  = CurPath;
            mExecutionProcess.StartInfo.Arguments = "-n " + FrameCount.ToString() + " -m \"" + ModuleDirectory + "\" -i \"" + InputDirectory + "\" -o \"" + OutputDirectory + "\" \"" + DiagramFile + "\" \"" + ParameterFile + "\"";

            ClearLog();
            if (mEnableSuperuserMode.Value)
            {
                Log("Running command: \"" + CurPath + "\" " + mExecutionProcess.StartInfo.Arguments);
            }
            mExecutionProcess.StartInfo.RedirectStandardInput  = true;
            mExecutionProcess.StartInfo.RedirectStandardOutput = true;
            mExecutionProcess.StartInfo.UseShellExecute        = false;
            mExecutionProcess.StartInfo.CreateNoWindow         = true;
            mExecutionProcess.Start();
            mExecutionThread = new Thread(new ThreadStart(RunModel));
            mExecutionThread.IsBackground = true;
            mExecutionThread.Name         = "Model Execution Thread";
            progressBar.Value             = 0;
            progressBar.Visible           = true;
            progressBar.Minimum           = 0;
            progressBar.Maximum           = mFrameCount.Value + 1;
            mExecutionThread.Priority     = ThreadPriority.BelowNormal;
            mExecutionThread.Start();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Appends header specific attributes to <paramref name="attributes"/> dictionary.
        /// </summary>
        /// <param name="attributes">Dictionary to append header specific attributes to.</param>
        internal void AppendHeaderAttributes(Dictionary <string, string> attributes)
        {
            attributes.Add("Frame Type", (ushort)TypeID + ": " + TypeID);

            if (FrameImages != null)
            {
                attributes.Add("Frame Length", FrameImages.BinaryLength.ToString());
                attributes.Add("Frame Images", FrameImages.Count.ToString());
            }
            else
            {
                attributes.Add("Frame Length", FrameLength.ToString());
                attributes.Add("Frame Images", "0");
            }

            attributes.Add("Frame Count", FrameCount.ToString());
            attributes.Add("Sample Count", m_sampleCount.ToString());
            attributes.Add("Status Flags", m_statusFlags.ToString());
            attributes.Add("Is First Frame", IsFirstFrame.ToString());
            attributes.Add("Is Last Frame", IsLastFrame.ToString());
        }
Ejemplo n.º 5
0
        private void DoRun()
        {
            mExecutionProcess = new Process();

            mExecutionProcess.StartInfo.FileName               = "DesktopEarlab.exe";
            mExecutionProcess.StartInfo.Arguments              = "-n " + FrameCount.ToString() + " -m \"" + ModuleDirectory + "\" -i \"" + InputDirectory + "\" -o \"" + OutputDirectory + "\" \"" + DiagramFile + "\" \"" + ParameterFile + "\"";
            mExecutionProcess.StartInfo.RedirectStandardInput  = true;
            mExecutionProcess.StartInfo.RedirectStandardOutput = true;
            mExecutionProcess.StartInfo.UseShellExecute        = false;
            mExecutionProcess.StartInfo.CreateNoWindow         = true;
            mExecutionProcess.Start();
            mExecutionThread = new Thread(new ThreadStart(RunModel));
            mExecutionThread.IsBackground = true;
            mExecutionThread.Name         = "Model Execution Thread";
            mStopModel                = false;
            progressBar.Value         = 0;
            progressBar.Visible       = true;
            progressBar.Minimum       = 0;
            progressBar.Maximum       = mFrameCount.Value + 1;
            mExecutionThread.Priority = ThreadPriority.BelowNormal;
            mExecutionThread.Start();
            timer.Enabled = true;
        }
Ejemplo n.º 6
0
 private void DelaySetColors()
 {
     foreach (KeyValuePair <Vessel, FrameCount> kvp in delaySetColors)
     {
         FrameCount frameCount = kvp.Value;
         frameCount.number = frameCount.number - 1;
         if (frameCount.number == 0)
         {
             delayRemoveList.Add(kvp.Key);
         }
     }
     foreach (Vessel setVessel in delayRemoveList)
     {
         delaySetColors.Remove(setVessel);
         if (FlightGlobals.fetch.vessels.Contains(setVessel))
         {
             SetVesselColor(setVessel);
         }
     }
     if (delayRemoveList.Count > 0)
     {
         delayRemoveList.Clear();
     }
 }
Ejemplo n.º 7
0
        private void SeekPanelGUI()
        {
            GUI.enabled = Seekable;

            GUILayoutOption[] miniButtonOptions = { GUILayout.Width(20.0f), GUILayout.Height(20.0f) };
            string            format            = string.Format("{{0,{0}}}/{{1,{0}}} frames", FrameCount.ToString().Length);
            string            info = string.Format(format, EndFrame - BeginFrame, FrameCount);

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("[", miniButtonOptions))
            {
                BeginFrame = CurrentFrame;
            }
            if (GUILayout.Button("<", miniButtonOptions))
            {
                CurrentFrame--;
            }
            CurrentFrame = EditorGUILayout.IntSlider(CurrentFrame, 0, FrameCount - 1);
            if (GUILayout.Button(">", miniButtonOptions))
            {
                CurrentFrame++;
            }
            if (GUILayout.Button("]", miniButtonOptions))
            {
                EndFrame = CurrentFrame + 1;
            }
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10.0f);

            EditorGUILayout.BeginHorizontal();
            BeginFrame = EditorGUILayout.DelayedIntField(BeginFrame, GUILayout.MaxWidth(50.0f));
            GUILayout.Label(" - ");
            EndFrame = EditorGUILayout.DelayedIntField(EndFrame, GUILayout.MaxWidth(50.0f));
            GUILayout.Label(info);
            GUILayout.FlexibleSpace();
            GUILayout.Label(GetFileSizeLabel(GetExpectedFileSize()));
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(10.0f);

            GUI.enabled = true;
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Serializes this object to .osu code.
 /// </summary>
 /// <returns></returns>
 public override string GetLine()
 {
     return($"Animation,{Layer},{Origin},\"{FilePath}\",{Pos.X.ToInvariant()},{Pos.Y.ToInvariant()},{FrameCount.ToInvariant()},{FrameDelay.ToInvariant()},{LoopType}");
 }
Ejemplo n.º 9
0
 public override void DumpShortBody(XmlWriter writer)
 {
     base.DumpShortBody(writer);
     writer.WriteElementString("frame-count", FrameCount.ToString());
 }