コード例 #1
0
        public int[] GetLinesFromCommand(HtmlAgilityPack.HtmlNode htmlNode, string commandName)
        {
            if (htmlNode == null)
            {
                return null;
            }

            var text = htmlNode.InnerText;
            text = text.Replace("<!--", string.Empty).Replace("-->", string.Empty);
            var command = text.Split(';').Where(s => s.Trim().StartsWith(commandName)).FirstOrDefault();

            if (command == null)
            {
                return null;
            }

            try
            {
                var arguments = command.Split(':')[1];
                var lineRanges = arguments.Split(',');
                var lineSet = new System.Collections.Generic.SortedSet<int>();

                foreach (var range in lineRanges)
                {
                    this.ParseRange(lineSet, range);
                }

                return lineSet.ToArray();
            }
            catch
            {
                return null;
            }
        }
コード例 #2
0
        public uint Add(TagsCollectionBase tags)
        {
            if (tags == null)
            {
                return(0);
            }
            if (tags.Count == 0)
            {
                return(1);
            }
            if (this._isReadonly)
            {
                throw new InvalidOperationException("This tags index is readonly. Check IsReadonly.");
            }
            System.Collections.Generic.SortedSet <long> sortedSet = new System.Collections.Generic.SortedSet <long>();
            foreach (Tag tag in tags)
            {
                sortedSet.Add((long)this.AddString(tag.Key, true) + (long)int.MaxValue * (long)this.AddString(tag.Value, false));
            }
            int[] collection = new int[sortedSet.Count * 2];
            int   index1     = 0;

            foreach (long num in sortedSet)
            {
                collection[index1] = (int)(num % (long)int.MaxValue);
                int index2 = index1 + 1;
                collection[index2] = (int)(num / (long)int.MaxValue);
                index1             = index2 + 1;
            }
            return(this.AddCollection(collection));
        }
コード例 #3
0
ファイル: Common.cs プロジェクト: shosca/Dry.Common
        public static string ToCacheKey(this DictHelper.MonoRailDictionary dict)
        {
            var list = new System.Collections.Generic.SortedSet <string>();

            foreach (var k in dict.Keys)
            {
                list.Add(k + "=" + dict[k]);
            }
            return(string.Join("&", list));
        }
コード例 #4
0
        //Directory.CreateDirectory(tag_path.Text);
        //tag_path.Text = base_hash(base_dir.Text, string.Join(link_sym, sortSet.ToArray()));
        //ArrayList arrayList = new ArrayList();
        //ArrayList copy;
        //ArrayList __new;
        //foreach (string tag in sortSet)
        //{
        //    copy = arrayList.Clone() as ArrayList;
        //    for (int i = 0; i < arrayList.Count; i++)
        //    {
        //        (arrayList[i] as ArrayList).Add(tag);
        //    }
        //    __new = new ArrayList();
        //    __new.Add(tag);
        //    arrayList.Add(__new);
        //}
        void creatSaveDirectory()
        {
            System.Collections.Generic.SortedSet <string> set = new System.Collections.Generic.SortedSet <string>(sortSet);
            string path = base_hash(base_dir.Text, string.Join(link_sym, set));

            if (!Directory.Exists(path))
            {
                CreateDirectory1_(path, string.Join(link_sym, set));
                creatSaveDirectory__(set);
            }
        }
