Skip to content

Commit 6e4027a

Browse files
committed
New version 2.2
Add Broadcast and Hosts Range info to VLSM tabview and CSV export
1 parent 295e241 commit 6e4027a

File tree

4 files changed

+62
-9
lines changed

4 files changed

+62
-9
lines changed

Base.lproj/MainMenu.xib

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@
539539
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
540540
<clipView key="contentView" id="L0l-HJ-flz">
541541
<rect key="frame" x="1" y="1" width="567" height="485"/>
542-
<autoresizingMask key="autoresizingMask"/>
542+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
543543
<subviews>
544544
<tableView identifier="subnetsTabView" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" headerView="583" id="586">
545545
<rect key="frame" x="0.0" y="0.0" width="567" height="462"/>
@@ -1021,7 +1021,7 @@
10211021
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
10221022
<subviews>
10231023
<tableView identifier="tabViewVLSM" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" headerView="SoM-fw-J5F" id="Xp5-Sj-frC">
1024-
<rect key="frame" x="0.0" y="0.0" width="579" height="457"/>
1024+
<rect key="frame" x="0.0" y="0.0" width="884" height="457"/>
10251025
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
10261026
<size key="intercellSpacing" width="3" height="2"/>
10271027
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -1063,7 +1063,7 @@
10631063
</textFieldCell>
10641064
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
10651065
</tableColumn>
1066-
<tableColumn identifier="nameVLSMCol" editable="NO" width="203.843994140625" minWidth="36.844001770019531" maxWidth="1000" id="rxF-Te-Q4K">
1066+
<tableColumn identifier="nameVLSMCol" width="203.843994140625" minWidth="36.844001770019531" maxWidth="1000" id="rxF-Te-Q4K">
10671067
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Subnet Name">
10681068
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
10691069
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
@@ -1087,6 +1087,30 @@
10871087
</textFieldCell>
10881088
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
10891089
</tableColumn>
1090+
<tableColumn identifier="rangeVLSMCol" editable="NO" width="149.51300048828125" minWidth="60.01300048828125" maxWidth="1000" id="i5N-yj-4Gi">
1091+
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Range">
1092+
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
1093+
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
1094+
</tableHeaderCell>
1095+
<textFieldCell key="dataCell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" alignment="left" id="cBn-5z-Byv">
1096+
<font key="font" metaFont="system"/>
1097+
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
1098+
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
1099+
</textFieldCell>
1100+
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
1101+
</tableColumn>
1102+
<tableColumn identifier="broadcastVLSMCol" editable="NO" width="149.51300048828125" minWidth="60.01300048828125" maxWidth="1000" id="2mz-yz-Fkv">
1103+
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Broadcast">
1104+
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
1105+
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
1106+
</tableHeaderCell>
1107+
<textFieldCell key="dataCell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" alignment="left" id="mXd-Jc-hvk">
1108+
<font key="font" metaFont="system"/>
1109+
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
1110+
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
1111+
</textFieldCell>
1112+
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
1113+
</tableColumn>
10901114
</tableColumns>
10911115
<connections>
10921116
<outlet property="dataSource" destination="b7w-M5-ti7" id="wKM-A7-jKm"/>
@@ -1103,7 +1127,7 @@
11031127
<autoresizingMask key="autoresizingMask"/>
11041128
</scroller>
11051129
<tableHeaderView key="headerView" wantsLayer="YES" id="SoM-fw-J5F">
1106-
<rect key="frame" x="0.0" y="0.0" width="579" height="28"/>
1130+
<rect key="frame" x="0.0" y="0.0" width="884" height="28"/>
11071131
<autoresizingMask key="autoresizingMask"/>
11081132
</tableHeaderView>
11091133
</scrollView>

SubnetCalc-Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>2.1</string>
18+
<string>$(MARKETING_VERSION)</string>
1919
<key>CFBundleSignature</key>
2020
<string>JMUL</string>
2121
<key>CFBundleVersion</key>

