Example #1
0
        static void Main(string[] args)
        {
            string encodedVal = string.Empty;
            long   decodedVal = 0;

            //Testing Lower Bounds
            for (int i = 1; i < 25; i++)
            {
                encodedVal = Obfuscate.Encode(i);
                decodedVal = Obfuscate.Decode(Obfuscate.Encode(i));
                Console.WriteLine($"{i} == {encodedVal} == {decodedVal}: {(long)i == decodedVal}");
            }

            //Testing Middle Bounds
            for (int i = 999999; i <= 999999 + 50; i++)
            {
                encodedVal = Obfuscate.Encode(i);
                decodedVal = Obfuscate.Decode(Obfuscate.Encode(i));
                Console.WriteLine($"{i} == {encodedVal} == {decodedVal}: {(long)i == decodedVal}");
            }

            //Testing Upper Bounds
            for (long i = (Int64.MaxValue - 25); i < Int64.MaxValue; i++)
            {
                encodedVal = Obfuscate.Encode(i);
                decodedVal = Obfuscate.Decode(Obfuscate.Encode(i));
                Console.WriteLine($"{i} == {encodedVal} == {decodedVal}: {i == decodedVal}");
            }
        }
Example #2
0
        private void setDefaults()
        {
            _ProfileName = "Default";

            //Outlook
            OutlookService       = OutlookOgcs.Calendar.Service.DefaultMailbox;
            MailboxName          = "";
            SharedCalendar       = "";
            UseOutlookCalendar   = new OutlookCalendarListEntry();
            CategoriesRestrictBy = RestrictBy.Exclude;
            Categories           = new List <String>();
            OnlyRespondedInvites = false;
            OutlookDateFormat    = "g";
            outlookGalBlocked    = false;

            //Google
            UseGoogleCalendar      = new GoogleCalendarListEntry();
            CloakEmail             = true;
            ExcludeDeclinedInvites = true;
            ExcludeGoals           = true;

            //Sync Options
            SyncDirection               = Sync.Direction.OutlookToGoogle;
            DaysInThePast               = 1;
            DaysInTheFuture             = 60;
            SyncInterval                = 0;
            SyncIntervalUnit            = "Hours";
            OutlookPush                 = false;
            AddLocation                 = true;
            AddDescription              = true;
            AddDescription_OnlyToGoogle = true;
            AddReminders                = false;
            UseGoogleDefaultReminder    = false;
            UseOutlookDefaultReminder   = false;
            ReminderDND                 = false;
            ReminderDNDstart            = DateTime.Now.Date.AddHours(22);
            ReminderDNDend              = DateTime.Now.Date.AddDays(1).AddHours(6);
            AddAttendees                = false;
            MaxAttendees                = 200;
            AddColours               = false;
            MergeItems               = true;
            DisableDelete            = true;
            ConfirmOnDelete          = true;
            TargetCalendar           = Sync.Direction.OutlookToGoogle;
            CreatedItemsOnly         = true;
            SetEntriesPrivate        = false;
            SetEntriesAvailable      = false;
            AvailabilityStatus       = Microsoft.Office.Interop.Outlook.OlBusyStatus.olFree.ToString();
            SetEntriesColour         = false;
            SetEntriesColourValue    = Microsoft.Office.Interop.Outlook.OlCategoryColor.olCategoryColorNone.ToString();
            SetEntriesColourName     = "None";
            SetEntriesColourGoogleId = "0";
            ColourMaps               = new ColourMappingDictionary();
            Obfuscation              = new Obfuscate();

            ExtirpateOgcsMetadata = false;
            lastSyncDate          = new DateTime(0);
        }
