public object Clone()
        {
            CacheServerConfigSetting config = new CacheServerConfigSetting();

            config.Name           = Name != null ? (string)Name.Clone() : null;
            config.cacheType      = this.cacheType;
            config.InProc         = InProc;
            config.Alias          = Alias;
            config.LastModified   = LastModified != null ? (string)LastModified.Clone() : null;
            config.Log            = Log != null ? (Alachisoft.NCache.Config.Dom.Log)Log.Clone() : null;
            config.PerfCounters   = PerfCounters != null ? (Alachisoft.NCache.Config.Dom.PerfCounters)PerfCounters.Clone() : null;
            config.autoBalancing  = this.autoBalancing != null ? (Alachisoft.NCache.Config.Dom.AutoLoadBalancing) this.autoBalancing.Clone() : null;
            config.Cleanup        = Cleanup != null ? (Alachisoft.NCache.Config.Dom.Cleanup)Cleanup.Clone() : null;
            config.Storage        = Storage != null ? (Alachisoft.NCache.Config.Dom.Storage)Storage.Clone() : null;
            config.EvictionPolicy = EvictionPolicy != null ? (Alachisoft.NCache.Config.Dom.EvictionPolicy)EvictionPolicy.Clone() : null;
            config.QueryIndices   = QueryIndices != null ? (Alachisoft.NCache.Config.Dom.QueryIndex)QueryIndices.Clone() : null;
            config.cacheTopology  = this.cacheTopology;

            return(config);
        }
        public ViewableDocument(JsonDocument inner)
        {
            this.inner = inner;

            Id           = inner.Metadata.IfPresent <string>("@id");
            LastModified = inner.LastModified ?? DateTime.MinValue;
            if (LastModified.Kind == DateTimeKind.Utc)
            {
                LastModified = LastModified.ToLocalTime();
            }
            ClrType        = inner.Metadata.IfPresent <string>(Constants.RavenClrType);
            CollectionType = DetermineCollectionType(inner.Metadata);

            disposable = Observable.FromEventPattern <EventHandler, EventArgs>(e => DocumentSize.Current.SizeChanged += e, e => DocumentSize.Current.SizeChanged -= e)
                         .Throttle(TimeSpan.FromSeconds(0.5))
                         .Subscribe(_ => CalculateData());

            CalculateData();
            ToolTipText = ShortViewOfJson.GetContentDataWithMargin(inner.DataAsJson, 10);
        }
Example #3
0
        public async Task PreconditionIfRangeLastModifiedIgnoreTest()
        {
            // Arrange
            Client.DefaultRequestHeaders.Add("Range", "bytes=1-1");
            Client.DefaultRequestHeaders.Add("If-Range", HeaderUtilities.FormatDate(LastModified.AddSeconds(-1)));

            // Act
            HttpResponseMessage response = await Client.GetAsync("/file/physical/true/true");

            response.EnsureSuccessStatusCode();

            string responseString = await response.Content.ReadAsStringAsync();

            // Assert
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.Equal("0123456789abcdefghijklmnopgrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWXYZ", responseString);
            Assert.Equal("bytes", response.Headers.AcceptRanges.ToString());
            Assert.Equal(EntityTag, response.Headers.ETag);
            Assert.Null(response.Content.Headers.ContentRange);
        }
Example #4
0
 /// <summary>
 /// This was moved into its own function that isn't virtual so that it could
 /// be called inside the object's constructor.
 /// </summary>
 /// <returns>The Object's hash code.</returns>
 private int CalculateHashCode()
 {
     unchecked
     {
         var result = (Bucket != null ? Bucket.GetHashCode() : 0);
         result = (result * 397) ^ (Key != null ? Key.GetHashCode() : 0);
         result = (result * 397) ^ (Value != null ? Value.GetHashCode() : 0);
         result = (result * 397) ^ (ContentType != null ? ContentType.GetHashCode() : 0);
         result = (result * 397) ^ (ContentEncoding != null ? ContentEncoding.GetHashCode() : 0);
         result = (result * 397) ^ (CharSet != null ? CharSet.GetHashCode() : 0);
         result = (result * 397) ^ (VectorClock != null ? VectorClock.GetHashCode() : 0);
         result = (result * 397) ^ (UserMetaData != null ? UserMetaData.GetHashCode() : 0);
         result = (result * 397) ^ (BinIndexes != null ? BinIndexes.GetHashCode() : 0);
         result = (result * 397) ^ (IntIndexes != null ? IntIndexes.GetHashCode() : 0);
         result = (result * 397) ^ LastModified.GetHashCode();
         result = (result * 397) ^ LastModifiedUsec.GetHashCode();
         result = (result * 397) ^ (Links != null ? Links.GetHashCode() : 0);
         result = (result * 397) ^ (_vtags != null ? _vtags.GetHashCode() : 0);
         return(result);
     }
 }
Example #5
0
        /// <summary>
        /// Set despawn times because .NET doesn't support Unix timestamp deserialization to <seealso cref="DateTime"/> class by default.
        /// </summary>
        public void SetDespawnTime()
        {
            DespawnTime = DisappearTime
                          .FromUnix()
                          .ConvertTimeFromCoordinates(Latitude, Longitude);

            SecondsLeft = DespawnTime
                          .Subtract(DateTime.UtcNow.ConvertTimeFromCoordinates(Latitude, Longitude));

            FirstSeenTime = FirstSeen
                            .FromUnix()
                            .ConvertTimeFromCoordinates(Latitude, Longitude);

            LastModifiedTime = LastModified
                               .FromUnix()
                               .ConvertTimeFromCoordinates(Latitude, Longitude);

            UpdatedTime = Updated
                          .FromUnix()
                          .ConvertTimeFromCoordinates(Latitude, Longitude);
        }
        public async Task PreconditionIfRangeLastModifiedLessTest()
        {
            // Arrange
            Client.DefaultRequestHeaders.Add("Range", "bytes=1-1");
            Client.DefaultRequestHeaders.Add("If-Range", HeaderUtilities.FormatDate(LastModified.AddSeconds(1)));

            // Act
            HttpResponseMessage response = await Client.GetAsync("/file/physical/true/true");

            response.EnsureSuccessStatusCode();

            string responseString = await response.Content.ReadAsStringAsync();

            // Assert
            // Assert
            Assert.Equal(HttpStatusCode.PartialContent, response.StatusCode);
            Assert.Equal("1", responseString);
            Assert.Equal("bytes", response.Headers.AcceptRanges.ToString());
            Assert.Equal(EntityTag, response.Headers.ETag);
            Assert.NotNull(response.Content.Headers.ContentRange);
            Assert.Equal("bytes 1-1/62", response.Content.Headers.ContentRange.ToString());
        }
Example #7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Host.Length != 0)
            {
                hash ^= Host.GetHashCode();
            }
            if (FilePath.Length != 0)
            {
                hash ^= FilePath.GetHashCode();
            }
            if (LastModified != 0L)
            {
                hash ^= LastModified.GetHashCode();
            }
            if (Bytes != 0L)
            {
                hash ^= Bytes.GetHashCode();
            }
            hash ^= lines_.GetHashCode();
            return(hash);
        }
