export profile Data
This commit is contained in:
1 parent
c8522de476
commit
cc285d5488
6 files changed
+44
-16
No files matched your search
@@ -985,9 +985,9 @@ ICAgICAgICAgICAgICA
|
|||||||
</constraints>
|
</constraints>
|
||||||
<items>
|
<items>
|
||||||
<navigationItem title="Controller & Widget Profiles" id="Q2V-XF-4jq">
|
<navigationItem title="Controller & Widget Profiles" id="Q2V-XF-4jq">
|
||||||
<barButtonItem key="leftBarButtonItem" title="Exit" width="90" style="plain" id="Bhn-IO-Wlt" userLabel="Delete">
|
<barButtonItem key="leftBarButtonItem" title="Export All Pofiles" width="90" style="plain" id="Bhn-IO-Wlt" userLabel="Export Data">
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="exitTapped:" destination="Atv-Nj-0qv" id="pwG-sO-9he"/>
|
<action selector="exportDataTapped:" destination="Atv-Nj-0qv" id="pwG-sO-9he"/>
|
||||||
</connections>
|
</connections>
|
||||||
</barButtonItem>
|
</barButtonItem>
|
||||||
<rightBarButtonItems>
|
<rightBarButtonItems>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<objects>
|
<objects>
|
||||||
<viewController id="dgh-JZ-Q7z" customClass="MainFrameViewController" sceneMemberID="viewController">
|
<viewController id="dgh-JZ-Q7z" customClass="MainFrameViewController" sceneMemberID="viewController">
|
||||||
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" id="Rtu-AT-Alw" customClass="AppCollectionView">
|
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" id="Rtu-AT-Alw" customClass="AppCollectionView">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="414" height="804"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<color key="backgroundColor" red="0.3333333432674408" green="0.3333333432674408" blue="0.3333333432674408" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="backgroundColor" red="0.3333333432674408" green="0.3333333432674408" blue="0.3333333432674408" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="15" minimumInteritemSpacing="15" id="YcZ-cR-3tK">
|
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="15" minimumInteritemSpacing="15" id="YcZ-cR-3tK">
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
<viewControllerLayoutGuide type="bottom" id="HaZ-6S-ZpN"/>
|
<viewControllerLayoutGuide type="bottom" id="HaZ-6S-ZpN"/>
|
||||||
</layoutGuides>
|
</layoutGuides>
|
||||||
<view key="view" contentMode="scaleToFill" id="iNk-qF-gIr" customClass="UIScrollView">
|
<view key="view" contentMode="scaleToFill" id="iNk-qF-gIr" customClass="UIScrollView">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="499" height="3500"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Resolution " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8zy-ri-Dqc">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Resolution " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8zy-ri-Dqc">
|
||||||
@@ -676,7 +676,6 @@ ICAgICAgICAgICAgIA
|
|||||||
<objects>
|
<objects>
|
||||||
<navigationController id="ftZ-kC-fxI" sceneMemberID="viewController">
|
<navigationController id="ftZ-kC-fxI" sceneMemberID="viewController">
|
||||||
<navigationBar key="navigationBar" contentMode="scaleToFill" barStyle="black" translucent="NO" id="0ZA-Ec-QgD">
|
<navigationBar key="navigationBar" contentMode="scaleToFill" barStyle="black" translucent="NO" id="0ZA-Ec-QgD">
|
||||||
<rect key="frame" x="0.0" y="48" width="414" height="44"/>
|
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<color key="backgroundColor" red="0.66666668653488159" green="0.66666668653488159" blue="0.66666668653488159" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="backgroundColor" red="0.66666668653488159" green="0.66666668653488159" blue="0.66666668653488159" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
<color key="barTintColor" red="0.66666668653488159" green="0.66666668653488159" blue="0.66666668653488159" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="barTintColor" red="0.66666668653488159" green="0.66666668653488159" blue="0.66666668653488159" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
@@ -750,7 +749,7 @@ ICAgICAgICAgICAgIA
|
|||||||
<viewControllerLayoutGuide type="bottom" id="TWA-bF-hnk"/>
|
<viewControllerLayoutGuide type="bottom" id="TWA-bF-hnk"/>
|
||||||
</layoutGuides>
|
</layoutGuides>
|
||||||
<view key="view" opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="Mwx-9q-yJJ">
|
<view key="view" opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="Mwx-9q-yJJ">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="650" height="896"/>
|
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jnu-63-bcf" customClass="ToolBarContainerView">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jnu-63-bcf" customClass="ToolBarContainerView">
|
||||||
@@ -991,7 +990,7 @@ ICAgICAgICAgICAgIA
|
|||||||
<navigationItem title="Controller & Widget Profiles" id="5pN-Sn-SCN">
|
<navigationItem title="Controller & Widget Profiles" id="5pN-Sn-SCN">
|
||||||
<barButtonItem key="leftBarButtonItem" title="Exit" id="D9X-7p-9oc">
|
<barButtonItem key="leftBarButtonItem" title="Exit" id="D9X-7p-9oc">
|
||||||
<connections>
|
<connections>
|
||||||
<action selector="exitTapped:" destination="0K8-kQ-xlN" id="Sam-Ct-kqC"/>
|
<action selector="exportDataTapped:" destination="0K8-kQ-xlN" id="Sam-Ct-kqC"/>
|
||||||
</connections>
|
</connections>
|
||||||
</barButtonItem>
|
</barButtonItem>
|
||||||
<rightBarButtonItems>
|
<rightBarButtonItems>
|
||||||
|
|||||||
@@ -247,7 +247,8 @@ static CGRect streamViewBounds;
|
|||||||
/*
|
/*
|
||||||
NSString *documentsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
|
NSString *documentsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject;
|
||||||
NSString *path = [documentsPath stringByAppendingPathComponent:@"newDefault.bin"];
|
NSString *path = [documentsPath stringByAppendingPathComponent:@"newDefault.bin"];
|
||||||
[newProfileEncoded writeToFile:path atomically:YES];
|
|
||||||
|
[profiles writeToFile:path atomically:YES];
|
||||||
NSLog(@"默认 Profile 数据已保存到: %@", path);
|
NSLog(@"默认 Profile 数据已保存到: %@", path);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**
|
/**
|
||||||
This view displays a list of on screen controller profiles and gives the user the ability to select any of the profiles to be the 'Selected' profile whose on screen controller layout configuration will be shown on the game stream view, or in the on screen controller layout view. This view also allows the user to swipe and delete any of the listed profiles.
|
This view displays a list of on screen controller profiles and gives the user the ability to select any of the profiles to be the 'Selected' profile whose on screen controller layout configuration will be shown on the game stream view, or in the on screen controller layout view. This view also allows the user to swipe and delete any of the listed profiles.
|
||||||
*/
|
*/
|
||||||
@interface OSCProfilesTableViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
|
@interface OSCProfilesTableViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, UIDocumentPickerDelegate>
|
||||||
|
|
||||||
- (void)profileViewRefresh;
|
- (void)profileViewRefresh;
|
||||||
|
|
||||||
|
|||||||
@@ -166,9 +166,37 @@ const double NAV_BAR_HEIGHT = 50;
|
|||||||
[self profileViewRefresh];
|
[self profileViewRefresh];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction) exportDataTapped:(id)sender {
|
||||||
|
// 创建临时占位文件(仅用于提供文件名)
|
||||||
|
NSString *tempPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"profiles.bin"];
|
||||||
|
[[NSData new] writeToFile:tempPath atomically:YES]; // 空文件
|
||||||
|
|
||||||
|
// 初始化选择器
|
||||||
|
UIDocumentPickerViewController *picker = [[UIDocumentPickerViewController alloc] initWithURL:[NSURL fileURLWithPath:tempPath] inMode:UIDocumentPickerModeExportToService];
|
||||||
|
picker.delegate = self;
|
||||||
|
[self presentViewController:picker animated:YES completion:nil];
|
||||||
|
}
|
||||||
|
|
||||||
- (IBAction) exitTapped:(id)sender {
|
#pragma mark - UIDocumentPickerDelegate
|
||||||
[self dismissViewControllerAnimated:YES completion:nil];
|
- (void)documentPicker:(UIDocumentPickerViewController *)controller
|
||||||
|
didPickDocumentsAtURLs:(NSArray<NSURL *> *)urls {
|
||||||
|
if (urls.count == 0) return;
|
||||||
|
NSURL *destinationURL = urls.firstObject;
|
||||||
|
NSArray *profiles = [profilesManager getAllProfiles];
|
||||||
|
// 1. 序列化数据
|
||||||
|
NSError *error;
|
||||||
|
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:profiles requiringSecureCoding:YES error:&error];
|
||||||
|
if (!data) {
|
||||||
|
NSLog(@"序列化失败: %@", error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 2. 安全写入
|
||||||
|
[destinationURL startAccessingSecurityScopedResource];
|
||||||
|
BOOL success = [data writeToURL:destinationURL options:NSDataWritingAtomic error:&error];
|
||||||
|
[destinationURL stopAccessingSecurityScopedResource];
|
||||||
|
if (!success) {
|
||||||
|
NSLog(@"写入失败: %@", error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -536,31 +536,31 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Bhn-IO-Wlt.title" : {
|
"Bhn-IO-Wlt.title" : {
|
||||||
"comment" : "Class = \"UIBarButtonItem\"; title = \"Exit\"; ObjectID = \"Bhn-IO-Wlt\";",
|
"comment" : "Class = \"UIBarButtonItem\"; title = \"Export All Pofiles\"; ObjectID = \"Bhn-IO-Wlt\";",
|
||||||
"extractionState" : "extracted_with_value",
|
"extractionState" : "extracted_with_value",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"en" : {
|
"en" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "new",
|
"state" : "new",
|
||||||
"value" : "Exit"
|
"value" : "Export All Pofiles"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zh-Hans" : {
|
"zh-Hans" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "needs_review",
|
"state" : "needs_review",
|
||||||
"value" : "退出"
|
"value" : "导出所有"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zh-Hant" : {
|
"zh-Hant" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "needs_review",
|
"state" : "needs_review",
|
||||||
"value" : "退出"
|
"value" : "导出所有"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"zh-HK" : {
|
"zh-HK" : {
|
||||||
"stringUnit" : {
|
"stringUnit" : {
|
||||||
"state" : "needs_review",
|
"state" : "needs_review",
|
||||||
"value" : "退出"
|
"value" : "导出所有"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user