Esempio n. 1
0
 public Frame Clone()
 {
     Frame frame = new Frame(this.m_length);
     frame.m_cells = new List<uint>();
     frame.m_cells.AddRange(this.m_cells);
     return frame;
 }
Esempio n. 2
0
 public static ParsedFrame ParseFrame(Frame frame, int boardLayoutWidth, int boardLayoutHeight)
 {
     ParsedFrame frame2 = new ParsedFrame(frame.Length, boardLayoutWidth, boardLayoutHeight);
     foreach (uint num in frame.Cells)
     {
         frame2.AddCell(num);
     }
     return frame2;
 }
Esempio n. 3
0
 public Frame MergeWith(Frame frame)
 {
     Frame frame2 = new Frame(Math.Max(this.m_length, frame.m_length));
     frame2.m_cells.AddRange(this.m_cells);
     foreach (uint num in frame.Cells)
     {
         if (!frame2.m_cells.Contains(num))
         {
             frame2.m_cells.Add(num);
         }
     }
     return frame2;
 }
Esempio n. 4
0
 public void UpdateFrame(Frame frame)
 {
     this.m_frameBuffer = ParsedFrame.ParseFrame(frame, this.m_boardLayoutWidth, this.m_boardLayoutHeight);
 }
Esempio n. 5
0
 public void UpdateFrame(Frame frame)
 {
     if (((this.m_state == RunState.Running) && (this.m_display != null)) && !this.m_display.IsDisposed)
     {
         lock (this.m_display)
         {
             this.m_display.OutputFrame(ParsedFrame.ParseFrame(frame, this.m_boardLayout.Width, this.m_boardLayout.Height));
         }
     }
 }
Esempio n. 6
0
 private void LoadFrames()
 {
     try
     {
         this.m_frames.Clear();
         foreach (XmlNode node in this.m_ledUINode.SelectNodes("Frames/Frame"))
         {
             Frame item = new Frame(node);
             this.m_frames.Add(item);
         }
         this.m_blankFrame = new Frame(1);
     }
     catch (ArgumentException)
     {
         throw;
     }
     catch
     {
         throw new Exception("Error loading frames.\n\nIf you are executing a scripted sequence, make sure the LedTriks plugin is setup for that.");
     }
 }
Esempio n. 7
0
 public void Startup()
 {
     if (this.m_portAddress == 0)
     {
         throw new Exception("No port has been specified.");
     }
     if (((this.m_thread != null) && this.m_running) && this.m_thread.IsAlive)
     {
         this.Shutdown();
     }
     EventSequence executable = (EventSequence) this.m_executable;
     this.m_ledUINode = executable.Extensions[".led"];
     if (!this.m_useWithScript)
     {
         XmlNode node = this.m_ledUINode.SelectSingleNode("Boards");
         if (node == null)
         {
             throw new ArgumentException("Cannot use the LedTriks output plugin with a non-LedTriks sequence.");
         }
         this.m_boardLayoutWidth = int.Parse(node.Attributes["width"].Value);
         this.m_boardLayoutHeight = int.Parse(node.Attributes["height"].Value);
         this.m_hardware = new Hardware(this.m_portAddress, this.m_boardLayoutWidth, this.m_boardLayoutHeight);
         this.LoadFrames();
         this.m_frameIndex = this.GetFrameAt(this.m_timer.Milliseconds);
         this.FrameTimesFromFrameIndex(this.m_frameIndex);
         this.m_thread = new Thread(new ThreadStart(this.StaticExecutionThread));
     }
     else
     {
         this.m_hardware = new Hardware(this.m_portAddress, 1, 1);
         this.m_frames.Clear();
         this.m_blankFrame = new Frame(1);
         this.m_thread = new Thread(new ThreadStart(this.DynamicExecutionThread));
     }
     this.m_hardware.Start();
     this.m_running = true;
     this.m_thread.Start();
 }
Esempio n. 8
0
 private unsafe Frame FrameFromBitmap(Bitmap bitmap, int length, int yOffset)
 {
     BitmapData bitmapdata = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat);
     Frame frame = new Frame(length);
     int num2 = 0;
     while (num2 < bitmap.Height)
     {
         int* numPtr = (int*) (((int*)bitmapdata.Scan0) + ((num2 * bitmap.Width) * 4));
         for (int i = 0; i < bitmap.Width; i++)
         {
             if (numPtr[i] != -1)
             {
                 frame.Cells.Add((uint) ((i << 0x10) | yOffset));
             }
         }
         num2++;
         yOffset++;
     }
     bitmap.UnlockBits(bitmapdata);
     return frame;
 }