Example #8
0
        /// <summary>
        ///     Translate the json document to a <see cref = "JObject" />
        /// </summary>
        /// <returns></returns>
        public JObject ToJson()
        {
            if (Projection != null)
            {
                return(Projection);
            }

            var doc      = new JObject(DataAsJson);        //clone the document
            var metadata = new JObject(Metadata);          // clone the metadata

            metadata["Last-Modified"] = JToken.FromObject(LastModified.ToString("r"));
            var etagProp = metadata.Property("@etag");

            if (etagProp == null)
            {
                etagProp = new JProperty("@etag");
                metadata.Add(etagProp);
            }
            etagProp.Value = new JValue(Etag.ToString());
            doc.Add("@metadata", metadata);
            metadata["Non-Authoritive-Information"] = JToken.FromObject(NonAuthoritiveInformation);
            return(doc);
        }
Example #9
0
        public virtual void dump(StringBuilder strBuilder)
        {
            strBuilder.AppendLine(Id.ToString());
            strBuilder.AppendLine(Naziv != null ? Naziv : NULL);
            strBuilder.AppendLine(Gimnastika.ToString());
            strBuilder.AppendLine(Datum.ToString());
            strBuilder.AppendLine(Mesto != null ? Mesto : NULL);
            strBuilder.AppendLine(TipTakmicenja.ToString());
            strBuilder.AppendLine(PrvoKolo != null ? PrvoKolo.Id.ToString() : NULL);
            strBuilder.AppendLine(DrugoKolo != null ? DrugoKolo.Id.ToString() : NULL);
            strBuilder.AppendLine(TreceKolo != null ? TreceKolo.Id.ToString() : NULL);
            strBuilder.AppendLine(CetvrtoKolo != null ? CetvrtoKolo.Id.ToString() : NULL);

            strBuilder.AppendLine(VrhovniSudija != null ? VrhovniSudija.Id.ToString() : NULL);

            strBuilder.AppendLine(BrojEOcena.ToString());
            strBuilder.AppendLine(BrojDecimalaD.ToString());
            strBuilder.AppendLine(BrojDecimalaE1.ToString());
            strBuilder.AppendLine(BrojDecimalaE.ToString());
            strBuilder.AppendLine(BrojDecimalaPen.ToString());
            strBuilder.AppendLine(BrojDecimalaTotal.ToString());
            strBuilder.AppendLine(ZavrsenoTak1.ToString());
            strBuilder.AppendLine(ZrebZaFinalePoSpravama != null ? ZrebZaFinalePoSpravama : NULL);
            strBuilder.AppendLine(LastModified.ToString());

            strBuilder.AppendLine(TakmicenjeDescriptions.Count.ToString());
            foreach (RezultatskoTakmicenjeDescription d in TakmicenjeDescriptions)
            {
                d.dump(strBuilder);
            }

            strBuilder.AppendLine(Kategorije.Count.ToString());
            foreach (TakmicarskaKategorija k in Kategorije)
            {
                k.dump(strBuilder);
            }
        }
Example #10
0
        public void UpdateDocumentFromJsonDocument()
        {
            Id       = document.Key;
            JsonData = PrepareRawJsonString(document.DataAsJson);

            IsProjection = string.IsNullOrEmpty(Id) && (document.Metadata == null || document.Metadata.Any() == false);
            if (IsProjection)
            {
                return;
            }

            if (document.Metadata != null)
            {
                foreach (var property in document.Metadata.ToList())
                {
                    if (property.Key.StartsWith("@"))
                    {
                        document.Metadata.Remove(property.Key);
                    }
                }
            }

            JsonMetadata = PrepareRawJsonString(document.Metadata);

            metadata = ParseJsonToDictionary(document.Metadata);

            LastModified = document.LastModified ?? DateTime.MinValue;
            if (LastModified.Kind == DateTimeKind.Utc)
            {
                LastModified = LastModified.ToLocalTime();
            }
            CollectionType            = DocumentViewModel.DetermineCollectionType(document.Metadata);
            ClrType                   = metadata.IfPresent <string>(Constants.RavenClrType);
            Etag                      = document.Etag.ToString();
            NonAuthoritiveInformation = document.NonAuthoritiveInformation ?? false;
        }
