Exemplo n.º 1
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();
 }
Exemplo n.º 2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Name.GetHashCode();
         hashCode = (hashCode * 397) ^ Endpoint.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)State;
         hashCode = (hashCode * 397) ^ Incarnation;
         hashCode = (hashCode * 397) ^ LastChanged.GetHashCode();
         hashCode = (hashCode * 397) ^ (Metadata != null ? Metadata.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 3
0
        public ConfigNode ToConfigNode()
        {
            var node = new ConfigNode(escapeIdsSpaces(FileUrl));

            if (SkipImage)
            {
                node.AddValue("SkipImage", true.ToString());
            }
            else
            {
                node.AddValue("Key", CacheKey);
                //node.AddValue("Url", el.Value.Url);
                node.AddValue("Size", FileSize.ToString());
                node.AddValue("Date", LastChanged.ToString());
            }
            return(node);
        }
Exemplo n.º 4
0
 public bool Equals(MemberInfo other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(string.Equals(Name, other.Name) &&
            Equals(Endpoint, other.Endpoint) &&
            State == other.State &&
            Incarnation == other.Incarnation &&
            LastChanged.Equals(other.LastChanged) &&
            Equals(Metadata, other.Metadata));
 }
Exemplo n.º 5
0
 internal override ModelBase Serialize()
 {
     return(new GMMainOptionsModel
     {
         id = Id,
         name = "Main",
         option_gameguid = GameGuid.ToString("D"),
         option_game_speed = GameSpeed,
         option_mips_for_3d_textures = UseMipsFor3DTextures,
         option_draw_colour = DrawColor,
         option_steam_app_id = SteamAppId,
         option_allow_game_statistics = AllowGameStatistics,
         option_sci_usesci = UseSci,
         option_author = Author,
         option_lastchanged = LastChanged.ToString("dd MMMM YYYY HH:mm:ss"),
         graphics_options = Graphics.Serialize(),
         audio_options = Audio.Serialize(),
         option_spine_licence = AcceptedSpineLicence
     });
 }
Exemplo n.º 6
0
 public bool isCacheValid(UrlDir.UrlFile file)
 {
     if ((file.fileTime - LastChanged).TotalMinutes > 1)
     {
         ("Cache miss: " + FileUrl + "; Date [" + file.fileTime.ToString() + "(aka " + file.fileTime.Ticks + ") vs " + LastChanged.ToString() + " (aka " + LastChanged.Ticks + "]").Log();
     }
     else if (new System.IO.FileInfo(file.fullPath).Length != FileSize)
     {
         ("Cache miss (size): " + FileUrl).Log();
     }
     else
     {
         return(true);
     }
     return(false);
 }