コード例 #5
0
        public System.Collections.Generic.SortedSet <PropertyDefinition> UpdateDefinitions(CategoryDTO category)
        {
            var definitions        = category.Definitions;
            var updatedDefinitions = new System.Collections.Generic.SortedSet <PropertyDefinition>();

            foreach (var def in definitions)
            {
                //TODO: we are only retrieving again, because a bug where the definition values are not sent over the wire
                var definition = _dao.FindByPK <PropertyDefinition>(typeof(PropertyDefinition), def.FullKey);
                updatedDefinitions.Add(definition);
                string value;
                if (!category.ValuesToSave.TryGetValue(definition.FullKey, out value))
                {
                    //we didn´t touch at these definitions
                    continue;
                }
                var condition = category.Condition == null ? null : category.Condition.RealCondition;

                var propValue = _dao.FindSingleByQuery <PropertyValue>(PropertyValue.ByDefinitionConditionModuleProfile, definition.FullKey,
                                                                       condition, category.Module.Id, category.UserProfile);
                if (propValue != null)
                {
                    UpdateFoundValue(definition, value, propValue);
                }
                else if (value != null)
                {
                    propValue = _dao.Save(new PropertyValue {
                        Definition  = definition,
                        Module      = category.Module.Id,
                        UserProfile = category.UserProfile,
                        Condition   = condition,
                        StringValue = value
                    });
                    if (definition.Values == null)
                    {
                        definition.Values = new HashedSet <PropertyValue>();
                    }
                    definition.Values.Add(propValue);
                    ConcurrentDictionary <ContextHolder, object> fromContext;
                    if (ConfigCache.TryGetValue(definition.FullKey, out fromContext))
                    {
                        //clear entire cache of definion
                        fromContext.Clear();
                    }
                }
            }

            return(updatedDefinitions);
        }
コード例 #6
0
        /// <summary>Determines all domain types that have value sets for the supplied version.</summary>
        /// <remarks>Determines all domain types that have value sets for the supplied version.</remarks>
        /// <param name="dao">the code set DAO</param>
        /// <param name="version">the value set version to use</param>
        /// <returns>the set of domain types as strings</returns>
        private ICollection <string> DetermineAllDomains(CodeSetDao dao, string version)
        {
            // use version to determine all applicable ValueSets
            IList <ValueSet> valueSets = dao.SelectValueSetsByVersion(version);
            // pull out all VocabularyDomains referenced by the value sets
            ICollection <string> domainTypes = new System.Collections.Generic.SortedSet <string>();

            foreach (ValueSet valueSet in valueSets)
            {
                ICollection <VocabularyDomain> vocabularyDomains = valueSet.VocabularyDomains;
                foreach (VocabularyDomain vocabularyDomain in vocabularyDomains)
                {
                    domainTypes.Add(vocabularyDomain.Type);
                }
            }
            return(domainTypes);
        }
コード例 #7
0
 public System.Collections.Generic.List <string> Permutation(string str)
 {
     System.Collections.Generic.SortedSet <string> lst = new System.Collections.Generic.SortedSet <string>();
     if (str.Length == 0)
     {
         return(lst.ToList());
     }
     if (str.Length == 1)
     {
         lst.Add(str);
         return(lst.ToList());
     }
     System.Collections.Generic.List <int> pivotes = new System.Collections.Generic.List <int>();
     for (var i = 0; i < str.Length; ++i)
     {
         Permutation(str, i, "", pivotes, lst);
     }
     return(lst.ToList());
 }
コード例 #8
0
            void Permutation(string str, int pivot, string path
                             , System.Collections.Generic.List <int> pivotes
                             , System.Collections.Generic.SortedSet <string> lst)
            {
                var pChar = str[pivot];

                if (path.Length + 1 == str.Length)
                {
                    lst.Add(path + pChar);
                    return;
                }
                pivotes.Add(pivot);
                for (int i = 0; i < str.Length; ++i)
                {
                    if (pivotes.Contains(i))
                    {
                        continue;
                    }
                    Permutation(str, i, path + pChar, pivotes, lst);
                }
                pivotes.RemoveAt(pivotes.Count - 1);
            }
コード例 #9
0
 public PINRedBlackTree(ILog log)
 {
     RBTree = new SortedSet <int>();
 }