Example #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                using (XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Encoding.UTF8))
                {
                    Nullable <DateTime> ims = IfModifiedSince;

                    if (ims.HasValue)
                    {
                        if (ims.Value.ToUniversalTime() >= LastModified)
                        {
                            Response.StatusCode = 304;
                            return;
                        }
                    }

                    Response.Clear();
                    Response.Cache.SetLastModified(LastModified.ToLocalTime());
                    Response.Cache.SetCacheability(HttpCacheability.Private);
                    Response.ContentType = XmlContentType;
                    Response.AddHeader("Modified", LastModified.ToString("r"));
                    WriteXml(writer);
                    writer.Close();
                }

                Response.End();
            }
            catch (ThreadAbortException)
            {
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (SearchString != null)
         {
             hashCode = hashCode * 59 + SearchString.GetHashCode();
         }
         if (SortingColumn != null)
         {
             hashCode = hashCode * 59 + SortingColumn.GetHashCode();
         }
         if (TagId != null)
         {
             hashCode = hashCode * 59 + TagId.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (AssetNumber != null)
         {
             hashCode = hashCode * 59 + AssetNumber.GetHashCode();
         }
         if (Latitude != null)
         {
             hashCode = hashCode * 59 + Latitude.GetHashCode();
         }
         if (Longitude != null)
         {
             hashCode = hashCode * 59 + Longitude.GetHashCode();
         }
         if (AssetClass != null)
         {
             hashCode = hashCode * 59 + AssetClass.GetHashCode();
         }
         if (LastModified != null)
         {
             hashCode = hashCode * 59 + LastModified.GetHashCode();
         }
         if (Created != null)
         {
             hashCode = hashCode * 59 + Created.GetHashCode();
         }
         if (Creator != null)
         {
             hashCode = hashCode * 59 + Creator.GetHashCode();
         }
         if (SubNumber != null)
         {
             hashCode = hashCode * 59 + SubNumber.GetHashCode();
         }
         if (CompanyCode != null)
         {
             hashCode = hashCode * 59 + CompanyCode.GetHashCode();
         }
         if (InventoryNumber != null)
         {
             hashCode = hashCode * 59 + InventoryNumber.GetHashCode();
         }
         if (SerialNumber != null)
         {
             hashCode = hashCode * 59 + SerialNumber.GetHashCode();
         }
         if (Location != null)
         {
             hashCode = hashCode * 59 + Location.GetHashCode();
         }
         if (Room != null)
         {
             hashCode = hashCode * 59 + Room.GetHashCode();
         }
         if (CostCenter != null)
         {
             hashCode = hashCode * 59 + CostCenter.GetHashCode();
         }
         if (CapitalisationDate != null)
         {
             hashCode = hashCode * 59 + CapitalisationDate.GetHashCode();
         }
         if (LastInventoryDate != null)
         {
             hashCode = hashCode * 59 + LastInventoryDate.GetHashCode();
         }
         if (AcquisitionValue != null)
         {
             hashCode = hashCode * 59 + AcquisitionValue.GetHashCode();
         }
         if (AssetSuperNumber != null)
         {
             hashCode = hashCode * 59 + AssetSuperNumber.GetHashCode();
         }
         if (Vendor != null)
         {
             hashCode = hashCode * 59 + Vendor.GetHashCode();
         }
         if (TypeName != null)
         {
             hashCode = hashCode * 59 + TypeName.GetHashCode();
         }
         if (Plant != null)
         {
             hashCode = hashCode * 59 + Plant.GetHashCode();
         }
         if (Quantity != null)
         {
             hashCode = hashCode * 59 + Quantity.GetHashCode();
         }
         if (Unit != null)
         {
             hashCode = hashCode * 59 + Unit.GetHashCode();
         }
         if (Untaggable != null)
         {
             hashCode = hashCode * 59 + Untaggable.GetHashCode();
         }
         if (Untagged != null)
         {
             hashCode = hashCode * 59 + Untagged.GetHashCode();
         }
         if (Page != null)
         {
             hashCode = hashCode * 59 + Page.GetHashCode();
         }
         if (PageSize != null)
         {
             hashCode = hashCode * 59 + PageSize.GetHashCode();
         }
         return(hashCode);
     }
 }
        /// <summary>
        /// Returns true if AssetFullTextAndPropertySearch instances are equal
        /// </summary>
        /// <param name="other">Instance of AssetFullTextAndPropertySearch to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AssetFullTextAndPropertySearch other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     SearchString == other.SearchString ||
                     SearchString != null &&
                     SearchString.Equals(other.SearchString)
                     ) &&
                 (
                     SortingColumn == other.SortingColumn ||
                     SortingColumn != null &&
                     SortingColumn.Equals(other.SortingColumn)
                 ) &&
                 (
                     TagId == other.TagId ||
                     TagId != null &&
                     TagId.Equals(other.TagId)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     AssetNumber == other.AssetNumber ||
                     AssetNumber != null &&
                     AssetNumber.Equals(other.AssetNumber)
                 ) &&
                 (
                     Latitude == other.Latitude ||
                     Latitude != null &&
                     Latitude.Equals(other.Latitude)
                 ) &&
                 (
                     Longitude == other.Longitude ||
                     Longitude != null &&
                     Longitude.Equals(other.Longitude)
                 ) &&
                 (
                     AssetClass == other.AssetClass ||
                     AssetClass != null &&
                     AssetClass.Equals(other.AssetClass)
                 ) &&
                 (
                     LastModified == other.LastModified ||
                     LastModified != null &&
                     LastModified.Equals(other.LastModified)
                 ) &&
                 (
                     Created == other.Created ||
                     Created != null &&
                     Created.Equals(other.Created)
                 ) &&
                 (
                     Creator == other.Creator ||
                     Creator != null &&
                     Creator.Equals(other.Creator)
                 ) &&
                 (
                     SubNumber == other.SubNumber ||
                     SubNumber != null &&
                     SubNumber.Equals(other.SubNumber)
                 ) &&
                 (
                     CompanyCode == other.CompanyCode ||
                     CompanyCode != null &&
                     CompanyCode.Equals(other.CompanyCode)
                 ) &&
                 (
                     InventoryNumber == other.InventoryNumber ||
                     InventoryNumber != null &&
                     InventoryNumber.Equals(other.InventoryNumber)
                 ) &&
                 (
                     SerialNumber == other.SerialNumber ||
                     SerialNumber != null &&
                     SerialNumber.Equals(other.SerialNumber)
                 ) &&
                 (
                     Location == other.Location ||
                     Location != null &&
                     Location.Equals(other.Location)
                 ) &&
                 (
                     Room == other.Room ||
                     Room != null &&
                     Room.Equals(other.Room)
                 ) &&
                 (
                     CostCenter == other.CostCenter ||
                     CostCenter != null &&
                     CostCenter.Equals(other.CostCenter)
                 ) &&
                 (
                     CapitalisationDate == other.CapitalisationDate ||
                     CapitalisationDate != null &&
                     CapitalisationDate.Equals(other.CapitalisationDate)
                 ) &&
                 (
                     LastInventoryDate == other.LastInventoryDate ||
                     LastInventoryDate != null &&
                     LastInventoryDate.Equals(other.LastInventoryDate)
                 ) &&
                 (
                     AcquisitionValue == other.AcquisitionValue ||
                     AcquisitionValue != null &&
                     AcquisitionValue.Equals(other.AcquisitionValue)
                 ) &&
                 (
                     AssetSuperNumber == other.AssetSuperNumber ||
                     AssetSuperNumber != null &&
                     AssetSuperNumber.Equals(other.AssetSuperNumber)
                 ) &&
                 (
                     Vendor == other.Vendor ||
                     Vendor != null &&
                     Vendor.Equals(other.Vendor)
                 ) &&
                 (
                     TypeName == other.TypeName ||
                     TypeName != null &&
                     TypeName.Equals(other.TypeName)
                 ) &&
                 (
                     Plant == other.Plant ||
                     Plant != null &&
                     Plant.Equals(other.Plant)
                 ) &&
                 (
                     Quantity == other.Quantity ||
                     Quantity != null &&
                     Quantity.Equals(other.Quantity)
                 ) &&
                 (
                     Unit == other.Unit ||
                     Unit != null &&
                     Unit.Equals(other.Unit)
                 ) &&
                 (
                     Untaggable == other.Untaggable ||
                     Untaggable != null &&
                     Untaggable.Equals(other.Untaggable)
                 ) &&
                 (
                     Untagged == other.Untagged ||
                     Untagged != null &&
                     Untagged.Equals(other.Untagged)
                 ) &&
                 (
                     Page == other.Page ||
                     Page != null &&
                     Page.Equals(other.Page)
                 ) &&
                 (
                     PageSize == other.PageSize ||
                     PageSize != null &&
                     PageSize.Equals(other.PageSize)
                 ));
        }
Example #14
0
        public override int GetHashCode()
        {
            var hashCode =
                Created.GetHashCode() ^
                LastModified.GetHashCode() ^
                Size.GetHashCode() ^
                IsFavorite.GetHashCode() ^
                CommentsCount.GetHashCode() ^
                CommentsUnread.GetHashCode() ^
                ShareTypes.GetHashCode() ^
                HasPreview.GetHashCode();

            if (ContentType != null)
            {
                hashCode ^= ContentType.GetHashCode();
            }

            if (Name != null)
            {
                hashCode ^= Name.GetHashCode();
            }

            if (Path != null)
            {
                hashCode ^= Path.GetHashCode();
            }

            if (CommentsHref != null)
            {
                hashCode ^= CommentsHref.GetHashCode();
            }

            // Is null on directories
            if (ETag != null)
            {
                hashCode ^= ETag.GetHashCode();
            }

            if (!string.IsNullOrEmpty(Id))
            {
                hashCode ^= Id.GetHashCode();
            }

            if (!string.IsNullOrEmpty(FileId))
            {
                hashCode ^= FileId.GetHashCode();
            }

            if (!string.IsNullOrEmpty(OwnderId))
            {
                hashCode ^= OwnderId.GetHashCode();
            }

            if (!string.IsNullOrEmpty(OwnerDisplayName))
            {
                hashCode ^= OwnerDisplayName.GetHashCode();
            }

            if (!string.IsNullOrEmpty(Checksums))
            {
                hashCode ^= Checksums.GetHashCode();
            }

            return(hashCode);
        }
