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); }
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(); }
/// <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()); }
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; }
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; }
public override void DumpShortBody(XmlWriter writer) { base.DumpShortBody(writer); writer.WriteElementString("frame-count", FrameCount.ToString()); }