コード例 #10
0
    public void Populate()
    {
        #region Types of Keywords

        FieldPublicDynamic = new { PropPublic1 = "A", PropPublic2 = 1, PropPublic3 = "B", PropPublic4 = "B", PropPublic5 = "B", PropPublic6 = "B", PropPublic7 = "B", PropPublic8 = "B", PropPublic9 = "B", PropPublic10 = "B", PropPublic11 = "B", PropPublic12 = new { PropSubPublic1 = 0, PropSubPublic2 = 1, PropSubPublic3 = 2 } };
        FieldPublicObject  = new StringBuilder("Object - StringBuilder");
        FieldPublicInt32   = int.MaxValue;
        FieldPublicInt64   = long.MaxValue;
        FieldPublicULong   = ulong.MaxValue;
        FieldPublicUInt    = uint.MaxValue;
        FieldPublicDecimal = 100000.999999m;
        FieldPublicDouble  = 100000.999999d;
        FieldPublicChar    = 'A';
        FieldPublicByte    = byte.MaxValue;
        FieldPublicBoolean = true;
        FieldPublicSByte   = sbyte.MaxValue;
        FieldPublicShort   = short.MaxValue;
        FieldPublicUShort  = ushort.MaxValue;
        FieldPublicFloat   = 100000.675555f;

        FieldPublicInt32Nullable   = int.MaxValue;
        FieldPublicInt64Nullable   = 2;
        FieldPublicULongNullable   = ulong.MaxValue;
        FieldPublicUIntNullable    = uint.MaxValue;
        FieldPublicDecimalNullable = 100000.999999m;
        FieldPublicDoubleNullable  = 100000.999999d;
        FieldPublicCharNullable    = 'A';
        FieldPublicByteNullable    = byte.MaxValue;
        FieldPublicBooleanNullable = true;
        FieldPublicSByteNullable   = sbyte.MaxValue;
        FieldPublicShortNullable   = short.MaxValue;
        FieldPublicUShortNullable  = ushort.MaxValue;
        FieldPublicFloatNullable   = 100000.675555f;

        #endregion

        #region System

        FieldPublicDateTime         = new DateTime(2000, 1, 1, 1, 1, 1);
        FieldPublicTimeSpan         = new TimeSpan(1, 10, 40);
        FieldPublicEnumDateTimeKind = DateTimeKind.Local;

        // Instantiate date and time using Persian calendar with years,
        // months, days, hours, minutes, seconds, and milliseconds
        FieldPublicDateTimeOffset = new DateTimeOffset(1387, 2, 12, 8, 6, 32, 545,
                                                       new System.Globalization.PersianCalendar(),
                                                       new TimeSpan(1, 0, 0));

        FieldPublicIntPtr         = new IntPtr(100);
        FieldPublicTimeZone       = TimeZone.CurrentTimeZone;
        FieldPublicTimeZoneInfo   = TimeZoneInfo.Utc;
        FieldPublicTuple          = Tuple.Create <string, int, decimal>("T-string\"", 1, 1.1m);
        FieldPublicType           = typeof(object);
        FieldPublicUIntPtr        = new UIntPtr(100);
        FieldPublicUri            = new Uri("http://www.site.com");
        FieldPublicVersion        = new Version(1, 0, 100, 1);
        FieldPublicGuid           = new Guid("d5010f5b-0cd1-44ca-aacb-5678b9947e6c");
        FieldPublicSingle         = Single.MaxValue;
        FieldPublicException      = new Exception("Test error", new Exception("inner exception"));
        FieldPublicEnumNonGeneric = EnumTest.ValueA;
        FieldPublicAction         = () => true.Equals(true);
        FieldPublicAction2        = (a, b) => true.Equals(true);
        FieldPublicFunc           = () => true;
        FieldPublicFunc2          = (a, b) => true;

        #endregion

        #region Arrays and Collections

        FieldPublicArrayUni    = new string[2];
        FieldPublicArrayUni[0] = "[0]";
        FieldPublicArrayUni[1] = "[1]";

        FieldPublicArrayTwo       = new string[2, 2];
        FieldPublicArrayTwo[0, 0] = "[0, 0]";
        FieldPublicArrayTwo[0, 1] = "[0, 1]";
        FieldPublicArrayTwo[1, 0] = "[1, 0]";
        FieldPublicArrayTwo[1, 1] = "[1, 1]";

        FieldPublicArrayThree          = new string[1, 1, 2];
        FieldPublicArrayThree[0, 0, 0] = "[0, 0, 0]";
        FieldPublicArrayThree[0, 0, 1] = "[0, 0, 1]";

        FieldPublicJaggedArrayTwo    = new string[2][];
        FieldPublicJaggedArrayTwo[0] = new string[5] {
            "a", "b", "c", "d", "e"
        };
        FieldPublicJaggedArrayTwo[1] = new string[4] {
            "a1", "b1", "c1", "d1"
        };

        FieldPublicJaggedArrayThree          = new string[1][][];
        FieldPublicJaggedArrayThree[0]       = new string[1][];
        FieldPublicJaggedArrayThree[0][0]    = new string[2];
        FieldPublicJaggedArrayThree[0][0][0] = "[0][0][0]";
        FieldPublicJaggedArrayThree[0][0][1] = "[0][0][1]";

        FieldPublicMixedArrayAndJagged = new int[3][, ]
        {
            new int[, ] {
                { 1, 3 }, { 5, 7 }
            },
            new int[, ] {
                { 0, 2 }, { 4, 6 }, { 8, 10 }
            },
            new int[, ] {
                { 11, 22 }, { 99, 88 }, { 0, 9 }
            }
        };

        FieldPublicDictionary = new System.Collections.Generic.Dictionary <string, string>();
        FieldPublicDictionary.Add("Key1", "Value1");
        FieldPublicDictionary.Add("Key2", "Value2");
        FieldPublicDictionary.Add("Key3", "Value3");
        FieldPublicDictionary.Add("Key4", "Value4");

        FieldPublicList = new System.Collections.Generic.List <int>();
        FieldPublicList.Add(0);
        FieldPublicList.Add(1);
        FieldPublicList.Add(2);

        FieldPublicQueue = new System.Collections.Generic.Queue <int>();
        FieldPublicQueue.Enqueue(10);
        FieldPublicQueue.Enqueue(11);
        FieldPublicQueue.Enqueue(12);

        FieldPublicHashSet = new System.Collections.Generic.HashSet <string>();
        FieldPublicHashSet.Add("HashSet1");
        FieldPublicHashSet.Add("HashSet2");

        FieldPublicSortedSet = new System.Collections.Generic.SortedSet <string>();
        FieldPublicSortedSet.Add("SortedSet1");
        FieldPublicSortedSet.Add("SortedSet2");
        FieldPublicSortedSet.Add("SortedSet3");

        FieldPublicStack = new System.Collections.Generic.Stack <string>();
        FieldPublicStack.Push("Stack1");
        FieldPublicStack.Push("Stack2");
        FieldPublicStack.Push("Stack3");

        FieldPublicLinkedList = new System.Collections.Generic.LinkedList <string>();
        FieldPublicLinkedList.AddFirst("LinkedList1");
        FieldPublicLinkedList.AddLast("LinkedList2");
        FieldPublicLinkedList.AddAfter(FieldPublicLinkedList.Find("LinkedList1"), "LinkedList1.1");

        FieldPublicObservableCollection = new System.Collections.ObjectModel.ObservableCollection <string>();
        FieldPublicObservableCollection.Add("ObservableCollection1");
        FieldPublicObservableCollection.Add("ObservableCollection2");

        FieldPublicKeyedCollection = new MyDataKeyedCollection();
        FieldPublicKeyedCollection.Add(new MyData()
        {
            Data = "data1", Id = 0
        });
        FieldPublicKeyedCollection.Add(new MyData()
        {
            Data = "data2", Id = 1
        });

        var list = new List <string>();
        list.Add("list1");
        list.Add("list2");
        list.Add("list3");

        FieldPublicReadOnlyCollection = new ReadOnlyCollection <string>(list);

        FieldPublicReadOnlyDictionary           = new ReadOnlyDictionary <string, string>(FieldPublicDictionary);
        FieldPublicReadOnlyObservableCollection = new ReadOnlyObservableCollection <string>(FieldPublicObservableCollection);
        FieldPublicCollection = new Collection <string>();
        FieldPublicCollection.Add("collection1");
        FieldPublicCollection.Add("collection2");
        FieldPublicCollection.Add("collection3");

        FieldPublicArrayListNonGeneric = new System.Collections.ArrayList();
        FieldPublicArrayListNonGeneric.Add(1);
        FieldPublicArrayListNonGeneric.Add("a");
        FieldPublicArrayListNonGeneric.Add(10.0m);
        FieldPublicArrayListNonGeneric.Add(new DateTime(2000, 01, 01));

        FieldPublicBitArray    = new System.Collections.BitArray(3);
        FieldPublicBitArray[2] = true;

        FieldPublicSortedList = new System.Collections.SortedList();
        FieldPublicSortedList.Add("key1", 1);
        FieldPublicSortedList.Add("key2", 2);
        FieldPublicSortedList.Add("key3", 3);
        FieldPublicSortedList.Add("key4", 4);

        FieldPublicHashtableNonGeneric = new System.Collections.Hashtable();
        FieldPublicHashtableNonGeneric.Add("key1", 1);
        FieldPublicHashtableNonGeneric.Add("key2", 2);
        FieldPublicHashtableNonGeneric.Add("key3", 3);
        FieldPublicHashtableNonGeneric.Add("key4", 4);

        FieldPublicQueueNonGeneric = new System.Collections.Queue();
        FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric1");
        FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric2");
        FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric3");

        FieldPublicStackNonGeneric = new System.Collections.Stack();
        FieldPublicStackNonGeneric.Push("StackNonGeneric1");
        FieldPublicStackNonGeneric.Push("StackNonGeneric2");

        FieldPublicIEnumerable = FieldPublicSortedList;

        FieldPublicBlockingCollection = new System.Collections.Concurrent.BlockingCollection <string>();
        FieldPublicBlockingCollection.Add("BlockingCollection1");
        FieldPublicBlockingCollection.Add("BlockingCollection2");

        FieldPublicConcurrentBag = new System.Collections.Concurrent.ConcurrentBag <string>();
        FieldPublicConcurrentBag.Add("ConcurrentBag1");
        FieldPublicConcurrentBag.Add("ConcurrentBag2");
        FieldPublicConcurrentBag.Add("ConcurrentBag3");

        FieldPublicConcurrentDictionary = new System.Collections.Concurrent.ConcurrentDictionary <string, int>();
        FieldPublicConcurrentDictionary.GetOrAdd("ConcurrentDictionary1", 0);
        FieldPublicConcurrentDictionary.GetOrAdd("ConcurrentDictionary2", 0);

        FieldPublicConcurrentQueue = new System.Collections.Concurrent.ConcurrentQueue <string>();
        FieldPublicConcurrentQueue.Enqueue("ConcurrentQueue1");
        FieldPublicConcurrentQueue.Enqueue("ConcurrentQueue2");

        FieldPublicConcurrentStack = new System.Collections.Concurrent.ConcurrentStack <string>();
        FieldPublicConcurrentStack.Push("ConcurrentStack1");
        FieldPublicConcurrentStack.Push("ConcurrentStack2");

        // FieldPublicOrderablePartitioner = new OrderablePartitioner();
        // FieldPublicPartitioner;
        // FieldPublicPartitionerNonGeneric;

        FieldPublicHybridDictionary = new System.Collections.Specialized.HybridDictionary();
        FieldPublicHybridDictionary.Add("HybridDictionaryKey1", "HybridDictionary1");
        FieldPublicHybridDictionary.Add("HybridDictionaryKey2", "HybridDictionary2");

        FieldPublicListDictionary = new System.Collections.Specialized.ListDictionary();
        FieldPublicListDictionary.Add("ListDictionaryKey1", "ListDictionary1");
        FieldPublicListDictionary.Add("ListDictionaryKey2", "ListDictionary2");
        FieldPublicNameValueCollection = new System.Collections.Specialized.NameValueCollection();
        FieldPublicNameValueCollection.Add("Key1", "Value1");
        FieldPublicNameValueCollection.Add("Key2", "Value2");

        FieldPublicOrderedDictionary = new System.Collections.Specialized.OrderedDictionary();
        FieldPublicOrderedDictionary.Add(1, "OrderedDictionary1");
        FieldPublicOrderedDictionary.Add(2, "OrderedDictionary1");
        FieldPublicOrderedDictionary.Add("OrderedDictionaryKey2", "OrderedDictionary2");

        FieldPublicStringCollection = new System.Collections.Specialized.StringCollection();
        FieldPublicStringCollection.Add("StringCollection1");
        FieldPublicStringCollection.Add("StringCollection2");

        #endregion

        #region Several

        PropXmlDocument = new XmlDocument();
        PropXmlDocument.LoadXml("<xml>something</xml>");

        var tr = new StringReader("<Root>Content</Root>");
        PropXDocument         = XDocument.Load(tr);
        PropStream            = GenerateStreamFromString("Stream");
        PropBigInteger        = new System.Numerics.BigInteger(100);
        PropStringBuilder     = new StringBuilder("StringBuilder");
        FieldPublicIQueryable = new List <string>()
        {
            "IQueryable"
        }.AsQueryable();

        #endregion

        #region Custom

        FieldPublicMyCollectionPublicGetEnumerator           = new MyCollectionPublicGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionInheritsPublicGetEnumerator   = new MyCollectionInheritsPublicGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionExplicitGetEnumerator         = new MyCollectionExplicitGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionInheritsExplicitGetEnumerator = new MyCollectionInheritsExplicitGetEnumerator("a b c", new char[] { ' ' });
        FieldPublicMyCollectionInheritsTooIEnumerable        = new MyCollectionInheritsTooIEnumerable("a b c", new char[] { ' ' });

        FieldPublicEnumSpecific = EnumTest.ValueB;
        MyDelegate            = MethodDelegate;
        EmptyClass            = new EmptyClass();
        StructGeneric         = new ThreeTuple <int>(0, 1, 2);
        StructGenericNullable = new ThreeTuple <int>(0, 1, 2);
        FieldPublicNullable   = new Nullable <ThreeTuple <int> >(StructGeneric);

        #endregion
    }
