Beispiel #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = PageSizeSet.GetHashCode();
         hashCode = (hashCode * 397) ^ (Query != null ? Query.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TotalSize != null ? TotalSize.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (QueryInputs != null ? QueryInputs.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Start;
         hashCode = (hashCode * 397) ^ (int)AggregationOperation;
         hashCode = (hashCode * 397) ^ (GroupBy != null ? GroupBy.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FieldsToFetch != null ? FieldsToFetch.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SortedFields != null ? SortedFields.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Cutoff.GetHashCode();
         hashCode = (hashCode * 397) ^ (CutoffEtag != null ? CutoffEtag.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DefaultField != null ? DefaultField.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)DefaultOperator;
         hashCode = (hashCode * 397) ^ SkipTransformResults.GetHashCode();
         hashCode = (hashCode * 397) ^ (SkippedResults != null ? SkippedResults.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DebugOptionGetIndexEntries.GetHashCode();
         hashCode = (hashCode * 397) ^ (HighlightedFields != null ? HighlightedFields.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (HighlighterPreTags != null ? HighlighterPreTags.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (HighlighterPostTags != null ? HighlighterPostTags.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ResultsTransformer != null ? ResultsTransformer.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DisableCaching.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = PageSizeSet.GetHashCode();
         hashCode = (hashCode * 397) ^ (Query != null ? Query.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TotalSize != null ? TotalSize.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (TransformerParameters != null ? TransformerParameters.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Start;
         hashCode = (hashCode * 397) ^ (IsDistinct ? 1 : 0);
         hashCode = (hashCode * 397) ^ (FieldsToFetch != null ? FieldsToFetch.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SortedFields != null ? SortedFields.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (SortHints != null ? SortHints.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Cutoff.GetHashCode();
         hashCode = (hashCode * 397) ^ WaitForNonStaleResultsAsOfNow.GetHashCode();
         hashCode = (hashCode * 397) ^ (CutoffEtag != null ? CutoffEtag.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DefaultField != null ? DefaultField.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)DefaultOperator;
         hashCode = (hashCode * 397) ^ (SkippedResults != null ? SkippedResults.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DebugOptionGetIndexEntries.GetHashCode();
         hashCode = (hashCode * 397) ^ (HighlightedFields != null ? HighlightedFields.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (HighlighterPreTags != null ? HighlighterPreTags.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (HighlighterPostTags != null ? HighlighterPostTags.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (HighlighterKeyName != null ? HighlighterKeyName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ResultsTransformer != null ? ResultsTransformer.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ShowTimings ? 1 : 0);
         hashCode = (hashCode * 397) ^ DisableCaching.GetHashCode();
         return(hashCode);
     }
 }
Beispiel #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (FullPath != null ? FullPath.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TotalSize.GetHashCode();
         hashCode = (hashCode * 397) ^ UploadedSize.GetHashCode();
         hashCode = (hashCode * 397) ^ (Metadata != null ? Metadata.GetHashCode() : 0);
         return(hashCode);
     }
 }
Beispiel #4
0
    static void Main(string[] args)
    {
        string[] pathList =
        {
            @"c:\nosuchfileexists",
            @"C:\Temp\test.txt",
            Environment.GetFolderPath(Environment.SpecialFolder.CommonMusic),
            Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
            Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
        };

        TotalSize.Demo(pathList);   // This demo runs multiple paths since it doesn't do much for each one

        /*
         * The Demo()s below all take one path - some of them are long running or produce a lot of output depending on your numbers of files
         *
         */

        string path = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments);

        // Other directories you might want to try
        //      Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
        //      Environment.GetFolderPath(Environment.SpecialFolder.CommonMusic);
        //      Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
        //      Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
        //      @"C:\Users\"

        PrintAll.Demo(path);
        PrintWithSizes.Demo(path);
        PrintDangles.Demo(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)); // UserProfile is a likely place to have many dangling links/shortcuts and will probably take a long time to run
        PrintSubdirSize.Demo(path);
        Sizehash.Demo(path);                                                                 // Set a breakpoint inside of Sizehash.Demo() and use the debugger if you want to explore the tree of Lists/Dictionaries that this creates
        ListOfAllPlainFiles.Demo(path);

        // A new sample that wasn't in the book that I just wanted to try
        string[] photosFileExtensions =
        {
            ".jpg",  ".jpeg", ".jpe", ".jif", ".jfif", ".jfi", // JPEG
            ".jp2",  ".j2k",  ".jpf", ".jpx", ".jpm",  ".mj2", // JPEG 2000
            ".jxr",  ".hdp",  ".wdp",                          // JPEG XR aka HD Photo
            ".heif", ".heic",                                  // HEIF

            // Raw image formats extensions from https://en.wikipedia.org/wiki/Raw_image_format
            ".3fr",  ".ari",  ".arw", ".bay", ".crw",  ".cr2", ".cr3", ".cap", ".data", ".dcs", ".dcr", ".dng", ".drf", ".eip", ".erf", ".fff", ".gpr", ".iiq", ".k25",
            ".kdc",  ".mdc",  ".mef", ".mos", ".mrw",  ".nef", ".nrw", ".obm", ".orf",  ".pef", ".ptx", ".pxn", ".r3d", ".raf", ".raw", ".rwl", ".rw2", ".rwz", ".sr2",
            ".srf",  ".srw",  ".tif", ".x3f"
        };

        PrintFilesFilteredByExtension.Demo(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), photosFileExtensions);

        Console.WriteLine("Press any key to exit");
        Console.ReadKey(true);
    }
Beispiel #5
0
    public static void Demo(string[] pathList)
    {
        Console.WriteLine("\n--------------- Chapter 1.6 TotalSize ---------------");

        TotalSize ts = new TotalSize();

        foreach (string path in pathList)
        {
            Console.WriteLine("Size of {0} = {1:N0} bytes", path, ts.Dir_Walk_Accumulator(path));
        }
        Console.WriteLine();
    }
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = ActiveSize.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)HorizontalSyncFrequencyInMillihertz;
         hashCode = (hashCode * 397) ^ PixelRate.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)ScanLineOrdering;
         hashCode = (hashCode * 397) ^ TotalSize.GetHashCode();
         hashCode = (hashCode * 397) ^ VerticalSyncFrequencyDivider.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)VerticalSyncFrequencyInMillihertz;
         hashCode = (hashCode * 397) ^ (int)VideoStandard;
         return(hashCode);
     }
 }
Beispiel #7
0
        override public bool AddFrame(Stream st)
        {
            long sp = StartPosition + TotalSize;

            System.Console.WriteLine("block écris en " + sp.ToString());
            if (Top.EncodingNeeded(0))
            {
                FileSource.Seek(StartPosition + TotalSize, SeekOrigin.Begin);//on se met la ou on doit ajouter le block encodé



                Top.Encode(st, FileSource, -1, -1);
                BlockMarker(FileSource);//marker de fin de block
                addBlockSize(sp, (FileSource.Position - sp) + 1, 1);
            }
            else
            {
                FileSource.Seek(StartPosition + TotalSize, SeekOrigin.Begin);//on se met la ou on doit ajouter le block encodé

                st.CopyTo(FileSource);
                BlockMarker(FileSource);//marker de fin de block
                addBlockSize(sp, st.Length + 1, 1);
            }
            Console.WriteLine("taille : " + TotalSize.ToString());
            blockCount++;
            if (PredictHit(FileSource) && !Top.MaxBlockCountReach(0, blockCount))
            {
                UpdateHeader(FileSource);
                return(false);//pas de problème
            }
            else
            {
                TerminateBlock(FileSource);
                if (!Top.MaxBlockCountReach(0, blockCount))
                {
                    Console.WriteLine("echec predicteur d=" + Depth + ", on fini avec Totalize=" + TotalSize + "(entre " + FirstFrame + " et " + LastFrame + ")");
                }
                return(true);
            }
        }
Beispiel #8
0
 internal override string GetCsvLine()
 {
     return(base.GetCsvLine() + "," + DriveFormat + "," + DriveType.ToString() + "," + TotalFreeSpace.ToString() + "," + TotalSize.ToString() + "," + VolumeLabel);
 }
Beispiel #9
0
        public int CompareTo(object obj)
        {
            var objTable = (VpaTableViewModel)obj;

            switch (SortColumn)
            {
            case "ColumnCardinality":
                return(RowsCount.CompareTo(objTable.RowsCount) * SortDirection);

            case "TotalSize":
                return(TotalSize.CompareTo(objTable.TotalSize) * SortDirection);

            case "DictionarySize":
                return(DictionarySize.CompareTo(objTable.DictionarySize) * SortDirection);

            case "DataSize":
                return(DataSize.CompareTo(objTable.DataSize) * SortDirection);

            case "HierarchiesSize":
                return(HierarchiesSize.CompareTo(objTable.HierarchiesSize) * SortDirection);

            case "TableSize":
                return(TableSize.CompareTo(objTable.TableSize) * SortDirection);

            case "PercentageDatabase":
                return(PercentageDatabase.CompareTo(objTable.PercentageDatabase) * SortDirection);

            case "SegmentsNumber":
                return(SegmentsNumber.CompareTo(objTable.SegmentsNumber) * SortDirection);

            case "PartitionsNumber":
                return(PartitionsNumber.CompareTo(objTable.PartitionsNumber) * SortDirection);

            case "ColumnsNumber":
                return(ColumnsNumber.CompareTo(objTable.ColumnsNumber) * SortDirection);

            case "ReferentialIntegrityViolationCount":
                return(ReferentialIntegrityViolationCount.CompareTo(objTable.ReferentialIntegrityViolationCount) * SortDirection);

            case "UserHierarchiesSize":
                return(UserHierarchiesSize.CompareTo(objTable.UserHierarchiesSize) * SortDirection);

            case "RelationshipSize":
                return(RelationshipSize.CompareTo(objTable.RelationshipSize) * SortDirection);

            case "RowsCount":
                return(RowsCount.CompareTo(objTable.RowsCount) * SortDirection);

            case "MissingKeys":
                return(RelationshipFromMissingKeys.CompareTo(objTable.RelationshipFromMissingKeys) * SortDirection);

            case "FromColumnCardinality":
                return(RelationshipMaxFromCardinality.CompareTo(objTable.RelationshipMaxFromCardinality) * SortDirection);

            case "ToColumnCardinality":
                return(RelationshipMaxToCardinality.CompareTo(objTable.RelationshipMaxToCardinality) * SortDirection);

            case "InvalidRows":
                return(RelationshipInvalidRows.CompareTo(objTable.RelationshipInvalidRows) * SortDirection);

            case "UsedSize":
                return(RelationshipSize.CompareTo(objTable.RelationshipSize) * SortDirection);

            default:
                return(TableName.CompareTo(objTable.TableName) * SortDirection);
            }
        }
Beispiel #10
0
 /// <summary>
 /// Returns a <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
 /// </summary>
 /// <returns>
 /// A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
 /// </returns>
 /// <filterpriority>2</filterpriority>
 public override string ToString()
 {
     return(string.Format("[{0}] {1} {2}", Index.ToString("00"), Name, IsFolder ? "[文件夹]" : TotalSize.ToSizeDesc()));
 }
Beispiel #11
0
 public override string ToString()
 {
     return($"{Count,6} {TotalSize.ToString("#,#"),11}  {MethodTable}  {Name}");
 }
Beispiel #12
0
        //-----------------------------------------------------------------------------------
        static void Main(string[] args)
        {
            int    select = 0;
            double TotalSize;
            double OneFileSize;
            bool   noExit = true;

            Console.CursorVisible = true;

            Console.Write("Input the total size(Gb): ");
            TotalSize = Convert.ToDouble(Console.ReadLine());
            Console.SetCursorPosition(26 + TotalSize.ToString().Length, 0);
            Console.WriteLine("Gb");

            Console.Write("Input the size of one file(Mb): ");
            OneFileSize = Convert.ToDouble(Console.ReadLine());
            Console.SetCursorPosition(32 + OneFileSize.ToString().Length, 1);
            Console.WriteLine("Mb");

            Console.CursorVisible = false;
            Console.WriteLine("\nCreate storage");

            while (noExit)
            {
                MenuOfStorage(select);

                Console.Write("Capacity: ");
                if (Capacity() < (TotalSize * 1000))
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                }
                Console.WriteLine(Capacity());
                Console.ForegroundColor = ConsoleColor.Gray;

                var key = Console.ReadKey(true).Key;

                switch (key)
                {
                case ConsoleKey.UpArrow:
                    if (select > 0)
                    {
                        select--;
                    }
                    break;

                case ConsoleKey.DownArrow:
                    if (select < storage.Length - 1)
                    {
                        select++;
                    }
                    break;

                case ConsoleKey.Enter:
                    if (select == 0)
                    {
                        CreateFlash();
                    }
                    else
                    if (select == 1)
                    {
                        CreateDVD();
                    }
                    else
                    if (select == 2)
                    {
                        CreateHDD();
                    }
                    break;

                case ConsoleKey.Escape:
                    noExit = false;
                    Console.Clear();
                    break;
                }
            }

            Console.WriteLine($"Total size: ");

            if (Capacity() < (TotalSize * 1000))
            {
                Console.ForegroundColor = ConsoleColor.Red;
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Green;
            }
            Console.WriteLine(Capacity());
            Console.ForegroundColor = ConsoleColor.Gray;

            Console.WriteLine();

            Console.WriteLine($"Copy by: {GetTotalTime()}");

            if (st.Count < 1)
            {
                Console.WriteLine("");
            }

            //while (true)
            //{
            //   Menu(select);

            //   var key = Console.ReadKey(true).Key;

            //   switch (key)
            //   {
            //       case ConsoleKey.UpArrow:
            //           if (select > 0)
            //               select--;
            //           break;
            //       case ConsoleKey.DownArrow:
            //           if (select < menuName.Length - 1)
            //               select++;
            //           break;
            //       case ConsoleKey.Enter:
            //           if (select == 0)
            //           {

            //           }
            //           break;
            //   }
            //}
        }
Beispiel #13
0
 public override string ToString()
 {
     return("[P2Pv1Header]\r\n" +
            String.Format(System.Globalization.CultureInfo.InvariantCulture, "SessionId     : {1:x} ({0})\r\n", SessionId.ToString(System.Globalization.CultureInfo.InvariantCulture), SessionId) +
            String.Format(System.Globalization.CultureInfo.InvariantCulture, "Identifier    : {1:x} ({0})\r\n", Identifier.ToString(System.Globalization.CultureInfo.InvariantCulture), Identifier) +
            String.Format(System.Globalization.CultureInfo.InvariantCulture, "Offset        : {1:x} ({0})\r\n", Offset.ToString(System.Globalization.CultureInfo.InvariantCulture), Offset) +
            String.Format(System.Globalization.CultureInfo.InvariantCulture, "TotalSize     : {1:x} ({0})\r\n", TotalSize.ToString(System.Globalization.CultureInfo.InvariantCulture), TotalSize) +
            String.Format(System.Globalization.CultureInfo.InvariantCulture, "MessageSize   : {1:x} ({0})\r\n", MessageSize.ToString(System.Globalization.CultureInfo.InvariantCulture), MessageSize) +
            String.Format(System.Globalization.CultureInfo.InvariantCulture, "Flags         : {1:x} ({0})\r\n", (uint)Flags, Convert.ToString(Flags)) +
            String.Format(System.Globalization.CultureInfo.InvariantCulture, "AckSessionId  : {1:x} ({0})\r\n", AckSessionId.ToString(System.Globalization.CultureInfo.InvariantCulture), AckSessionId) +
            String.Format(System.Globalization.CultureInfo.InvariantCulture, "AckIdentifier : {1:x} ({0})\r\n", AckIdentifier.ToString(System.Globalization.CultureInfo.InvariantCulture), AckIdentifier) +
            String.Format(System.Globalization.CultureInfo.InvariantCulture, "AckTotalSize  : {1:x} ({0})\r\n", AckTotalSize.ToString(System.Globalization.CultureInfo.InvariantCulture), AckTotalSize));
 }
 public static ObjectAssertions HaveTotalSize(this ObjectAssertions objectAssertions, int totalSize)
 {
     (objectAssertions.Subject as CacheStatistics) !.TotalSize.Should().Be(totalSize);
     return(objectAssertions);
 }