public ActionDefinition(ActionLibrary parent, string name, int id)
 {
     Library = parent;
     GameMakerVersion = 520;
     Name = name;
     ActionID = id;
     System.IO.MemoryStream ms = new System.IO.MemoryStream();
     Properties.Resources.DefaultAction.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
     OriginalImage = ms.ToArray();
     ms.Close();
     Image = new System.Drawing.Bitmap(24, 24, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
     System.Drawing.Graphics.FromImage(Image).DrawImage(Properties.Resources.DefaultAction, new System.Drawing.Rectangle(0, 0, 24, 24), new System.Drawing.Rectangle(0, 0, 24, 24), System.Drawing.GraphicsUnit.Pixel);
     (Image as System.Drawing.Bitmap).MakeTransparent(Properties.Resources.DefaultAction.GetPixel(0, Properties.Resources.DefaultAction.Height - 1));
     Hidden = false;
     Advanced = false;
     RegisteredOnly = false;
     Description = string.Empty;
     ListText = string.Empty;
     HintText = string.Empty;
     Kind = ActionKind.Normal;
     InterfaceKind = ActionInferfaceKind.Normal;
     IsQuestion = false;
     ShowApplyTo = true;
     ShowRelative = true;
     ArgumentCount = 0;
     Arguments = new ActionArgument[8];
     for (int i = 0; i < 8; i++) Arguments[i] = new ActionArgument();
     ExecutionType = ActionExecutionType.None;
     FunctionName = string.Empty;
     Code = string.Empty;
 }
예제 #2
0
 public ActionDefinition(ActionLibrary parent, string name, int id)
 {
     Library          = parent;
     GameMakerVersion = 520;
     Name             = name;
     ActionID         = id;
     System.IO.MemoryStream ms = new System.IO.MemoryStream();
     Properties.Resources.DefaultAction.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
     OriginalImage = ms.ToArray();
     ms.Close();
     Image = new System.Drawing.Bitmap(24, 24, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
     System.Drawing.Graphics.FromImage(Image).DrawImage(Properties.Resources.DefaultAction, new System.Drawing.Rectangle(0, 0, 24, 24), new System.Drawing.Rectangle(0, 0, 24, 24), System.Drawing.GraphicsUnit.Pixel);
     (Image as System.Drawing.Bitmap).MakeTransparent(Properties.Resources.DefaultAction.GetPixel(0, Properties.Resources.DefaultAction.Height - 1));
     Hidden         = false;
     Advanced       = false;
     RegisteredOnly = false;
     Description    = string.Empty;
     ListText       = string.Empty;
     HintText       = string.Empty;
     Kind           = ActionKind.Normal;
     InterfaceKind  = ActionInferfaceKind.Normal;
     IsQuestion     = false;
     ShowApplyTo    = true;
     ShowRelative   = true;
     ArgumentCount  = 0;
     Arguments      = new ActionArgument[8];
     for (int i = 0; i < 8; i++)
     {
         Arguments[i] = new ActionArgument();
     }
     ExecutionType = ActionExecutionType.None;
     FunctionName  = string.Empty;
     Code          = string.Empty;
 }
예제 #3
0
 public void Save(System.IO.Stream s)
 {
     System.IO.BinaryWriter bw = new System.IO.BinaryWriter(s, Encoding.ASCII);
     bw.Write(GameMakerVersion);
     bw.Write(TabCaption.Length); bw.Write(TabCaption.ToCharArray());
     bw.Write(1000);//LibraryID);
     bw.Write(Author.Length); bw.Write(Author.ToCharArray());
     bw.Write(Version);
     bw.Write(LastChanged.Subtract(new DateTime(1899, 12, 30)).TotalDays);
     bw.Write(Info.Length); bw.Write(Info.ToCharArray());
     bw.Write(InitializationCode.Length); bw.Write(InitializationCode.ToCharArray());
     bw.Write(AdvancedModeOnly ? 1 : 0);
     bw.Write(ActionNumberIncremental);
     bw.Write(Actions.Count);
     foreach (ActionDefinition a in Actions)
     {
         bw.Write(a.GameMakerVersion);
         bw.Write(a.Name.Length); bw.Write(a.Name.ToCharArray());
         bw.Write(a.ActionID);
         System.IO.MemoryStream ms = new System.IO.MemoryStream();
         System.Drawing.Bitmap  b  = new System.Drawing.Bitmap(a.Image.Width, a.Image.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
         System.Drawing.Graphics.FromImage(b).DrawImage(a.Image, 0, 0);
         b.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
         bw.Write((int)ms.Length);
         bw.Write(ms.ToArray());
         ms.Close();
         bw.Write(a.Hidden ? 1 : 0);
         bw.Write(a.Advanced ? 1 : 0);
         if (a.GameMakerVersion != 500)
         {
             bw.Write(a.RegisteredOnly ? 1 : 0);
         }
         bw.Write(a.Description.Length); bw.Write(a.Description.ToCharArray());
         bw.Write(a.ListText.Length); bw.Write(a.ListText.ToCharArray());
         bw.Write(a.HintText.Length); bw.Write(a.HintText.ToCharArray());
         bw.Write((int)a.Kind);
         bw.Write((int)a.InterfaceKind);
         bw.Write(a.IsQuestion ? 1 : 0);
         bw.Write(a.ShowApplyTo ? 1 : 0);
         bw.Write(a.ShowRelative ? 1 : 0);
         bw.Write(a.ArgumentCount);
         bw.Write(8);
         for (int i = 0; i < 8; i++)
         {
             ActionArgument arg = i < a.ArgumentCount ? a.Arguments[i] : new ActionArgument();
             bw.Write(arg.Caption.Length); bw.Write(arg.Caption.ToCharArray());
             bw.Write((int)arg.Type);
             bw.Write(arg.DefaultValue.Length); bw.Write(arg.DefaultValue.ToCharArray());
             bw.Write(arg.Menu.Length); bw.Write(arg.Menu.ToCharArray());
         }
         bw.Write((int)a.ExecutionType);
         bw.Write(a.FunctionName.Length); bw.Write(a.FunctionName.ToCharArray());
         bw.Write(a.Code.Length); bw.Write(a.Code.ToCharArray());
     }
     s.Flush();
 }