Example #3
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 (AlwaysShow != null)
         {
             hashCode = hashCode * 59 + AlwaysShow.GetHashCode();
         }
         if (DisplayOrder != null)
         {
             hashCode = hashCode * 59 + DisplayOrder.GetHashCode();
         }
         if (FormElement != null)
         {
             hashCode = hashCode * 59 + FormElement.GetHashCode();
         }
         if (Label != null)
         {
             hashCode = hashCode * 59 + Label.GetHashCode();
         }
         if (Link != null)
         {
             hashCode = hashCode * 59 + Link.GetHashCode();
         }
         if (Mask != null)
         {
             hashCode = hashCode * 59 + Mask.GetHashCode();
         }
         if (Obfuscate != null)
         {
             hashCode = hashCode * 59 + Obfuscate.GetHashCode();
         }
         if (PlaceholderLabel != null)
         {
             hashCode = hashCode * 59 + PlaceholderLabel.GetHashCode();
         }
         if (PreferredInputType != null)
         {
             hashCode = hashCode * 59 + PreferredInputType.GetHashCode();
         }
         if (Tooltip != null)
         {
             hashCode = hashCode * 59 + Tooltip.GetHashCode();
         }
         return(hashCode);
     }
 }
        public void TestMethod1()
        {
            //Testing Lower Bounds
            for (int i = 1; i < 25; i++)
            {
                Debug.Assert(Obfuscate.Encode(i) != string.Empty, "Invalid Encoding");
                Debug.Assert((Obfuscate.Decode(Obfuscate.Encode(i)) == (long)i), "Invalid Decoding");
            }

            //Testing Middle Bounds
            for (int i = 10000; i < 10025; i++)
            {
                Debug.Assert(Obfuscate.Encode(i) != string.Empty, "Invalid Encoding");
                Debug.Assert(Obfuscate.Decode(Obfuscate.Encode(i)) == (long)i, "Invalid Decoding");
            }

            //Testing Upper Bounds
            for (long i = Int64.MaxValue - 25; i < Int64.MaxValue; i++)
            {
                Debug.Assert(Obfuscate.Encode(i) != string.Empty, "Invalid Encoding");
                Debug.Assert(Obfuscate.Decode(Obfuscate.Encode(i)) == i, "Invalid Decoding");
            }
        }
Example #5
0
        /// <summary>
        /// Returns true if PaymentProductFieldDisplayHints instances are equal
        /// </summary>
        /// <param name="other">Instance of PaymentProductFieldDisplayHints to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PaymentProductFieldDisplayHints other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     AlwaysShow == other.AlwaysShow ||
                     AlwaysShow != null &&
                     AlwaysShow.Equals(other.AlwaysShow)
                     ) &&
                 (
                     DisplayOrder == other.DisplayOrder ||
                     DisplayOrder != null &&
                     DisplayOrder.Equals(other.DisplayOrder)
                 ) &&
                 (
                     FormElement == other.FormElement ||
                     FormElement != null &&
                     FormElement.Equals(other.FormElement)
                 ) &&
                 (
                     Label == other.Label ||
                     Label != null &&
                     Label.Equals(other.Label)
                 ) &&
                 (
                     Link == other.Link ||
                     Link != null &&
                     Link.Equals(other.Link)
                 ) &&
                 (
                     Mask == other.Mask ||
                     Mask != null &&
                     Mask.Equals(other.Mask)
                 ) &&
                 (
                     Obfuscate == other.Obfuscate ||
                     Obfuscate != null &&
                     Obfuscate.Equals(other.Obfuscate)
                 ) &&
                 (
                     PlaceholderLabel == other.PlaceholderLabel ||
                     PlaceholderLabel != null &&
                     PlaceholderLabel.Equals(other.PlaceholderLabel)
                 ) &&
                 (
                     PreferredInputType == other.PreferredInputType ||
                     PreferredInputType != null &&
                     PreferredInputType.Equals(other.PreferredInputType)
                 ) &&
                 (
                     Tooltip == other.Tooltip ||
                     Tooltip != null &&
                     Tooltip.Equals(other.Tooltip)
                 ));
        }