diff --git a/Base.lproj/MainMenu.xib b/Base.lproj/MainMenu.xib index c680f3c..c471e3c 100644 --- a/Base.lproj/MainMenu.xib +++ b/Base.lproj/MainMenu.xib @@ -831,7 +831,7 @@ - + @@ -1021,7 +1021,7 @@ - + @@ -1063,12 +1063,12 @@ - + - + @@ -1087,6 +1087,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -1103,7 +1127,7 @@ - + diff --git a/README.md b/README.md index ef4fb4b..31185b7 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # SubnetCalc Subnet Calculator for MacOS -What's New in version 2.1: -- FLSM (Fixed Length Subnet Mask) support -- VLSM (Variable Length Subnet Mask) support -- Export FSLM result in a CSV file -- Export VSLM result in a CSV file +What's New in version 2.2: +- Change the VLSM Subnet Name by editing the corresponding column +- Display Hosts Range and Broadcast columns in the VLSM view +- Export Hosts Range and Broadcast infos to the CSV file + For more information: http://subnetcalc.mulot.org diff --git a/SubnetCalc-Info.plist b/SubnetCalc-Info.plist index 0a089da..4924201 100644 --- a/SubnetCalc-Info.plist +++ b/SubnetCalc-Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.1 + $(MARKETING_VERSION) CFBundleSignature JMUL CFBundleVersion diff --git a/SubnetCalc.xcodeproj/project.pbxproj b/SubnetCalc.xcodeproj/project.pbxproj index 3021f2a..f50e9e9 100644 --- a/SubnetCalc.xcodeproj/project.pbxproj +++ b/SubnetCalc.xcodeproj/project.pbxproj @@ -401,7 +401,7 @@ CODE_SIGN_IDENTITY = "Mac Developer"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 8; DEVELOPMENT_TEAM = VNLK894MAE; ENABLE_HARDENED_RUNTIME = YES; GCC_DYNAMIC_NO_PIC = NO; @@ -411,6 +411,7 @@ INFOPLIST_FILE = "SubnetCalc-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MARKETING_VERSION = 2.2; PRODUCT_BUNDLE_IDENTIFIER = net.mulot.subnetcalc; PRODUCT_NAME = SubnetCalc; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -429,7 +430,7 @@ CODE_SIGN_ENTITLEMENTS = SubnetCalc.entitlements; CODE_SIGN_IDENTITY = "Mac Developer"; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 7; + CURRENT_PROJECT_VERSION = 8; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = VNLK894MAE; ENABLE_HARDENED_RUNTIME = YES; @@ -438,6 +439,7 @@ INFOPLIST_FILE = "SubnetCalc-Info.plist"; INSTALL_PATH = /Applications; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MARKETING_VERSION = 2.2; PRODUCT_BUNDLE_IDENTIFIER = net.mulot.subnetcalc; PRODUCT_NAME = SubnetCalc; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/SubnetCalcAppDelegate.swift b/SubnetCalcAppDelegate.swift index e8e9271..3c1b1a5 100644 --- a/SubnetCalcAppDelegate.swift +++ b/SubnetCalcAppDelegate.swift @@ -776,6 +776,18 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, return 0 } + //Invoked when editing a value from a TabView + //Used only for VLSM Subnet Name + func tableView(_ tableView: NSTableView, setObjectValue object: Any?, for tableColumn: NSTableColumn?, row: Int) + { + if (tableView == viewVLSM) { + if (tableColumn!.identifier.rawValue == "nameVLSMCol") { + //print("edit tableView Name VLSM: \(row) \(object as! String)") + subnetsVLSM[row].1 = object as! String + } + } + } + //Display all subnets info in the TableView Subnet/Hosts func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? @@ -848,12 +860,38 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, else if (tableColumn!.identifier.rawValue == "usedVLSMCol") { return (subnetsVLSM[row].2) } + else if (tableColumn!.identifier.rawValue == "rangeVLSMCol") { + var subnet = IPSubnetCalc.numerize(ipAddress: ipsc!.subnetId()) + if (row > 0) { + for index in (0...(row - 1)) { + subnet = subnet + ~IPSubnetCalc.numerize(maskbits: subnetsVLSM[index].0) + 1 + } + } + let ipsc_tmp = IPSubnetCalc(ipAddress: IPSubnetCalc.digitize(ipAddress: subnet), maskbits: (subnetsVLSM[row].0)) + if (ipsc_tmp != nil) + { + return (ipsc_tmp!.subnetRange()) + } + } + else if (tableColumn!.identifier.rawValue == "broadcastVLSMCol") { + var subnet = IPSubnetCalc.numerize(ipAddress: ipsc!.subnetId()) + if (row > 0) { + for index in (0...(row - 1)) { + subnet = subnet + ~IPSubnetCalc.numerize(maskbits: subnetsVLSM[index].0) + 1 + } + } + let ipsc_tmp = IPSubnetCalc(ipAddress: IPSubnetCalc.digitize(ipAddress: subnet), maskbits: (subnetsVLSM[row].0)) + if (ipsc_tmp != nil) + { + return (ipsc_tmp!.subnetBroadcast()) + } + } } } } return (nil) } - + @IBAction func subnetBitsSlide(_ sender: AnyObject) { if (ipsc == nil) @@ -1174,7 +1212,7 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, var cvsData = Data(capacity: Constants.BUFFER_LINES) let cvsFile = FileHandle(forWritingAtPath: panel.url!.path) if (cvsFile != nil) { - var cvsStr = "#;Subnet ID;Mask bits;Subnet Name;Used\n" + var cvsStr = "#;Subnet Name;Subnet ID;Mask bits;Hosts Range;Broadcast;Used\n" let subnetid = IPSubnetCalc.numerize(ipAddress: self.ipsc!.subnetId()) for index in (0...(self.subnetsVLSM.count - 1)) { var subnet = subnetid @@ -1183,8 +1221,9 @@ class SubnetCalcAppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate, subnet = subnet + ~IPSubnetCalc.numerize(maskbits: self.subnetsVLSM[index2].0) + 1 } } + let ipsc_tmp = IPSubnetCalc(ipAddress: IPSubnetCalc.digitize(ipAddress: subnet), maskbits: self.subnetsVLSM[index].0)! //print("VLSM: \(index + 1);\(IPSubnetCalc.digitize(ipAddress: subnet));\(self.subnetsVLSM[index].0);\(self.subnetsVLSM[index].1);\(self.subnetsVLSM[index].2)\n") - cvsStr.append("\(index + 1);\(IPSubnetCalc.digitize(ipAddress: subnet));\(self.subnetsVLSM[index].0);\(self.subnetsVLSM[index].1);\(self.subnetsVLSM[index].2)\n") + 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") } cvsData.append(cvsStr.data(using: String.Encoding.ascii)!) cvsFile!.write(cvsData)