本文整理汇总了C#中System.Collections.Dictionary.ToJSON方法的典型用法代码示例。如果您正苦于以下问题:C# Dictionary.ToJSON方法的具体用法?C# Dictionary.ToJSON怎么用?C# Dictionary.ToJSON使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Dictionary
的用法示例。
在下文中一共展示了Dictionary.ToJSON方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTwitterFilesToProject
private static void AddTwitterFilesToProject()
{
string _twitterNativeFolder = AssetsUtility.AssetPathToAbsolutePath(kRelativePathToTwitterNativeFiles);
string _twitterConfileFile = Path.Combine(_twitterNativeFolder, "Config.txt");
// Re move the files if version has changed
if (File.Exists(_twitterConfileFile))
{
string _fileVersion = File.ReadAllText(_twitterConfileFile);
if (string.Compare(_fileVersion, EditorPrefs.GetString(kTwitterConfigKey, "0")) == 0)
return;
EditorPrefs.SetString(kTwitterConfigKey, _fileVersion);
}
// Start moving files and framework
string _projectPath = AssetsUtility.GetProjectPath();
string _twitterExternalFolder = Path.Combine(_projectPath, kExtenalFolderRelativePath + "/Twitter");
if (Directory.Exists(_twitterExternalFolder))
Directory.Delete(_twitterExternalFolder, true);
Directory.CreateDirectory(_twitterExternalFolder);
List<string> _twitterFilesList = new List<string>();
List<string> _twitterFolderList = new List<string>();
// ***********************
// Source code section
// ***********************
string _nativeCodeSourceFolder = Path.Combine(_twitterNativeFolder, "Source");
string _nativeCodeDestFolder = Path.Combine(_twitterExternalFolder, "Source");
// Copying folder
IOExtensions.CopyFilesRecursively(_nativeCodeSourceFolder, _nativeCodeDestFolder);
// Adding source folder to modifier
_twitterFolderList.Add("Twitter/Source:-fno-objc-arc");
// ***********************
// Framework Section
// ***********************
string[] _zippedFrameworkFiles = Directory.GetFiles(_twitterNativeFolder, "*.gz", SearchOption.AllDirectories);
string _destFrameworkFolder = Path.Combine(_twitterExternalFolder, "Framework");
if (!Directory.Exists(_destFrameworkFolder))
Directory.CreateDirectory(_destFrameworkFolder);
// Iterate through each zip files
foreach (string _curZippedFile in _zippedFrameworkFiles)
{
Zip.DecompressToDirectory(_curZippedFile, _destFrameworkFolder);
// Adding file to modifier
_twitterFilesList.Add("Twitter/Framework/" + Path.GetFileNameWithoutExtension(_curZippedFile));
}
// ***********************
// Xcode modifier Section
// ***********************
Dictionary<string, object> _xcodeModDict = new Dictionary<string, object>();
_xcodeModDict["group"] = "NativePlugins-Twitter";
_xcodeModDict["libs"] = new string[0];
_xcodeModDict["frameworks"] = new string[] {
"Accounts.framework:weak",
"Social.framework:weak"
};
_xcodeModDict["headerpaths"] = new string[0];
_xcodeModDict["files"] = _twitterFilesList;
_xcodeModDict["folders"] = _twitterFolderList;
_xcodeModDict["excludes"] = new string[] {
"^.*.meta$",
"^.*.mdown$",
"^.*.pdf$",
"^.*.DS_Store"
};
_xcodeModDict["compiler_flags"] = new string[0];
_xcodeModDict["linker_flags"] = new string[0];
File.WriteAllText(GetTwitterXcodeModFilePath(), _xcodeModDict.ToJSON());
}
示例2: SendConfigInfoToNative
protected void SendConfigInfoToNative(string[] _senderIDs, Dictionary<string,string> _customKeysInfo, bool _needsBigStyle, Texture2D _whiteSmallNotificationIcon)
{
if (_senderIDs.Length == 0)
{
Console.LogError(Constants.kDebugTag, "Add senderid list for notifications to work");
}
List<string> list = new List<string>(_senderIDs);
//Pass this to android
Plugin.Call(NativeInfo.Methods.INITIALIZE,list.ToJSON(),_customKeysInfo.ToJSON(), _needsBigStyle, _whiteSmallNotificationIcon == null ? false : true);
}
示例3: PickImageFinished
private void PickImageFinished (string _path)
{
Dictionary<string, object> _packedData = new Dictionary<string, object>();
_packedData[kImagePath] = _path;
_packedData[kFinishReason] = (int)ePickImageFinishReason.SELECTED;
if (NPBinding.MediaLibrary != null)
NPBinding.MediaLibrary.InvokeMethod(kPickImageFinishedEvent, _packedData.ToJSON());
// Reset view
ResetView();
}
示例4: PickImageCancelled
private void PickImageCancelled()
{
Dictionary<string, int> _packedData = new Dictionary<string, int>();
_packedData[kFinishReason] = (int)ePickImageFinishReason.CANCELLED;
if (NPBinding.MediaLibrary != null)
NPBinding.MediaLibrary.InvokeMethod(kPickImageFinishedEvent, _packedData.ToJSON());
// Reset view
ResetView();
}
示例5: AlertDialogCallback
void AlertDialogCallback(string _selectedButton, string _callerTag)
{
Dictionary<string, string> _dataDict = new Dictionary<string, string>();
_dataDict[kButtonPressed] = _selectedButton;
_dataDict[kCaller] = _callerTag;
if (NPBinding.UI != null)
NPBinding.UI.InvokeMethod(kAlertDialogClosedEvent, _dataDict.ToJSON());
}
示例6: LoginPromptCallback
void LoginPromptCallback(string _selectedButton, GUIPromptDialog.InputFieldElement[] _inputList)
{
Dictionary<string, string> _dataDict = new Dictionary<string, string>();
_dataDict[kButtonPressed] = _selectedButton;
//Adding some default text here
_dataDict[kUserName] = "";
_dataDict[kPassword] = "";
if(_inputList != null)
{
if(_inputList[0] != null)
{
_dataDict[kUserName] = _inputList[0].GetCurrentText();
}
if(_inputList[1] != null)
{
_dataDict[kPassword] = _inputList[1].GetCurrentText();
}
}
if (NPBinding.UI != null)
NPBinding.UI.InvokeMethod(kLoginPromptDialogClosedEvent, _dataDict.ToJSON());
}
示例7: SingleFieldPromptCallback
void SingleFieldPromptCallback(string _selectedButton, GUIPromptDialog.InputFieldElement[] _inputList)
{
Dictionary<string, string> _dataDict = new Dictionary<string, string>();
_dataDict[kButtonPressed] = _selectedButton;
if(_inputList != null && _inputList[0] != null)
{
_dataDict[kInput] = _inputList[0].GetCurrentText();
}
if (NPBinding.UI != null)
NPBinding.UI.InvokeMethod(kSingleFieldPromptDialogClosedEvent, _dataDict.ToJSON());
}