Example #15
0
        /// <summary>
        /// Returns true if AssetResource instances are equal
        /// </summary>
        /// <param name="other">Instance of AssetResource to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AssetResource other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AssetNumber == other.AssetNumber ||
                     AssetNumber != null &&
                     AssetNumber.Equals(other.AssetNumber)
                     ) &&
                 (
                     SubNumber == other.SubNumber ||
                     SubNumber != null &&
                     SubNumber.Equals(other.SubNumber)
                 ) &&
                 (
                     CompanyCode == other.CompanyCode ||
                     CompanyCode != null &&
                     CompanyCode.Equals(other.CompanyCode)
                 ) &&
                 (
                     TagId == other.TagId ||
                     TagId != null &&
                     TagId.Equals(other.TagId)
                 ) &&
                 (
                     SecondTagId == other.SecondTagId ||
                     SecondTagId != null &&
                     SecondTagId.Equals(other.SecondTagId)
                 ) &&
                 (
                     IsUntaggable == other.IsUntaggable ||
                     IsUntaggable != null &&
                     IsUntaggable.Equals(other.IsUntaggable)
                 ) &&
                 (
                     LastModified == other.LastModified ||
                     LastModified != null &&
                     LastModified.Equals(other.LastModified)
                 ) &&
                 (
                     Created == other.Created ||
                     Created != null &&
                     Created.Equals(other.Created)
                 ) &&
                 (
                     Creator == other.Creator ||
                     Creator != null &&
                     Creator.Equals(other.Creator)
                 ) &&
                 (
                     InventoryNumber == other.InventoryNumber ||
                     InventoryNumber != null &&
                     InventoryNumber.Equals(other.InventoryNumber)
                 ) &&
                 (
                     SerialNumber == other.SerialNumber ||
                     SerialNumber != null &&
                     SerialNumber.Equals(other.SerialNumber)
                 ) &&
                 (
                     Location == other.Location ||
                     Location != null &&
                     Location.Equals(other.Location)
                 ) &&
                 (
                     Room == other.Room ||
                     Room != null &&
                     Room.Equals(other.Room)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     CostCenter == other.CostCenter ||
                     CostCenter != null &&
                     CostCenter.Equals(other.CostCenter)
                 ) &&
                 (
                     CapitalisationDate == other.CapitalisationDate ||
                     CapitalisationDate != null &&
                     CapitalisationDate.Equals(other.CapitalisationDate)
                 ) &&
                 (
                     LastInventoryDate == other.LastInventoryDate ||
                     LastInventoryDate != null &&
                     LastInventoryDate.Equals(other.LastInventoryDate)
                 ) &&
                 (
                     AcquisitionValue == other.AcquisitionValue ||
                     AcquisitionValue != null &&
                     AcquisitionValue.Equals(other.AcquisitionValue)
                 ) &&
                 (
                     AssetSuperNumber == other.AssetSuperNumber ||
                     AssetSuperNumber != null &&
                     AssetSuperNumber.Equals(other.AssetSuperNumber)
                 ) &&
                 (
                     Vendor == other.Vendor ||
                     Vendor != null &&
                     Vendor.Equals(other.Vendor)
                 ) &&
                 (
                     TypeName == other.TypeName ||
                     TypeName != null &&
                     TypeName.Equals(other.TypeName)
                 ) &&
                 (
                     Plant == other.Plant ||
                     Plant != null &&
                     Plant.Equals(other.Plant)
                 ) &&
                 (
                     AssetClass == other.AssetClass ||
                     AssetClass != null &&
                     AssetClass.Equals(other.AssetClass)
                 ) &&
                 (
                     Quantity == other.Quantity ||
                     Quantity != null &&
                     Quantity.Equals(other.Quantity)
                 ) &&
                 (
                     Unit == other.Unit ||
                     Unit != null &&
                     Unit.Equals(other.Unit)
                 ) &&
                 (
                     DeactivatedOn == other.DeactivatedOn ||
                     DeactivatedOn != null &&
                     DeactivatedOn.Equals(other.DeactivatedOn)
                 ) &&
                 (
                     IsDeactivated == other.IsDeactivated ||
                     IsDeactivated != null &&
                     IsDeactivated.Equals(other.IsDeactivated)
                 ) &&
                 (
                     CompanyCodeCurrency == other.CompanyCodeCurrency ||
                     CompanyCodeCurrency != null &&
                     CompanyCodeCurrency.Equals(other.CompanyCodeCurrency)
                 ) &&
                 (
                     Comment == other.Comment ||
                     Comment != null &&
                     Comment.Equals(other.Comment)
                 ) &&
                 (
                     ShareTags == other.ShareTags ||
                     ShareTags != null &&
                     ShareTags.Equals(other.ShareTags)
                 ));
        }