コード例 #11
0
        /// <summary>
        /// Generates thumbnails for all video files in a directory (and its subdirectories).
        /// </summary>
        /// <param name="path">The path of videos directory.</param>
        /// <param name="cmdline">The initial command line.</param>
        /// <param name="dontLog">if set to <c>true</c> don't log progress messages.</param>
        private void ProcessDirectory(string path, string cmdline, bool dontLog)
        {
            string logFile = System.IO.Path.Combine (path, "CLAutoThumbnailer.log");

            // First process subdirectories
            string [] directories = System.IO.Directory.GetDirectories (path);
            foreach (string subDir in directories)
                ProcessDirectory (subDir, cmdline, false);

            // See if this directory has already been processed by looking for subdir
            if (_tnSettings.SubDirectory != "")
                {
                string subdir = _tnSettings.SubDirectory.ToLower ().Trim ();
                subdir = System.IO.Path.Combine (path, subdir);
                if (System.IO.Directory.Exists (subdir))
                    {
                    if (!dontLog)
                        THelper.AddTextLogger (logFile, path);
                    THelper.Information ("{0} : {1} already contains \"{2}\" sub-directory.",
                                         DateTime.Now, path, _tnSettings.SubDirectory);
                    if (!dontLog)
                        THelper.RemoveTextLogger (path);
                    return;
                    }
                }

            // See if this directory has already been processed by looking for filepattern
            string [] files = System.IO.Directory.GetFiles (path);
            foreach (string file in files)
                {
                if (_jpegRE.IsMatch (file))
                    {
                    if (!dontLog)
                        THelper.AddTextLogger (logFile, path);
                    THelper.Information ("{0} : {1} already contains thumbnails.",
                                         DateTime.Now, path);
                    if (!dontLog)
                        THelper.RemoveTextLogger (path);
                    return;
                    }
                }

            System.Collections.Generic.SortedSet<string> videoFiles =
                new System.Collections.Generic.SortedSet<string> ();

            foreach (string file in files)
                {
                if (_videoRE.IsMatch (file))
                    {
                    System.IO.FileInfo fi = new System.IO.FileInfo (file);
                    if (fi.Length > _minFileSize)
                        videoFiles.Add (file);
                    }
                }

            if (videoFiles.Count > 0)
                {
                if (!dontLog)
                    THelper.AddTextLogger (logFile, path);
                DateTime start = DateTime.Now;
                THelper.Information ("{0} : Processing directory {1}",
                    start, path);
                THelper.Debug ("Command Line: {0}", cmdline);

                foreach (string file in videoFiles)
                    {
                    TimeSpan originalStart = _tnSettings.Start;
                    TimeSpan originalEnd = _tnSettings.End;

                    List<string> localFiles = CreateFileList (file);
                    ProcessFiles (localFiles, null, _outputDirectory);

                    _tnSettings.Start = originalStart;
                    _tnSettings.End = originalEnd;
                    }

                DateTime end = DateTime.Now;
                THelper.Information ("{0} : Done processing directory {1}",
                    end, path);
                THelper.Information ("{0} Total time.",
                    (end - start).ToString (@"h\:mm\:ss"));
                THelper.Information ();

                if (!dontLog)
                    THelper.RemoveTextLogger (path);
                }
        }