SubnetCalc.xcodeproj/project.pbxproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@
401401
CODE_SIGN_IDENTITY = "Mac Developer";
402402
COMBINE_HIDPI_IMAGES = YES;
403403
COPY_PHASE_STRIP = NO;
404-
CURRENT_PROJECT_VERSION = 7;
404+
CURRENT_PROJECT_VERSION = 1;
405405
DEVELOPMENT_TEAM = VNLK894MAE;
406406
ENABLE_HARDENED_RUNTIME = YES;
407407
GCC_DYNAMIC_NO_PIC = NO;
@@ -411,6 +411,7 @@
411411
INFOPLIST_FILE = "SubnetCalc-Info.plist";
412412
INSTALL_PATH = "$(HOME)/Applications";
413413
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
414+
MARKETING_VERSION = 2.2;
414415
PRODUCT_BUNDLE_IDENTIFIER = net.mulot.subnetcalc;
415416
PRODUCT_NAME = SubnetCalc;
416417
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -429,7 +430,7 @@
429430
CODE_SIGN_ENTITLEMENTS = SubnetCalc.entitlements;
430431
CODE_SIGN_IDENTITY = "Mac Developer";
431432
COMBINE_HIDPI_IMAGES = YES;
432-
CURRENT_PROJECT_VERSION = 7;
433+
CURRENT_PROJECT_VERSION = 1;
433434
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
434435
DEVELOPMENT_TEAM = VNLK894MAE;
435436
ENABLE_HARDENED_RUNTIME = YES;
@@ -438,6 +439,7 @@
438439
INFOPLIST_FILE = "SubnetCalc-Info.plist";
439440
INSTALL_PATH = /Applications;
440441
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
442+
MARKETING_VERSION = 2.2;
441443
PRODUCT_BUNDLE_IDENTIFIER = net.mulot.subnetcalc;
442444
PRODUCT_NAME = SubnetCalc;
443445
PROVISIONING_PROFILE_SPECIFIER = "";

SubnetCalcAppDelegate.swift

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,32 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
848848
else if (tableColumn!.identifier.rawValue == "usedVLSMCol") {
849849
return (subnetsVLSM[row].2)
850850
}
851+
else if (tableColumn!.identifier.rawValue == "rangeVLSMCol") {
852+
var subnet = IPSubnetCalc.numerize(ipAddress: ipsc!.subnetId())
853+
if (row > 0) {
854+
for index in (0...(row - 1)) {
855+
subnet = subnet + ~IPSubnetCalc.numerize(maskbits: subnetsVLSM[index].0) + 1
856+
}
857+
}
858+
let ipsc_tmp = IPSubnetCalc(ipAddress: IPSubnetCalc.digitize(ipAddress: subnet), maskbits: (subnetsVLSM[row].0))
859+
if (ipsc_tmp != nil)
860+
{
861+
return (ipsc_tmp!.subnetRange())
862+
}
863+
}
864+
else if (tableColumn!.identifier.rawValue == "broadcastVLSMCol") {
865+
var subnet = IPSubnetCalc.numerize(ipAddress: ipsc!.subnetId())
866+
if (row > 0) {
867+
for index in (0...(row - 1)) {
868+
subnet = subnet + ~IPSubnetCalc.numerize(maskbits: subnetsVLSM[index].0) + 1
869+
}
870+
}
871+
let ipsc_tmp = IPSubnetCalc(ipAddress: IPSubnetCalc.digitize(ipAddress: subnet), maskbits: (subnetsVLSM[row].0))
872+
if (ipsc_tmp != nil)
873+
{
874+
return (ipsc_tmp!.subnetBroadcast())
875+
}
876+
}
851877
}
852878
}
853879
}
@@ -1174,7 +1200,7 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
11741200
var cvsData = Data(capacity: Constants.BUFFER_LINES)
11751201
let cvsFile = FileHandle(forWritingAtPath: panel.url!.path)
11761202
if (cvsFile != nil) {
1177-
var cvsStr = "#;Subnet ID;Mask bits;Subnet Name;Used\n"
1203+
var cvsStr = "#;Subnet Name;Subnet ID;Mask bits;Hosts Range;Broadcast;Used\n"
11781204
let subnetid = IPSubnetCalc.numerize(ipAddress: self.ipsc!.subnetId())
11791205
for index in (0...(self.subnetsVLSM.count - 1)) {
11801206
var subnet = subnetid
@@ -1183,8 +1209,9 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate,
11831209
subnet = subnet + ~IPSubnetCalc.numerize(maskbits: self.subnetsVLSM[index2].0) + 1
11841210
}
11851211
}
1212+
let ipsc_tmp = IPSubnetCalc(ipAddress: IPSubnetCalc.digitize(ipAddress: subnet), maskbits: self.subnetsVLSM[index].0)!
11861213
//print("VLSM: \(index + 1);\(IPSubnetCalc.digitize(ipAddress: subnet));\(self.subnetsVLSM[index].0);\(self.subnetsVLSM[index].1);\(self.subnetsVLSM[index].2)\n")
1187-
cvsStr.append("\(index + 1);\(IPSubnetCalc.digitize(ipAddress: subnet));\(self.subnetsVLSM[index].0);\(self.subnetsVLSM[index].1);\(self.subnetsVLSM[index].2)\n")
1214+
cvsStr.append("\(index + 1);\(self.subnetsVLSM[index].1);\(ipsc_tmp.subnetId());\(self.subnetsVLSM[index].0);\(ipsc_tmp.subnetRange());\(ipsc_tmp.subnetBroadcast());\(self.subnetsVLSM[index].2)\n")
11881215
}
11891216
cvsData.append(cvsStr.data(using: String.Encoding.ascii)!)
11901217
cvsFile!.write(cvsData)

0 commit comments

Comments
 (0)