Example #16
0
        internal void Serialize(StringBuilder sb)
        {
            sb.Append(Name).Append(',');     // 0
            if (!LastIP.Equals(IPAddress.None))
            {
                sb.Append(LastIP);                                      // 1
            }
            sb.Append(',');

            sb.Append(Rank.FullName).Append(',');            // 2
            RankChangeDate.ToUnixTimeString(sb).Append(','); // 3

            sb.AppendEscaped(RankChangedBy).Append(',');     // 4

            switch (BanStatus)
            {
            case BanStatus.Banned:
                sb.Append('b');
                break;

            case BanStatus.IPBanExempt:
                sb.Append('x');
                break;
            }
            sb.Append(',');                                       // 5

            BanDate.ToUnixTimeString(sb).Append(',');             // 6
            sb.AppendEscaped(BannedBy).Append(',');               // 7
            UnbanDate.ToUnixTimeString(sb).Append(',');           // 8
            sb.AppendEscaped(UnbannedBy).Append(',');             // 9
            sb.AppendEscaped(BanReason).Append(',');              // 10
            sb.AppendEscaped(UnbanReason).Append(',');            // 11

            LastFailedLoginDate.ToUnixTimeString(sb).Append(','); // 12

            if (!LastFailedLoginIP.Equals(IPAddress.None))
            {
                sb.Append(LastFailedLoginIP);                // 13
            }
            sb.Append(',', 2);                               // skip 14

            FirstLoginDate.ToUnixTimeString(sb).Append(','); // 15
            LastLoginDate.ToUnixTimeString(sb).Append(',');  // 16

            Player pObject = PlayerObject;

            if (pObject != null)
            {
                (TotalTime.Add(TimeSinceLastLogin)).ToSecondsString(sb);     // 17
            }
            else
            {
                TotalTime.ToSecondsString(sb);   // 17
            }
            sb.Append(',');

            if (BlocksBuilt > 0)
            {
                sb.Digits(BlocksBuilt);                     // 18
            }
            sb.Append(',');

            if (BlocksDeleted > 0)
            {
                sb.Digits(BlocksDeleted);                       // 19
            }
            sb.Append(',');

            sb.Digits(TimesVisited).Append(',');     // 20


            if (MessagesWritten > 0)
            {
                sb.Digits(MessagesWritten); // 21
            }
            sb.Append(',', 3);              // 22-23 no longer in use

            if (PreviousRank != null)
            {
                sb.Append(PreviousRank.FullName);                          // 24
            }
            sb.Append(',');

            sb.AppendEscaped(RankChangeReason).Append(',');     // 25


            if (TimesKicked > 0)
            {
                sb.Digits(TimesKicked);                     // 26
            }
            sb.Append(',');

            if (TimesKickedOthers > 0)
            {
                sb.Digits(TimesKickedOthers);                           // 27
            }
            sb.Append(',');

            if (TimesBannedOthers > 0)
            {
                sb.Digits(TimesBannedOthers);                           // 28
            }
            sb.Append(',');


            sb.Digits(ID).Append(',');                  // 29

            sb.Digits((int)RankChangeType).Append(','); // 30


            LastKickDate.ToUnixTimeString(sb).Append(',');     // 31

            if (IsOnline)
            {
                DateTime.UtcNow.ToUnixTimeString(sb);              // 32
            }
            else
            {
                LastSeen.ToUnixTimeString(sb);
            }
            sb.Append(',');

            if (BlocksDrawn > 0)
            {
                sb.Append(BlocksDrawn);                     // 33
            }
            sb.Append(',');

            sb.AppendEscaped(LastKickBy).Append(',');     // 34
            sb.AppendEscaped(LastKickReason).Append(','); // 35

            BannedUntil.ToUnixTimeString(sb);             // 36

            if (IsFrozen)
            {
                sb.Append(',').Append('f').Append(',');     // 37
                sb.AppendEscaped(FrozenBy).Append(',');     // 38
                FrozenOn.ToUnixTimeString(sb).Append(',');  // 39
            }
            else
            {
                sb.Append(',', 4);   // 37-39
            }

            if (MutedUntil > DateTime.UtcNow)
            {
                MutedUntil.ToUnixTimeString(sb).Append(','); // 40
                sb.AppendEscaped(MutedBy).Append(',');       // 41
            }
            else
            {
                sb.Append(',', 2);   // 40-41
            }

            sb.AppendEscaped(Password).Append(',');     // 42

            if (IsOnline)
            {
                sb.Append('o');              // 43
            }
            sb.Append(',');

            if (BandwidthUseMode != BandwidthUseMode.Default)
            {
                sb.Append((byte)BandwidthUseMode);                                                  // 44
            }
            sb.Append(',');

            if (IsHidden)
            {
                sb.Append('h');              // 45
            }
            sb.Append(',');
            LastModified.ToUnixTimeString(sb);   // 46

            sb.Append(',');
            sb.AppendEscaped(DisplayedName);   // 47

            sb.Append(',');
            sb.Append((byte)AccountType);   // 48

            sb.Append(',');
            if (Email != null)
            {
                sb.AppendEscaped(Email);
            }
        }
Example #17
0
        public async Task PreconditionIfUnmodifiedSinceIfMatchFailTest()
        {
            // Arrange
            Client.DefaultRequestHeaders.Add("If-Match", EntityTag.ToString());
            Client.DefaultRequestHeaders.Add("If-Unmodified-Since", HeaderUtilities.FormatDate(LastModified.AddSeconds(-1)));

            // Act
            HttpResponseMessage response = await Client.GetAsync("/file/physical/true/true");

            string responseString = await response.Content.ReadAsStringAsync();

            // Assert
            Assert.Equal(HttpStatusCode.PreconditionFailed, response.StatusCode);
            Assert.Equal(string.Empty, responseString);
            Assert.NotEqual("bytes", response.Headers.AcceptRanges.ToString());
            Assert.Equal(EntityTag, response.Headers.ETag);
            Assert.Null(response.Content.Headers.ContentRange);
            Assert.Equal("attachment", response.Content.Headers.ContentDisposition.DispositionType);
        }
Example #18
0
 public override string ToString()
 {
     return(LastModified.ToString());
 }
 private bool Equals(IKnowledgeBaseEntry other)
 {
     return(KBID == other.KBID && Timestamp.Equals(other.Timestamp) && Context == other.Context && Product == other.Product && Rating_Yes == other.Rating_Yes && Rating_No == other.Rating_No &&
            Rating_Views == other.Rating_Views && LastModified.Equals(other.LastModified) && IsPrivate == other.IsPrivate && Status == other.Status && Priority == other.Priority &&
            Keywords == other.Keywords && Address == other.Address);
 }
Example #20
0
 public bool Equals(RegisteredContent other)
 {
     return(LastAccess.Equals(other.LastAccess) && LastModified.Equals(other.LastModified) &&
            Attributes == other.Attributes && Length == other.Length);
 }
Example #21
0
        public string GetPresetDataString(ZoneInfo zoneInfo)
        {
            string str = "";

            for (uint i = 0u; i < Waymarks.Length; ++i)
            {
                str += GetWaymarkID(i) + ": " + Waymarks[i].GetWaymarkDataString() + "\r\n";
            }
            str += "\r\nZone ID: " + ZoneID.ToString() + " (" + zoneInfo.GetZoneName(ZoneID) + ")\r\nLast Modified: " + LastModified.ToLocalTime().ToString("G");
            return(str);
        }