コード例 #12
0
        /// <summary>
        /// Generates a command file that can be used to automatically specify run options.
        /// </summary>
        /// <param name="sw">The <see cref="System.IO.StreamWriter"/> to write to.</param>
        /// <param name="path">The directory that contains videos for which entries
        /// will be added to the command file.</param>
        /// <param name="baseDir">The prefix string that will be removed from all
        /// video filename paths in the command file.</param>
        private void GenerateCommandFile(System.IO.StreamWriter sw, 
            string path, string baseDir)
        {
            // First process subdirectories
            string [] directories = System.IO.Directory.GetDirectories (path);
            foreach (string subDir in directories)
                GenerateCommandFile (sw, subDir, baseDir);

            string [] files = System.IO.Directory.GetFiles (path);

            // See if this directory has already been processed
            string alreadyHasOverview = "";
            foreach (string file in files)
                {
                if (_overviewRE.IsMatch (file))
                    {
                    alreadyHasOverview = "#";
                    break;
                    }
                }

            System.Collections.Generic.SortedSet<string> videoFiles =
                new System.Collections.Generic.SortedSet<string> ();

            foreach (string file in files)
                {
                if (_videoRE.IsMatch (file))
                    {
                    System.IO.FileInfo fi = new System.IO.FileInfo (file);
                    if (fi.Length > 100 * 1024 * 1024)
                        videoFiles.Add (file);
                    }
                }

            baseDir = baseDir + "\\";
            if (videoFiles.Count > 0)
                {
                THelper.Information ("Generating command file entries for {0}",
                                     path);
                foreach (string file in videoFiles)
                    {
                    string relativePath = file.Replace (baseDir, "");
                    sw.WriteLine ("{0}-i 0 -s 0:0:0 -e \"{1}\"",
                        alreadyHasOverview, relativePath);
                    }
                }
        }
コード例 #13
0
 public SortedSet(IEnumerable <T> collection, IComparer <T> comparer)
 {
     sortedSet      = new System.Collections.Generic.SortedSet <T>(collection, comparer);
     Implementation = sortedSet;
 }