コード例 #1
0
ファイル: Union.cs プロジェクト: nilnul/_nilnul_._LIB_
        public Set1 <T, TEq> op(Set1 <T, TEq> arg, Set1 <T, TEq> arg1)
        {
            var r = new Set1 <T, TEq>(arg);

            r.UnionWith(arg1);
            return(r);
        }
コード例 #2
0
        /**
         *
         */
        internal StyleTable CreateProtoChainRoot(bool registerClone = true)
        {
            StyleTable root = new StyleTable();

            // If there's a defaultFactory for this style sheet,
            // then add the object it produces to the root.
            if (null != Set1)
            {
                root = root.CloneAndOverrideWith(Set1.Produce());
            }

            // If there's a factory for this style sheet,
            // then add the object it produces to the root.
            if (null != Set2)
            {
                root = root.CloneAndOverrideWith(Set2.Produce());
            }

            if (registerClone)
            {
                _clones.Add(root);
            }

            return(root);
        }
コード例 #3
0
        public Set1 <T, TEq> op(Set1 <T, TEq> arg, Set1 <T, TEq> arg1)
        {
            var r = new Set1 <T, TEq>(arg);

            r.IntersectWith(arg1);
            return(r);
        }
コード例 #4
0
        protected async override void OnAppearing()
        {
            Set1 set1 = await sass.Get_Value <Set1>(FileName);

            BindingContext = set1;
            base.OnAppearing();
        }
コード例 #5
0
        public Set7 createSet7()
        {
            Set7 set7 = new Set7();

            set7.Value                       = (new Set7.Set7SequenceType());
            set7.Value.Set6                  = (new Set6());
            set7.Value.Set6.Value            = (new Set6.Set6SequenceType());
            set7.Value.Set6.Value.Set4       = (new Set4());
            set7.Value.Set6.Value.Set4.Value = (new List <Set3>());
            Set3 set3 = new Set3();

            set3.Value            = (new Set3.Set3SequenceType());
            set3.Value.Set2       = (new Set2());
            set3.Value.Set2.Value = (new List <Set1>());
            Set1 set1 = new Set1();

            set1.Value        = (new Set1.Set1SequenceType());
            set1.Value.Set1ID = 0x44L;
            set3.Value.Set2.Value.Add(set1);
            set7.Value.Set6.Value.Set4.Value.Add(set3);
            set7.Value.Set6.Value.Set5       = (new Set5());
            set7.Value.Set6.Value.Set5.Value = (new List <Set3>());
            set7.Value.Set6.Value.Set5.Value.Add(set3);
            return(set7);
        }
コード例 #6
0
ファイル: Xor.cs プロジェクト: nilnul/_nilnul_._LIB_
        public Set1 <T, TEq> op(Set1 <T, TEq> arg, Set1 <T, TEq> arg1)
        {
            var r = new Set1 <T, TEq>(arg);

            r.SymmetricExceptWith(arg1);
            return(r);
        }
コード例 #7
0
 public void DisallowUnpersistSetWithPieces()
 {
     Session.BeginUpdate();
     Assert.Throws <ConstraintException>(() =>
                                         Set1.Unpersist(Session));
     Session.Commit();
 }
コード例 #8
0
        public void Challenge08()
        {
            Set1 set = new Set1();

            string detectedLine = set.DetectAesInEcbMode(File.ReadAllLines("08.txt"));

            Assert.AreEqual("d880619740a8a19b7840a8a31c810a3d08649af70dc06f4fd5d2d69c744cd283e2dd052f6b641dbf9d11b0348542bb5708649af70dc06f4fd5d2d69c744cd2839475c9dfdbc1d46597949d9c7e82bf5a08649af70dc06f4fd5d2d69c744cd28397a93eab8d6aecd566489154789a6b0308649af70dc06f4fd5d2d69c744cd283d403180c98c8f6db1f2a3f9c4040deb0ab51b29933f2c123c58386b06fba186a", detectedLine);
        }
コード例 #9
0
        public void Challenge03()
        {
            Set1 set = new Set1();

            string xorCipherString = set.XorCipher("1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736");

            Assert.AreEqual("Cooking MC's like a pound of bacon", xorCipherString, false);
        }
コード例 #10
0
        public void Challenge02()
        {
            Set1 set = new Set1();

            string fixedXorString = set.FixedXor("1c0111001f010100061a024b53535009181c", "686974207468652062756c6c277320657965");

            Assert.AreEqual("746865206b696420646f6e277420706c6179", fixedXorString, false);
        }
コード例 #11
0
ファイル: Set1Tests.cs プロジェクト: yohanseimon/Matasano
        public void Challenge01()
        {
            Set1 set = new Set1();

            string base64String = set.HexToBase64("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d");

            Assert.AreEqual("SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t", base64String, false);
        }