Example #22
0
        internal void OnLoad()
        {
            Mouse    = window.Mouse;
            Keyboard = window.Keyboard;

                        #if ANDROID
            Graphics = new OpenGLESApi();
                        #elif !USE_DX
            Graphics = new OpenGLApi();
                        #else
            Graphics = new Direct3D9Api(this);
                        #endif
            Graphics.MakeApiInfo();
            ErrorHandler.AdditionalInfo = Graphics.ApiInfo;

                        #if ANDROID
            Drawer2D = new CanvasDrawer2D(Graphics);
                        #else
            Drawer2D = new GdiPlusDrawer2D(Graphics);
                        #endif

            Entities = new EntityList(this);
            AcceptedUrls.Load();
            DeniedUrls.Load();
            ETags.Load();
            LastModified.Load();

            if (Options.GetBool(OptionsKey.SurvivalMode, false))
            {
                Mode = new SurvivalGameMode();
            }
            else
            {
                Mode = new CreativeGameMode();
            }
            Components.Add(Mode);

            Input           = new InputHandler(this);
            defaultIb       = Graphics.MakeDefaultIb();
            ParticleManager = new ParticleManager(); Components.Add(ParticleManager);
            TabList         = new TabList(); Components.Add(TabList);
            LoadOptions();
            LoadGuiOptions();
            Chat = new Chat(); Components.Add(Chat);

            WorldEvents.OnNewMap       += OnNewMapCore;
            WorldEvents.OnNewMapLoaded += OnNewMapLoadedCore;
            Events.TextureChanged      += TextureChangedCore;

            BlockInfo.Allocate(256);
            BlockInfo.Init();

            ModelCache = new ModelCache(this);
            ModelCache.InitCache();
            Downloader = new AsyncDownloader(Drawer2D); Components.Add(Downloader);
            Lighting   = new BasicLighting(); Components.Add(Lighting);

            Drawer2D.UseBitmappedChat = ClassicMode || !Options.GetBool(OptionsKey.UseChatFont, false);
            Drawer2D.BlackTextShadows = Options.GetBool(OptionsKey.BlackText, false);
            Graphics.Mipmaps          = Options.GetBool(OptionsKey.Mipmaps, false);

            TerrainAtlas1D.game = this;
            TerrainAtlas2D.game = this;
            Animations          = new Animations(); Components.Add(Animations);
            Inventory           = new Inventory(); Components.Add(Inventory);
            SurvInv             = new SurvivalInventory(); Components.Add(SurvInv);
            Inventory.Map       = new BlockID[BlockInfo.Count];

            RecipeList = Recipes.MakeRecipeList();

            BlockInfo.SetDefaultPerms();
            World       = new World(this);
            LocalPlayer = new LocalPlayer(this); Components.Add(LocalPlayer);
            Entities.List[EntityList.SelfID] = LocalPlayer;
            Width = window.Width; Height = window.Height;

            MapRenderer = new MapRenderer(this);
            string renType = Options.Get(OptionsKey.RenderType) ?? "normal";
            if (!SetRenderType(renType))
            {
                SetRenderType("normal");
            }

            if (IPAddress == null)
            {
                Server = new Singleplayer.SinglePlayerServer(this);
            }
            else
            {
                Server = new Network.NetworkProcessor(this);
            }
            Graphics.LostContextFunction = Server.Tick;

            Cameras.Add(new FirstPersonCamera(this));
            Cameras.Add(new ThirdPersonCamera(this, false));
            Cameras.Add(new ThirdPersonCamera(this, true));
            Camera = Cameras[0];
            UpdateProjection();

            Gui               = new GuiInterface(this); Components.Add(Gui);
            CommandList       = new CommandList(); Components.Add(CommandList);
            SelectionManager  = new SelectionManager(); Components.Add(SelectionManager);
            WeatherRenderer   = new WeatherRenderer(); Components.Add(WeatherRenderer);
            HeldBlockRenderer = new HeldBlockRenderer(); Components.Add(HeldBlockRenderer);

            Graphics.DepthTest = true;
            Graphics.DepthTestFunc(CompareFunc.LessEqual);
            //Graphics.DepthWrite = true;
            Graphics.AlphaBlendFunc(BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha);
            Graphics.AlphaTestFunc(CompareFunc.Greater, 0.5f);
            Culling           = new FrustumCulling();
            Picking           = new PickedPosRenderer(); Components.Add(Picking);
            AudioPlayer       = new AudioPlayer(); Components.Add(AudioPlayer);
            AxisLinesRenderer = new AxisLinesRenderer(); Components.Add(AxisLinesRenderer);
            SkyboxRenderer    = new SkyboxRenderer(); Components.Add(SkyboxRenderer);
            CelestialRenderer = new CelestialRenderer(); Components.Add(CelestialRenderer);

            PluginLoader.game = this;
            List <string> nonLoaded = PluginLoader.LoadAll();

            for (int i = 0; i < Components.Count; i++)
            {
                Components[i].Init(this);
            }
            ExtractInitialTexturePack();
            for (int i = 0; i < Components.Count; i++)
            {
                Components[i].Ready(this);
            }
            InitScheduledTasks();

            if (nonLoaded != null)
            {
                for (int i = 0; i < nonLoaded.Count; i++)
                {
                    Overlay warning = new PluginOverlay(this, nonLoaded[i]);
                    Gui.ShowOverlay(warning, false);
                }
            }

            window.LoadIcon();
            string connectString = "Connecting to " + IPAddress + ":" + Port + "..";
            if (Graphics.WarnIfNecessary(Chat))
            {
                //MapBordersRenderer.UseLegacyMode(true);
                EnvRenderer.UseLegacyMode(true);
            }
            Gui.SetNewScreen(new LoadingMapScreen(this, connectString, ""));
            Server.Connect(IPAddress, Port);
        }
Example #23
0
        public async Task PreconditionIfModifiedSinceIfNoneMatchSuccessTest()
        {
            // Arrange
            var tmpNewEntityTag = new EntityTagHeaderValue("\"xyzzy\"", true);

            Client.DefaultRequestHeaders.Add("If-None-Match", tmpNewEntityTag.ToString());
            Client.DefaultRequestHeaders.Add("If-Modified-Since", HeaderUtilities.FormatDate(LastModified.AddSeconds(1)));

            // Act
            HttpResponseMessage response = await Client.GetAsync("/file/physical/true/true");

            response.EnsureSuccessStatusCode();

            string responseString = await response.Content.ReadAsStringAsync();

            // Assert
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.Equal("0123456789abcdefghijklmnopgrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWXYZ", responseString);
            Assert.Equal("bytes", response.Headers.AcceptRanges.ToString());
            Assert.Equal(EntityTag, response.Headers.ETag);
            Assert.Null(response.Content.Headers.ContentRange);
            Assert.Equal("attachment", response.Content.Headers.ContentDisposition.DispositionType);
        }
        /// <summary>
        /// Returns true if InventoryOrderAsset instances are equal
        /// </summary>
        /// <param name="other">Instance of InventoryOrderAsset to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(InventoryOrderAsset other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     InventoryOrderId == other.InventoryOrderId ||
                     InventoryOrderId != null &&
                     InventoryOrderId.Equals(other.InventoryOrderId)
                     ) &&
                 (
                     Checked == other.Checked ||
                     Checked != null &&
                     Checked.Equals(other.Checked)
                 ) &&
                 (
                     LastModified == other.LastModified ||
                     LastModified != null &&
                     LastModified.Equals(other.LastModified)
                 ) &&
                 (
                     Created == other.Created ||
                     Created != null &&
                     Created.Equals(other.Created)
                 ) &&
                 (
                     ChangedBy == other.ChangedBy ||
                     ChangedBy != null &&
                     ChangedBy.Equals(other.ChangedBy)
                 ) &&
                 (
                     CommentOther == other.CommentOther ||
                     CommentOther != null &&
                     CommentOther.Equals(other.CommentOther)
                 ) &&
                 (
                     CommentCostCenter == other.CommentCostCenter ||
                     CommentCostCenter != null &&
                     CommentCostCenter.Equals(other.CommentCostCenter)
                 ) &&
                 (
                     CommentPlant == other.CommentPlant ||
                     CommentPlant != null &&
                     CommentPlant.Equals(other.CommentPlant)
                 ) &&
                 (
                     CommentLocation == other.CommentLocation ||
                     CommentLocation != null &&
                     CommentLocation.Equals(other.CommentLocation)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ) &&
                 (
                     Asset == other.Asset ||
                     Asset != null &&
                     Asset.Equals(other.Asset)
                 ) &&
                 (
                     AssetNumber == other.AssetNumber ||
                     AssetNumber != null &&
                     AssetNumber.Equals(other.AssetNumber)
                 ) &&
                 (
                     SubNumber == other.SubNumber ||
                     SubNumber != null &&
                     SubNumber.Equals(other.SubNumber)
                 ) &&
                 (
                     CompanyCode == other.CompanyCode ||
                     CompanyCode != null &&
                     CompanyCode.Equals(other.CompanyCode)
                 ));
        }
