Beispiel #1
0
        //
        // Generate a list of the functions implemented in CT2 for
        // https://www.cryptool.org/de/ctp-dokumentation-de/ctp-functions-de
        //
        public override void Generate(TemplateDirectory templatesDir)
        {
            foreach (var lang in AvailableLanguages)
            {
                var cultureInfo = new CultureInfo(lang);
                Thread.CurrentThread.CurrentCulture   = cultureInfo;
                Thread.CurrentThread.CurrentUICulture = cultureInfo;

                // create list of functions
                itemlist.Clear();

                GetComponents(lang);
                GetWizard(lang);
                //GetTemplates(templatesDir, lang, "");

                // create CSV file
                var CSVDesc = GenerateCSVDescription();

                StoreFunctionList(CSVDesc, "FunctionList-" + lang + ".csv");

                // create text file
                var TextDesc = Properties.Resources.FunctionListTemplate
                               .Replace("\r", "")
                               .Replace("$VERSION$", GetVersion())
                               .Replace("$DATE$", DateTime.Now.ToString(CultureInfo.CurrentUICulture.DateTimeFormat))
                               + GenerateDescription();

                StoreFunctionList(TextDesc, "FunctionList-" + lang + ".txt");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Removes all items from the <see cref="T:System.Collections.Generic.ICollection`1" />.
        /// </summary>
        public void Clear()
        {
            ItemList.Clear();
            ++m_VersionTag;

            if (HasKey)
            {
                ItemDictionary.Clear();
            }
        }
 public void Dispose()
 {
     lock (lockObject)
     {
         ListOfPointQueue.Clear();
         ListOfPointQueue = null;
         ListOfItemQueue.Clear();
         ListOfItemQueue = null;
         Grid.Clear();
         Grid = null;
         ItemDictionary.Clear();
         ItemDictionary = null;
     }
 }
Beispiel #4
0
        public void BasicItemDictionary()
        {
            ItemDictionary <ProjectItemInstance> items = new ItemDictionary <ProjectItemInstance>();

            // Clearing empty collection
            items.Clear();

            // Enumeration of empty collection
            using (IEnumerator <ProjectItemInstance> enumerator = items.GetEnumerator())
            {
                enumerator.MoveNext().ShouldBeFalse();
                Should.Throw <InvalidOperationException>(() =>
                {
                    object o = ((IEnumerator)enumerator).Current;
                });
                enumerator.Current.ShouldBeNull();
            }

            List <ProjectItemInstance> list = new List <ProjectItemInstance>();

            foreach (ProjectItemInstance item in items)
            {
                list.Add(item);
            }

            Assert.Empty(list);

            // Cause an empty list for type 'x' to be added
            ICollection <ProjectItemInstance> itemList = items["x"];

            // Enumerate empty collection, with an empty list in it
            foreach (ProjectItemInstance item in items)
            {
                list.Add(item);
            }

            Assert.Empty(list);

            // Add and remove some items
            ProjectItemInstance item1 = GetItemInstance("i", "i1");

            Assert.False(items.Remove(item1));
            Assert.Empty(items["j"]);

            items.Add(item1);
            Assert.Single(items["i"]);
            Assert.Equal(item1, items["i"].First());

            ProjectItemInstance item2 = GetItemInstance("i", "i2");

            items.Add(item2);
            ProjectItemInstance item3 = GetItemInstance("j", "j1");

            items.Add(item3);

            // Enumerate to verify contents
            list = new List <ProjectItemInstance>();
            foreach (ProjectItemInstance item in items)
            {
                list.Add(item);
            }

            list.Sort(ProjectItemInstanceComparer);
            Assert.Equal(item1, list[0]);
            Assert.Equal(item2, list[1]);
            Assert.Equal(item3, list[2]);

            // Direct operations on the enumerator
            using (IEnumerator <ProjectItemInstance> enumerator = items.GetEnumerator())
            {
                Assert.Null(enumerator.Current);
                Assert.True(enumerator.MoveNext());
                Assert.NotNull(enumerator.Current);
                enumerator.Reset();
                Assert.Null(enumerator.Current);
                Assert.True(enumerator.MoveNext());
                Assert.NotNull(enumerator.Current);
            }
        }
        public void BasicItemDictionary()
        {
            ItemDictionary <ProjectItemInstance> items = new ItemDictionary <ProjectItemInstance>();

            // Clearing empty collection
            items.Clear();

            // Enumeration of empty collection
            using (IEnumerator <ProjectItemInstance> enumerator = items.GetEnumerator())
            {
                Assert.Equal(false, enumerator.MoveNext());
                ObjectModelHelpers.AssertThrows(typeof(InvalidOperationException), delegate { object o = ((IEnumerator)enumerator).Current; });
                Assert.Equal(null, enumerator.Current);
            }

            List <ProjectItemInstance> list = new List <ProjectItemInstance>();

            foreach (ProjectItemInstance item in items)
            {
                list.Add(item);
            }

            Assert.Equal(0, list.Count);

            // Cause an empty list for type 'x' to be added
            ICollection <ProjectItemInstance> itemList = items["x"];

            // Enumerate empty collection, with an empty list in it
            foreach (ProjectItemInstance item in items)
            {
                list.Add(item);
            }

            Assert.Equal(0, list.Count);

            // Add and remove some items
            ProjectItemInstance item1 = GetItemInstance("i", "i1");

            Assert.Equal(false, items.Remove(item1));
            Assert.Equal(0, items["j"].Count);

            items.Add(item1);
            Assert.Equal(1, items["i"].Count);
            Assert.Equal(item1, items["i"].First());

            ProjectItemInstance item2 = GetItemInstance("i", "i2");

            items.Add(item2);
            ProjectItemInstance item3 = GetItemInstance("j", "j1");

            items.Add(item3);

            // Enumerate to verify contents
            list = new List <ProjectItemInstance>();
            foreach (ProjectItemInstance item in items)
            {
                list.Add(item);
            }

            list.Sort(ProjectItemInstanceComparer);
            Assert.Equal(item1, list[0]);
            Assert.Equal(item2, list[1]);
            Assert.Equal(item3, list[2]);

            // Direct operations on the enumerator
            using (IEnumerator <ProjectItemInstance> enumerator = items.GetEnumerator())
            {
                Assert.Equal(null, enumerator.Current);
                Assert.Equal(true, enumerator.MoveNext());
                Assert.NotNull(enumerator.Current);
                enumerator.Reset();
                Assert.Equal(null, enumerator.Current);
                Assert.Equal(true, enumerator.MoveNext());
                Assert.NotNull(enumerator.Current);
            }
        }