コード例 #12
0
        public void Challenge04()
        {
            Set1 set = new Set1();

            string xorCipherString = set.XorCipher(File.ReadLines("04.txt").Cast <string>().ToArray());

            Assert.AreEqual("Now that the party is jumping\n", xorCipherString, false);
        }
コード例 #13
0
        public void Challenge06()
        {
            Set1 set = new Set1();

            string decryptedString = set.BreakRepeatingKeyXor(File.ReadAllText("06.txt"));

            Assert.AreEqual("Terminator X: Bring the noise", decryptedString);
        }
コード例 #14
0
        public void Challenge05()
        {
            Set1 set = new Set1();

            string encryptedString = set.RepeatingKeyXor("Burning 'em, if you ain't quick and nimble\nI go crazy when I hear a cymbal", "ICE");

            Assert.AreEqual("0b3637272a2b2e63622c2e69692a23693a2a3c6324202d623d63343c2a26226324272765272a282b2f20430a652e2c652a3124333a653e2b2027630c692b20283165286326302e27282f", encryptedString, false);
        }
コード例 #15
0
ファイル: Set1Tests.cs プロジェクト: yohanseimon/Matasano
        public void Challenge05()
        {
            Set1 set = new Set1();

            string encryptedString = set.RepeatingKeyXor("Burning 'em, if you ain't quick and nimble\nI go crazy when I hear a cymbal", "ICE");

            Assert.AreEqual("0b3637272a2b2e63622c2e69692a23693a2a3c6324202d623d63343c2a26226324272765272a282b2f20430a652e2c652a3124333a653e2b2027630c692b20283165286326302e27282f", encryptedString, false);
        }
コード例 #16
0
        public void Challenge07()
        {
            Set1 set = new Set1();

            string decryptedString = set.DecryptAesInEcbMode(File.ReadAllText("07.txt"));

            Assert.IsTrue(decryptedString.StartsWith("I'm back and I'm ringin' the bell"));
        }
コード例 #17
0
ファイル: Set1Tests.cs プロジェクト: yohanseimon/Matasano
        public void Challenge06()
        {
            Set1 set = new Set1();

            string decryptedString = set.BreakRepeatingKeyXor(File.ReadAllText("06.txt"));

            Assert.AreEqual("Terminator X: Bring the noise", decryptedString);
        }
コード例 #18
0
ファイル: Set1Tests.cs プロジェクト: yohanseimon/Matasano
        public void Challenge04()
        {
            Set1 set = new Set1();

            string xorCipherString = set.XorCipher(File.ReadLines("04.txt").Cast<string>().ToArray());

            Assert.AreEqual("Now that the party is jumping\n", xorCipherString, false);
        }
コード例 #19
0
ファイル: Set1Tests.cs プロジェクト: yohanseimon/Matasano
        public void Challenge03()
        {
            Set1 set = new Set1();

            string xorCipherString = set.XorCipher("1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736");

            Assert.AreEqual("Cooking MC's like a pound of bacon", xorCipherString, false);
        }
コード例 #20
0
ファイル: Set1Tests.cs プロジェクト: yohanseimon/Matasano
        public void Challenge02()
        {
            Set1 set = new Set1();

            string fixedXorString = set.FixedXor("1c0111001f010100061a024b53535009181c", "686974207468652062756c6c277320657965");

            Assert.AreEqual("746865206b696420646f6e277420706c6179", fixedXorString, false);
        }
コード例 #21
0
        public void Challenge01()
        {
            Set1 set = new Set1();

            string base64String = set.HexToBase64("49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d");

            Assert.AreEqual("SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t", base64String, false);
        }
コード例 #22
0
ファイル: Set1Tests.cs プロジェクト: yohanseimon/Matasano
        public void Challenge07()
        {
            Set1 set = new Set1();

            string decryptedString = set.DecryptAesInEcbMode(File.ReadAllText("07.txt"));

            Assert.IsTrue(decryptedString.StartsWith("I'm back and I'm ringin' the bell"));
        }
コード例 #23
0
ファイル: Set.cs プロジェクト: jelink/Utilities-VS2015-
 /// <summary>
 /// Determines if the two sets are equivalent
 /// </summary>
 /// <param name="Set1">Set 1</param>
 /// <param name="Set2">Set 2</param>
 /// <returns>True if they are, false otherwise</returns>
 public static bool operator ==(Set <T> Set1, Set <T> Set2)
 {
     if (((object)Set1) == null && ((object)Set2) == null)
     {
         return(true);
     }
     if (((object)Set1) == null || ((object)Set2) == null)
     {
         return(false);
     }
     return(Set1.Contains(Set2) && Set2.Contains(Set1));
 }
コード例 #24
0
        /// <summary>
        /// Gets the style
        /// </summary>
        /// <param name="styleProp"></param>
        /// <returns></returns>