Example #25
0
        public async Task PreconditionIfModifiedSinceSuccessPutTest()
        {
            // Arrange
            Client.DefaultRequestHeaders.Add("If-Modified-Since", HeaderUtilities.FormatDate(LastModified.AddSeconds(-1)));

            // Act
            HttpResponseMessage response = await Client.PutAsync("/file/file", new StringContent(string.Empty));

            response.EnsureSuccessStatusCode();

            string responseString = await response.Content.ReadAsStringAsync();

            // Assert
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.Equal("0123456789abcdefghijklmnopgrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWXYZ", responseString);
            Assert.Equal("bytes", response.Headers.AcceptRanges.ToString());
            Assert.Equal(EntityTag, response.Headers.ETag);
            Assert.Null(response.Content.Headers.ContentRange);
            Assert.Equal("attachment", response.Content.Headers.ContentDisposition.DispositionType);
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (InventoryOrderId != null)
         {
             hashCode = hashCode * 59 + InventoryOrderId.GetHashCode();
         }
         if (Checked != null)
         {
             hashCode = hashCode * 59 + Checked.GetHashCode();
         }
         if (LastModified != null)
         {
             hashCode = hashCode * 59 + LastModified.GetHashCode();
         }
         if (Created != null)
         {
             hashCode = hashCode * 59 + Created.GetHashCode();
         }
         if (ChangedBy != null)
         {
             hashCode = hashCode * 59 + ChangedBy.GetHashCode();
         }
         if (CommentOther != null)
         {
             hashCode = hashCode * 59 + CommentOther.GetHashCode();
         }
         if (CommentCostCenter != null)
         {
             hashCode = hashCode * 59 + CommentCostCenter.GetHashCode();
         }
         if (CommentPlant != null)
         {
             hashCode = hashCode * 59 + CommentPlant.GetHashCode();
         }
         if (CommentLocation != null)
         {
             hashCode = hashCode * 59 + CommentLocation.GetHashCode();
         }
         if (Status != null)
         {
             hashCode = hashCode * 59 + Status.GetHashCode();
         }
         if (Asset != null)
         {
             hashCode = hashCode * 59 + Asset.GetHashCode();
         }
         if (AssetNumber != null)
         {
             hashCode = hashCode * 59 + AssetNumber.GetHashCode();
         }
         if (SubNumber != null)
         {
             hashCode = hashCode * 59 + SubNumber.GetHashCode();
         }
         if (CompanyCode != null)
         {
             hashCode = hashCode * 59 + CompanyCode.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #27
0
        // pass in either basedir or s, but not both.
        // In other words, you can extract to a stream or to a directory, but not both!
        private void Extract(string basedir, System.IO.Stream s)
        {
            string TargetFile = null;

            if (basedir != null)
            {
                TargetFile = System.IO.Path.Combine(basedir, FileName);

                // check if a directory
                if ((IsDirectory) || (FileName.EndsWith("/")))
                {
                    if (!System.IO.Directory.Exists(TargetFile))
                    {
                        System.IO.Directory.CreateDirectory(TargetFile);
                    }
                    return;
                }
            }
            else if (s != null)
            {
                if ((IsDirectory) || (FileName.EndsWith("/")))
                {
                    // extract a directory to streamwriter?  nothing to do!
                    return;
                }
            }
            else
            {
                throw new Exception("Invalid input.");
            }

            using (System.IO.MemoryStream memstream = new System.IO.MemoryStream(_FileData))
            {
                System.IO.Stream input = null;
                try
                {
                    if (CompressedSize == UncompressedSize)
                    {
                        // the System.IO.Compression.DeflateStream class does not handle uncompressed data.
                        // so if an entry is not compressed, then we just translate the bytes directly.
                        input = memstream;
                    }
                    else
                    {
                        input = new System.IO.Compression.DeflateStream(memstream, System.IO.Compression.CompressionMode.Decompress);
                    }

                    if (TargetFile != null)
                    {
                        // ensure the target path exists
                        if (!System.IO.Directory.Exists(System.IO.Path.GetDirectoryName(TargetFile)))
                        {
                            System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(TargetFile));
                        }
                    }

                    System.IO.Stream output = null;
                    try
                    {
                        if (TargetFile != null)
                        {
                            if ((OverwriteOnExtract) && (System.IO.File.Exists(TargetFile)))
                            {
                                System.IO.File.Delete(TargetFile);
                            }
                            output = new System.IO.FileStream(TargetFile, System.IO.FileMode.CreateNew);
                        }
                        else
                        {
                            output = s;
                        }

                        byte[] bytes = new byte[4096];
                        int    n;

                        if (_Debug)
                        {
                            Console.WriteLine("{0}: _FileData.Length= {1}", TargetFile, _FileData.Length);
                            Console.WriteLine("{0}: memstream.Position: {1}", TargetFile, memstream.Position);
                            n = _FileData.Length;
                            if (n > 1000)
                            {
                                n = 500;
                                Console.WriteLine("{0}: truncating dump from {1} to {2} bytes...", TargetFile, _FileData.Length, n);
                            }
                            for (int j = 0; j < n; j += 2)
                            {
                                if ((j > 0) && (j % 40 == 0))
                                {
                                    System.Console.WriteLine();
                                }
                                System.Console.Write(" {0:X2}", _FileData[j]);
                                if (j + 1 < n)
                                {
                                    System.Console.Write("{0:X2}", _FileData[j + 1]);
                                }
                            }
                            System.Console.WriteLine("\n");
                        }

                        n = 1; // anything non-zero
                        while (n != 0)
                        {
                            if (_Debug)
                            {
                                Console.WriteLine("{0}: about to read...", TargetFile);
                            }
                            n = input.Read(bytes, 0, bytes.Length);
                            if (_Debug)
                            {
                                Console.WriteLine("{0}: got {1} bytes", TargetFile, n);
                            }
                            if (n > 0)
                            {
                                if (_Debug)
                                {
                                    Console.WriteLine("{0}: about to write...", TargetFile);
                                }
                                output.Write(bytes, 0, n);
                            }
                        }
                    }
                    finally
                    {
                        // we only close the output stream if we opened it.
                        if ((output != null) && (TargetFile != null))
                        {
                            output.Close();
                            output.Dispose();
                        }
                    }

                    if (TargetFile != null)
                    {
                        // We may have to adjust the last modified time to compensate
                        // for differences in how the .NET Base Class Library deals
                        // with daylight saving time (DST) versus how the Windows
                        // filesystem deals with daylight saving time. See
                        // http://blogs.msdn.com/oldnewthing/archive/2003/10/24/55413.aspx for some context.

                        // in a nutshell: Daylight savings time rules change regularly.  In
                        // 2007, for example, the inception week of DST changed.  In 1977,
                        // DST was in place all year round. in 1945, likewise.  And so on.
                        // Win32 does not attempt to guess which time zone rules were in
                        // effect at the time in question.  It will render a time as
                        // "standard time" and allow the app to change to DST as necessary.
                        //  .NET makes a different choice.

                        // -------------------------------------------------------
                        // Compare the output of FileInfo.LastWriteTime.ToString("f") with
                        // what you see in the property sheet for a file that was last
                        // written to on the other side of the DST transition. For example,
                        // suppose the file was last modified on October 17, during DST but
                        // DST is not currently in effect. Explorer's file properties
                        // reports Thursday, October 17, 2003, 8:45:38 AM, but .NETs
                        // FileInfo reports Thursday, October 17, 2003, 9:45 AM.

                        // Win32 says, "Thursday, October 17, 2002 8:45:38 AM PST". Note:
                        // Pacific STANDARD Time. Even though October 17 of that year
                        // occurred during Pacific Daylight Time, Win32 displays the time as
                        // standard time because that's what time it is NOW.

                        // .NET BCL assumes that the current DST rules were in place at the
                        // time in question.  So, .NET says, "Well, if the rules in effect
                        // now were also in effect on October 17, 2003, then that would be
                        // daylight time" so it displays "Thursday, October 17, 2003, 9:45
                        // AM PDT" - daylight time.

                        // So .NET gives a value which is more intuitively correct, but is
                        // also potentially incorrect, and which is not invertible. Win32
                        // gives a value which is intuitively incorrect, but is strictly
                        // correct.
                        // -------------------------------------------------------

                        // With this adjustment, I add one hour to the tweaked .NET time, if
                        // necessary.  That is to say, if the time in question had occurred
                        // in what the .NET BCL assumed to be DST (an assumption that may be
                        // wrong given the constantly changing DST rules).

                        if (LastModified.IsDaylightSavingTime())
                        {
                            DateTime AdjustedLastModified = LastModified + new System.TimeSpan(1, 0, 0);
                            System.IO.File.SetLastWriteTime(TargetFile, AdjustedLastModified);
                        }
                        else
                        {
                            System.IO.File.SetLastWriteTime(TargetFile, LastModified);
                        }
                    }
                }
                finally
                {
                    // we only close the output stream if we opened it.
                    // we cannot use using() here because in some cases we do not want to Dispose the stream!
                    if ((input != null) && (input != memstream))
                    {
                        input.Close();
                        input.Dispose();
                    }
                }
            }
        }
Example #28
0
        public AboutForm()
        {
            InitializeComponent();

            aboutTextBox.Text = aboutTextBox.Text.Replace("<<appname>>",
                                                          String.Format("SeeMS {0}", (Environment.Is64BitProcess ? "(64-bit) " : "")));

            aboutTextBox.Text = aboutTextBox.Text.Replace("<<version>>",
                                                          String.Format("{0} ({1})", Version, LastModified.ToShortDateString()));
            aboutTextBox.Text = aboutTextBox.Text.Replace("<<date>>", LastModified.Year.ToString());

            componentListView.Items.Add("DR Docking Windows").SubItems.Add(
                String.Format("{0} ({1})", GetAssemblyVersion(GetAssemblyByName("DigitalRune")),
                              GetAssemblyLastModified(GetAssemblyByName("DigitalRune")).ToShortDateString()));

            componentListView.Items.Add("ZedGraph").SubItems.Add(
                String.Format("{0} ({1})", GetAssemblyVersion(GetAssemblyByName("ZedGraph")),
                              GetAssemblyLastModified(GetAssemblyByName("ZedGraph")).ToShortDateString()));

            componentListView.Items.Add("ProteoWizard MSData").SubItems.Add(
                String.Format("{0} ({1})", pwiz.CLI.msdata.Version.ToString(), pwiz.CLI.msdata.Version.LastModified()));
            componentListView.Items.Add("ProteoWizard Analysis").SubItems.Add(
                String.Format("{0} ({1})", pwiz.CLI.analysis.Version.ToString(), pwiz.CLI.analysis.Version.LastModified()));
            componentListView.Items.Add("ProteoWizard Proteome").SubItems.Add(
                String.Format("{0} ({1})", pwiz.CLI.proteome.Version.ToString(), pwiz.CLI.proteome.Version.LastModified()));
        }
Example #29
0
 public override string ToString()
 {
     return(Id + "," + Name + "," + Description + "," +
            Priority + "," + Status + "," + DateFound.ToShortDateString() + "," +
            LastModified.ToShortDateString() + "," + CreatedBy.Surname + "," + AssignedUser.Surname);
 }
Example #30
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (AssetNumber != null)
         {
             hashCode = hashCode * 59 + AssetNumber.GetHashCode();
         }
         if (SubNumber != null)
         {
             hashCode = hashCode * 59 + SubNumber.GetHashCode();
         }
         if (CompanyCode != null)
         {
             hashCode = hashCode * 59 + CompanyCode.GetHashCode();
         }
         if (TagId != null)
         {
             hashCode = hashCode * 59 + TagId.GetHashCode();
         }
         if (SecondTagId != null)
         {
             hashCode = hashCode * 59 + SecondTagId.GetHashCode();
         }
         if (IsUntaggable != null)
         {
             hashCode = hashCode * 59 + IsUntaggable.GetHashCode();
         }
         if (LastModified != null)
         {
             hashCode = hashCode * 59 + LastModified.GetHashCode();
         }
         if (Created != null)
         {
             hashCode = hashCode * 59 + Created.GetHashCode();
         }
         if (Creator != null)
         {
             hashCode = hashCode * 59 + Creator.GetHashCode();
         }
         if (InventoryNumber != null)
         {
             hashCode = hashCode * 59 + InventoryNumber.GetHashCode();
         }
         if (SerialNumber != null)
         {
             hashCode = hashCode * 59 + SerialNumber.GetHashCode();
         }
         if (Location != null)
         {
             hashCode = hashCode * 59 + Location.GetHashCode();
         }
         if (Room != null)
         {
             hashCode = hashCode * 59 + Room.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (CostCenter != null)
         {
             hashCode = hashCode * 59 + CostCenter.GetHashCode();
         }
         if (CapitalisationDate != null)
         {
             hashCode = hashCode * 59 + CapitalisationDate.GetHashCode();
         }
         if (LastInventoryDate != null)
         {
             hashCode = hashCode * 59 + LastInventoryDate.GetHashCode();
         }
         if (AcquisitionValue != null)
         {
             hashCode = hashCode * 59 + AcquisitionValue.GetHashCode();
         }
         if (AssetSuperNumber != null)
         {
             hashCode = hashCode * 59 + AssetSuperNumber.GetHashCode();
         }
         if (Vendor != null)
         {
             hashCode = hashCode * 59 + Vendor.GetHashCode();
         }
         if (TypeName != null)
         {
             hashCode = hashCode * 59 + TypeName.GetHashCode();
         }
         if (Plant != null)
         {
             hashCode = hashCode * 59 + Plant.GetHashCode();
         }
         if (AssetClass != null)
         {
             hashCode = hashCode * 59 + AssetClass.GetHashCode();
         }
         if (Quantity != null)
         {
             hashCode = hashCode * 59 + Quantity.GetHashCode();
         }
         if (Unit != null)
         {
             hashCode = hashCode * 59 + Unit.GetHashCode();
         }
         if (DeactivatedOn != null)
         {
             hashCode = hashCode * 59 + DeactivatedOn.GetHashCode();
         }
         if (IsDeactivated != null)
         {
             hashCode = hashCode * 59 + IsDeactivated.GetHashCode();
         }
         if (CompanyCodeCurrency != null)
         {
             hashCode = hashCode * 59 + CompanyCodeCurrency.GetHashCode();
         }
         if (Comment != null)
         {
             hashCode = hashCode * 59 + Comment.GetHashCode();
         }
         if (ShareTags != null)
         {
             hashCode = hashCode * 59 + ShareTags.GetHashCode();
         }
         return(hashCode);
     }
 }