diff --git a/Base.lproj/MainMenu.xib b/Base.lproj/MainMenu.xib new file mode 100644 index 0000000..348f392 --- /dev/null +++ b/Base.lproj/MainMenu.xib @@ -0,0 +1,853 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib deleted file mode 100644 index 77ea6d6..0000000 --- a/English.lproj/MainMenu.xib +++ /dev/null @@ -1,4544 +0,0 @@ - - - - 1060 - 10J567 - 823 - 1038.35 - 462.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 823 - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - - NSApplication - - - FirstResponder - - - NSApplication - - - AMainMenu - - - - SubnetCalc - - 1048576 - 2147483647 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - submenuAction: - - SubnetCalc - - - - About SubnetCalc - - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Preferences… - , - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Services - - 1048576 - 2147483647 - - - submenuAction: - - Services - - _NSServicesMenu - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Hide SubnetCalc - h - 1048576 - 2147483647 - - - - - - Hide Others - h - 1572864 - 2147483647 - - - - - - Show All - - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Quit SubnetCalc - q - 1048576 - 2147483647 - - - - - _NSAppleMenu - - - - - Edit - - 1048576 - 2147483647 - - - submenuAction: - - Edit - - - - Cut - x - 1048576 - 2147483647 - - - - - - Copy - c - 1048576 - 2147483647 - - - - - - Paste - v - 1048576 - 2147483647 - - - - - - Delete - - 1048576 - 2147483647 - - - - - - Select All - a - 1048576 - 2147483647 - - - - - - - - - Window - - 1048576 - 2147483647 - - - submenuAction: - - Window - - - - Minimize - m - 1048576 - 2147483647 - - - - - - YES - YES - - - 1048576 - 2147483647 - - - - - - Bring All to Front - - 1048576 - 2147483647 - - - - - _NSWindowsMenu - - - - - Help - - 2147483647 - - - submenuAction: - - Help - - - - SubnetCalc Help - ? - 1048576 - 2147483647 - - - - - _NSHelpMenu - - - - _NSMainMenu - - - 15 - 2 - {{335, 326}, {482, 424}} - 1954021376 - SubnetCalc - NSWindow - - {1.79769e+308, 1.79769e+308} - {482, 424} - - - 256 - - - - 274 - {{13, 10}, {456, 370}} - - - - 1 - - - 256 - - - - 256 - - - - 256 - - - - 258 - {{14, 10}, {392, 26}} - - YES - - -2076049856 - 1024 - - LucidaGrande - 13 - 1044 - - - -2038284033 - 1 - - - - - - 400 - 75 - - - Class A : 1.0.0.0 - 126.255.255.255 - - 1048576 - 2147483647 - 1 - - - _popUpItemAction: - - - YES - - - OtherViews - - - - - - Class B : 128.0.0.0 - 191.255.255.255 - - 1048576 - 2147483647 - - - _popUpItemAction: - - - - - Class C : 192.0.0.0 - 223.255.255.255 - - 1048576 - 2147483647 - - - _popUpItemAction: - - - - - Class D/Multicast : 224.0.0.0 - 239.255.255.255 - - 1048576 - 2147483647 - - - _popUpItemAction: - - - - - 3 - YES - YES - 1 - - - - {{2, 2}, {420, 48}} - - - - {{6, 241}, {424, 68}} - - {0, 0} - - 67239424 - 0 - Address Class Type - - LucidaGrande - 13 - 1558 - - - 6 - System - textBackgroundColor - - 3 - MQA - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 258 - - - - 256 - - - - 258 - {{17, 14}, {386, 22}} - - YES - - -2075001280 - 4195328 - - - - YES - - - 1 - MCAwIDAAA - - - - - {{2, 2}, {420, 50}} - - - - {{6, 167}, {424, 70}} - - {0, 0} - - 67239424 - 0 - Class Bit Map (n=network; s=subnet; h=host) - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 258 - - - - 256 - - - - 258 - {{17, 14}, {386, 22}} - - YES - - -2075001280 - 4195328 - - - - YES - - - - - - {{2, 2}, {420, 50}} - - - - {{6, 93}, {424, 70}} - - {0, 0} - - 67239424 - 0 - Binary - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 258 - - - - 256 - - - - 258 - {{17, 13}, {386, 22}} - - YES - - -2075001280 - 4195328 - - - - YES - - - - - - {{2, 2}, {420, 50}} - - - - {{6, 19}, {424, 70}} - - {0, 0} - - 67239424 - 0 - Hexadecimal - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - {{10, 33}, {436, 324}} - - - Address - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - - - - 2 - - - 256 - - - - 258 - - - - 256 - - - - 258 - {{20, 10}, {144, 26}} - - YES - - 343014976 - 4195328 - - - - - - YES - - - 6 - System - controlTextColor - - 3 - MAA - - - 5 - YES - - - - 274 - {15, 0} - - - YES - - - - 12 - 10 - 1000 - - 75628032 - 0 - - - LucidaGrande - 12 - 16 - - - 3 - MC4zMzMzMzI5ODU2AA - - - - - 338820672 - 1024 - - - YES - - 6 - System - controlBackgroundColor - - - - - 3 - YES - - - - 3 - 2 - - - 6 - System - gridColor - - 3 - MC41AA - - - 19 - tableViewAction: - -767524864 - - - - 1 - -1 - 0 - YES - 0 - - - - - {{2, 2}, {181, 48}} - - - - {{234, 253}, {185, 68}} - - {0, 0} - - 67239424 - 0 - Subnet Mask - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 256 - - - - 256 - - - - 256 - {{14, 10}, {58, 26}} - - YES - - 343014976 - 4195328 - - - - YES - - - 5 - YES - - - - 274 - {15, 0} - - - YES - - - - 12 - 10 - 1000 - - 75628032 - 0 - - - - - - 3 - MC4zMzMzMzI5ODU2AA - - - - - 338820672 - 1024 - - - YES - - - - 3 - YES - - - - 3 - 2 - - - 19 - tableViewAction: - -767524864 - - - - 1 - -1 - 0 - YES - 0 - - - - - {{2, 2}, {83, 48}} - - - - {{17, 253}, {87, 68}} - - {0, 0} - - 67239424 - 0 - Subnet Bits - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 256 - - - - 256 - - - - 256 - {{14, 10}, {58, 26}} - - YES - - 343014976 - 4195328 - - - - YES - - - 5 - YES - - - - 274 - {15, 0} - - - YES - - - - 12 - 10 - 1000 - - 75628032 - 0 - - - - - - 3 - MC4zMzMzMzI5ODU2AA - - - - - 338820672 - 1024 - - - YES - - - - 3 - YES - - - - 3 - 2 - - - 19 - tableViewAction: - -767524864 - - - - 1 - -1 - 0 - YES - 0 - - - - - {{2, 2}, {83, 48}} - - - - {{124, 253}, {87, 68}} - - {0, 0} - - 67239424 - 0 - Mask Bits - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 256 - - - - 256 - - - - 256 - {{20, 10}, {153, 26}} - - YES - - 343014976 - 4195328 - - - - YES - - - 5 - YES - - - - 274 - {15, 0} - - - YES - - - - 12 - 10 - 1000 - - 75628032 - 0 - - - - - - 3 - MC4zMzMzMzI5ODU2AA - - - - - 338820672 - 1024 - - - YES - - - - 3 - YES - - - - 3 - 2 - - - 19 - tableViewAction: - -767524864 - - - - 1 - -1 - 0 - YES - 0 - - - - - {{2, 2}, {190, 48}} - - - - {{17, 174}, {194, 68}} - - {0, 0} - - 67239424 - 0 - Max Subnets - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 258 - - - - 256 - - - - 258 - {{20, 10}, {144, 26}} - - YES - - 343014976 - 4195328 - - - - YES - - - 5 - YES - - - - 274 - {15, 0} - - - YES - - - - 12 - 10 - 1000 - - 75628032 - 0 - - - - - - 3 - MC4zMzMzMzI5ODU2AA - - - - - 338820672 - 1024 - - - YES - - - - 3 - YES - - - - 3 - 2 - - - 19 - tableViewAction: - -767524864 - - - - 1 - -1 - 0 - YES - 0 - - - - - {{2, 2}, {181, 48}} - - - - {{234, 174}, {185, 68}} - - {0, 0} - - 67239424 - 0 - Max Hosts / Subnets - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 258 - - - - 256 - - - - 258 - {{20, 14}, {361, 22}} - - YES - - -2075001280 - 4195328 - - - - YES - - - - - - {{2, 2}, {398, 50}} - - - - {{17, 97}, {402, 70}} - - {0, 0} - - 67239424 - 0 - Subnet Host Address Range - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 256 - - - - 256 - - - - 256 - {{17, 14}, {156, 22}} - - YES - - -2075001280 - 4195328 - - - - YES - - - - - - {{2, 2}, {190, 50}} - - - - {{17, 20}, {194, 70}} - - {0, 0} - - 67239424 - 0 - Subnet ID - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 258 - - - - 256 - - - - 258 - {{17, 14}, {147, 22}} - - YES - - -2075001280 - 4195328 - - - - YES - - - - - - {{2, 2}, {181, 50}} - - - - {{234, 20}, {185, 70}} - - {0, 0} - - 67239424 - 0 - Subnet Broadcast - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - {{10, 33}, {436, 324}} - - Subnets - - - - - - - 256 - - - - 274 - - - - 2304 - - - - 256 - {379, 251} - - YES - - - 256 - {379, 17} - - - - - - 256 - {{380, 0}, {16, 17}} - - - - - numCol - 40 - 40 - 1000 - - 75628096 - 2048 - # - - LucidaGrande - 11 - 3100 - - - 3 - MC4zMzMzMzI5ODU2AA - - - 6 - System - headerTextColor - - - - - 338820672 - 1024 - - - - - - 3 - YES - - - - subnetCol - 88 - 40 - 1000 - - 75628096 - 2048 - Subnet ID - - - - - - 338820672 - 1024 - - - - - - 3 - YES - - - - rangeCol - 131.843994140625 - 36.844001770019531 - 1000 - - 75628096 - 2048 - Range - - - 6 - System - headerColor - - - - - - 338820672 - 1024 - - - - - - 3 - YES - - - - broadcastCol - 107.01300048828125 - 60.01300048828125 - 1000 - - 75628096 - 2048 - Broadcast - - - - - - 338820672 - 1024 - - - - - - 3 - YES - - - - 3 - 2 - - - 17 - -700416000 - - - 1 - -1 - 0 - YES - 0 - - - {{1, 17}, {379, 251}} - - - - - 4 - - - - 256 - {{380, 17}, {15, 251}} - - - _doScroller: - 0.9842105507850647 - - - - 256 - {{1, 268}, {379, 15}} - - 1 - - _doScroller: - 0.974293053150177 - - - - 2304 - - - - {{1, 0}, {379, 17}} - - - - - 4 - - - - {{20, 20}, {396, 284}} - - - 50 - - - - - - QSAAAEEgAABBmAAAQZgAAA - - - {{10, 33}, {436, 324}} - - Subnets/Hosts - - - - - - - 256 - - - - 256 - - - - 256 - - - - 256 - {{14, 10}, {58, 26}} - - YES - - 343014976 - 4195328 - - - - YES - - - 5 - YES - - - - 274 - {15, 0} - - - YES - - - - 12 - 10 - 1000 - - 75628032 - 0 - - - - - - 3 - MC4zMzMzMzI5ODU2AA - - - - - 338820672 - 1024 - - - YES - - - - 3 - YES - - - - 3 - 2 - - - 19 - tableViewAction: - -767524864 - - - - 1 - -1 - 0 - YES - 0 - - - - - {{2, 2}, {83, 48}} - - - - {{17, 253}, {87, 68}} - - {0, 0} - - 67239424 - 0 - Mask Bits - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 258 - - - - 256 - - - - 258 - {{20, 10}, {141, 26}} - - YES - - 343014976 - 4195328 - - - - - - YES - - - 5 - YES - - - - 274 - {15, 0} - - - YES - - - - 12 - 10 - 1000 - - 75628032 - 0 - - - - 3 - MC4zMzMzMzI5ODU2AA - - - - - 338820672 - 1024 - - - YES - - - - 3 - YES - - - - 3 - 2 - - - 19 - tableViewAction: - -767524864 - - - - 1 - -1 - 0 - YES - 0 - - - - - {{2, 2}, {178, 48}} - - - - {{235, 253}, {182, 68}} - - {0, 0} - - 67239424 - 0 - Supernet Mask - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 258 - - - - 256 - - - - 258 - {{20, 10}, {141, 26}} - - YES - - 343014976 - 4195328 - - - - - - YES - - - 5 - YES - - - - 274 - {15, 0} - - - YES - - - - 12 - 10 - 1000 - - 75628032 - 0 - - - - 3 - MC4zMzMzMzI5ODU2AA - - - - - 338820672 - 1024 - - - YES - - - - 3 - YES - - - - 3 - 2 - - - 19 - tableViewAction: - -767524864 - - - - 1 - -1 - 0 - YES - 0 - - - - - {{2, 2}, {178, 48}} - - - - {{235, 175}, {182, 68}} - - {0, 0} - - 67239424 - 0 - Max Addresses - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 256 - - - - 256 - - - - 256 - {{20, 10}, {141, 26}} - - YES - - 343014976 - 4195328 - - - - YES - - - 5 - YES - - - - 274 - {15, 0} - - - YES - - - - 12 - 10 - 1000 - - 75628032 - 0 - - - - - - 3 - MC4zMzMzMzI5ODU2AA - - - - - 338820672 - 1024 - - - YES - - - - 3 - YES - - - - 3 - 2 - - - 19 - tableViewAction: - -767524864 - - - - 1 - -1 - 0 - YES - 0 - - - - - {{2, 2}, {178, 48}} - - - - {{17, 175}, {182, 68}} - - {0, 0} - - 67239424 - 0 - Max Supernets - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 256 - - - - 256 - - - - 256 - {{17, 14}, {144, 22}} - - YES - - -2075001280 - 4195328 - - - - YES - - - - - - {{2, 2}, {178, 50}} - - - - {{17, 16}, {182, 70}} - - {0, 0} - - 67239424 - 0 - Route - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - - 258 - - - - 256 - - - - 258 - {{17, 14}, {362, 22}} - - YES - - -2075001280 - 4195328 - - - - YES - - - - - - {{2, 2}, {396, 50}} - - - - {{17, 95}, {400, 70}} - - {0, 0} - - 67239424 - 0 - Supernet Address Range - - - - 3 - MCAwLjgAA - - - - 3 - 0 - 2 - NO - - - {{10, 33}, {436, 324}} - - CIDR - - - - - - - 0 - YES - YES - - - - - - - 269 - {{169, 382}, {144, 22}} - - YES - - -1804468671 - 1024 - - - - YES - - - 6 - System - textColor - - - - - - - 269 - {{87, 387}, {77, 17}} - - YES - - 67239424 - 4194304 - IP Address - - - - - - - - - 269 - {{315, 377}, {84, 32}} - - YES - - 67239424 - 137887744 - Calc - - - -2038284033 - 1 - - Helvetica - 13 - 16 - - - - - - - - 200 - 25 - - - - {482, 424} - - - {{0, 0}, {1920, 1178}} - {482, 446} - {1.79769e+308, 1.79769e+308} - - - SubnetCalcAppDelegate - - - NSFontManager - - - - - - - performMiniaturize: - - - - 37 - - - - arrangeInFront: - - - - 39 - - - - orderFrontStandardAboutPanel: - - - - 142 - - - - hide: - - - - 367 - - - - hideOtherApplications: - - - - 368 - - - - unhideAllApplications: - - - - 370 - - - - terminate: - - - - 449 - - - - showHelp: - - - - 493 - - - - delegate - - - - 495 - - - - window - - - - 532 - - - - initialFirstResponder - - - - 620 - - - - delegate - - - - 621 - - - - calc: - - - - 622 - - - - changeAddrClassType: - - - - 623 - - - - changeMaskBits: - - - - 624 - - - - changeMaxHosts: - - - - 625 - - - - changeMaxSubnets: - - - - 626 - - - - changeSubnetBits: - - - - 627 - - - - changeSubnetMask: - - - - 628 - - - - changeSupernetMask: - - - - 629 - - - - changeSupernetMaskBits: - - - - 630 - - - - changeSupernetMax: - - - - 631 - - - - changeSupernetMaxAddr: - - - - 632 - - - - addrField - - - - 633 - - - - classBinaryMap - - - - 634 - - - - classBitMap - - - - 635 - - - - classHexaMap - - - - 636 - - - - classType - - - - 637 - - - - maskBitsCombo - - - - 638 - - - - maxHostsBySubnetCombo - - - - 639 - - - - maxSubnetsCombo - - - - 640 - - - - subnetBitsCombo - - - - 641 - - - - subnetBroadcast - - - - 642 - - - - subnetHostAddrRange - - - - 643 - - - - subnetId - - - - 644 - - - - subnetMaskCombo - - - - 645 - - - - subnetsHostsView - - - - 646 - - - - supernetAddrRange - - - - 647 - - - - supernetMaskBitsCombo - - - - 648 - - - - supernetMaskCombo - - - - 649 - - - - supernetMaxAddr - - - - 650 - - - - supernetMaxCombo - - - - 651 - - - - supernetRoute - - - - 652 - - - - tabView - - - - 653 - - - - dataSource - - - - 654 - - - - ipAddrEdit: - - - - 655 - - - - copy: - - - - 701 - - - - cut: - - - - 702 - - - - paste: - - - - 703 - - - - delete: - - - - 704 - - - - selectAll: - - - - 705 - - - - - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 29 - - - - - - - - - - - 19 - - - - - - - - 56 - - - - - - - - 57 - - - - - - - - - - - - - - - - - - 58 - - - - - 134 - - - - - 150 - - - - - 136 - - - - - 144 - - - - - 129 - - - - - 143 - - - - - 236 - - - - - 131 - - - - - - - - 149 - - - - - 145 - - - - - 130 - - - - - 24 - - - - - - - - - - 92 - - - - - 5 - - - - - 23 - - - - - 371 - - - - - - - - 372 - - - - - - - - - - - 420 - - - - - 490 - - - - - - - - 491 - - - - - - - - 492 - - - - - 494 - - - - - 533 - - - - - - - - - - - 534 - - - - - - - - 535 - - - - - - - - 536 - - - - - - - - 537 - - - - - - - - 538 - - - - - - - - - - - 539 - - - - - - - - 540 - - - - - - - - 541 - - - - - - - - 542 - - - - - - - - 543 - - - - - - - - 544 - - - - - - - - 545 - - - - - - - - - - - 546 - - - - - 547 - - - - - 548 - - - - - 549 - - - - - 550 - - - - - - - - 551 - - - - - 552 - - - - - - - - 553 - - - - - 554 - - - - - - - - 555 - - - - - 556 - - - - - - - - - - - - - - - 557 - - - - - - - - 558 - - - - - - - - 559 - - - - - - - - 560 - - - - - - - - 561 - - - - - - - - 562 - - - - - - - - 563 - - - - - - - - 564 - - - - - - - - 565 - - - - - - - - 566 - - - - - 567 - - - - - - - - 568 - - - - - 569 - - - - - - - - 570 - - - - - 571 - - - - - - - - 572 - - - - - 573 - - - - - - - - 574 - - - - - 575 - - - - - - - - 576 - - - - - 577 - - - - - - - - 578 - - - - - 579 - - - - - - - - 580 - - - - - 581 - - - - - - - - 582 - - - - - - - - - - - 583 - - - - - 584 - - - - - 585 - - - - - 586 - - - - - - - - - - - 587 - - - - - - - - 588 - - - - - - - - 589 - - - - - - - - 590 - - - - - - - - 591 - - - - - 592 - - - - - 593 - - - - - 594 - - - - - 595 - - - - - - - - - - - - - 596 - - - - - - - - 597 - - - - - - - - 598 - - - - - - - - 599 - - - - - - - - 600 - - - - - - - - 601 - - - - - - - - 602 - - - - - - - - 603 - - - - - 604 - - - - - - - - 605 - - - - - 606 - - - - - - - - 607 - - - - - 608 - - - - - - - - 609 - - - - - 610 - - - - - - - - 611 - - - - - 612 - - - - - - - - 613 - - - - - 614 - - - - - - - - 615 - - - - - - - - 616 - - - - - - - - 617 - - - - - 618 - - - - - 619 - - - - - 656 - - - - - - - - 657 - - - - - - - - - - - - 666 - - - - - 667 - - - - - 668 - - - - - 671 - - - - - 672 - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{436, 809}, {64, 6}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{352, 820}, {194, 53}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{525, 802}, {197, 73}} - {{242, 873}, {286, 20}} - com.apple.InterfaceBuilder.CocoaPlugin - - {74, 862} - {{6, 978}, {478, 20}} - {{65, 97}, {482, 424}} - com.apple.InterfaceBuilder.CocoaPlugin - {{65, 97}, {482, 424}} - - {{33, 99}, {480, 360}} - - {3.40282e+38, 3.40282e+38} - {482, 424} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{423, 851}, {182, 23}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABBUAAAw70AAA - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - AUDAAABBmAAAA - - - com.apple.InterfaceBuilder.CocoaPlugin - - AUDAAABCugAAA - - - com.apple.InterfaceBuilder.CocoaPlugin - - AUDAAABDJwAAA - - - com.apple.InterfaceBuilder.CocoaPlugin - - AUDAAABDcQAAA - - - com.apple.InterfaceBuilder.CocoaPlugin - - {{178, 595}, {402, 83}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABBiAAAwggAAA - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABBiAAAwggAAA - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - AUL4AABDfQAAA - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - {{254, 690}, {211, 183}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{23, 794}, {245, 183}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - AUNtAABDLwAAA - - - com.apple.InterfaceBuilder.CocoaPlugin - - AUNtAABDfQAAA - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABDKAAAw8CAAA - - - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABCrgAAw8kAAA - - - com.apple.InterfaceBuilder.CocoaPlugin - - P4AAAL+AAABDnYAAw8uAAA - - - com.apple.InterfaceBuilder.CocoaPlugin - - {{352, 770}, {137, 103}} - com.apple.InterfaceBuilder.CocoaPlugin - - {{187, 434}, {243, 243}} - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - - 705 - - - - - SubnetCalcAppDelegate - NSObject - - id - id - id - id - id - id - id - id - id - id - id - id - - - - calc: - id - - - changeAddrClassType: - id - - - changeMaskBits: - id - - - changeMaxHosts: - id - - - changeMaxSubnets: - id - - - changeSubnetBits: - id - - - changeSubnetMask: - id - - - changeSupernetMask: - id - - - changeSupernetMaskBits: - id - - - changeSupernetMax: - id - - - changeSupernetMaxAddr: - id - - - ipAddrEdit: - id - - - - NSTextField - NSTextField - NSTextField - NSTextField - NSPopUpButton - NSComboBox - NSComboBox - NSComboBox - NSComboBox - NSTextField - NSTextField - NSTextField - NSComboBox - NSTableView - NSTextField - NSComboBox - NSComboBox - NSComboBox - NSComboBox - NSTextField - NSTabView - NSWindow - - - - addrField - NSTextField - - - classBinaryMap - NSTextField - - - classBitMap - NSTextField - - - classHexaMap - NSTextField - - - classType - NSPopUpButton - - - maskBitsCombo - NSComboBox - - - maxHostsBySubnetCombo - NSComboBox - - - maxSubnetsCombo - NSComboBox - - - subnetBitsCombo - NSComboBox - - - subnetBroadcast - NSTextField - - - subnetHostAddrRange - NSTextField - - - subnetId - NSTextField - - - subnetMaskCombo - NSComboBox - - - subnetsHostsView - NSTableView - - - supernetAddrRange - NSTextField - - - supernetMaskBitsCombo - NSComboBox - - - supernetMaskCombo - NSComboBox - - - supernetMaxAddr - NSComboBox - - - supernetMaxCombo - NSComboBox - - - supernetRoute - NSTextField - - - tabView - NSTabView - - - window - NSWindow - - - - IBProjectSource - SubnetCalcAppDelegate.h - - - - - - NSActionCell - NSCell - - IBFrameworkSource - AppKit.framework/Headers/NSActionCell.h - - - - NSApplication - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSApplication.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSApplicationScripting.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSColorPanel.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSHelpManager.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSPageLayout.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSUserInterfaceItemSearching.h - - - - NSBox - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSBox.h - - - - NSBrowser - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSBrowser.h - - - - NSButton - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSButton.h - - - - NSButtonCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSButtonCell.h - - - - NSCell - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSCell.h - - - - NSComboBox - NSTextField - - IBFrameworkSource - AppKit.framework/Headers/NSComboBox.h - - - - NSComboBoxCell - NSTextFieldCell - - IBFrameworkSource - AppKit.framework/Headers/NSComboBoxCell.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h - - - - NSFontManager - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontManager.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.h - - - - NSMatrix - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSMatrix.h - - - - NSMenu - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenu.h - - - - NSMenuItem - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenuItem.h - - - - NSMenuItemCell - NSButtonCell - - IBFrameworkSource - AppKit.framework/Headers/NSMenuItemCell.h - - - - NSMovieView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSMovieView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSAccessibility.h - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDictionaryController.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDragging.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontPanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSKeyValueBinding.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSNibLoading.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSOutlineView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSPasteboard.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSavePanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSToolbarItem.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSView.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObjectScripting.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPortCoder.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptObjectSpecifiers.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptWhoseTests.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLDownload.h - - - - NSPopUpButton - NSButton - - IBFrameworkSource - AppKit.framework/Headers/NSPopUpButton.h - - - - NSPopUpButtonCell - NSMenuItemCell - - IBFrameworkSource - AppKit.framework/Headers/NSPopUpButtonCell.h - - - - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSInterfaceStyle.h - - - - NSResponder - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSResponder.h - - - - NSScrollView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSScrollView.h - - - - NSScroller - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSScroller.h - - - - NSTabView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSTabView.h - - - - NSTabViewItem - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTabViewItem.h - - - - NSTableColumn - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableColumn.h - - - - NSTableHeaderView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSTableHeaderView.h - - - - NSTableView - NSControl - - - - NSText - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSText.h - - - - NSTextField - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSTextField.h - - - - NSTextFieldCell - NSActionCell - - IBFrameworkSource - AppKit.framework/Headers/NSTextFieldCell.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSClipView.h - - - - NSView - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSRulerView.h - - - - NSView - NSResponder - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSDrawer.h - - - - NSWindow - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSWindow.h - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSWindowScripting.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - YES - ../SubnetCalc.xcodeproj - 3 - - {9, 8} - {7, 2} - - - diff --git a/IPSubnetCalc.h b/IPSubnetCalc.h index 7d28dd2..2f8e620 100644 --- a/IPSubnetCalc.h +++ b/IPSubnetCalc.h @@ -36,15 +36,18 @@ unsigned int hostSubnetUbound; unsigned int ciscoWildcard; - char bitMap[36]; + char bitMap[36]; + Boolean classless; } +@property Boolean classless; + + (NSString *)denumberize:(unsigned int)address; + (unsigned int)numberize:(const char *)address; + (int)countOnBits:(unsigned int)number; - (void)initAddress:(const char *)address; -- (void)initAddressAndMask:(const char *)address:(unsigned int)addressMask; -- (void)initAddressAndMaskWithUnsignedInt:(unsigned int)address:(unsigned int)addressMask; +- (void)initAddressAndMask:(const char *)address mask:(unsigned int)addressMask; +- (void)initAddressAndMaskWithUnsignedInt:(unsigned int)address mask:(unsigned int)addressMask; - (NSString *)subnetHostAddrRange; - (NSString *)networkClass; - (unsigned int)netBits; diff --git a/IPSubnetCalc.m b/IPSubnetCalc.m index 53f16b6..54ef8c5 100644 --- a/IPSubnetCalc.m +++ b/IPSubnetCalc.m @@ -11,28 +11,37 @@ @implementation IPSubnetCalc +@synthesize classless; + + (unsigned int)numberize:(const char *)address { unsigned int sin_addr; - if ((inet_pton(AF_INET, address, &sin_addr)) <= 0) - return (-1); - return (ntohl(sin_addr)); + if (address != NULL) + { + if ((inet_pton(AF_INET, address, &sin_addr)) <= 0) + return (-1); + return (ntohl(sin_addr)); + } + return (0); } + (NSString *)denumberize:(unsigned int)address { char *buffer; unsigned int addr_nl; - NSString *nstr; - + NSString *nstr; + addr_nl = htonl(address); if (!(buffer = malloc(INET_ADDRSTRLEN * sizeof (char)))) return (NULL); if (!inet_ntop(AF_INET, &addr_nl, buffer, INET_ADDRSTRLEN * sizeof (char))) + { + free(buffer); return (NULL); - nstr = [NSString stringWithCString: buffer encoding: NSASCIIStringEncoding]; - free(buffer); + } + nstr = [NSString stringWithCString: buffer encoding: NSASCIIStringEncoding]; + free(buffer); return (nstr); } @@ -73,7 +82,7 @@ - (IBAction)setBitMap bitMap[DOT(2)] = '.'; bitMap[DOT(3)] = '.'; bitMap[35] = 0; - + for (i = 0; i < 35; i++) { if (i == DOT(1) || i == DOT(2) || i == DOT(3)) @@ -135,37 +144,35 @@ - (char)getClass:(unsigned int)address return ('d'); } -- (int)setClassInfo:(char)class:(const int)setDefaults -{ - if (networkClass) - [networkClass release]; +- (int)setClassInfo:(char)class defaults:(const int)setDefaults +{ switch (class) { case 'a' : - networkClass = [[NSString alloc] initWithString: @"A"]; + networkClass = @"A"; netBits = 8; netId = 0x01000000; mask = 0xff000000; break; case 'b' : - networkClass = [[NSString alloc] initWithString: @"B"]; + networkClass = @"B"; netBits = 16; netId = 0x80000000; mask = 0xffff0000; break; case 'c' : - networkClass = [[NSString alloc] initWithString: @"C"]; + networkClass = @"C"; netBits = 24; netId = 0xc0000000; mask = 0xffffff00; break; - case 'd' : - networkClass = [[NSString alloc] initWithString: @"D"]; - break; + case 'd' : + networkClass = @"D"; + break; default : return (-1); } - if (setDefaults) + if (setDefaults) hostAddr = netId + 1; return (0); } @@ -177,17 +184,17 @@ - (void)initByAddr:(unsigned int)address class = [self getClass:address]; subnetBits = 0; hostAddr = address; - [self setClassInfo:class:0]; + [self setClassInfo:class defaults:0]; [self initNetwork]; } -- (void)initByAddrAndMask:(unsigned int)address:(unsigned int)addressMask +- (void)initByAddrAndMask:(unsigned int)address mask:(unsigned int)addressMask { char class; class = [self getClass:address]; hostAddr = address; - [self setClassInfo:class:0]; + [self setClassInfo:class defaults:0]; if (mask > addressMask) { mask = addressMask; @@ -204,19 +211,25 @@ - (void)initByAddrAndMask:(unsigned int)address:(unsigned int)addressMask - (void)initAddress:(const char *)address { - [self initByAddr:[IPSubnetCalc numberize:address]]; + if (address) + { + [self initByAddr:[IPSubnetCalc numberize:address]]; + } } -- (void)initAddressAndMask:(const char *)address:(unsigned int)addressMask +- (void)initAddressAndMask:(const char *)address mask:(unsigned int)addressMask { - [self initByAddrAndMask:[IPSubnetCalc numberize:address]:addressMask]; + if (address) + { + [self initByAddrAndMask:[IPSubnetCalc numberize:address] mask:addressMask]; + } } -- (void)initAddressAndMaskWithUnsignedInt:(unsigned int)address:(unsigned int)addressMask +- (void)initAddressAndMaskWithUnsignedInt:(unsigned int)address mask:(unsigned int)addressMask { - [self initByAddrAndMask:address:addressMask]; + [self initByAddrAndMask:address mask:addressMask]; } - (NSString *)subnetHostAddrRange @@ -224,7 +237,7 @@ - (NSString *)subnetHostAddrRange NSString *strRange; unsigned int tmpmask; - strRange = [[[NSString alloc] initWithString: [IPSubnetCalc denumberize: ((hostAddr & (mask | subnetMask)) + 1)]] autorelease]; + strRange = [[NSString alloc] initWithString: [IPSubnetCalc denumberize: ((hostAddr & (mask | subnetMask)) + 1)]]; tmpmask = -1; tmpmask >>= maskBits; return ([strRange stringByAppendingFormat: @" - %@", [IPSubnetCalc denumberize: ((hostAddr | tmpmask) - 1)]]); @@ -232,7 +245,7 @@ - (NSString *)subnetHostAddrRange - (NSString *)bitMap { - return ([NSString stringWithCString: bitMap encoding: NSASCIIStringEncoding]); + return ([NSString stringWithCString: bitMap encoding: NSASCIIStringEncoding]); } - (NSString *)binMap @@ -241,8 +254,8 @@ - (NSString *)binMap unsigned int address; unsigned int mask_tmp = 1; int i; - - str_binmap = [[[NSString alloc] init] autorelease]; + + str_binmap = [[NSString alloc] init]; address = hostAddr; mask_tmp <<= 31; for (i = 0; i < 32; i++) @@ -251,7 +264,7 @@ - (NSString *)binMap str_binmap = [str_binmap stringByAppendingString: @"1"]; else str_binmap = [str_binmap stringByAppendingString: @"0"]; - address <<= 1; + address <<= 1; if (i != 31 && ((i + 1) % 8 == 0)) str_binmap = [str_binmap stringByAppendingString: @"."]; } @@ -263,14 +276,14 @@ - (NSString *)hexMap NSString *str_hexmap; unsigned int address; int i; - - str_hexmap = [[[NSString alloc] init] autorelease]; + + str_hexmap = [[NSString alloc] init]; address = hostAddr; for (i = 0; i < 4; i++) { str_hexmap = [str_hexmap stringByAppendingFormat: @"%.2X", ((address << (8 * i)) >> 24)]; if (i != 3) - str_hexmap = [str_hexmap stringByAppendingString: @"."]; + str_hexmap = [str_hexmap stringByAppendingString: @"."]; } return (str_hexmap); } @@ -312,7 +325,7 @@ - (NSString *)netId - (unsigned int)netIdIntValue { - return (netId); + return (netId); } - (NSString *)subnetMask @@ -322,7 +335,7 @@ - (NSString *)subnetMask - (unsigned int)subnetMaskIntValue { - return (mask | subnetMask); + return (mask | subnetMask); } - (NSString *)subnetBroadcast @@ -347,27 +360,36 @@ - (NSString *)networkClass - (unsigned int)netBits { - return (netBits); + return (netBits); } - (NSString *)supernetRoute:(int)supernetMaskBits { - unsigned int tmpmask = -1; + unsigned int tmpmask = -1; - tmpmask <<= (32 - supernetMaskBits); + tmpmask <<= (32 - supernetMaskBits); return ([IPSubnetCalc denumberize: (hostAddr & tmpmask)]); } - (NSString *)supernetAddrRange:(int)supernetMaskBits { - NSString *strRange; + NSString *strRange; unsigned int tmpmask = -1; - tmpmask <<= (32 - supernetMaskBits); - strRange = [[[NSString alloc] initWithString: [IPSubnetCalc denumberize: (hostAddr & tmpmask)]] autorelease]; + tmpmask <<= (32 - supernetMaskBits); + strRange = [[NSString alloc] initWithString: [IPSubnetCalc denumberize: (hostAddr & tmpmask)]]; tmpmask = -1; tmpmask >>= supernetMaskBits; return ([strRange stringByAppendingFormat: @" - %@", [IPSubnetCalc denumberize: (hostAddr | tmpmask)]]); } +- (id)init +{ + self = [super init]; + if (self) { + [self setClassless: NO]; + } + return self; +} + @end diff --git a/License.txt b/License.txt index d0ac68f..3e3b1f8 100644 --- a/License.txt +++ b/License.txt @@ -277,4 +277,4 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS \ No newline at end of file + END OF TERMS AND CONDITIONS diff --git a/PrintView.h b/PrintView.h new file mode 100644 index 0000000..480cd45 --- /dev/null +++ b/PrintView.h @@ -0,0 +1,21 @@ +// +// PrintView.h +// SubnetCalc +// +// Created by Julien Mulot on 02/02/11. +// Copyright 2011 mulot.net. All rights reserved. +// + +#import + + +@interface PrintView : NSView { + NSTableView *subnetsTable; + long entryPerPage; // how many entry per pages + long pages; //how many pages + float rectHeight; //how much vertical space +} + +-initWithSubnet:(NSTableView *)table printInfo:(NSPrintInfo *)pi; +- (NSRect)rectForSubnet:(int)index; +@end diff --git a/PrintView.m b/PrintView.m new file mode 100644 index 0000000..919094c --- /dev/null +++ b/PrintView.m @@ -0,0 +1,97 @@ +// +// PrintView.m +// SubnetCalc +// +// Created by Julien Mulot on 02/02/11. +// Copyright 2011 mulot.net. All rights reserved. +// + +#import "PrintView.h" + + +@implementation PrintView + +-initWithSubnet:(NSTableView *)table printInfo:(NSPrintInfo *)pi +{ + NSRect frame; + NSSize paperSize; + + entryPerPage = 30; + pages = [subnetsTable numberOfRows] / entryPerPage; + if (([subnetsTable numberOfRows] % entryPerPage) != 0) + { + pages = pages + 1; + } + paperSize = [pi paperSize]; + frame.origin = NSMakePoint(0,0); + frame.size.width = paperSize.width; + frame.size.height = paperSize.height * pages; + self = [super initWithFrame:frame]; + rectHeight = paperSize.height / entryPerPage; + return self; +} + +-(BOOL)knowsPageRange:(NSRange *)range; +{ + range->location = 1; + range->length = pages; + return YES; +} + +-(NSRect)rectForSubnet:(int)index +{ + NSRect result; + NSRect bounds; + + bounds = [self bounds]; + result.origin.x = bounds.origin.x; + result.size.width = bounds.size.width; + result.origin.y = NSMaxY(bounds) -((index + 1) * rectHeight); + result.size.height = rectHeight; + return (result); +} + +-(NSRect)rectForPage:(NSInteger)pageNum +{ + NSRect result; + + result.size.width = [self bounds].size.width; + result.size.height = rectHeight * entryPerPage; + result.origin.x = [self bounds].origin.x; + result.origin.y = NSMaxY([self bounds]) - (pageNum * result.size.height); + return (result); +} + +-(void)drawRect:(NSRect)rect +{ + int i; + NSRect aRect; + NSMutableDictionary *attributes; + NSString *printString; + + attributes = [[NSMutableDictionary alloc] init]; + [attributes setObject:[NSFont fontWithName:@"Helvetica" size:14] forKey: NSFontAttributeName]; + [attributes setObject:[NSColor blackColor] forKey:NSForegroundColorAttributeName]; + for (i = 1; i <= [subnetsTable numberOfRows]; i++) + { + aRect = [self rectForSubnet:i]; + if (NSIntersectsRect(aRect, rect)) + { + aRect.origin.x = aRect.origin.x + 50; + aRect.size.width = aRect.size.width - 400; + //NSLog(@"PrintLine %d %@\n",i, [subnetsTable tableView: + printString = [NSString stringWithFormat: @"%d %@ %@ %@", + i, @"toto", @"tata", @"titi" + ]; + //[[Subnets objectAtIndex:i] stringValue]]; + [printString drawInRect:aRect withAttributes:attributes]; + } + } +} + +-(void)dealloc +{ + +} + +@end diff --git a/README.md b/README.md index b56e4a2..faa2471 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,12 @@ # SubnetCalc Subnet Calculator for MacOS X -Current released version 1.5 +What's New in version 1.6: +- Dark Mode support +- Selectable cells for copy +- New App icon +- Universal binary (Apple Silicon support) -New in version 1.5: -- MacOS compatibility fix -- CIDR tab redesign -- Classless / CIDR support for Subnets/Hosts list -- Wildcard mask option -- Export all subnets to CSV file -- Export subnet infos to Clipboard -- New icon -- Source code compatible with XCode 9 - -For more information: http://subnetcalc.free.fr +For more information: http://subnetcalc.mulot.org Buy Me A Coffee - diff --git a/SubnetCalc App Icon-v4.pxd/QuickLook/Icon.tiff b/SubnetCalc App Icon-v4.pxd/QuickLook/Icon.tiff new file mode 100644 index 0000000..c8b0286 Binary files /dev/null and b/SubnetCalc App Icon-v4.pxd/QuickLook/Icon.tiff differ diff --git a/SubnetCalc App Icon-v4.pxd/QuickLook/Thumbnail.tiff b/SubnetCalc App Icon-v4.pxd/QuickLook/Thumbnail.tiff new file mode 100644 index 0000000..96c59ce Binary files /dev/null and b/SubnetCalc App Icon-v4.pxd/QuickLook/Thumbnail.tiff differ diff --git a/SubnetCalc App Icon-v4.pxd/data/A92A363A-8B3D-4D1D-82F7-106B1CC581FD b/SubnetCalc App Icon-v4.pxd/data/A92A363A-8B3D-4D1D-82F7-106B1CC581FD new file mode 100644 index 0000000..5098577 Binary files /dev/null and b/SubnetCalc App Icon-v4.pxd/data/A92A363A-8B3D-4D1D-82F7-106B1CC581FD differ diff --git a/SubnetCalc App Icon-v4.pxd/data/E413E5BB-8E70-4154-A962-095FDD8DF488 b/SubnetCalc App Icon-v4.pxd/data/E413E5BB-8E70-4154-A962-095FDD8DF488 new file mode 100644 index 0000000..6b4efd4 Binary files /dev/null and b/SubnetCalc App Icon-v4.pxd/data/E413E5BB-8E70-4154-A962-095FDD8DF488 differ diff --git a/SubnetCalc App Icon-v4.pxd/data/F6F4EA55-2397-4F7E-8803-54BE53A25E8E b/SubnetCalc App Icon-v4.pxd/data/F6F4EA55-2397-4F7E-8803-54BE53A25E8E new file mode 100644 index 0000000..8245a89 Binary files /dev/null and b/SubnetCalc App Icon-v4.pxd/data/F6F4EA55-2397-4F7E-8803-54BE53A25E8E differ diff --git a/SubnetCalc App Icon-v4.pxd/metadata.info b/SubnetCalc App Icon-v4.pxd/metadata.info new file mode 100644 index 0000000..af74d04 Binary files /dev/null and b/SubnetCalc App Icon-v4.pxd/metadata.info differ diff --git a/SubnetCalc-Info.plist b/SubnetCalc-Info.plist index d018f65..93b4c6a 100644 --- a/SubnetCalc-Info.plist +++ b/SubnetCalc-Info.plist @@ -2,16 +2,12 @@ - LSApplicationCategoryType - public.app-category.utilities CFBundleDevelopmentRegion English CFBundleExecutable ${EXECUTABLE_NAME} - CFBundleIconFile - SubnetCalc.icns CFBundleIdentifier - net.mulot.subnetcalc + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -19,18 +15,20 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.2 + 1.6 CFBundleSignature JMUL CFBundleVersion - 1.2 + 3 + LSApplicationCategoryType + public.app-category.utilities LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + Copyright 2020 Julien Mulot NSMainNibFile MainMenu NSPrincipalClass NSApplication - NSHumanReadableCopyright - Copyright 2010 Julien Mulot diff --git a/SubnetCalc.entitlements b/SubnetCalc.entitlements new file mode 100644 index 0000000..19afff1 --- /dev/null +++ b/SubnetCalc.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-write + + + diff --git a/SubnetCalc.icns b/SubnetCalc.icns deleted file mode 100644 index bfb6e08..0000000 Binary files a/SubnetCalc.icns and /dev/null differ diff --git a/SubnetCalc.xcodeproj/project.pbxproj b/SubnetCalc.xcodeproj/project.pbxproj index 151115d..0a5376e 100644 --- a/SubnetCalc.xcodeproj/project.pbxproj +++ b/SubnetCalc.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 48; objects = { /* Begin PBXBuildFile section */ @@ -12,16 +12,26 @@ 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; - 9494208212D3B11E00E2F57D /* SubnetCalc.icns in Resources */ = {isa = PBXBuildFile; fileRef = 9494208112D3B11E00E2F57D /* SubnetCalc.icns */; }; + 945E62F825658DBF00CDC9C7 /* SubnetCalcUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 945E62F725658DBF00CDC9C7 /* SubnetCalcUITests.m */; }; 949420B812D3C62A00E2F57D /* License.txt in Resources */ = {isa = PBXBuildFile; fileRef = 949420B712D3C62A00E2F57D /* License.txt */; }; 949420BD12D3C64500E2F57D /* IPSubnetCalc.m in Sources */ = {isa = PBXBuildFile; fileRef = 949420BA12D3C64500E2F57D /* IPSubnetCalc.m */; }; + 9494DD211F7BEAE80032DB19 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9494DD201F7BEAE80032DB19 /* Images.xcassets */; }; + 94B6031212F74DC7005AA5EB /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94B6031112F74DC7005AA5EB /* CoreFoundation.framework */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 945E62FA25658DBF00CDC9C7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8D1107260486CEB800E47090; + remoteInfo = SubnetCalc; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ - 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; - 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; 256AC3D80F4B6AC300CF3369 /* SubnetCalcAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubnetCalcAppDelegate.h; sourceTree = ""; }; 256AC3D90F4B6AC300CF3369 /* SubnetCalcAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SubnetCalcAppDelegate.m; sourceTree = ""; }; 256AC3F00F4B6AF500CF3369 /* SubnetCalc_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubnetCalc_Prefix.pch; sourceTree = ""; }; @@ -30,10 +40,18 @@ 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 8D1107310486CEB800E47090 /* SubnetCalc-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "SubnetCalc-Info.plist"; sourceTree = ""; }; 8D1107320486CEB800E47090 /* SubnetCalc.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SubnetCalc.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 9494208112D3B11E00E2F57D /* SubnetCalc.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = SubnetCalc.icns; sourceTree = ""; }; + 945E62EF25658A9500CDC9C7 /* SubnetCalc.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = SubnetCalc.xctestplan; sourceTree = ""; }; + 945E62F525658DBF00CDC9C7 /* SubnetCalcUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SubnetCalcUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 945E62F725658DBF00CDC9C7 /* SubnetCalcUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SubnetCalcUITests.m; sourceTree = ""; }; + 945E62F925658DBF00CDC9C7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 949420B712D3C62A00E2F57D /* License.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = License.txt; sourceTree = ""; }; 949420B912D3C64500E2F57D /* IPSubnetCalc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IPSubnetCalc.h; sourceTree = ""; }; - 949420BA12D3C64500E2F57D /* IPSubnetCalc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IPSubnetCalc.m; sourceTree = ""; }; + 949420BA12D3C64500E2F57D /* IPSubnetCalc.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = IPSubnetCalc.m; sourceTree = ""; }; + 9494DD1F1F7BE7B40032DB19 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 9494DD201F7BEAE80032DB19 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = SubnetCalc/Images.xcassets; sourceTree = ""; }; + 94B6031112F74DC7005AA5EB /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; + 94CDB5F6255EE11D0010F1E4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 94D8C5731520F99500B27A3A /* SubnetCalc.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = SubnetCalc.entitlements; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -42,6 +60,14 @@ buildActionMask = 2147483647; files = ( 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + 94B6031212F74DC7005AA5EB /* CoreFoundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 945E62F225658DBF00CDC9C7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( ); runOnlyForDeploymentPostprocessing = 0; }; @@ -51,8 +77,8 @@ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( - 949420BA12D3C64500E2F57D /* IPSubnetCalc.m */, 949420B912D3C64500E2F57D /* IPSubnetCalc.h */, + 949420BA12D3C64500E2F57D /* IPSubnetCalc.m */, 256AC3D80F4B6AC300CF3369 /* SubnetCalcAppDelegate.h */, 256AC3D90F4B6AC300CF3369 /* SubnetCalcAppDelegate.m */, ); @@ -73,6 +99,7 @@ 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + 94B6031112F74DC7005AA5EB /* CoreFoundation.framework */, ); name = "Other Frameworks"; sourceTree = ""; @@ -81,6 +108,7 @@ isa = PBXGroup; children = ( 8D1107320486CEB800E47090 /* SubnetCalc.app */, + 945E62F525658DBF00CDC9C7 /* SubnetCalcUITests.xctest */, ); name = Products; sourceTree = ""; @@ -88,9 +116,11 @@ 29B97314FDCFA39411CA2CEA /* SubnetCalc */ = { isa = PBXGroup; children = ( + 94D8C5731520F99500B27A3A /* SubnetCalc.entitlements */, 080E96DDFE201D6D7F000001 /* Classes */, 29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97317FDCFA39411CA2CEA /* Resources */, + 945E62F625658DBF00CDC9C7 /* SubnetCalcUITests */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, ); @@ -109,11 +139,12 @@ 29B97317FDCFA39411CA2CEA /* Resources */ = { isa = PBXGroup; children = ( + 9494DD201F7BEAE80032DB19 /* Images.xcassets */, 949420B712D3C62A00E2F57D /* License.txt */, - 9494208112D3B11E00E2F57D /* SubnetCalc.icns */, 8D1107310486CEB800E47090 /* SubnetCalc-Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + 945E62EF25658A9500CDC9C7 /* SubnetCalc.xctestplan */, ); name = Resources; sourceTree = ""; @@ -127,6 +158,15 @@ name = Frameworks; sourceTree = ""; }; + 945E62F625658DBF00CDC9C7 /* SubnetCalcUITests */ = { + isa = PBXGroup; + children = ( + 945E62F725658DBF00CDC9C7 /* SubnetCalcUITests.m */, + 945E62F925658DBF00CDC9C7 /* Info.plist */, + ); + path = SubnetCalcUITests; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -148,26 +188,62 @@ productReference = 8D1107320486CEB800E47090 /* SubnetCalc.app */; productType = "com.apple.product-type.application"; }; + 945E62F425658DBF00CDC9C7 /* SubnetCalcUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 945E62FC25658DBF00CDC9C7 /* Build configuration list for PBXNativeTarget "SubnetCalcUITests" */; + buildPhases = ( + 945E62F125658DBF00CDC9C7 /* Sources */, + 945E62F225658DBF00CDC9C7 /* Frameworks */, + 945E62F325658DBF00CDC9C7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 945E62FB25658DBF00CDC9C7 /* PBXTargetDependency */, + ); + name = SubnetCalcUITests; + productName = SubnetCalcUITests; + productReference = 945E62F525658DBF00CDC9C7 /* SubnetCalcUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; + attributes = { + LastUpgradeCheck = 1220; + TargetAttributes = { + 8D1107260486CEB800E47090 = { + LastSwiftMigration = 0820; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 945E62F425658DBF00CDC9C7 = { + CreatedOnToolsVersion = 12.2; + ProvisioningStyle = Automatic; + TestTargetID = 8D1107260486CEB800E47090; + }; + }; + }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SubnetCalc" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + en, ); mainGroup = 29B97314FDCFA39411CA2CEA /* SubnetCalc */; projectDirPath = ""; projectRoot = ""; targets = ( 8D1107260486CEB800E47090 /* SubnetCalc */, + 945E62F425658DBF00CDC9C7 /* SubnetCalcUITests */, ); }; /* End PBXProject section */ @@ -178,12 +254,19 @@ buildActionMask = 2147483647; files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, + 9494DD211F7BEAE80032DB19 /* Images.xcassets in Resources */, 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, - 9494208212D3B11E00E2F57D /* SubnetCalc.icns in Resources */, 949420B812D3C62A00E2F57D /* License.txt in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; + 945E62F325658DBF00CDC9C7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -197,13 +280,29 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 945E62F125658DBF00CDC9C7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 945E62F825658DBF00CDC9C7 /* SubnetCalcUITests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 945E62FB25658DBF00CDC9C7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8D1107260486CEB800E47090 /* SubnetCalc */; + targetProxy = 945E62FA25658DBF00CDC9C7 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 089C165DFE840E0CC02AAC07 /* English */, + 94CDB5F6255EE11D0010F1E4 /* en */, ); name = InfoPlist.strings; sourceTree = ""; @@ -211,7 +310,7 @@ 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( - 1DDD58150DA1D0A300B32029 /* English */, + 9494DD1F1F7BE7B40032DB19 /* Base */, ); name = MainMenu.xib; sourceTree = ""; @@ -219,20 +318,105 @@ /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ + 945E62FD25658DBF00CDC9C7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = VNLK894MAE; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + INFOPLIST_FILE = SubnetCalcUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = mulot.org.SubnetCalcUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_TARGET_NAME = SubnetCalc; + }; + name = Debug; + }; + 945E62FE25658DBF00CDC9C7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = VNLK894MAE; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + INFOPLIST_FILE = SubnetCalcUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 11.0; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = mulot.org.SubnetCalcUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_TARGET_NAME = SubnetCalc; + }; + name = Release; + }; C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = SubnetCalc.entitlements; + CODE_SIGN_IDENTITY = "Mac Developer"; + COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; + DEVELOPMENT_TEAM = VNLK894MAE; + ENABLE_HARDENED_RUNTIME = YES; GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = SubnetCalc_Prefix.pch; INFOPLIST_FILE = "SubnetCalc-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_BUNDLE_IDENTIFIER = net.mulot.subnetcalc; PRODUCT_NAME = SubnetCalc; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -240,50 +424,130 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = SubnetCalc.entitlements; + CODE_SIGN_IDENTITY = "Mac Developer"; + COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = VNLK894MAE; + ENABLE_HARDENED_RUNTIME = YES; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = SubnetCalc_Prefix.pch; INFOPLIST_FILE = "SubnetCalc-Info.plist"; INSTALL_PATH = /Applications; + PRODUCT_BUNDLE_IDENTIFIER = net.mulot.subnetcalc; PRODUCT_NAME = SubnetCalc; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 3.0; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CODE_SIGN_IDENTITY = "3rd Party Mac Developer Application: Julien Mulot"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = ""; + "CODE_SIGN_ENTITLEMENTS[sdk=*]" = ""; + CODE_SIGN_IDENTITY = "Mac Developer"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_OPTIMIZATION_LEVEL = 0; + DEVELOPMENT_TEAM = VNLK894MAE; + ENABLE_STRICT_OBJC_MSGSEND = NO; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_NO_COMMON_BLOCKS = NO; + GCC_OPTIMIZATION_LEVEL = s; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.12; ONLY_ACTIVE_ARCH = YES; - PREBINDING = NO; - SDKROOT = macosx10.6; + PROVISIONING_PROFILE = ""; + SDKROOT = macosx; + STRIP_INSTALLED_PRODUCT = YES; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CODE_SIGN_IDENTITY = "3rd Party Mac Developer Application: Julien Mulot"; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_C_LANGUAGE_STANDARD = gnu99; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_ENTITLEMENTS = ""; + "CODE_SIGN_ENTITLEMENTS[sdk=*]" = ""; + CODE_SIGN_IDENTITY = "Mac Developer"; + DEBUG_INFORMATION_FORMAT = ""; + DEVELOPMENT_TEAM = VNLK894MAE; + ENABLE_STRICT_OBJC_MSGSEND = NO; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_NO_COMMON_BLOCKS = NO; + GCC_OPTIMIZATION_LEVEL = s; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - PREBINDING = NO; - SDKROOT = macosx10.6; - VALID_ARCHS = "i386 x86_64"; + MACOSX_DEPLOYMENT_TARGET = 10.12; + ONLY_ACTIVE_ARCH = NO; + PROVISIONING_PROFILE = ""; + SDKROOT = macosx; + STRIP_INSTALLED_PRODUCT = YES; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 945E62FC25658DBF00CDC9C7 /* Build configuration list for PBXNativeTarget "SubnetCalcUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 945E62FD25658DBF00CDC9C7 /* Debug */, + 945E62FE25658DBF00CDC9C7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "SubnetCalc" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -291,7 +555,7 @@ C01FCF4C08A954540054247B /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; + defaultConfigurationName = Debug; }; C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SubnetCalc" */ = { isa = XCConfigurationList; @@ -300,7 +564,7 @@ C01FCF5008A954540054247B /* Release */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; + defaultConfigurationName = Debug; }; /* End XCConfigurationList section */ }; diff --git a/SubnetCalc.xcodeproj/xcshareddata/xcschemes/SubnetCalc.xcscheme b/SubnetCalc.xcodeproj/xcshareddata/xcschemes/SubnetCalc.xcscheme new file mode 100644 index 0000000..2d3571f --- /dev/null +++ b/SubnetCalc.xcodeproj/xcshareddata/xcschemes/SubnetCalc.xcscheme @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SubnetCalc.xctestplan b/SubnetCalc.xctestplan new file mode 100644 index 0000000..6d9a760 --- /dev/null +++ b/SubnetCalc.xctestplan @@ -0,0 +1,32 @@ +{ + "configurations" : [ + { + "id" : "CF14950C-2190-40EE-AA0F-76C4608AFC55", + "name" : "Configuration 1", + "options" : { + + } + } + ], + "defaultOptions" : { + "codeCoverage" : false, + "targetForVariableExpansion" : { + "containerPath" : "container:SubnetCalc.xcodeproj", + "identifier" : "8D1107260486CEB800E47090", + "name" : "SubnetCalc" + } + }, + "testTargets" : [ + { + "skippedTests" : [ + "SubnetCalcUITests\/testLaunchPerformance" + ], + "target" : { + "containerPath" : "container:SubnetCalc.xcodeproj", + "identifier" : "945E62F425658DBF00CDC9C7", + "name" : "SubnetCalcUITests" + } + } + ], + "version" : 1 +} diff --git a/SubnetCalc/Images.xcassets/AppIcon.appiconset/Contents.json b/SubnetCalc/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..37a27f4 --- /dev/null +++ b/SubnetCalc/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "filename" : "SubnetCalc16x16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "SubnetCalc32x32.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "SubnetCalc32x32-1.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "SubnetCalc64x64.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "SubnetCalc128x128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "SubnetCalc256x256.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "SubnetCalc256x256-1.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "SubnetCalc512x512.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "SubnetCalc512x512-1.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "SubnetCalc1024x1024.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc1024x1024.png b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc1024x1024.png new file mode 100644 index 0000000..2620026 Binary files /dev/null and b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc1024x1024.png differ diff --git a/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc128x128.png b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc128x128.png new file mode 100644 index 0000000..4c0b059 Binary files /dev/null and b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc128x128.png differ diff --git a/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc16x16.png b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc16x16.png new file mode 100644 index 0000000..633bede Binary files /dev/null and b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc16x16.png differ diff --git a/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc256x256-1.png b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc256x256-1.png new file mode 100644 index 0000000..fe4f1e2 Binary files /dev/null and b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc256x256-1.png differ diff --git a/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc256x256.png b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc256x256.png new file mode 100644 index 0000000..fe4f1e2 Binary files /dev/null and b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc256x256.png differ diff --git a/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc32x32-1.png b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc32x32-1.png new file mode 100644 index 0000000..2f8f8f2 Binary files /dev/null and b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc32x32-1.png differ diff --git a/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc32x32.png b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc32x32.png new file mode 100644 index 0000000..2f8f8f2 Binary files /dev/null and b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc32x32.png differ diff --git a/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc512x512-1.png b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc512x512-1.png new file mode 100644 index 0000000..96771a5 Binary files /dev/null and b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc512x512-1.png differ diff --git a/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc512x512.png b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc512x512.png new file mode 100644 index 0000000..96771a5 Binary files /dev/null and b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc512x512.png differ diff --git a/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc64x64.png b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc64x64.png new file mode 100644 index 0000000..acf0f5b Binary files /dev/null and b/SubnetCalc/Images.xcassets/AppIcon.appiconset/SubnetCalc64x64.png differ diff --git a/SubnetCalc/Images.xcassets/Contents.json b/SubnetCalc/Images.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/SubnetCalc/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SubnetCalc1024x1024.png b/SubnetCalc1024x1024.png new file mode 100644 index 0000000..2620026 Binary files /dev/null and b/SubnetCalc1024x1024.png differ diff --git a/SubnetCalc128x128.png b/SubnetCalc128x128.png new file mode 100644 index 0000000..4c0b059 Binary files /dev/null and b/SubnetCalc128x128.png differ diff --git a/SubnetCalc16x16.png b/SubnetCalc16x16.png new file mode 100644 index 0000000..633bede Binary files /dev/null and b/SubnetCalc16x16.png differ diff --git a/SubnetCalc256x256.png b/SubnetCalc256x256.png new file mode 100644 index 0000000..fe4f1e2 Binary files /dev/null and b/SubnetCalc256x256.png differ diff --git a/SubnetCalc32x32.png b/SubnetCalc32x32.png new file mode 100644 index 0000000..2f8f8f2 Binary files /dev/null and b/SubnetCalc32x32.png differ diff --git a/SubnetCalc512x512.png b/SubnetCalc512x512.png new file mode 100644 index 0000000..96771a5 Binary files /dev/null and b/SubnetCalc512x512.png differ diff --git a/SubnetCalc64x64.png b/SubnetCalc64x64.png new file mode 100644 index 0000000..acf0f5b Binary files /dev/null and b/SubnetCalc64x64.png differ diff --git a/SubnetCalcAppDelegate.h b/SubnetCalcAppDelegate.h index 43f9ead..4afb7b1 100644 --- a/SubnetCalcAppDelegate.h +++ b/SubnetCalcAppDelegate.h @@ -14,7 +14,8 @@ IBOutlet NSTextField *classBinaryMap; IBOutlet NSTextField *classBitMap; IBOutlet NSTextField *classHexaMap; - IBOutlet NSPopUpButton *classType; + IBOutlet NSPopUpButton *exportButton; + IBOutlet NSPopUpButton *classType; IBOutlet NSComboBox *maskBitsCombo; IBOutlet NSComboBox *maxHostsBySubnetCombo; IBOutlet NSComboBox *maxSubnetsCombo; @@ -28,10 +29,18 @@ IBOutlet NSComboBox *supernetMaskCombo; IBOutlet NSComboBox *supernetMaxCombo; IBOutlet NSComboBox *supernetMaxAddr; + IBOutlet NSComboBox *supernetMaxSubnetsCombo; IBOutlet NSTextField *supernetRoute; IBOutlet NSTextField *supernetAddrRange; - IBOutlet NSTabView *tabView; - NSWindow *window; + IBOutlet NSTabView *tabView; + IBOutlet NSSlider *subnetBitsSlide; + IBOutlet NSTextField *bitsOnSlide; + IBOutlet NSButton *tabViewClassLess; + IBOutlet NSButton *wildcard; + //IBOutlet NSView *mainWindow; + //IBOutlet NSWindow *window; + IBOutlet NSMenuItem *darkModeMenu; + IBOutlet NSApplication *NSApp; } @property (assign) IBOutlet NSWindow *window; @@ -39,7 +48,10 @@ - (void)doIPSubnetCalc:(unsigned int)mask; - (void)doSupernetCalc:(int)maskBits; - (void)initClassInfos:(NSString *)c; +- (void)initCIDR; - (int)checkAddr:(NSString *)address; +- (void)bitsOnSlidePos; +- (NSString *)URLEncode:(NSString *)url; - (IBAction)calc:(id)sender; - (IBAction)ipAddrEdit:(id)sender; - (IBAction)changeAddrClassType:(id)sender; @@ -52,6 +64,13 @@ - (IBAction)changeSupernetMask:(id)sender; - (IBAction)changeSupernetMax:(id)sender; - (IBAction)changeSupernetMaxAddr:(id)sender; +- (IBAction)changeSupernetMaxSubnets:(id)sender; +- (IBAction)subnetBitsSlide:(id)sender; +- (IBAction)changeTableViewClass:(id)sender; +- (IBAction)changeWildcard:(id)sender; +- (IBAction)exportCSV:(id)sender; +- (void)printAllSubnets; +- (void)darkMode:(id)sender; - (int)numberOfRowsInTableView:(NSTableView *)aTableView; - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn @@ -61,7 +80,8 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex; +@end + IPSubnetCalc *ipsc; NSArray *tab_tabView; -@end diff --git a/SubnetCalcAppDelegate.m b/SubnetCalcAppDelegate.m index 48efe03..bf1861e 100644 --- a/SubnetCalcAppDelegate.m +++ b/SubnetCalcAppDelegate.m @@ -12,208 +12,259 @@ #import #import +#define BUFFER_LINES 1000 +#define NETWORK_BITS_MIN_CLASSLESS 1 +#define NETWORK_BITS_MIN 8 +#define NETWORK_BITS_MAX 32 + @implementation SubnetCalcAppDelegate @synthesize window; - (int)checkAddr:(NSString *)address { - NSRange range; - - range = [address rangeOfString:@"/"]; - if (range.location != NSNotFound) - { - if (([[address substringFromIndex: range.location + 1] intValue] > 32) - || ([[address substringFromIndex: range.location + 1] intValue] < 8)) - return (-1); - if ([IPSubnetCalc numberize: [[address substringToIndex: range.location] cStringUsingEncoding: NSASCIIStringEncoding]] == -1) - return (-1); - [tabView selectTabViewItemAtIndex: 1]; - } - else if ([IPSubnetCalc numberize: [address cStringUsingEncoding: NSASCIIStringEncoding]] == -1) - return (-1); - return (0); + NSRange range; + + if (address) + { + range = [address rangeOfString:@"/"]; + if (range.location != NSNotFound) + { + if (([[address substringFromIndex: range.location + 1] intValue] > NETWORK_BITS_MAX) + || ([[address substringFromIndex: range.location + 1] intValue] < NETWORK_BITS_MIN)) + return (-1); + if ([IPSubnetCalc numberize: [[address substringToIndex: range.location] cStringUsingEncoding: NSASCIIStringEncoding]] == -1) + return (-1); + [tabView selectTabViewItemAtIndex: 1]; + } + else if ([IPSubnetCalc numberize: [address cStringUsingEncoding: NSASCIIStringEncoding]] == -1) + return (-1); + } + else + { + return (-2); + } + return (0); } - (void)initClassInfos:(NSString *)c { - unsigned int tmp_mask; - unsigned int addr_nl; - int i; - int j = 0; - - if ([c isEqualToString: @"A"]) - { - j = 1; + if ([c isEqualToString: @"A"]) + { [classType selectItemAtIndex: 0]; - } + } else if ([c isEqualToString: @"B"]) - { - j = 2; + { [classType selectItemAtIndex: 1]; - } + } else if ([c isEqualToString: @"C"]) - { - j = 3; + { [classType selectItemAtIndex: 2]; - } - else if ([c isEqualToString: @"D"]) - { + } + else if ([c isEqualToString: @"D"]) + { [classType selectItemAtIndex: 3]; - tab_tabView = [tabView tabViewItems]; - [tab_tabView retain]; - [tabView removeTabViewItem: [tab_tabView objectAtIndex: 1]]; - [tabView removeTabViewItem: [tab_tabView objectAtIndex: 2]]; - [tabView removeTabViewItem: [tab_tabView objectAtIndex: 3]]; - } - if (j) - { - for (i = j; i <= 8 * j; i++) - [supernetMaskBitsCombo addItemWithObjectValue: [NSString stringWithFormat: @"%d", i]]; - tmp_mask = -1; - for (i = 32 - j; i >= (32 - 8 * j); i--) - { - addr_nl = htonl(tmp_mask << i); - [supernetMaskCombo addItemWithObjectValue: [IPSubnetCalc denumberize: addr_nl]]; - } - for (i = 0; i < 8 * j - j + 1; i++) - { - tmp_mask = pow(2, i); - [supernetMaxCombo addItemWithObjectValue: [NSString stringWithFormat: @"%u", tmp_mask]]; - } - for (i = (32 - 8 * j); i < 32 - j + 1; i++) - { - tmp_mask = pow(2, i) - 2; - [supernetMaxAddr addItemWithObjectValue: [NSString stringWithFormat: @"%u", tmp_mask]]; - } - [supernetMaxCombo selectItemAtIndex: 8 * (j - 1)]; - [supernetMaxAddr selectItemAtIndex: 8 * (j - 1)]; - [supernetMaskBitsCombo selectItemAtIndex: 8 - j]; - [supernetMaskCombo selectItemAtIndex: 8 - j]; - } + tab_tabView = [tabView tabViewItems]; + [tabView removeTabViewItem: [tab_tabView objectAtIndex: 1]]; + [tabView removeTabViewItem: [tab_tabView objectAtIndex: 2]]; + [tabView removeTabViewItem: [tab_tabView objectAtIndex: 3]]; + } +} + +- (void)initCIDR +{ + unsigned int tmp_mask; + unsigned int addr_nl; + int i; + + for (i = 1; i <= 30; i++) + [supernetMaskBitsCombo addItemWithObjectValue: [NSString stringWithFormat: @"%d", i]]; + tmp_mask = -1; + for (i = 31; i > 1; i--) + { + //addr_nl = htonl(tmp_mask << i); + addr_nl = (tmp_mask << i); + [supernetMaskCombo addItemWithObjectValue: [IPSubnetCalc denumberize: addr_nl]]; + } + for (i = 0; i < 30; i++) + { + tmp_mask = pow(2, i); + [supernetMaxCombo addItemWithObjectValue: [NSString stringWithFormat: @"%u", tmp_mask]]; + } + for (i = 1; i < 32; i++) + { + tmp_mask = pow(2, i) - 2; + [supernetMaxAddr addItemWithObjectValue: [NSString stringWithFormat: @"%u", tmp_mask]]; + } + for (i = 0; i < 32; i++) + { + tmp_mask = (pow(2, i)); + [supernetMaxSubnetsCombo addItemWithObjectValue: [NSString stringWithFormat: @"%u", tmp_mask]]; + } + /* + [supernetMaxCombo selectItemAtIndex: 7]; + [supernetMaxAddr selectItemAtIndex: 23]; + [supernetMaskBitsCombo selectItemAtIndex: 7]; + [supernetMaskCombo selectItemAtIndex: 7]; + [supernetMaxSubnetsCombo selectItemAtIndex: 24]; + */ } - (void)doIPSubnetCalc:(unsigned int)mask { - NSRange range; - NSMutableAttributedString *astr; - - if ([self checkAddr: [addrField stringValue]]) - return; - if ([tabView numberOfTabViewItems] != 4) - { - [tabView addTabViewItem: [tab_tabView objectAtIndex:1]]; - [tabView addTabViewItem: [tab_tabView objectAtIndex:2]]; - [tabView addTabViewItem: [tab_tabView objectAtIndex:3]]; - [tab_tabView release]; - } - [supernetMaskBitsCombo removeAllItems]; - [supernetMaskCombo removeAllItems]; - [supernetMaxAddr removeAllItems]; - [supernetMaxCombo removeAllItems]; - if (ipsc) - [ipsc release]; + NSRange range; + NSMutableAttributedString *astr; + + if([[addrField stringValue] length] == 0) + [addrField setStringValue: NSLocalizedString(@"10.0.0.0", nil)]; + if ([self checkAddr: [addrField stringValue]]) + { + NSAlert *alert = [[NSAlert alloc] init]; + [alert addButtonWithTitle: @"OK"]; + [alert setMessageText: @"Bad IP Address"]; + [alert setAlertStyle: NSAlertStyleWarning]; + [alert setInformativeText:@"Bad format"]; + if ([alert runModal] == NSAlertFirstButtonReturn) + return; + } + if ([tabView numberOfTabViewItems] != 4) + { + [tabView addTabViewItem: [tab_tabView objectAtIndex:1]]; + [tabView addTabViewItem: [tab_tabView objectAtIndex:2]]; + [tabView addTabViewItem: [tab_tabView objectAtIndex:3]]; + } + /* + [supernetMaskBitsCombo removeAllItems]; + [supernetMaskCombo removeAllItems]; + [supernetMaxAddr removeAllItems]; + [supernetMaxCombo removeAllItems]; + [supernetMaxSubnetsCombo removeAllItems]; + */ ipsc = [[IPSubnetCalc alloc] init]; - range = [[addrField stringValue] rangeOfString:@"/"]; - if (range.location != NSNotFound) - { - mask = -1; - mask <<= (32 - [[[addrField stringValue] substringFromIndex: range.location + 1] intValue]); - [addrField setStringValue: [[addrField stringValue] substringToIndex: range.location]]; - } - if (mask) - [ipsc initAddressAndMask: [[addrField stringValue] cStringUsingEncoding: NSASCIIStringEncoding]: mask]; - else - [ipsc initAddress: [[addrField stringValue] cStringUsingEncoding: NSASCIIStringEncoding]]; - [self initClassInfos: [ipsc networkClass]]; - [supernetRoute setStringValue: [ipsc supernetRoute: [[supernetMaskBitsCombo objectValueOfSelectedItem] intValue]]]; - [supernetAddrRange setStringValue: [ipsc supernetAddrRange: [[supernetMaskBitsCombo objectValueOfSelectedItem] intValue]]]; - astr = [[NSMutableAttributedString alloc] initWithString : [ipsc bitMap]]; - /* - if ([[ipsc maskBits] intValue] >= 24) - [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 27)]; - else if ([[ipsc maskBits] intValue] >= 16) - [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 18)]; - else - [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 9)]; - */ - [classBitMap setAttributedStringValue: astr]; - [astr release]; - [classBinaryMap setStringValue: [ipsc binMap]]; - [classHexaMap setStringValue: [ipsc hexMap]]; - [subnetBitsCombo selectItemWithObjectValue: [[ipsc subnetBits] stringValue]]; - [maskBitsCombo selectItemWithObjectValue: [[ipsc maskBits] stringValue]]; - [maxSubnetsCombo selectItemWithObjectValue: [[ipsc subnetMax] stringValue]]; - [maxHostsBySubnetCombo selectItemWithObjectValue: [[ipsc hostMax] stringValue]]; - [subnetMaskCombo selectItemWithObjectValue: [ipsc subnetMask]]; - [subnetId setStringValue: [ipsc subnetId]]; - [subnetHostAddrRange setStringValue: [ipsc subnetHostAddrRange]]; - [subnetBroadcast setStringValue: [ipsc subnetBroadcast]]; + if (ipsc) + { + if ([tabViewClassLess state] == NSOnState) + { + [ipsc setClassless: YES]; + } + else + { + [ipsc setClassless: NO]; + } + range = [[addrField stringValue] rangeOfString:@"/"]; + if (range.location != NSNotFound) + { + mask = -1; + mask <<= (32 - [[[addrField stringValue] substringFromIndex: range.location + 1] intValue]); + [addrField setStringValue: [[addrField stringValue] substringToIndex: range.location]]; + } + if (mask) + [ipsc initAddressAndMask: [[addrField stringValue] cStringUsingEncoding: NSASCIIStringEncoding] mask: mask]; + else + [ipsc initAddress: [[addrField stringValue] cStringUsingEncoding: NSASCIIStringEncoding]]; + [self initClassInfos: [ipsc networkClass]]; + [supernetRoute setStringValue: [ipsc supernetRoute: [[supernetMaskBitsCombo objectValueOfSelectedItem] intValue]]]; + [supernetAddrRange setStringValue: [ipsc supernetAddrRange: [[supernetMaskBitsCombo objectValueOfSelectedItem] intValue]]]; + astr = [[NSMutableAttributedString alloc] initWithString : [ipsc bitMap]]; + /* + if ([[ipsc maskBits] intValue] >= 24) + [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 27)]; + else if ([[ipsc maskBits] intValue] >= 16) + [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 18)]; + else + [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 9)]; + */ + [classBitMap setAttributedStringValue: astr]; + [classBinaryMap setStringValue: [ipsc binMap]]; + [classHexaMap setStringValue: [ipsc hexMap]]; + [subnetBitsCombo selectItemWithObjectValue: [[ipsc subnetBits] stringValue]]; + [maskBitsCombo selectItemWithObjectValue: [[ipsc maskBits] stringValue]]; + [maxSubnetsCombo selectItemWithObjectValue: [[ipsc subnetMax] stringValue]]; + [maxHostsBySubnetCombo selectItemWithObjectValue: [[ipsc hostMax] stringValue]]; + if ([wildcard state] == NSOnState) + { + [subnetMaskCombo selectItemWithObjectValue: [IPSubnetCalc denumberize: ~([ipsc subnetMaskIntValue])]]; + } + else + { + [subnetMaskCombo selectItemWithObjectValue: [ipsc subnetMask]]; + } + [subnetId setStringValue: [ipsc subnetId]]; + [subnetHostAddrRange setStringValue: [ipsc subnetHostAddrRange]]; + [subnetBroadcast setStringValue: [ipsc subnetBroadcast]]; + [bitsOnSlide setStringValue: [[ipsc maskBits] stringValue]]; + [subnetBitsSlide setFloatValue: [[ipsc maskBits] floatValue]]; + [self doSupernetCalc: [ipsc maskBitsIntValue]]; + [self bitsOnSlidePos]; + [subnetsHostsView reloadData]; + } } - (IBAction)calc:(id)sender { - [self doIPSubnetCalc:0]; + if (ipsc) + { + [self doIPSubnetCalc:[ipsc subnetMaskIntValue]]; + } + else + { + [self doIPSubnetCalc:0]; + } } - (IBAction)ipAddrEdit:(id)sender { - [self calc:nil]; + [self calc:nil]; } - (IBAction)changeAddrClassType:(id)sender { - NSMutableAttributedString *astr; - - if ([tabView numberOfTabViewItems] != 4) - { - [tabView addTabViewItem: [tab_tabView objectAtIndex:1]]; - [tabView addTabViewItem: [tab_tabView objectAtIndex:2]]; - [tabView addTabViewItem: [tab_tabView objectAtIndex:3]]; - [tab_tabView release]; - } + NSMutableAttributedString *astr; + + if ([tabView numberOfTabViewItems] != 4) + { + [tabView addTabViewItem: [tab_tabView objectAtIndex:1]]; + [tabView addTabViewItem: [tab_tabView objectAtIndex:2]]; + [tabView addTabViewItem: [tab_tabView objectAtIndex:3]]; + } if ([sender indexOfSelectedItem] == 0) { - astr = [[NSMutableAttributedString alloc] initWithString : @"nnnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhh"]; - /* - [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 9)]; - [astr addAttribute:NSForegroundColorAttributeName value:[NSColor redColor] range:NSMakeRange(9, 26)]; - */ - [classBitMap setAttributedStringValue: astr]; - [astr release]; - [classBinaryMap setStringValue: @"00000001000000000000000000000000"]; + astr = [[NSMutableAttributedString alloc] initWithString : NSLocalizedString(@"nnnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhh", nil)]; + /* + [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 9)]; + [astr addAttribute:NSForegroundColorAttributeName value:[NSColor redColor] range:NSMakeRange(9, 26)]; + */ + [classBitMap setAttributedStringValue: astr]; + [classBinaryMap setStringValue: NSLocalizedString(@"00000001000000000000000000000000", nil)]; } else if ([sender indexOfSelectedItem] == 1) { - astr = [[NSMutableAttributedString alloc] initWithString : @"nnnnnnnn.nnnnnnnn.hhhhhhhh.hhhhhhhh"]; - /* - [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 18)]; - [astr addAttribute:NSForegroundColorAttributeName value:[NSColor redColor] range:NSMakeRange(18, 17)]; - */ - [classBitMap setAttributedStringValue: astr]; - [astr release]; - [classBinaryMap setStringValue: @"10000000000000000000000000000000"]; + astr = [[NSMutableAttributedString alloc] initWithString : NSLocalizedString(@"nnnnnnnn.nnnnnnnn.hhhhhhhh.hhhhhhhh", nil)]; + /* + [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 18)]; + [astr addAttribute:NSForegroundColorAttributeName value:[NSColor redColor] range:NSMakeRange(18, 17)]; + */ + [classBitMap setAttributedStringValue: astr]; + [classBinaryMap setStringValue: NSLocalizedString(@"10000000000000000000000000000000", nil)]; } else if ([sender indexOfSelectedItem] == 2) { - astr = [[NSMutableAttributedString alloc] initWithString : @"nnnnnnnn.nnnnnnnn.nnnnnnnn.hhhhhhhh"]; - /* - [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 27)]; - [astr addAttribute:NSForegroundColorAttributeName value:[NSColor redColor] range:NSMakeRange(27, 8)]; - */ - [classBitMap setAttributedStringValue: astr]; - [astr release]; - [classBinaryMap setStringValue: @"11000000000000000000000000000000"]; - } - else if ([sender indexOfSelectedItem] == 3) - { - tab_tabView = [tabView tabViewItems]; - [tab_tabView retain]; - [tabView removeTabViewItem: [tab_tabView objectAtIndex: 1]]; - [tabView removeTabViewItem: [tab_tabView objectAtIndex: 2]]; - [tabView removeTabViewItem: [tab_tabView objectAtIndex: 3]]; - } + astr = [[NSMutableAttributedString alloc] initWithString : NSLocalizedString(@"nnnnnnnn.nnnnnnnn.nnnnnnnn.hhhhhhhh", nil)]; + /* + [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 27)]; + [astr addAttribute:NSForegroundColorAttributeName value:[NSColor redColor] range:NSMakeRange(27, 8)]; + */ + [classBitMap setAttributedStringValue: astr]; + [classBinaryMap setStringValue: NSLocalizedString(@"11000000000000000000000000000000", nil)]; + } + else if ([sender indexOfSelectedItem] == 3) + { + tab_tabView = [tabView tabViewItems]; + [tabView removeTabViewItem: [tab_tabView objectAtIndex: 1]]; + [tabView removeTabViewItem: [tab_tabView objectAtIndex: 2]]; + [tabView removeTabViewItem: [tab_tabView objectAtIndex: 3]]; + } } - (IBAction)changeMaxHosts:(id)sender @@ -225,132 +276,412 @@ - (IBAction)changeMaxHosts:(id)sender - (IBAction)changeMaxSubnets:(id)sender { - unsigned int mask = -1; + unsigned int mask = -1; - [self doIPSubnetCalc: (mask << (32 - ([sender indexOfSelectedItem] + [ipsc netBits])))]; + if (ipsc) + [self doIPSubnetCalc: (mask << (32 - ([sender indexOfSelectedItem] + [ipsc netBits])))]; + else + [self doIPSubnetCalc: (mask << (32 - ([sender indexOfSelectedItem] + 8)))]; } - (IBAction)changeSubnetBits:(id)sender { - unsigned int mask = -1; - - [self doIPSubnetCalc: (mask << (32 - ([[sender objectValueOfSelectedItem] intValue] + [ipsc netBits])))]; + unsigned int mask = -1; + + if (ipsc) + [self doIPSubnetCalc: (mask << (32 - ([[sender objectValueOfSelectedItem] intValue] + [ipsc netBits])))]; + else + [self doIPSubnetCalc: (mask << (32 - ([[sender objectValueOfSelectedItem] intValue] + 8)))]; } - (IBAction)changeSubnetMask:(id)sender { unsigned int sin_addr; - if ((inet_pton(AF_INET, [[sender objectValueOfSelectedItem] cStringUsingEncoding: NSASCIIStringEncoding], &sin_addr)) <= 0) - exit(-1); - [self doIPSubnetCalc: ntohl(sin_addr)]; + if ((inet_pton(AF_INET, [[sender objectValueOfSelectedItem] cStringUsingEncoding: NSASCIIStringEncoding]?:"0", &sin_addr )) <= 0) + { + NSAlert *alert = [[NSAlert alloc] init]; + [alert addButtonWithTitle: @"OK"]; + [alert setMessageText: @"Bad Subnet Mask"]; + [alert setAlertStyle: NSAlertStyleWarning]; + [alert setInformativeText:@"Bad format"]; + if ([alert runModal] == NSAlertFirstButtonReturn) + { + if (ipsc) + { + if ([wildcard state] == NSOnState) + { + [subnetMaskCombo selectItemWithObjectValue: [IPSubnetCalc denumberize: ~([ipsc subnetMaskIntValue])]]; + } + else + { + [subnetMaskCombo selectItemWithObjectValue: [ipsc subnetMask]]; + } + } + } + } + else { + if ([wildcard state] == NSOnState) + { + sin_addr = ~sin_addr; + [self doIPSubnetCalc: ntohl(sin_addr)]; + } + else + { + [self doIPSubnetCalc: ntohl(sin_addr)]; + } + } } - (IBAction)changeMaskBits:(id)sender { - unsigned int mask = -1; + unsigned int mask = -1; - [self doIPSubnetCalc:(mask << (32 - [[sender objectValueOfSelectedItem] intValue]))]; + [self doIPSubnetCalc:(mask << (32 - [[sender objectValueOfSelectedItem] intValue]))]; } - (void)doSupernetCalc:(int)maskBits { - unsigned int mask = -1; - unsigned int result = 0; - - [supernetMaskBitsCombo selectItemWithObjectValue: [NSString stringWithFormat: @"%d", maskBits]]; - [supernetMaskCombo selectItemWithObjectValue: [IPSubnetCalc denumberize: (mask << (32 - maskBits))]]; - if ([[ipsc networkClass] isEqualToString: @"A"]) - result = pow(2, 8 - maskBits); - else if ([[ipsc networkClass] isEqualToString: @"B"]) - result = pow(2, 16 - maskBits); - else if ([[ipsc networkClass] isEqualToString: @"C"]) - result = pow(2, 24 - maskBits); - [supernetMaxCombo selectItemWithObjectValue: [NSString stringWithFormat: @"%u", result]]; - result = pow(2, 32 - maskBits) - 2; - [supernetMaxAddr selectItemWithObjectValue: [NSString stringWithFormat: @"%u", result]]; - [supernetRoute setStringValue: [ipsc supernetRoute: maskBits]]; - [supernetAddrRange setStringValue: [ipsc supernetAddrRange: maskBits]]; + unsigned int mask = -1; + unsigned int result = 0; + + if (maskBits >=0 && maskBits <= 32 && ipsc) + { + [supernetMaskBitsCombo selectItemWithObjectValue: [NSString stringWithFormat: @"%d", maskBits]]; + //[supernetMaskCombo selectItemWithObjectValue: [IPSubnetCalc denumberize: (mask << ((8 - maskBits)) & 0x000000FF)]]; + [supernetMaskCombo selectItemWithObjectValue: [IPSubnetCalc denumberize: (mask << (32 - maskBits))]]; + if ([[ipsc networkClass] isEqualToString: @"A"]) + result = pow(2, 8 - maskBits); + else if ([[ipsc networkClass] isEqualToString: @"B"]) + result = pow(2, 16 - maskBits); + else if ([[ipsc networkClass] isEqualToString: @"C"]) + result = pow(2, 24 - maskBits); + if (result > 0) + [supernetMaxCombo selectItemWithObjectValue: [NSString stringWithFormat: @"%u", result]]; + else + [supernetMaxCombo selectItemWithObjectValue: @"1"]; + result = pow(2, 32 - maskBits) - 2; + [supernetMaxAddr selectItemWithObjectValue: [NSString stringWithFormat: @"%u", result]]; + [supernetRoute setStringValue: [ipsc supernetRoute: maskBits]]; + [supernetAddrRange setStringValue: [ipsc supernetAddrRange: maskBits]]; + result = pow(2, 32 - maskBits); + [supernetMaxSubnetsCombo selectItemWithObjectValue: [NSString stringWithFormat: @"%u", result]]; + } } - (IBAction)changeSupernetMaskBits:(id)sender { - [self doSupernetCalc: [[sender objectValueOfSelectedItem] intValue]]; + [self doSupernetCalc: [[sender objectValueOfSelectedItem] intValue]]; } - (IBAction)changeSupernetMask:(id)sender { - unsigned int mask; - - mask = [IPSubnetCalc numberize: [[sender objectValueOfSelectedItem] cStringUsingEncoding: NSASCIIStringEncoding]]; - [self doSupernetCalc: [IPSubnetCalc countOnBits: mask]]; + unsigned int mask; + + mask = [IPSubnetCalc numberize: [[sender objectValueOfSelectedItem] cStringUsingEncoding: NSASCIIStringEncoding]]; + [self doSupernetCalc: [IPSubnetCalc countOnBits: mask]]; } - (IBAction)changeSupernetMax:(id)sender { - if ([[ipsc networkClass] isEqualToString: @"A"]) - [self doSupernetCalc: 8 - [sender indexOfSelectedItem]]; - else if ([[ipsc networkClass] isEqualToString: @"B"]) - [self doSupernetCalc: 16 - [sender indexOfSelectedItem]]; - else if ([[ipsc networkClass] isEqualToString: @"C"]) - [self doSupernetCalc: 24 - [sender indexOfSelectedItem]]; + if (ipsc) + { + if ([[ipsc networkClass] isEqualToString: @"A"]) + [self doSupernetCalc: 8 - (int)[sender indexOfSelectedItem]]; + else if ([[ipsc networkClass] isEqualToString: @"B"]) + [self doSupernetCalc: 16 - (int)[sender indexOfSelectedItem]]; + else if ([[ipsc networkClass] isEqualToString: @"C"]) + [self doSupernetCalc: 24 - (int)[sender indexOfSelectedItem]]; + } } - (IBAction)changeSupernetMaxAddr:(id)sender { - [self changeSupernetMax: sender]; + [self changeSupernetMax: sender]; +} + +- (IBAction)changeSupernetMaxSubnets:(id)sender +{ + [self doSupernetCalc: (32 - (int)[sender indexOfSelectedItem])]; } - (int)numberOfRowsInTableView:(NSTableView *)aTableView { - return ([[ipsc subnetMax] intValue]); + if (ipsc) + { + if ([ipsc classless] == YES) + return (pow(2, ([[ipsc maskBits] intValue] - NETWORK_BITS_MIN_CLASSLESS))); + else + return ([[ipsc subnetMax] intValue]); + } + return 0; } +//Display all subnets info in the TableView Subnet/Hosts - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn - row:(int)rowIndex + row:(int)rowIndex { - IPSubnetCalc *ipsc_tmp; - unsigned int mask; - - mask = rowIndex; - mask <<= (32 - [ipsc maskBitsIntValue]); + IPSubnetCalc *ipsc_tmp; + unsigned int mask; + ipsc_tmp = [[IPSubnetCalc alloc] init]; - [ipsc_tmp initAddressAndMaskWithUnsignedInt:([ipsc netIdIntValue] | mask): [ipsc subnetMaskIntValue]]; - [ipsc_tmp autorelease]; - if ([[aTableColumn identifier] isEqualToString: @"numCol"]) - return ([NSNumber numberWithInt: rowIndex + 1]); - if ([[aTableColumn identifier] isEqualToString: @"rangeCol"]) - return ([[ipsc_tmp subnetHostAddrRange] retain]); - if ([[aTableColumn identifier] isEqualToString: @"subnetCol"]) - return ([ipsc_tmp subnetId]); - if ([[aTableColumn identifier] isEqualToString: @"broadcastCol"]) - return ([ipsc_tmp subnetBroadcast]); - return (nil); + if (ipsc_tmp && ipsc) + { + mask = rowIndex; + mask <<= (32 - [ipsc maskBitsIntValue]); + [ipsc_tmp initAddressAndMaskWithUnsignedInt:([ipsc netIdIntValue] | mask) mask: [ipsc subnetMaskIntValue]]; + if ([[aTableColumn identifier] isEqualToString: @"numCol"]) + return ([NSNumber numberWithInt: rowIndex + 1]); + else if ([[aTableColumn identifier] isEqualToString: @"rangeCol"]) + return ([ipsc_tmp subnetHostAddrRange]); + else if ([[aTableColumn identifier] isEqualToString: @"subnetCol"]) + return ([ipsc_tmp subnetId]); + else if ([[aTableColumn identifier] isEqualToString: @"broadcastCol"]) + return ([ipsc_tmp subnetBroadcast]); + } + return (nil); +} + +- (void)printAllSubnets +{ + IPSubnetCalc *ipsc_tmp; + unsigned int mask; + unsigned int i; + + if (ipsc) + { + for (i = 0; i < [[ipsc subnetMax] unsignedIntValue]; i++) + { + mask = i; + mask <<= (32 - [ipsc maskBitsIntValue]); + ipsc_tmp = [[IPSubnetCalc alloc] init]; + [ipsc_tmp initAddressAndMaskWithUnsignedInt:([ipsc netIdIntValue] | mask) mask: [ipsc subnetMaskIntValue]]; + NSLog(@"# : %d", i + 1); + NSLog(@"Subnet ID : %@", [ipsc_tmp subnetId]); + NSLog(@"IP Range : %@", [ipsc_tmp subnetHostAddrRange]); + NSLog(@"Broadcast : %@", [ipsc_tmp subnetBroadcast]); + } + } } - (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn - row:(int)rowIndex + row:(int)rowIndex +{ +} + +- (void)bitsOnSlidePos { + NSRect coordLabel, coordSlider; + + coordLabel = [bitsOnSlide frame]; + coordSlider = [subnetBitsSlide frame]; + coordLabel.origin.x = coordSlider.origin.x - (coordLabel.size.width / 2) + ([subnetBitsSlide knobThickness] / 2) + (((coordSlider.size.width - ([subnetBitsSlide knobThickness] / 2)) / [subnetBitsSlide numberOfTickMarks]) * ([subnetBitsSlide floatValue] - 1.0)); + //NSLog(@"slide x : %f label width : %f slide knob : %f slide width : %f n tick marks : %d slide value : %f x coord %f", coordSlider.origin.x, coordLabel.size.width, [subnetBitsSlide knobThickness], coordSlider.size.width, (int)[subnetBitsSlide numberOfTickMarks], [subnetBitsSlide floatValue], coordLabel.origin.x); + [bitsOnSlide setFrame: coordLabel]; + +} + +- (IBAction)subnetBitsSlide:(id)sender +{ + unsigned int mask = -1; + + [self doIPSubnetCalc:(mask << (32 - [sender intValue]))]; + [subnetsHostsView reloadData]; +} + +- (IBAction)changeTableViewClass:(id)sender +{ + if ([tabViewClassLess state] == NSOnState) + { + if (ipsc) + [ipsc setClassless: YES]; + } + else + { + if (ipsc) + [ipsc setClassless: NO]; + } + [subnetsHostsView reloadData]; +} + +- (IBAction)changeWildcard:(id)sender +{ + int i; + unsigned int mask = -1; + unsigned int addr_nl; + + [subnetMaskCombo removeAllItems]; + if ([wildcard state] == NSOnState) + { + for (i = 24; i > 1; i--) + { + addr_nl = (mask << i); + [subnetMaskCombo addItemWithObjectValue: [IPSubnetCalc denumberize: ~addr_nl]]; + } + if (ipsc) + { + [subnetMaskCombo selectItemWithObjectValue: [IPSubnetCalc denumberize: ~([ipsc subnetMaskIntValue])]]; + } + else + { + [subnetMaskCombo selectItemWithObjectValue: @"0.0.0.255"]; + } + } + else + { + for (i = 24; i > 1; i--) + { + addr_nl = (mask << i); + [subnetMaskCombo addItemWithObjectValue: [IPSubnetCalc denumberize: addr_nl]]; + } + if (ipsc) + { + [subnetMaskCombo selectItemWithObjectValue: [ipsc subnetMask]]; + } + else + { + [subnetMaskCombo selectItemWithObjectValue: @"255.0.0.0"]; + } + } +} + + +- (IBAction)exportCSV:(id)sender +{ + NSSavePanel *panel; + + if (ipsc) + { + panel = [NSSavePanel savePanel]; + [panel setAllowedFileTypes:[NSArray arrayWithObject: @"csv"]]; + [panel beginWithCompletionHandler: ^(NSModalResponse result){ + if (result == NSFileHandlingPanelOKButton) + { + NSString *str_csv; + unsigned int i; + unsigned mask; + NSMutableData *data_cvs; + NSFileHandle *file_cvs; + NSFileManager *file_mgt; + IPSubnetCalc *ipsc_tmp; + unsigned int netId; + unsigned int subnetMask; + unsigned int maskBits; + unsigned int subnetMax; + + if ((file_mgt = [[NSFileManager alloc] init])) + { + [file_mgt createFileAtPath:[[panel URL] path] contents:nil attributes:nil]; + } + data_cvs = [NSMutableData dataWithCapacity: 200000000]; + file_cvs = [NSFileHandle fileHandleForWritingAtPath: [[panel URL] path]]; + if (file_cvs && data_cvs) + { + netId = [ipsc netIdIntValue]; + subnetMask = [ipsc subnetMaskIntValue]; + maskBits = [ipsc maskBitsIntValue]; + subnetMax = [[ipsc subnetMax] unsignedIntValue]; + //[self printAllSubnets]; + str_csv = @"#;Subnet ID;Range;Broadcast\n"; + [data_cvs appendData: [str_csv dataUsingEncoding: NSASCIIStringEncoding]]; + @autoreleasepool { + for (i = 0; i < subnetMax; i++) + { + mask = i; + mask <<= (32 - maskBits); + if ((ipsc_tmp = [[IPSubnetCalc alloc] init])) + { + [ipsc_tmp initAddressAndMaskWithUnsignedInt: (netId | mask) mask: subnetMask]; + if ((str_csv = [[NSString alloc] initWithFormat:@"%d;%@;%@;%@\n", i + 1, [ipsc_tmp subnetId], [ipsc_tmp subnetHostAddrRange], [ipsc_tmp subnetBroadcast]])) + { + [data_cvs appendData: [str_csv dataUsingEncoding: NSASCIIStringEncoding]]; + } + } + } + [file_cvs writeData: data_cvs]; + [file_cvs synchronizeFile]; + [file_cvs closeFile]; + } + } + } + }]; + } +} + +- (IBAction)exportClipboard:(id)sender +{ + NSPasteboard *pb = [NSPasteboard generalPasteboard]; + NSString *str; + + [pb clearContents]; + str = [[NSString alloc] init]; + if (ipsc) + { + str = [str stringByAppendingFormat: @"Address Class Type: %@\nIP Address: %@\nSubnet ID: %@\nSubnet Mask: %@\nBroadcast: %@\nIP Range: %@\nMask Bits: %@\nSubnet Bits: %@\nMax Subnets: %@\nMax Hosts / Subnet : %@\nAddress Hexa: %@\nBitMap: %@\nBinMap: %@\n", [ipsc networkClass], [IPSubnetCalc denumberize:[ipsc hostAddrIntValue]], [ipsc subnetId], [ipsc subnetMask], [ipsc subnetBroadcast], [ipsc subnetHostAddrRange], [[ipsc maskBits] stringValue], [[ipsc subnetBits] stringValue], [[ipsc subnetMax] stringValue], [[ipsc hostMax] stringValue], [ipsc hexMap], [ipsc bitMap], [ipsc binMap]]; + [pb setString: str forType:NSStringPboardType]; + } +} + +- (IBAction)darkMode:(id)sender +{ + if (@available(macOS 10.14, *)) { + if ([darkModeMenu state] == NSControlStateValueOff) + { + NSApp.appearance = [NSAppearance appearanceNamed: NSAppearanceNameDarkAqua]; + [darkModeMenu setState: NSControlStateValueOn]; + } + else if ([darkModeMenu state] == NSControlStateValueOn) + { + NSApp.appearance = nil; + [darkModeMenu setState: NSControlStateValueOff]; + } + } +} + +-(NSString *)URLEncode:(NSString *)url +{ + NSString *url_encoded; + + if (url) + { + url_encoded = [[NSString alloc] initWithString: url]; + url_encoded = [url_encoded stringByReplacingOccurrencesOfString: @" " withString: @"%20"]; + url_encoded = [url_encoded stringByReplacingOccurrencesOfString: @"\n" withString: @"%0D"]; + url_encoded = [url_encoded stringByReplacingOccurrencesOfString: @"/" withString: @"%2F"]; + } + return (url_encoded); +} + +- (void)windowDidResize:(NSNotification *)notification +{ + [self bitsOnSlidePos]; } - (void)windowWillClose:(NSNotification *)notif { - [NSApp terminate: self]; + [NSApp terminate: self]; } - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - int i; + int i; unsigned int mask = -1; unsigned int addr_nl; - NSMutableAttributedString *astr; - + NSMutableAttributedString *astr; + for (i = 24; i > 1; i--) { addr_nl = (mask << i); - [subnetMaskCombo addItemWithObjectValue: [IPSubnetCalc denumberize: addr_nl]]; + if ([wildcard state] == NSOnState) + { + [subnetMaskCombo addItemWithObjectValue: [IPSubnetCalc denumberize: ~addr_nl]]; + } + else + { + [subnetMaskCombo addItemWithObjectValue: [IPSubnetCalc denumberize: addr_nl]]; + } } for (i = 8; i < 31; i++) [maskBitsCombo addItemWithObjectValue: [NSString stringWithFormat: @"%d", i]]; @@ -366,16 +697,17 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { mask = (pow(2, i)); [maxSubnetsCombo addItemWithObjectValue: [NSString stringWithFormat: @"%u", mask]]; } - astr = [[NSMutableAttributedString alloc] initWithString : @"nnnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhh"]; - /* - [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 9)]; - [astr addAttribute:NSForegroundColorAttributeName value:[NSColor redColor] range:NSMakeRange(9, 26)]; - */ - [classBitMap setAttributedStringValue: astr]; - [astr release]; + astr = [[NSMutableAttributedString alloc] initWithString : @"nnnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhh"]; + /* + [astr addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:NSMakeRange(0, 9)]; + [astr addAttribute:NSForegroundColorAttributeName value:[NSColor redColor] range:NSMakeRange(9, 26)]; + */ + [classBitMap setAttributedStringValue: astr]; [subnetMaskCombo selectItemWithObjectValue: @"255.0.0.0"]; [maskBitsCombo selectItemWithObjectValue: @"8"]; - [subnetBitsCombo selectItemWithObjectValue: @"0"]; + [subnetBitsCombo selectItemWithObjectValue: @"0"]; + //NSApp.appearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua]; + [self initCIDR]; } @end diff --git a/SubnetCalcUITests/Info.plist b/SubnetCalcUITests/Info.plist new file mode 100644 index 0000000..64d65ca --- /dev/null +++ b/SubnetCalcUITests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/SubnetCalcUITests/SubnetCalcUITests.m b/SubnetCalcUITests/SubnetCalcUITests.m new file mode 100644 index 0000000..1721b48 --- /dev/null +++ b/SubnetCalcUITests/SubnetCalcUITests.m @@ -0,0 +1,149 @@ +// +// SubnetCalcUITests.m +// SubnetCalcUITests +// +// Created by Julien Mulot on 18/11/2020. +// + +#import + +@interface SubnetCalcUITests : XCTestCase + +@end + +@implementation SubnetCalcUITests + +- (void)setUp { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + self.continueAfterFailure = NO; + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. +} + +- (void)testExample { + // UI tests must launch the application that they test. + XCUIApplication *app = [[XCUIApplication alloc] init]; + [app launch]; + + // Use recording to get started writing UI tests. + // Use XCTAssert and related functions to verify your tests produce the correct results. + + XCUIElement *subnetcalcWindow = [[XCUIApplication alloc] init].windows[@"SubnetCalc"]; + + XCUIElement *iptextfieldcellTextField = subnetcalcWindow.textFields[@"ipaddrfield"]; + [iptextfieldcellTextField click]; + [iptextfieldcellTextField typeText:@"10.32.2.52/30\r"]; + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"subnetbitscombo"] value], @"22"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"maskbitscombo"] value], @"30"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"subnetmaskcombo"] value], @"255.255.255.252"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"maxsubnetcombo"] value], @"4194304"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"maxhostscombo"] value], @"2"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"subnetrangetext"] value], @"10.32.2.53 - 10.32.2.54"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"subnetidtext"] value], @"10.32.2.52"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"subnetbroadcasttext"] value], @"10.32.2.55"); + [subnetcalcWindow.tabs[@"CIDR"] click]; + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmaskbits"] value], @"30"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmask"] value], @"255.255.255.252"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmaxsubnets"] value], @"4"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmaxaddr"] value], @"2"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmaxsupernets"] value], @"1"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"cidrnetwork"] value], @"10.32.2.52"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"cidrrange"] value], @"10.32.2.52 - 10.32.2.55"); + [subnetcalcWindow.tabs[@"Address"] click]; + XCTAssertEqualObjects([subnetcalcWindow.popUpButtons[@"addrclasstypecell"] value], @"Class A : 1.0.0.0 - 126.255.255.255"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"classbitmap"] value], @"nnnnnnnn.ssssssss.ssssssss.sssssshh"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"binarymap"] value], @"00001010.00100000.00000010.00110100"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"hexamap"] value], @"0A.20.02.34"); + + [iptextfieldcellTextField click]; + [iptextfieldcellTextField doubleClick]; + [iptextfieldcellTextField typeText:@"192.168.254.129/12\r"]; + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"subnetbitscombo"] value], @"0"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"maskbitscombo"] value], @"12"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"subnetmaskcombo"] value], @"255.240.0.0"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"maxsubnetcombo"] value], @"1"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"maxhostscombo"] value], @"1048574"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"subnetrangetext"] value], @"192.160.0.1 - 192.175.255.254"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"subnetidtext"] value], @"192.160.0.0"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"subnetbroadcasttext"] value], @"192.175.255.255"); + [subnetcalcWindow.tabs[@"CIDR"] click]; + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmaskbits"] value], @"12"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmask"] value], @"255.240.0.0"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmaxsubnets"] value], @"1048576"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmaxaddr"] value], @"1048574"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmaxsupernets"] value], @"4096"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"cidrnetwork"] value], @"192.160.0.0"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"cidrrange"] value], @"192.160.0.0 - 192.175.255.255"); + [subnetcalcWindow.tabs[@"Address"] click]; + XCTAssertEqualObjects([subnetcalcWindow.popUpButtons[@"addrclasstypecell"] value], @"Class C : 192.0.0.0 - 223.255.255.255"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"classbitmap"] value], @"nnnnnnnn.nnnnhhhh.hhhhhhhh.hhhhhhhh"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"binarymap"] value], @"11000000.10101000.11111110.10000001"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"hexamap"] value], @"C0.A8.FE.81"); + + [iptextfieldcellTextField click]; + [iptextfieldcellTextField doubleClick]; + [iptextfieldcellTextField typeText:@"172.16.242.132/8\r"]; + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"subnetbitscombo"] value], @"0"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"maskbitscombo"] value], @"8"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"subnetmaskcombo"] value], @"255.0.0.0"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"maxsubnetcombo"] value], @"1"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"maxhostscombo"] value], @"16777214"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"subnetrangetext"] value], @"172.0.0.1 - 172.255.255.254"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"subnetidtext"] value], @"172.0.0.0"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"subnetbroadcasttext"] value], @"172.255.255.255"); + [subnetcalcWindow.tabs[@"CIDR"] click]; + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmaskbits"] value], @"8"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmask"] value], @"255.0.0.0"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmaxsubnets"] value], @"16777216"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmaxaddr"] value], @"16777214"); + XCTAssertEqualObjects([subnetcalcWindow.comboBoxes[@"cidrmaxsupernets"] value], @"256"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"cidrnetwork"] value], @"172.0.0.0"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"cidrrange"] value], @"172.0.0.0 - 172.255.255.255"); + [subnetcalcWindow.tabs[@"Address"] click]; + XCTAssertEqualObjects([subnetcalcWindow.popUpButtons[@"addrclasstypecell"] value], @"Class B : 128.0.0.0 - 191.255.255.255"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"classbitmap"] value], @"nnnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhh"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"binarymap"] value], @"10101100.00010000.11110010.10000100"); + XCTAssertEqualObjects([subnetcalcWindow.staticTexts[@"hexamap"] value], @"AC.10.F2.84"); + + + [[subnetcalcWindow childrenMatchingType:XCUIElementTypeMenuButton].element click]; + [subnetcalcWindow/*@START_MENU_TOKEN@*/.menuItems[@"exportClipboard:"]/*[[".menuButtons",".menus",".menuItems[@\"Export Clipboard\"]",".menuItems[@\"exportClipboard:\"]"],[[[-1,3],[-1,2],[-1,1,2],[-1,0,1]],[[-1,3],[-1,2],[-1,1,2]],[[-1,3],[-1,2]]],[0]]@END_MENU_TOKEN@*/ click]; + + NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; + NSString *pastecontent = [pasteboard stringForType: NSPasteboardTypeString]; + NSString *validcontent = @"Address Class Type: B\n\ +IP Address: 172.16.242.132\n\ +Subnet ID: 172.0.0.0\n\ +Subnet Mask: 255.0.0.0\n\ +Broadcast: 172.255.255.255\n\ +IP Range: 172.0.0.1 - 172.255.255.254\n\ +Mask Bits: 8\n\ +Subnet Bits: 0\n\ +Max Subnets: 1\n\ +Max Hosts / Subnet : 16777214\n\ +Address Hexa: AC.10.F2.84\n\ +BitMap: nnnnnnnn.hhhhhhhh.hhhhhhhh.hhhhhhhh\n\ +BinMap: 10101100.00010000.11110010.10000100\n"; + XCTAssertEqualObjects(pastecontent, validcontent); + + //XCTAssert([subnetcalcWindow.popUpButtons[@"addrclasstypecell"] exists]); + //[subnetcalcWindow/*@START_MENU_TOKEN@*/.tabs[@"Subnets"]/*[[".tabGroups.tabs[@\"Subnets\"]",".tabs[@\"Subnets\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/ click]; + [iptextfieldcellTextField typeKey:@"q" modifierFlags:XCUIKeyModifierCommand]; +} + +- (void)testLaunchPerformance { + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + // This measures how long it takes to launch your application. + [self measureWithMetrics:@[[[XCTApplicationLaunchMetric alloc] init]] block:^{ + [[[XCUIApplication alloc] init] launch]; + }]; + } +} + +@end diff --git a/English.lproj/InfoPlist.strings b/en.lproj/InfoPlist.strings similarity index 100% rename from English.lproj/InfoPlist.strings rename to en.lproj/InfoPlist.strings diff --git a/subnetcalc-screenshot-final.png b/subnetcalc-screenshot-final.png deleted file mode 100644 index d78d3e6..0000000 Binary files a/subnetcalc-screenshot-final.png and /dev/null differ