// ReSharper disable MemberCanBePrivate.Global
        public object GetStyle(string styleProp)
// ReSharper restore MemberCanBePrivate.Global
        {
            // First look in the overrides, in case setStyle()
            // has been called on this StyleDeclaration.
            if (null != _overrides)
            {
                // If the property exists in our overrides, but
                // has 'undefined' as its value, it has been
                // cleared from this stylesheet so return
                // undefined.

                /*if (_overrides.ContainsKey(styleProp) && UNDEFINED.Equals(_overrides[styleProp]))
                 * {
                 *      return UNDEFINED;
                 * }*/

                if (_overrides.ContainsKey(styleProp))
                {
                    var v = _overrides[styleProp];
                    if (!UNDEFINED.Equals(v))                     // must use !==
                    {
                        return(v);
                    }
                }
            }
            // not found in overrides

            if (null != Set2)
            {
                StyleTable o = Set2.Produce();
                object     v = o.GetValue(styleProp);
                if (!UNDEFINED.Equals(v))
                {
                    return(v);
                }
            }
            // not found in stylesheet

            if (null != Set1)
            {
                StyleTable o = Set1.Produce();
                object     v = o.GetValue(styleProp);
                if (!UNDEFINED.Equals(v))
                {
                    return(v);
                }
            }
            // not faund in default values

            // so return null
            return(UNDEFINED);
        }
コード例 #25
0
        /// <summary>
        /// Saving Values to the Storage...
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="Key"></param>
        /// <param name="ValueToSave"></param>
        /// <returns></returns>
        public async Task Save_Value(String filename, Set1 set1)
        {
            XDocument doc = new XDocument();

            using (var writer = doc.CreateWriter())
            {
                var serializer = new XmlSerializer(typeof(Set1));
                serializer.Serialize(writer, set1);
            }
            //get the folder name and path
            IFolder rootFolder = FileSystem.Current.LocalStorage;
            // create a new subfolder in the local folder
            IFolder folder = await rootFolder.CreateFolderAsync("Set1",
                                                                CreationCollisionOption.OpenIfExists);

            //create a file
            IFile file = await folder.CreateFileAsync(filename,
                                                      CreationCollisionOption.ReplaceExisting);

            await file.WriteAllTextAsync(doc.ToString());
        }
コード例 #26
0
 public Sed(Set1 <T, TEq> val) : base(val)
 {
 }
コード例 #27
0
// ReSharper restore UnassignedField.Global
#endif

        ///<summary>
        ///</summary>
        ///<param name="chain">Replikativni Dictionary</param>
        ///<param name="target"></param>
        ///<returns></returns>
        internal virtual StyleTable AddStyleToProtoChain(StyleTable chain, object target /*, object filterMap*/)
        {
            //Debug.Log("AddStyleToProtoChain: chain: " + chain + "; target: " + target);

            bool nodeAddedToChain = false;

            //var originalChain = chain;

            //if (filterMap)
            //{
            //    chain = {};
            //}

#if DEBUG
            if (!string.IsNullOrEmpty(DebugId))
            {
                Debug.Log(DebugId + " 0. " + chain);
            }
#endif

            // If there's a defaultFactory for this style sheet,
            // then add the object it produces to the chain.
            if (null != Set1)
            {
                chain            = chain.CloneAndOverrideWith(Set1.Produce());
                nodeAddedToChain = true;
            }

#if DEBUG
            if (!string.IsNullOrEmpty(DebugId))
            {
                Debug.Log(DebugId + " 1. " + chain);
            }
#endif

            // If there's a factory for this style sheet,
            // then add the object it produces to the chain.
            if (null != Set2)
            {
                chain            = chain.CloneAndOverrideWith(Set2.Produce());
                nodeAddedToChain = true;
            }

#if DEBUG
            if (!string.IsNullOrEmpty(DebugId))
            {
                Debug.Log(DebugId + " 2. " + chain);
            }
#endif

            //Debug.Log("-- chain: " + chain);

            // If someone has called setStyle() on this StyleDeclaration,
            // then some of the values returned from the factory are
            // out-of-date. Overwrite them with the up-to-date values.
            if (null != _overrides)
            {
                // Before we add our overrides to the object at the head of
                // the chain, make sure that we added an object at the head
                // of the chain.
                if (null == Set1 && null == Set2)
                {
                    chain            = (StyleTable)chain.Clone();
                    nodeAddedToChain = true;
                }

                foreach (string p in _overrides.Keys)
                {
                    if (!UNDEFINED.Equals(_overrides[p]))
                    {
                        chain[p] = _overrides[p];
                    }

                    /*if (UNDEFINED.Equals(_overrides[p]))
                     *      chain.Remove(p);
                     * else
                     *      chain[p] = _overrides[p];*/
                }
            }

#if DEBUG
            if (!string.IsNullOrEmpty(DebugId))
            {
                Debug.Log(DebugId + " 3. " + chain);
            }
#endif

            #region _complex

            ////if (filterMap)
            ////{
            //    if (nodeAddedToChain)
            //    {
            //        //Debug.Log("nodeAddedToChain");
            //        //var filteredChain = new Dictionary<string, object>();
            //        //for (string i in chain)
            //        //{
            //        //    if (filterMap[i] != null)
            //        //    {
            //        //        filteredChain[filterMap[i]] = chain[i];
            //        //    }
            //        //}

            //        //var f = new StyleTableValuesFactory(originalChain);

            //        chain = (StyleTable) originalChain.Clone();

            //        //chain = originalChain;

            //        //chain = filteredChain;
            //        //chain = f.Produce();

            //        //chain[FILTERMAP_PROP] = filterMap;
            //    }
            //    else
            //    {
            //        chain = originalChain;
            //    }
            ////}

            #endregion

            if (nodeAddedToChain)
            {
                _clones.Add(chain);
            }

            return(chain);
        }
コード例 #28
0
        /// <summary>
        /// Private
        /// </summary>
        /// <param name="styleProp"></param>
        /// <param name="value"></param>
        internal void SetLocalStyle(string styleProp, object value)
        {
            //object oldValue = GetStyle(styleProp);

            if (UNDEFINED.Equals(value))
            {
                ClearStyleAttr(styleProp);
                return;
            }

            StyleTable o;

            if (null != Set1)
            {
                o = Set1.Produce();
                if (!o.ContainsKey(styleProp) || o[styleProp] != value)                 // Defaultni factory nema taj stil ili ga ima ali s različitom vrijednošću
                {
                    /**
                     * Defaultni factory ima različitu vrijednost ovog stila, znači radi se o overrideu
                     * Kreirajmo overrides tablicu i u njoj setirajmo stil
                     * */
                    if (null == _overrides)
                    {
                        _overrides = new StyleTable();
                    }

                    _overrides[styleProp] = value;
                }
                else if (null != _overrides && _overrides.ContainsKey(styleProp))                 // Defaultni factory ima taj stil i to sa istom vrijednošću
                {
                    /**
                     * Obrišimo ga u overrides tabeli
                     * */
                    _overrides.Remove(styleProp);
                }
            }

            if (null != Set2)
            {
                o = Set2.Produce();
                if (!o.ContainsKey(styleProp) || o[styleProp] != value)
                {
                    if (null == _overrides)
                    {
                        _overrides = new StyleTable();
                    }

                    _overrides[styleProp] = value;
                }
                else if (null != _overrides && _overrides.ContainsKey(styleProp))
                {
                    _overrides.Remove(styleProp);
                }
            }

            if (null == Set1 && null == Set2)             // Ne postoji niti jedan factory (ni metadata, ni stylesheet)
            {
                if (null == _overrides)
                {
                    _overrides = new StyleTable();
                }
                _overrides[styleProp] = value;
            }

            UpdateClones(styleProp, value);
        }
コード例 #29
0
ファイル: Eq.cs プロジェクト: nilnul/_nilnul_._LIB_
        public int GetHashCode(Set1 <T, TEq> obj)
        {
            return(0);

            //throw new NotImplementedException();
        }
コード例 #30
0
ファイル: En.cs プロジェクト: nilnul/_nilnul_._LIB_
 public En(Set1 <T, TEq> val) : base(val)
 {
 }
コード例 #31
0
ファイル: Eq.cs プロジェクト: nilnul/_nilnul_._LIB_
        public bool Equals(Set1 <T, TEq> x, Set1 <T, TEq> y)
        {
            return(x.IsSubsetOf(y) && y.IsSubsetOf(x));

            throw new NotImplementedException();
        }
コード例 #32
0
 public override string ToString()
 {
     return("{" + Set1.ToString() + "|" + Set2.ToString() + "}");
 }
コード例 #33
0
ファイル: Set1Tests.cs プロジェクト: yohanseimon/Matasano
        public void Challenge08()
        {
            Set1 set = new Set1();

            string detectedLine = set.DetectAesInEcbMode(File.ReadAllLines("08.txt"));

            Assert.AreEqual("d880619740a8a19b7840a8a31c810a3d08649af70dc06f4fd5d2d69c744cd283e2dd052f6b641dbf9d11b0348542bb5708649af70dc06f4fd5d2d69c744cd2839475c9dfdbc1d46597949d9c7e82bf5a08649af70dc06f4fd5d2d69c744cd28397a93eab8d6aecd566489154789a6b0308649af70dc06f4fd5d2d69c744cd283d403180c98c8f6db1f2a3f9c4040deb0ab51b29933f2c123c58386b06fba186a", detectedLine);
        }