{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"3840e62d4c2787c0ffd835666a7d987e\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 178,\n \"max_line_length\": 271,\n \"avg_line_length\": 45.82022471910113,\n \"alnum_prop\": 0.6705492888670918,\n \"repo_name\": \"CompilerTeaching/CompilerTeaching.github.io\",\n \"id\": \"18bbd9c982bd62c8a451459b6f17354e07465f5b\",\n \"size\": \"8156\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"mysorescript/doxygen/main_8cc.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"118682\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"4461393\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"149964\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"50\"\n },\n {\n \"name\": \"TeX\",\n \"bytes\": \"265\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":917,"cells":{"text":{"kind":"string","value":"Contributing to Girder\n======================\n\nThere are many ways to contribute to Girder, with varying levels of effort. Do try to\nlook through the documentation first if something is unclear, and let us know how we can\ndo better.\n\n- Ask a question on the `Girder users email list `_\n- Ask a question in the `Gitter Forum `_\n- Submit a feature request or bug, or add to the discussion on the `Girder issue tracker `_\n- Submit a `Pull Request `_ to improve Girder or its documentation\n\nWe encourage a range of contributions, from patches that include passing tests and\ndocumentation, all the way down to half-baked ideas that launch discussions.\n\nThe PR Process, CircleCI, and Related Gotchas\n---------------------------------------------\n\nHow to submit a PR\n^^^^^^^^^^^^^^^^^^\n\nIf you are new to Girder development and you don't have push access to the Girder\nrepository, here are the steps:\n\n1. `Fork and clone `_ the repository.\n2. Create a branch.\n3. `Push `_ the branch to your GitHub fork.\n4. Create a `Pull Request `_.\n\nThis corresponds to the ``Fork & Pull Model`` mentioned in the\n`GitHub flow `_ guides.\n\nIf you have push access to Girder repository, you could simply push your branch\ninto the main repository and create a `Pull Request `_. This\ncorresponds to the ``Shared Repository Model`` and will facilitate other developers to checkout your\ntopic without having to `configure a remote `_.\nIt will also simplify the workflow when you are *co-developing* a branch.\n\nWhen submitting a PR, make sure to add a ``Cc: @girder/developers`` comment to notify Girder\ndevelopers of your awesome contributions. Based on the\ncomments posted by the reviewers, you may have to revisit your patches.\n\nAutomatic testing of pull requests\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nWhen you submit a PR to the Girder repo, CircleCI will run the build and test suite on the\nhead of the branch. If you add new commits onto the branch, those will also automatically\nbe run through the CI process. The status of the CI process (passing, failing, or in progress) will\nbe displayed directly in the PR page in GitHub.\n\nThe CircleCI build will run according to the `circle.yml file `_,\nwhich is useful as an example for how to set up your own environment for testing.\n\nThe tests that run in CircleCI are harnessed with CTest, which submits the results of its\nautomated testing to `Girder's CDash dashboard `_\nwhere the test and coverage results can be easily visualized and explored.\n\nConfusing failing test message \"AttributeError: 'module' object has no attribute 'x_test'\"\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis is also a gotcha for your local testing environment. If a new dependency is\nintroduced during development, but is not in the test environment, usually because the\ndependency is not included in a ``requirements.txt`` or ``requirements-dev.txt`` file, or\nbecause those requirements are not installed via ``pip``, a test can fail that attempts to\nimport that dependency and can print a confusing message in the test logs like\n\"AttributeError: 'module' object has no attribute 'x_test'\".\n\nAs an example, the HDFS plugin has a dependency on the Python module ``snakebite``, specified in the\n`HDFS plugin requirements.txt file `_.\nIf this dependency was not included in the requirements file, or if that requirements file\nwas not included in the `circle.yml file `_\n(or that requirements file was not ``pip`` installed in a local test environment), when the test defined in\n`the assetstore_test.py file `_\nis run, the ``snakebite`` module will not be found, but the exception will be swallowed by\nthe testing environment and instead the ``assetstore_test`` module will be considered\ninvalid, resulting in the confusing error message::\n\n AttributeError: 'module' object has no attribute 'assetstore_test'\n\nbut you won't be confused now, will you?\n\nHow to integrate a PR\n^^^^^^^^^^^^^^^^^^^^^\n\nGetting your contributions integrated is relatively straightforward, here is the checklist:\n\n- All tests pass\n- Any significant changes are added to the ``CHANGELOG.rst`` with human-readable and understandable\n text (i.e. not a commit message). Text should be placed in the \"Unreleased\" section, and grouped\n into the appropriate sub-section of:\n\n - Bug fixes\n - Security fixes\n - Added features\n - Changes\n - Deprecations\n - Removals\n\n- Consensus is reached. This requires that a reviewer adds an \"approved\" review via GitHub with no\n changes requested, and a reasonable amount of time passed without anyone objecting.\n\nNext, there are two scenarios:\n\n- You do NOT have push access: A Girder core developer will integrate your PR.\n- You have push access: Simply click on the \"Merge pull request\" button.\n\nThen, click on the \"Delete branch\" button that appears afterward.\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"6807546034279759c213ee08bd4f23d3\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 107,\n \"max_line_length\": 141,\n \"avg_line_length\": 52.90654205607477,\n \"alnum_prop\": 0.7433315668609787,\n \"repo_name\": \"adsorensen/girder\",\n \"id\": \"06b5018035ab263a7a277f2c1c9b0f729049818e\",\n \"size\": \"5661\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"CONTRIBUTING.rst\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CMake\",\n \"bytes\": \"46894\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"53110\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"151777\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"1215426\"\n },\n {\n \"name\": \"Mako\",\n \"bytes\": \"8228\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"2119660\"\n },\n {\n \"name\": \"Roff\",\n \"bytes\": \"17\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"10593\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"9063\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":918,"cells":{"text":{"kind":"string","value":"ACCEPTED\n\n#### According to\nIndex Fungorum\n\n#### Published in\nnull\n\n#### Original name\nUromyces viennot-bourginii J. Anikster & I. Wahl\n\n### Remarks\nnull"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c10f3bf050fff5156135fd8ca4c87c56\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 13,\n \"max_line_length\": 48,\n \"avg_line_length\": 11.76923076923077,\n \"alnum_prop\": 0.7058823529411765,\n \"repo_name\": \"mdoering/backbone\",\n \"id\": \"41cea1d44e748e8305ab3f7e1a5eb6a323c945e1\",\n \"size\": \"225\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"life/Fungi/Basidiomycota/Pucciniomycetes/Pucciniales/Pucciniaceae/Uromyces/Uromyces viennot-bourginii/README.md\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":919,"cells":{"text":{"kind":"string","value":"namespace content {\n\nstruct PresentationRequest;\nclass PresentationScreenAvailabilityListener;\n\nusing PresentationConnectionCallback =\n base::OnceCallback;\nusing PresentationConnectionErrorCallback =\n base::OnceCallback;\nusing DefaultPresentationConnectionCallback = base::RepeatingCallback;\n\nstruct PresentationConnectionStateChangeInfo {\n explicit PresentationConnectionStateChangeInfo(\n blink::mojom::PresentationConnectionState state)\n : state(state),\n close_reason(\n blink::mojom::PresentationConnectionCloseReason::CONNECTION_ERROR) {\n }\n ~PresentationConnectionStateChangeInfo() = default;\n\n blink::mojom::PresentationConnectionState state;\n\n // |close_reason| and |messsage| are only used for state change to CLOSED.\n blink::mojom::PresentationConnectionCloseReason close_reason;\n std::string message;\n};\n\nusing PresentationConnectionStateChangedCallback =\n base::RepeatingCallback;\n\nusing ReceiverConnectionAvailableCallback = base::RepeatingCallback,\n mojo::PendingReceiver)>;\n\n// Base class for ControllerPresentationServiceDelegate and\n// ReceiverPresentationServiceDelegate.\nclass CONTENT_EXPORT PresentationServiceDelegate {\n public:\n // Observer interface to listen for changes to PresentationServiceDelegate.\n class CONTENT_EXPORT Observer {\n public:\n // Called when the PresentationServiceDelegate is being destroyed.\n virtual void OnDelegateDestroyed() = 0;\n\n protected:\n virtual ~Observer() {}\n };\n\n virtual ~PresentationServiceDelegate() {}\n\n // Registers an observer associated with frame with |render_process_id|\n // and |render_frame_id| with this class to listen for updates.\n // This class does not own the observer.\n // It is an error to add an observer if there is already an observer for that\n // frame.\n virtual void AddObserver(int render_process_id,\n int render_frame_id,\n Observer* observer) = 0;\n\n // Unregisters the observer associated with the frame with |render_process_id|\n // and |render_frame_id|.\n // The observer will no longer receive updates.\n virtual void RemoveObserver(int render_process_id, int render_frame_id) = 0;\n\n // Resets the presentation state for the frame given by |render_process_id|\n // and |render_frame_id|.\n // This unregisters all screen availability associated with the given frame,\n // and clears the default presentation URL for the frame.\n virtual void Reset(int render_process_id, int render_frame_id) = 0;\n};\n\n// An interface implemented by embedders to handle Presentation API calls\n// forwarded from PresentationServiceImpl.\nclass CONTENT_EXPORT ControllerPresentationServiceDelegate\n : public PresentationServiceDelegate {\n public:\n using SendMessageCallback = base::OnceCallback;\n\n // Registers |listener| to continuously listen for\n // availability updates for a presentation URL, originated from the frame\n // given by |render_process_id| and |render_frame_id|.\n // This class does not own |listener|.\n // Returns true on success.\n // This call will return false if a listener with the same presentation URL\n // from the same frame is already registered.\n virtual bool AddScreenAvailabilityListener(\n int render_process_id,\n int render_frame_id,\n PresentationScreenAvailabilityListener* listener) = 0;\n\n // Unregisters |listener| originated from the frame given by\n // |render_process_id| and |render_frame_id| from this class. The listener\n // will no longer receive availability updates.\n virtual void RemoveScreenAvailabilityListener(\n int render_process_id,\n int render_frame_id,\n PresentationScreenAvailabilityListener* listener) = 0;\n\n // Sets the default presentation URLs represented by |request|. When the\n // default presentation is started on this frame, |callback| will be invoked\n // with the corresponding blink::mojom::PresentationInfo object.\n // If |request.presentation_urls| is empty, the default presentation URLs will\n // be cleared and the previously registered callback (if any) will be removed.\n virtual void SetDefaultPresentationUrls(\n const content::PresentationRequest& request,\n DefaultPresentationConnectionCallback callback) = 0;\n\n // Starts a new presentation.\n // |request.presentation_urls| contains a list of possible URLs for the\n // presentation. Typically, the embedder will allow the user to select a\n // screen to show one of the URLs.\n // |request|: The request to start a presentation.\n // |success_cb|: Invoked with presentation info, if presentation started\n // successfully.\n // |error_cb|: Invoked with error reason, if presentation did not\n // start.\n virtual void StartPresentation(\n const content::PresentationRequest& request,\n PresentationConnectionCallback success_cb,\n PresentationConnectionErrorCallback error_cb) = 0;\n\n // Reconnects to an existing presentation. Unlike StartPresentation(), this\n // does not bring a screen list UI.\n // |request|: The request to reconnect to a presentation.\n // |presentation_id|: The ID of the presentation to reconnect.\n // |success_cb|: Invoked with presentation info, if presentation reconnected\n // successfully.\n // |error_cb|: Invoked with error reason, if reconnection failed.\n virtual void ReconnectPresentation(\n const content::PresentationRequest& request,\n const std::string& presentation_id,\n PresentationConnectionCallback success_cb,\n PresentationConnectionErrorCallback error_cb) = 0;\n\n // Closes an existing presentation connection.\n // |render_process_id|, |render_frame_id|: ID for originating frame.\n // |presentation_id|: The ID of the presentation to close.\n virtual void CloseConnection(int render_process_id,\n int render_frame_id,\n const std::string& presentation_id) = 0;\n\n // Terminates an existing presentation.\n // |render_process_id|, |render_frame_id|: ID for originating frame.\n // |presentation_id|: The ID of the presentation to terminate.\n virtual void Terminate(int render_process_id,\n int render_frame_id,\n const std::string& presentation_id) = 0;\n\n // Gets a FlingingController for a given presentation ID.\n // |render_process_id|, |render_frame_id|: ID of originating frame.\n // |presentation_id|: The ID of the presentation for which we want a\n // Controller.\n virtual std::unique_ptr GetFlingingController(\n int render_process_id,\n int render_frame_id,\n const std::string& presentation_id) = 0;\n\n // Continuously listen for state changes for a PresentationConnection in a\n // frame.\n // |render_process_id|, |render_frame_id|: ID of frame.\n // |connection|: PresentationConnection to listen for state changes.\n // |state_changed_cb|: Invoked with the PresentationConnection and its new\n // state whenever there is a state change.\n virtual void ListenForConnectionStateChange(\n int render_process_id,\n int render_frame_id,\n const blink::mojom::PresentationInfo& connection,\n const PresentationConnectionStateChangedCallback& state_changed_cb) = 0;\n};\n\n// An interface implemented by embedders to handle\n// PresentationService calls from a presentation receiver.\nclass CONTENT_EXPORT ReceiverPresentationServiceDelegate\n : public PresentationServiceDelegate {\n public:\n // Registers a callback from the embedder when an offscreeen presentation has\n // been successfully started.\n // |receiver_available_callback|: Invoked when successfully starting a\n // local presentation.\n virtual void RegisterReceiverConnectionAvailableCallback(\n const content::ReceiverConnectionAvailableCallback&\n receiver_available_callback) = 0;\n};\n\n} // namespace content\n\n#endif // CONTENT_PUBLIC_BROWSER_PRESENTATION_SERVICE_DELEGATE_H_\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c815ace4d92eb1df1cf59bfdd8d4b500\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 189,\n \"max_line_length\": 80,\n \"avg_line_length\": 43.61904761904762,\n \"alnum_prop\": 0.7410237748665697,\n \"repo_name\": \"scheib/chromium\",\n \"id\": \"a7b337bb1dd1f729ed9fc6d3c70e87441376886e\",\n \"size\": \"8908\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/main\",\n \"path\": \"content/public/browser/presentation_service_delegate.h\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":920,"cells":{"text":{"kind":"string","value":"Pushes JSON data into Loggly.com from the browser. Tries to have readable code, while keeping the code length small.\n\n*Beware* window.screen, window.navigator, window.location, and window.performance.timing are NOT enumerable and values need to be manually copied if you want to pass them into `TinyLoggly.log()`.\n\nYou must change the variable LOGGLY_KEY to your own Loggly key for the code to work.\n\nPlease don't report bugs, features, or ask me anything. I didn't actually use this code because of data privacy issues.\n\nKeys are modified:\n\n - appends $n to keys for number values to prevent nasty loggly error \"Removed parsed fields because of mapping conflict while indexing (i.e originally sent as one type and later sent as new type)\"\n - Loggly itself limits keys to 64 characters and it also replaces any spaces or dots (within keys) by underscores.\n\nSome values are modified or removed:\n\n - nulls are NOT logged\n - Arrays are NOT logged (there is some commented out code that works though).\n - Empty objects are NOT logged\n - Objects that only contain empty objects or nulls are NOT logged.\n - Booleans true and false are changed to 'true' and 'false' strings.\n - Number values - see above comment on appending $n to the key\n - NaN/Inifinity/-Infinity are converted to strings\n\nLoggly limits keys to 100 or so (I think across all JSON input) and just won't parse anything after that. So be careful to limit the number of variables in your JSON.\n\nThis code improves the randomisation of sessionId's (compared to the default loggly JavaScript code) by making them properly random in modern browsers.\n\nMaybe still get Mapping Conflict if mix Object/Array/String for the same key - fix would be to append other unique identifiers to the key for each of the accepted types (same as we do for Number).\n\nRelevant loggly documentation is at:\n\n - https://www.loggly.com/docs/http-endpoint/\n - https://www.loggly.com/docs/automated-parsing/\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"aff9732e9dc9127f08591d840aad887b\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 33,\n \"max_line_length\": 197,\n \"avg_line_length\": 58.72727272727273,\n \"alnum_prop\": 0.7781217750257998,\n \"repo_name\": \"MorrisJohns/TinyLoggly\",\n \"id\": \"73908644a1857de3bcc1cb71534312b8ef1426ea\",\n \"size\": \"1952\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"README.md\",\n \"mode\": \"33188\",\n \"license\": \"bsd-2-clause\",\n \"language\": [\n {\n \"name\": \"HTML\",\n \"bytes\": \"298\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"7262\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":921,"cells":{"text":{"kind":"string","value":"\"\"\"\nThis module provies an interface to the Elastic MapReduce (EMR)\nservice from AWS.\n\"\"\"\nfrom boto.emr.connection import EmrConnection\nfrom boto.emr.step import Step, StreamingStep, JarStep\nfrom boto.emr.bootstrap_action import BootstrapAction\nfrom boto.regioninfo import RegionInfo, get_regions\nfrom boto.regioninfo import connect\n\n\ndef regions():\n \"\"\"\n Get all available regions for the Amazon Elastic MapReduce service.\n\n :rtype: list\n :return: A list of :class:`boto.regioninfo.RegionInfo`\n \"\"\"\n return get_regions('elasticmapreduce', connection_cls=EmrConnection)\n\n\ndef connect_to_region(region_name, **kw_params):\n return connect('elasticmapreduce', region_name,\n connection_cls=EmrConnection, **kw_params)\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"a0378f24b974b293ff6239860b31341b\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 24,\n \"max_line_length\": 72,\n \"avg_line_length\": 31.375,\n \"alnum_prop\": 0.7410358565737052,\n \"repo_name\": \"xq262144/hue\",\n \"id\": \"dfa53c7337195e9d7ff07c5124d6130b28aa4cf9\",\n \"size\": \"1963\",\n \"binary\": false,\n \"copies\": \"32\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"desktop/core/ext-py/boto-2.46.1/boto/emr/__init__.py\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Assembly\",\n \"bytes\": \"3096\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"41710\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"2692409\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"199897\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"521820\"\n },\n {\n \"name\": \"Emacs Lisp\",\n \"bytes\": \"11704\"\n },\n {\n \"name\": \"Genshi\",\n \"bytes\": \"946\"\n },\n {\n \"name\": \"Go\",\n \"bytes\": \"6671\"\n },\n {\n \"name\": \"Groff\",\n \"bytes\": \"16669\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"24188238\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"575404\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"4987047\"\n },\n {\n \"name\": \"M4\",\n \"bytes\": \"1377\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"144341\"\n },\n {\n \"name\": \"Mako\",\n \"bytes\": \"3052598\"\n },\n {\n \"name\": \"Myghty\",\n \"bytes\": \"936\"\n },\n {\n \"name\": \"PLSQL\",\n \"bytes\": \"13774\"\n },\n {\n \"name\": \"PLpgSQL\",\n \"bytes\": \"3646\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"3499\"\n },\n {\n \"name\": \"PigLatin\",\n \"bytes\": \"328\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"44291483\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"44147\"\n },\n {\n \"name\": \"Smarty\",\n \"bytes\": \"130\"\n },\n {\n \"name\": \"Thrift\",\n \"bytes\": \"278712\"\n },\n {\n \"name\": \"Visual Basic\",\n \"bytes\": \"2884\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"518588\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":922,"cells":{"text":{"kind":"string","value":"\n\n\n\n \n \n \n \n \n\n \n \n \n\n \n \n \n\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"02cec806e2e38dcc5316a1c165efe2ec\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 38,\n \"max_line_length\": 81,\n \"avg_line_length\": 37.63157894736842,\n \"alnum_prop\": 0.7328671328671329,\n \"repo_name\": \"toddlipcon/nutch\",\n \"id\": \"4ec14b16498ac553af2db0b1c06a185ec1d269cf\",\n \"size\": \"1430\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"contrib/web2/plugins/web-more/plugin.xml\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"2454126\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"16632\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":923,"cells":{"text":{"kind":"string","value":"\n\n#include \n\n#include \n#include \n\nusing folly::HHWheelTimer;\nusing std::chrono::milliseconds;\n\nnamespace wangle {\n\nConnectionManager::ConnectionManager(folly::EventBase* eventBase,\n milliseconds timeout, Callback* callback)\n : connTimeouts_(new HHWheelTimer(eventBase)),\n callback_(callback),\n eventBase_(eventBase),\n drainIterator_(conns_.end()),\n idleIterator_(conns_.end()),\n idleLoopCallback_(this),\n timeout_(timeout),\n idleConnEarlyDropThreshold_(timeout_ / 2) {\n\n}\n\nvoid\nConnectionManager::addConnection(ManagedConnection* connection,\n bool timeout) {\n CHECK_NOTNULL(connection);\n ConnectionManager* oldMgr = connection->getConnectionManager();\n if (oldMgr != this) {\n if (oldMgr) {\n // 'connection' was being previously managed in a different thread.\n // We must remove it from that manager before adding it to this one.\n oldMgr->removeConnection(connection);\n }\n\n // put the connection into busy part first. This should not matter at all\n // because the last callback for an idle connection must be onDeactivated(),\n // so the connection must be moved to idle part then.\n conns_.push_front(*connection);\n\n connection->setConnectionManager(this);\n if (callback_) {\n callback_->onConnectionAdded(*this);\n }\n }\n if (timeout) {\n scheduleTimeout(connection, timeout_);\n }\n if (shutdownState_ >= ShutdownState::CLOSE_WHEN_IDLE) {\n // shouldn't really hapen\n connection->closeWhenIdle();\n } else if (shutdownState_ >= ShutdownState::NOTIFY_PENDING_SHUTDOWN) {\n connection->notifyPendingShutdown();\n }\n}\n\nvoid\nConnectionManager::scheduleTimeout(ManagedConnection* const connection,\n std::chrono::milliseconds timeout) {\n if (timeout > std::chrono::milliseconds(0)) {\n connTimeouts_->scheduleTimeout(connection, timeout);\n }\n}\n\nvoid ConnectionManager::scheduleTimeout(\n folly::HHWheelTimer::Callback* callback,\n std::chrono::milliseconds timeout) {\n connTimeouts_->scheduleTimeout(callback, timeout);\n}\n\nvoid\nConnectionManager::removeConnection(ManagedConnection* connection) {\n if (connection->getConnectionManager() == this) {\n connection->cancelTimeout();\n connection->setConnectionManager(nullptr);\n\n // Un-link the connection from our list, being careful to keep the iterator\n // that we're using for idle shedding valid\n auto it = conns_.iterator_to(*connection);\n if (it == drainIterator_) {\n ++drainIterator_;\n }\n if (it == idleIterator_) {\n ++idleIterator_;\n }\n conns_.erase(it);\n\n if (callback_) {\n callback_->onConnectionRemoved(*this);\n if (getNumConnections() == 0) {\n callback_->onEmpty(*this);\n }\n }\n }\n}\n\nvoid\nConnectionManager::initiateGracefulShutdown(\n std::chrono::milliseconds idleGrace) {\n VLOG(3) << this << \" initiateGracefulShutdown with nconns=\" << conns_.size();\n if (shutdownState_ != ShutdownState::NONE) {\n VLOG(3) << \"Ignoring redundant call to initiateGracefulShutdown\";\n return;\n }\n if (idleGrace.count() > 0) {\n shutdownState_ = ShutdownState::NOTIFY_PENDING_SHUTDOWN;\n idleLoopCallback_.scheduleTimeout(idleGrace);\n VLOG(3) << \"Scheduling idle grace period of \" << idleGrace.count() << \"ms\";\n } else {\n shutdownState_ = ShutdownState::CLOSE_WHEN_IDLE;\n VLOG(3) << \"proceeding directly to closing idle connections\";\n }\n drainIterator_ = conns_.begin();\n drainAllConnections();\n}\n\nvoid\nConnectionManager::drainAllConnections() {\n DestructorGuard g(this);\n size_t numCleared = 0;\n size_t numKept = 0;\n\n auto it = drainIterator_;\n\n CHECK(shutdownState_ == ShutdownState::NOTIFY_PENDING_SHUTDOWN ||\n shutdownState_ == ShutdownState::CLOSE_WHEN_IDLE);\n while (it != conns_.end() && (numKept + numCleared) < 64) {\n ManagedConnection& conn = *it++;\n if (shutdownState_ == ShutdownState::NOTIFY_PENDING_SHUTDOWN) {\n conn.notifyPendingShutdown();\n numKept++;\n } else { // CLOSE_WHEN_IDLE\n // Second time around: close idle sessions. If they aren't idle yet,\n // have them close when they are idle\n if (conn.isBusy()) {\n numKept++;\n } else {\n numCleared++;\n }\n conn.closeWhenIdle();\n }\n }\n\n if (shutdownState_ == ShutdownState::CLOSE_WHEN_IDLE) {\n VLOG(2) << \"Idle connections cleared: \" << numCleared <<\n \", busy conns kept: \" << numKept;\n } else {\n VLOG(3) << this << \" notified n=\" << numKept;\n }\n drainIterator_ = it;\n if (it != conns_.end()) {\n eventBase_->runInLoop(&idleLoopCallback_);\n } else {\n if (shutdownState_ == ShutdownState::NOTIFY_PENDING_SHUTDOWN) {\n VLOG(3) << this << \" finished notify_pending_shutdown\";\n shutdownState_ = ShutdownState::NOTIFY_PENDING_SHUTDOWN_COMPLETE;\n if (!idleLoopCallback_.isScheduled()) {\n // The idle grace timer already fired, start over immediately\n shutdownState_ = ShutdownState::CLOSE_WHEN_IDLE;\n drainIterator_ = conns_.begin();\n eventBase_->runInLoop(&idleLoopCallback_);\n }\n } else {\n shutdownState_ = ShutdownState::CLOSE_WHEN_IDLE_COMPLETE;\n }\n }\n}\n\nvoid\nConnectionManager::idleGracefulTimeoutExpired() {\n VLOG(2) << this << \" idleGracefulTimeoutExpired\";\n if (shutdownState_ == ShutdownState::NOTIFY_PENDING_SHUTDOWN_COMPLETE) {\n shutdownState_ = ShutdownState::CLOSE_WHEN_IDLE;\n drainIterator_ = conns_.begin();\n drainAllConnections();\n } else {\n VLOG(4) << this << \" idleGracefulTimeoutExpired during \"\n \"NOTIFY_PENDING_SHUTDOWN, ignoring\";\n }\n}\n\nvoid\nConnectionManager::dropAllConnections() {\n DestructorGuard g(this);\n\n shutdownState_ = ShutdownState::CLOSE_WHEN_IDLE_COMPLETE;\n // Iterate through our connection list, and drop each connection.\n VLOG(3) << \"connections to drop: \" << conns_.size();\n idleLoopCallback_.cancelTimeout();\n unsigned i = 0;\n while (!conns_.empty()) {\n ManagedConnection& conn = conns_.front();\n conns_.pop_front();\n conn.cancelTimeout();\n conn.setConnectionManager(nullptr);\n // For debugging purposes, dump information about the first few\n // connections.\n static const unsigned MAX_CONNS_TO_DUMP = 2;\n if (++i <= MAX_CONNS_TO_DUMP) {\n conn.dumpConnectionState(3);\n }\n conn.dropConnection();\n }\n drainIterator_ = conns_.end();\n idleIterator_ = conns_.end();\n idleLoopCallback_.cancelLoopCallback();\n\n if (callback_) {\n callback_->onEmpty(*this);\n }\n}\n\nvoid\nConnectionManager::onActivated(ManagedConnection& conn) {\n auto it = conns_.iterator_to(conn);\n if (it == idleIterator_) {\n idleIterator_++;\n }\n conns_.erase(it);\n conns_.push_front(conn);\n}\n\nvoid\nConnectionManager::onDeactivated(ManagedConnection& conn) {\n auto it = conns_.iterator_to(conn);\n bool moveDrainIter = false;\n if (it == drainIterator_) {\n drainIterator_++;\n moveDrainIter = true;\n }\n conns_.erase(it);\n conns_.push_back(conn);\n if (idleIterator_ == conns_.end()) {\n idleIterator_--;\n }\n if (moveDrainIter && drainIterator_ == conns_.end()) {\n drainIterator_--;\n }\n}\n\nsize_t\nConnectionManager::dropIdleConnections(size_t num) {\n VLOG(4) << \"attempt to drop \" << num << \" idle connections\";\n if (idleConnEarlyDropThreshold_ >= timeout_) {\n return 0;\n }\n\n size_t count = 0;\n while(count < num) {\n auto it = idleIterator_;\n if (it == conns_.end()) {\n return count; // no more idle session\n }\n auto idleTime = it->getIdleTime();\n if (idleTime == std::chrono::milliseconds(0) ||\n idleTime <= idleConnEarlyDropThreshold_) {\n VLOG(4) << \"conn's idletime: \" << idleTime.count()\n << \", earlyDropThreshold: \" << idleConnEarlyDropThreshold_.count()\n << \", attempt to drop \" << count << \"/\" << num;\n return count; // idleTime cannot be further reduced\n }\n ManagedConnection& conn = *it;\n idleIterator_++;\n conn.timeoutExpired();\n count++;\n }\n\n return count;\n}\n\n\n} // wangle\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"171082e3c60041f8c296453ab47c983e\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 274,\n \"max_line_length\": 80,\n \"avg_line_length\": 29.156934306569344,\n \"alnum_prop\": 0.660282888972337,\n \"repo_name\": \"jamperry/wangle\",\n \"id\": \"5648b879f6825a33a5f4ed1f818aeac7e6398c92\",\n \"size\": \"8296\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"wangle/acceptor/ConnectionManager.cpp\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"2575\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"676896\"\n },\n {\n \"name\": \"CMake\",\n \"bytes\": \"6375\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"260\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":924,"cells":{"text":{"kind":"string","value":"code: true\ntype: page\ntitle: refreshToken\ndescription: Refresh an authentication token\n---\n\n# refreshToken\n\n\n\nRefreshes a valid, non-expired authentication token.\n\nIf this action is successful, then the [jwt](/sdk/js/7/core-classes/kuzzle/properties) property of this class instance is set to the new authentication token.\n\nAll further requests emitted by this SDK instance will be on behalf of the authenticated user, until either the authenticated token expires, the [logout](/sdk/js/7/controllers/auth/logout) action is called, or the `jwt` property is manually set to another value.\n\n\n## Arguments\n\n```js\nrefreshToken ([options])\n```\n\n
\n\n| Arguments | Type | Description |\n| --------- | ----------------- | ------------- |\n| `options` |
object
| Query options |\n\n\n### options\n\nAdditional query options\n\n| Property | Type
(default) | Description |\n| ----------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------- |\n| `expiresIn` |
string
| Expiration time in [ms library](https://www.npmjs.com/package/ms) format. (e.g. `2h`) |\n| `queuable` |
boolean

(`true`) | If true, queues the request during downtime, until connected to Kuzzle again |\n| [`timeout`](/sdk/7/core-classes/kuzzle/query#timeout) |
number

(`-1`) | Time (in ms) during which a request will still be waited to be resolved. Set it `-1` if you want to wait indefinitely |\n\n### expiresIn\n\nThe default value for the `expiresIn` option is defined at server level, in Kuzzle's [configuration file](/core/2/guides/advanced/configuration).\n\n## Resolves\n\nThe `refreshToken` action resolves to a token object with the following properties:\n\n| Property | Type | Description |\n| ----------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `_id` |
string
| User unique identifier ([kuid](/core/2/guides/main-concepts/authentication#kuzzle-user-identifier-kuid)) |\n| `expiresAt` |
number
| Expiration timestamp in Epoch-millis format (UTC) |\n| `jwt` |
string
| Authentication token (returned only if the option [cookieAuth](/sdk/js/7/core-classes/kuzzle/constructor) is not enabled in the SDK, otherwise stored in an http cookie) |\n| `ttl` |
number
| Time to live of the authentication token, in milliseconds |\n\n## Usage\n\n<<< ./snippets/refreshToken.js\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"32ff8d7c60a447e0f16508408bdb6496\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 58,\n \"max_line_length\": 262,\n \"avg_line_length\": 57,\n \"alnum_prop\": 0.47580157289776165,\n \"repo_name\": \"kuzzleio/sdk-javascript\",\n \"id\": \"a74718431f0d3958aaf34a0afb83cea43819b6b8\",\n \"size\": \"3310\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"doc/7/controllers/auth/refresh-token/index.md\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"HTML\",\n \"bytes\": \"1048\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"468625\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"2025\"\n },\n {\n \"name\": \"TypeScript\",\n \"bytes\": \"252195\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":925,"cells":{"text":{"kind":"string","value":"class Command implements ICommand, IConfigureCommand {\n\n public name: string;\n\n private allowedMarks: Array = new Array();\n private leftMarks: Array = new Array();\n private renderers: Array<{id: Constants.OutputTypes, renderer: IRenderer}> =\n new Array<{id: Constants.OutputTypes, renderer: IRenderer}>();\n\n public configureGutterMark(mark: string, parameters?: Object): IConfigureCommand {\n if (InstanceHelper.IsNullOrUndefined(mark) ||\n mark === String()) throw new Error('You are required to specify a mark');\n\n this.allowedMarks.push(mark);\n return this;\n }\n public configureLeftMark(mark: string, parameters?: Object): IConfigureCommand {\n if (InstanceHelper.IsNullOrUndefined(mark) ||\n mark === String()) throw new Error('You are required to specify a mark');\n if (/^\\s+$/.test(mark))\n throw new Error('Whitespaces are not allowed for leftMarks');\n\n this.allowedMarks.push(mark);\n this.leftMarks.push(mark);\n return this;\n }\n public configureQuickMark(mark: string, parameters?: Object): IConfigureCommand {\n if (InstanceHelper.IsNullOrUndefined(mark) ||\n mark === String()) throw new Error('You are required to specify a mark');\n if (/^\\s+$/.test(mark))\n throw new Error('Whitespaces are not allowed for quickMarks');\n\n this.allowedMarks.push(mark);\n return this;\n }\n public configureRestrictions(children?: string[], parents?: string[]): IConfigureCommand {\n return this;\n }\n\n public allowsMark(mark: string): boolean {\n if (InstanceHelper.IsNullOrUndefined(mark) ||\n mark === String()) return false;\n\n return _.includes(this.allowedMarks, mark);\n }\n\n public allowsLeftMark(mark: string): boolean {\n if (InstanceHelper.IsNullOrUndefined(mark) ||\n mark === String()) return false;\n if (/^\\s+$/.test(mark))\n throw new Error('Whitespaces are not allowed for leftMarks');\n\n return _.includes(this.leftMarks, mark);\n }\n\n public getRenderer(rendererType: Constants.OutputTypes): IRenderer {\n let rendererPointer = _(this.renderers).find(x => x.id === rendererType);\n if (InstanceHelper.IsNullOrUndefined(rendererPointer))\n throw new ReferenceError(`You should configure a renderer for '${this.name}'` +\n ` before rendering`);\n\n return rendererPointer.renderer;\n }\n\n public configureRenderer(rendererType: Constants.OutputTypes, factory: () => IRenderer): IConfigureCommand {\n this.renderers.push({\n id: rendererType,\n renderer: factory()\n });\n return this;\n }\n\n}"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"8769b1ac4d7ff26245a6c708f5ffed51\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 73,\n \"max_line_length\": 112,\n \"avg_line_length\": 37.93150684931507,\n \"alnum_prop\": 0.6359696641386782,\n \"repo_name\": \"Marvin-Brouwer/XMD\",\n \"id\": \"1c8bf15a7bf35f31f81ad7e933fc69144462017f\",\n \"size\": \"3086\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/Commands/Command.ts\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"2361\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"3244\"\n },\n {\n \"name\": \"TypeScript\",\n \"bytes\": \"27082\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":926,"cells":{"text":{"kind":"string","value":"import Vue from 'vue'\nimport VueLazyload from 'vue-lazyload'\n\nimport loading from 'assets/lazy-loading.png'\n\nVue.use(VueLazyload, {loading})\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"88017a6815787f6339e203f65d67d87b\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 6,\n \"max_line_length\": 45,\n \"avg_line_length\": 23.5,\n \"alnum_prop\": 0.7730496453900709,\n \"repo_name\": \"JounQin/MIC\",\n \"id\": \"09284131a5ecfdc5064805d0bf506be9accc1638\",\n \"size\": \"141\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/plugins/lazy.js\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"14310\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"1536\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"49511\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"111\"\n },\n {\n \"name\": \"Vue\",\n \"bytes\": \"26804\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":927,"cells":{"text":{"kind":"string","value":"ACCEPTED\n\n#### According to\nInterim Register of Marine and Nonmarine Genera\n\n#### Published in\nSenckenb Lethaea 83 (1-2), 30 Dezember: 4.\n\n#### Original name\nnull\n\n### Remarks\nnull"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"287d8d70175ab9496cf4963467d4f3cc\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 13,\n \"max_line_length\": 47,\n \"avg_line_length\": 13.846153846153847,\n \"alnum_prop\": 0.7111111111111111,\n \"repo_name\": \"mdoering/backbone\",\n \"id\": \"0c0d38b1aeae555e2b47381ba77890b2fc55b032\",\n \"size\": \"237\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"life/Protozoa/Granuloreticulosea/Foraminiferida/Vaginulinidae/Clarifovea/README.md\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":928,"cells":{"text":{"kind":"string","value":"cask 'syphon-virtual-screen' do\n version '1.3'\n sha256 '0cf56d171f3427d623d4b12d55e0342a34cd8d12dd7082c7ed372b5effac8a46'\n\n # github.com/andreacremaschi/Syphon-virtual-screen was verified as official when first introduced to the cask\n url 'https://github.com/andreacremaschi/Syphon-virtual-screen/releases/download/1.3/Syphon.Virtual.Screen.mpkg.zip'\n appcast 'https://github.com/andreacremaschi/Syphon-virtual-screen/releases.atom',\n checkpoint: '99793e70b315957b663123c844fb442f2fffef84e7ec4731506b6324fc70fcca'\n name 'Syphon Virtual Screen'\n homepage 'https://andreacremaschi.github.io/Syphon-virtual-screen/'\n\n pkg 'Syphon Virtual Screen.mpkg'\n\n uninstall kext: 'EWProxyFrameBuffer',\n delete: '/System/Library/Caches/com.apple.kext.caches'\n\n caveats 'To use different resolutions modify EWProxyFramebuffer.kext/Contents/Info.plist'\nend\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"6b328e4c63e206c5ae03686338c01a1c\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 18,\n \"max_line_length\": 117,\n \"avg_line_length\": 48.44444444444444,\n \"alnum_prop\": 0.7912844036697247,\n \"repo_name\": \"decrement/homebrew-cask\",\n \"id\": \"4c1a0a7aa6fea0e8e6c6c8e27b0d39397f7ddb4d\",\n \"size\": \"872\",\n \"binary\": false,\n \"copies\": \"8\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"Casks/syphon-virtual-screen.rb\",\n \"mode\": \"33188\",\n \"license\": \"bsd-2-clause\",\n \"language\": [\n {\n \"name\": \"Ruby\",\n \"bytes\": \"1751705\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"56109\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":929,"cells":{"text":{"kind":"string","value":"\n\n\n \n \n\n\n
\n \n \n \n\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"8e67f4cb7e7d089169e2ef7c0167f705\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 22,\n \"max_line_length\": 59,\n \"avg_line_length\": 21.681818181818183,\n \"alnum_prop\": 0.59958071278826,\n \"repo_name\": \"rwl/d3.dart\",\n \"id\": \"cd5d504aec228e1e8416bdcd144fa134a1e15d59\",\n \"size\": \"477\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"example/bar_chart1/index.html\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"Dart\",\n \"bytes\": \"274021\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"8742\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":930,"cells":{"text":{"kind":"string","value":"/** @module transition */ /** for typedoc */\nimport { TransitionHookOptions, IEventHook, HookResult } from \"./interface\";\nimport { Transition } from \"./transition\";\nimport { State } from \"../state/stateObject\";\n/** @hidden */\nexport declare class TransitionHook {\n private transition;\n private stateContext;\n private eventHook;\n private options;\n constructor(transition: Transition, stateContext: State, eventHook: IEventHook, options: TransitionHookOptions);\n private isSuperseded;\n invokeHook(): Promise;\n /**\n * This method handles the return value of a Transition Hook.\n *\n * A hook can return false (cancel), a TargetState (redirect),\n * or a promise (which may later resolve to false or a redirect)\n *\n * This also handles \"transition superseded\" -- when a new transition\n * was started while the hook was still running\n */\n handleHookResult(result: HookResult): Promise;\n toString(): string;\n /**\n * Given an array of TransitionHooks, runs each one synchronously and sequentially.\n *\n * Returns a promise chain composed of any promises returned from each hook.invokeStep() call\n */\n static runSynchronousHooks(hooks: TransitionHook[], swallowExceptions?: boolean): Promise;\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"171aca4fdc568f14fbae8b5cd0d5b069\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 31,\n \"max_line_length\": 116,\n \"avg_line_length\": 41.58064516129032,\n \"alnum_prop\": 0.6982156710628394,\n \"repo_name\": \"MadhavBitra/jsdelivr\",\n \"id\": \"f74dbfbbbbde5bc6a6f991a8cbdcbca50e1cf77e\",\n \"size\": \"1289\",\n \"binary\": false,\n \"copies\": \"17\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"files/angular.ui-router/1.0.0-beta.3/transition/transitionHook.d.ts\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":931,"cells":{"text":{"kind":"string","value":"\npackage org.springframework.richclient.command.config;\n\nimport java.awt.Color;\n\nimport javax.swing.Icon;\nimport javax.swing.JButton;\nimport javax.swing.JMenu;\nimport javax.swing.JMenuItem;\n\nimport junit.framework.TestCase;\n\nimport org.springframework.richclient.test.TestIcon;\n\n/**\n * Testcase for CommandButtonIconInfo\n * \n * @author Peter De Bruycker\n */\npublic class CommandButtonIconInfoTests extends TestCase {\n\n private Icon icon;\n\n private Icon selectedIcon;\n\n private Icon rolloverIcon;\n\n private Icon disabledIcon;\n\n private Icon pressedIcon;\n\n private CommandButtonIconInfo completeInfo;\n\n public void testConstructor() {\n CommandButtonIconInfo info = new CommandButtonIconInfo(icon);\n assertEquals(icon, info.getIcon());\n assertNull(info.getSelectedIcon());\n assertNull(info.getRolloverIcon());\n assertNull(info.getDisabledIcon());\n assertNull(info.getPressedIcon());\n }\n\n public void testConstructor2() {\n CommandButtonIconInfo info = new CommandButtonIconInfo(icon, selectedIcon);\n assertEquals(icon, info.getIcon());\n assertEquals(selectedIcon, info.getSelectedIcon());\n assertNull(info.getRolloverIcon());\n assertNull(info.getDisabledIcon());\n assertNull(info.getPressedIcon());\n }\n\n public void testConstructor3() {\n CommandButtonIconInfo info = new CommandButtonIconInfo(icon, selectedIcon, rolloverIcon);\n assertEquals(icon, info.getIcon());\n assertEquals(selectedIcon, info.getSelectedIcon());\n assertEquals(rolloverIcon, info.getRolloverIcon());\n assertNull(info.getDisabledIcon());\n assertNull(info.getPressedIcon());\n }\n\n public void testConstructor4() {\n CommandButtonIconInfo info = new CommandButtonIconInfo(icon, selectedIcon, rolloverIcon, disabledIcon,\n pressedIcon);\n assertEquals(icon, info.getIcon());\n assertEquals(selectedIcon, info.getSelectedIcon());\n assertEquals(rolloverIcon, info.getRolloverIcon());\n assertEquals(disabledIcon, info.getDisabledIcon());\n assertEquals(pressedIcon, info.getPressedIcon());\n }\n\n public void testConfigureWithNullButton() {\n CommandButtonIconInfo info = new CommandButtonIconInfo(icon);\n try {\n info.configure(null);\n fail(\"Should throw IllegalArgumentException\");\n }\n catch (IllegalArgumentException e) {\n pass();\n }\n }\n\n public void testConfigureWithJButton() {\n JButton button = new JButton(\"Test\");\n JButton result = (JButton)completeInfo.configure(button);\n assertSame(button, result);\n\n assertEquals(icon, button.getIcon());\n assertEquals(selectedIcon, button.getSelectedIcon());\n assertEquals(rolloverIcon, button.getRolloverIcon());\n assertEquals(disabledIcon, button.getDisabledIcon());\n assertEquals(pressedIcon, button.getPressedIcon());\n }\n\n public void testConfigureWithJMenuItem() {\n JMenuItem button = new JMenuItem(\"Test\");\n JMenuItem result = (JMenuItem)completeInfo.configure(button);\n assertSame(button, result);\n\n assertEquals(icon, button.getIcon());\n assertEquals(selectedIcon, button.getSelectedIcon());\n assertEquals(rolloverIcon, button.getRolloverIcon());\n assertEquals(disabledIcon, button.getDisabledIcon());\n assertEquals(pressedIcon, button.getPressedIcon());\n }\n\n public void testConfigureWithJMenu() {\n JMenu button = new JMenu(\"Test\");\n button.setIcon(icon);\n button.setSelectedIcon(selectedIcon);\n button.setRolloverIcon(rolloverIcon);\n button.setDisabledIcon(disabledIcon);\n button.setPressedIcon(pressedIcon);\n\n JMenuItem result = (JMenuItem)completeInfo.configure(button);\n assertSame(button, result);\n\n assertEquals(icon, button.getIcon());\n assertEquals(selectedIcon, button.getSelectedIcon());\n assertEquals(rolloverIcon, button.getRolloverIcon());\n assertEquals(disabledIcon, button.getDisabledIcon());\n assertEquals(pressedIcon, button.getPressedIcon());\n }\n\n private static void pass() {\n // test passes\n }\n\n protected void setUp() throws Exception {\n icon = new TestIcon(Color.BLUE);\n selectedIcon = new TestIcon(Color.BLACK);\n rolloverIcon = new TestIcon(Color.GREEN);\n disabledIcon = new TestIcon(Color.GRAY);\n pressedIcon = new TestIcon(Color.WHITE);\n\n completeInfo = new CommandButtonIconInfo(icon, selectedIcon, rolloverIcon, disabledIcon, pressedIcon);\n }\n}"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"a78e4b8f9cee826271f63ed9bdb70ba8\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 137,\n \"max_line_length\": 110,\n \"avg_line_length\": 33.99270072992701,\n \"alnum_prop\": 0.6864934507193472,\n \"repo_name\": \"springrichclient/springrcp\",\n \"id\": \"b811ce4dd49eadafe8ae59630de1f6f635d884ec\",\n \"size\": \"5280\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"spring-richclient-core/src/test/java/org/springframework/richclient/command/config/CommandButtonIconInfoTests.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Haskell\",\n \"bytes\": \"1484\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"4963844\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"22973\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"2550\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":932,"cells":{"text":{"kind":"string","value":"module.exports = require('./make-webpack-config')({\n devtool: 'eval',\n env: \"development\"\n});\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"5958acede08e1f94631a7dd8c21e9540\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 4,\n \"max_line_length\": 51,\n \"avg_line_length\": 24,\n \"alnum_prop\": 0.6458333333333334,\n \"repo_name\": \"KeweiCodes/snake\",\n \"id\": \"501ef1e8a3a53bcfbee0854567c5abe2b8434f20\",\n \"size\": \"96\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"conf/webpack.development.js\",\n \"mode\": \"33261\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"570\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"919\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"14712\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":933,"cells":{"text":{"kind":"string","value":"\n\nimport {AmpAudio} from '../amp-audio';\nimport {adopt} from '../../../../src/runtime';\nimport {naturalDimensions_} from '../../../../src/layout';\nimport {createIframePromise} from '../../../../testing/iframe';\nimport * as sinon from 'sinon';\nimport '../amp-audio';\n\nadopt(window);\n\ndescribe('amp-audio', () => {\n let iframe;\n let ampAudio;\n let sandbox;\n\n beforeEach(() => {\n sandbox = sinon.sandbox.create();\n return createIframePromise(/* runtimeOff */ true).then(i => {\n iframe = i;\n });\n });\n\n afterEach(() => {\n sandbox.restore();\n document.body.removeChild(iframe.iframe);\n });\n\n function getAmpAudio(attributes, opt_childNodesAttrs) {\n ampAudio = iframe.doc.createElement('amp-audio');\n for (const key in attributes) {\n ampAudio.setAttribute(key, attributes[key]);\n }\n if (opt_childNodesAttrs) {\n opt_childNodesAttrs.forEach(childNodeAttrs => {\n let child;\n if (childNodeAttrs.tag === 'text') {\n child = iframe.doc.createTextNode(childNodeAttrs.text);\n } else {\n child = iframe.doc.createElement(childNodeAttrs.tag);\n for (const key in childNodeAttrs) {\n if (key !== 'tag') {\n child.setAttribute(key, childNodeAttrs[key]);\n }\n }\n }\n ampAudio.appendChild(child);\n });\n }\n return ampAudio;\n }\n\n function attachAndRun(attributes, opt_childNodesAttrs) {\n const ampAudio = getAmpAudio(attributes, opt_childNodesAttrs);\n naturalDimensions_['AMP-AUDIO'] = {width: '300px', height: '30px'};\n return iframe.addElement(ampAudio);\n }\n\n it('should load audio through attribute', () => {\n return attachAndRun({\n src: 'https://origin.com/audio.mp3',\n }).then(a => {\n const audio = a.querySelector('audio');\n expect(audio.tagName).to.equal('AUDIO');\n expect(audio.getAttribute('src'))\n .to.equal('https://origin.com/audio.mp3');\n expect(audio.hasAttribute('controls')).to.be.true;\n expect(a.style.width).to.be.equal('300px');\n expect(a.style.height).to.be.equal('30px');\n });\n });\n\n it('should load audio through sources', () => {\n return attachAndRun({\n width: 503,\n height: 53,\n autoplay: '',\n muted: '',\n loop: '',\n }, [\n {tag: 'source', src: 'https://origin.com/audio.mp3',\n type: 'audio/mpeg'},\n {tag: 'source', src: 'https://origin.com/audio.ogg', type: 'audio/ogg'},\n {tag: 'text', text: 'Unsupported.'},\n ]).then(a => {\n const audio = a.querySelector('audio');\n expect(audio.tagName).to.equal('AUDIO');\n expect(a.getAttribute('width')).to.be.equal('503');\n expect(a.getAttribute('height')).to.be.equal('53');\n expect(audio.offsetWidth).to.be.greaterThan('1');\n expect(audio.offsetHeight).to.be.greaterThan('1');\n expect(audio.hasAttribute('controls')).to.be.true;\n expect(audio.hasAttribute('autoplay')).to.be.true;\n expect(audio.hasAttribute('muted')).to.be.true;\n expect(audio.hasAttribute('loop')).to.be.true;\n expect(audio.hasAttribute('src')).to.be.false;\n expect(audio.childNodes[0].tagName).to.equal('SOURCE');\n expect(audio.childNodes[0].getAttribute('src'))\n .to.equal('https://origin.com/audio.mp3');\n expect(audio.childNodes[1].tagName).to.equal('SOURCE');\n expect(audio.childNodes[1].getAttribute('src'))\n .to.equal('https://origin.com/audio.ogg');\n expect(audio.childNodes[2].nodeType).to.equal(Node.TEXT_NODE);\n expect(audio.childNodes[2].textContent).to.equal('Unsupported.');\n });\n });\n\n it('should set its dimensions to the browser natural', () => {\n return attachAndRun({\n src: 'https://origin.com/audio.mp3',\n }).then(a => {\n const audio = a.querySelector('audio');\n expect(a.style.width).to.be.equal('300px');\n expect(a.style.height).to.be.equal('30px');\n if (/Safari|Firefox/.test(navigator.userAgent)) {\n // Safari has default sizes for audio tags that cannot\n // be overridden.\n return;\n }\n expect(audio.offsetWidth).to.be.equal(300);\n expect(audio.offsetHeight).to.be.equal(30);\n });\n });\n\n it('should set its natural dimension only if not specified', () => {\n return attachAndRun({\n 'width': '500',\n src: 'https://origin.com/audio.mp3',\n }).then(a => {\n expect(a.style.width).to.be.equal('500px');\n expect(a.style.height).to.be.equal('30px');\n });\n });\n\n it('should fallback when not available', () => {\n const savedCreateElement = document.createElement;\n document.createElement = name => {\n if (name == 'audio') {\n return savedCreateElement.call(document, 'audio2');\n }\n return savedCreateElement.call(document, name);\n };\n const element = document.createElement('div');\n element.toggleFallback = sandbox.spy();\n const audio = new AmpAudio(element);\n const promise = audio.layoutCallback();\n document.createElement = savedCreateElement;\n return promise.then(() => {\n expect(element.toggleFallback).to.be.calledOnce;\n });\n });\n\n it('should propagate ARIA attributes', () => {\n return attachAndRun({\n src: 'https://origin.com/audio.mp3',\n 'aria-label': 'Hello',\n 'aria-labelledby': 'id2',\n 'aria-describedby': 'id3',\n }).then(a => {\n const audio = a.querySelector('audio');\n expect(audio.getAttribute('aria-label')).to.equal('Hello');\n expect(audio.getAttribute('aria-labelledby')).to.equal('id2');\n expect(audio.getAttribute('aria-describedby')).to.equal('id3');\n });\n });\n});\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"0cd29f967c2559e5592d5325f09ce735\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 166,\n \"max_line_length\": 80,\n \"avg_line_length\": 33.84939759036145,\n \"alnum_prop\": 0.607225484961737,\n \"repo_name\": \"sklobovskaya/amphtml\",\n \"id\": \"457c1f8b6b78ffa06a864ae132fc7b56e707e0d0\",\n \"size\": \"6246\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"extensions/amp-audio/0.1/test/test-amp-audio.js\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"73680\"\n },\n {\n \"name\": \"Go\",\n \"bytes\": \"7459\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"876009\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"36596\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"7538285\"\n },\n {\n \"name\": \"Protocol Buffer\",\n \"bytes\": \"29210\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"82782\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"6079\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"6942\"\n },\n {\n \"name\": \"Yacc\",\n \"bytes\": \"20286\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":934,"cells":{"text":{"kind":"string","value":" __ _ _____ _\n ___ _ __ / _/ |___ / __ __(_)_ __ ___\n / __| '_ \\| |_| | |_ \\ _____\\ \\ / /| | '_ ` _ \\\n \\__ \\ |_) | _| |___) |_____|\\ V / | | | | | | |\n |___/ .__/|_| |_|____/ \\_/ |_|_| |_| |_|\n |_|\n\nspf13-vim is a distribution of vim plugins and resources for Vim, Gvim and [MacVim].\n\nIt is a good starting point for anyone intending to use VIM for development running equally well on Windows, Linux, \\*nix and Mac.\n\nThe distribution is completely customisable using a `~/.vimrc.local`, `~/.vimrc.bundles.local`, and `~/.vimrc.before.local` Vim RC files.\n\n![spf13-vim image][spf13-vim-img]\n\nUnlike traditional VIM plugin structure, which similar to UNIX throws all files into common directories, making updating or disabling plugins a real mess, spf13-vim 3 uses the [Vundle] plugin management system to have a well organized vim directory (Similar to mac's app folders). Vundle also ensures that the latest versions of your plugins are installed and makes it easy to keep them up to date.\n\nGreat care has been taken to ensure that each plugin plays nicely with others, and optional configuration has been provided for what we believe is the most efficient use.\n\nLastly (and perhaps, most importantly) It is completely cross platform. It works well on Windows, Linux and OSX without any modifications or additional configurations. If you are using [MacVim] or Gvim additional features are enabled. So regardless of your environment just clone and run.\n\n# Installation\n## Requirements\nTo make all the plugins work, specifically [neocomplete](https://github.com/Shougo/neocomplete.vim), you need [vim with lua](https://github.com/Shougo/neocomplete.vim#requirements).\n\n## Linux, \\*nix, Mac OSX Installation\n\nThe easiest way to install spf13-vim is to use our [automatic installer](https://j.mp/spf13-vim3) by simply copying and pasting the following line into a terminal. This will install spf13-vim and backup your existing vim configuration. If you are upgrading from a prior version (before 3.0) this is also the recommended installation.\n\n*Requires Git 1.7+ and Vim 7.3+*\n\n```bash\n\n curl https://j.mp/spf13-vim3 -L > spf13-vim.sh && sh spf13-vim.sh\n```\n\nIf you have a bash-compatible shell you can run the script directly:\n```bash\n\n sh <(curl https://j.mp/spf13-vim3 -L)\n```\n\n## Installing on Windows\n\nOn Windows and \\*nix [Git] and [Curl] are required. Also, if you haven't done so already, you'll need to install [Vim].\nThe quickest option to install all three dependencies ([Git], [Curl], [Vim] and [spf13-vim]) is via [Chocolatey] NuGet. After installing [Chocolatey], execute the following commands on the _command prompt_:\n\n C:\\> choco install spf13-vim\n\n_Note: The [spf13-vim package] will install Vim also!_\n\nIf you want to install [msysgit], [Curl] and [spf13-vim] individually, follow the directions below.\n\n### Installing dependencies\n\n#### Install [Vim]\n\nAfter the installation of Vim you must add a new directory to your environment variables path to make it work with the script installation of spf13.\n\nOpen Vim and write the following command, it will show the installed directory:\n\n :echo $VIMRUNTIME\n C:\\Program Files (X86)\\Vim\\vim74\n\nThen you need to add it to your environment variable path. After that try execute `vim` within command prompt (press Win-R, type `cmd`, press Enter) and you’ll see the default vim page.\n\n#### Install [msysgit]\n\nAfter installation try running `git --version` within _command prompt_ (press Win-R, type `cmd`, press Enter) to make sure all good:\n\n C:\\> git --version\n git version 1.7.4.msysgit.0\n\n#### Setup [Curl]\n_Instructions blatently copied from vundle readme_\nInstalling Curl on Windows is easy as [Curl] is bundled with [msysgit]!\nBut before it can be used with [Vundle] it's required make `curl` run in _command prompt_.\nThe easiest way is to create `curl.cmd` with [this content](https://gist.github.com/912993)\n\n @rem Do not use \"echo off\" to not affect any child calls.\n @setlocal\n\n @rem Get the abolute path to the parent directory, which is assumed to be the\n @rem Git installation root.\n @for /F \"delims=\" %%I in (\"%~dp0..\") do @set git_install_root=%%~fI\n @set PATH=%git_install_root%\\bin;%git_install_root%\\mingw\\bin;%PATH%\n\n @if not exist \"%HOME%\" @set HOME=%HOMEDRIVE%%HOMEPATH%\n @if not exist \"%HOME%\" @set HOME=%USERPROFILE%\n\n @curl.exe %*\n\n\nAnd copy it to `C:\\Program Files\\Git\\cmd\\curl.cmd`, assuming [msysgit] was installed to `c:\\Program Files\\Git`\n\nto verify all good, run:\n\n C:\\> curl --version\n curl 7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8k zlib/1.2.3\n Protocols: dict file ftp ftps http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp\n Features: Largefile NTLM SSL SSPI libz\n\n\n#### Installing spf13-vim on Windows\n\nThe easiest way is to download and run the spf13-vim-windows-install.cmd file. Remember to run this file in **Administrator Mode** if you want the symlinks to be created successfully.\n\n## Updating to the latest version\nThe simpliest (and safest) way to update is to simply rerun the installer. It will completely and non destructively upgrade to the latest version.\n\n```bash\n\n curl https://j.mp/spf13-vim3 -L -o - | sh\n\n```\n\nAlternatively you can manually perform the following steps. If anything has changed with the structure of the configuration you will need to create the appropriate symlinks.\n\n```bash\n cd $HOME/to/spf13-vim/\n git pull\n vim +BundleInstall! +BundleClean +q\n```\n\n### Fork me on GitHub\n\nI'm always happy to take pull requests from others. A good number of people are already [contributors] to [spf13-vim]. Go ahead and fork me.\n\n# A highly optimized .vimrc config file\n\n![spf13-vimrc image][spf13-vimrc-img]\n\nThe .vimrc file is suited to programming. It is extremely well organized and folds in sections.\nEach section is labeled and each option is commented.\n\nIt fixes many of the inconveniences of vanilla vim including\n\n * A single config can be used across Windows, Mac and linux\n * Eliminates swap and backup files from littering directories, preferring to store in a central location.\n * Fixes common typos like :W, :Q, etc\n * Setup a solid set of settings for Formatting (change to meet your needs)\n * Setup the interface to take advantage of vim's features including\n * omnicomplete\n * line numbers\n * syntax highlighting\n * A better ruler & status line\n * & more\n * Configuring included plugins\n\n## Customization\n\nCreate `~/.vimrc.local` and `~/.gvimrc.local` for any local\ncustomizations.\n\nFor example, to override the default color schemes:\n\n```bash\n echo colorscheme ir_black >> ~/.vimrc.local\n```\n\n### Before File\n\nCreate a `~/.vimrc.before.local` file to define any customizations\nthat get loaded *before* the spf13-vim `.vimrc`.\n\nFor example, to prevent autocd into a file directory:\n```bash\n echo let g:spf13_no_autochdir = 1 >> ~/.vimrc.before.local\n```\nFor a list of available spf13-vim specific customization options, look at the `~/.vimrc.before` file.\n\n\n### Fork Customization\n\nThere is an additional tier of customization available to those who want to maintain a\nfork of spf13-vim specialized for a particular group. These users can create `.vimrc.fork`\nand `.vimrc.bundles.fork` files in the root of their fork. The load order for the configuration is:\n\n1. `.vimrc.before` - spf13-vim before configuration\n2. `.vimrc.before.fork` - fork before configuration\n3. `.vimrc.before.local` - before user configuration\n4. `.vimrc.bundles` - spf13-vim bundle configuration\n5. `.vimrc.bundles.fork` - fork bundle configuration\n6. `.vimrc.bundles.local` - local user bundle configuration\n6. `.vimrc` - spf13-vim vim configuration\n7. `.vimrc.fork` - fork vim configuration\n8. `.vimrc.local` - local user configuration\n\nSee `.vimrc.bundles` for specifics on what options can be set to override bundle configuration. See `.vimrc.before` for specifics\non what options can be overridden. Most vim configuration options should be set in your `.vimrc.fork` file, bundle configuration\nneeds to be set in your `.vimrc.bundles.fork` file.\n\nYou can specify the default bundles for your fork using `.vimrc.before.fork` file. Here is how to create an example `.vimrc.before.fork` file\nin a fork repo for the default bundles.\n```bash\n echo let g:spf13_bundle_groups=[\\'general\\', \\'programming\\', \\'misc\\', \\'youcompleteme\\'] >> .vimrc.before.fork\n```\nOnce you have this file in your repo, only the bundles you specified will be installed during the first installation of your fork.\n\nYou may also want to update your `README.markdown` file so that the `bootstrap.sh` link points to your repository and your `bootstrap.sh`\nfile to pull down your fork.\n\nFor an example of a fork of spf13-vim that provides customization in this manner see [taxilian's fork](https://github.com/taxilian/spf13-vim).\n\n### Easily Editing Your Configuration\n\n`ev` opens a new tab containing the .vimrc configuration files listed above. This makes it easier to get an overview of your\nconfiguration and make customizations.\n\n`sv` sources the .vimrc file, instantly applying your customizations to the currently running vim instance.\n\nThese two mappings can themselves be customized by setting the following in .vimrc.before.local:\n```bash\nlet g:spf13_edit_config_mapping='ev'\nlet g:spf13_apply_config_mapping='sv'\n```\n\n# Plugins\n\nspf13-vim contains a curated set of popular vim plugins, colors, snippets and syntaxes. Great care has been made to ensure that these plugins play well together and have optimal configuration.\n\n## Adding new plugins\n\nCreate `~/.vimrc.bundles.local` for any additional bundles.\n\nTo add a new bundle, just add one line for each bundle you want to install. The line should start with the word \"Bundle\" followed by a string of either the vim.org project name or the githubusername/githubprojectname. For example, the github project [spf13/vim-colors](https://github.com/spf13/vim-colors) can be added with the following command\n\n```bash\n echo Bundle \\'spf13/vim-colors\\' >> ~/.vimrc.bundles.local\n```\n\nOnce new plugins are added, they have to be installed.\n\n```bash\n vim +BundleInstall! +BundleClean +q\n```\n\n## Removing (disabling) an included plugin\n\nCreate `~/.vimrc.local` if it doesn't already exist.\n\nAdd the UnBundle command to this line. It takes the same input as the Bundle line, so simply copy the line you want to disable and add 'Un' to the beginning.\n\nFor example, disabling the 'AutoClose' and 'scrooloose/syntastic' plugins\n\n```bash\n echo UnBundle \\'AutoClose\\' >> ~/.vimrc.bundles.local\n echo UnBundle \\'scrooloose/syntastic\\' >> ~/.vimrc.bundles.local\n```\n\n**Remember to run ':BundleClean!' after this to remove the existing directories**\n\n\nHere are a few of the plugins:\n\n\n## [Undotree]\n\nIf you undo changes and then make a new change, in most editors the changes you undid are gone forever, as their undo-history is a simple list.\nSince version 7.0 vim uses an undo-tree instead. If you make a new change after undoing changes, a new branch is created in that tree.\nCombined with persistent undo, this is nearly as flexible and safe as git ;-)\n\nUndotree makes that feature more accessible by creating a visual representation of said undo-tree.\n\n**QuickStart** Launch using `u`.\n\n## [NERDTree]\n\nNERDTree is a file explorer plugin that provides \"project drawer\"\nfunctionality to your vim editing. You can learn more about it with\n`:help NERDTree`.\n\n**QuickStart** Launch using `e`.\n\n**Customizations**:\n\n* Use `` to toggle NERDTree\n* Use `e` or `nt` to load NERDTreeFind which opens NERDTree where the current file is located.\n* Hide clutter ('\\.pyc', '\\.git', '\\.hg', '\\.svn', '\\.bzr')\n* Treat NERDTree more like a panel than a split.\n\n## [ctrlp]\nCtrlp replaces the Command-T plugin with a 100% viml plugin. It provides an intuitive and fast mechanism to load files from the file system (with regex and fuzzy find), from open buffers, and from recently used files.\n\n**QuickStart** Launch using ``.\n\n## [Surround]\n\nThis plugin is a tool for dealing with pairs of \"surroundings.\" Examples\nof surroundings include parentheses, quotes, and HTML tags. They are\nclosely related to what Vim refers to as text-objects. Provided\nare mappings to allow for removing, changing, and adding surroundings.\n\nDetails follow on the exact semantics, but first, consider the following\nexamples. An asterisk (*) is used to denote the cursor position.\n\n Old text Command New text ~\n \"Hello *world!\" ds\" Hello world!\n [123+4*56]/2 cs]) (123+456)/2\n \"Look ma, I'm *HTML!\" cs\" Look ma, I'm HTML!\n if *x>3 { ysW( if ( x>3 ) {\n my $str = *whee!; vllllS' my $str = 'whee!';\n\nFor instance, if the cursor was inside `\"foo bar\"`, you could type\n`cs\"'` to convert the text to `'foo bar'`.\n\nThere's a lot more, check it out at `:help surround`\n\n## [NERDCommenter]\n\nNERDCommenter allows you to wrangle your code comments, regardless of\nfiletype. View `help :NERDCommenter` or checkout my post on [NERDCommenter](http://spf13.com/post/vim-plugins-nerd-commenter).\n\n**QuickStart** Toggle comments using `c` in Visual or Normal mode.\n\n## [neocomplete]\n\nNeocomplete is an amazing autocomplete plugin with additional support for snippets. It can complete simulatiously from the dictionary, buffer, omnicomplete and snippets. This is the one true plugin that brings Vim autocomplete on par with the best editors.\n\n**QuickStart** Just start typing, it will autocomplete where possible\n\n**Customizations**:\n\n * Automatically present the autocomplete menu\n * Support tab and enter for autocomplete\n * `` for completing snippets using [Neosnippet](https://github.com/Shougo/neosnippet.vim).\n\n![neocomplete image][autocomplete-img]\n\n## [YouCompleteMe]\n\nYouCompleteMe is another amazing completion engine. It is slightly more involved to set up as it contains a binary component that the user needs to compile before it will work. As a result of this however it is very fast.\n\nTo enable YouCompleteMe add `youcompleteme` to your list of groups by overriding it in your `.vimrc.before.local` like so: `let g:spf13_bundle_groups=['general', 'programming', 'misc', 'scala', 'youcompleteme']` This is just an example. Remember to choose the other groups you want here.\n\nOnce you have done this you will need to get Vundle to grab the latest code from git. You can do this by calling `:BundleInstall!`. You should see YouCompleteMe in the list.\n\nYou will now have the code in your bundles directory and can proceed to compile the core. Change to the directory it has been downloaded to. If you have a vanilla install then `cd ~/.spf13-vim-3/.vim/bundle/YouCompleteMe/` should do the trick. You should see a file in this directory called install.sh. There are a few options to consider before running the installer:\n\n * Do you want clang support (if you don't know what this is then you likely don't need it)?\n * Do you want to link against a local libclang or have the installer download the latest for you?\n * Do you want support for c# via the omnisharp server?\n\nThe plugin is well documented on the site linked above. Be sure to give that a read and make sure you understand the options you require.\n\nFor java users wanting to use eclim be sure to add `let g:EclimCompletionMethod = 'omnifunc'` to your .vimrc.local.\n\n## [Syntastic]\n\nSyntastic is a syntax checking plugin that runs buffers through external syntax\ncheckers as they are saved and opened. If syntax errors are detected, the user\nis notified and is happy because they didn't have to compile their code or\nexecute their script to find them.\n\n## [AutoClose]\n\nAutoClose does what you expect. It's simple, if you open a bracket, paren, brace, quote,\netc, it automatically closes it. It handles curlys correctly and doesn't get in the\nway of double curlies for things like jinja and twig.\n\n## [Fugitive]\n\nFugitive adds pervasive git support to git directories in vim. For more\ninformation, use `:help fugitive`\n\nUse `:Gstatus` to view `git status` and type `-` on any file to stage or\nunstage it. Type `p` on a file to enter `git add -p` and stage specific\nhunks in the file.\n\nUse `:Gdiff` on an open file to see what changes have been made to that\nfile\n\n**QuickStart** `gs` to bring up git status\n\n**Customizations**:\n\n * `gs` :Gstatus\n * `gd` :Gdiff\n * `gc` :Gcommit\n * `gb` :Gblame\n * `gl` :Glog\n * `gp` :Git push\n * `gw` :Gwrite\n * :Git ___ will pass anything along to git.\n\n![fugitive image][fugitive-img]\n\n## [PIV]\n\nThe most feature complete and up to date PHP Integration for Vim with proper support for PHP 5.3+ including latest syntax, functions, better fold support, etc.\n\nPIV provides:\n\n * PHP 5.3 support\n * Auto generation of PHP Doc (,pd on (function, variable, class) definition line)\n * Autocomplete of classes, functions, variables, constants and language keywords\n * Better indenting\n * Full PHP documentation manual (hit K on any function for full docs)\n\n![php vim itegration image][phpmanual-img]\n\n## [Ack.vim]\n\nAck.vim uses ack to search inside the current directory for a pattern.\nYou can learn more about it with `:help Ack`\n\n**QuickStart** :Ack\n\n## [Tabularize]\n\nTabularize lets you align statements on their equal signs and other characters\n\n**Customizations**:\n\n * `a= :Tabularize /=`\n * `a: :Tabularize /:`\n * `a:: :Tabularize /:\\zs`\n * `a, :Tabularize /,`\n * `a :Tabularize /`\n\n## [Tagbar]\n\nspf13-vim includes the Tagbar plugin. This plugin requires exuberant-ctags and will automatically generate tags for your open files. It also provides a panel to navigate easily via tags\n\n**QuickStart** `CTRL-]` while the cursor is on a keyword (such as a function name) to jump to its definition.\n\n**Customizations**: spf13-vim binds `tt` to toggle the tagbar panel\n\n![tagbar image][tagbar-img]\n\n**Note**: For full language support, run `brew install ctags` to install\nexuberant-ctags.\n\n**Tip**: Check out `:help ctags` for information about VIM's built-in\nctag support. Tag navigation creates a stack which can traversed via\n`Ctrl-]` (to find the source of a token) and `Ctrl-T` (to jump back up\none level).\n\n## [EasyMotion]\n\nEasyMotion provides an interactive way to use motions in Vim.\n\nIt quickly maps each possible jump destination to a key allowing very fast and\nstraightforward movement.\n\n**QuickStart** EasyMotion is triggered using the normal movements, but prefixing them with ``\n\nFor example this screen shot demonstrates pressing `,,w`\n\n![easymotion image][easymotion-img]\n\n## [Airline]\n\nAirline provides a lightweight themable statusline with no external dependencies. By default this configuration uses the symbols `‹` and `›` as separators for different statusline sections but can be configured to use the same symbols as [Powerline]. An example first without and then with powerline symbols is shown here:\n\n![airline image][airline-img]\n\nTo enable powerline symbols first install one of the [Powerline Fonts] or patch your favorite font using the provided instructions. Configure your terminal, MacVim, or Gvim to use the desired font. Finally add `let g:airline_powerline_fonts=1` to your `.vimrc.before.local`.\n\n## Additional Syntaxes\n\nspf13-vim ships with a few additional syntaxes:\n\n* Markdown (bound to \\*.markdown, \\*.md, and \\*.mk)\n* Twig\n* Git commits (set your `EDITOR` to `mvim -f`)\n\n## Amazing Colors\n\nspf13-vim includes [solarized] and [spf13 vim color pack](https://github.com/spf13/vim-colors/):\n\n* ir_black\n* molokai\n* peaksea\n\nUse `:color molokai` to switch to a color scheme.\n\nTerminal Vim users will benefit from solarizing their terminal emulators and setting solarized support to 16 colors:\n\n let g:solarized_termcolors=16\n color solarized\n\nTerminal emulator colorschemes:\n\n* http://ethanschoonover.com/solarized (iTerm2, Terminal.app)\n* https://github.com/phiggins/konsole-colors-solarized (KDE Konsole)\n* https://github.com/sigurdga/gnome-terminal-colors-solarized (Gnome Terminal)\n\n## Snippets\n\nIt also contains a very complete set of [snippets](https://github.com/spf13/snipmate-snippets) for use with snipmate or [neocomplete].\n\n\n# Intro to VIM\n\nHere's some tips if you've never used VIM before:\n\n## Tutorials\n\n* Type `vimtutor` into a shell to go through a brief interactive\n tutorial inside VIM.\n* Read the slides at [VIM: Walking Without Crutches](https://walking-without-crutches.heroku.com/#1).\n\n## Modes\n\n* VIM has two (common) modes:\n * insert mode- stuff you type is added to the buffer\n * normal mode- keys you hit are interpreted as commands\n* To enter insert mode, hit `i`\n* To exit insert mode, hit ``\n\n## Useful commands\n\n* Use `:q` to exit vim\n* Certain commands are prefixed with a `` key, which by default maps to `\\`.\n Spf13-vim uses `let mapleader = \",\"` to change this to `,` which is in a consistent and\n convenient location.\n* Keyboard [cheat sheet](http://www.viemu.com/vi-vim-cheat-sheet.gif).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-7131036-5/spf13-vim/readme)](https://github.com/igrigorik/ga-beacon)\n[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/spf13/spf13-vim/trend.png)](https://bitdeli.com/free \"Bitdeli Badge\")\n\n\n[Git]:http://git-scm.com\n[Curl]:http://curl.haxx.se\n[Vim]:http://www.vim.org/download.php#pc\n[msysgit]:http://msysgit.github.io\n[Chocolatey]: http://chocolatey.org/\n[spf13-vim package]: https://chocolatey.org/packages/spf13-vim\n[MacVim]:http://code.google.com/p/macvim/\n[spf13-vim]:https://github.com/spf13/spf13-vim\n[contributors]:https://github.com/spf13/spf13-vim/contributors\n\n[Vundle]:https://github.com/VundleVim/Vundle.vim\n[PIV]:https://github.com/spf13/PIV\n[NERDCommenter]:https://github.com/scrooloose/nerdcommenter\n[Undotree]:https://github.com/mbbill/undotree\n[NERDTree]:https://github.com/scrooloose/nerdtree\n[ctrlp]:https://github.com/kien/ctrlp.vim\n[solarized]:https://github.com/altercation/vim-colors-solarized\n[neocomplete]:https://github.com/shougo/neocomplete\n[Fugitive]:https://github.com/tpope/vim-fugitive\n[Surround]:https://github.com/tpope/vim-surround\n[Tagbar]:https://github.com/majutsushi/tagbar\n[Syntastic]:https://github.com/scrooloose/syntastic\n[vim-easymotion]:https://github.com/Lokaltog/vim-easymotion\n[YouCompleteMe]:https://github.com/Valloric/YouCompleteMe\n[Matchit]:http://www.vim.org/scripts/script.php?script_id=39\n[Tabularize]:https://github.com/godlygeek/tabular\n[EasyMotion]:https://github.com/Lokaltog/vim-easymotion\n[Airline]:https://github.com/bling/vim-airline\n[Powerline]:https://github.com/lokaltog/powerline\n[Powerline Fonts]:https://github.com/Lokaltog/powerline-fonts\n[AutoClose]:https://github.com/spf13/vim-autoclose\n[Ack.vim]:https://github.com/mileszs/ack.vim\n\n[spf13-vim-img]:https://i.imgur.com/UKToY.png\n[spf13-vimrc-img]:https://i.imgur.com/kZWj1.png\n[autocomplete-img]:https://i.imgur.com/90Gg7.png\n[tagbar-img]:https://i.imgur.com/cjbrC.png\n[fugitive-img]:https://i.imgur.com/4NrxV.png\n[nerdtree-img]:https://i.imgur.com/9xIfu.png\n[phpmanual-img]:https://i.imgur.com/c0GGP.png\n[easymotion-img]:https://i.imgur.com/ZsrVL.png\n[airline-img]:https://i.imgur.com/D4ZYADr.png\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"a1bd6f671e6a398bfa6040886df21bb5\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 565,\n \"max_line_length\": 398,\n \"avg_line_length\": 41.55929203539823,\n \"alnum_prop\": 0.7333162982837188,\n \"repo_name\": \"metcalfc/spf13-vim\",\n \"id\": \"f97b4802a3382633ccdb2a5cc0e879b437fcfd84\",\n \"size\": \"23535\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/3.0\",\n \"path\": \"README.markdown\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"4122\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"5419\"\n },\n {\n \"name\": \"Vim script\",\n \"bytes\": \"50427\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":935,"cells":{"text":{"kind":"string","value":"' . __('Select one…') . ''\n . '';\n //get column whose datatype falls under string category\n $html .= PMA_getHtmlForColumnsList(\n $db,\n $table,\n _pgettext('string types', 'String')\n );\n echo $html;\n exit;\n}\nif (isset($_REQUEST['splitColumn'])) {\n $num_fields = $_REQUEST['numFields'];\n $html = PMA_getHtmlForCreateNewColumn($num_fields, $db, $table);\n $html .= PMA_URL_getHiddenInputs($db, $table);\n echo $html;\n exit;\n}\nif (isset($_REQUEST['addNewPrimary'])) {\n $num_fields = 1;\n $columnMeta = array('Field'=>$table . \"_id\", 'Extra'=>'auto_increment');\n $html = PMA_getHtmlForCreateNewColumn(\n $num_fields, $db, $table, $columnMeta\n );\n $html .= PMA_URL_getHiddenInputs($db, $table);\n echo $html;\n exit;\n}\nif (isset($_REQUEST['findPdl'])) {\n $html = PMA_findPartialDependencies($table, $db);\n echo $html;\n exit;\n}\n\nif (isset($_REQUEST['getNewTables2NF'])) {\n $partialDependencies = json_decode($_REQUEST['pd']);\n $html = PMA_getHtmlForNewTables2NF($partialDependencies, $table);\n echo $html;\n exit;\n}\n\nif (isset($_REQUEST['getNewTables3NF'])) {\n $dependencies = json_decode($_REQUEST['pd']);\n $tables = json_decode($_REQUEST['tables']);\n $newTables = PMA_getHtmlForNewTables3NF($dependencies, $tables, $db);\n PMA_Response::getInstance()->disable();\n PMA_headerJSON();\n echo json_encode($newTables);\n exit;\n}\n\n$response = PMA_Response::getInstance();\n$header = $response->getHeader();\n$scripts = $header->getScripts();\n$scripts->addFile('normalization.js');\n$scripts->addFile('jquery/jquery.uitablefilter.js');\n$normalForm = '1nf';\nif (isset($_REQUEST['normalizeTo'])) {\n $normalForm = $_REQUEST['normalizeTo'];\n}\nif (isset($_REQUEST['createNewTables2NF'])) {\n $partialDependencies = json_decode($_REQUEST['pd']);\n $tablesName = json_decode($_REQUEST['newTablesName']);\n $res = PMA_createNewTablesFor2NF($partialDependencies, $tablesName, $table, $db);\n $response->addJSON($res);\n exit;\n}\nif (isset($_REQUEST['createNewTables3NF'])) {\n $newtables = json_decode($_REQUEST['newTables']);\n $res = PMA_createNewTablesFor3NF($newtables, $db);\n $response->addJSON($res);\n exit;\n}\nif (isset($_POST['repeatingColumns'])) {\n $repeatingColumns = $_POST['repeatingColumns'];\n $newTable = $_POST['newTable'];\n $newColumn = $_POST['newColumn'];\n $primary_columns = $_POST['primary_columns'];\n $res = PMA_moveRepeatingGroup(\n $repeatingColumns, $primary_columns, $newTable, $newColumn, $table, $db\n );\n $response->addJSON($res);\n exit;\n}\nif (isset($_REQUEST['step1'])) {\n $html = PMA_getHtmlFor1NFStep1($db, $table, $normalForm);\n $response->addHTML($html);\n} else if (isset($_REQUEST['step2'])) {\n $res = PMA_getHtmlContentsFor1NFStep2($db, $table);\n $response->addJSON($res);\n} else if (isset($_REQUEST['step3'])) {\n $res = PMA_getHtmlContentsFor1NFStep3($db, $table);\n $response->addJSON($res);\n} else if (isset ($_REQUEST['step4'])) {\n $res = PMA_getHtmlContentsFor1NFStep4($db, $table);\n $response->addJSON($res);\n} else if (isset($_REQUEST['step']) && $_REQUEST['step'] == 2.1) {\n $res = PMA_getHtmlFor2NFstep1($db, $table);\n $response->addJSON($res);\n} else if (isset($_REQUEST['step']) && $_REQUEST['step'] == 3.1) {\n $tables = $_REQUEST['tables'];\n $res = PMA_getHtmlFor3NFstep1($db, $tables);\n $response->addJSON($res);\n} else {\n $response->addHTML(PMA_getHtmlForNormalizetable());\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"7529bbc65e3f56281f38bfd676c5f265\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 123,\n \"max_line_length\": 85,\n \"avg_line_length\": 32.45528455284553,\n \"alnum_prop\": 0.6312625250501002,\n \"repo_name\": \"jothamhernandez/ThesisProject\",\n \"id\": \"4cb956918104c7dac53d97accb9f5e31c380c9db\",\n \"size\": \"3994\",\n \"binary\": false,\n \"copies\": \"13\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"db/normalization.php\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"ApacheConf\",\n \"bytes\": \"659\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"12934\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"92872\"\n },\n {\n \"name\": \"Groff\",\n \"bytes\": \"58\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"2159883\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"9930313\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"14684\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"17257824\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"32580\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"4584\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":936,"cells":{"text":{"kind":"string","value":"Artwork-Installer LinuxEDU\n\nTrebuie instalat pachetul \"ubiquity-slideshow-xubuntu\"\nsudo apt-get install ubiquity-slideshow-xubuntu\n\nApoi, editate fișierele din /usr/share/ubiquity-slideshow\n\nMerge testat/dezvoltat în felul următor :\n- se ia iso-ul și se rulează într-o mașină virtuală\n- se înlocuiesc fișierele din /usr/share/ubiquity-slideshow cu unele personale\n- se pornește installerul și se instalează sistemul (aici se vor vedea noul artwork)\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"62cd5f26600e78710defe44d4880bf2d\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 11,\n \"max_line_length\": 84,\n \"avg_line_length\": 40.81818181818182,\n \"alnum_prop\": 0.8151447661469933,\n \"repo_name\": \"educatie/installer\",\n \"id\": \"3b636dd198da67c613df6ed4327c4609954dfd93\",\n \"size\": \"483\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"README.md\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"4643\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"247576\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"9025\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":937,"cells":{"text":{"kind":"string","value":"package org.apache.struts2.convention;\n\nimport com.opensymphony.xwork2.ActionInvocation;\nimport com.opensymphony.xwork2.interceptor.AbstractInterceptor;\n\npublic class TestInterceptor extends AbstractInterceptor {\n\tprivate String string1;\n\t\n\t@Override\n\tpublic String intercept(ActionInvocation invocation) throws Exception {\n\t\treturn null;\n\t}\n\n\tpublic String getString1() {\n\t\treturn string1;\n\t}\n\n\tpublic void setString1(String string1) {\n\t\tthis.string1 = string1;\n\t}\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"b2573815b016988240ad301652bd0728\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 21,\n \"max_line_length\": 72,\n \"avg_line_length\": 22.285714285714285,\n \"alnum_prop\": 0.7927350427350427,\n \"repo_name\": \"TheTypoMaster/struts-2.3.24\",\n \"id\": \"12a0988aba831bd6dc95c22e72f1d0cb75ec65c5\",\n \"size\": \"468\",\n \"binary\": false,\n \"copies\": \"4\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/plugins/convention/src/test/java/org/apache/struts2/convention/TestInterceptor.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"ActionScript\",\n \"bytes\": \"22970\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"73781\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"1055902\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"10166736\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"3966249\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"8112\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":938,"cells":{"text":{"kind":"string","value":"

Datasets

Datasets.

Usage

var datasets = require( '@stdlib/datasets' );\n

datasets( name[, options] )

Returns standard library datasets.

var data = datasets( 'MONTH_NAMES_EN' );\n/* returns\n    [\n        'January',\n        'February',\n        'March',\n        'April',\n        'May',\n        'June',\n        'July',\n        'August',\n        'September',\n        'October',\n        'November',\n        'December'\n    ]\n*/\n

The function forwards provided options to the dataset interface specified by name.

var opts = {\n    'data': 'cities'\n};\n\nvar data = datasets( 'MINARD_NAPOLEONS_MARCH', opts );\n/* returns\n    [\n        {'lon': 24,'lat': 55,'city': 'Kowno',\n        {'lon': 25.3,'lat': 54.7,'city': 'Wilna',\n        {'lon': 26.4,'lat': 54.4,'city': 'Smorgoni',\n        {'lon': 26.8,'lat': 54.3,'city': 'Molodexno',\n        {'lon': 27.7,'lat': 55.2,'city': 'Gloubokoe',\n        {'lon': 27.6,'lat': 53.9,'city': 'Minsk',\n        {'lon': 28.5,'lat': 54.3,'city': 'Studienska',\n        {'lon': 28.7,'lat': 55.5,'city': 'Polotzk',\n        {'lon': 29.2,'lat': 54.4,'city': 'Bobr',\n        {'lon': 30.2,'lat': 55.3,'city': 'Witebsk',\n        {'lon': 30.4,'lat': 54.5,'city': 'Orscha',\n        {'lon': 30.4,'lat': 53.9,'city': 'Mohilow',\n        {'lon': 32,'lat': 54.8,'city': 'Smolensk',\n        {'lon': 33.2,'lat': 54.9,'city': 'Dorogobouge',\n        {'lon': 34.3,'lat': 55.2,'city': 'Wixma',\n        {'lon': 34.4,'lat': 55.5,'city': 'Chjat',\n        {'lon': 36,'lat': 55.5,'city': 'Mojaisk',\n        {'lon': 37.6,'lat': 55.8,'city': 'Moscou',\n        {'lon': 36.6,'lat': 55.3,'city': 'Tarantino',\n        {'lon': 36.5,'lat': 55,'city': 'Malo-Jarosewli'\n    ]\n*/\n

Examples

var datasets = require( '@stdlib/datasets' );\n\nvar data = datasets( 'MONTH_NAMES_EN' );\nconsole.log( data );\n

CLI

Usage

Usage: datasets [options] [--name=&#x3C;name>]\n\nOptions:\n\n  -h,    --help                Print this message.\n  -V,    --version             Print the package version.\n         --name name           Dataset name.\n         --ls                  List datasets.\n

Notes

  • Dataset specific options should follow two hyphen characters -- in order to indicate that those options should not be parsed as normal command-line options.

Examples

$ datasets --name MONTH_NAMES_EN\nJanuary\nFebruary\nMarch\n...\n

Use two hyphen characters -- to delineate dataset specific options.

$ datasets --name MINARD_NAPOLEONS_MARCH -- --data army\nlon,lat,size,direction,division\n24.0,54.9,340000,A,1\n24.5,55.0,340000,A,1\n25.5,54.5,340000,A,1\n...\n
"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"80616f62e93f77cc5093c21ed7e0ba3c\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 71,\n \"max_line_length\": 397,\n \"avg_line_length\": 57.267605633802816,\n \"alnum_prop\": 0.6013280865715691,\n \"repo_name\": \"stdlib-js/www\",\n \"id\": \"4a8d6bcc7acc59922ec2eb4003dab2fbff9029d6\",\n \"size\": \"4066\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"public/docs/api/latest/@stdlib/datasets/index.html\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"190538\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"158086013\"\n },\n {\n \"name\": \"Io\",\n \"bytes\": \"14873\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"5395746994\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"40479\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"9744\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":939,"cells":{"text":{"kind":"string","value":"FROM balenalib/artik520-ubuntu:disco-build\n\nENV NODE_VERSION 15.6.0\nENV YARN_VERSION 1.22.4\n\nRUN for key in \\\n\t6A010C5166006599AA17F08146C2130DFD2497F5 \\\n\t; do \\\n\t\tgpg --keyserver pgp.mit.edu --recv-keys \"$key\" || \\\n\t\tgpg --keyserver keyserver.pgp.com --recv-keys \"$key\" || \\\n\t\tgpg --keyserver ha.pool.sks-keyservers.net --recv-keys \"$key\" ; \\\n\tdone \\\n\t&& curl -SLO \"http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-armv7l.tar.gz\" \\\n\t&& echo \"234871415c54174f91764f332a72631519a6af7b1a87797ad7c729855182f9cd node-v$NODE_VERSION-linux-armv7l.tar.gz\" | sha256sum -c - \\\n\t&& tar -xzf \"node-v$NODE_VERSION-linux-armv7l.tar.gz\" -C /usr/local --strip-components=1 \\\n\t&& rm \"node-v$NODE_VERSION-linux-armv7l.tar.gz\" \\\n\t&& curl -fSLO --compressed \"https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz\" \\\n\t&& curl -fSLO --compressed \"https://yarnpkg.com/downloads/$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz.asc\" \\\n\t&& gpg --batch --verify yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \\\n\t&& mkdir -p /opt/yarn \\\n\t&& tar -xzf yarn-v$YARN_VERSION.tar.gz -C /opt/yarn --strip-components=1 \\\n\t&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \\\n\t&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarnpkg \\\n\t&& rm yarn-v$YARN_VERSION.tar.gz.asc yarn-v$YARN_VERSION.tar.gz \\\n\t&& npm config set unsafe-perm true -g --unsafe-perm \\\n\t&& rm -rf /tmp/*\n\nCMD [\"echo\",\"'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs\"]\n\n RUN curl -SLO \"https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@node.sh\" \\\n && echo \"Running test-stack@node\" \\\n && chmod +x test-stack@node.sh \\\n && bash test-stack@node.sh \\\n && rm -rf test-stack@node.sh \n\nRUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \\nArchitecture: ARM v7 \\nOS: Ubuntu disco \\nVariant: build variant \\nDefault variable(s): UDEV=off \\nThe following software stack is preinstalled: \\nNode.js v15.6.0, Yarn v1.22.4 \\nExtra features: \\n- Easy way to install packages with `install_packages ` command \\n- Run anywhere with cross-build feature (for ARM only) \\n- Keep the container idling with `balena-idle` command \\n- Show base image details with `balena-info` command' > /.balena/messages/image-info\n\nRUN echo '#!/bin/sh.real\\nbalena-info\\nrm -f /bin/sh\\ncp /bin/sh.real /bin/sh\\n/bin/sh \"$@\"' > /bin/sh-shim \\\n\t&& chmod +x /bin/sh-shim \\\n\t&& cp /bin/sh /bin/sh.real \\\n\t&& mv /bin/sh-shim /bin/sh"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"885fb7467817fc7d57d9c5ea62044ca9\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 41,\n \"max_line_length\": 692,\n \"avg_line_length\": 66.73170731707317,\n \"alnum_prop\": 0.7097953216374269,\n \"repo_name\": \"nghiant2710/base-images\",\n \"id\": \"8570b392e054aacee967fc718c879c76d0cb8816\",\n \"size\": \"2757\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"balena-base-images/node/artik520/ubuntu/disco/15.6.0/build/Dockerfile\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Dockerfile\",\n \"bytes\": \"144558581\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"16316\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"368690\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":940,"cells":{"text":{"kind":"string","value":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing wojilu.Common.Menus.Interface;\r\nusing wojilu.Web.Context;\r\nusing System.Collections;\r\nusing wojilu.Web.Url;\r\nusing wojilu.Web.Mvc.Routes;\r\nusing wojilu.Web.Mvc;\r\n\r\nnamespace wojilu.Web.Controller.Layouts {\r\n\r\n public class MenuHelper {\r\n\r\n public static void bindMenuSingle( IBlock block, IMenu menu, MvcContext ctx ) {\r\n\r\n\r\n block.Set( \"menu.Id\", menu.Id );\r\n block.Set( \"menu.Name\", menu.Name );\r\n block.Set( \"menu.Style\", menu.Style );\r\n block.Set( \"menu.Link\", UrlConverter.toMenu( menu, ctx ) );\r\n\r\n String lnkTarget = menu.OpenNewWindow == 1 ? lnkTarget = \" target=\\\"_blank\\\"\" : \"\";\r\n block.Set( \"menu.LinkTarget\", lnkTarget );\r\n\r\n block.Next();\r\n }\r\n\r\n public static void bindSubMenus( IBlock block, List list, MvcContext ctx ) {\r\n\r\n foreach (IMenu menu in list) {\r\n bindMenuSingle( block, menu, ctx );\r\n }\r\n }\r\n\r\n public static List getSubMenus( IList menus, IMenu menu ) {\r\n\r\n List list = new List();\r\n if (menu == null) return list;\r\n\r\n foreach (IMenu m in menus) {\r\n if (m.ParentId == menu.Id) list.Add( m );\r\n }\r\n return list;\r\n }\r\n\r\n public static List getRootMenus( IList menus ) {\r\n\r\n List list = new List();\r\n foreach (IMenu m in menus) {\r\n if (m.ParentId == 0) list.Add( m );\r\n }\r\n return list;\r\n }\r\n\r\n\r\n //--------------------------------------------------------------------------------------------------\r\n\r\n public static IMenu getCurrentRootMenu( List list, MvcContext ctx ) {\r\n\r\n IMenu m = getCurrentMenuByUrl( list, ctx );\r\n\r\n if (m != null) {\r\n\r\n if (m.ParentId == 0)\r\n return m;\r\n else {\r\n return getParentMenu( list, m, ctx );\r\n }\r\n }\r\n else {\r\n\r\n return getRootMenuByAppAndNs( list, ctx );\r\n }\r\n }\r\n\r\n //--------------------------------------------\r\n\r\n private static IMenu getCurrentMenuByUrl( List list, MvcContext ctx ) {\r\n\r\n String currentPath = strUtil.TrimEnd( ctx.url.Path, MvcConfig.Instance.UrlExt );\r\n currentPath = currentPath.TrimStart( '/' );\r\n\r\n Boolean isHomepage = false;\r\n if (strUtil.IsNullOrEmpty( currentPath )) isHomepage = true;// 在无后缀名的情况下,首页是空\"\"\r\n\r\n foreach (IMenu menu in list) {\r\n\r\n if (isHomepage) {\r\n if (\"default\".Equals( menu.Url )) return menu;\r\n continue;\r\n }\r\n\r\n if (currentPath.Equals( menu.Url ) || currentPath.Equals( menu.RawUrl )) { // 未设置友好网址的url也是空\r\n return menu;\r\n }\r\n }\r\n return null;\r\n }\r\n\r\n private static IMenu getParentMenu( List list, IMenu menu, MvcContext ctx ) {\r\n foreach (IMenu m in list) {\r\n if (m.Id == menu.ParentId) return m;\r\n }\r\n return null;\r\n }\r\n\r\n //--------------------------------------------\r\n\r\n private static IMenu getRootMenuByAppAndNs( List list, MvcContext ctx ) {\r\n\r\n IMenu menu = getRootMenuByNs( list, ctx );\r\n if (menu == null) return null;\r\n\r\n // 如果是app,则还要比较appId\r\n if (ctx.app.Id > 0) {\r\n Route menuRoute = RouteTool.RecognizePath( menu.RawUrl );\r\n if (ctx.app.Id != menuRoute.appId) return null;\r\n }\r\n\r\n return menu;\r\n }\r\n\r\n private static IMenu getRootMenuByNs( List list, MvcContext ctx ) {\r\n\r\n // 先找到同一命名空间的\r\n IMenu menu = getMenuBySameNs( list, ctx );\r\n if (menu == null) return null;\r\n\r\n // 找到父菜单\r\n if (menu.ParentId > 0) menu = getParentMenu( list, menu, ctx );\r\n return menu;\r\n }\r\n\r\n private static IMenu getMenuBySameNs( List list, MvcContext ctx ) {\r\n\r\n foreach (IMenu m in list) {\r\n\r\n if (m.RawUrl.StartsWith( \"http:\" )) continue;\r\n\r\n Route rt = RouteTool.RecognizePath( m.RawUrl );\r\n if (!ctx.route.ns.StartsWith( rt.ns )) continue;\r\n\r\n if (ctx.app.Id <= 0 || ctx.app.Id == rt.appId) return m;\r\n\r\n }\r\n return null;\r\n }\r\n\r\n\r\n\r\n\r\n }\r\n\r\n}\r\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c0409690916c4305b286058d1a486550\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 155,\n \"max_line_length\": 108,\n \"avg_line_length\": 30.18709677419355,\n \"alnum_prop\": 0.477025005343022,\n \"repo_name\": \"songboriceboy/cnblogsbywojilu\",\n \"id\": \"a1c623f2f516718a55d68f4e9f8b1aa548d6dcf7\",\n \"size\": \"4779\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"wojilu.Controller/Layouts/MenuHelper.cs\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"ASP\",\n \"bytes\": \"1648\"\n },\n {\n \"name\": \"ActionScript\",\n \"bytes\": \"1034007\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"113\"\n },\n {\n \"name\": \"C#\",\n \"bytes\": \"5144510\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"494476\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"1357282\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"1469091\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"10164\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":941,"cells":{"text":{"kind":"string","value":"import { Mob, IMob, IMobTag, MobTag } from '../../core';\n\n/**\n * @name ElderGuardian\n * @description\n * The elder guardian is a hostile mob which only spawns underwater in ocean monuments.\n * It is a stronger variant of the guardian.\n */\nexport interface IElderGuardian extends IMob {\n\n}\n\n/**\n * @name ElderGuardian\n * @description\n * The elder guardian is a hostile mob which only spawns underwater in ocean monuments.\n * It is a stronger variant of the guardian.\n */\nexport class ElderGuardian extends Mob implements IElderGuardian {\n /**\n * @description\n * Initializes the Zombie\n */\n\tconstructor() {\n\t\tsuper('elder_guardian', new MobTag());\n\t}\n /**\n * Tags which modify the entity with your given values. \n */\n\tpublic get Tag(): IMobTag {\n\t\treturn this.entityTag as MobTag;\n\t}\n}"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"9f063e63a3d7716d642c0675b6eb80d9\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 33,\n \"max_line_length\": 87,\n \"avg_line_length\": 24.515151515151516,\n \"alnum_prop\": 0.6823238566131026,\n \"repo_name\": \"BrunnerLivio/MinecraftCommandAPI\",\n \"id\": \"8ad353fafe788f0f0a3ed890884bb94346663397\",\n \"size\": \"809\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/entities/ElderGuardian/ElderGuardian.ts\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"2577\"\n },\n {\n \"name\": \"TypeScript\",\n \"bytes\": \"55005\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":942,"cells":{"text":{"kind":"string","value":"\n

Are you sure you want to delete {{deleteText}}?

\n
\n \n Cancel\n
\n
\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"11b9b5bbf0907139f262bbeae8092261\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 7,\n \"max_line_length\": 83,\n \"avg_line_length\": 40.857142857142854,\n \"alnum_prop\": 0.6503496503496503,\n \"repo_name\": \"torgartor21/mfl_admin_web\",\n \"id\": \"9def26d39e9b1b6e631c493dfe9ff7a04eb4bf08\",\n \"size\": \"286\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/app/common/tpls/delete.tpl.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"300434\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"524869\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"1588217\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"1115\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"2084\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":943,"cells":{"text":{"kind":"string","value":"using System;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing Moq;\nusing Owin;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Microsoft.Owin.Mapping;\nusing Microsoft.Owin.Extensions;\nusing System.Threading.Tasks;\nusing MMMWrapper.Logic;\nusing MMMWrapper.Logic.Config;\n\nnamespace MMMWrapper.Tests\n{\n [TestClass]\n public class OwinTests\n {\n [TestMethod]\n public void StartUpOk()\n {\n var startup = new Startup();\n var mockedAppBuilder = new Mock();\n\n\n var properties = new Dictionary();\n\n mockedAppBuilder.Setup(a => a.Properties).Returns(properties);\n\n mockedAppBuilder.Setup(a => a.Use(It.IsAny())).Verifiable();\n mockedAppBuilder.Setup(a => a.New()).Returns(mockedAppBuilder.Object);\n\n\n\n mockedAppBuilder.Setup(a => a.Use(typeof(MapMiddleware), It.IsAny())).Returns(mockedAppBuilder.Object.New());\n\n\n startup.Configuration(mockedAppBuilder.Object);\n\n Assert.IsTrue(properties.Keys.Any(a => a == \"swagger\"));\n }\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"ea37b4d301d2ccc38d6624630f6ef186\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 42,\n \"max_line_length\": 133,\n \"avg_line_length\": 27.285714285714285,\n \"alnum_prop\": 0.6684118673647469,\n \"repo_name\": \"martijnvaandering/MMMWrapper\",\n \"id\": \"4655460f57020418a94f36d7e4b0eaa8a8e86166\",\n \"size\": \"1148\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"MMMWrapper.Tests/OwinTest.cs\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"C#\",\n \"bytes\": \"185241\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"102034\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"4252\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"2229519\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":944,"cells":{"text":{"kind":"string","value":"\n'use strict';\n\nimport type {SourceMap} from './output/source-map';\nimport type {Ast} from 'babel-core';\nimport type {Console} from 'console';\n\nexport type Callback\n = (Error => void)\n & ((null | void, A, B) => void);\n\ntype Dependency = {|\n id: string,\n path: string,\n|};\n\nexport type File = {|\n code: string,\n map?: ?Object,\n path: string,\n type: FileTypes,\n|};\n\ntype FileTypes = 'module' | 'script' | 'asset';\n\nexport type GraphFn = (\n entryPoints: Iterable,\n platform: string,\n options?: ?GraphOptions,\n callback?: Callback,\n) => void;\n\ntype GraphOptions = {|\n log?: Console,\n optimize?: boolean,\n skip?: Set,\n|};\n\nexport type GraphResult = {|\n entryModules: Array,\n modules: Array,\n|};\n\nexport type IdForPathFn = {path: string} => number;\n\nexport type LoadFn = (\n file: string,\n options: LoadOptions,\n callback: Callback>,\n) => void;\n\ntype LoadOptions = {|\n log?: Console,\n optimize?: boolean,\n platform?: string,\n|};\n\nexport type Module = {|\n dependencies: Array,\n file: File,\n|};\n\nexport type OutputFn = (\n modules: Iterable,\n filename?: string,\n idForPath: IdForPathFn,\n) => OutputResult;\n\ntype OutputResult = {|\n code: string,\n map: SourceMap,\n|};\n\nexport type PackageData = {|\n browser?: Object | string,\n main?: string,\n name?: string,\n 'react-native'?: Object | string,\n|};\n\nexport type ResolveFn = (\n id: string,\n source: ?string,\n platform: string,\n options?: ResolveOptions,\n callback: Callback,\n) => void;\n\ntype ResolveOptions = {\n log?: Console,\n};\n\nexport type TransformerResult = {|\n ast: ?Ast,\n code: string,\n map: ?SourceMap,\n|};\n\nexport type Transformer = {\n transform: (\n sourceCode: string,\n filename: string,\n options: ?{},\n plugins?: Array,\n ) => {ast: ?Ast, code: string, map: ?SourceMap}\n};\n\nexport type TransformResult = {|\n code: string,\n dependencies: Array,\n dependencyMapName?: string,\n map: ?Object,\n|};\n\nexport type TransformResults = {[string]: TransformResult};\n\nexport type TransformVariants = {[key: string]: Object};\n\nexport type TransformedFile = {\n assetContent: ?string,\n code: string,\n file: string,\n hasteID: ?string,\n package?: PackageData,\n transformed: TransformResults,\n type: FileTypes,\n};\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"460a40a79026e54ee299f145881fd774\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 127,\n \"max_line_length\": 62,\n \"avg_line_length\": 18.661417322834644,\n \"alnum_prop\": 0.6535864978902953,\n \"repo_name\": \"Maxwell2022/react-native\",\n \"id\": \"92ecc3ceaab5d041c0f72f41ccc3459083289e9e\",\n \"size\": \"2690\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"packager/src/ModuleGraph/types.flow.js\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"Assembly\",\n \"bytes\": \"15392\"\n },\n {\n \"name\": \"Awk\",\n \"bytes\": \"121\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"683\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"203427\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"684247\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"40564\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"172601\"\n },\n {\n \"name\": \"IDL\",\n \"bytes\": \"1837\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"2839413\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"3944826\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"7585\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"1382785\"\n },\n {\n \"name\": \"Objective-C++\",\n \"bytes\": \"237329\"\n },\n {\n \"name\": \"Prolog\",\n \"bytes\": \"287\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"137789\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"7566\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"40461\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":945,"cells":{"text":{"kind":"string","value":"\n\n \n \n \n elpi: Not compatible 👼\n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n « Up\n

\n elpi\n \n 1.8.2~8.12\n Not compatible 👼\n \n

\n

📅 (2022-11-26 03:34:25 UTC)

\n

Context

\n
# Packages matching: installed\n# Name              # Installed # Synopsis\nbase-bigarray       base\nbase-threads        base\nbase-unix           base\nconf-findutils      1           Virtual package relying on findutils\nconf-gmp            4           Virtual package relying on a GMP lib system installation\ncoq                 8.13.0      Formal proof management system\nnum                 1.4         The legacy Num library for arbitrary-precision integer and rational arithmetic\nocaml               4.06.1      The OCaml compiler (virtual package)\nocaml-base-compiler 4.06.1      Official 4.06.1 release\nocaml-config        1           OCaml Switch Configuration\nocamlfind           1.9.5       A library manager for OCaml\nzarith              1.12        Implements arithmetic and logical operations over arbitrary-precision integers\n# opam file:\nopam-version: &quot;2.0&quot;\nmaintainer: &quot;Enrico Tassi &lt;enrico.tassi@inria.fr&gt;&quot;\nauthors: [ &quot;Enrico Tassi&quot; ]\nlicense: &quot;LGPL-2.1-or-later&quot;\nhomepage: &quot;https://github.com/LPCIC/coq-elpi&quot;\nbug-reports: &quot;https://github.com/LPCIC/coq-elpi/issues&quot;\ndev-repo: &quot;git+https://github.com/LPCIC/coq-elpi&quot;\nbuild: [ make &quot;COQBIN=%{bin}%/&quot; &quot;ELPIDIR=%{prefix}%/lib/elpi&quot; &quot;OCAMLWARN=&quot; ]\ninstall: [ make &quot;install&quot; &quot;COQBIN=%{bin}%/&quot; &quot;ELPIDIR=%{prefix}%/lib/elpi&quot; ]\ndepends: [\n  &quot;elpi&quot; {&gt;= &quot;1.12.0&quot; &amp; &lt; &quot;1.13.0~&quot;}\n  &quot;coq&quot; {&gt;= &quot;8.12&quot; &amp; &lt; &quot;8.13~&quot; }\n  ]\ntags: [ &quot;logpath:elpi&quot; ]\nsynopsis: &quot;Elpi extension language for Coq&quot;\ndescription: &quot;&quot;&quot;\nCoq-elpi provides a Coq plugin that embeds ELPI.\nIt also provides a way to embed Coq&#39;s terms into λProlog using\nthe Higher-Order Abstract Syntax approach\nand a way to read terms back.  In addition to that it exports to ELPI a\nset of Coq&#39;s primitives, e.g. printing a message, accessing the\nenvironment of theorems and data types, defining a new constant and so on.\nFor convenience it also provides a quotation and anti-quotation for Coq&#39;s\nsyntax in λProlog.  E.g. `{{nat}}` is expanded to the type name of natural\nnumbers, or `{{A -&gt; B}}` to the representation of a product by unfolding\n the `-&gt;` notation. Finally it provides a way to define new vernacular commands\nand\nnew tactics.&quot;&quot;&quot;\nurl {\nsrc: &quot;https://github.com/LPCIC/coq-elpi/archive/v1.8.2_8.12.tar.gz&quot;\nchecksum: &quot;sha256=fa7008d75abafa9fcb8d8ed5a26873c4cc00663963425de55e230b7835c9e9a4&quot;\n}\n
\n

Lint

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
\n

Dry install 🏜️

\n

Dry install with the current Coq version:

\n
\n
Command
\n
opam install -y --show-action coq-elpi.1.8.2~8.12 coq.8.13.0
\n
Return code
\n
5120
\n
Output
\n
[NOTE] Package coq is already installed (current version is 8.13.0).\nThe following dependencies couldn&#39;t be met:\n  - coq-elpi -&gt; coq &lt; 8.13~ -&gt; ocaml &lt; 4.06.0\n      base of this switch (use `--unlock-base&#39; to force)\nYour request can&#39;t be satisfied:\n  - No available version of coq satisfies the constraints\nNo solution found, exiting\n
\n
\n

Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:

\n
\n
Command
\n
opam remove -y coq; opam install -y --show-action --unlock-base coq-elpi.1.8.2~8.12
\n
Return code
\n
0
\n
\n

Install dependencies

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Duration
\n
0 s
\n
\n

Install 🚀

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Duration
\n
0 s
\n
\n

Installation size

\n

No files were installed.

\n

Uninstall 🧹

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Missing removes
\n
\n none\n
\n
Wrong removes
\n
\n none\n
\n
\n
\n
\n
\n
\n
\n

\n Sources are on GitHub © Guillaume Claret 🐣\n

\n
\n
\n \n \n \n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"f30fe44eb2a1f3c5f6961a024ac13f3a\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 174,\n \"max_line_length\": 159,\n \"avg_line_length\": 43.54597701149425,\n \"alnum_prop\": 0.5568166820641415,\n \"repo_name\": \"coq-bench/coq-bench.github.io\",\n \"id\": \"aa58f150916011449454e8a16119e83ac8be698b\",\n \"size\": \"7604\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"clean/Linux-x86_64-4.06.1-2.0.5/released/8.13.0/elpi/1.8.2~8.12.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":946,"cells":{"text":{"kind":"string","value":"\n#ifndef _UAPI__LINUX_NETLINK_H\n#define _UAPI__LINUX_NETLINK_H\n#include \n#include \n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#include \n#define NETLINK_ROUTE 0\n#define NETLINK_UNUSED 1\n#define NETLINK_USERSOCK 2\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NETLINK_FIREWALL 3\n#define NETLINK_SOCK_DIAG 4\n#define NETLINK_NFLOG 5\n#define NETLINK_XFRM 6\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NETLINK_SELINUX 7\n#define NETLINK_ISCSI 8\n#define NETLINK_AUDIT 9\n#define NETLINK_FIB_LOOKUP 10\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NETLINK_CONNECTOR 11\n#define NETLINK_NETFILTER 12\n#define NETLINK_IP6_FW 13\n#define NETLINK_DNRTMSG 14\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NETLINK_KOBJECT_UEVENT 15\n#define NETLINK_GENERIC 16\n#define NETLINK_SCSITRANSPORT 18\n#define NETLINK_ECRYPTFS 19\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NETLINK_RDMA 20\n#define NETLINK_CRYPTO 21\n#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG\n#define MAX_LINKS 32\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\nstruct sockaddr_nl {\n __kernel_sa_family_t nl_family;\n unsigned short nl_pad;\n __u32 nl_pid;\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n __u32 nl_groups;\n};\nstruct nlmsghdr {\n __u32 nlmsg_len;\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n __u16 nlmsg_type;\n __u16 nlmsg_flags;\n __u32 nlmsg_seq;\n __u32 nlmsg_pid;\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n};\n#define NLM_F_REQUEST 1\n#define NLM_F_MULTI 2\n#define NLM_F_ACK 4\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NLM_F_ECHO 8\n#define NLM_F_DUMP_INTR 16\n#define NLM_F_ROOT 0x100\n#define NLM_F_MATCH 0x200\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NLM_F_ATOMIC 0x400\n#define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH)\n#define NLM_F_REPLACE 0x100\n#define NLM_F_EXCL 0x200\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NLM_F_CREATE 0x400\n#define NLM_F_APPEND 0x800\n#define NLMSG_ALIGNTO 4U\n#define NLMSG_ALIGN(len) ( ((len)+NLMSG_ALIGNTO-1) & ~(NLMSG_ALIGNTO-1) )\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NLMSG_HDRLEN ((int) NLMSG_ALIGN(sizeof(struct nlmsghdr)))\n#define NLMSG_LENGTH(len) ((len) + NLMSG_HDRLEN)\n#define NLMSG_SPACE(len) NLMSG_ALIGN(NLMSG_LENGTH(len))\n#define NLMSG_DATA(nlh) ((void*)(((char*)nlh) + NLMSG_LENGTH(0)))\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NLMSG_NEXT(nlh,len) ((len) -= NLMSG_ALIGN((nlh)->nlmsg_len), (struct nlmsghdr*)(((char*)(nlh)) + NLMSG_ALIGN((nlh)->nlmsg_len)))\n#define NLMSG_OK(nlh,len) ((len) >= (int)sizeof(struct nlmsghdr) && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && (nlh)->nlmsg_len <= (len))\n#define NLMSG_PAYLOAD(nlh,len) ((nlh)->nlmsg_len - NLMSG_SPACE((len)))\n#define NLMSG_NOOP 0x1\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NLMSG_ERROR 0x2\n#define NLMSG_DONE 0x3\n#define NLMSG_OVERRUN 0x4\n#define NLMSG_MIN_TYPE 0x10\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\nstruct nlmsgerr {\n int error;\n struct nlmsghdr msg;\n};\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NETLINK_ADD_MEMBERSHIP 1\n#define NETLINK_DROP_MEMBERSHIP 2\n#define NETLINK_PKTINFO 3\n#define NETLINK_BROADCAST_ERROR 4\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NETLINK_NO_ENOBUFS 5\n#define NETLINK_RX_RING 6\n#define NETLINK_TX_RING 7\nstruct nl_pktinfo {\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n __u32 group;\n};\nstruct nl_mmap_req {\n unsigned int nm_block_size;\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n unsigned int nm_block_nr;\n unsigned int nm_frame_size;\n unsigned int nm_frame_nr;\n};\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\nstruct nl_mmap_hdr {\n unsigned int nm_status;\n unsigned int nm_len;\n __u32 nm_group;\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n __u32 nm_pid;\n __u32 nm_uid;\n __u32 nm_gid;\n};\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\nenum nl_mmap_status {\n NL_MMAP_STATUS_UNUSED,\n NL_MMAP_STATUS_RESERVED,\n NL_MMAP_STATUS_VALID,\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n NL_MMAP_STATUS_COPY,\n NL_MMAP_STATUS_SKIP,\n};\n#define NL_MMAP_MSG_ALIGNMENT NLMSG_ALIGNTO\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NL_MMAP_MSG_ALIGN(sz) __ALIGN_KERNEL(sz, NL_MMAP_MSG_ALIGNMENT)\n#define NL_MMAP_HDRLEN NL_MMAP_MSG_ALIGN(sizeof(struct nl_mmap_hdr))\n#define NET_MAJOR 36\nenum {\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n NETLINK_UNCONNECTED = 0,\n NETLINK_CONNECTED,\n};\nstruct nlattr {\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n __u16 nla_len;\n __u16 nla_type;\n};\n#define NLA_F_NESTED (1 << 15)\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NLA_F_NET_BYTEORDER (1 << 14)\n#define NLA_TYPE_MASK ~(NLA_F_NESTED | NLA_F_NET_BYTEORDER)\n#define NLA_ALIGNTO 4\n#define NLA_ALIGN(len) (((len) + NLA_ALIGNTO - 1) & ~(NLA_ALIGNTO - 1))\n/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */\n#define NLA_HDRLEN ((int) NLA_ALIGN(sizeof(struct nlattr)))\n#endif\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"e5b6f4d335524d443452cb161a83643e\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 153,\n \"max_line_length\": 145,\n \"avg_line_length\": 37.39869281045752,\n \"alnum_prop\": 0.7221251310730514,\n \"repo_name\": \"efortuna/AndroidSDKClone\",\n \"id\": \"b5567b01adc40d4c8e3f56793aecff6b9dd46032\",\n \"size\": \"6696\",\n \"binary\": false,\n \"copies\": \"95\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"ndk_experimental/platforms/android-20/arch-x86/usr/include/linux/netlink.h\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"AppleScript\",\n \"bytes\": \"0\"\n },\n {\n \"name\": \"Assembly\",\n \"bytes\": \"79928\"\n },\n {\n \"name\": \"Awk\",\n \"bytes\": \"101642\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"110780727\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"62609188\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"318944\"\n },\n {\n \"name\": \"Component Pascal\",\n \"bytes\": \"220\"\n },\n {\n \"name\": \"Emacs Lisp\",\n \"bytes\": \"4737\"\n },\n {\n \"name\": \"Groovy\",\n \"bytes\": \"82931\"\n },\n {\n \"name\": \"IDL\",\n \"bytes\": \"31867\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"102919416\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"44616\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"196166\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"45617403\"\n },\n {\n \"name\": \"Prolog\",\n \"bytes\": \"1828886\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"34997242\"\n },\n {\n \"name\": \"Rust\",\n \"bytes\": \"17781\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"1585527\"\n },\n {\n \"name\": \"Visual Basic\",\n \"bytes\": \"962\"\n },\n {\n \"name\": \"XC\",\n \"bytes\": \"802542\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":947,"cells":{"text":{"kind":"string","value":"\n// .NAME vtkQuaternion - templated base type for storage of quaternions.\n// .SECTION Description\n// This class is a templated data type for storing and manipulating\n// quaternions. The quaternions have the form [w, x, y, z].\n// Given a rotation of angle theta and axis v, the corresponding\n// quaternion is [w, x, y, z] = [cos(theta/2), v*sin(theta/2)]\n//\n// This class implements the Spherical Linear interpolation (SLERP)\n// and the Spherical Spline Quaternion interpolation (SQUAD).\n// It is advised to use the vtkQuaternionInterpolator when dealing\n// with multiple quaternions and or interpolations.\n//\n// .SECTION See also\n// vtkQuaternionInterpolator\n\n#ifndef __vtkQuaternion_h\n#define __vtkQuaternion_h\n\n#include \"vtkTuple.h\"\n\ntemplate class vtkQuaternion : public vtkTuple\n{\npublic:\n // Description:\n // Default constructor. Creates an identity quaternion.\n vtkQuaternion();\n\n // Description:\n // Initialize all of the quaternion's elements with the supplied scalar.\n explicit vtkQuaternion(const T& scalar) : vtkTuple(scalar) {}\n\n // Description:\n // Initalize the quaternion's elements with the elements of the supplied array.\n // Note that the supplied pointer must contain at least as many elements as\n // the quaternion, or it will result in access to out of bounds memory.\n explicit vtkQuaternion(const T* init) : vtkTuple(init) {}\n\n // Description:\n // Initialize the quaternion element explicitly.\n vtkQuaternion(const T& w, const T& x, const T& y, const T& z);\n\n // Description:\n // Get the squared norm of the quaternion.\n T SquaredNorm() const;\n\n // Description:\n // Get the norm of the quaternion, i.e. its length.\n T Norm() const;\n\n // Description:\n // Set the quaternion to identity in place.\n void ToIdentity();\n\n // Description:\n // Return the identity quaternion.\n // Note that the default constructor also creates an identity quaternion.\n static vtkQuaternion Identity();\n\n // Description:\n // Normalize the quaternion in place.\n // Return the norm of the quaternion.\n T Normalize();\n\n // Description:\n // Return the normalized form of this quaternion.\n vtkQuaternion Normalized() const;\n\n // Description:\n // Conjugate the quaternion in place.\n void Conjugate();\n\n // Description:\n // Return the conjugate form of this quaternion.\n vtkQuaternion Conjugated() const;\n\n // Description:\n // Invert the quaternion in place.\n // This is equivalent to conjugate the quaternion and then divide\n // it by its squared norm.\n void Invert();\n\n // Description:\n // Return the inverted form of this quaternion.\n vtkQuaternion Inverse() const;\n\n // Description:\n // Return the dot product of two quaternions.\n T Dot(const vtkQuaternion& q)const;\n\n // Description:\n // Convert this quaternion to a unit log quaternion.\n // The unit log quaternion is defined by:\n // [w, x, y, z] = [0.0, v*sin(theta)].\n void ToUnitLog();\n\n // Description:\n // Return the unit log version of this quaternion.\n // The unit log quaternion is defined by:\n // [w, x, y, z] = [0.0, v*sin(theta)].\n vtkQuaternion UnitLog() const;\n\n // Description:\n // Convert this quaternion to a unit exponential quaternion.\n // The unit exponential quaternion is defined by:\n // [w, x, y, z] = [cos(theta), v*sin(theta)].\n void ToUnitExp();\n\n // Description:\n // Return the unit exponential version of this quaternion.\n // The unit exponential quaternion is defined by:\n // [w, x, y, z] = [cos(theta), v*sin(theta)].\n vtkQuaternion UnitExp() const;\n\n // Description:\n // Normalize a quaternion in place and transform it to\n // so its angle is in degrees and its axis normalized.\n void NormalizeWithAngleInDegrees();\n\n // Description:\n // Returns a quaternion normalized and transformed\n // so its angle is in degrees and its axis normalized.\n vtkQuaternion NormalizedWithAngleInDegrees() const;\n\n // Description:\n // Set/Get the w, x, y and z components of the quaternion.\n void Set(const T& w, const T& x, const T& y, const T& z);\n void Set(T quat[4]);\n void Get(T quat[4]) const;\n\n // Description:\n // Set/Get the w component of the quaternion, i.e. element 0.\n void SetW(const T& w);\n const T& GetW() const;\n\n // Description:\n // Set/Get the x component of the quaternion, i.e. element 1.\n void SetX(const T& x);\n const T& GetX() const;\n\n // Description:\n // Set/Get the y component of the quaternion, i.e. element 2.\n void SetY(const T& y);\n const T& GetY() const;\n\n // Description:\n // Set/Get the y component of the quaternion, i.e. element 3.\n void SetZ(const T& z);\n const T& GetZ() const;\n\n // Description:\n // Set/Get the angle (in radians) and the axis corresponding to\n // the axis-angle rotation of this quaternion.\n T GetRotationAngleAndAxis(T axis[3]) const;\n void SetRotationAngleAndAxis(T angle, T axis[3]);\n void SetRotationAngleAndAxis(\n const T& angle, const T& x, const T& y, const T& z);\n\n // Description:\n // Cast the quaternion to the specified type and return the result.\n template vtkQuaternion Cast() const;\n\n // Description:\n // Convert a quaternion to a 3x3 rotation matrix. The quaternion\n // does not have to be normalized beforehand.\n // @sa FromMatrix3x3()\n void ToMatrix3x3(T A[3][3]) const;\n\n // Description:\n // Convert a 3x3 matrix into a quaternion. This will provide the\n // best possible answer even if the matrix is not a pure rotation matrix.\n // The method used is that of B.K.P. Horn.\n // @sa ToMatrix3x3()\n void FromMatrix3x3(const T A[3][3]);\n\n // Description:\n // Interpolate quaternions using spherical linear interpolation between\n // this quaternion and q1 to produce the output.\n // The parametric coordinate t belongs to [0,1] and lies between (this,q1).\n // @sa vtkQuaternionInterpolator\n vtkQuaternion Slerp(T t, const vtkQuaternion& q) const;\n\n // Description:\n // Interpolates between quaternions, using spherical quadrangle\n // interpolation.\n // @sa vtkQuaternionInterpolator\n vtkQuaternion InnerPoint(const vtkQuaternion& q1,\n const vtkQuaternion& q2) const;\n\n // Description:\n // Performs the copy of a quaternion of the same basic type.\n void operator=(const vtkQuaternion& q);\n\n // Description:\n // Performs addition of quaternion of the same basic type.\n vtkQuaternion operator+(const vtkQuaternion& q) const;\n\n // Description:\n // Performs subtraction of quaternions of the same basic type.\n vtkQuaternion operator-(const vtkQuaternion& q) const;\n\n // Description:\n // Negate the quaternion by multiplying each component by -1.\n vtkQuaternion operator-() const;\n\n // Description:\n // Performs multiplication of quaternion of the same basic type.\n vtkQuaternion operator*(const vtkQuaternion& q) const;\n\n // Description:\n // Performs multiplication of the quaternions by a scalar value.\n vtkQuaternion operator*(const T& scalar) const;\n\n // Description:\n // Performs in place multiplication of the quaternions by a scalar value.\n void operator*=(const T& scalar) const;\n\n // Description:\n // Performs division of quaternions of the same type.\n vtkQuaternion operator/(const vtkQuaternion& q) const;\n\n // Description:\n // Performs division of the quaternions by a scalar value.\n vtkQuaternion operator/(const T& scalar) const;\n\n // Description:\n // Performs in place division of the quaternions by a scalar value.\n void operator/=(const T& scalar);\n\n // Decription:\n // Compare two quaternions. Return true if the quaternions are equal, false\n // otherwise.\n bool operator==(const vtkQuaternion& q) const;\n};\n\n// Description:\n// Several macros to define the various operator overloads for the quaternions.\n// These are necessary for the derived classes that are commonly used.\n#define vtkQuaternionIdentity(quaternionType, type) \\\nquaternionType Identity() const \\\n{ \\\n return quaternionType(vtkQuaternion::Identity().GetData()); \\\n}\n#define vtkQuaternionNormalized(quaternionType, type) \\\nquaternionType Normalized() const \\\n{ \\\n return quaternionType(vtkQuaternion::Normalized().GetData()); \\\n}\n#define vtkQuaternionConjugated(quaternionType, type) \\\nquaternionType Conjugated() const \\\n{ \\\n return quaternionType(vtkQuaternion::Conjugated().GetData()); \\\n}\n#define vtkQuaternionInverse(quaternionType, type) \\\nquaternionType Inverse() const \\\n{ \\\n return quaternionType(vtkQuaternion::Inverse().GetData()); \\\n}\n#define vtkQuaternionUnitLog(quaternionType, type) \\\nquaternionType UnitLog() const \\\n{ \\\n return quaternionType( \\\n vtkQuaternion::UnitLog().GetData()); \\\n}\n#define vtkQuaternionUnitExp(quaternionType, type) \\\nquaternionType UnitExp() const \\\n{ \\\n return quaternionType( \\\n vtkQuaternion::UnitExp().GetData()); \\\n}\n#define vtkQuaternionNormalizedWithAngleInDegrees(quaternionType, type) \\\nquaternionType NormalizedWithAngleInDegrees() const \\\n{ \\\n return quaternionType( \\\n vtkQuaternion::NormalizedWithAngleInDegrees().GetData()); \\\n}\n#define vtkQuaternionSlerp(quaternionType, type) \\\nquaternionType Slerp(type t, const quaternionType& q) const \\\n{ \\\n return quaternionType( \\\n vtkQuaternion::Slerp(t, q).GetData()); \\\n}\n#define vtkQuaternionInnerPoint(quaternionType, type) \\\nquaternionType InnerPoint(const quaternionType& q1, \\\n const quaternionType& q2) const \\\n{ \\\n return quaternionType( \\\n vtkQuaternion::InnerPoint(q1, q2).GetData()); \\\n}\n#define vtkQuaternionOperatorPlus(quaternionType, type) \\\ninline quaternionType operator+(const quaternionType& q) const \\\n{ \\\n return quaternionType( ( \\\n static_cast< vtkQuaternion > (*this) + \\\n static_cast< vtkQuaternion > (q)).GetData()); \\\n}\n#define vtkQuaternionOperatorMinus(quaternionType, type) \\\ninline quaternionType operator-(const quaternionType& q) const \\\n{ \\\n return quaternionType( ( \\\n static_cast< vtkQuaternion > (*this) - \\\n static_cast< vtkQuaternion > (q)).GetData()); \\\n}\n#define vtkQuaternionOperatorMultiply(quaternionType, type) \\\ninline quaternionType operator*(const quaternionType& q) const \\\n{ \\\n return quaternionType( ( \\\n static_cast< vtkQuaternion > (*this) * \\\n static_cast< vtkQuaternion > (q)).GetData()); \\\n}\n#define vtkQuaternionOperatorMultiplyScalar(quaternionType, type) \\\ninline quaternionType operator*(const type& scalar) const \\\n{ \\\n return quaternionType( ( \\\n static_cast< vtkQuaternion > (*this) * \\\n scalar).GetData()); \\\n}\n#define vtkQuaternionOperatorDivide(quaternionType, type) \\\ninline quaternionType operator/(const quaternionType& q) const \\\n{ \\\n return quaternionType( ( \\\n static_cast< vtkQuaternion > (*this) / \\\n static_cast< vtkQuaternion > (q)).GetData()); \\\n}\n#define vtkQuaternionOperatorDivideScalar(quaternionType, type) \\\ninline quaternionType operator/(const type& scalar) const \\\n{ \\\n return quaternionType( ( \\\n static_cast< vtkQuaternion > (*this) / \\\n scalar).GetData()); \\\n}\n\n#define vtkQuaternionOperatorMacro(quaternionType, type) \\\nvtkQuaternionIdentity(quaternionType, type) \\\nvtkQuaternionNormalized(quaternionType, type) \\\nvtkQuaternionConjugated(quaternionType, type) \\\nvtkQuaternionInverse(quaternionType, type) \\\nvtkQuaternionUnitLog(quaternionType, type) \\\nvtkQuaternionUnitExp(quaternionType, type) \\\nvtkQuaternionNormalizedWithAngleInDegrees(quaternionType, type) \\\nvtkQuaternionSlerp(quaternionType, type) \\\nvtkQuaternionInnerPoint(quaternionType, type) \\\nvtkQuaternionOperatorPlus(quaternionType, type) \\\nvtkQuaternionOperatorMinus(quaternionType, type) \\\nvtkQuaternionOperatorMultiply(quaternionType, type) \\\nvtkQuaternionOperatorMultiplyScalar(quaternionType, type) \\\nvtkQuaternionOperatorDivide(quaternionType, type) \\\nvtkQuaternionOperatorDivideScalar(quaternionType, type)\n\n// .NAME vtkQuaternionf - Float quaternion type.\n//\n// .SECTION Description\n// This class is uses vtkQuaternion with float type data.\n// For futher description, see the templated class vtkQuaternion.\n// @sa vtkQuaterniond vtkQuaternion\nclass vtkQuaternionf : public vtkQuaternion\n{\npublic:\n vtkQuaternionf() {}\n explicit vtkQuaternionf(float w, float x, float y, float z)\n : vtkQuaternion(w, x, y, z) {}\n explicit vtkQuaternionf(float scalar) : vtkQuaternion(scalar) {}\n explicit vtkQuaternionf(const float *init) : vtkQuaternion(init) {}\n vtkQuaternionOperatorMacro(vtkQuaternionf, float)\n};\n\n// .NAME vtkQuaterniond - Double quaternion type.\n//\n// .SECTION Description\n// This class is uses vtkQuaternion with double type data.\n// For futher description, seethe templated class vtkQuaternion.\n// @sa vtkQuaternionf vtkQuaternion\nclass vtkQuaterniond : public vtkQuaternion\n{\npublic:\n vtkQuaterniond() {}\n explicit vtkQuaterniond(double w, double x, double y, double z)\n : vtkQuaternion(w, x, y, z) {}\n explicit vtkQuaterniond(double scalar) : vtkQuaternion(scalar) {}\n explicit vtkQuaterniond(const double *init) : vtkQuaternion(init) {}\n vtkQuaternionOperatorMacro(vtkQuaterniond, double);\n};\n\n#include \"vtkQuaternion.txx\"\n\n#endif // __vtkQuaternion_h\n// VTK-HeaderTest-Exclude: vtkQuaternion.h\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"7d2aff1292aed1958971f49f91b7e70f\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 387,\n \"max_line_length\": 81,\n \"avg_line_length\": 34.2609819121447,\n \"alnum_prop\": 0.7244136058526284,\n \"repo_name\": \"ricortiz/Bender\",\n \"id\": \"4f7226256310e6cf6bc72ed31d0c34a8ac373255\",\n \"size\": \"13842\",\n \"binary\": false,\n \"copies\": \"4\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"Libs/VTK/Common/vtkQuaternion.h\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"81018\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"775818\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"132283\"\n },\n {\n \"name\": \"TypeScript\",\n \"bytes\": \"63251\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":948,"cells":{"text":{"kind":"string","value":"/**\n * @license Highmaps JS v9.0.1 (2021-02-16)\n * @module highcharts/highmaps\n *\n * (c) 2011-2021 Torstein Honsi\n *\n * License: www.highcharts.com/license\n */\n'use strict';\nimport Highcharts from './highcharts.src.js';\nimport './modules/map.src.js';\n\nHighcharts.product = 'Highmaps';\nexport default Highcharts;\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"b597c4a37e57747d462faf2cf91fe347\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 14,\n \"max_line_length\": 45,\n \"avg_line_length\": 22.285714285714285,\n \"alnum_prop\": 0.6987179487179487,\n \"repo_name\": \"cdnjs/cdnjs\",\n \"id\": \"9180db67512b922a17a26e92cba3099598c2c4a0\",\n \"size\": \"312\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"ajax/libs/highcharts/9.0.1/es-modules/masters/highmaps.src.js\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":949,"cells":{"text":{"kind":"string","value":"A small study project on the [sbt-native-packager](http://www.scala-sbt.org/sbt-native-packager/).\n\n# Documentation\nThe following documentation is available:\n\n- [SBT Native Packager Universal Plugin](http://www.scala-sbt.org/sbt-native-packager/formats/universal.html)\n- [SBT Native Packager Archetype Cheatsheet](http://www.scala-sbt.org/sbt-native-packager/archetypes/cheatsheet.html)\n- [SBT Native Packager Packaging Formats](http://www.scala-sbt.org/sbt-native-packager/formats/index.html)\n- [Nepomuk Seiler - SBT Native Packager Examples](https://github.com/muuki88/sbt-native-packager-examples)\n\n\n## Examples\nThe following examples are sorted from very simple to complex. Simple projects only use defaults that come out\nof the box and the more complex override these default settings because we don't like the 'acceptable default' and \noverride it with our own setting.\n\n- [simple-javaapp-packaging](https://github.com/dnvriend/sbt-native-packager-demo/tree/master/simple-javaapp-packaging)\n - An introduction to packaging a simple Java/Scala application with a minimum of configuration.\n- [simple-javaapp-with-config](https://github.com/dnvriend/sbt-native-packager-demo/tree/master/simple-javaapp-with-config)\n - A simple Java application that uses the Typesafe Config library to lookup configuration. It introduces how to configure the universal plugin.\n\n## Basic Configuration\n- In `project/build.properties` add:\n\n```bash\nsbt.version=0.13.9\n```\n\n- In `project/plugins.sbt` add:\n\n```scala\n// to resolve jars //\nresolvers += \"bintray-sbt-plugin-releases\" at \"http://dl.bintray.com/content/sbt/sbt-plugin-releases\"\n\n// to package applications //\naddSbtPlugin(\"com.typesafe.sbt\" %% \"sbt-native-packager\" % \"1.1.0-M3\")\n\n```\n\n- Configure the project with minimum settings:\n\n```scala\nname := \"helloworld\"\n\nversion := \"1.0.0\"\n\nscalaVersion := \"2.11.7\"\n\nenablePlugins(JavaAppPackaging)\n```\n\n- Package your project eg. `universal:packageBin` to create a `zip`, `universal:packageZipTarball` to create a `tgz` or\n`docker:publishLocal` to create a docker image in your local repository.\n\n# Available Archetypes\n[Archetypes](http://www.scala-sbt.org/sbt-native-packager/gettingstarted.html#archetypes) are __packaging defaults__ that make assumptions how to package our application and make it easy for us to \npackage our application quickly. Of course, when we don't like (some of) the default behaviors we can override \nthose by overriding the appropriate key using the [archetype cheatsheet](http://www.scala-sbt.org/sbt-native-packager/archetypes/cheatsheet.html). \n\nArchetypes are enabled in the `build.sbt` file. For example, to enable the packaging defaults for an application\nthat will be a standalone application, we can use the `JavaAppPackaging` archtype. Just add the line `enablePlugins(JavaAppPackaging)`\nto `build.sbt` and you are set.\n \nThe following [archetypes](http://www.scala-sbt.org/sbt-native-packager/gettingstarted.html#archetypes) are available:\n\n- [Java Application](http://www.scala-sbt.org/sbt-native-packager/archetypes/java_app/): \n - `enablePlugins(JavaAppPackaging)` \n - Creates a standalone package, with a `bin/lib` directory structure and an executable bash/bat script.\n- [Java Server](http://www.scala-sbt.org/sbt-native-packager/archetypes/java_server/): \n - `enablePlugins(JavaServerAppPackaging)` \n - Creates a standalone package with an executable bash/bat script and additional configuration and autostart.\n\n# Available Packaging Formats\nBelieve it or not, the `zip`, `tgz` and `docker` are not the only packaging formats available. The `sbt-native-packager`\nalso supports the following packaging formats:\n \n__Note:__ Some packaging formats may only be created when the environment SBT runs in supports it, eg. when running on\nUbuntu, the plugin can create the `deb` (Debian) package and packaging `docker` is only supported when `docker` is available\nand so on.\n\n- [deb](http://www.scala-sbt.org/sbt-native-packager/formats/debian.html): \n - `debian:packageBin` \n - Packaging format for Debian based systems like Ubuntu using the `Debian plugin`.\n- [rpm](http://www.scala-sbt.org/sbt-native-packager/formats/rpm.html): \n - `rpm:packageBin` \n - Packaging format for Redhat based systems like RHEL or CentOS using the `Rpm plugin`.\n- [msi](http://www.scala-sbt.org/sbt-native-packager/formats/windows.html): \n - `windows:packageBin` \n - Packaging format for windows systems using the `Windows plugin`.\n- [dmg](http://www.scala-sbt.org/sbt-native-packager/formats/universal.html): \n - `universal:packageOsxDmg` \n - Packaging format for osx based systems using the `Universal plugin`.\n- [docker](http://www.scala-sbt.org/sbt-native-packager/formats/docker.html): \n - `docker:publishLocal` \n - Package your application in a docker container using the `Docker plugin`.\n- [zip](http://www.scala-sbt.org/sbt-native-packager/formats/universal.html): \n - `universal:packageBin` \n - Packaging format for all systems supporting zip using the `Universal plugin`.\n- [tar](http://www.scala-sbt.org/sbt-native-packager/formats/universal.html): \n - ``:packageZipTarball` \n - Packaging format for all systems supporting tar using the `Universal plugin`.\n- [xz](http://www.scala-sbt.org/sbt-native-packager/formats/universal.html): \n - `universal:packageXzTarball` \n - Packaging format for all systems supporting xz using the `Universal plugin`.\n- [jdkpackager](http://www.scala-sbt.org/sbt-native-packager/formats/jdkpackager.html): \n - `jdkPackager:packageBinl` \n - Oracle javapackager create packages for your running platform using the `JDK Packager plugin`.\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"bc50de36e6c54a60d32c1baea119edb1\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 108,\n \"max_line_length\": 197,\n \"avg_line_length\": 51.97222222222222,\n \"alnum_prop\": 0.7641190094423659,\n \"repo_name\": \"dnvriend/sbt-native-packager-demo\",\n \"id\": \"daa11caa1993466b3b4c90e8bba5e369069957f0\",\n \"size\": \"5640\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"README.md\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Scala\",\n \"bytes\": \"11739\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":950,"cells":{"text":{"kind":"string","value":"\n\npackage com.signalcollect.serialization\n\nimport org.junit.runner.RunWith\nimport org.specs2.mock.Mockito\nimport org.specs2.mutable.SpecificationWithJUnit\nimport org.specs2.runner.JUnitRunner\nimport com.signalcollect.GraphBuilder\nimport com.signalcollect.configuration.ActorSystemRegistry\nimport akka.serialization.SerializationExtension\nimport com.romix.akka.serialization.kryo.KryoSerializer\n\n@RunWith(classOf[JUnitRunner])\nclass SerializerSpec extends SpecificationWithJUnit with Mockito {\n\n sequential\n\n \"Kryo\" should {\n\n \"correctly serialize Scala immutable maps\" in {\n val g = GraphBuilder.build\n try {\n // Scala uses special representations for small maps.\n kryoSerializeAndDeserialize(Map.empty[Int, Double])\n kryoSerializeAndDeserialize(Map(1 -> 1.5))\n kryoSerializeAndDeserialize(Map(1 -> 1.5, 2 -> 5.4))\n kryoSerializeAndDeserialize(Map(1 -> 1.5, 2 -> 5.4, 3 -> 4.5))\n kryoSerializeAndDeserialize(Map(1 -> 1.5, 2 -> 5.4, 3 -> 4.5, 4 -> 1.2))\n kryoSerializeAndDeserialize(Map(1 -> 1.5, 2 -> 5.4, 3 -> 4.5, 4 -> 1.2, 6 -> 3.2))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize Scala immutable sets\" in {\n val g = GraphBuilder.build\n try {\n // Scala uses special representations for small sets.\n kryoSerializeAndDeserialize(Set.empty[Int])\n kryoSerializeAndDeserialize(Set(1))\n kryoSerializeAndDeserialize(Set(1, 2))\n kryoSerializeAndDeserialize(Set(1, 2, 3))\n kryoSerializeAndDeserialize(Set(1, 2, 3, 4))\n kryoSerializeAndDeserialize(Set(1, 2, 3, 4, 5))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize Scala None\" in {\n val g = GraphBuilder.build\n try {\n kryoSerializeAndDeserialize(None)\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize Scala List\" in {\n val g = GraphBuilder.build\n try {\n kryoSerializeAndDeserialize(List.empty[Int])\n kryoSerializeAndDeserialize(List(1))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize Scala Vector\" in {\n val g = GraphBuilder.build\n try {\n kryoSerializeAndDeserialize(Vector.empty[Int])\n kryoSerializeAndDeserialize(Vector(1))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize Scala Seq\" in {\n val g = GraphBuilder.build\n try {\n kryoSerializeAndDeserialize(Seq.empty[Int])\n kryoSerializeAndDeserialize(Seq(1))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize Scala Array\" in {\n val g = GraphBuilder.build\n try {\n assert(kryoSerializeAndDeserializeSpecial(Array.empty[Int]).toList == List())\n assert(kryoSerializeAndDeserializeSpecial(Array(1)).toList == List(1))\n assert(kryoSerializeAndDeserializeSpecial(Array(1.0)).toList == List(1.0))\n assert(kryoSerializeAndDeserializeSpecial(Array(1l)).toList == List(1l))\n assert(kryoSerializeAndDeserializeSpecial(Array(\"abc\")).toList == List(\"abc\"))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize Array[Array[Int]]\" in {\n val g = GraphBuilder.build\n try {\n assert(kryoSerializeAndDeserializeSpecial(\n Array(Array(1, 2, 3), Array(3, 4, 5))).map(_.toList).toList == List(List(1, 2, 3), List(3, 4, 5)))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize integers\" in {\n val g = GraphBuilder.build\n try {\n kryoSerializeAndDeserialize(Integer.valueOf(1))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize longs\" in {\n val g = GraphBuilder.build\n try {\n kryoSerializeAndDeserialize(Long.box(1l))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize floats\" in {\n val g = GraphBuilder.build\n try {\n kryoSerializeAndDeserialize(Float.box(1.0f))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize doubles\" in {\n val g = GraphBuilder.build\n try {\n kryoSerializeAndDeserialize(Double.box(1.0d))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize booleans\" in {\n val g = GraphBuilder.build\n try {\n kryoSerializeAndDeserialize(Boolean.box(true))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize shorts\" in {\n val g = GraphBuilder.build\n try {\n kryoSerializeAndDeserialize(Short.box(1))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize strings\" in {\n val g = GraphBuilder.build\n try {\n kryoSerializeAndDeserialize(\"abc\")\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize Java strings\" in {\n val g = GraphBuilder.build\n try {\n val javaString: java.lang.String = \"abc\"\n kryoSerializeAndDeserialize(javaString)\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize Tuple2\" in {\n val g = GraphBuilder.build\n try {\n kryoSerializeAndDeserialize((1, \"second\"))\n true\n } finally {\n g.shutdown\n }\n }\n\n \"correctly serialize Tuple3\" in {\n val g = GraphBuilder.build\n try {\n kryoSerializeAndDeserialize((1, \"second\", 3.0))\n true\n } finally {\n g.shutdown\n }\n }\n\n def kryoSerializeAndDeserialize(instance: AnyRef) {\n val akka = ActorSystemRegistry.retrieve(\"SignalCollect\").get\n val serialization = SerializationExtension(akka)\n val s = serialization.findSerializerFor(instance)\n // println(s\"${s.getClass} for ${instance.getClass}\")\n assert(s.isInstanceOf[KryoSerializer])\n val bytes = s.toBinary(instance)\n val b = s.fromBinary(bytes, manifest = None)\n assert(b == instance)\n }\n\n def kryoSerializeAndDeserializeSpecial[T <: AnyRef](instance: T): T = {\n val akka = ActorSystemRegistry.retrieve(\"SignalCollect\").get\n val serialization = SerializationExtension(akka)\n val s = serialization.findSerializerFor(instance)\n assert(s.isInstanceOf[KryoSerializer])\n val bytes = s.toBinary(instance)\n val b = s.fromBinary(bytes, manifest = None).asInstanceOf[T]\n b\n }\n\n }\n\n \"DefaultSerializer\" should {\n\n \"correctly serialize/deserialize a Double\" in {\n DefaultSerializer.read[Double](DefaultSerializer.write(1024.0)) === 1024.0\n }\n\n \"correctly serialize/deserialize a job configuration\" in {\n val job = new Job(\n 100,\n Some(SpreadsheetConfiguration(\"some.emailAddress@gmail.com\", \"somePasswordHere\", \"someSpreadsheetNameHere\", \"someWorksheetNameHere\")),\n \"someUsername\",\n \"someJobDescription\")\n DefaultSerializer.read[Job](DefaultSerializer.write(job)) === job\n }\n\n }\n\n}\n\ncase class SpreadsheetConfiguration(\n gmailAccount: String,\n gmailPassword: String,\n spreadsheetName: String,\n worksheetName: String)\n\ncase class Job(\n var jobId: Int,\n var spreadsheetConfiguration: Option[SpreadsheetConfiguration],\n var submittedByUser: String,\n var jobDescription: String)"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"2ccce85df82b63b05d517b600f0e95ab\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 274,\n \"max_line_length\": 142,\n \"avg_line_length\": 26.76277372262774,\n \"alnum_prop\": 0.6218464475657984,\n \"repo_name\": \"danihegglin/DynDCO\",\n \"id\": \"d540bf821768e5a33d384027bcb808765aea0150\",\n \"size\": \"7980\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/test/scala/com/signalcollect/serialization/SerializerSpec.scala\",\n \"mode\": \"33261\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"24989\"\n },\n {\n \"name\": \"CoffeeScript\",\n \"bytes\": \"25307\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"23644\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"184348\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"16001\"\n },\n {\n \"name\": \"R\",\n \"bytes\": \"14767\"\n },\n {\n \"name\": \"Scala\",\n \"bytes\": \"901963\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"1419\"\n },\n {\n \"name\": \"TeX\",\n \"bytes\": \"146135\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":951,"cells":{"text":{"kind":"string","value":"\n\n#include \n__FBSDID(\"$FreeBSD: releng/9.3/sys/mips/idt/obio.c 212413 2010-09-10 11:19:03Z avg $\");\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n\n#include \n#include \n\n#define ICU_REG_READ(o) \\\n *((volatile uint32_t *)MIPS_PHYS_TO_KSEG1(IDT_BASE_ICU + (o)))\n#define ICU_REG_WRITE(o,v) (ICU_REG_READ(o)) = (v)\n\n#define GPIO_REG_READ(o) \\\n *((volatile uint32_t *)MIPS_PHYS_TO_KSEG1(IDT_BASE_GPIO + (o)))\n#define GPIO_REG_WRITE(o,v) (GPIO_REG_READ(o)) = (v)\n\nstatic int\tobio_activate_resource(device_t, device_t, int, int,\n\t\t struct resource *);\nstatic device_t\tobio_add_child(device_t, u_int, const char *, int);\nstatic struct resource *\n\t\tobio_alloc_resource(device_t, device_t, int, int *, u_long,\n\t\t u_long, u_long, u_int);\nstatic int\tobio_attach(device_t);\nstatic int\tobio_deactivate_resource(device_t, device_t, int, int,\n\t\t struct resource *);\nstatic struct resource_list *\n\t\tobio_get_resource_list(device_t, device_t);\nstatic void\tobio_hinted_child(device_t, const char *, int);\nstatic int\tobio_intr(void *);\nstatic int\tobio_probe(device_t);\nstatic int\tobio_release_resource(device_t, device_t, int, int,\n\t\t struct resource *);\nstatic int\tobio_setup_intr(device_t, device_t, struct resource *, int,\n\t\t driver_filter_t *, driver_intr_t *, void *, void **);\nstatic int\tobio_teardown_intr(device_t, device_t, struct resource *,\n\t\t void *);\n\nstatic void \nobio_mask_irq(void *arg)\n{\n\tunsigned int irq = (unsigned int)arg;\n\tint ip_bit, mask, mask_register;\n\n\t/* mask IRQ */\n\tmask_register = ICU_IRQ_MASK_REG(irq);\n\tip_bit = ICU_IP_BIT(irq);\n\n\tmask = ICU_REG_READ(mask_register);\n\tICU_REG_WRITE(mask_register, mask | ip_bit);\n}\n\nstatic void \nobio_unmask_irq(void *arg)\n{\n\tunsigned int irq = (unsigned int)arg;\n\tint ip_bit, mask, mask_register;\n\n\t/* unmask IRQ */\n\tmask_register = ICU_IRQ_MASK_REG(irq);\n\tip_bit = ICU_IP_BIT(irq);\n\n\tmask = ICU_REG_READ(mask_register);\n\tICU_REG_WRITE(mask_register, mask & ~ip_bit);\n}\n\nstatic int\nobio_probe(device_t dev)\n{\n\n\treturn (0);\n}\n\nstatic int\nobio_attach(device_t dev)\n{\n\tstruct obio_softc *sc = device_get_softc(dev);\n\tint rid, irq;\n\n\tsc->oba_mem_rman.rm_type = RMAN_ARRAY;\n\tsc->oba_mem_rman.rm_descr = \"OBIO memeory\";\n\tif (rman_init(&sc->oba_mem_rman) != 0 ||\n\t rman_manage_region(&sc->oba_mem_rman, OBIO_MEM_START,\n\t OBIO_MEM_START + OBIO_MEM_SIZE) != 0)\n\t\tpanic(\"obio_attach: failed to set up I/O rman\");\n\n\tsc->oba_irq_rman.rm_type = RMAN_ARRAY;\n\tsc->oba_irq_rman.rm_descr = \"OBIO IRQ\";\n\n\tif (rman_init(&sc->oba_irq_rman) != 0 ||\n\t rman_manage_region(&sc->oba_irq_rman, IRQ_BASE, IRQ_END) != 0)\n\t\tpanic(\"obio_attach: failed to set up IRQ rman\");\n\n\t/* Hook up our interrupt handlers. We should handle IRQ0..IRQ4*/\n\tfor(irq = 0; irq < 5; irq++) {\n\t\tif ((sc->sc_irq[irq] = bus_alloc_resource(dev, SYS_RES_IRQ, \n\t\t &rid, irq, irq, 1, RF_SHAREABLE | RF_ACTIVE)) == NULL) {\n\t\t\tdevice_printf(dev, \"unable to allocate IRQ resource\\n\");\n\t\t\treturn (ENXIO);\n\t\t}\n\n\t\tif ((bus_setup_intr(dev, sc->sc_irq[irq], INTR_TYPE_MISC, \n\t\t obio_intr, NULL, sc, &sc->sc_ih[irq]))) {\n\t\t\tdevice_printf(dev,\n\t\t\t \"WARNING: unable to register interrupt handler\\n\");\n\t\t\treturn (ENXIO);\n\t\t}\n\t}\n\n\tbus_generic_probe(dev);\n\tbus_enumerate_hinted_children(dev);\n\tbus_generic_attach(dev);\n\n\treturn (0);\n}\n\nstatic struct resource *\nobio_alloc_resource(device_t bus, device_t child, int type, int *rid,\n u_long start, u_long end, u_long count, u_int flags)\n{\n\tstruct obio_softc\t\t*sc = device_get_softc(bus);\n\tstruct obio_ivar\t\t*ivar = device_get_ivars(child);\n\tstruct resource\t\t\t*rv;\n\tstruct resource_list_entry\t*rle;\n\tstruct rman\t\t\t*rm;\n\tint\t\t\t\t isdefault, needactivate, passthrough;\n\n\tisdefault = (start == 0UL && end == ~0UL);\n\tneedactivate = flags & RF_ACTIVE;\n\tpassthrough = (device_get_parent(child) != bus);\n\trle = NULL;\n\n\tif (passthrough)\n\t\treturn (BUS_ALLOC_RESOURCE(device_get_parent(bus), child, type,\n\t\t rid, start, end, count, flags));\n\n\t/*\n\t * If this is an allocation of the \"default\" range for a given RID,\n\t * and we know what the resources for this device are (ie. they aren't\n\t * maintained by a child bus), then work out the start/end values.\n\t */\n\tif (isdefault) {\n\t\trle = resource_list_find(&ivar->resources, type, *rid);\n\t\tif (rle == NULL)\n\t\t\treturn (NULL);\n\t\tif (rle->res != NULL) {\n\t\t\tpanic(\"%s: resource entry is busy\", __func__);\n\t\t}\n\t\tstart = rle->start;\n\t\tend = rle->end;\n\t\tcount = rle->count;\n\t}\n\n\tswitch (type) {\n\tcase SYS_RES_IRQ:\n\t\trm = &sc->oba_irq_rman;\n\t\tbreak;\n\tcase SYS_RES_MEMORY:\n\t\trm = &sc->oba_mem_rman;\n\t\tbreak;\n\tdefault:\n\t\tprintf(\"%s: unknown resource type %d\\n\", __func__, type);\n\t\treturn (0);\n\t}\n\n\trv = rman_reserve_resource(rm, start, end, count, flags, child);\n\tif (rv == 0) {\n\t\tprintf(\"%s: could not reserve resource\\n\", __func__);\n\t\treturn (0);\n\t}\n\n\trman_set_rid(rv, *rid);\n\n\tif (needactivate) {\n\t\tif (bus_activate_resource(child, type, *rid, rv)) {\n\t\t\tprintf(\"%s: could not activate resource\\n\", __func__);\n\t\t\trman_release_resource(rv);\n\t\t\treturn (0);\n\t\t}\n\t}\n\n\treturn (rv);\n}\n\nstatic int\nobio_activate_resource(device_t bus, device_t child, int type, int rid,\n struct resource *r)\n{\n\n\t/* XXX: should we mask/unmask IRQ here? */\n\treturn (BUS_ACTIVATE_RESOURCE(device_get_parent(bus), child,\n\t\ttype, rid, r));\n}\n\nstatic int\nobio_deactivate_resource(device_t bus, device_t child, int type, int rid,\n struct resource *r)\n{\n\n\t/* XXX: should we mask/unmask IRQ here? */\n\treturn (BUS_DEACTIVATE_RESOURCE(device_get_parent(bus), child,\n\t\ttype, rid, r));\n}\n\nstatic int\nobio_release_resource(device_t dev, device_t child, int type,\n int rid, struct resource *r)\n{\n\tstruct resource_list *rl;\n\tstruct resource_list_entry *rle;\n\n\trl = obio_get_resource_list(dev, child);\n\tif (rl == NULL)\n\t\treturn (EINVAL);\n\trle = resource_list_find(rl, type, rid);\n\tif (rle == NULL)\n\t\treturn (EINVAL);\n\trman_release_resource(r);\n\trle->res = NULL;\n\n\treturn (0);\n}\n\nstatic int\nobio_setup_intr(device_t dev, device_t child, struct resource *ires,\n\t\tint flags, driver_filter_t *filt, driver_intr_t *handler,\n\t\tvoid *arg, void **cookiep)\n{\n\tstruct obio_softc *sc = device_get_softc(dev);\n\tstruct intr_event *event;\n\tint irq, ip_bit, error, mask, mask_register;\n\n\tirq = rman_get_start(ires);\n\n\tif (irq >= NIRQS)\n\t\tpanic(\"%s: bad irq %d\", __func__, irq);\n\n\tevent = sc->sc_eventstab[irq];\n\tif (event == NULL) {\n\t\terror = intr_event_create(&event, (void *)irq, 0, irq, \n\t\t obio_mask_irq, obio_unmask_irq,\n\t\t NULL, NULL,\n\t\t \"obio intr%d:\", irq);\n\n\t\tsc->sc_eventstab[irq] = event;\n\t}\n\n\tintr_event_add_handler(event, device_get_nameunit(child), filt,\n\t handler, arg, intr_priority(flags), flags, cookiep);\n\n\t/* unmask IRQ */\n\tmask_register = ICU_IRQ_MASK_REG(irq);\n\tip_bit = ICU_IP_BIT(irq);\n\n\tmask = ICU_REG_READ(mask_register);\n\tICU_REG_WRITE(mask_register, mask & ~ip_bit);\n\n\treturn (0);\n}\n\nstatic int\nobio_teardown_intr(device_t dev, device_t child, struct resource *ires,\n void *cookie)\n{\n\tstruct obio_softc *sc = device_get_softc(dev);\n\tint irq, result;\n\tuint32_t mask_register, mask, ip_bit;\n\n\tirq = rman_get_start(ires);\n\tif (irq >= NIRQS)\n\t\tpanic(\"%s: bad irq %d\", __func__, irq);\n\n\tif (sc->sc_eventstab[irq] == NULL)\n\t\tpanic(\"Trying to teardown unoccupied IRQ\");\n\n\t/* mask IRQ */\n\tmask_register = ICU_IRQ_MASK_REG(irq);\n\tip_bit = ICU_IP_BIT(irq);\n\n\tmask = ICU_REG_READ(mask_register);\n\tICU_REG_WRITE(mask_register, mask | ip_bit);\n\n\tresult = intr_event_remove_handler(cookie);\n\tif (!result)\n\t\tsc->sc_eventstab[irq] = NULL;\n\n\treturn (result);\n}\n\nstatic int\nobio_intr(void *arg)\n{\n\tstruct obio_softc *sc = arg;\n\tstruct intr_event *event;\n\tuint32_t irqstat, ipend, imask, xpend;\n\tint irq, thread, group, i;\n\n\tirqstat = 0;\n\tirq = 0;\n\tfor (group = 2; group <= 6; group++) {\n\t\tipend = ICU_REG_READ(ICU_GROUP_IPEND_REG(group));\n\t\timask = ICU_REG_READ(ICU_GROUP_MASK_REG(group));\n\t\txpend = ipend;\n\t\tipend &= ~imask;\n\n\t\twhile ((i = fls(xpend)) != 0) {\n\t\t\txpend &= ~(1 << (i - 1));\n\t\t\tirq = IP_IRQ(group, i - 1);\n\t\t}\n\t\n\t\twhile ((i = fls(ipend)) != 0) {\n\t\t\tipend &= ~(1 << (i - 1));\n\t\t\tirq = IP_IRQ(group, i - 1);\n\t\t\tevent = sc->sc_eventstab[irq];\n\t\t\tthread = 0;\n\t\t\tif (!event || TAILQ_EMPTY(&event->ie_handlers)) {\n\t\t\t\t/* TODO: Log stray IRQs */\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t/* TODO: frame instead of NULL? */\n\t\t\tintr_event_handle(event, NULL);\n\t\t\t/* XXX: Log stray IRQs */\n\t\t}\n\t}\n#if 0\n\tipend = ICU_REG_READ(ICU_IPEND2);\n\tprintf(\"ipend2 = %08x!\\n\", ipend);\n\n\tipend = ICU_REG_READ(ICU_IPEND3);\n\tprintf(\"ipend3 = %08x!\\n\", ipend);\n\n\tipend = ICU_REG_READ(ICU_IPEND4);\n\tprintf(\"ipend4 = %08x!\\n\", ipend);\n\tipend = ICU_REG_READ(ICU_IPEND5);\n\tprintf(\"ipend5 = %08x!\\n\", ipend);\n\n\tipend = ICU_REG_READ(ICU_IPEND6);\n\tprintf(\"ipend6 = %08x!\\n\", ipend);\n#endif\n\twhile (irqstat != 0) {\n\t\tif ((irqstat & 1) == 1) {\n\t\t}\n\n\t\tirq++;\n\t\tirqstat >>= 1;\n\t}\n\n\treturn (FILTER_HANDLED);\n}\n\nstatic void\nobio_hinted_child(device_t bus, const char *dname, int dunit)\n{\n\tdevice_t\t\tchild;\n\tlong\t\t\tmaddr;\n\tint\t\t\tmsize;\n\tint\t\t\tirq;\n\tint\t\t\tresult;\n\n\tchild = BUS_ADD_CHILD(bus, 0, dname, dunit);\n\n\t/*\n\t * Set hard-wired resources for hinted child using\n\t * specific RIDs.\n\t */\n\tresource_long_value(dname, dunit, \"maddr\", &maddr);\n\tresource_int_value(dname, dunit, \"msize\", &msize);\n\n\n\tresult = bus_set_resource(child, SYS_RES_MEMORY, 0,\n\t maddr, msize);\n\tif (result != 0)\n\t\tdevice_printf(bus, \"warning: bus_set_resource() failed\\n\");\n\n\tif (resource_int_value(dname, dunit, \"irq\", &irq) == 0) {\n\t\tresult = bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);\n\t\tif (result != 0)\n\t\t\tdevice_printf(bus,\n\t\t\t \"warning: bus_set_resource() failed\\n\");\n\t}\n}\n\nstatic device_t\nobio_add_child(device_t bus, u_int order, const char *name, int unit)\n{\n\tdevice_t\t\tchild;\n\tstruct obio_ivar\t*ivar;\n\n\tivar = malloc(sizeof(struct obio_ivar), M_DEVBUF, M_WAITOK | M_ZERO);\n\tif (ivar == NULL) {\n\t\tprintf(\"Failed to allocate ivar\\n\");\n\t\treturn (0);\n\t}\n\tresource_list_init(&ivar->resources);\n\n\tchild = device_add_child_ordered(bus, order, name, unit);\n\tif (child == NULL) {\n\t\tprintf(\"Can't add child %s%d ordered\\n\", name, unit);\n\t\treturn (0);\n\t}\n\n\tdevice_set_ivars(child, ivar);\n\n\treturn (child);\n}\n\n/*\n * Helper routine for bus_generic_rl_get_resource/bus_generic_rl_set_resource\n * Provides pointer to resource_list for these routines\n */\nstatic struct resource_list *\nobio_get_resource_list(device_t dev, device_t child)\n{\n\tstruct obio_ivar *ivar;\n\n\tivar = device_get_ivars(child);\n\treturn (&(ivar->resources));\n}\n\nstatic device_method_t obio_methods[] = {\n\tDEVMETHOD(bus_activate_resource,\tobio_activate_resource),\n\tDEVMETHOD(bus_add_child,\t\tobio_add_child),\n\tDEVMETHOD(bus_alloc_resource,\t\tobio_alloc_resource),\n\tDEVMETHOD(bus_deactivate_resource,\tobio_deactivate_resource),\n\tDEVMETHOD(bus_get_resource_list,\tobio_get_resource_list),\n\tDEVMETHOD(bus_hinted_child,\t\tobio_hinted_child),\n\tDEVMETHOD(bus_release_resource,\t\tobio_release_resource),\n\tDEVMETHOD(bus_setup_intr,\t\tobio_setup_intr),\n\tDEVMETHOD(bus_teardown_intr,\t\tobio_teardown_intr),\n\tDEVMETHOD(device_attach,\t\tobio_attach),\n\tDEVMETHOD(device_probe,\t\t\tobio_probe),\n DEVMETHOD(bus_get_resource,\t\tbus_generic_rl_get_resource),\n DEVMETHOD(bus_set_resource,\t\tbus_generic_rl_set_resource),\n\n\t{0, 0},\n};\n\nstatic driver_t obio_driver = {\n\t\"obio\",\n\tobio_methods,\n\tsizeof(struct obio_softc),\n};\nstatic devclass_t obio_devclass;\n\nDRIVER_MODULE(obio, nexus, obio_driver, obio_devclass, 0, 0);\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"063844d89d1b1983f4dea176755879d0\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 456,\n \"max_line_length\": 87,\n \"avg_line_length\": 25.24122807017544,\n \"alnum_prop\": 0.6516941789748045,\n \"repo_name\": \"dcui/FreeBSD-9.3_kernel\",\n \"id\": \"10911ec2d0dfbd97e1f3ec92d2814aca2d57d7af\",\n \"size\": \"13242\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"sys/mips/idt/obio.c\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"Assembly\",\n \"bytes\": \"1740660\"\n },\n {\n \"name\": \"Awk\",\n \"bytes\": \"135150\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"158\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"189969174\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"2113755\"\n },\n {\n \"name\": \"DTrace\",\n \"bytes\": \"19810\"\n },\n {\n \"name\": \"Forth\",\n \"bytes\": \"188128\"\n },\n {\n \"name\": \"Groff\",\n \"bytes\": \"147703\"\n },\n {\n \"name\": \"Lex\",\n \"bytes\": \"65561\"\n },\n {\n \"name\": \"Logos\",\n \"bytes\": \"6310\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"594606\"\n },\n {\n \"name\": \"Mathematica\",\n \"bytes\": \"9538\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"527964\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"2404\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"3348\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"7091\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"43402\"\n },\n {\n \"name\": \"SourcePawn\",\n \"bytes\": \"253\"\n },\n {\n \"name\": \"Yacc\",\n \"bytes\": \"160534\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":952,"cells":{"text":{"kind":"string","value":"\n\n'use strict';\n\nvar UPPER_A_CP = 'A'.codePointAt(0);\nvar UPPER_Z_CP = 'Z'.codePointAt(0);\nvar LOWER_A_CP = 'a'.codePointAt(0);\nvar LOWER_Z_CP = 'z'.codePointAt(0);\nvar DIGIT_0_CP = '0'.codePointAt(0);\nvar DIGIT_9_CP = '9'.codePointAt(0);\n\n/**\n * A regexp-tree plugin to transform coded chars into simple chars.\n *\n * \\u0061 -> a\n */\nmodule.exports = {\n Char: function Char(path) {\n var node = path.node,\n parent = path.parent;\n\n if (isNaN(node.codePoint) || node.kind === 'simple') {\n return;\n }\n\n if (parent.type === 'ClassRange') {\n if (!isSimpleRange(parent)) {\n return;\n }\n }\n\n if (!isPrintableASCIIChar(node.codePoint)) {\n return;\n }\n\n var symbol = String.fromCodePoint(node.codePoint);\n var newChar = {\n type: 'Char',\n kind: 'simple',\n value: symbol,\n symbol: symbol,\n codePoint: node.codePoint\n };\n if (needsEscape(symbol, parent.type)) {\n newChar.escaped = true;\n }\n path.replace(newChar);\n }\n};\n\n/**\n * Checks if a range is included either in 0-9, a-z or A-Z\n * @param classRange\n * @returns {boolean}\n */\nfunction isSimpleRange(classRange) {\n var from = classRange.from,\n to = classRange.to;\n\n return from.codePoint >= DIGIT_0_CP && from.codePoint <= DIGIT_9_CP && to.codePoint >= DIGIT_0_CP && to.codePoint <= DIGIT_9_CP || from.codePoint >= UPPER_A_CP && from.codePoint <= UPPER_Z_CP && to.codePoint >= UPPER_A_CP && to.codePoint <= UPPER_Z_CP || from.codePoint >= LOWER_A_CP && from.codePoint <= LOWER_Z_CP && to.codePoint >= LOWER_A_CP && to.codePoint <= LOWER_Z_CP;\n}\n\n/**\n * Checks if a code point in the range of printable ASCII chars\n * (DEL char excluded)\n * @param codePoint\n * @returns {boolean}\n */\nfunction isPrintableASCIIChar(codePoint) {\n return codePoint >= 0x20 && codePoint <= 0x7e;\n}\n\nfunction needsEscape(symbol, parentType) {\n if (parentType === 'ClassRange' || parentType === 'CharacterClass') {\n return (/[\\]\\\\^-]/.test(symbol)\n );\n }\n\n return (/[*[()+?^$./\\\\|{}]/.test(symbol)\n );\n}"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"a03edf64ebb27b14457ebce8295460b2\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 81,\n \"max_line_length\": 378,\n \"avg_line_length\": 25.19753086419753,\n \"alnum_prop\": 0.6075453209211171,\n \"repo_name\": \"brett-harvey/Smart-Contracts\",\n \"id\": \"e3a1f4883edb73e25bf7fc609ceaa6b19496ef9a\",\n \"size\": \"2149\",\n \"binary\": false,\n \"copies\": \"6\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"Ethereum-based-Roll4Win/node_modules/regexp-tree/dist/optimizer/transforms/char-code-to-simple-char-transform.js\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"430\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":953,"cells":{"text":{"kind":"string","value":"layout: page\ntitle: Seattle Police Officer 7674 Milton J. Rodrigue\npermalink: /information/agencies/city_of_seattle/seattle_police_department/copbook/7674/\n---\n\n**Age as of Feb. 24, 2016:** 37\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"9c4decc6ad2b768b7d7bc0b8b96f0459\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 6,\n \"max_line_length\": 88,\n \"avg_line_length\": 32.166666666666664,\n \"alnum_prop\": 0.7616580310880829,\n \"repo_name\": \"seattlepublicrecords/seattlepublicrecords.github.io\",\n \"id\": \"93bfac2804e52af5f58387028307327751178680\",\n \"size\": \"197\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"information/agencies/city_of_seattle/seattle_police_department/copbook/7674/index.md\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"14496\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"14591\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"5297\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"964\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":954,"cells":{"text":{"kind":"string","value":"require 'test/unit' \nrequire 'churn' \n\n\nclass ChurnTests < Test::Unit::TestCase \n\n def test_month_before_is_28_days\n assert_equal(Time.local(2005, 1, 1),\n month_before(Time.local(2005, 1, 29)))\n end\n\n def test_svn_date\n assert_equal('2005-03-04',\n svn_date(Time.local(2005, 3, 4)))\n end\n\n\n def test_header_format\n assert_equal(\"Changes since 2005-08-05:\",\n header(svn_date(month_before(Time.local(2005, 9, 2)))))\n end\n\n def test_normal_subsystem_line_format\n assert_equal(' audit ********* (45)',\n subsystem_line(\"audit\", 45))\n end\n\n def test_asterisks_for_divides_by_five\n assert_equal('****', asterisks_for(20))\n end\n\n def test_asterisks_for_rounds_up_and_down\n assert_equal('****', asterisks_for(18))\n assert_equal('***', asterisks_for(17))\n end\n\n def test_subversion_log_can_have_no_changes\n assert_equal(0, extract_change_count_from(\"------------------------------------------------------------------------\\n\"))\n end\n \n def test_subversion_log_with_changes\n assert_equal(2, extract_change_count_from(\"------------------------------------------------------------------------\\nr2531 | bem | 2005-07-01 01:11:44 -0500 (Fri, 01 Jul 2005) | 1 line\\n\\nrevisions up through ch 3 exercises\\n------------------------------------------------------------------------\\nr2524 | bem | 2005-06-30 18:45:59 -0500 (Thu, 30 Jun 2005) | 1 line\\n\\nresults of read-through; including renaming mistyping to snapshots\\n------------------------------------------------------------------------\\n\"))\n end\n\n def test_churn_line_to_int_extracts_parenthesized_change_count\n assert_equal(19, churn_line_to_int(\" ui2 **** (19)\"))\n assert_equal(9, churn_line_to_int(\" ui ** (9)\"))\n end\n\n\n def test_order_by_descending_change_count\n original = [ \"all that really matters is the number in parens - (1)\",\n \" inventory (0)\",\n \" ui ** (12)\" ]\n\n expected = [ \" ui ** (12)\",\n \"all that really matters is the number in parens - (1)\",\n \" inventory (0)\" ]\n\n actual = order_by_descending_change_count(original)\n\n assert_equal(expected, actual)\n end\n\nend\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"5b819aa736c1e1c1bfed2130e115f476\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 65,\n \"max_line_length\": 519,\n \"avg_line_length\": 34.87692307692308,\n \"alnum_prop\": 0.521835024261138,\n \"repo_name\": \"Mitali-Sodhi/CodeLingo\",\n \"id\": \"1efd6e231ec7653101bb9c1703b2eed411b38e5d\",\n \"size\": \"2470\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"Dataset/ruby/churn-tests-re.rb\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"9681846\"\n },\n {\n \"name\": \"C#\",\n \"bytes\": \"1741915\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"5686017\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"11812193\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"11198971\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"21693468\"\n },\n {\n \"name\": \"M\",\n \"bytes\": \"61627\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"4085820\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"193472\"\n },\n {\n \"name\": \"Perl6\",\n \"bytes\": \"176248\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"10296284\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"1050136\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":955,"cells":{"text":{"kind":"string","value":"

Metatranscriptomic diversity in Salix roots + rhizophere

\nThis interactive graphic vizualizes the organism diversity by annotation, as it can be found in the roots + rhizosphere of Salix Fish Creek in hydrocarbons contaminated soil.\n\nNote: DE refers to Differential Expression (including only differentially expressed transcripts). \"Full\" means all transcripts are considered. Full may run slowly on lower spec computers.\n\n

GO TO FIGURE

\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"d9750382f2df99a2056f75834e7c5cbb\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 7,\n \"max_line_length\": 187,\n \"avg_line_length\": 82.71428571428571,\n \"alnum_prop\": 0.7944732297063903,\n \"repo_name\": \"gonzalezem/Dylan-PolyA\",\n \"id\": \"8b6e426b2a5855eeeacc063fd7e3709e8c9f2691\",\n \"size\": \"579\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"README.md\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"8226\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"5107\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"78455\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":956,"cells":{"text":{"kind":"string","value":"using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Management.Automation;\nusing Microsoft.Management.Infrastructure;\nusing Microsoft.PowerShell.Cim;\nusing Dbg = System.Management.Automation.Diagnostics;\n\nnamespace Microsoft.PowerShell.Cmdletization.Cim\n{\n /// \n /// Client-side filtering for\n /// 1) filtering that cannot be translated into a server-side query (i.e. when CimQuery.WildcardToWqlLikeOperand reports that it cannot translate into WQL)\n /// 2) detecting if all expected results have been received and giving friendly user errors otherwise (i.e. could not find process with name='foo'; details in Windows 8 Bugs: #60926)\n /// \n internal class ClientSideQuery : QueryBuilder\n {\n internal class NotFoundError\n {\n public NotFoundError()\n {\n this.ErrorMessageGenerator = GetErrorMessageForNotFound;\n }\n\n public NotFoundError(string propertyName, object propertyValue, bool wildcardsEnabled)\n {\n this.PropertyName = propertyName;\n this.PropertyValue = propertyValue;\n\n if (wildcardsEnabled)\n {\n var propertyValueAsString = propertyValue as string;\n if ((propertyValueAsString != null) && (WildcardPattern.ContainsWildcardCharacters(propertyValueAsString)))\n {\n this.ErrorMessageGenerator =\n (queryDescription, className) => GetErrorMessageForNotFound_ForWildcard(this.PropertyName, this.PropertyValue, className);\n }\n else\n {\n this.ErrorMessageGenerator =\n (queryDescription, className) => GetErrorMessageForNotFound_ForEquality(this.PropertyName, this.PropertyValue, className);\n }\n }\n else\n {\n this.ErrorMessageGenerator =\n (queryDescription, className) => GetErrorMessageForNotFound_ForEquality(this.PropertyName, this.PropertyValue, className);\n }\n }\n\n public string PropertyName { get; private set; }\n\n public object PropertyValue { get; private set; }\n\n public Func ErrorMessageGenerator { get; private set; }\n\n private static string GetErrorMessageForNotFound(string queryDescription, string className)\n {\n string message = string.Format(\n CultureInfo.InvariantCulture, // queryDescription should already be in the right format - can use invariant culture here\n CmdletizationResources.CimJob_NotFound_ComplexCase,\n queryDescription,\n className);\n return message;\n }\n\n private static string GetErrorMessageForNotFound_ForEquality(string propertyName, object propertyValue, string className)\n {\n string message = string.Format(\n CultureInfo.InvariantCulture, // queryDescription should already be in the right format - can use invariant culture here\n CmdletizationResources.CimJob_NotFound_SimpleGranularCase_Equality,\n propertyName,\n propertyValue,\n className);\n return message;\n }\n\n private static string GetErrorMessageForNotFound_ForWildcard(string propertyName, object propertyValue, string className)\n {\n string message = string.Format(\n CultureInfo.InvariantCulture, // queryDescription should already be in the right format - can use invariant culture here\n CmdletizationResources.CimJob_NotFound_SimpleGranularCase_Wildcard,\n propertyName,\n propertyValue,\n className);\n return message;\n }\n }\n\n private abstract class CimInstanceFilterBase\n {\n protected abstract bool IsMatchCore(CimInstance cimInstance);\n\n protected BehaviorOnNoMatch BehaviorOnNoMatch { get; set; }\n\n private bool HadMatches { get; set; }\n\n public bool IsMatch(CimInstance cimInstance)\n {\n bool isMatch = this.IsMatchCore(cimInstance);\n this.HadMatches = this.HadMatches || isMatch;\n return isMatch;\n }\n\n public virtual bool ShouldReportErrorOnNoMatches_IfMultipleFilters()\n {\n switch (this.BehaviorOnNoMatch)\n {\n case BehaviorOnNoMatch.ReportErrors:\n return true;\n\n case BehaviorOnNoMatch.SilentlyContinue:\n return false;\n\n case BehaviorOnNoMatch.Default:\n default:\n Dbg.Assert(false, \"BehaviorOnNoMatch.Default should be handled by derived classes\");\n return false;\n }\n }\n\n public virtual IEnumerable GetNotFoundErrors_IfThisIsTheOnlyFilter()\n {\n switch (this.BehaviorOnNoMatch)\n {\n case BehaviorOnNoMatch.ReportErrors:\n if (this.HadMatches)\n {\n return Enumerable.Empty();\n }\n else\n {\n return new[] { new NotFoundError() };\n }\n\n case BehaviorOnNoMatch.SilentlyContinue:\n return Enumerable.Empty();\n\n case BehaviorOnNoMatch.Default:\n default:\n Dbg.Assert(false, \"BehaviorOnNoMatch.Default should be handled by derived classes\");\n return Enumerable.Empty();\n }\n }\n }\n\n private abstract class CimInstancePropertyBasedFilter : CimInstanceFilterBase\n {\n private readonly List _propertyValueFilters = new List();\n protected IEnumerable PropertyValueFilters { get { return _propertyValueFilters; } }\n\n protected void AddPropertyValueFilter(PropertyValueFilter propertyValueFilter)\n {\n _propertyValueFilters.Add(propertyValueFilter);\n }\n\n protected override bool IsMatchCore(CimInstance cimInstance)\n {\n bool isMatch = false;\n foreach (PropertyValueFilter propertyValueFilter in this.PropertyValueFilters)\n {\n if (propertyValueFilter.IsMatch(cimInstance))\n {\n isMatch = true;\n if (this.BehaviorOnNoMatch == BehaviorOnNoMatch.SilentlyContinue)\n {\n break;\n }\n }\n }\n\n return isMatch;\n }\n }\n\n private class CimInstanceRegularFilter : CimInstancePropertyBasedFilter\n {\n public CimInstanceRegularFilter(string propertyName, IEnumerable allowedPropertyValues, bool wildcardsEnabled, BehaviorOnNoMatch behaviorOnNoMatch)\n {\n var valueBehaviors = new HashSet();\n\n foreach (object allowedPropertyValue in allowedPropertyValues)\n {\n PropertyValueFilter filter =\n new PropertyValueRegularFilter(\n propertyName,\n allowedPropertyValue,\n wildcardsEnabled,\n behaviorOnNoMatch);\n this.AddPropertyValueFilter(filter);\n\n valueBehaviors.Add(filter.BehaviorOnNoMatch);\n }\n\n if (valueBehaviors.Count == 1)\n {\n this.BehaviorOnNoMatch = valueBehaviors.Single();\n }\n else\n {\n this.BehaviorOnNoMatch = behaviorOnNoMatch;\n }\n }\n\n public override bool ShouldReportErrorOnNoMatches_IfMultipleFilters()\n {\n switch (this.BehaviorOnNoMatch)\n {\n case BehaviorOnNoMatch.ReportErrors:\n return true;\n\n case BehaviorOnNoMatch.SilentlyContinue:\n return false;\n\n case BehaviorOnNoMatch.Default:\n default:\n return this.PropertyValueFilters\n .Where(f => !f.HadMatch).Any(f => f.BehaviorOnNoMatch == BehaviorOnNoMatch.ReportErrors);\n }\n }\n\n public override IEnumerable GetNotFoundErrors_IfThisIsTheOnlyFilter()\n {\n foreach (PropertyValueFilter propertyValueFilter in this.PropertyValueFilters)\n {\n if (propertyValueFilter.BehaviorOnNoMatch != BehaviorOnNoMatch.ReportErrors)\n {\n continue;\n }\n\n if (propertyValueFilter.HadMatch)\n {\n continue;\n }\n\n var propertyValueRegularFilter = (PropertyValueRegularFilter)propertyValueFilter;\n yield return propertyValueRegularFilter.GetGranularNotFoundError();\n }\n }\n }\n\n private class CimInstanceExcludeFilter : CimInstancePropertyBasedFilter\n {\n public CimInstanceExcludeFilter(string propertyName, IEnumerable excludedPropertyValues, bool wildcardsEnabled, BehaviorOnNoMatch behaviorOnNoMatch)\n {\n if (behaviorOnNoMatch == BehaviorOnNoMatch.Default)\n {\n this.BehaviorOnNoMatch = BehaviorOnNoMatch.SilentlyContinue;\n }\n else\n {\n this.BehaviorOnNoMatch = behaviorOnNoMatch;\n }\n\n foreach (object excludedPropertyValue in excludedPropertyValues)\n {\n this.AddPropertyValueFilter(\n new PropertyValueExcludeFilter(\n propertyName,\n excludedPropertyValue,\n wildcardsEnabled,\n behaviorOnNoMatch));\n }\n }\n }\n\n private class CimInstanceMinFilter : CimInstancePropertyBasedFilter\n {\n public CimInstanceMinFilter(string propertyName, object minPropertyValue, BehaviorOnNoMatch behaviorOnNoMatch)\n {\n if (behaviorOnNoMatch == BehaviorOnNoMatch.Default)\n {\n this.BehaviorOnNoMatch = BehaviorOnNoMatch.SilentlyContinue;\n }\n else\n {\n this.BehaviorOnNoMatch = behaviorOnNoMatch;\n }\n\n this.AddPropertyValueFilter(\n new PropertyValueMinFilter(\n propertyName,\n minPropertyValue,\n behaviorOnNoMatch));\n }\n }\n\n private class CimInstanceMaxFilter : CimInstancePropertyBasedFilter\n {\n public CimInstanceMaxFilter(string propertyName, object minPropertyValue, BehaviorOnNoMatch behaviorOnNoMatch)\n {\n if (behaviorOnNoMatch == BehaviorOnNoMatch.Default)\n {\n this.BehaviorOnNoMatch = BehaviorOnNoMatch.SilentlyContinue;\n }\n else\n {\n this.BehaviorOnNoMatch = behaviorOnNoMatch;\n }\n\n this.AddPropertyValueFilter(\n new PropertyValueMaxFilter(\n propertyName,\n minPropertyValue,\n behaviorOnNoMatch));\n }\n }\n\n private class CimInstanceAssociationFilter : CimInstanceFilterBase\n {\n public CimInstanceAssociationFilter(BehaviorOnNoMatch behaviorOnNoMatch)\n {\n if (behaviorOnNoMatch == BehaviorOnNoMatch.Default)\n {\n this.BehaviorOnNoMatch = BehaviorOnNoMatch.ReportErrors;\n }\n else\n {\n this.BehaviorOnNoMatch = behaviorOnNoMatch;\n }\n }\n\n protected override bool IsMatchCore(CimInstance cimInstance)\n {\n return true; // the fact that this method is getting called means that CIM found associated instances (i.e. by definition the argument *is* matching)\n }\n }\n\n internal abstract class PropertyValueFilter\n {\n protected PropertyValueFilter(string propertyName, object expectedPropertyValue, BehaviorOnNoMatch behaviorOnNoMatch)\n {\n PropertyName = propertyName;\n _behaviorOnNoMatch = behaviorOnNoMatch;\n OriginalExpectedPropertyValue = expectedPropertyValue;\n CimTypedExpectedPropertyValue = CimValueConverter.ConvertFromDotNetToCim(expectedPropertyValue);\n }\n\n public BehaviorOnNoMatch BehaviorOnNoMatch\n {\n get\n {\n if (_behaviorOnNoMatch == BehaviorOnNoMatch.Default)\n {\n _behaviorOnNoMatch = this.GetDefaultBehaviorWhenNoMatchesFound(this.CimTypedExpectedPropertyValue);\n }\n\n return _behaviorOnNoMatch;\n }\n }\n\n protected abstract BehaviorOnNoMatch GetDefaultBehaviorWhenNoMatchesFound(object cimTypedExpectedPropertyValue);\n private BehaviorOnNoMatch _behaviorOnNoMatch;\n\n public string PropertyName { get; }\n\n public object CimTypedExpectedPropertyValue { get; }\n\n public object OriginalExpectedPropertyValue { get; }\n\n public bool HadMatch { get; private set; }\n\n public bool IsMatch(CimInstance o)\n {\n if (o == null)\n {\n return false;\n }\n\n CimProperty propertyInfo = o.CimInstanceProperties[PropertyName];\n if (propertyInfo == null)\n {\n return false;\n }\n\n object actualPropertyValue = propertyInfo.Value;\n\n if (CimTypedExpectedPropertyValue == null)\n {\n HadMatch = HadMatch || (actualPropertyValue == null);\n return actualPropertyValue == null;\n }\n\n CimValueConverter.AssertIntrinsicCimValue(actualPropertyValue);\n CimValueConverter.AssertIntrinsicCimValue(CimTypedExpectedPropertyValue);\n\n actualPropertyValue = ConvertActualValueToExpectedType(actualPropertyValue, CimTypedExpectedPropertyValue);\n Dbg.Assert(IsSameType(actualPropertyValue, CimTypedExpectedPropertyValue), \"Types of actual vs expected property value should always match\");\n\n bool isMatch = this.IsMatchingValue(actualPropertyValue);\n HadMatch = HadMatch || isMatch;\n return isMatch;\n }\n\n protected abstract bool IsMatchingValue(object actualPropertyValue);\n\n private object ConvertActualValueToExpectedType(object actualPropertyValue, object expectedPropertyValue)\n {\n if ((actualPropertyValue is string) && (!(expectedPropertyValue is string)))\n {\n actualPropertyValue = LanguagePrimitives.ConvertTo(actualPropertyValue, expectedPropertyValue.GetType(), CultureInfo.InvariantCulture);\n }\n\n if (!IsSameType(actualPropertyValue, expectedPropertyValue))\n {\n var errorMessage = string.Format(\n CultureInfo.InvariantCulture,\n CmdletizationResources.CimJob_MismatchedTypeOfPropertyReturnedByQuery,\n PropertyName,\n actualPropertyValue.GetType().FullName,\n expectedPropertyValue.GetType().FullName);\n throw CimJobException.CreateWithoutJobContext(\n errorMessage,\n \"CimJob_PropertyTypeUnexpectedByClientSideQuery\",\n ErrorCategory.InvalidType);\n }\n\n return actualPropertyValue;\n }\n\n private static bool IsSameType(object actualPropertyValue, object expectedPropertyValue)\n {\n if (actualPropertyValue == null)\n {\n return true;\n }\n\n if (expectedPropertyValue == null)\n {\n return true;\n }\n\n if (actualPropertyValue is TimeSpan || actualPropertyValue is DateTime)\n {\n return expectedPropertyValue is TimeSpan || expectedPropertyValue is DateTime;\n }\n\n return actualPropertyValue.GetType() == expectedPropertyValue.GetType();\n }\n }\n\n internal class PropertyValueRegularFilter : PropertyValueFilter\n {\n private readonly bool _wildcardsEnabled;\n\n public PropertyValueRegularFilter(string propertyName, object expectedPropertyValue, bool wildcardsEnabled, BehaviorOnNoMatch behaviorOnNoMatch)\n : base(propertyName, expectedPropertyValue, behaviorOnNoMatch)\n {\n _wildcardsEnabled = wildcardsEnabled;\n }\n\n protected override BehaviorOnNoMatch GetDefaultBehaviorWhenNoMatchesFound(object cimTypedExpectedPropertyValue)\n {\n if (!_wildcardsEnabled)\n {\n return BehaviorOnNoMatch.ReportErrors;\n }\n else\n {\n string expectedPropertyValueAsString = cimTypedExpectedPropertyValue as string;\n if (expectedPropertyValueAsString != null && WildcardPattern.ContainsWildcardCharacters(expectedPropertyValueAsString))\n {\n return BehaviorOnNoMatch.SilentlyContinue;\n }\n else\n {\n return BehaviorOnNoMatch.ReportErrors;\n }\n }\n }\n\n internal NotFoundError GetGranularNotFoundError()\n {\n return new NotFoundError(this.PropertyName, this.OriginalExpectedPropertyValue, _wildcardsEnabled);\n }\n\n protected override bool IsMatchingValue(object actualPropertyValue)\n {\n if (_wildcardsEnabled)\n {\n return WildcardEqual(this.PropertyName, actualPropertyValue, this.CimTypedExpectedPropertyValue);\n }\n else\n {\n return NonWildcardEqual(this.PropertyName, actualPropertyValue, this.CimTypedExpectedPropertyValue);\n }\n }\n\n private static bool NonWildcardEqual(string propertyName, object actualPropertyValue, object expectedPropertyValue)\n {\n // perform .NET-based, case-insensitive equality test for 1) characters and 2) strings\n if (expectedPropertyValue is char)\n {\n expectedPropertyValue = expectedPropertyValue.ToString();\n actualPropertyValue = actualPropertyValue.ToString();\n }\n\n var expectedPropertyValueAsString = expectedPropertyValue as string;\n if (expectedPropertyValueAsString != null)\n {\n var actualPropertyValueAsString = (string)actualPropertyValue;\n return actualPropertyValueAsString.Equals(expectedPropertyValueAsString, StringComparison.OrdinalIgnoreCase);\n }\n\n // perform .NET based equality for everything else\n return actualPropertyValue.Equals(expectedPropertyValue);\n }\n\n private static bool WildcardEqual(string propertyName, object actualPropertyValue, object expectedPropertyValue)\n {\n string actualPropertyValueAsString;\n string expectedPropertyValueAsString;\n if (!LanguagePrimitives.TryConvertTo(actualPropertyValue, out actualPropertyValueAsString))\n {\n return false;\n }\n\n if (!LanguagePrimitives.TryConvertTo(expectedPropertyValue, out expectedPropertyValueAsString))\n {\n return false;\n }\n\n return WildcardPattern.Get(expectedPropertyValueAsString, WildcardOptions.IgnoreCase).IsMatch(actualPropertyValueAsString);\n }\n }\n\n internal class PropertyValueExcludeFilter : PropertyValueRegularFilter\n {\n public PropertyValueExcludeFilter(string propertyName, object expectedPropertyValue, bool wildcardsEnabled, BehaviorOnNoMatch behaviorOnNoMatch)\n : base(propertyName, expectedPropertyValue, wildcardsEnabled, behaviorOnNoMatch)\n {\n }\n\n protected override BehaviorOnNoMatch GetDefaultBehaviorWhenNoMatchesFound(object cimTypedExpectedPropertyValue)\n {\n return BehaviorOnNoMatch.SilentlyContinue;\n }\n\n protected override bool IsMatchingValue(object actualPropertyValue)\n {\n return !base.IsMatchingValue(actualPropertyValue);\n }\n }\n\n internal class PropertyValueMinFilter : PropertyValueFilter\n {\n public PropertyValueMinFilter(string propertyName, object expectedPropertyValue, BehaviorOnNoMatch behaviorOnNoMatch)\n : base(propertyName, expectedPropertyValue, behaviorOnNoMatch)\n {\n }\n\n protected override BehaviorOnNoMatch GetDefaultBehaviorWhenNoMatchesFound(object cimTypedExpectedPropertyValue)\n {\n return BehaviorOnNoMatch.SilentlyContinue;\n }\n\n protected override bool IsMatchingValue(object actualPropertyValue)\n {\n return ActualValueGreaterThanOrEqualToExpectedValue(this.PropertyName, actualPropertyValue, this.CimTypedExpectedPropertyValue);\n }\n\n private static bool ActualValueGreaterThanOrEqualToExpectedValue(string propertyName, object actualPropertyValue, object expectedPropertyValue)\n {\n try\n {\n var expectedComparable = expectedPropertyValue as IComparable;\n if (expectedComparable == null)\n {\n return false;\n }\n\n return expectedComparable.CompareTo(actualPropertyValue) <= 0;\n }\n catch (ArgumentException)\n {\n return false;\n }\n }\n }\n\n internal class PropertyValueMaxFilter : PropertyValueFilter\n {\n public PropertyValueMaxFilter(string propertyName, object expectedPropertyValue, BehaviorOnNoMatch behaviorOnNoMatch)\n : base(propertyName, expectedPropertyValue, behaviorOnNoMatch)\n {\n }\n\n protected override BehaviorOnNoMatch GetDefaultBehaviorWhenNoMatchesFound(object cimTypedExpectedPropertyValue)\n {\n return BehaviorOnNoMatch.SilentlyContinue;\n }\n\n protected override bool IsMatchingValue(object actualPropertyValue)\n {\n return ActualValueLessThanOrEqualToExpectedValue(this.PropertyName, actualPropertyValue, this.CimTypedExpectedPropertyValue);\n }\n\n private static bool ActualValueLessThanOrEqualToExpectedValue(string propertyName, object actualPropertyValue, object expectedPropertyValue)\n {\n try\n {\n var actualComparable = actualPropertyValue as IComparable;\n if (actualComparable == null)\n {\n return false;\n }\n\n return actualComparable.CompareTo(expectedPropertyValue) <= 0;\n }\n catch (ArgumentException)\n {\n return false;\n }\n }\n }\n\n private int _numberOfResultsFromMi;\n private int _numberOfMatchingResults;\n\n private readonly List _filters = new List();\n private readonly object _myLock = new object();\n\n #region \"Public\" interface for client-side filtering\n\n internal bool IsResultMatchingClientSideQuery(CimInstance result)\n {\n lock (_myLock)\n {\n _numberOfResultsFromMi++;\n\n if (_filters.All(f => f.IsMatch(result)))\n {\n _numberOfMatchingResults++;\n return true;\n }\n else\n {\n return false;\n }\n }\n }\n\n internal IEnumerable GenerateNotFoundErrors()\n {\n if (_filters.Count > 1)\n {\n if (_numberOfMatchingResults > 0)\n {\n return Enumerable.Empty();\n }\n\n if (_filters.All(f => !f.ShouldReportErrorOnNoMatches_IfMultipleFilters()))\n {\n return Enumerable.Empty();\n }\n\n return new[] { new NotFoundError() };\n }\n\n CimInstanceFilterBase filter = _filters.SingleOrDefault();\n if (filter != null)\n {\n return filter.GetNotFoundErrors_IfThisIsTheOnlyFilter();\n }\n\n return Enumerable.Empty();\n }\n\n #endregion\n\n #region QueryBuilder interface\n\n public override void FilterByProperty(string propertyName, IEnumerable allowedPropertyValues, bool wildcardsEnabled, BehaviorOnNoMatch behaviorOnNoMatch)\n {\n _filters.Add(new CimInstanceRegularFilter(propertyName, allowedPropertyValues, wildcardsEnabled, behaviorOnNoMatch));\n }\n\n public override void ExcludeByProperty(string propertyName, IEnumerable excludedPropertyValues, bool wildcardsEnabled, BehaviorOnNoMatch behaviorOnNoMatch)\n {\n _filters.Add(new CimInstanceExcludeFilter(propertyName, excludedPropertyValues, wildcardsEnabled, behaviorOnNoMatch));\n }\n\n public override void FilterByMinPropertyValue(string propertyName, object minPropertyValue, BehaviorOnNoMatch behaviorOnNoMatch)\n {\n _filters.Add(new CimInstanceMinFilter(propertyName, minPropertyValue, behaviorOnNoMatch));\n }\n\n public override void FilterByMaxPropertyValue(string propertyName, object maxPropertyValue, BehaviorOnNoMatch behaviorOnNoMatch)\n {\n _filters.Add(new CimInstanceMaxFilter(propertyName, maxPropertyValue, behaviorOnNoMatch));\n }\n\n public override void FilterByAssociatedInstance(object associatedInstance, string associationName, string sourceRole, string resultRole, BehaviorOnNoMatch behaviorOnNoMatch)\n {\n _filters.Add(new CimInstanceAssociationFilter(behaviorOnNoMatch));\n }\n\n #endregion\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"6ec03f859e472b9e1ac2412738ba1b10\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 702,\n \"max_line_length\": 187,\n \"avg_line_length\": 40.48860398860399,\n \"alnum_prop\": 0.5685184533652324,\n \"repo_name\": \"Cowmonaut/PowerShell\",\n \"id\": \"084d61ecab0a31798638ff1acff9085deb3de2bd\",\n \"size\": \"28520\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/Microsoft.PowerShell.Commands.Management/cimSupport/cmdletization/cim/clientSideQuery.cs\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"15610\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":957,"cells":{"text":{"kind":"string","value":"\n/******************************************************************************\n * Product of NIST/ITL Advanced Networking Technologies Division (ANTD). *\n ******************************************************************************/\npackage gov.nist.javax.sip.stack;\n\nimport gov.nist.core.CommonLogger;\nimport gov.nist.core.LogWriter;\nimport gov.nist.core.StackLogger;\nimport gov.nist.javax.sip.header.CSeq;\nimport gov.nist.javax.sip.header.CallID;\nimport gov.nist.javax.sip.header.ContentLength;\nimport gov.nist.javax.sip.header.From;\nimport gov.nist.javax.sip.header.RequestLine;\nimport gov.nist.javax.sip.header.StatusLine;\nimport gov.nist.javax.sip.header.To;\nimport gov.nist.javax.sip.header.Via;\nimport gov.nist.javax.sip.message.SIPMessage;\n\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.net.InetAddress;\nimport java.net.Socket;\nimport java.text.ParseException;\n\n/*\n * Ahmet Uyar sent in a bug report for TCP operation of the JAIN sipStack.\n * Niklas Uhrberg suggested that a mechanism be added to limit the number of simultaneous open\n * connections. The TLS Adaptations were contributed by Daniel Martinez. Hagai Sela contributed a\n * bug fix for symmetric nat. Jeroen van Bemmel added compensation for buggy clients ( Microsoft\n * RTC clients ). Bug fixes by viswashanti.kadiyala@antepo.com, Joost Yervante Damand\n */\n\n/**\n * This is a stack abstraction for TCP connections. This abstracts a stream of\n * parsed messages. The SIP sipStack starts this from the main SIPStack class\n * for each connection that it accepts. It starts a message parser in its own\n * thread and talks to the message parser via a pipe. The message parser calls\n * back via the parseError or processMessage functions that are defined as part\n * of the SIPMessageListener interface.\n *\n * @see gov.nist.javax.sip.parser.PipelinedMsgParser\n *\n *\n * @author M. Ranganathan
\n *\n * @version 1.2 $Revision: 1.83 $ $Date: 2010-12-02 22:44:53 $\n */\npublic class TCPMessageChannel extends ConnectionOrientedMessageChannel {\n private static StackLogger logger = CommonLogger.getLogger(TCPMessageChannel.class); \n\n protected OutputStream myClientOutputStream;\n\n protected TCPMessageChannel(SIPTransactionStack sipStack) {\n \tsuper(sipStack);\n }\n\n /**\n * Constructor - gets called from the SIPStack class with a socket on\n * accepting a new client. All the processing of the message is done here\n * with the sipStack being freed up to handle new connections. The sock\n * input is the socket that is returned from the accept. Global data that is\n * shared by all threads is accessible in the Server structure.\n *\n * @param sock\n * Socket from which to read and write messages. The socket is\n * already connected (was created as a result of an accept).\n *\n * @param sipStack\n * Ptr to SIP Stack\n */\n\n protected TCPMessageChannel(Socket sock, SIPTransactionStack sipStack,\n TCPMessageProcessor msgProcessor, String threadName) throws IOException {\n\n \tsuper(sipStack);\n if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {\n logger.logDebug(\n \"creating new TCPMessageChannel \");\n logger.logStackTrace();\n }\n mySock = sock;\n peerAddress = mySock.getInetAddress();\n myAddress = msgProcessor.getIpAddress().getHostAddress();\n myClientInputStream = mySock.getInputStream();\n myClientOutputStream = mySock.getOutputStream();\n mythread = new Thread(this);\n mythread.setDaemon(true);\n mythread.setName(threadName);\n this.peerPort = mySock.getPort();\n this.key = MessageChannel.getKey(peerAddress, peerPort, \"TCP\");\n\n this.myPort = msgProcessor.getPort();\n // Bug report by Vishwashanti Raj Kadiayl\n super.messageProcessor = msgProcessor;\n // Can drop this after response is sent potentially.\n mythread.start();\n }\n\n /**\n * Constructor - connects to the given inet address. Acknowledgement --\n * Lamine Brahimi (IBM Zurich) sent in a bug fix for this method. A thread\n * was being uncessarily created.\n *\n * @param inetAddr\n * inet address to connect to.\n * @param sipStack\n * is the sip sipStack from which we are created.\n * @throws IOException\n * if we cannot connect.\n */\n protected TCPMessageChannel(InetAddress inetAddr, int port,\n SIPTransactionStack sipStack, TCPMessageProcessor messageProcessor)\n throws IOException {\n \t\n \tsuper(sipStack);\n if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {\n logger.logDebug(\n \"creating new TCPMessageChannel \");\n logger.logStackTrace();\n }\n this.peerAddress = inetAddr;\n this.peerPort = port;\n this.myPort = messageProcessor.getPort();\n this.peerProtocol = \"TCP\";\n this.myAddress = messageProcessor.getIpAddress().getHostAddress();\n // Bug report by Vishwashanti Raj Kadiayl\n this.key = MessageChannel.getKey(peerAddress, peerPort, \"TCP\");\n super.messageProcessor = messageProcessor;\n\n } \n\n /**\n * Close the message channel.\n */\n public void close(boolean removeSocket, boolean stopKeepAliveTask) { \n isRunning = false;\n \t// we need to close everything because the socket may be closed by the other end\n \t// like in LB scenarios sending OPTIONS and killing the socket after it gets the response \t\n if (mySock != null) {\n \tif (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG))\n logger.logDebug(\"Closing socket \" + key);\n \ttry {\n\t mySock.close();\n\t mySock = null;\n \t} catch (IOException ex) {\n if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG))\n logger.logDebug(\"Error closing socket \" + ex);\n }\n } \n if(myParser != null) {\n \tif (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG))\n logger.logDebug(\"Closing my parser \" + myParser);\n myParser.close(); \n } \n // no need to close myClientInputStream since myParser.close() above will do it\n if(myClientOutputStream != null) {\n \tif (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG))\n logger.logDebug(\"Closing client output stream \" + myClientOutputStream);\n \ttry {\n \t\tmyClientOutputStream.close();\n \t} catch (IOException ex) {\n if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG))\n logger.logDebug(\"Error closing client output stream\" + ex);\n }\n } \n if(removeSocket) { \n\t // remove the \"tcp:\" part of the key to cleanup the ioHandler hashmap\n\t String ioHandlerKey = key.substring(4);\n\t if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG))\n\t logger.logDebug(\"Closing TCP socket \" + ioHandlerKey);\n\t // Issue 358 : remove socket and semaphore on close to avoid leaking\n\t sipStack.ioHandler.removeSocket(ioHandlerKey);\n\t if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {\n logger.logDebug(\"Closing message Channel (key = \" + key +\")\" + this);\n }\n } else {\n if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {\n String ioHandlerKey = key.substring(4);\n logger.logDebug(\"not removing socket key from the cached map since it has already been updated by the iohandler.sendBytes \" + ioHandlerKey);\n }\n }\n if(stopKeepAliveTask) {\n\t\t\tcancelPingKeepAliveTimeoutTaskIfStarted();\n\t\t}\n\n }\n\n /**\n * get the transport string.\n *\n * @return \"tcp\" in this case.\n */\n public String getTransport() {\n return \"TCP\";\n } \n\n /**\n * Send message to whoever is connected to us. Uses the topmost via address\n * to send to.\n *\n * @param msg\n * is the message to send.\n * @param isClient\n */\n protected synchronized void sendMessage(byte[] msg, boolean isClient) throws IOException {\n\n if ( logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {\n logger.logDebug(\"sendMessage isClient = \" + isClient);\n }\n \n Socket sock = null;\n IOException problem = null;\n /* try {\n //\tsock = this.sipStack.ioHandler.sendBytes(this.messageProcessor.getIpAddress(),\n // this.peerAddress, this.peerPort, this.peerProtocol, msg, isClient, this);\n } catch (IOException any) {\n \tproblem = any;\n \tlogger.logWarning(\"Failed to connect \" + this.peerAddress + \":\" + this.peerPort +\" but trying the advertised port=\" + this.peerPortAdvertisedInHeaders + \" if it's different than the port we just failed on\");\n }*/\n if(sock == null) { // http://java.net/jira/browse/JSIP-362 If we couldn't connect to the host, try the advertised host and port as failsafe\n \tif(peerAddressAdvertisedInHeaders != null && peerPortAdvertisedInHeaders > 0) { \n if (logger.isLoggingEnabled(LogWriter.TRACE_WARN)) {\n logger.logWarning(\"Couldn't connect to peerAddress = \" + peerAddress + \" peerPort = \" + peerPort\n + \" key = \" + key + \" retrying on peerPortAdvertisedInHeaders \"\n + peerPortAdvertisedInHeaders);\n }\n \t\tInetAddress address = InetAddress.getByName(peerAddressAdvertisedInHeaders);\n // sock = this.sipStack.ioHandler.sendBytes(this.messageProcessor.getIpAddress(),\n // \t\taddress, this.peerPortAdvertisedInHeaders, this.peerProtocol, msg, isClient, this);\n \t\tthis.peerPort = this.peerPortAdvertisedInHeaders;\n \t\tthis.peerAddress = address;\n \t\tthis.key = MessageChannel.getKey(peerAddress, peerPort, \"TCP\");\n \t\tif (logger.isLoggingEnabled(LogWriter.TRACE_WARN)) {\n logger.logWarning(\"retry suceeded to peerAddress = \" + peerAddress\n + \" peerPortAdvertisedInHeaders = \" + peerPortAdvertisedInHeaders + \" key = \" + key);\n }\n } else {\n \t\tthrow problem; // throw the original excpetion we had from the first attempt\n \t}\n }\n\n // Created a new socket so close the old one and stick the new\n // one in its place but dont do this if it is a datagram socket.\n // (could have replied via udp but received via tcp!).\n // if (mySock == null && s != null) {\n // this.uncache();\n // } else\n if (sock != mySock && sock != null) {\n \t if (mySock != null) {\n \t\t if(logger.isLoggingEnabled(LogWriter.TRACE_WARN)) {\n \t\t\t logger.logWarning(\n \t\t \"Old socket different than new socket on channel \" + key);\n\t\t logger.logStackTrace();\n\t\t logger.logWarning(\n\t\t \t\t \"Old socket local ip address \" + mySock.getLocalSocketAddress());\n\t\t logger.logWarning(\n\t\t \t\t \"Old socket remote ip address \" + mySock.getRemoteSocketAddress()); \n\t\t logger.logWarning(\n\t\t \t\t \"New socket local ip address \" + sock.getLocalSocketAddress());\n\t\t logger.logWarning(\n\t\t \t\t \"New socket remote ip address \" + sock.getRemoteSocketAddress());\n \t\t }\n \t\t close(false, false);\n \t} \n \tif(problem == null) {\n \t\tif(mySock != null) {\n\t \t\tif(logger.isLoggingEnabled(LogWriter.TRACE_WARN)) {\n\t \t\t\tlogger.logWarning(\n\t \t\t \"There was no exception for the retry mechanism so creating a new thread based on the new socket for incoming \" + key);\n\t \t\t}\n \t\t}\n\t mySock = sock;\n\t this.myClientInputStream = mySock.getInputStream();\n\t this.myClientOutputStream = mySock.getOutputStream();\n\t Thread thread = new Thread(this);\n\t thread.setDaemon(true);\n\t thread.setName(\"TCPMessageChannelThread\");\n\t thread.start();\n \t} else {\n \t\tif(logger.isLoggingEnabled(LogWriter.TRACE_WARN)) {\n \t\t\tlogger.logWarning(\n \t\t\t\t\t\"There was an exception for the retry mechanism so not creating a new thread based on the new socket for incoming \" + key);\n \t\t}\n \t\tmySock = sock;\n \t}\n }\n\n }\n\n /**\n * Send a message to a specified address.\n *\n * @param message\n * Pre-formatted message to send.\n * @param receiverAddress\n * Address to send it to.\n * @param receiverPort\n * Receiver port.\n * @throws IOException\n * If there is a problem connecting or sending.\n */\n public synchronized void sendMessage(byte message[], InetAddress receiverAddress,\n int receiverPort, boolean retry) throws IOException {\n if (message == null || receiverAddress == null)\n throw new IllegalArgumentException(\"Null argument\");\n \n if(peerPortAdvertisedInHeaders <= 0) {\n \tif(logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {\n \tlogger.logDebug(\"receiver port = \" + receiverPort + \" for this channel \" + this + \" key \" + key);\n } \t\n \tif(receiverPort <=0) { \n \t\t// if port is 0 we assume the default port for TCP\n \t\tthis.peerPortAdvertisedInHeaders = 5060;\n \t} else {\n \t\tthis.peerPortAdvertisedInHeaders = receiverPort;\n \t}\n \tif(logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {\n \tlogger.logDebug(\"2.Storing peerPortAdvertisedInHeaders = \" + peerPortAdvertisedInHeaders + \" for this channel \" + this + \" key \" + key);\n }\t \n }\n \n Socket sock = null;\n IOException problem = null;\n /* try {\n //\tsock = this.sipStack.ioHandler.sendBytes(this.messageProcessor.getIpAddress(),\n // receiverAddress, receiverPort, \"TCP\", message, retry, this);\n } catch (IOException any) {\n \tproblem = any;\n \tlogger.logWarning(\"Failed to connect \" + this.peerAddress + \":\" + receiverPort +\" but trying the advertised port=\" + this.peerPortAdvertisedInHeaders + \" if it's different than the port we just failed on\");\n \tlogger.logError(\"Error is \", any);\n\n }*/\n if(sock == null) { // http://java.net/jira/browse/JSIP-362 If we couldn't connect to the host, try the advertised host:port as failsafe\n \tif(peerAddressAdvertisedInHeaders != null && peerPortAdvertisedInHeaders > 0) { \n if (logger.isLoggingEnabled(LogWriter.TRACE_WARN)) {\n logger.logWarning(\"Couldn't connect to receiverAddress = \" + receiverAddress\n + \" receiverPort = \" + receiverPort + \" key = \" + key\n + \" retrying on peerPortAdvertisedInHeaders \" + peerPortAdvertisedInHeaders);\n }\n \t\tInetAddress address = InetAddress.getByName(peerAddressAdvertisedInHeaders);\n // sock = this.sipStack.ioHandler.sendBytes(this.messageProcessor.getIpAddress(),\n // address, this.peerPortAdvertisedInHeaders, \"TCP\", message, retry, this);\n \t\tthis.peerPort = this.peerPortAdvertisedInHeaders;\n \t\tthis.peerAddress = address;\n \t\tthis.key = MessageChannel.getKey(peerAddress, peerPort, \"TCP\");\n if (logger.isLoggingEnabled(LogWriter.TRACE_WARN)) {\n logger.logWarning(\"retry suceeded to peerAddress = \" + peerAddress\n + \" peerPort = \" + peerPort + \" key = \" + key);\n }\n } else {\n \t\tthrow problem; // throw the original excpetion we had from the first attempt\n \t}\n }\n \n if (sock != mySock && sock != null) { \t \t\n if (mySock != null) {\n \tif(logger.isLoggingEnabled(LogWriter.TRACE_WARN)) {\n \t\t\t \t logger.logWarning(\n \t\t \"Old socket different than new socket on channel \" + key);\n\t\t logger.logStackTrace();\n\t\t logger.logWarning(\n\t\t \t\t \"Old socket local ip address \" + mySock.getLocalSocketAddress());\n\t\t logger.logWarning(\n\t\t \t\t \"Old socket remote ip address \" + mySock.getRemoteSocketAddress()); \n\t\t logger.logWarning(\n\t\t \t\t \"New socket local ip address \" + sock.getLocalSocketAddress());\n\t\t logger.logWarning(\n\t\t \t\t \"New socket remote ip address \" + sock.getRemoteSocketAddress());\n \t\t \t}\n \tclose(false, false);\n }\n if(problem == null) {\n \tif (mySock != null) {\n \t\tif(logger.isLoggingEnabled(LogWriter.TRACE_WARN)) {\n \t\t\tlogger.logWarning(\n \t\t\t\t\t\"There was no exception for the retry mechanism so creating a new thread based on the new socket for incoming \" + key);\n \t\t}\n \t}\n\t mySock = sock;\n\t this.myClientInputStream = mySock.getInputStream();\n\t this.myClientOutputStream = mySock.getOutputStream();\n\t // start a new reader on this end of the pipe.\n\t Thread mythread = new Thread(this);\n\t mythread.setDaemon(true);\n\t mythread.setName(\"TCPMessageChannelThread\");\n\t mythread.start();\n } else {\n \tif(logger.isLoggingEnabled(LogWriter.TRACE_WARN)) {\n \t\tlogger.logWarning(\n \t\t\t\"There was an exception for the retry mechanism so not creating a new thread based on the new socket for incoming \" + key);\n \t}\n \tmySock = sock;\n }\n }\n\n }\n\n /**\n * Exception processor for exceptions detected from the parser. (This is\n * invoked by the parser when an error is detected).\n *\n * @param sipMessage\n * -- the message that incurred the error.\n * @param ex\n * -- parse exception detected by the parser.\n * @param header\n * -- header that caused the error.\n * @throws ParseException\n * Thrown if we want to reject the message.\n */\n public void handleException(ParseException ex, SIPMessage sipMessage,\n Class hdrClass, String header, String message)\n throws ParseException {\n if (logger.isLoggingEnabled())\n logger.logException(ex);\n // Log the bad message for later reference.\n if ((hdrClass != null)\n && (hdrClass.equals(From.class) || hdrClass.equals(To.class)\n || hdrClass.equals(CSeq.class)\n || hdrClass.equals(Via.class)\n || hdrClass.equals(CallID.class)\n || hdrClass.equals(ContentLength.class)\n || hdrClass.equals(RequestLine.class) || hdrClass\n .equals(StatusLine.class))) {\n if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {\n logger.logDebug(\n \"Encountered Bad Message \\n\" + sipMessage.toString());\n }\n\n // JvB: send a 400 response for requests (except ACK)\n // Currently only UDP, @todo also other transports\n String msgString = sipMessage.toString();\n if (!msgString.startsWith(\"SIP/\") && !msgString.startsWith(\"ACK \")) {\n \tif(mySock != null)\n \t{\n\t \t if (logger.isLoggingEnabled(LogWriter.TRACE_ERROR)) {\n\t \t\t logger.logError(\"Malformed mandatory headers: closing socket! :\" + mySock.toString());\n\t \t }\n\t \n\t \ttry\n\t \t{\n\t \t\tmySock.close();\n\t \t\t\n\t \t} catch(IOException ie)\n\t \t{\n\t \t\tif (logger.isLoggingEnabled(LogWriter.TRACE_ERROR)) {\n\t \t\t\tlogger.logError(\"Exception while closing socket! :\" + mySock.toString() + \":\" + ie.toString());\n\t \t\t}\n\t \t\t\n\t \t}\n \t}\n }\n\n throw ex;\n } else {\n sipMessage.addUnparsed(header);\n }\n } \n\n /**\n * Equals predicate.\n *\n * @param other\n * is the other object to compare ourselves to for equals\n */\n\n public boolean equals(Object other) {\n\n if (!this.getClass().equals(other.getClass()))\n return false;\n else {\n TCPMessageChannel that = (TCPMessageChannel) other;\n if (this.mySock != that.mySock)\n return false;\n else\n return true;\n }\n } \n\n /**\n * TCP Is not a secure protocol.\n */\n public boolean isSecure() {\n return false;\n }\n\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"8d9c5c246eb71648156a875643cc03b6\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 488,\n \"max_line_length\": 216,\n \"avg_line_length\": 42.86065573770492,\n \"alnum_prop\": 0.5848154522853318,\n \"repo_name\": \"fhg-fokus-nubomedia/signaling-plane\",\n \"id\": \"b552e244a02854e9f0d05e6248df7088d8fb58eb\",\n \"size\": \"22000\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"modules/lib-sip/src/main/java/gov/nist/javax/sip/stack/TCPMessageChannel.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"12152\"\n },\n {\n \"name\": \"Groff\",\n \"bytes\": \"22\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"2637100\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"5622899\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"3448641\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"161709\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"8658\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":958,"cells":{"text":{"kind":"string","value":"using content::NotificationService;\n\nTabModel::TabModel(Profile* profile)\n : profile_(profile),\n synced_window_delegate_(\n new browser_sync::SyncedWindowDelegateAndroid(this)),\n toolbar_model_(new ToolbarModelImpl(this)) {\n\n if (profile) {\n // A normal Profile creates an OTR profile if it does not exist when\n // GetOffTheRecordProfile() is called, so we guard it with\n // HasOffTheRecordProfile(). An OTR profile returns itself when you call\n // GetOffTheRecordProfile().\n is_off_the_record_ = (profile->HasOffTheRecordProfile() &&\n profile == profile->GetOffTheRecordProfile());\n\n // A profile can be destroyed, for example in the case of closing all\n // incognito tabs. We therefore must listen for when this happens, and\n // remove our pointer to the profile accordingly.\n registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,\n content::Source(profile_));\n } else {\n is_off_the_record_ = false;\n }\n}\n\nTabModel::TabModel()\n : profile_(NULL),\n is_off_the_record_(false),\n synced_window_delegate_(\n new browser_sync::SyncedWindowDelegateAndroid(this)) {\n}\n\nTabModel::~TabModel() {\n}\n\ncontent::WebContents* TabModel::GetActiveWebContents() const {\n if (GetTabCount() == 0 || GetActiveIndex() < 0 ||\n GetActiveIndex() > GetTabCount())\n return NULL;\n return GetWebContentsAt(GetActiveIndex());\n}\n\nProfile* TabModel::GetProfile() const {\n return profile_;\n}\n\nbool TabModel::IsOffTheRecord() const {\n return is_off_the_record_;\n}\n\nbrowser_sync::SyncedWindowDelegate* TabModel::GetSyncedWindowDelegate() const {\n return synced_window_delegate_.get();\n}\n\nSessionID::id_type TabModel::GetSessionId() const {\n return session_id_.id();\n}\n\nvoid TabModel::BroadcastSessionRestoreComplete() {\n if (profile_) {\n NotificationService::current()->Notify(\n chrome::NOTIFICATION_SESSION_RESTORE_COMPLETE,\n content::Source(profile_),\n NotificationService::NoDetails());\n } else {\n // TODO(nyquist): Uncomment this once downstream Android uses new\n // constructor that takes a Profile* argument. See crbug.com/159704.\n // NOTREACHED();\n }\n}\n\nToolbarModel* TabModel::GetToolbarModel() {\n return toolbar_model_.get();\n}\n\nToolbarModel::SecurityLevel TabModel::GetSecurityLevelForCurrentTab() {\n return toolbar_model_->GetSecurityLevel();\n}\n\nvoid TabModel::Observe(\n int type,\n const content::NotificationSource& source,\n const content::NotificationDetails& details) {\n switch (type) {\n case chrome::NOTIFICATION_PROFILE_DESTROYED:\n // Our profile just got destroyed, so we delete our pointer to it.\n profile_ = NULL;\n break;\n default:\n NOTREACHED();\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"06d85c09aa644c28e58d2d73449a5eb6\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 93,\n \"max_line_length\": 79,\n \"avg_line_length\": 29.365591397849464,\n \"alnum_prop\": 0.6935188575613328,\n \"repo_name\": \"zcbenz/cefode-chromium\",\n \"id\": \"7bd5d7305061ebd98c912aad0ca1c378011b3cee\",\n \"size\": \"3314\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"chrome/browser/ui/android/tab_model/tab_model.cc\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"ASP\",\n \"bytes\": \"853\"\n },\n {\n \"name\": \"AppleScript\",\n \"bytes\": \"6973\"\n },\n {\n \"name\": \"Arduino\",\n \"bytes\": \"464\"\n },\n {\n \"name\": \"Assembly\",\n \"bytes\": \"1174304\"\n },\n {\n \"name\": \"Awk\",\n \"bytes\": \"9519\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"76026099\"\n },\n {\n \"name\": \"C#\",\n \"bytes\": \"1132\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"157904700\"\n },\n {\n \"name\": \"DOT\",\n \"bytes\": \"1559\"\n },\n {\n \"name\": \"F#\",\n \"bytes\": \"381\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"3225038\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"18180217\"\n },\n {\n \"name\": \"Logos\",\n \"bytes\": \"4517\"\n },\n {\n \"name\": \"Matlab\",\n \"bytes\": \"5234\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"7139426\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"97817\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"932901\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"8654916\"\n },\n {\n \"name\": \"R\",\n \"bytes\": \"262\"\n },\n {\n \"name\": \"Ragel in Ruby Host\",\n \"bytes\": \"3621\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"1533012\"\n },\n {\n \"name\": \"Tcl\",\n \"bytes\": \"277077\"\n },\n {\n \"name\": \"XML\",\n \"bytes\": \"13493\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":959,"cells":{"text":{"kind":"string","value":"import os\n\nfrom collections import defaultdict\n\nfrom .smb_utils import smb_connect, get_netbios_name, NameError\nfrom smb.base import SharedDevice\n\nDEFAULT_TIMEOUT = 30\nDEFAULT_SHARE = 'data'\n\nclass IfcbConnectionError(Exception):\n pass\n\ndef do_nothing(*args, **kw):\n pass\n\nclass RemoteIfcb(object):\n def __init__(self, addr, username, password, netbios_name=None, timeout=DEFAULT_TIMEOUT,\n share=DEFAULT_SHARE, directory='', connect=True):\n self.addr = addr\n self.username = username\n self.password = password\n self.timeout = timeout\n self.share = share\n self.connect = connect\n self.netbios_name = netbios_name\n self.directory = directory\n self._c = None\n def open(self):\n if self._c is not None:\n return\n try:\n self._c = smb_connect(self.addr, self.username, self.password, self.netbios_name, self.timeout)\n except:\n raise IfcbConnectionError('unable to connect to IFCB')\n def close(self):\n if self._c is not None:\n self._c.close()\n self._c = None\n def __enter__(self):\n if self.connect:\n self.open()\n return self\n def __exit__(self, type, value, traceback):\n self.close()\n def ensure_connected(self):\n if self._c is None:\n raise IfcbConnectionError('IFCB is not connected')\n def is_responding(self):\n # tries to get NetBIOS name to see if IFCB is responding\n if self.netbios_name is not None:\n return True # FIXME determine connection state\n if self._c is not None:\n return True\n else:\n try:\n get_netbios_name(self.addr, timeout=self.timeout)\n return True\n except:\n return False\n def list_shares(self):\n self.ensure_connected()\n for share in self._c.listShares():\n if share.type == SharedDevice.DISK_TREE:\n yield share.name\n def share_exists(self):\n self.ensure_connected()\n for share in self.list_shares():\n if share.lower() == self.share.lower():\n return True\n return False\n def list_filesets(self):\n \"\"\"list fileset lids, most recent first\"\"\"\n self.ensure_connected()\n fs = defaultdict(lambda: 0)\n for f in self._c.listPath(self.share, self.directory):\n if f.isDirectory:\n continue\n fn = f.filename\n lid, ext = os.path.splitext(fn)\n if ext in ['.hdr','.roi','.adc']:\n fs[lid] += 1\n complete_sets = []\n for lid, c in fs.items():\n if c == 3: # complete fileset\n complete_sets.append(lid)\n return sorted(complete_sets, reverse=True)\n def transfer_fileset(self, lid, local_directory, skip_existing=True, create_directories=True):\n self.ensure_connected()\n if create_directories:\n os.makedirs(local_directory, exist_ok=True)\n n_copied = 0\n for ext in ['hdr', 'adc', 'roi']:\n fn = '{}.{}'.format(lid, ext)\n local_path = os.path.join(local_directory, fn)\n remote_path = os.path.join(self.directory, fn)\n temp_local_path = local_path + '.temp_download'\n\n if skip_existing and os.path.exists(local_path):\n lf_size = os.path.getsize(local_path)\n rf = self._c.getAttributes(self.share, remote_path)\n if lf_size == rf.file_size:\n continue\n\n with open(temp_local_path, 'wb') as fout:\n self._c.retrieveFile(self.share, remote_path, fout, timeout=self.timeout)\n os.rename(temp_local_path, local_path)\n n_copied += 1\n return n_copied > 0\n def delete_fileset(self, lid):\n self.ensure_connected()\n for ext in ['hdr', 'adc', 'roi']:\n self._c.deleteFiles(self.share, '{}.{}'.format(lid, ext))\n def sync(self, local_directory, progress_callback=do_nothing, fileset_callback=do_nothing):\n # local_directory can be\n # * a path, or\n # * a callbale returning a path when passed a bin lid\n self.ensure_connected()\n fss = self.list_filesets()\n copied = []\n failed = []\n for lid in fss:\n try:\n if callable(local_directory):\n destination_directory = local_directory(lid)\n was_copied = self.transfer_fileset(lid, destination_directory, skip_existing=True)\n if was_copied:\n copied.append(lid)\n fileset_callback(lid)\n except:\n failed.append(lid)\n pass\n progress_callback({\n 'total': len(fss),\n 'copied': copied,\n 'failed': failed,\n 'lid': lid\n })\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"ae8b7173cfc845dfc3495c866c982732\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 138,\n \"max_line_length\": 107,\n \"avg_line_length\": 36,\n \"alnum_prop\": 0.5489130434782609,\n \"repo_name\": \"joefutrelle/pyifcb\",\n \"id\": \"0c37ea582882e6065887aeec5c9a54eeaf1ac60d\",\n \"size\": \"4968\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"ifcb/data/transfer/remote.py\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Python\",\n \"bytes\": \"161062\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":960,"cells":{"text":{"kind":"string","value":"/****************************************************************************\n** Meta object code from reading C++ file 'mintingview.h'\n**\n** Created by: The Qt Meta Object Compiler version 67 (Qt 5.9.5)\n**\n** WARNING! All changes made in this file will be lost!\n*****************************************************************************/\n\n#include \"../src/qt/mintingview.h\"\n#include \n#include \n#if !defined(Q_MOC_OUTPUT_REVISION)\n#error \"The header file 'mintingview.h' doesn't include .\"\n#elif Q_MOC_OUTPUT_REVISION != 67\n#error \"This file was generated using the moc from 5.9.5. It\"\n#error \"cannot be used with the include files from this version of Qt.\"\n#error \"(The moc has changed too much.)\"\n#endif\n\nQT_BEGIN_MOC_NAMESPACE\nQT_WARNING_PUSH\nQT_WARNING_DISABLE_DEPRECATED\nstruct qt_meta_stringdata_MintingView_t {\n QByteArrayData data[5];\n char stringdata0[53];\n};\n#define QT_MOC_LITERAL(idx, ofs, len) \\\n Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \\\n qptrdiff(offsetof(qt_meta_stringdata_MintingView_t, stringdata0) + ofs \\\n - idx * sizeof(QByteArrayData)) \\\n )\nstatic const qt_meta_stringdata_MintingView_t qt_meta_stringdata_MintingView = {\n {\nQT_MOC_LITERAL(0, 0, 11), // \"MintingView\"\nQT_MOC_LITERAL(1, 12, 13), // \"exportClicked\"\nQT_MOC_LITERAL(2, 26, 0), // \"\"\nQT_MOC_LITERAL(3, 27, 21), // \"chooseMintingInterval\"\nQT_MOC_LITERAL(4, 49, 3) // \"idx\"\n\n },\n \"MintingView\\0exportClicked\\0\\0\"\n \"chooseMintingInterval\\0idx\"\n};\n#undef QT_MOC_LITERAL\n\nstatic const uint qt_meta_data_MintingView[] = {\n\n // content:\n 7, // revision\n 0, // classname\n 0, 0, // classinfo\n 2, 14, // methods\n 0, 0, // properties\n 0, 0, // enums/sets\n 0, 0, // constructors\n 0, // flags\n 0, // signalCount\n\n // slots: name, argc, parameters, tag, flags\n 1, 0, 24, 2, 0x0a /* Public */,\n 3, 1, 25, 2, 0x0a /* Public */,\n\n // slots: parameters\n QMetaType::Void,\n QMetaType::Void, QMetaType::Int, 4,\n\n 0 // eod\n};\n\nvoid MintingView::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)\n{\n if (_c == QMetaObject::InvokeMetaMethod) {\n MintingView *_t = static_cast(_o);\n Q_UNUSED(_t)\n switch (_id) {\n case 0: _t->exportClicked(); break;\n case 1: _t->chooseMintingInterval((*reinterpret_cast< int(*)>(_a[1]))); break;\n default: ;\n }\n }\n}\n\nconst QMetaObject MintingView::staticMetaObject = {\n { &QWidget::staticMetaObject, qt_meta_stringdata_MintingView.data,\n qt_meta_data_MintingView, qt_static_metacall, nullptr, nullptr}\n};\n\n\nconst QMetaObject *MintingView::metaObject() const\n{\n return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;\n}\n\nvoid *MintingView::qt_metacast(const char *_clname)\n{\n if (!_clname) return nullptr;\n if (!strcmp(_clname, qt_meta_stringdata_MintingView.stringdata0))\n return static_cast(this);\n return QWidget::qt_metacast(_clname);\n}\n\nint MintingView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)\n{\n _id = QWidget::qt_metacall(_c, _id, _a);\n if (_id < 0)\n return _id;\n if (_c == QMetaObject::InvokeMetaMethod) {\n if (_id < 2)\n qt_static_metacall(this, _c, _id, _a);\n _id -= 2;\n } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {\n if (_id < 2)\n *reinterpret_cast(_a[0]) = -1;\n _id -= 2;\n }\n return _id;\n}\nQT_WARNING_POP\nQT_END_MOC_NAMESPACE\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"20c90970bdc11fd38080fa59e582151a\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 119,\n \"max_line_length\": 96,\n \"avg_line_length\": 30.722689075630253,\n \"alnum_prop\": 0.5905361050328227,\n \"repo_name\": \"FourTwentyOne/421\",\n \"id\": \"c11d890b1546d7dcd35d4a631f53221566698ad1\",\n \"size\": \"3656\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"build/moc_mintingview.cpp\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"8565\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"1593460\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"89377\"\n },\n {\n \"name\": \"NSIS\",\n \"bytes\": \"6074\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"858\"\n },\n {\n \"name\": \"Objective-C++\",\n \"bytes\": \"3537\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"50532\"\n },\n {\n \"name\": \"QMake\",\n \"bytes\": \"15241\"\n },\n {\n \"name\": \"Roff\",\n \"bytes\": \"12841\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"3859\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":961,"cells":{"text":{"kind":"string","value":"\n\n \n \n \n equations: Not compatible 👼\n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n « Up\n

\n equations\n \n 1.0~beta2+8.7\n Not compatible 👼\n \n

\n

📅 (2022-09-12 23:10:41 UTC)

\n

Context

\n
# Packages matching: installed\n# Name              # Installed # Synopsis\nbase-bigarray       base\nbase-num            base        Num library distributed with the OCaml compiler\nbase-threads        base\nbase-unix           base\ncamlp5              7.14        Preprocessor-pretty-printer of OCaml\nconf-findutils      1           Virtual package relying on findutils\nconf-perl           2           Virtual package relying on perl\ncoq                 8.5.1       Formal proof management system\nnum                 0           The Num library for arbitrary-precision integer and rational arithmetic\nocaml               4.05.0      The OCaml compiler (virtual package)\nocaml-base-compiler 4.05.0      Official 4.05.0 release\nocaml-config        1           OCaml Switch Configuration\n# opam file:\nopam-version: &quot;2.0&quot;\nauthors: [ &quot;Matthieu Sozeau &lt;matthieu.sozeau@inria.fr&gt;&quot; &quot;Cyprien Mangin &lt;cyprien.mangin@m4x.org&gt;&quot; ]\ndev-repo: &quot;git+https://github.com/mattam82/Coq-Equations.git&quot;\nmaintainer: &quot;matthieu.sozeau@inria.fr&quot;\nhomepage: &quot;https://mattam82.github.io/Coq-Equations&quot;\nbug-reports: &quot;https://github.com/mattam82/Coq-Equations/issues&quot;\nlicense: &quot;LGPL 2.1&quot;\nbuild: [\n  [&quot;coq_makefile&quot; &quot;-f&quot; &quot;_CoqProject&quot; &quot;-o&quot; &quot;Makefile&quot;]\n  [make &quot;-j%{jobs}%&quot;]\n]\ninstall: [\n  [make &quot;install&quot;]\n]\nremove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/Equations&quot;]\ndepends: [\n  &quot;ocaml&quot;\n  &quot;coq&quot; {&gt;= &quot;8.7&quot; &amp; &lt; &quot;8.8&quot;}\n]\nsynopsis: &quot;A function definition package for Coq&quot;\nflags: light-uninstall\nurl {\n  src:\n    &quot;https://github.com/mattam82/Coq-Equations/archive/v1.0-8.7-beta2.tar.gz&quot;\n  checksum: &quot;md5=d281835d0762424b23c9aebf4a6d8921&quot;\n}\n
\n

Lint

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
\n

Dry install 🏜️

\n

Dry install with the current Coq version:

\n
\n
Command
\n
opam install -y --show-action coq-equations.1.0~beta2+8.7 coq.8.5.1
\n
Return code
\n
5120
\n
Output
\n
[NOTE] Package coq is already installed (current version is 8.5.1).\nThe following dependencies couldn&#39;t be met:\n  - coq-equations -&gt; coq &gt;= 8.7 -&gt; ocaml &gt;= 4.09.0\n      base of this switch (use `--unlock-base&#39; to force)\nYour request can&#39;t be satisfied:\n  - No available version of coq satisfies the constraints\nNo solution found, exiting\n
\n
\n

Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:

\n
\n
Command
\n
opam remove -y coq; opam install -y --show-action --unlock-base coq-equations.1.0~beta2+8.7
\n
Return code
\n
0
\n
\n

Install dependencies

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Duration
\n
0 s
\n
\n

Install 🚀

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Duration
\n
0 s
\n
\n

Installation size

\n

No files were installed.

\n

Uninstall 🧹

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Missing removes
\n
\n none\n
\n
Wrong removes
\n
\n none\n
\n
\n
\n
\n
\n
\n
\n

\n Sources are on GitHub © Guillaume Claret 🐣\n

\n
\n
\n \n \n \n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"3a91f30612ba018377ea94059cda81eb\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 168,\n \"max_line_length\": 159,\n \"avg_line_length\": 40.964285714285715,\n \"alnum_prop\": 0.537198488811392,\n \"repo_name\": \"coq-bench/coq-bench.github.io\",\n \"id\": \"112da7912cefe589186f9d69146761328aa40be2\",\n \"size\": \"6907\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"clean/Linux-x86_64-4.05.0-2.0.1/released/8.5.1/equations/1.0~beta2+8.7.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":962,"cells":{"text":{"kind":"string","value":"google-site-verification: google75f5f31b628404a4.html"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"9021dddaf18c4ff6d1126bc08131a824\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 1,\n \"max_line_length\": 53,\n \"avg_line_length\": 53,\n \"alnum_prop\": 0.9056603773584906,\n \"repo_name\": \"vmcosta/vmcosta.github.io\",\n \"id\": \"c275d104670e511e1091404795b68cc1536bd796\",\n \"size\": \"53\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"google75f5f31b628404a4.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"ApacheConf\",\n \"bytes\": \"2519\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"52103\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"17693\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"20894\"\n },\n {\n \"name\": \"Nginx\",\n \"bytes\": \"2342\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"711369\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":963,"cells":{"text":{"kind":"string","value":"\nusing System;\nusing System.Web;\nusing System.IO;\nusing System.Collections;\nusing System.Collections.Specialized;\nusing System.Security.Principal;\nusing System.Threading;\nusing log4net;\nusing FluorineFx.Messaging;\nusing FluorineFx.Messaging.Api;\nusing FluorineFx.Messaging.Messages;\nusing FluorineFx.Security;\nusing FluorineFx.Messaging.Rtmp;\n\nnamespace FluorineFx.Context\n{\n\t/// \n\t/// This type supports the Fluorine infrastructure and is not intended to be used directly from your code.\n\t/// \n\tsealed class FluorineRtmpContext : FluorineContext\n\t{\n private static readonly ILog log = LogManager.GetLogger(typeof(FluorineRtmpContext));\n\n private FluorineRtmpContext(IConnection connection)\n {\n _connection = connection;\n _session = connection.Session;\n _client = connection.Client;\n if (_client != null)\n _client.Renew();\n }\n\n internal static void Initialize(IConnection connection)\n {\n FluorineRtmpContext fluorineContext = new FluorineRtmpContext(connection);\n WebSafeCallContext.SetData(FluorineContext.FluorineContextKey, fluorineContext);\n if (log.IsDebugEnabled)\n log.Debug(__Res.GetString(__Res.Context_Initialized, connection.ConnectionId, connection.Client != null ? connection.Client.Id : \"[not set]\", connection.Session != null ? connection.Session.Id : \"[not set]\"));\n }\n\n public FluorineRtmpContext()\n\t\t{\n\t\t}\n\n\t\t/// \n\t\t/// Gets the physical drive path of the application directory for the application hosted in the current application domain.\n\t\t/// \n\t\tpublic override string RootPath\n\t\t{ \n\t\t\tget\n\t\t\t{\n\t\t\t\t//return HttpRuntime.AppDomainAppPath;\n return AppDomain.CurrentDomain.BaseDirectory;\n\t\t\t}\n\t\t}\n\n\t\t/// \n\t\t/// Gets the virtual path of the current request.\n\t\t/// \n\t\tpublic override string RequestPath \n\t\t{ \n\t\t\tget { return null; }\n\t\t}\n\t\t/// \n\t\t/// Gets the ASP.NET application's virtual application root path on the server.\n\t\t/// \n\t\tpublic override string RequestApplicationPath\n\t\t{ \n\t\t\tget { return null; }\n\t\t}\n\n public override string ApplicationPath\n {\n get\n {\n return null;\n }\n }\n\n\t\t/// \n\t\t/// Gets the absolute URI from the URL of the current request.\n\t\t/// \n\t\tpublic override string AbsoluteUri\n\t\t{ \n\t\t\tget{ return null; }\n\t\t}\n\n\t\tpublic override string ActivationMode\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\n\t\tpublic override string PhysicalApplicationPath\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\t//return HttpRuntime.AppDomainAppPath;\n return AppDomain.CurrentDomain.BaseDirectory;\n\t\t\t}\n\t\t}\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"8683b7a57251ccc3b7a99d0a4b75011c\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 106,\n \"max_line_length\": 225,\n \"avg_line_length\": 26.066037735849058,\n \"alnum_prop\": 0.6572566051393413,\n \"repo_name\": \"gspark/PmsAssistant\",\n \"id\": \"4b53c176c7fbbce84afc5951d9db690f510114de\",\n \"size\": \"3592\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"FluorineFx/Context/FluorineRtmpContext.cs\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"C#\",\n \"bytes\": \"5383235\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":964,"cells":{"text":{"kind":"string","value":"\n\n// Utilities for dealing with XLA primitive types.\n\n#ifndef TENSORFLOW_COMPILER_XLA_PRIMITIVE_UTIL_H_\n#define TENSORFLOW_COMPILER_XLA_PRIMITIVE_UTIL_H_\n\n#include \n\n#include \"tensorflow/compiler/xla/types.h\"\n#include \"tensorflow/compiler/xla/xla_data.pb.h\"\n\nnamespace xla {\nnamespace primitive_util {\n\n// Returns the XLA primitive type (eg, F32) corresponding to the given\n// template parameter native type (eg, float).\ntemplate \nPrimitiveType NativeToPrimitiveType() {\n // Make the expression depend on the template parameter NativeT so\n // that this compile-time error only apperas if this function is\n // instantiated with some concrete type that is not specialized\n // below.\n static_assert(!std::is_same::value,\n \"Cannot map native type to primitive type.\");\n return PRIMITIVE_TYPE_INVALID;\n}\n\n// Declarations of specializations for each native type which correspond to a\n// XLA primitive type.\ntemplate <>\nPrimitiveType NativeToPrimitiveType();\n\n// Unsigned integer\ntemplate <>\nPrimitiveType NativeToPrimitiveType();\n\ntemplate <>\nPrimitiveType NativeToPrimitiveType();\n\ntemplate <>\nPrimitiveType NativeToPrimitiveType();\n\ntemplate <>\nPrimitiveType NativeToPrimitiveType();\n\n// Signed integer\ntemplate <>\nPrimitiveType NativeToPrimitiveType();\n\ntemplate <>\nPrimitiveType NativeToPrimitiveType();\n\ntemplate <>\nPrimitiveType NativeToPrimitiveType();\n\ntemplate <>\nPrimitiveType NativeToPrimitiveType();\n\n// Floating point\ntemplate <>\nPrimitiveType NativeToPrimitiveType();\ntemplate <>\nPrimitiveType NativeToPrimitiveType();\ntemplate <>\nPrimitiveType NativeToPrimitiveType();\n\n// Complex\ntemplate <>\nPrimitiveType NativeToPrimitiveType();\n\nbool IsFloatingPointType(PrimitiveType type);\n\nbool IsComplexType(PrimitiveType type);\n\nbool IsSignedIntegralType(PrimitiveType type);\n\nbool IsUnsignedIntegralType(PrimitiveType type);\n\nbool IsIntegralType(PrimitiveType type);\n\n// Returns the number of bits in the representation for a given type.\nint BitWidth(PrimitiveType type);\n\n// Returns the real, imag component type underlying the given complex type.\n// LOG(FATAL)'s if complex_type is not complex.\nPrimitiveType ComplexComponentType(PrimitiveType complex_type);\n\n// Returns the native type (eg, float) corresponding to the given template\n// parameter XLA primitive type (eg, F32).\ntemplate \nstruct PrimitiveTypeToNative;\n\n// Declarations of specializations for each native type which correspond to a\n// XLA primitive type.\ntemplate <>\nstruct PrimitiveTypeToNative {\n using type = bool;\n};\n\n// Unsigned integer\ntemplate <>\nstruct PrimitiveTypeToNative {\n using type = uint8;\n};\n\ntemplate <>\nstruct PrimitiveTypeToNative {\n using type = uint16;\n};\n\ntemplate <>\nstruct PrimitiveTypeToNative {\n using type = uint32;\n};\n\ntemplate <>\nstruct PrimitiveTypeToNative {\n using type = uint64;\n};\n\n// Signed integer\ntemplate <>\nstruct PrimitiveTypeToNative {\n using type = int8;\n};\n\ntemplate <>\nstruct PrimitiveTypeToNative {\n using type = int16;\n};\n\ntemplate <>\nstruct PrimitiveTypeToNative {\n using type = int32;\n};\n\ntemplate <>\nstruct PrimitiveTypeToNative {\n using type = int64;\n};\n\n// Floating point\ntemplate <>\nstruct PrimitiveTypeToNative {\n using type = float;\n};\ntemplate <>\nstruct PrimitiveTypeToNative {\n using type = double;\n};\ntemplate <>\nstruct PrimitiveTypeToNative {\n using type = half;\n};\n\n// Complex\ntemplate <>\nstruct PrimitiveTypeToNative {\n using type = complex64;\n};\n} // namespace primitive_util\n} // namespace xla\n\n#endif // TENSORFLOW_COMPILER_XLA_PRIMITIVE_UTIL_H_\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"0fcdee3e0ffde7b72929d83dda1f72fb\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 165,\n \"max_line_length\": 77,\n \"avg_line_length\": 22.666666666666668,\n \"alnum_prop\": 0.7593582887700535,\n \"repo_name\": \"dyoung418/tensorflow\",\n \"id\": \"a49c8b86fcfe156ea3733ce05c0fb7337cf60dce\",\n \"size\": \"4408\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"tensorflow/compiler/xla/primitive_util.h\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"155915\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"9052366\"\n },\n {\n \"name\": \"CMake\",\n \"bytes\": \"29372\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"1297\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"763492\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"38854\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"10779\"\n },\n {\n \"name\": \"Jupyter Notebook\",\n \"bytes\": \"1772913\"\n },\n {\n \"name\": \"Protocol Buffer\",\n \"bytes\": \"110178\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"6032114\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"165125\"\n },\n {\n \"name\": \"TypeScript\",\n \"bytes\": \"403037\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":965,"cells":{"text":{"kind":"string","value":"\nnamespace _01.Last_3_Consecutive_Equal_Strings\n{\n using System;\n using System.Linq;\n\n public class LastThreeConsecutiveEqualStrings\n {\n public static void Main()\n {\n //var text = \"one one one one two hi hi my echo last last last pi\";\n var words = Console.ReadLine()\n .Split(new char[] { ' ' },\n StringSplitOptions.RemoveEmptyEntries)\n .ToArray();\n\n LastThreeEqualStrings(words);\n }\n\n static void LastThreeEqualStrings(string[] words)\n {\n var len = words.Length;\n var count = 1;\n\n for (int i = len - 1; i > 0; i--)\n {\n var word = words[i];\n var compare = words[i-1];\n \n\n if (word == compare)\n {\n count++;\n if (count == 3)\n {\n for (int j = 0; j < 3; j++)\n {\n Console.Write($\"{word} \");\n }\n Console.WriteLine();\n break;\n }\n }\n else\n {\n count = 1;\n }\n }\n }\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c225cff5686dfc85da981186e812bdcd\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 51,\n \"max_line_length\": 79,\n \"avg_line_length\": 25.92156862745098,\n \"alnum_prop\": 0.3585476550680787,\n \"repo_name\": \"1ooIL40/FundamentalsExtendetRepo\",\n \"id\": \"3b22e2251f4ec8917a00471ef15d72489d6e70e0\",\n \"size\": \"1324\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"Simple Arrays - More Exercises/01. Last 3 Consecutive Equal Strings/LastThreeConsecutiveEqualStrings.cs\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"C#\",\n \"bytes\": \"505444\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":966,"cells":{"text":{"kind":"string","value":"const START_SPEAKING_ACTIVITY = 'WEB_CHAT/START_SPEAKING';\n\nexport default function startSpeakingActivity() {\n return {\n type: START_SPEAKING_ACTIVITY\n };\n}\n\nexport { START_SPEAKING_ACTIVITY };\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"7eac3be90cd7e5f6f17d023aab21ef31\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 9,\n \"max_line_length\": 58,\n \"avg_line_length\": 22.11111111111111,\n \"alnum_prop\": 0.7336683417085427,\n \"repo_name\": \"billba/botchat\",\n \"id\": \"79122bd510580d9de64a80d13912e05cfbba5876\",\n \"size\": \"199\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"packages/core/src/actions/startSpeakingActivity.js\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"10340\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"1438\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"1845029\"\n },\n {\n \"name\": \"TypeScript\",\n \"bytes\": \"66519\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":967,"cells":{"text":{"kind":"string","value":"import hassapi as hass\nimport globals\n\n#\n# App to send notification when door opened or closed\n#\n# Args:\n#\n# sensor: sensor to monitor e.g. input_binary.hall\n#\n# Release Notes\n#\n# Version 1.0:\n# Initial Version\n\n\nclass DoorNotification(hass.Hass):\n def initialize(self):\n if \"sensor\" in self.args:\n for sensor in self.split_device_list(self.args[\"sensor\"]):\n self.listen_state(self.state_change, sensor)\n else:\n self.listen_state(self.motion, \"binary_sensor\")\n\n def state_change(self, entity, attribute, old, new, kwargs):\n if new == \"on\" or new == \"open\":\n state = \"open\"\n else:\n state = \"closed\"\n self.log(\"{} is {}\".format(self.friendly_name(entity), state))\n self.notify(\"{} is {}\".format(self.friendly_name(entity), state), name=globals.notify)\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"13a323a4821dcedf6eff673c8c4cbc91\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 31,\n \"max_line_length\": 94,\n \"avg_line_length\": 27.70967741935484,\n \"alnum_prop\": 0.6123399301513388,\n \"repo_name\": \"acockburn/appdaemon\",\n \"id\": \"90c00182e0eda9c5000fef827c9ad91ce04397f5\",\n \"size\": \"859\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"conf/example_apps/door_notification.py\",\n \"mode\": \"33261\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Python\",\n \"bytes\": \"96201\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"1768\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":968,"cells":{"text":{"kind":"string","value":"markTestIncomplete($this->getDriver() . ' is having trouble with binding params');\n }\n\n public function getDriver()\n {\n return 'Db2';\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c9afa57487a3e4542a8dabc3192386c6\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 36,\n \"max_line_length\": 97,\n \"avg_line_length\": 19.97222222222222,\n \"alnum_prop\": 0.6564673157162726,\n \"repo_name\": \"djozsef/zf1\",\n \"id\": \"98c7c7931006e0c1d81a53c86b87dafb071838fd\",\n \"size\": \"1481\",\n \"binary\": false,\n \"copies\": \"8\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"tests/Zend/Db/Profiler/Db2Test.php\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":969,"cells":{"text":{"kind":"string","value":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Runtime.InteropServices;\r\nusing System.Text;\r\n\r\nnamespace XbyakSharp\r\n{\r\n public class CPUID : CodeGenerator\r\n {\r\n [UnmanagedFunctionPointer(CallingConvention.Cdecl)]\r\n private delegate void GetCPUIDDelegate(int level, int[] result);\r\n\r\n private static CPUID instance = null;\r\n private static GetCPUIDDelegate func = null;\r\n\r\n static CPUID()\r\n {\r\n instance = new CPUID();\r\n func = instance.GetDelegate();\r\n }\r\n\r\n private CPUID()\r\n {\r\n if (Environment.Is64BitProcess)\r\n {\r\n mov(r9, rdx);\r\n mov(r10, rbx);\r\n mov(rax, rcx);\r\n cpuid();\r\n mov(dword[r9], eax);\r\n mov(dword[r9 + 4], ebx);\r\n mov(dword[r9 + 8], ecx);\r\n mov(dword[r9 + 12], edx);\r\n mov(rbx, r10);\r\n }\r\n else\r\n {\r\n push(ebx);\r\n push(esi);\r\n mov(eax, dword[esp + 8 + 4]);\r\n cpuid();\r\n mov(esi, dword[esp + 8 + 8]);\r\n mov(dword[esi], eax);\r\n mov(dword[esi + 4], ebx);\r\n mov(dword[esi + 8], ecx);\r\n mov(dword[esi + 12], edx);\r\n pop(esi);\r\n pop(ebx);\r\n }\r\n ret();\r\n }\r\n\r\n public static int[] Exec(int level)\r\n {\r\n int[] result = new int[4];\r\n func(level, result);\r\n\r\n return result;\r\n }\r\n }\r\n}\r\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"9734a1089e913cc1f8bdddb3325d15f0\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 62,\n \"max_line_length\": 72,\n \"avg_line_length\": 27.112903225806452,\n \"alnum_prop\": 0.4265318262938727,\n \"repo_name\": \"mes51/XbyakSharp\",\n \"id\": \"39fa78c67caec82e918fe5c3a71e3294690660a5\",\n \"size\": \"1683\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"XbyakSharp/CPUID.cs\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"C#\",\n \"bytes\": \"468913\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":970,"cells":{"text":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing MinorShift.Emuera.GameProc;\nusing MinorShift.Emuera.GameData.Variable;\n\nnamespace MinorShift.Emuera.GameData.Function\n{\n\tinternal sealed class UserDefinedRefMethod\n\t{\n\t\tpublic CalledFunction CalledFunction { get; private set; }\n\t\tpublic string Name { get; private set; }\n\t\tpublic Type RetType { get; private set; }\n\t\tpublic UserDifinedFunctionDataArgType[] ArgTypeList { get; private set; }\n\n\t\tinternal static UserDefinedRefMethod Create(UserDefinedFunctionData funcData)\n\t\t{\n\t\t\tUserDefinedRefMethod ret = new UserDefinedRefMethod();\n\t\t\tret.Name = funcData.Name;\n\t\t\tif (funcData.TypeIsStr)\n\t\t\t\tret.RetType = typeof(string);\n\t\t\telse\n\t\t\t\tret.RetType = typeof(Int64);\n\t\t\tret.ArgTypeList = funcData.ArgList;\n\t\t\treturn ret;\n\t\t}\n\n\t\t/// \n\t\t/// 戻り値と引数の数・型の完全一致が必要\n\t\t/// \n\t\t/// \n\t\t/// 一致ならtrue\n\t\tinternal bool MatchType(CalledFunction call)\n\t\t{\n\t\t\tFunctionLabelLine label = call.TopLabel;\n\t\t\tif (label.IsError)\n\t\t\t\treturn false;\n\t\t\tif (RetType != label.MethodType)\n\t\t\t\treturn false;\n\t\t\tif (ArgTypeList.Length != label.Arg.Length)\n\t\t\t\treturn false;\n\t\t\tfor (int i = 0; i < ArgTypeList.Length; i++)\n\t\t\t{\n\t\t\t\tVariableToken vToken = label.Arg[i].Identifier;\n\t\t\t\tif (vToken.IsReference)\n\t\t\t\t{\n\t\t\t\t\tUserDifinedFunctionDataArgType type = UserDifinedFunctionDataArgType.__Ref;\n\t\t\t\t\ttype += vToken.Dimension;\n\t\t\t\t\tif (vToken.IsInteger)\n\t\t\t\t\t\ttype |= UserDifinedFunctionDataArgType.Int;\n\t\t\t\t\telse\n\t\t\t\t\t\ttype |= UserDifinedFunctionDataArgType.Str;\n\t\t\t\t\tif (ArgTypeList[i] != type)\n\t\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tif (vToken.IsInteger && ArgTypeList[i] != UserDifinedFunctionDataArgType.Int)\n\t\t\t\t\t\treturn false;\n\t\t\t\t\tif (vToken.IsString && ArgTypeList[i] != UserDifinedFunctionDataArgType.Str)\n\t\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\t/// \n\t\t/// 戻り値と引数の数・型の完全一致が必要\n\t\t/// \n\t\t/// \n\t\t/// 一致ならtrue\n\t\tinternal bool MatchType(UserDefinedRefMethod rother)\n\t\t{\n\t\t\tif (RetType != rother.RetType)\n\t\t\t\treturn false;\n\t\t\tif (ArgTypeList.Length != rother.ArgTypeList.Length)\n\t\t\t\treturn false;\n\t\t\tfor (int i = 0; i < ArgTypeList.Length; i++)\n\t\t\t{\n\t\t\t\tif (ArgTypeList[i] != rother.ArgTypeList[i])\n\t\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\tinternal void SetReference(CalledFunction call)\n\t\t{\n\t\t\tCalledFunction = call;\n\t\t}\n\t}\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"addf252ad33d70eb33116468cae80775\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 91,\n \"max_line_length\": 83,\n \"avg_line_length\": 26.67032967032967,\n \"alnum_prop\": 0.6814997939843428,\n \"repo_name\": \"Riey/EmueraFramework\",\n \"id\": \"3405767ac10e582a5bfca221af80116573de469e\",\n \"size\": \"2517\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"Emuera/GameData/Function/UserDefinedRefMethod.cs\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"C#\",\n \"bytes\": \"1565329\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":971,"cells":{"text":{"kind":"string","value":"container);\n $p = new Project($this->container);\n $tc = new TaskCreation($this->container);\n $this->container['dispatcher']->addSubscriber(new WebhookSubscriber($this->container));\n\n $c->save(array('webhook_url' => 'http://localhost/?task-creation'));\n\n $this->assertEquals(1, $p->create(array('name' => 'test')));\n $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test')));\n\n $this->assertStringStartsWith('http://localhost/?task-creation&token=', $this->container['httpClient']->getUrl());\n\n $event = $this->container['httpClient']->getData();\n $this->assertNotEmpty($event);\n $this->assertArrayHasKey('event_name', $event);\n $this->assertArrayHasKey('event_data', $event);\n $this->assertEquals('task.create', $event['event_name']);\n $this->assertNotEmpty($event['event_data']);\n\n $this->assertArrayHasKey('project_id', $event['event_data']);\n $this->assertArrayHasKey('task_id', $event['event_data']);\n $this->assertArrayHasKey('title', $event['event_data']);\n $this->assertArrayHasKey('column_id', $event['event_data']);\n $this->assertArrayHasKey('color_id', $event['event_data']);\n $this->assertArrayHasKey('swimlane_id', $event['event_data']);\n $this->assertArrayHasKey('date_creation', $event['event_data']);\n $this->assertArrayHasKey('date_modification', $event['event_data']);\n $this->assertArrayHasKey('date_moved', $event['event_data']);\n $this->assertArrayHasKey('position', $event['event_data']);\n }\n\n public function testTaskModification()\n {\n $c = new Config($this->container);\n $p = new Project($this->container);\n $tc = new TaskCreation($this->container);\n $tm = new TaskModification($this->container);\n $this->container['dispatcher']->addSubscriber(new WebhookSubscriber($this->container));\n\n $c->save(array('webhook_url' => 'http://localhost/modif/'));\n\n $this->assertEquals(1, $p->create(array('name' => 'test')));\n $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test')));\n $this->assertTrue($tm->update(array('id' => 1, 'title' => 'test update')));\n\n $this->assertStringStartsWith('http://localhost/modif/?token=', $this->container['httpClient']->getUrl());\n\n $event = $this->container['httpClient']->getData();\n $this->assertNotEmpty($event);\n $this->assertArrayHasKey('event_name', $event);\n $this->assertArrayHasKey('event_data', $event);\n $this->assertEquals('task.update', $event['event_name']);\n $this->assertNotEmpty($event['event_data']);\n\n $this->assertArrayHasKey('project_id', $event['event_data']);\n $this->assertArrayHasKey('task_id', $event['event_data']);\n $this->assertArrayHasKey('title', $event['event_data']);\n $this->assertArrayHasKey('column_id', $event['event_data']);\n $this->assertArrayHasKey('color_id', $event['event_data']);\n $this->assertArrayHasKey('swimlane_id', $event['event_data']);\n $this->assertArrayHasKey('date_creation', $event['event_data']);\n $this->assertArrayHasKey('date_modification', $event['event_data']);\n $this->assertArrayHasKey('date_moved', $event['event_data']);\n $this->assertArrayHasKey('position', $event['event_data']);\n }\n\n public function testCommentCreation()\n {\n $c = new Config($this->container);\n $p = new Project($this->container);\n $tc = new TaskCreation($this->container);\n $cm = new Comment($this->container);\n $this->container['dispatcher']->addSubscriber(new WebhookSubscriber($this->container));\n\n $c->save(array('webhook_url' => 'http://localhost/comment'));\n\n $this->assertEquals(1, $p->create(array('name' => 'test')));\n $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test')));\n $this->assertEquals(1, $cm->create(array('task_id' => 1, 'comment' => 'test comment', 'user_id' => 1)));\n\n $this->assertStringStartsWith('http://localhost/comment?token=', $this->container['httpClient']->getUrl());\n\n $event = $this->container['httpClient']->getData();\n $this->assertNotEmpty($event);\n $this->assertArrayHasKey('event_name', $event);\n $this->assertArrayHasKey('event_data', $event);\n $this->assertEquals('comment.create', $event['event_name']);\n $this->assertNotEmpty($event['event_data']);\n\n $this->assertArrayHasKey('task_id', $event['event_data']);\n $this->assertArrayHasKey('user_id', $event['event_data']);\n $this->assertArrayHasKey('comment', $event['event_data']);\n $this->assertArrayHasKey('id', $event['event_data']);\n $this->assertEquals('test comment', $event['event_data']['comment']);\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"3788a859779f569b20cfc995f9a3202e\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 112,\n \"max_line_length\": 122,\n \"avg_line_length\": 46.294642857142854,\n \"alnum_prop\": 0.6167791706846673,\n \"repo_name\": \"fabiano-pereira/kanboard\",\n \"id\": \"946d744c8c961a97c93275564e2d8916b76b7664\",\n \"size\": \"5185\",\n \"binary\": false,\n \"copies\": \"17\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"tests/units/WebhookTest.php\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"ApacheConf\",\n \"bytes\": \"230\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"29876\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"54130\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"3923\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"2968349\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":972,"cells":{"text":{"kind":"string","value":"ACCEPTED\n\n#### According to\nIndex Fungorum\n\n#### Published in\nnull\n\n#### Original name\nnull\n\n### Remarks\nnull"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"5d238ec4cfda5e2db77aeed1ef6015c8\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 13,\n \"max_line_length\": 18,\n \"avg_line_length\": 8.384615384615385,\n \"alnum_prop\": 0.6788990825688074,\n \"repo_name\": \"mdoering/backbone\",\n \"id\": \"e0c509f9499321d6633330b1bbc43018b83e0214\",\n \"size\": \"154\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"life/Fungi/Ascomycota/Lecanoromycetes/Lecanorales/Catillariaceae/Catillaria/Catillaria chroolepus/README.md\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":973,"cells":{"text":{"kind":"string","value":"\n\n\n\n\ngit-remote-helpers\n\n\n\n\n
\n

git-remote-helpers

\n
\n
\n
\n
\n

This document has been moved to gitremote-helpers(1).

\n

Please let the owners of the referring site know so that they can update the\nlink you clicked to get here.

\n

Thanks.

\n
\n
\n
\n

\n
\n
\nLast updated 2013-08-20 08:40:27 PDT\n
\n
\n\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"ecd331af92af3974e3886a6f8d5257e6\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 757,\n \"max_line_length\": 126,\n \"avg_line_length\": 21.18758256274769,\n \"alnum_prop\": 0.6322713386121329,\n \"repo_name\": \"padamshrestha/portable_nodejs_git\",\n \"id\": \"194bfead8756d1eccf282d2823e760cfefcc6cc7\",\n \"size\": \"16039\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"Git/doc/git/html/git-remote-helpers.html\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"18617\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"275803\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"164357\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"15143\"\n },\n {\n \"name\": \"Emacs Lisp\",\n \"bytes\": \"30222\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"6835201\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"77298\"\n },\n {\n \"name\": \"M4\",\n \"bytes\": \"193907\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"2531\"\n },\n {\n \"name\": \"NewLisp\",\n \"bytes\": \"37316\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"5146825\"\n },\n {\n \"name\": \"Perl6\",\n \"bytes\": \"473997\"\n },\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"991\"\n },\n {\n \"name\": \"Prolog\",\n \"bytes\": \"553295\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"28952\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"273882\"\n },\n {\n \"name\": \"Smalltalk\",\n \"bytes\": \"25677\"\n },\n {\n \"name\": \"SystemVerilog\",\n \"bytes\": \"27798\"\n },\n {\n \"name\": \"Tcl\",\n \"bytes\": \"2257519\"\n },\n {\n \"name\": \"VimL\",\n \"bytes\": \"680966\"\n },\n {\n \"name\": \"Visual Basic\",\n \"bytes\": \"691\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"50637\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":974,"cells":{"text":{"kind":"string","value":"\npackage com.linecorp.armeria.server;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\n\nimport java.util.function.Function;\n\nimport org.junit.jupiter.api.Test;\n\nimport com.google.common.collect.ImmutableList;\n\nimport com.linecorp.armeria.client.ClientRequestContext;\nimport com.linecorp.armeria.common.HttpMethod;\nimport com.linecorp.armeria.common.HttpRequest;\nimport com.linecorp.armeria.common.QueryParams;\nimport com.linecorp.armeria.common.RequestContext;\nimport com.linecorp.armeria.common.annotation.Nullable;\nimport com.linecorp.armeria.common.util.SafeCloseable;\n\nclass ServiceRequestContextTest {\n\n @Test\n void current() {\n assertThatThrownBy(ServiceRequestContext::current).isInstanceOf(IllegalStateException.class)\n .hasMessageContaining(\"unavailable\");\n\n final ServiceRequestContext sctx = serviceRequestContext();\n try (SafeCloseable unused = sctx.push()) {\n assertThat(ServiceRequestContext.current()).isSameAs(sctx);\n final ClientRequestContext cctx = clientRequestContext();\n try (SafeCloseable unused1 = cctx.push()) {\n assertThat(ServiceRequestContext.current()).isSameAs(sctx);\n assertThat(ClientRequestContext.current()).isSameAs(cctx);\n assertThat((ClientRequestContext) RequestContext.current()).isSameAs(cctx);\n }\n assertCurrentCtx(sctx);\n }\n assertCurrentCtx(null);\n\n try (SafeCloseable unused = clientRequestContext().push()) {\n assertThatThrownBy(ServiceRequestContext::current)\n .isInstanceOf(IllegalStateException.class)\n .hasMessageContaining(\"not a server-side context\");\n }\n }\n\n @Test\n void currentOrNull() {\n assertThat(ServiceRequestContext.currentOrNull()).isNull();\n\n final ServiceRequestContext sctx = serviceRequestContext();\n try (SafeCloseable unused = sctx.push()) {\n assertThat(ServiceRequestContext.currentOrNull()).isSameAs(sctx);\n final ClientRequestContext cctx = clientRequestContext();\n try (SafeCloseable unused1 = cctx.push()) {\n assertThat(ServiceRequestContext.currentOrNull()).isSameAs(sctx);\n assertThat(ClientRequestContext.current()).isSameAs(cctx);\n assertThat((ClientRequestContext) RequestContext.current()).isSameAs(cctx);\n }\n assertCurrentCtx(sctx);\n }\n assertCurrentCtx(null);\n\n try (SafeCloseable unused = clientRequestContext().push()) {\n assertThat(ServiceRequestContext.currentOrNull()).isNull();\n }\n }\n\n @Test\n void mapCurrent() {\n assertThat(ServiceRequestContext.mapCurrent(ctx -> \"foo\", () -> \"defaultValue\"))\n .isEqualTo(\"defaultValue\");\n assertThat(ServiceRequestContext.mapCurrent(Function.identity(), null)).isNull();\n\n final ServiceRequestContext sctx = serviceRequestContext();\n try (SafeCloseable unused = sctx.push()) {\n assertThat(ServiceRequestContext.mapCurrent(c -> c == sctx ? \"foo\" : \"bar\",\n () -> \"defaultValue\"))\n .isEqualTo(\"foo\");\n assertThat(ServiceRequestContext.mapCurrent(Function.identity(), null)).isSameAs(sctx);\n final ClientRequestContext cctx = clientRequestContext();\n try (SafeCloseable unused1 = cctx.push()) {\n assertThat(ServiceRequestContext.mapCurrent(c -> c == sctx ? \"foo\" : \"bar\",\n () -> \"defaultValue\"))\n .isEqualTo(\"foo\");\n assertThat(ClientRequestContext.mapCurrent(c -> c == cctx ? \"baz\" : \"qux\",\n () -> \"defaultValue\"))\n .isEqualTo(\"baz\");\n assertThat(ServiceRequestContext.mapCurrent(Function.identity(), null)).isSameAs(sctx);\n assertThat(ClientRequestContext.mapCurrent(Function.identity(), null)).isSameAs(cctx);\n assertThat(RequestContext.mapCurrent(Function.identity(), null)).isSameAs(cctx);\n }\n assertCurrentCtx(sctx);\n }\n assertCurrentCtx(null);\n\n try (SafeCloseable unused = clientRequestContext().push()) {\n assertThatThrownBy(() -> ServiceRequestContext.mapCurrent(c -> \"foo\", () -> \"bar\"))\n .isInstanceOf(IllegalStateException.class)\n .hasMessageContaining(\"not a server-side context\");\n }\n }\n\n @Test\n void pushReentrance() {\n final ServiceRequestContext ctx = serviceRequestContext();\n try (SafeCloseable ignored = ctx.push()) {\n assertCurrentCtx(ctx);\n try (SafeCloseable ignored2 = ctx.push()) {\n assertCurrentCtx(ctx);\n }\n assertCurrentCtx(ctx);\n }\n assertCurrentCtx(null);\n }\n\n @Test\n void pushWithOldClientCtxWhoseRootIsThisServiceCtx() {\n final ServiceRequestContext sctx = serviceRequestContext();\n try (SafeCloseable ignored = sctx.push()) {\n assertCurrentCtx(sctx);\n // The root of ClientRequestContext is sctx.\n final ClientRequestContext cctx = clientRequestContext();\n try (SafeCloseable ignored1 = cctx.push()) {\n assertCurrentCtx(cctx);\n try (SafeCloseable ignored2 = sctx.push()) {\n assertCurrentCtx(sctx);\n }\n assertCurrentCtx(cctx);\n }\n assertCurrentCtx(sctx);\n }\n assertCurrentCtx(null);\n }\n\n @Test\n void pushWithOldIrrelevantClientCtx() {\n final ClientRequestContext cctx = clientRequestContext();\n try (SafeCloseable ignored = cctx.push()) {\n assertCurrentCtx(cctx);\n final ServiceRequestContext sctx = serviceRequestContext();\n assertThatThrownBy(sctx::push).isInstanceOf(IllegalStateException.class);\n }\n assertCurrentCtx(null);\n }\n\n @Test\n void pushWithOldIrrelevantServiceCtx() {\n final ServiceRequestContext sctx1 = serviceRequestContext();\n final ServiceRequestContext sctx2 = serviceRequestContext();\n try (SafeCloseable ignored = sctx1.push()) {\n assertCurrentCtx(sctx1);\n assertThatThrownBy(sctx2::push).isInstanceOf(IllegalStateException.class);\n }\n assertCurrentCtx(null);\n }\n\n @Test\n void queryParams() {\n final String path = \"/foo\";\n final QueryParams queryParams = QueryParams.of(\"param1\", \"value1\",\n \"param1\", \"value2\",\n \"Param1\", \"Value3\",\n \"PARAM1\", \"VALUE4\");\n final String pathAndQuery = path + '?' + queryParams.toQueryString();\n final ServiceRequestContext ctx = ServiceRequestContext.of(HttpRequest.of(HttpMethod.GET,\n pathAndQuery));\n\n assertThat(ctx.queryParams()).isEqualTo(queryParams);\n\n assertThat(ctx.queryParam(\"param1\")).isEqualTo(\"value1\");\n assertThat(ctx.queryParam(\"Param1\")).isEqualTo(\"Value3\");\n assertThat(ctx.queryParam(\"PARAM1\")).isEqualTo(\"VALUE4\");\n assertThat(ctx.queryParam(\"Not exist\")).isNull();\n\n assertThat(ctx.queryParams(\"param1\")).isEqualTo(ImmutableList.of(\"value1\", \"value2\"));\n assertThat(ctx.queryParams(\"Param1\")).isEqualTo(ImmutableList.of(\"Value3\"));\n assertThat(ctx.queryParams(\"PARAM1\")).isEqualTo(ImmutableList.of(\"VALUE4\"));\n assertThat(ctx.queryParams(\"Not exist\")).isEmpty();\n }\n\n private static void assertCurrentCtx(@Nullable RequestContext ctx) {\n final RequestContext current = RequestContext.currentOrNull();\n assertThat(current).isSameAs(ctx);\n }\n\n private static ServiceRequestContext serviceRequestContext() {\n return ServiceRequestContext.of(HttpRequest.of(HttpMethod.GET, \"/\"));\n }\n\n private static ClientRequestContext clientRequestContext() {\n return ClientRequestContext.of(HttpRequest.of(HttpMethod.GET, \"/\"));\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"0201dd7bf52a4510a8c57864116dc372\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 195,\n \"max_line_length\": 103,\n \"avg_line_length\": 43.38461538461539,\n \"alnum_prop\": 0.6112293144208037,\n \"repo_name\": \"minwoox/armeria\",\n \"id\": \"b4c157cc9ab7474c6f50c33f5b7db2965b99adde\",\n \"size\": \"9093\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"core/src/test/java/com/linecorp/armeria/server/ServiceRequestContextTest.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"7197\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"1222\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"16194263\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"26702\"\n },\n {\n \"name\": \"Kotlin\",\n \"bytes\": \"90127\"\n },\n {\n \"name\": \"Less\",\n \"bytes\": \"34341\"\n },\n {\n \"name\": \"Scala\",\n \"bytes\": \"209950\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"2062\"\n },\n {\n \"name\": \"Thrift\",\n \"bytes\": \"192676\"\n },\n {\n \"name\": \"TypeScript\",\n \"bytes\": \"243099\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":975,"cells":{"text":{"kind":"string","value":"\n\npackage sample.session;\n\nimport java.time.Duration;\nimport java.util.Base64;\n\nimport org.junit.jupiter.api.Test;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.boot.test.context.SpringBootTest;\nimport org.springframework.boot.web.server.LocalServerPort;\nimport org.springframework.http.HttpStatus;\nimport org.springframework.http.ResponseCookie;\nimport org.springframework.web.reactive.function.client.ClientResponse;\nimport org.springframework.web.reactive.function.client.WebClient;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\n/**\n * Integration tests for {@link SampleSessionWebFluxApplication}.\n *\n * @author Vedran Pavic\n */\n@SpringBootTest(properties = \"server.servlet.session.timeout:2\",\n\t\twebEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)\nclass SampleSessionWebFluxApplicationTests {\n\n\t@LocalServerPort\n\tprivate int port;\n\n\t@Autowired\n\tprivate WebClient.Builder webClientBuilder;\n\n\t@Test\n\tvoid userDefinedMappingsSecureByDefault() throws Exception {\n\t\tWebClient webClient = this.webClientBuilder\n\t\t\t\t.baseUrl(\"http://localhost:\" + this.port + \"/\").build();\n\t\tClientResponse response = webClient.get().header(\"Authorization\", getBasicAuth())\n\t\t\t\t.exchange().block(Duration.ofSeconds(30));\n\t\tassertThat(response.statusCode()).isEqualTo(HttpStatus.OK);\n\t\tResponseCookie sessionCookie = response.cookies().getFirst(\"SESSION\");\n\t\tString sessionId = response.bodyToMono(String.class)\n\t\t\t\t.block(Duration.ofSeconds(30));\n\t\tresponse = webClient.get().cookie(\"SESSION\", sessionCookie.getValue()).exchange()\n\t\t\t\t.block(Duration.ofSeconds(30));\n\t\tassertThat(response.statusCode()).isEqualTo(HttpStatus.OK);\n\t\tassertThat(response.bodyToMono(String.class).block(Duration.ofSeconds(30)))\n\t\t\t\t.isEqualTo(sessionId);\n\t\tThread.sleep(2000);\n\t\tresponse = webClient.get().cookie(\"SESSION\", sessionCookie.getValue()).exchange()\n\t\t\t\t.block(Duration.ofSeconds(30));\n\t\tassertThat(response.statusCode()).isEqualTo(HttpStatus.UNAUTHORIZED);\n\t}\n\n\tprivate String getBasicAuth() {\n\t\treturn \"Basic \" + Base64.getEncoder().encodeToString(\"user:password\".getBytes());\n\t}\n\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"e147f0acde58a3ccf396432c6fa58e38\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 60,\n \"max_line_length\": 83,\n \"avg_line_length\": 35.36666666666667,\n \"alnum_prop\": 0.7794533459000943,\n \"repo_name\": \"lburgazzoli/spring-boot\",\n \"id\": \"018d03267a4f6fe57dca328cafb8f5162889c101\",\n \"size\": \"2743\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"spring-boot-samples/spring-boot-sample-session-webflux/src/test/java/sample/session/SampleSessionWebFluxApplicationTests.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"6954\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"5769\"\n },\n {\n \"name\": \"FreeMarker\",\n \"bytes\": \"2134\"\n },\n {\n \"name\": \"Groovy\",\n \"bytes\": \"49512\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"69689\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"11602150\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"37789\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"1307\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"27916\"\n },\n {\n \"name\": \"Smarty\",\n \"bytes\": \"3276\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"34105\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":976,"cells":{"text":{"kind":"string","value":"// Generated by CoffeeScript 1.8.0\n\n\n\n(function() {\n angular.module(\"GScreen\").controller(\"Chromecasts\", function($scope, Chromecast, castAway) {\n\n castAway.initialize();\n $scope.chromecasts = Chromecast.query();\n $scope.chromecastAvailable = castAway.available;\n console.log(\"Initial Chromecast available\", $scope.chromecastAvailable);\n\n return castAway.on(\"receivers:available\", function() {\n $scope.$apply(function() {\n $scope.chromecastAvailable = true;\n return $scope.chromecastAvailable;\n });\n \n\n return console.log(\"Chromecast is available\", $scope.chromecastAvailable);\n });\n });\n\n}).call(this);\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"90348abefa22deff1fb2c2579e1dac38\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 24,\n \"max_line_length\": 96,\n \"avg_line_length\": 30.25,\n \"alnum_prop\": 0.6101928374655647,\n \"repo_name\": \"vitorismart/ChromeCast\",\n \"id\": \"358d281b8168a86ebbfc9726f831f4fef7505325\",\n \"size\": \"2210\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"target/client/controllers/chromecasts.js\",\n \"mode\": \"33188\",\n \"license\": \"bsd-3-clause\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"14339\"\n },\n {\n \"name\": \"CoffeeScript\",\n \"bytes\": \"744\"\n },\n {\n \"name\": \"Gnuplot\",\n \"bytes\": \"5822\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"123435\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"21591\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"1347\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"3465\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":977,"cells":{"text":{"kind":"string","value":"\n\n#ifndef __MEDIA_MEDIARECORDERIMPL_H\n#define __MEDIA_MEDIARECORDERIMPL_H\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \n#include \n#include \"OutputHandler.h\"\n#include \"MediaQueue.h\"\n#include \"RecorderObserverWorker.h\"\n\nusing namespace std;\n\nnamespace media {\n/**\n * @brief current state of MediaRecorder\n * @details @b #include \n * @since TizenRT v2.0\n */\ntypedef enum recorder_state_e {\n\t/** MediaRecorder object was created */\n\tRECORDER_STATE_NONE,\n\t/** MediaRecorder worker object was created */\n\tRECORDER_STATE_IDLE,\n\t/** MediaRecorder datasource configured */\n\tRECORDER_STATE_CONFIGURED,\n\t/** MediaRecorder ready to record */\n\tRECORDER_STATE_READY,\n\t/** MediaRecorder do recording */\n\tRECORDER_STATE_RECORDING,\n\t/** MediaRecorder pause to record */\n\tRECORDER_STATE_PAUSED\n} recorder_state_t;\n\nconst char *const recorder_state_names[] = {\n\t\"RECORDER_STATE_NONE\",\n\t\"RECORDER_STATE_IDLE\",\n\t\"RECORDER_STATE_CONFIGURED\",\n\t\"RECORDER_STATE_READY\",\n\t\"RECORDER_STATE_RECORDING\",\n\t\"RECORDER_STATE_PAUSED\",\n};\n\ntypedef enum recorder_observer_command_e {\n\tRECORDER_OBSERVER_COMMAND_STARTED,\n\tRECORDER_OBSERVER_COMMAND_PAUSED,\n\tRECORDER_OBSERVER_COMMAND_FINISHIED,\n\tRECORDER_OBSERVER_COMMAND_START_ERROR,\n\tRECORDER_OBSERVER_COMMAND_PAUSE_ERROR,\n\tRECORDER_OBSERVER_COMMAND_STOP_ERROR,\n\tRECORDER_OBSERVER_COMMAND_BUFFER_OVERRUN,\n\tRECORDER_OBSERVER_COMMAND_BUFFER_UNDERRUN,\n\tRECORDER_OBSERVER_COMMAND_BUFFER_DATAREACHED,\n} recorder_observer_command_t;\n\nclass MediaRecorderImpl : public enable_shared_from_this\n{\npublic:\n\tMediaRecorderImpl(MediaRecorder& recorder);\n\t~MediaRecorderImpl();\n\n\trecorder_result_t create();\n\trecorder_result_t destroy();\n\trecorder_result_t prepare();\n\trecorder_result_t unprepare();\n\n\trecorder_result_t start();\n\trecorder_result_t pause();\n\trecorder_result_t stop();\n\n\trecorder_result_t getVolume(uint8_t *vol);\n\trecorder_result_t getMaxVolume(uint8_t *vol);\n\trecorder_result_t setVolume(uint8_t vol);\n\trecorder_result_t setDataSource(std::unique_ptr dataSource);\n\trecorder_state_t getState();\n\trecorder_result_t setObserver(std::shared_ptr observer);\n\tbool isRecording();\n\trecorder_result_t setDuration(int second);\n\trecorder_result_t setFileSize(int byte);\n\tvoid notifySync();\n\tvoid notifyObserver(recorder_observer_command_t cmd, ...);\n\tvoid capture();\n\nprivate:\n\tvoid createRecorder(recorder_result_t& ret);\n\tvoid destroyRecorder(recorder_result_t& ret);\n\tvoid prepareRecorder(recorder_result_t& ret);\n\tvoid unprepareRecorder(recorder_result_t& ret);\n\tvoid startRecorder();\n\tvoid pauseRecorder();\n\tvoid stopRecorder(recorder_result_t ret);\n\tvoid getRecorderVolume(uint8_t *vol, recorder_result_t& ret);\n\tvoid getRecorderMaxVolume(uint8_t *vol, recorder_result_t& ret);\n\tvoid setRecorderVolume(uint8_t vol, recorder_result_t& ret);\n\tvoid setRecorderObserver(std::shared_ptr observer);\n\tvoid setRecorderDataSource(std::shared_ptr dataSource, recorder_result_t& ret);\n\tvoid setRecorderDuration(int second, recorder_result_t& ret);\n\tvoid setRecorderFileSize(int byte, recorder_result_t& ret);\n\nprivate:\n\tstd::atomic mCurState;\n\tstream::OutputHandler mOutputHandler;\n\tstd::shared_ptr mRecorderObserver;\n\n\tMediaRecorder& mRecorder;\n\tunsigned char* mBuffer;\n\tint mBuffSize;\n\tmutex mCmdMtx; // command mutex\n\tstd::condition_variable mSyncCv;\n\tint mDuration;\n\tint mFileSize;\n\tuint32_t mTotalFrames;\n\tuint32_t mCapturedFrames;\n};\n} // namespace media\n\n#endif\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"a3f4b35da3f0d9eeb5e5e785f8f3f4e4\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 126,\n \"max_line_length\": 106,\n \"avg_line_length\": 29.761904761904763,\n \"alnum_prop\": 0.7722666666666667,\n \"repo_name\": \"chanijjani/TizenRT\",\n \"id\": \"a61f21d7476dda0b91e503552b6f78e01c5241ad\",\n \"size\": \"4510\",\n \"binary\": false,\n \"copies\": \"12\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"framework/src/media/MediaRecorderImpl.h\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Assembly\",\n \"bytes\": \"415941\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"42646\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"65318395\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"1995766\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"2990\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"63595\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"737534\"\n },\n {\n \"name\": \"Objective-C\",\n \"bytes\": \"42504\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"4361\"\n },\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"8511\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"180702\"\n },\n {\n \"name\": \"Roff\",\n \"bytes\": \"4401\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"222522\"\n },\n {\n \"name\": \"Tcl\",\n \"bytes\": \"163693\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":978,"cells":{"text":{"kind":"string","value":"\n\npackage org.openehealth.ipf.platform.camel.ihe.fhir.iti83;\n\nimport ca.uhn.fhir.rest.server.exceptions.ForbiddenOperationException;\nimport org.hl7.fhir.r4.model.OperationOutcome;\nimport org.junit.jupiter.api.BeforeAll;\nimport org.junit.jupiter.api.Test;\n\nimport static org.junit.jupiter.api.Assertions.assertThrows;\n\n/**\n *\n */\npublic class TestIti83UnknownTarget extends AbstractTestIti83 {\n\n private static final String CONTEXT_DESCRIPTOR = \"iti-83-unknown-target.xml\";\n\n @BeforeAll\n public static void setUpClass() {\n startServer(CONTEXT_DESCRIPTOR);\n }\n\n @Test\n public void testSendManualPixm() {\n assertThrows(ForbiddenOperationException.class, ()->{\n try {\n sendManuallyOnType(validQueryParameters());\n } catch (ForbiddenOperationException e) {\n assertAndRethrow(e, OperationOutcome.IssueType.CODEINVALID);\n }\n });\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"42c6ae6c56be1b2e7b9d27202f9ddf4f\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 34,\n \"max_line_length\": 81,\n \"avg_line_length\": 27.41176470588235,\n \"alnum_prop\": 0.6952789699570815,\n \"repo_name\": \"oehf/ipf\",\n \"id\": \"348b7c0cf5809773aea5af87d39b90d59ff2b07b\",\n \"size\": \"1548\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"platform-camel/ihe/fhir/r4/pixpdq/src/test/java/org/openehealth/ipf/platform/camel/ihe/fhir/iti83/TestIti83UnknownTarget.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"2381\"\n },\n {\n \"name\": \"Groovy\",\n \"bytes\": \"1232218\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"11417\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"6734450\"\n },\n {\n \"name\": \"Kotlin\",\n \"bytes\": \"87953\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"553\"\n },\n {\n \"name\": \"XQuery\",\n \"bytes\": \"15044\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"567639\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":979,"cells":{"text":{"kind":"string","value":"FROM balenalib/beaglebone-pocket-debian:sid-run\n\nENV GO_VERSION 1.15.8\n\n# gcc for cgo\nRUN apt-get update && apt-get install -y --no-install-recommends \\\n\t\tg++ \\\n\t\tgcc \\\n\t\tlibc6-dev \\\n\t\tmake \\\n\t\tpkg-config \\\n\t\tgit \\\n\t&& rm -rf /var/lib/apt/lists/*\n\nRUN set -x \\\n\t&& fetchDeps=' \\\n\t\tcurl \\\n\t' \\\n\t&& apt-get update && apt-get install -y $fetchDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \\\n\t&& mkdir -p /usr/local/go \\\n\t&& curl -SLO \"http://resin-packages.s3.amazonaws.com/golang/v$GO_VERSION/go$GO_VERSION.linux-armv7hf.tar.gz\" \\\n\t&& echo \"bde22202576c3920ff5646fb1d19877cedc19501939d6ccd7b16ff89071abd0a go$GO_VERSION.linux-armv7hf.tar.gz\" | sha256sum -c - \\\n\t&& tar -xzf \"go$GO_VERSION.linux-armv7hf.tar.gz\" -C /usr/local/go --strip-components=1 \\\n\t&& rm -f go$GO_VERSION.linux-armv7hf.tar.gz\n\nENV GOROOT /usr/local/go\nENV GOPATH /go\nENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH\n\nRUN mkdir -p \"$GOPATH/src\" \"$GOPATH/bin\" && chmod -R 777 \"$GOPATH\"\nWORKDIR $GOPATH\n\nCMD [\"echo\",\"'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs\"]\n\n RUN curl -SLO \"https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@golang.sh\" \\\n && echo \"Running test-stack@golang\" \\\n && chmod +x test-stack@golang.sh \\\n && bash test-stack@golang.sh \\\n && rm -rf test-stack@golang.sh \n\nRUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \\nArchitecture: ARM v7 \\nOS: Debian Sid \\nVariant: run variant \\nDefault variable(s): UDEV=off \\nThe following software stack is preinstalled: \\nGo v1.15.8 \\nExtra features: \\n- Easy way to install packages with `install_packages ` command \\n- Run anywhere with cross-build feature (for ARM only) \\n- Keep the container idling with `balena-idle` command \\n- Show base image details with `balena-info` command' > /.balena/messages/image-info\n\nRUN echo '#!/bin/sh.real\\nbalena-info\\nrm -f /bin/sh\\ncp /bin/sh.real /bin/sh\\n/bin/sh \"$@\"' > /bin/sh-shim \\\n\t&& chmod +x /bin/sh-shim \\\n\t&& cp /bin/sh /bin/sh.real \\\n\t&& mv /bin/sh-shim /bin/sh"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c7d10d79b576c6f86f046a0f9b1401cb\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 46,\n \"max_line_length\": 669,\n \"avg_line_length\": 50.73913043478261,\n \"alnum_prop\": 0.7065124250214224,\n \"repo_name\": \"nghiant2710/base-images\",\n \"id\": \"e3414823c6f451adaa5da3263b3837a93f305117\",\n \"size\": \"2355\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"balena-base-images/golang/beaglebone-pocket/debian/sid/1.15.8/run/Dockerfile\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Dockerfile\",\n \"bytes\": \"144558581\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"16316\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"368690\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":980,"cells":{"text":{"kind":"string","value":"\npackage org.apache.wicket.protocol.ws.api.registry;\n\nimport java.util.Collection;\n\nimport org.apache.wicket.Application;\nimport org.apache.wicket.protocol.ws.api.IWebSocketConnection;\n\n/**\n * Tracks all currently connected WebSocket clients\n *\n * @since 6.0\n */\npublic interface IWebSocketConnectionRegistry\n{\n\t/**\n\t * @param application\n\t * the web application to look in\n\t * @param sessionId\n\t * the http session id\n\t * @param key\n\t * the web socket client key\n\t * @return the web socket connection used by a client from the specified coordinates\n\t */\n\tIWebSocketConnection getConnection(Application application, String sessionId, IKey key);\n\n\t/**\n\t * @param application\n\t * the web application to look in\n\t * @param sessionId\n\t * the http session id\n\t * @return collection of web socket connection used by a client with the given session id\n\t */\n\tCollection getConnections(Application application, String sessionId);\n\n\n\t/**\n\t * @param application\n\t * the web application to look in\n\t * @return collection of web socket connection used by any client connected to specified application\n\t */\n\tCollection getConnections(Application application);\n\n\t/**\n\t * Adds a new connection into the registry at the specified coordinates (application+session+page)\n\t *\n\t * @param application\n\t * the web application to look in\n\t * @param sessionId\n\t * the http session id\n\t * @param key\n\t * the web socket client key\n\t * @param connection\n\t * the web socket connection to add\n\t */\n\tvoid setConnection(Application application, String sessionId, IKey key, IWebSocketConnection connection);\n\n\t/**\n\t * Removes a web socket connection from the registry at the specified coordinates (application+session+page)\n\t *\n\t * @param application\n\t * the web application to look in\n\t * @param sessionId\n\t * the http session id\n\t * @param key\n\t * the web socket client key\n\t */\n\tvoid removeConnection(Application application, String sessionId, IKey key);\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"1e10e3874f02fd863830d409351b0882\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 69,\n \"max_line_length\": 109,\n \"avg_line_length\": 29.768115942028984,\n \"alnum_prop\": 0.7156767283349562,\n \"repo_name\": \"aldaris/wicket\",\n \"id\": \"2782a93b01c0113e19fa6629c68ead94761e7760\",\n \"size\": \"2856\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/IWebSocketConnectionRegistry.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"131341\"\n },\n {\n \"name\": \"Dockerfile\",\n \"bytes\": \"163\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"897448\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"12154156\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"540078\"\n },\n {\n \"name\": \"Logos\",\n \"bytes\": \"146\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"1547\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"26094\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"2162\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":981,"cells":{"text":{"kind":"string","value":"class CreateDynamicFieldDependencies < ActiveRecord::Migration\n def self.up\n create_table :dynamic_field_dependencies do |t|\n t.integer :child_id, :parent_id\n t.string :dependent_value\n end\n add_index :dynamic_field_dependencies, [:child_id, :parent_id], :unique => true, :name => 'index_df_dependencies'\n end\n\n def self.down\n drop_table :dynamic_field_dependencies\n end\nend\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"ad4f6db3eb28e808ed33cf01636a97e1\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 13,\n \"max_line_length\": 117,\n \"avg_line_length\": 30.846153846153847,\n \"alnum_prop\": 0.7057356608478803,\n \"repo_name\": \"netmediagroup/dynamic_form_builder\",\n \"id\": \"201b9979709014313b9f3d482a1cf02cf1e8d2e2\",\n \"size\": \"401\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"db/migrate/20090415200001_create_dynamic_field_dependencies.rb\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"Ruby\",\n \"bytes\": \"87687\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":982,"cells":{"text":{"kind":"string","value":"\n\nmodule.exports = angular.module('trafficPortal.form.user.new', [])\n .controller('FormNewUserController', require('./FormNewUserController'));\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"cdbaa50786d7b41ff04ffdcb6a9886c3\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 4,\n \"max_line_length\": 77,\n \"avg_line_length\": 36.75,\n \"alnum_prop\": 0.7414965986394558,\n \"repo_name\": \"serDrem/incubator-trafficcontrol\",\n \"id\": \"cdd08177f8a76ce07555ce4e96b4935448c29481\",\n \"size\": \"956\",\n \"binary\": false,\n \"copies\": \"14\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"traffic_portal/app/src/common/modules/form/user/new/index.js\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"21929\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"188879\"\n },\n {\n \"name\": \"Go\",\n \"bytes\": \"1377260\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"723492\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"1232975\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"1598022\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"1047\"\n },\n {\n \"name\": \"PLSQL\",\n \"bytes\": \"4308\"\n },\n {\n \"name\": \"PLpgSQL\",\n \"bytes\": \"70798\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"3472258\"\n },\n {\n \"name\": \"Perl 6\",\n \"bytes\": \"25530\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"92267\"\n },\n {\n \"name\": \"Roff\",\n \"bytes\": \"4011\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"4090\"\n },\n {\n \"name\": \"SQLPL\",\n \"bytes\": \"67758\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"166073\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":983,"cells":{"text":{"kind":"string","value":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Threading.Tasks;\r\nusing System.Web.Http;\r\nusing Xpressive.Home.Contracts.Rooms;\r\n\r\nnamespace Xpressive.Home.WebApi.Controllers\r\n{\r\n [RoutePrefix(\"api/v1/roomscriptgroup\")]\r\n public class RoomScriptGroupController : ApiController\r\n {\r\n private readonly IRoomRepository _roomRepository;\r\n private readonly IRoomScriptGroupRepository _repository;\r\n\r\n public RoomScriptGroupController(IRoomScriptGroupRepository repository, IRoomRepository roomRepository)\r\n {\r\n _repository = repository;\r\n _roomRepository = roomRepository;\r\n }\r\n\r\n [HttpGet, Route(\"{id}\")]\r\n public async Task Get(string id)\r\n {\r\n Guid guid;\r\n if (Guid.TryParse(id, out guid))\r\n {\r\n var group = await _repository.GetAsync(guid);\r\n\r\n if (group != null)\r\n {\r\n return Ok(group);\r\n }\r\n }\r\n\r\n return NotFound();\r\n }\r\n\r\n [HttpGet, Route(\"\")]\r\n public async Task> GetByRoom([FromUri] string roomId)\r\n {\r\n var rooms = await _roomRepository.GetAsync();\r\n var room = rooms.SingleOrDefault(r => r.Id.Equals(new Guid(roomId)));\r\n\r\n if (room == null)\r\n {\r\n return Enumerable.Empty();\r\n }\r\n\r\n var groups = await _repository.GetAsync(room);\r\n return groups;\r\n }\r\n\r\n [HttpPost, Route(\"{roomId}\")]\r\n public async Task Create(string roomId, [FromBody] RoomScriptGroup group)\r\n {\r\n var rooms = await _roomRepository.GetAsync();\r\n var room = rooms.SingleOrDefault(r => r.Id.Equals(new Guid(roomId)));\r\n\r\n if (room == null)\r\n {\r\n return null;\r\n }\r\n\r\n group = new RoomScriptGroup\r\n {\r\n Name = group.Name,\r\n Icon = string.Empty,\r\n RoomId = room.Id\r\n };\r\n\r\n await _repository.SaveAsync(group);\r\n\r\n return group;\r\n }\r\n\r\n [HttpPost, Route(\"\")]\r\n public async Task Save([FromBody] RoomScriptGroup group)\r\n {\r\n if (group == null || group.Id == Guid.Empty)\r\n {\r\n return NotFound();\r\n }\r\n\r\n var existing = await _repository.GetAsync(group.Id);\r\n\r\n if (existing == null)\r\n {\r\n return NotFound();\r\n }\r\n\r\n existing.Icon = group.Icon;\r\n existing.Name = group.Name;\r\n existing.SortOrder = group.SortOrder;\r\n\r\n await _repository.SaveAsync(existing);\r\n return Ok();\r\n }\r\n }\r\n}\r\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"9b6943e9af36cce0541fdc324d115681\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 100,\n \"max_line_length\": 111,\n \"avg_line_length\": 29.27,\n \"alnum_prop\": 0.5165698667577725,\n \"repo_name\": \"xpressive-websolutions/Xpressive.Home\",\n \"id\": \"c436ed5d161078475f4dcc53ced8f23eed3dcb9c\",\n \"size\": \"2927\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"Xpressive.Home.WebApi/Controllers/RoomScriptGroupController.cs\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"C#\",\n \"bytes\": \"557265\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"23005\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"59277\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"80498\"\n },\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"6096\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":984,"cells":{"text":{"kind":"string","value":"! Copyright (c) 2015 Alex Kramer \n! See the LICENSE.txt file at the top-level directory of this distribution.\n\nprogram scatter\n use progvars\n use setup, only: init\n use wfunc_prop, only: propagate\n use output, only: write_output\n\n implicit none\n\n call init\n call propagate\n call write_output\n\nend program scatter\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"839211f8e8d25178883459f95dd478dc\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 16,\n \"max_line_length\": 75,\n \"avg_line_length\": 21.9375,\n \"alnum_prop\": 0.7492877492877493,\n \"repo_name\": \"kramer314/qm-scattering\",\n \"id\": \"e72ec27421d98a75d5fc57dd7123df60f39e26f2\",\n \"size\": \"351\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"scatter.f90\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"FORTRAN\",\n \"bytes\": \"11654\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"374\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":985,"cells":{"text":{"kind":"string","value":"\n 5.2.0.0\n Twitter__Configuration\n \n \n http://www.mulesoft.org/schema/mule/twitter/get-user-timeline-by-screen-name\n \n \n __default__\n \n \n \n LIST\n \n \n \n \n Twitter__Configuration\n twitter4j.Status\n \n false\n \n \n \n FLOW\n \n \n \n \n \n \n \n INBOUND\n \n \n \n \n \n \n \n OUTBOUND\n \n \n \n \n \n \n \n SESSION\n \n \n \n \n \n \n \n RECORD\n \n \n \n \n \n \n \n \n \n \n \n \n \n http://www.mulesoft.org/schema/mule/twitter/update-status\n \n \n __default__\n \n \n \n Twitter__Configuration\n twitter4j.Status\n \n \n \n FLOW\n \n \n \n \n \n \n \n INBOUND\n \n \n \n \n \n \n \n OUTBOUND\n \n \n \n \n \n \n \n SESSION\n \n \n \n \n \n \n \n RECORD\n \n \n \n \n \n \n \n \n \n \n \n \n \n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"4431f6652592414c8c10d999f62e7d09\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 129,\n \"max_line_length\": 123,\n \"avg_line_length\": 53.51162790697674,\n \"alnum_prop\": 0.5780095610604086,\n \"repo_name\": \"vageeshs7/mule-esb-examples\",\n \"id\": \"360277b0b548f70e078b2ff90297771914c075ca\",\n \"size\": \"6903\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"varys-knows-twitter-connector/catalog/Twitter__Configuration__md__io__.xml\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":986,"cells":{"text":{"kind":"string","value":" 'text',\n\t\t\t'value' => htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8'),\n\t\t\t'name' => $this->name,\n\t\t\t'id' => $this->id,\n\t\t\t'size' => ($this->element['size'] ? (int) $this->element['size'] : ''),\n\t\t\t'maxlength' => ($this->element['maxlength'] ? (int) $this->element['maxlength'] : ''),\n\t\t\t'class' => 'orcid' . ($this->element['class'] ? (string) $this->element['class'] : ''),\n\t\t\t'autocomplete' => ((string) $this->element['autocomplete'] == 'off' ? 'off' : ''),\n\t\t\t'readonly' => ((string) $this->element['readonly'] == 'true' ? 'readonly' : ''),\n\t\t\t'disabled' => ((string) $this->element['disabled'] == 'true' ? 'disabled' : ''),\n\t\t\t'onchange' => ($this->element['onchange'] ? (string) $this->element['onchange'] : '')\n\t\t);\n\n\t\t$attr = array();\n\t\tforeach ($attributes as $key => $value)\n\t\t{\n\t\t\tif ($key != 'value' && !$value)\n\t\t\t{\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$attr[] = $key . '=\"' . $value . '\"';\n\t\t}\n\t\t$attr = implode(' ', $attr);\n\n\t\t$html = array();\n\n\t\t$html[] = '
';\n\t\t$html[] = '\t
';\n\t\t$html[] = '\t\t';\n\t\t$html[] = '\t\t';\n\t\t$html[] = '\t
';\n\t\t$html[] = '\t
';\n\t\t// Build the ORCID Create or Connect hyperlink\n\t\t$config = Component::params('com_members');\n\t\t$srv = $config->get('orcid_service', 'members');\n\t\t$clientID = $config->get('orcid_' . $srv . '_client_id', '');\n\t\t$redirectURI = $config->get('orcid_' . $srv . '_redirect_uri', '');\n\t\t$html[] = ' get('orcid_service', 'members') == 'sandbox')\n\t\t{\n\t\t\t$html[] = 'sandbox.';\n\t\t}\n\t $html[] = 'orcid.org/oauth/authorize?client_id=' . $clientID . htmlspecialchars('&') . 'response_type=code' . htmlspecialchars('&') . 'scope=/authenticate' . htmlspecialchars('&'). 'redirect_uri=' . urlencode($redirectURI)\n\t\t. '\" rel=\"nofollow external\">' . '\"iD\"/'\n\t\t. Lang::txt('COM_MEMBERS_PROFILE_ORCID_CREATE_OR_CONNECT') . '';\n\t\t$html[] = '\t
';\n\t\t$html[] = '
';\n\t\t$html[] = '

\"ORCID\" ' . Lang::txt('COM_MEMBERS_PROFILE_ORCID_ABOUT') . '

';\n\n\t\tBehavior::framework(true);\n\t\tBehavior::modal();\n\n\t\t$path = dirname(dirname(__DIR__)) . '/site/assets/js/orcid.js';\n\n\t\tif (file_exists($path))\n\t\t{\n\t\t\tDocument::addScript(Request::root(true) . 'core/components/com_members/site/assets/js/orcid.js?t=' . filemtime($path));\n\t\t}\n\n\t\treturn implode($html);\n\t}\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"b5e3062e7cdf7f6390049ebd8b42e5a6\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 95,\n \"max_line_length\": 227,\n \"avg_line_length\": 35.6,\n \"alnum_prop\": 0.562093435836783,\n \"repo_name\": \"zooley/hubzero-cms\",\n \"id\": \"33d37b00adb2096cfee8173861a234b37af053ab\",\n \"size\": \"3530\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"core/components/com_members/models/fields/orcid.php\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"ActionScript\",\n \"bytes\": \"171251\"\n },\n {\n \"name\": \"AngelScript\",\n \"bytes\": \"1638\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"2719736\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"1289374\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"12613354\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"24941743\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"10678\"\n },\n {\n \"name\": \"TSQL\",\n \"bytes\": \"572\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":987,"cells":{"text":{"kind":"string","value":"/*\n * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.\n *\n *\n *\n *\n *\n *\n *\n *\n *\n *\n *\n *\n *\n *\n *\n *\n *\n *\n *\n *\n */\n\n/*\n *\n *\n *\n *\n *\n * Written by Doug Lea with assistance from members of JCP JSR-166\n * Expert Group and released to the public domain, as explained at\n * http://creativecommons.org/publicdomain/zero/1.0/\n */\n\npackage java.util.concurrent.atomic;\nimport sun.misc.Unsafe;\n\n/**\n * An {@code int} value that may be updated atomically. See the\n * {@link java.util.concurrent.atomic} package specification for\n * description of the properties of atomic variables. An\n * {@code AtomicInteger} is used in applications such as atomically\n * incremented counters, and cannot be used as a replacement for an\n * {@link java.lang.Integer}. However, this class does extend\n * {@code Number} to allow uniform access by tools and utilities that\n * deal with numerically-based classes.\n *\n * @since 1.5\n * @author Doug Lea\n*/\npublic class AtomicInteger extends Number implements java.io.Serializable {\n private static final long serialVersionUID = 6214790243416807050L;\n\n // setup to use Unsafe.compareAndSwapInt for updates\n private static final Unsafe unsafe = Unsafe.getUnsafe();\n private static final long valueOffset;\n\n static {\n try {\n valueOffset = unsafe.objectFieldOffset\n (AtomicInteger.class.getDeclaredField(\"value\"));\n } catch (Exception ex) { throw new Error(ex); }\n }\n\n private volatile int value;\n\n /**\n * Creates a new AtomicInteger with the given initial value.\n *\n * @param initialValue the initial value\n */\n public AtomicInteger(int initialValue) {\n value = initialValue;\n }\n\n /**\n * Creates a new AtomicInteger with initial value {@code 0}.\n */\n public AtomicInteger() {\n }\n\n /**\n * Gets the current value.\n *\n * @return the current value\n */\n public final int get() {\n return value;\n }\n\n /**\n * Sets to the given value.\n *\n * @param newValue the new value\n */\n public final void set(int newValue) {\n value = newValue;\n }\n\n /**\n * Eventually sets to the given value.\n *\n * @param newValue the new value\n * @since 1.6\n */\n public final void lazySet(int newValue) {\n unsafe.putOrderedInt(this, valueOffset, newValue);\n }\n\n /**\n * Atomically sets to the given value and returns the old value.\n *\n * @param newValue the new value\n * @return the previous value\n */\n public final int getAndSet(int newValue) {\n for (;;) {\n int current = get();\n if (compareAndSet(current, newValue))\n return current;\n }\n }\n\n /**\n * Atomically sets the value to the given updated value\n * if the current value {@code ==} the expected value.\n *\n * @param expect the expected value\n * @param update the new value\n * @return true if successful. False return indicates that\n * the actual value was not equal to the expected value.\n */\n public final boolean compareAndSet(int expect, int update) {\n return unsafe.compareAndSwapInt(this, valueOffset, expect, update);\n }\n\n /**\n * Atomically sets the value to the given updated value\n * if the current value {@code ==} the expected value.\n *\n *

May fail spuriously\n * and does not provide ordering guarantees, so is only rarely an\n * appropriate alternative to {@code compareAndSet}.\n *\n * @param expect the expected value\n * @param update the new value\n * @return true if successful.\n */\n public final boolean weakCompareAndSet(int expect, int update) {\n return unsafe.compareAndSwapInt(this, valueOffset, expect, update);\n }\n\n /**\n * Atomically increments by one the current value.\n *\n * @return the previous value\n */\n public final int getAndIncrement() {\n for (;;) {\n int current = get();\n int next = current + 1;\n if (compareAndSet(current, next))\n return current;\n }\n }\n\n /**\n * Atomically decrements by one the current value.\n *\n * @return the previous value\n */\n public final int getAndDecrement() {\n for (;;) {\n int current = get();\n int next = current - 1;\n if (compareAndSet(current, next))\n return current;\n }\n }\n\n /**\n * Atomically adds the given value to the current value.\n *\n * @param delta the value to add\n * @return the previous value\n */\n public final int getAndAdd(int delta) {\n for (;;) {\n int current = get();\n int next = current + delta;\n if (compareAndSet(current, next))\n return current;\n }\n }\n\n /**\n * Atomically increments by one the current value.\n *\n * @return the updated value\n */\n public final int incrementAndGet() {\n for (;;) {\n int current = get();\n int next = current + 1;\n if (compareAndSet(current, next))\n return next;\n }\n }\n\n /**\n * Atomically decrements by one the current value.\n *\n * @return the updated value\n */\n public final int decrementAndGet() {\n for (;;) {\n int current = get();\n int next = current - 1;\n if (compareAndSet(current, next))\n return next;\n }\n }\n\n /**\n * Atomically adds the given value to the current value.\n *\n * @param delta the value to add\n * @return the updated value\n */\n public final int addAndGet(int delta) {\n for (;;) {\n int current = get();\n int next = current + delta;\n if (compareAndSet(current, next))\n return next;\n }\n }\n\n /**\n * Returns the String representation of the current value.\n * @return the String representation of the current value.\n */\n public String toString() {\n return Integer.toString(get());\n }\n\n\n public int intValue() {\n return get();\n }\n\n public long longValue() {\n return (long)get();\n }\n\n public float floatValue() {\n return (float)get();\n }\n\n public double doubleValue() {\n return (double)get();\n }\n\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"d13dd470698c748a69263bf8ebea3c66\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 265,\n \"max_line_length\": 75,\n \"avg_line_length\": 24.19622641509434,\n \"alnum_prop\": 0.5790704928259514,\n \"repo_name\": \"ZhaoX/jdk-1.7-annotated\",\n \"id\": \"07366aa2e1e24f31c8b175c64ec45dc5c9b00117\",\n \"size\": \"6412\",\n \"binary\": false,\n \"copies\": \"3\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/java/util/concurrent/atomic/AtomicInteger.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"23352747\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":988,"cells":{"text":{"kind":"string","value":".cascading-list \r\n{\r\n border: 1px solid #999;\r\n color: #333;\r\n}\r\n\r\n/*Clear fix*/\r\n.cascading-list:before, .cascading-list:after { content: \"\\0020\"; display: block; height: 0; overflow: hidden; }\r\n.cascading-list:after { clear: both; }\r\n.cascading-list { zoom: 1; }\r\n\r\n.cascading-list .selective \r\n{\r\n float: left;\r\n border: none;\r\n}\r\n\r\n.selective li\r\n{\r\n background-image: url('images/arrow-gradient.png');\r\n background-position: 99% center;\r\n background-repeat: no-repeat;\r\n overflow: hidden;\r\n}\r\n\r\n.selective-disabled li.selected\r\n{\r\n background-image: url('images/arrow-disabled.png');\r\n}\r\n\r\n.selective li.selected\r\n{\r\n background-image: url('images/arrow-solidgrey.png');\r\n}\r\n\r\n.selective:focus li.selected\r\n{\r\n background-image: url('images/arrow-white.png');\r\n}\r\n\r\n.selective li.no-children, .selective:focus li.no-children\r\n{\r\n background-image: none;\r\n}\r\n\r\n.selective li.active\r\n{\r\n background-color: #fff2ab;\r\n}\r\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"c0a326d4c42371ae1726b873571eecb0\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 49,\n \"max_line_length\": 112,\n \"avg_line_length\": 19.632653061224488,\n \"alnum_prop\": 0.6444906444906445,\n \"repo_name\": \"jondkoon/jquery.cascadingList\",\n \"id\": \"0e986699ccfa718b425b424ac3d991dff4b30fcf\",\n \"size\": \"964\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"jquery.cascadingList/jquery.cascadingList.css\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"21363\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":989,"cells":{"text":{"kind":"string","value":"goog.provide(\"trapeze.font.HmtxTable\");\r\ntrapeze.font.HmtxTable = function(ttf) {\n\t// the number of glyphs stored in the maxp table may be incorrect\n\t// in the case of subsetted fonts produced by some pdf generators\n\tvar maxp = ttf.getTable(\"maxp\");\n\tvar numGlyphs = maxp.numGlyphs;\n\n\tvar hhea = ttf.getTable(\"hhea\");\n\tvar numOfLongHorMetrics = hhea.numOfLongHorMetrics;\n\n\tthis.advanceWidths = []; //new short[numOfLongHorMetrics];\n\tthis.leftSideBearings = []; //new short[numGlyphs]; \n\tthis.setData = function(data) {\n\t\t// some PDF writers subset the font but don't update the number of glyphs in the maxp table,\n // this would appear to break the TTF spec.\n // A better solution might be to try and override the numGlyphs in the maxp table based\n // on the number of entries in the cmap table or by parsing the glyf table, but this\n // appears to be the only place that gets affected by the discrepancy... so far!...\n // so updating this allows it to work.\n var i;\n // only read as much data as is available\n for (i = 0; i < numGlyphs && data.hasRemaining(); i++) {\n if (i < numOfLongHorMetrics) {\n this.advanceWidths[i] = data.getShort();\n }\n \n this.leftSideBearings[i] = data.getShort();\n }\n // initialise the remaining advanceWidths and leftSideBearings to 0\n if (i < numOfLongHorMetrics) {\n for(var j = i; j < numOfLongHorMetrics; j++)\n\t\t\t\tthis.advanceWidths[i] = 0;\n }\n if (i < numGlyphs) {\n for(var j = i; j < numGlyphs; j++)\n\t\t\t\tthis.leftSideBearings[i] = 0;\n }\n\t};\n\t/** get the advance of a given glyph */\n this.getAdvance = function(glyphID) {\n if (glyphID < this.advanceWidths.length) {\n return this.advanceWidths[glyphID];\n } else {\n return this.advanceWidths[this.advanceWidths.length - 1];\n }\n };\n};"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"178062854137bf658c6d997380944c8b\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 47,\n \"max_line_length\": 95,\n \"avg_line_length\": 41.319148936170215,\n \"alnum_prop\": 0.621524201853759,\n \"repo_name\": \"AKamanjha/trapeze-reader\",\n \"id\": \"21795c2696790096ca86b4e99ff4096eb419aac3\",\n \"size\": \"1942\",\n \"binary\": false,\n \"copies\": \"5\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/font/HmtxTable.js\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"2571\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"8176\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"333536\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"5564\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":990,"cells":{"text":{"kind":"string","value":"\npackage org.apereo.portal.io.xml.portlettype;\n\nimport org.apereo.portal.security.IPermission;\n\n/**\n * Set of supported permissions that can be used in the element of a\n * portlet definition.\n *\n * @since 4.2\n */\npublic enum ExternalPermissionDefinition {\n SUBSCRIBE(IPermission.PORTAL_SUBSCRIBE, IPermission.PORTLET_SUBSCRIBER_ACTIVITY, false),\n BROWSE(IPermission.PORTAL_SUBSCRIBE, IPermission.PORTLET_BROWSE_ACTIVITY, true);\n\n private final String system;\n private final String activity;\n private boolean exportForPortletDef;\n\n ExternalPermissionDefinition(final String system, final String activity, final boolean export) {\n this.system = system;\n this.activity = activity;\n this.exportForPortletDef = export;\n }\n\n public String getSystem() {\n return system;\n }\n\n public String getActivity() {\n return activity;\n }\n\n public boolean getExportForPortletDef() {\n return exportForPortletDef;\n }\n\n @Override\n public String toString() {\n return system + \".\" + activity;\n }\n\n /**\n * Given a system and activity, attempt to lookup a matching ExternalPermissionDefinition.\n *\n * @param system the system to lookup\n * @param activity the activity to lookup\n * @return the matching permission if one can be found, otherwise null\n */\n public static ExternalPermissionDefinition find(String system, String activity) {\n for (ExternalPermissionDefinition perm : ExternalPermissionDefinition.values()) {\n if (perm.system.equalsIgnoreCase(system) && perm.activity.equalsIgnoreCase(activity)) {\n return perm;\n }\n }\n\n return null;\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"195b15d3728c49916f30624a65bd1675\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 59,\n \"max_line_length\": 100,\n \"avg_line_length\": 29.440677966101696,\n \"alnum_prop\": 0.6827864133563616,\n \"repo_name\": \"stalele/uPortal\",\n \"id\": \"4da8c08a1eca6301713c55d38b6508287809fff9\",\n \"size\": \"2526\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"uPortal-io/uPortal-io-types/src/main/java/org/apereo/portal/io/xml/portlettype/ExternalPermissionDefinition.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"238557\"\n },\n {\n \"name\": \"Groovy\",\n \"bytes\": \"56453\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"223563\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"9899148\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"811252\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"1769\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"3135\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"259363\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":991,"cells":{"text":{"kind":"string","value":"'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar AppConfigSettings = {\n name: 'Admin Panel',\n basename: 'http://localhost:8786',\n adminPath: '/r-admin',\n routerHistory: 'browserHistory',\n hot_reload: false,\n includeCoreData: {\n manifest: true,\n navigation: true\n },\n allHistoryOptions: 'browserHistory|hashHistory|createMemoryHistory',\n application: {\n environment: 'development',\n use_offline_cache: false\n },\n ui: {\n initialization: {\n show_header: false,\n show_footer: false,\n show_sidebar_overlay: true,\n refresh_manifests: true,\n refresh_navigation: true,\n refresh_components: true\n },\n notifications: {\n error_timeout: 10000,\n timed_timeout: 10000,\n hide_login_notification: false,\n supressResourceErrors: false\n },\n fixedSidebar: true,\n sidebarBG: '#ffffff',\n header: {\n isBold: true,\n color: 'isBlack',\n buttonColor: 'isWhite',\n useGlobalSearch: false,\n useHeaderLogout: false,\n customButton: false,\n navLabelStyle: {},\n containerStyle: {},\n userNameStyle: {}\n },\n footer: {\n navStyle: {}\n },\n sidebar: {\n containerStyle: {},\n use_floating_nav: false\n }\n },\n auth: {\n logged_in_homepage: '/r-admin/dashboard',\n logged_out_path: '/login'\n },\n login: {\n url: 'http://localhost:8786/api/jwt/token',\n devurl: 'http://localhost:8786/api/jwt/token',\n options: {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n clientid: 'fbff80bd23de5b1699cb595167370a1a',\n entitytype: 'account'\n }\n }\n },\n userprofile: {\n url: 'http://localhost:8786/api/jwt/profile',\n devurl: 'http://localhost:8786/api/jwt/profile',\n options: {\n method: 'POST',\n headers: {\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n clientid: 'fbff80bd23de5b1699cb595167370a1a',\n clientid_default: 'clientIDNEEDED',\n entitytype: 'account'\n }\n }\n }\n};\nexports.default = {\n pages: {\n LOAD_PAGE_ACTION: 'load page component',\n INITIAL_APP_LOADED: 'loaded initial app state',\n RESET_APP_LOADED: 'resetting initial app state',\n ASYNCSTORAGE_KEY: 'current_view',\n UPDATE_APP_DIMENSIONS: 'update dimensions state'\n },\n tabBarExtensions: {\n SET_EXTENSIONS_ACTION: 'set tabBarExtensions'\n },\n fetchData: {\n FETCH_DATA_REQUEST: 'fetching data request',\n FETCH_DATA_FAILURE: 'fetching data failed',\n FETCH_DATA_SUCCESS: 'fetching data succeeded'\n },\n user: {\n LOGIN_DATA_REQUEST: 'user logining data request',\n USER_DATA_FAILURE: 'user fetching data failed',\n LOGIN_DATA_SUCCESS: 'user login fetching data succeeded',\n SAVE_DATA_SUCCESS: 'user profile saving data succeeded',\n UPDATE_PROFILE_SUCCESS: 'user profile data updated',\n LOGOUT_REQUEST: 'user logout request',\n LOGOUT_SUCCESS: 'user logout succeeded',\n LOGOUT_FAILURE: 'user logout failed',\n PREFERENCE_LOAD_SUCCESS: 'preferences loaded',\n PREFERENCE_LOAD_ERROR: 'preferences failed',\n PREFERENCE_REQUEST: 'perferences request',\n NAVIGATION_LOAD_SUCCESS: 'navigation loaded',\n NAVIGATION_LOAD_ERROR: 'navigation failed',\n NAVIGATION_REQUEST: 'navigation request',\n MFA_AUTHENTICATED: 'mfa authenticated'\n // CURRENT_USER_STATUS:'get current login status', \n },\n clientCacheData: {\n CLIENT_CACHE_DATA_REQUEST: 'client cache data save request',\n CLIENT_CACHE_DATA_FAILURE: 'client cache data failed',\n CLIENT_CACHE_DATA_SUCCESS: 'client cache data succeeded'\n },\n dynamic: {\n SET_DYNAMIC_DATA: 'set dynamic data'\n // SHOW_ERROR:'show error notification',\n },\n output: {\n OUTPUT_FILE_DATA_SUCCESS: 'output data to file',\n OUTPUT_FILE_DATA_ERROR: 'error outputing data to file'\n // SHOW_ERROR:'show error notification',\n },\n jwt_token: {\n TOKEN_NAME: AppConfigSettings.name + '_jwt_token',\n TOKEN_DATA: AppConfigSettings.name + '_jwt_token_data',\n PROFILE_JSON: AppConfigSettings.name + '_jwt_profile'\n },\n cache: {\n CONFIGURATION_CACHE: AppConfigSettings.name + '_configuration'\n },\n manifest: {\n MANIFEST_DATA_REQUEST: 'manifest data request',\n MANIFEST_DATA_FAILURE: 'manifest data failed',\n MANIFEST_DATA_SUCCESS: 'manifest data succeeded',\n UNAUTHENTICATED_MANIFEST_DATA_REQUEST: 'unauthenticated manifest data request',\n UNAUTHENTICATED_MANIFEST_DATA_FAILURE: 'unauthenticated manifest data failed',\n UNAUTHENTICATED_MANIFEST_DATA_SUCCESS: 'unauthenticated manifest data succeeded'\n },\n notification: {\n SHOW_TIMED_NOTIFICATION: 'show timed notification',\n SHOW_STATIC_NOTIFICATION: 'show static notification',\n HIDE_NOTIFICATION: 'hide notification',\n FAILED_NOTIFICATION_CREATION: 'failed to create notification',\n SHOW_MODAL: 'show modal',\n HIDE_MODAL: 'hide modal'\n },\n ui: {\n TOGGLE_SIDEBAR: 'toggle side menu',\n OPEN_SIDEBAR: 'open side menu',\n CLOSE_SIDEBAR: 'close side menu',\n SET_UI_LOADED: 'set ui loaded state',\n SET_NAV_LABEL: 'set navigation label',\n LOAD_NAV_DATA_SUCCESS: 'set nav ui loaded state',\n LOGIN_COMPONENT: 'fetchLoginComponent',\n MAIN_COMPONENT: 'fetchMainComponent',\n ERROR_COMPONENTS: 'fetchErrorComponents',\n SET_SELECTED_NAV_STATE: 'making nav item active'\n // GET_APP_STATE:'get current app state',\n },\n settings: {\n UPDATE_APP_SETTINGS: 'update application settings'\n }\n};"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"f65b217a086242ffe3f42f9acda08267\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 176,\n \"max_line_length\": 84,\n \"avg_line_length\": 31.164772727272727,\n \"alnum_prop\": 0.6641750227894258,\n \"repo_name\": \"typesettin/periodicjs.ext.reactadmin\",\n \"id\": \"cda69b05de0d82cc0e8b53bc044b90e0979939f0\",\n \"size\": \"5485\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"adminclient/_src/constants/index.js\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"3282\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"148597\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"1262207\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":992,"cells":{"text":{"kind":"string","value":"\n\n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"3da76472e2930d57e8097033db9e9889\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 63,\n \"max_line_length\": 79,\n \"avg_line_length\": 33.12698412698413,\n \"alnum_prop\": 0.5764254911356014,\n \"repo_name\": \"DemonHunterzty/CoolWeather\",\n \"id\": \"544519142c753b959392f5b406be088a1ec2eb14\",\n \"size\": \"2087\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"app/src/main/res/layout/activity_weather.xml\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Java\",\n \"bytes\": \"33698\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":993,"cells":{"text":{"kind":"string","value":"\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Management.Automation.Internal;\nusing System.Management.Automation.Language;\nusing System.Management.Automation.Runspaces;\nusing System.Management.Automation.Tracing;\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Security;\nusing System.Text;\nusing System.Xml;\nusing Microsoft.Management.Infrastructure;\nusing Microsoft.Management.Infrastructure.Serialization;\nusing Microsoft.PowerShell.Commands;\nusing Dbg = System.Management.Automation.Diagnostics;\nusing System.Management.Automation.Remoting;\n\n#if CORECLR\n// Use stubs for SerializableAttribute and ISerializable related types\nusing Microsoft.PowerShell.CoreClr.Stubs;\n#else\nusing MailAddress = System.Net.Mail.MailAddress;\n#endif\n\nnamespace System.Management.Automation\n{\n [Flags]\n internal enum SerializationOptions\n {\n None = 0,\n UseDepthFromTypes = 1,\n NoRootElement = 2,\n NoNamespace = 4,\n NoObjectRefIds = 8,\n PreserveSerializationSettingOfOriginal = 16,\n\n RemotingOptions = UseDepthFromTypes | NoRootElement | NoNamespace | PreserveSerializationSettingOfOriginal,\n }\n\n internal class SerializationContext\n {\n private const int DefaultSerializationDepth = 2;\n\n internal SerializationContext()\n : this(DefaultSerializationDepth, true)\n {\n }\n\n internal SerializationContext(int depth, bool useDepthFromTypes)\n : this(\n depth,\n (useDepthFromTypes ? SerializationOptions.UseDepthFromTypes : SerializationOptions.None) |\n SerializationOptions.PreserveSerializationSettingOfOriginal,\n null)\n {\n }\n\n internal SerializationContext(int depth, SerializationOptions options, PSRemotingCryptoHelper cryptoHelper)\n {\n if (depth < 1)\n {\n throw PSTraceSource.NewArgumentException(\"writer\", Serialization.DepthOfOneRequired);\n }\n\n this.depth = depth;\n this.options = options;\n this.cryptoHelper = cryptoHelper;\n }\n\n internal readonly int depth;\n internal readonly SerializationOptions options;\n internal readonly PSRemotingCryptoHelper cryptoHelper;\n\n internal readonly CimClassSerializationCache cimClassSerializationIdCache = new CimClassSerializationCache();\n }\n\n ///

\n /// This class provides public functionality for serializing a PSObject\n /// \n public class PSSerializer\n {\n internal PSSerializer() { }\n\n /// \n /// Serializes an object into PowerShell CliXml\n /// \n /// The input object to serialize. Serializes to a default depth of 1\n /// The serialized object, as CliXml\n public static string Serialize(Object source)\n {\n return Serialize(source, s_mshDefaultSerializationDepth);\n }\n\n /// \n /// Serializes an object into PowerShell CliXml\n /// \n /// The input object to serialize\n /// The depth of the members to serialize\n /// The serialized object, as CliXml\n public static string Serialize(Object source, int depth)\n {\n // Create an xml writer\n StringBuilder sb = new StringBuilder();\n XmlWriterSettings xmlSettings = new XmlWriterSettings();\n xmlSettings.CloseOutput = true;\n xmlSettings.Encoding = System.Text.Encoding.Unicode;\n xmlSettings.Indent = true;\n xmlSettings.OmitXmlDeclaration = true;\n XmlWriter xw = XmlWriter.Create(sb, xmlSettings);\n\n // Serialize the objects\n Serializer serializer = new Serializer(xw, depth, true);\n serializer.Serialize(source);\n serializer.Done();\n serializer = null;\n\n // Return the output\n return sb.ToString();\n }\n\n /// \n /// Deserializes PowerShell CliXml into an object.\n /// \n /// The CliXml the represents the object to deserialize.\n /// An object that represents the serialized content\n public static object Deserialize(string source)\n {\n Object[] results = DeserializeAsList(source);\n\n // Return the results\n if (results.Length == 0)\n {\n return null;\n }\n else if (results.Length == 1)\n {\n return results[0];\n }\n else\n {\n return results;\n }\n }\n\n /// \n /// Deserializes PowerShell CliXml into a list of objects.\n /// \n /// The CliXml the represents the object to deserialize.\n /// An object array represents the serialized content\n public static object[] DeserializeAsList(string source)\n {\n List results = new List();\n\n // Create the text reader to hold the content\n TextReader textReader = new StringReader(source);\n XmlReader xmlReader = XmlReader.Create(textReader, InternalDeserializer.XmlReaderSettingsForCliXml);\n\n // Deserialize the content\n Deserializer deserializer = new Deserializer(xmlReader);\n while (!deserializer.Done())\n {\n object result = deserializer.Deserialize();\n results.Add(result);\n }\n\n return results.ToArray();\n }\n\n /// \n /// Default depth of serialization\n /// \n private static int s_mshDefaultSerializationDepth = 1;\n }\n\n /// \n /// This class provides functionality for serializing a PSObject\n /// \n internal class Serializer\n {\n #region constructor\n\n private readonly InternalSerializer _serializer;\n\n /// \n /// Creates a Serializer using default serialization context\n /// \n /// writer to be used for serialization\n internal Serializer(XmlWriter writer)\n : this(writer, new SerializationContext())\n {\n }\n\n /// \n /// Creates a Serializer using specified serialization context\n /// \n /// writer to be used for serialization\n /// depth of serialization\n /// \n /// if true then types.ps1xml can override depth\n /// for a particular types (using SerializationDepth property)\n /// \n internal Serializer(XmlWriter writer, int depth, bool useDepthFromTypes)\n : this(writer, new SerializationContext(depth, useDepthFromTypes))\n {\n }\n\n /// \n /// Creates a Serializer using specified serialization context\n /// \n /// writer to be used for serialization\n /// serialization context\n internal Serializer(XmlWriter writer, SerializationContext context)\n {\n if (writer == null)\n {\n throw PSTraceSource.NewArgumentException(\"writer\");\n }\n if (context == null)\n {\n throw PSTraceSource.NewArgumentException(\"context\");\n }\n\n _serializer = new InternalSerializer(writer, context);\n _serializer.Start();\n }\n\n #endregion constructor\n\n #region public methods / properties\n\n /// \n /// Used by Remoting infrastructure. This TypeTable instance\n /// will be used by Serializer if ExecutionContext is not\n /// available (to get the ExecutionContext's TypeTable)\n /// \n internal TypeTable TypeTable\n {\n get { return _serializer.TypeTable; }\n set { _serializer.TypeTable = value; }\n }\n\n /// \n /// Serializes the object\n /// \n /// object to be serialized\n /// \n /// Please note that this method shouldn't throw any exceptions. \n /// If it throws - please open a bug.\n /// \n internal void Serialize(object source)\n {\n Serialize(source, null);\n }\n\n /// \n /// Serializes passed in object\n /// \n /// \n /// object to be serialized\n /// \n /// \n /// Stream to which this object belong. Ex: Output, Error etc.\n /// \n /// \n /// Please note that this method shouldn't throw any exceptions. \n /// If it throws - please open a bug.\n /// \n internal void Serialize(object source, string streamName)\n {\n _serializer.WriteOneTopLevelObject(source, streamName);\n }\n\n /// \n /// Write the end of root element\n /// \n internal void Done()\n {\n _serializer.End();\n }\n\n internal void Stop()\n {\n _serializer.Stop();\n }\n\n #endregion\n }\n\n [Flags]\n internal enum DeserializationOptions\n {\n None = 0,\n NoRootElement = 256, // I start at 256 to try not to overlap \n NoNamespace = 512, // with SerializationOptions and to catch bugs early\n DeserializeScriptBlocks = 1024,\n\n RemotingOptions = NoRootElement | NoNamespace,\n }\n\n internal class DeserializationContext\n {\n internal DeserializationContext()\n : this(DeserializationOptions.None, null)\n {\n }\n\n internal DeserializationContext(DeserializationOptions options, PSRemotingCryptoHelper cryptoHelper)\n {\n this.options = options;\n this.cryptoHelper = cryptoHelper;\n }\n\n /// \n /// Limits the total data processed by the deserialization context. Deserialization context\n /// is used by PriorityReceivedDataCollection (remoting) to process incoming data from the\n /// remote end. A value of Null means that the max memory is unlimited.\n /// \n internal Nullable MaximumAllowedMemory { set; get; }\n\n /// \n /// Logs that memory used by deserialized objects is not related to the size of input xml.\n /// Used mainly to account for memory usage of cloned TypeNames when calculating memory quota usage.\n /// \n /// \n internal void LogExtraMemoryUsage(int amountOfExtraMemory)\n {\n if (amountOfExtraMemory < 0)\n {\n return;\n }\n\n if (MaximumAllowedMemory.HasValue)\n {\n if (amountOfExtraMemory > (MaximumAllowedMemory.Value - _totalDataProcessedSoFar))\n {\n string message = StringUtil.Format(Serialization.DeserializationMemoryQuota, ((double)MaximumAllowedMemory.Value) / (1 << 20),\n ConfigurationDataFromXML.MAXRCVDOBJSIZETOKEN_CamelCase,\n ConfigurationDataFromXML.MAXRCVDCMDSIZETOKEN_CamelCase);\n throw new XmlException(message);\n }\n\n _totalDataProcessedSoFar = _totalDataProcessedSoFar + amountOfExtraMemory;\n }\n }\n\n private int _totalDataProcessedSoFar;\n\n internal readonly DeserializationOptions options;\n internal readonly PSRemotingCryptoHelper cryptoHelper;\n\n internal static int MaxItemsInCimClassCache = 100;\n internal readonly CimClassDeserializationCache cimClassSerializationIdCache = new CimClassDeserializationCache();\n }\n\n internal class CimClassDeserializationCache\n {\n private readonly Dictionary _cimClassIdToClass = new Dictionary();\n\n internal void AddCimClassToCache(TKey key, CimClass cimClass)\n {\n if (_cimClassIdToClass.Count >= DeserializationContext.MaxItemsInCimClassCache)\n {\n _cimClassIdToClass.Clear();\n }\n _cimClassIdToClass.Add(key, cimClass);\n\n /* PRINTF DEBUG\n\t\t\tConsole.WriteLine(\"Contents of deserialization cache (after a call to AddCimClassToCache ({0})):\", key);\n\t\t\tConsole.WriteLine(\" Count = {0}\", this._cimClassIdToClass.Count);\n\t\t\tforeach (var t in this._cimClassIdToClass.Keys)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\" {0}\", t);\n\t\t\t}\n\t\t\t */\n }\n\n internal CimClass GetCimClassFromCache(TKey key)\n {\n CimClass cimClass;\n if (_cimClassIdToClass.TryGetValue(key, out cimClass))\n {\n /* PRINTF DEBUG\n\t\t\t\tConsole.WriteLine(\"GetCimClassFromCache - class found: {0}\", key);\n\t\t\t\t */\n\n return cimClass;\n }\n\n /* PRINTF DEBUG\n\t\t\tConsole.WriteLine(\"GetCimClassFromCache - class NOT found: {0}\", key);\n\t\t\t */\n\n return null;\n }\n }\n\n internal class CimClassSerializationCache\n {\n private readonly HashSet _cimClassesHeldByDeserializer = new HashSet(EqualityComparer.Default);\n\n internal bool DoesDeserializerAlreadyHaveCimClass(TKey key)\n {\n return _cimClassesHeldByDeserializer.Contains(key);\n }\n\n internal void AddClassToCache(TKey key)\n {\n Dbg.Assert(!_cimClassesHeldByDeserializer.Contains(key), \"This method should not be called for classes already in the cache\");\n\n if (_cimClassesHeldByDeserializer.Count >= DeserializationContext.MaxItemsInCimClassCache)\n {\n _cimClassesHeldByDeserializer.Clear();\n }\n _cimClassesHeldByDeserializer.Add(key);\n\n /* PRINTF DEBUG\n\t\t\tConsole.WriteLine(\"Contents of serialization cache (after adding {0}):\", key);\n\t\t\tConsole.WriteLine(\" Count = {0}\", this._cimClassesHeldByDeserializer.Count);\n\t\t\tforeach (var t in _cimClassesHeldByDeserializer)\n\t\t\t{\n\t\t\t\tConsole.WriteLine(\" {0}\", t);\n\t\t\t}\n\t\t\t */\n }\n }\n\n internal class CimClassSerializationId : Tuple\n {\n public CimClassSerializationId(string className, string namespaceName, string computerName, int hashCode)\n : base(className, namespaceName, computerName, hashCode)\n {\n }\n\n public string ClassName { get { return this.Item1; } }\n public string NamespaceName { get { return this.Item2; } }\n public string ComputerName { get { return this.Item3; } }\n public int ClassHashCode { get { return this.Item4; } }\n }\n\n /// \n /// This class provides functionality for deserializing a PSObject\n /// \n internal class Deserializer\n {\n #region constructor\n\n private readonly XmlReader _reader;\n private readonly InternalDeserializer _deserializer;\n private readonly DeserializationContext _context;\n\n /// \n /// Creates a Deserializer using default deserialization context\n /// \n /// reader to be used for deserialization\n /// \n /// Thrown when the xml is in an incorrect format\n /// \n internal Deserializer(XmlReader reader)\n : this(reader, new DeserializationContext())\n {\n }\n\n /// \n /// Creates a Deserializer using specified serialization context\n /// \n /// reader to be used for deserialization\n /// serialization context\n /// \n /// Thrown when the xml is in an incorrect format\n /// \n internal Deserializer(XmlReader reader, DeserializationContext context)\n {\n if (reader == null)\n {\n throw PSTraceSource.NewArgumentNullException(\"reader\");\n }\n\n _reader = reader;\n _context = context;\n _deserializer = new InternalDeserializer(_reader, _context);\n\n try\n {\n Start();\n }\n catch (XmlException exception)\n {\n ReportExceptionForETW(exception);\n throw;\n }\n }\n\n #endregion constructor\n\n #region public method / properties\n\n private static void ReportExceptionForETW(XmlException exception)\n {\n PSEtwLog.LogAnalyticError(\n PSEventId.Serializer_XmlExceptionWhenDeserializing, PSOpcode.Exception, PSTask.Serialization,\n PSKeyword.Serializer | PSKeyword.UseAlwaysAnalytic,\n exception.LineNumber, exception.LinePosition, exception.ToString());\n }\n\n private bool _done = false;\n\n /// \n /// Used by Remoting infrastructure. This TypeTable instance\n /// will be used by Deserializer if ExecutionContext is not\n /// available (to get the ExecutionContext's TypeTable)\n /// \n internal TypeTable TypeTable\n {\n get { return _deserializer.TypeTable; }\n set { _deserializer.TypeTable = value; }\n }\n\n /// \n /// Read the root element tag and set the cursor to start tag of \n /// first object.\n /// \n private void Start()\n {\n Dbg.Assert(_reader.ReadState == ReadState.Initial, \"When deserialization starts we should have XmlReader.ReadState == Initial\");\n Dbg.Assert(_reader.NodeType == XmlNodeType.None, \"When deserialization starts we should have XmlReader.NodeType == None\");\n _reader.Read();\n\n //If version is not provided, we assume it is the default\n string version = InternalSerializer.DefaultVersion;\n if (DeserializationOptions.NoRootElement == (_context.options & DeserializationOptions.NoRootElement))\n {\n _done = _reader.EOF;\n }\n else\n {\n // Make sure the reader is positioned on the root ( ) element (not on XmlDeclaration for example)\n _reader.MoveToContent();\n Dbg.Assert(_reader.EOF || (_reader.NodeType == XmlNodeType.Element), \"When deserialization starts reading we should have XmlReader.NodeType == Element\");\n\n //Read version attribute and validate it.\n string versionAttribute = _reader.GetAttribute(SerializationStrings.VersionAttribute);\n if (versionAttribute != null)\n {\n version = versionAttribute;\n }\n\n //If the root element tag is empty, there are no objects to read.\n if (!_deserializer.ReadStartElementAndHandleEmpty(SerializationStrings.RootElementTag))\n {\n _done = true;\n }\n }\n _deserializer.ValidateVersion(version);\n }\n\n internal bool Done()\n {\n if (_done == false)\n {\n if (DeserializationOptions.NoRootElement == (_context.options & DeserializationOptions.NoRootElement))\n {\n _done = _reader.EOF;\n }\n else\n {\n if (_reader.NodeType == XmlNodeType.EndElement)\n {\n try\n {\n _reader.ReadEndElement();\n }\n catch (XmlException exception)\n {\n ReportExceptionForETW(exception);\n throw;\n }\n _done = true;\n }\n }\n }\n return _done;\n }\n\n internal void Stop()\n {\n _deserializer.Stop();\n }\n\n /// \n /// Deserializes next object.\n /// \n /// \n /// Thrown when the xml is in an incorrect format\n /// \n internal object Deserialize()\n {\n string ignore;\n return Deserialize(out ignore);\n }\n\n /// \n /// Deserializes next object.\n /// \n /// stream the object belongs to (i.e. \"Error\", \"Output\", etc.)\n /// \n /// Thrown when the xml is in an incorrect format\n /// \n internal object Deserialize(out string streamName)\n {\n if (Done())\n {\n throw PSTraceSource.NewInvalidOperationException(Serialization.ReadCalledAfterDone);\n }\n\n try\n {\n return _deserializer.ReadOneObject(out streamName);\n }\n catch (XmlException exception)\n {\n ReportExceptionForETW(exception);\n throw;\n }\n }\n\n #endregion public methods\n\n #region Helper methods for dealing with \"Deserialized.\" prefix\n\n /// \n /// Adds \"Deserialized.\" prefix to passed in argument if not already present\n /// \n /// \n internal static void AddDeserializationPrefix(ref string type)\n {\n Dbg.Assert(type != null, \"caller should validate the parameter\");\n if (!type.StartsWith(Deserializer.DeserializationTypeNamePrefix, StringComparison.OrdinalIgnoreCase))\n {\n type = type.Insert(0, Deserializer.DeserializationTypeNamePrefix);\n }\n }\n\n /// \n /// Checks if an object is either a live or deserialized instance of class or one of its subclasses.\n /// \n /// \n /// \n /// true if is either a live or deserialized instance of class or one of its subclasses; false otherwise\n internal static bool IsInstanceOfType(object o, Type type)\n {\n if (type == null)\n {\n throw PSTraceSource.NewArgumentNullException(\"type\");\n }\n if (o == null)\n {\n return false;\n }\n\n return type.IsInstanceOfType(PSObject.Base(o)) || IsDeserializedInstanceOfType(o, type);\n }\n\n /// \n /// Checks if an object is a deserialized instance of class or one of its subclasses.\n /// \n /// \n /// \n /// true if is a deserialized instance of class or one of its subclasses; false otherwise\n internal static bool IsDeserializedInstanceOfType(object o, Type type)\n {\n if (type == null)\n {\n throw PSTraceSource.NewArgumentNullException(\"type\");\n }\n if (o == null)\n {\n return false;\n }\n\n PSObject pso = o as PSObject;\n if (pso != null)\n {\n IEnumerable typeNames = pso.InternalTypeNames;\n if (typeNames != null)\n {\n foreach (string typeName in typeNames)\n {\n if (typeName.Length == Deserializer.DeserializationTypeNamePrefix.Length + type.FullName.Length &&\n typeName.StartsWith(Deserializer.DeserializationTypeNamePrefix, StringComparison.OrdinalIgnoreCase) &&\n typeName.EndsWith(type.FullName, StringComparison.OrdinalIgnoreCase))\n {\n return true;\n }\n }\n }\n }\n\n // not the right type\n return false;\n }\n\n internal static string MaskDeserializationPrefix(string typeName)\n {\n if (typeName == null)\n {\n return null;\n }\n\n if (typeName.StartsWith(Deserializer.DeserializationTypeNamePrefix, StringComparison.OrdinalIgnoreCase))\n {\n typeName = typeName.Substring(Deserializer.DeserializationTypeNamePrefix.Length);\n }\n\n return typeName;\n }\n\n /// \n /// Gets a new collection of typenames without \"Deserialization.\" prefix\n /// in the typename. This will allow to map type info/format info of the orignal type \n /// for deserialized objects.\n /// \n /// \n /// \n /// Null if no type with \"Deserialized.\" prefix is found.\n /// Otherwise with the prefix removed if any.\n /// \n internal static Collection MaskDeserializationPrefix(Collection typeNames)\n {\n Dbg.Assert(null != typeNames, \"typeNames cannot be null\");\n\n bool atleastOneDeserializedTypeFound = false;\n\n Collection typesWithoutPrefix = new Collection();\n foreach (string type in typeNames)\n {\n if (type.StartsWith(Deserializer.DeserializationTypeNamePrefix,\n StringComparison.OrdinalIgnoreCase))\n {\n atleastOneDeserializedTypeFound = true;\n // remove *only* the prefix\n typesWithoutPrefix.Add(type.Substring(Deserializer.DeserializationTypeNamePrefix.Length));\n }\n else\n {\n typesWithoutPrefix.Add(type);\n }\n }\n\n if (atleastOneDeserializedTypeFound)\n {\n return typesWithoutPrefix;\n }\n\n return null;\n }\n\n /// \n /// Used to prefix a typename for deserialization.\n /// \n private const string DeserializationTypeNamePrefix = \"Deserialized.\";\n\n #endregion\n }\n\n /// \n /// Types of known type container supported by monad\n /// \n internal enum ContainerType\n {\n Dictionary,\n Queue,\n Stack,\n List,\n Enumerable,\n None\n };\n\n /// \n /// This internal helper class provides methods for serializing mshObject.\n /// \n internal class InternalSerializer\n {\n #region constructor\n\n internal const string DefaultVersion = \"1.1.0.1\";\n\n /// \n /// Xml writer to be used\n /// \n private readonly XmlWriter _writer;\n\n /// \n /// Serialization context\n /// \n private readonly SerializationContext _context;\n\n /// Used by Remoting infrastructure. This TypeTable instance\n /// will be used by Serializer if ExecutionContext is not\n /// available (to get the ExecutionContext's TypeTable)\n private TypeTable _typeTable;\n\n /// \n /// Depth below top level - used to prevent infinitely deep serialization\n /// (without this protection it would be possible i.e. with SerializationDepth and recursion)\n /// \n private int _depthBelowTopLevel;\n\n private const int MaxDepthBelowTopLevel = 50;\n\n private readonly ReferenceIdHandlerForSerializer _objectRefIdHandler;\n private readonly ReferenceIdHandlerForSerializer _typeRefIdHandler;\n\n internal InternalSerializer(XmlWriter writer, SerializationContext context)\n {\n Dbg.Assert(writer != null, \"caller should validate the parameter\");\n Dbg.Assert(context != null, \"caller should validate the parameter\");\n _writer = writer;\n _context = context;\n\n IDictionary objectRefIdDictionary = null;\n if ((_context.options & SerializationOptions.NoObjectRefIds) == 0)\n {\n objectRefIdDictionary = new WeakReferenceDictionary();\n }\n _objectRefIdHandler = new ReferenceIdHandlerForSerializer(objectRefIdDictionary);\n\n _typeRefIdHandler = new ReferenceIdHandlerForSerializer(\n new Dictionary(ConsolidatedString.EqualityComparer));\n }\n\n #endregion\n\n /// \n /// Used by Remoting infrastructure. This TypeTable instance\n /// will be used by Serializer if ExecutionContext is not\n /// available (to get the ExecutionContext's TypeTable)\n /// \n internal TypeTable TypeTable\n {\n get { return _typeTable; }\n set { _typeTable = value; }\n }\n\n /// \n /// Writes the start of root element \n /// \n internal void Start()\n {\n if (SerializationOptions.NoRootElement != (_context.options & SerializationOptions.NoRootElement))\n {\n this.WriteStartElement(SerializationStrings.RootElementTag);\n this.WriteAttribute(SerializationStrings.VersionAttribute, InternalSerializer.DefaultVersion);\n }\n }\n\n /// \n /// Writes the end of root element \n /// \n internal void End()\n {\n if (SerializationOptions.NoRootElement != (_context.options & SerializationOptions.NoRootElement))\n {\n _writer.WriteEndElement();\n }\n _writer.Flush();\n }\n\n private bool _isStopping = false;\n\n /// \n /// Called from a separate thread will stop the serialization process\n /// \n internal void Stop()\n {\n _isStopping = true;\n }\n\n private void CheckIfStopping()\n {\n if (_isStopping)\n {\n throw PSTraceSource.NewInvalidOperationException(Serialization.Stopping);\n }\n }\n\n internal static bool IsPrimitiveKnownType(Type input)\n {\n //Check if source is of primitive known type\n TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfo(input);\n return (pktInfo != null);\n }\n\n /// \n /// This writes one object.\n /// \n /// \n /// source to be serialized.\n /// \n /// \n /// Stream to which source belongs\n /// \n internal void WriteOneTopLevelObject\n (\n object source,\n string streamName\n )\n {\n Dbg.Assert(_depthBelowTopLevel == 0, \"InternalSerializer.depthBelowTopLevel should be 0 at top-level\");\n WriteOneObject(source, streamName, null, _context.depth);\n }\n\n private void WriteOneObject\n (\n object source,\n string streamName,\n string property,\n int depth\n )\n {\n Dbg.Assert(depth >= 0, \"depth should always be greater or equal to zero\");\n this.CheckIfStopping();\n\n if (source == null)\n {\n WriteNull(streamName, property);\n return;\n }\n\n try\n {\n _depthBelowTopLevel++;\n Dbg.Assert(_depthBelowTopLevel <= MaxDepthBelowTopLevel, \"depthBelowTopLevel should be <= MaxDepthBelowTopLevel\");\n if (HandleMaxDepth(source, streamName, property))\n {\n return;\n }\n\n depth = GetDepthOfSerialization(source, depth);\n\n if (HandlePrimitiveKnownTypeByConvertingToPSObject(source, streamName, property, depth))\n {\n return;\n }\n\n //Object is not of primitive known type. Check if this has \n //already been serialized.\n string refId = _objectRefIdHandler.GetRefId(source);\n if (refId != null)\n {\n WritePSObjectReference(streamName, property, refId);\n return;\n }\n\n if (HandlePrimitiveKnownTypePSObject(source, streamName, property, depth))\n {\n return;\n }\n\n //Note: We do not use containers in depth calculation. i.e even if the \n //current depth is zero, we serialize the container. All contained items will\n //get serialized with depth zero.\n if (HandleKnownContainerTypes(source, streamName, property, depth))\n {\n return;\n }\n\n PSObject mshSource = PSObject.AsPSObject(source);\n //If depth is zero, complex type should be serialized as string.\n if (depth == 0 || SerializeAsString(mshSource))\n {\n HandlePSObjectAsString(mshSource, streamName, property, depth);\n return;\n }\n\n HandleComplexTypePSObject(source, streamName, property, depth);\n return;\n }\n finally\n {\n _depthBelowTopLevel--;\n Dbg.Assert(_depthBelowTopLevel >= 0, \"depthBelowTopLevel should be >= 0\");\n }\n }\n\n private bool HandleMaxDepth(object source, string streamName, string property)\n {\n if (_depthBelowTopLevel == MaxDepthBelowTopLevel)\n {\n // assert commented out because of clashes with Wei's tests\n // Dbg.Assert(false, \"We should never reach MaxDepthBelowTopLevel with non-malicious input\");\n\n PSEtwLog.LogAnalyticError(PSEventId.Serializer_MaxDepthWhenSerializing, PSOpcode.Exception,\n PSTask.Serialization, PSKeyword.Serializer, source.GetType().AssemblyQualifiedName, property, _depthBelowTopLevel);\n\n string content = Serialization.DeserializationTooDeep;\n HandlePrimitiveKnownType(content, streamName, property);\n return true;\n }\n else\n {\n return false;\n }\n }\n\n /// \n /// Serializes Primitive Known Types.\n /// \n /// \n /// true if source is handled, else false.\n /// \n private bool HandlePrimitiveKnownType\n (\n object source,\n string streamName,\n string property\n )\n {\n Dbg.Assert(source != null, \"caller should validate the parameter\");\n\n //Check if source is of primitive known type\n TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfo(source.GetType());\n if (pktInfo != null)\n {\n WriteOnePrimitiveKnownType(this, streamName, property, source, pktInfo);\n return true;\n }\n return false;\n }\n\n /// \n /// Handles primitive known type by first converting it to a PSObject.In W8, extended\n /// property data is stored external to PSObject. By converting to PSObject, we will\n /// be able to retrieve and serialize the extended properties. This is tracked by\n /// Win8: 414042\n /// \n /// \n /// \n /// \n /// \n /// \n private bool HandlePrimitiveKnownTypeByConvertingToPSObject(\n object source,\n string streamName,\n string property,\n int depth\n )\n {\n Dbg.Assert(source != null, \"caller should validate the parameter\");\n //Check if source is of primitive known type\n TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfo(source.GetType());\n if (pktInfo != null)\n {\n PSObject pktInfoPSObject = PSObject.AsPSObject(source);\n return HandlePrimitiveKnownTypePSObject(pktInfoPSObject, streamName, property, depth);\n }\n return false;\n }\n\n\n /// \n /// \n /// \n /// \n /// \n /// \n /// \n private bool HandleSecureString(object source, string streamName, string property)\n {\n Dbg.Assert(source != null, \"caller should validate the parameter\");\n\n SecureString secureString = null;\n secureString = source as SecureString;\n PSObject moSource;\n\n if (secureString != null)\n {\n moSource = PSObject.AsPSObject(secureString);\n }\n else\n {\n moSource = source as PSObject;\n }\n\n if (moSource != null && !moSource.immediateBaseObjectIsEmpty)\n {\n // check if source is of type secure string\n secureString = moSource.ImmediateBaseObject as SecureString;\n if (secureString != null)\n {\n // the principle used in serialization is that serialization\n // never throws, and if something can't be serialized nothing\n // is written. So we write the elements only if encryption succeeds\n try\n {\n String encryptedString;\n if (_context.cryptoHelper != null)\n {\n encryptedString = _context.cryptoHelper.EncryptSecureString(secureString);\n }\n else\n {\n encryptedString = Microsoft.PowerShell.SecureStringHelper.Protect(secureString);\n }\n\n if (property != null)\n {\n WriteStartElement(SerializationStrings.SecureStringTag);\n WriteNameAttribute(property);\n }\n else\n {\n WriteStartElement(SerializationStrings.SecureStringTag);\n }\n\n if (streamName != null)\n {\n WriteAttribute(SerializationStrings.StreamNameAttribute, streamName);\n }\n\n //Note: We do not use WriteRaw for serializing secure string. WriteString \n //does necessary escaping which may be needed for certain\n //characters.\n _writer.WriteString(encryptedString);\n\n _writer.WriteEndElement();\n\n return true;\n }\n catch (PSCryptoException)\n {\n // do nothing\n }\n } // if (source ...\n }\n\n return false;\n }\n\n /// \n /// Serializes PSObject whose base objects are of primitive known type\n /// \n /// \n /// \n /// \n /// \n /// \n /// true if source is handled, else false.\n /// \n private bool HandlePrimitiveKnownTypePSObject\n (\n object source,\n string streamName,\n string property,\n int depth\n )\n {\n Dbg.Assert(source != null, \"caller should validate the parameter\");\n\n bool sourceHandled = false;\n PSObject moSource = source as PSObject;\n if (moSource != null && !moSource.immediateBaseObjectIsEmpty)\n {\n //Check if baseObject is primitive known type\n object baseObject = moSource.ImmediateBaseObject;\n TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfo(baseObject.GetType());\n if (pktInfo != null)\n {\n WritePrimitiveTypePSObject(moSource, baseObject, pktInfo, streamName, property, depth);\n sourceHandled = true;\n }\n }\n return sourceHandled;\n }\n\n private bool HandleKnownContainerTypes\n (\n object source,\n string streamName,\n string property,\n int depth\n )\n {\n Dbg.Assert(source != null, \"caller should validate the parameter\");\n\n ContainerType ct = ContainerType.None;\n PSObject mshSource = source as PSObject;\n IEnumerable enumerable = null;\n IDictionary dictionary = null;\n\n //If passed in object is PSObject with no baseobject, return false.\n if (mshSource != null && mshSource.immediateBaseObjectIsEmpty)\n {\n return false;\n }\n\n //Check if source (or baseobject in mshSource) is known container type\n SerializationUtilities.GetKnownContainerTypeInfo(mshSource != null ? mshSource.ImmediateBaseObject : source, out ct,\n out dictionary, out enumerable);\n\n if (ct == ContainerType.None)\n return false;\n\n string refId = _objectRefIdHandler.SetRefId(source);\n WriteStartOfPSObject(\n mshSource ?? PSObject.AsPSObject(source),\n streamName,\n property,\n refId,\n true, // always write TypeNames information for known container types\n null); // never write ToString information for known container types\n\n switch (ct)\n {\n case ContainerType.Dictionary:\n WriteDictionary(dictionary, SerializationStrings.DictionaryTag, depth);\n break;\n case ContainerType.Stack:\n WriteEnumerable(enumerable, SerializationStrings.StackTag, depth);\n break;\n case ContainerType.Queue:\n WriteEnumerable(enumerable, SerializationStrings.QueueTag, depth);\n break;\n case ContainerType.List:\n WriteEnumerable(enumerable, SerializationStrings.ListTag, depth);\n break;\n case ContainerType.Enumerable:\n WriteEnumerable(enumerable, SerializationStrings.CollectionTag, depth);\n break;\n default:\n Dbg.Assert(false, \"All containers should be handled in the switch\");\n break;\n }\n\n if (depth != 0)\n {\n // An object which is original enumerable becomes an PSObject with ArrayList on deserialization. \n // So on roundtrip it will show up as List.\n // We serialize properties of enumerable and on deserialization mark the object as Deserialized. \n // So if object is marked deserialized, we should write properties.\n if (ct == ContainerType.Enumerable || (mshSource != null && mshSource.isDeserialized))\n {\n PSObject sourceAsPSObject = PSObject.AsPSObject(source);\n PSMemberInfoInternalCollection specificPropertiesToSerialize = SerializationUtilities.GetSpecificPropertiesToSerialize(sourceAsPSObject, AllPropertiesCollection, _typeTable);\n WritePSObjectProperties(sourceAsPSObject, depth, specificPropertiesToSerialize);\n SerializeExtendedProperties(sourceAsPSObject, depth, specificPropertiesToSerialize);\n }\n // always serialize instance properties if there are any\n else if (mshSource != null)\n {\n SerializeInstanceProperties(mshSource, depth);\n }\n }\n\n _writer.WriteEndElement();\n\n return true;\n }\n\n #region Write PSObject\n\n /// \n /// Writes PSObject Reference Element\n /// \n private void WritePSObjectReference\n (\n string streamName,\n string property,\n string refId\n )\n {\n Dbg.Assert(!string.IsNullOrEmpty(refId), \"caller should validate the parameter\");\n\n WriteStartElement(SerializationStrings.ReferenceTag);\n if (streamName != null)\n {\n WriteAttribute(SerializationStrings.StreamNameAttribute, streamName);\n }\n if (property != null)\n {\n WriteNameAttribute(property);\n }\n WriteAttribute(SerializationStrings.ReferenceIdAttribute, refId);\n _writer.WriteEndElement();\n }\n\n private static bool PSObjectHasModifiedTypesCollection(PSObject pso)\n {\n ConsolidatedString currentTypes = pso.InternalTypeNames;\n Collection originalTypes = pso.InternalAdapter.BaseGetTypeNameHierarchy(pso.ImmediateBaseObject);\n\n if (currentTypes.Count != originalTypes.Count)\n {\n return true;\n }\n\n IEnumerator currentEnumerator = currentTypes.GetEnumerator();\n IEnumerator originalEnumerator = originalTypes.GetEnumerator();\n while (currentEnumerator.MoveNext() && originalEnumerator.MoveNext())\n {\n if (!currentEnumerator.Current.Equals(originalEnumerator.Current, StringComparison.OrdinalIgnoreCase))\n {\n return true;\n }\n }\n\n return false;\n }\n\n /// \n /// Serializes an PSObject whose baseobject is of primitive type.\n /// \n /// \n /// source from which notes are written\n /// \n /// \n /// primitive object which is written as base object. In most cases it\n /// is same source.ImmediateBaseObject. When PSObject is serialized as string,\n /// it can be different. for more info.\n /// \n /// \n /// TypeSerializationInfo for the primitive. \n /// \n /// \n /// \n /// \n private void WritePrimitiveTypePSObject\n (\n PSObject source,\n object primitive,\n TypeSerializationInfo pktInfo,\n string streamName,\n string property,\n int depth\n )\n {\n Dbg.Assert(source != null, \"Caller should validate source != null\");\n\n string toStringValue = SerializationUtilities.GetToStringForPrimitiveObject(source);\n bool hasModifiedTypesCollection = PSObjectHasModifiedTypesCollection(source);\n bool hasNotes = PSObjectHasNotes(source);\n bool hasModifiedToString = (toStringValue != null);\n\n if (hasNotes || hasModifiedTypesCollection || hasModifiedToString)\n {\n WritePrimitiveTypePSObjectWithNotes(\n source,\n primitive,\n hasModifiedTypesCollection,\n toStringValue,\n pktInfo,\n streamName,\n property,\n depth);\n return;\n }\n else\n {\n if (primitive != null)\n {\n WriteOnePrimitiveKnownType(this, streamName, property, primitive, pktInfo);\n return;\n }\n else\n {\n WriteNull(streamName, property);\n return;\n }\n }\n }\n\n /// \n /// Serializes an PSObject whose baseobject is of primitive type\n /// and which has notes.\n /// \n /// \n /// source from which notes are written\n /// \n /// \n /// primitive object which is written as base object. In most cases it\n /// is same source.ImmediateBaseObject. When PSObject is serialized as string,\n /// it can be different. for more info.\n /// \n /// \n /// \n /// \n /// TypeSerializationInfo for the primitive. \n /// \n /// \n /// \n /// \n private void WritePrimitiveTypePSObjectWithNotes\n (\n PSObject source,\n object primitive,\n bool hasModifiedTypesCollection,\n string toStringValue,\n TypeSerializationInfo pktInfo,\n string streamName,\n string property,\n int depth\n )\n {\n Dbg.Assert(source != null, \"caller should validate the parameter\");\n Dbg.Assert(pktInfo != null, \"Caller should validate pktInfo != null\");\n\n string refId = _objectRefIdHandler.SetRefId(source);\n WriteStartOfPSObject(\n source,\n streamName,\n property,\n refId,\n hasModifiedTypesCollection, // preserve TypeNames information if different from the primitive type\n toStringValue); // preserve ToString information only if got it from deserialization or overridden by PSObject\n // (example where preservation of TypeNames and ToString is needed: enums serialized as ints, help string with custom type names (HelpInfoShort))\n\n if (pktInfo != null)\n {\n WriteOnePrimitiveKnownType(this, streamName, null, primitive, pktInfo);\n }\n\n // serialize only instance properties - members from type table are\n // always going to be available for known primitive types\n SerializeInstanceProperties(source, depth);\n\n _writer.WriteEndElement();\n }\n\n private void HandleComplexTypePSObject\n (\n object source,\n string streamName,\n string property,\n int depth\n )\n {\n Dbg.Assert(source != null, \"caller should validate the parameter\");\n PSObject mshSource = PSObject.AsPSObject(source);\n\n // Figure out what kind of object we are dealing with\n bool isErrorRecord = false;\n bool isInformationalRecord = false;\n bool isEnum = false;\n bool isPSObject = false;\n bool isCimInstance = false;\n\n if (!mshSource.immediateBaseObjectIsEmpty)\n {\n do // false loop\n {\n CimInstance cimInstance = mshSource.ImmediateBaseObject as CimInstance;\n if (cimInstance != null)\n {\n isCimInstance = true;\n break;\n }\n\n ErrorRecord errorRecord = mshSource.ImmediateBaseObject as ErrorRecord;\n if (errorRecord != null)\n {\n errorRecord.ToPSObjectForRemoting(mshSource);\n isErrorRecord = true;\n break;\n }\n\n InformationalRecord informationalRecord = mshSource.ImmediateBaseObject as InformationalRecord;\n if (informationalRecord != null)\n {\n informationalRecord.ToPSObjectForRemoting(mshSource);\n isInformationalRecord = true;\n break;\n }\n\n isEnum = mshSource.ImmediateBaseObject is Enum;\n isPSObject = mshSource.ImmediateBaseObject is PSObject;\n } while (false);\n }\n\n bool writeToString = true;\n if (mshSource.ToStringFromDeserialization == null) // continue to write ToString from deserialized objects, but...\n {\n if (mshSource.immediateBaseObjectIsEmpty) // ... don't write ToString for property bags\n {\n writeToString = false;\n }\n }\n\n string refId = _objectRefIdHandler.SetRefId(source);\n WriteStartOfPSObject(\n mshSource,\n streamName,\n property,\n refId,\n true, // always write TypeNames for complex objects\n writeToString ? SerializationUtilities.GetToString(mshSource) : null);\n\n PSMemberInfoInternalCollection specificPropertiesToSerialize = SerializationUtilities.GetSpecificPropertiesToSerialize(mshSource, AllPropertiesCollection, _typeTable);\n\n if (isEnum)\n {\n object baseObject = mshSource.ImmediateBaseObject;\n WriteOneObject(System.Convert.ChangeType(baseObject, Enum.GetUnderlyingType(baseObject.GetType()), System.Globalization.CultureInfo.InvariantCulture), null, null, depth);\n }\n else if (isPSObject)\n {\n WriteOneObject(mshSource.ImmediateBaseObject, null, null, depth);\n }\n else if (isErrorRecord || isInformationalRecord)\n {\n // nothing to do\n }\n else\n {\n WritePSObjectProperties(mshSource, depth, specificPropertiesToSerialize);\n }\n\n if (isCimInstance)\n {\n CimInstance cimInstance = mshSource.ImmediateBaseObject as CimInstance;\n PrepareCimInstanceForSerialization(mshSource, cimInstance);\n }\n\n SerializeExtendedProperties(mshSource, depth, specificPropertiesToSerialize);\n\n _writer.WriteEndElement();\n }\n\n private static Lazy s_cimSerializer = new Lazy(CimSerializer.Create);\n\n private void PrepareCimInstanceForSerialization(PSObject psObject, CimInstance cimInstance)\n {\n Queue serializedClasses = new Queue();\n\n // \n // CREATE SERIALIZED FORM OF THE CLASS METADATA\n //\n ArrayList psoClasses = new ArrayList();\n for (CimClass cimClass = cimInstance.CimClass; cimClass != null; cimClass = cimClass.CimSuperClass)\n {\n PSObject psoClass = new PSObject();\n psoClass.TypeNames.Clear();\n psoClasses.Add(psoClass);\n\n psoClass.Properties.Add(new PSNoteProperty(InternalDeserializer.CimClassNameProperty, cimClass.CimSystemProperties.ClassName));\n psoClass.Properties.Add(new PSNoteProperty(InternalDeserializer.CimNamespaceProperty, cimClass.CimSystemProperties.Namespace));\n psoClass.Properties.Add(new PSNoteProperty(InternalDeserializer.CimServerNameProperty, cimClass.CimSystemProperties.ServerName));\n psoClass.Properties.Add(new PSNoteProperty(InternalDeserializer.CimHashCodeProperty, cimClass.GetHashCode()));\n\n CimClassSerializationId cimClassSerializationId = new CimClassSerializationId(\n cimClass.CimSystemProperties.ClassName,\n cimClass.CimSystemProperties.Namespace,\n cimClass.CimSystemProperties.ServerName,\n cimClass.GetHashCode());\n if (_context.cimClassSerializationIdCache.DoesDeserializerAlreadyHaveCimClass(cimClassSerializationId))\n {\n break;\n }\n\n serializedClasses.Enqueue(cimClassSerializationId);\n byte[] miXmlBytes = s_cimSerializer.Value.Serialize(cimClass, ClassSerializationOptions.None);\n string miXmlString = Encoding.Unicode.GetString(miXmlBytes, 0, miXmlBytes.Length);\n psoClass.Properties.Add(new PSNoteProperty(InternalDeserializer.CimMiXmlProperty, miXmlString));\n }\n psoClasses.Reverse();\n\n //\n // UPDATE CLASSDECL CACHE\n //\n foreach (CimClassSerializationId serializedClassId in serializedClasses)\n {\n _context.cimClassSerializationIdCache.AddClassToCache(serializedClassId);\n }\n\n //\n // ATTACH CLASS METADATA TO THE OBJECT BEING SERIALIZED\n //\n PSPropertyInfo classMetadataProperty = psObject.Properties[InternalDeserializer.CimClassMetadataProperty];\n if (classMetadataProperty != null)\n {\n classMetadataProperty.Value = psoClasses;\n }\n else\n {\n PSNoteProperty classMetadataNote = new PSNoteProperty(\n InternalDeserializer.CimClassMetadataProperty,\n psoClasses);\n classMetadataNote.IsHidden = true;\n psObject.Properties.Add(classMetadataNote);\n }\n\n // ATTACH INSTANCE METADATA TO THE OBJECT BEING SERIALIZED\n List namesOfModifiedProperties = cimInstance\n .CimInstanceProperties\n .Where(p => p.IsValueModified)\n .Select(p => p.Name)\n .ToList();\n if (namesOfModifiedProperties.Count != 0)\n {\n PSObject instanceMetadata = new PSObject();\n PSPropertyInfo instanceMetadataProperty = psObject.Properties[InternalDeserializer.CimInstanceMetadataProperty];\n if (instanceMetadataProperty != null)\n {\n instanceMetadataProperty.Value = instanceMetadata;\n }\n else\n {\n PSNoteProperty instanceMetadataNote = new PSNoteProperty(InternalDeserializer.CimInstanceMetadataProperty, instanceMetadata);\n instanceMetadataNote.IsHidden = true;\n psObject.Properties.Add(instanceMetadataNote);\n }\n\n instanceMetadata.InternalTypeNames = ConsolidatedString.Empty;\n\n instanceMetadata.Properties.Add(\n new PSNoteProperty(\n InternalDeserializer.CimModifiedProperties,\n string.Join(\" \", namesOfModifiedProperties)));\n }\n }\n\n /// \n /// Writes start element, attributes and typeNames for PSObject.\n /// \n /// \n /// \n /// \n /// \n /// if true, TypeName information is written, else not.\n /// if not null then ToString information is written\n private void WriteStartOfPSObject\n (\n PSObject mshObject,\n string streamName,\n string property,\n string refId,\n bool writeTypeNames,\n string toStringValue\n )\n {\n Dbg.Assert(mshObject != null, \"caller should validate the parameter\");\n\n //Write PSObject start element.\n WriteStartElement(SerializationStrings.PSObjectTag);\n\n if (streamName != null)\n {\n WriteAttribute(SerializationStrings.StreamNameAttribute, streamName);\n }\n\n if (property != null)\n {\n WriteNameAttribute(property);\n }\n\n if (refId != null)\n {\n WriteAttribute(SerializationStrings.ReferenceIdAttribute, refId);\n }\n\n if (writeTypeNames)\n {\n //Write TypeNames\n ConsolidatedString typeNames = mshObject.InternalTypeNames;\n if (typeNames.Count > 0)\n {\n string typeNameHierarchyReferenceId = _typeRefIdHandler.GetRefId(typeNames);\n if (typeNameHierarchyReferenceId == null)\n {\n WriteStartElement(SerializationStrings.TypeNamesTag);\n\n //Create a new refId and write it as attribute\n string tnRefId = _typeRefIdHandler.SetRefId(typeNames);\n Dbg.Assert(tnRefId != null, \"SetRefId should always succeed for strings\");\n WriteAttribute(SerializationStrings.ReferenceIdAttribute, tnRefId);\n\n foreach (string type in typeNames)\n {\n WriteEncodedElementString(SerializationStrings.TypeNamesItemTag, type);\n }\n _writer.WriteEndElement();\n }\n else\n {\n WriteStartElement(SerializationStrings.TypeNamesReferenceTag);\n WriteAttribute(SerializationStrings.ReferenceIdAttribute, typeNameHierarchyReferenceId);\n _writer.WriteEndElement();\n }\n }\n }\n\n if (toStringValue != null)\n {\n WriteEncodedElementString(SerializationStrings.ToStringElementTag, toStringValue);\n }\n }\n\n #region membersets\n\n /// \n /// Returns true if PSObject has notes. \n /// \n /// \n /// \n /// \n private static bool PSObjectHasNotes(PSObject source)\n {\n Dbg.Assert(source != null, \"Caller should validate the parameter\");\n if (source.InstanceMembers != null && source.InstanceMembers.Count > 0)\n {\n return true;\n }\n return false;\n }\n\n private bool? _canUseDefaultRunspaceInThreadSafeManner;\n\n private bool CanUseDefaultRunspaceInThreadSafeManner\n {\n get\n {\n if (!_canUseDefaultRunspaceInThreadSafeManner.HasValue)\n {\n _canUseDefaultRunspaceInThreadSafeManner = Runspace.CanUseDefaultRunspace;\n }\n\n return _canUseDefaultRunspaceInThreadSafeManner.Value;\n }\n }\n\n /// \n /// Serialize member set. This method serializes without writing \n /// enclosing tags and attributes.\n /// \n /// \n /// enumerable containing members\n /// \n /// \n /// \n /// if this is true, write an enclosing \"\" tag.\n /// \n /// \n private void WriteMemberInfoCollection\n (\n IEnumerable me,\n int depth,\n bool writeEnclosingMemberSetElementTag\n )\n {\n Dbg.Assert(me != null, \"caller should validate the parameter\");\n\n bool enclosingTagWritten = false;\n foreach (PSMemberInfo info in me)\n {\n if (!info.ShouldSerialize)\n {\n continue;\n }\n int depthOfMember = info.IsInstance ? depth : depth - 1;\n\n if (info.MemberType == (info.MemberType & PSMemberTypes.Properties))\n {\n bool gotValue;\n object value = SerializationUtilities.GetPropertyValueInThreadSafeManner((PSPropertyInfo)info, this.CanUseDefaultRunspaceInThreadSafeManner, out gotValue);\n if (gotValue)\n {\n if (writeEnclosingMemberSetElementTag && !enclosingTagWritten)\n {\n enclosingTagWritten = true;\n WriteStartElement(SerializationStrings.MemberSet);\n }\n\n WriteOneObject(value, null, info.Name, depthOfMember);\n }\n }\n else if (info.MemberType == PSMemberTypes.MemberSet)\n {\n if (writeEnclosingMemberSetElementTag && !enclosingTagWritten)\n {\n enclosingTagWritten = true;\n WriteStartElement(SerializationStrings.MemberSet);\n }\n WriteMemberSet((PSMemberSet)info, depthOfMember);\n }\n }\n if (enclosingTagWritten)\n {\n _writer.WriteEndElement();\n }\n }\n\n /// \n /// Serializes MemberSet.\n /// \n private void WriteMemberSet\n (\n PSMemberSet set,\n int depth\n )\n {\n Dbg.Assert(set != null, \"Caller should validate the parameter\");\n\n if (!set.ShouldSerialize)\n {\n return;\n }\n WriteStartElement(SerializationStrings.MemberSet);\n WriteNameAttribute(set.Name);\n WriteMemberInfoCollection(set.Members, depth, false);\n _writer.WriteEndElement();\n }\n\n #endregion membersets\n\n #region properties\n\n /// \n /// Serializes properties of PSObject\n /// \n private void WritePSObjectProperties\n (\n PSObject source,\n int depth,\n IEnumerable specificPropertiesToSerialize\n )\n {\n Dbg.Assert(source != null, \"caller should validate the information\");\n\n //Depth available for each property is one less\n --depth;\n Dbg.Assert(depth >= 0, \"depth should be greater or equal to zero\");\n\n if (specificPropertiesToSerialize != null)\n {\n SerializeProperties(specificPropertiesToSerialize, SerializationStrings.AdapterProperties, depth);\n }\n else\n {\n if (source.ShouldSerializeAdapter())\n {\n IEnumerable adapterCollection = null;\n adapterCollection = source.GetAdaptedProperties();\n if (adapterCollection != null)\n {\n SerializeProperties(adapterCollection, SerializationStrings.AdapterProperties, depth);\n }\n }\n }\n }\n\n private void SerializeInstanceProperties\n (\n PSObject source,\n int depth\n )\n {\n //Serialize instanceMembers\n Dbg.Assert(source != null, \"caller should validate the information\");\n PSMemberInfoCollection instanceMembers = source.InstanceMembers;\n if (instanceMembers != null)\n {\n WriteMemberInfoCollection(instanceMembers, depth, true);\n }\n }\n\n private Collection> _extendedMembersCollection;\n private Collection> ExtendedMembersCollection\n {\n get {\n return _extendedMembersCollection ??\n (_extendedMembersCollection =\n PSObject.GetMemberCollection(PSMemberViewTypes.Extended, _typeTable));\n }\n }\n\n private Collection> _allPropertiesCollection;\n private Collection> AllPropertiesCollection\n {\n get {\n return _allPropertiesCollection ??\n (_allPropertiesCollection = PSObject.GetPropertyCollection(PSMemberViewTypes.All, _typeTable));\n }\n }\n\n private void SerializeExtendedProperties\n (\n PSObject source,\n int depth,\n IEnumerable specificPropertiesToSerialize\n )\n {\n Dbg.Assert(source != null, \"caller should validate the information\");\n\n IEnumerable extendedMembersEnumerable = null;\n if (specificPropertiesToSerialize == null)\n {\n // Get only extended members including hidden members from the psobect source.\n PSMemberInfoIntegratingCollection membersToSearch =\n new PSMemberInfoIntegratingCollection(source, ExtendedMembersCollection);\n extendedMembersEnumerable = membersToSearch.Match(\n \"*\",\n PSMemberTypes.Properties | PSMemberTypes.PropertySet | PSMemberTypes.MemberSet,\n MshMemberMatchOptions.IncludeHidden | MshMemberMatchOptions.OnlySerializable);\n }\n else\n {\n List extendedMembersList = new List(source.InstanceMembers);\n extendedMembersEnumerable = extendedMembersList;\n\n foreach (PSMemberInfo member in specificPropertiesToSerialize)\n {\n if (member.IsInstance)\n {\n continue;\n }\n\n if (member is PSProperty)\n {\n continue;\n }\n\n extendedMembersList.Add(member);\n }\n }\n\n if (extendedMembersEnumerable != null)\n {\n WriteMemberInfoCollection(extendedMembersEnumerable, depth, true);\n }\n }\n\n /// \n /// Serializes properties from collection\n /// \n /// \n /// Collection of properties to serialize\n /// \n /// \n /// Name for enclosing element tag\n /// \n /// \n /// depth to which each property should be \n /// serialized\n /// \n private void SerializeProperties\n (\n IEnumerable propertyCollection,\n string name,\n int depth\n )\n {\n Dbg.Assert(propertyCollection != null, \"caller should validate the parameter\");\n bool startElementWritten = false;\n\n foreach (PSMemberInfo info in propertyCollection)\n {\n PSProperty prop = info as PSProperty;\n if (prop == null)\n {\n continue;\n }\n\n if (!startElementWritten)\n {\n WriteStartElement(name);\n startElementWritten = true;\n }\n\n bool success;\n object value = SerializationUtilities.GetPropertyValueInThreadSafeManner(prop, this.CanUseDefaultRunspaceInThreadSafeManner, out success);\n if (success)\n {\n WriteOneObject(value, null, prop.Name, depth);\n }\n }\n\n if (startElementWritten)\n {\n _writer.WriteEndElement();\n }\n }\n\n #endregion base properties\n\n #endregion WritePSObject\n\n #region enumerable and dictionary\n\n /// \n /// Serializes IEnumerable\n /// \n /// \n /// enumerable which is serialized\n /// \n /// \n /// \n /// \n private void WriteEnumerable\n (\n IEnumerable enumerable,\n string tag,\n int depth\n )\n {\n Dbg.Assert(enumerable != null, \"caller should validate the parameter\");\n Dbg.Assert(!string.IsNullOrEmpty(tag), \"caller should validate the parameter\");\n\n //Start element\n WriteStartElement(tag);\n\n IEnumerator enumerator = null;\n try\n {\n enumerator = enumerable.GetEnumerator();\n try\n {\n enumerator.Reset();\n }\n catch (System.NotSupportedException)\n {\n //ignore exceptions thrown when the enumerator doesn't support Reset() method as in win8:948569 \n }\n }\n catch (Exception exception)\n {\n // Catch-all OK. This is a third-party call-out.\n CommandProcessorBase.CheckForSevereException(exception);\n\n PSEtwLog.LogAnalyticWarning(\n PSEventId.Serializer_EnumerationFailed, PSOpcode.Exception, PSTask.Serialization,\n PSKeyword.Serializer | PSKeyword.UseAlwaysAnalytic,\n enumerable.GetType().AssemblyQualifiedName,\n exception.ToString());\n\n enumerator = null;\n }\n\n //AD has incorrect implementation of IEnumerable where they returned null\n //for GetEnumerator instead of empty enumerator\n if (enumerator != null)\n {\n while (true)\n {\n object item = null;\n try\n {\n if (!enumerator.MoveNext())\n {\n break;\n }\n else\n {\n item = enumerator.Current;\n }\n }\n catch (Exception exception)\n {\n // Catch-all OK. This is a third-party call-out.\n CommandProcessorBase.CheckForSevereException(exception);\n\n PSEtwLog.LogAnalyticWarning(\n PSEventId.Serializer_EnumerationFailed, PSOpcode.Exception, PSTask.Serialization,\n PSKeyword.Serializer | PSKeyword.UseAlwaysAnalytic,\n enumerable.GetType().AssemblyQualifiedName,\n exception.ToString());\n\n break;\n }\n WriteOneObject(item, null, null, depth);\n }\n }\n //End element\n _writer.WriteEndElement();\n }\n\n /// \n /// Serializes IDictionary\n /// \n /// dictionary which is serialized\n /// \n /// \n private void WriteDictionary\n (\n IDictionary dictionary,\n string tag,\n int depth\n )\n {\n Dbg.Assert(dictionary != null, \"caller should validate the parameter\");\n Dbg.Assert(!string.IsNullOrEmpty(tag), \"caller should validate the parameter\");\n\n //Start element\n WriteStartElement(tag);\n\n IDictionaryEnumerator dictionaryEnum = null;\n try\n {\n dictionaryEnum = dictionary.GetEnumerator();\n }\n catch (Exception exception) // ignore non-severe exceptions\n {\n // Catch-all OK. This is a third-party call-out.\n CommandProcessorBase.CheckForSevereException(exception);\n\n PSEtwLog.LogAnalyticWarning(\n PSEventId.Serializer_EnumerationFailed, PSOpcode.Exception, PSTask.Serialization,\n PSKeyword.Serializer | PSKeyword.UseAlwaysAnalytic,\n dictionary.GetType().AssemblyQualifiedName,\n exception.ToString());\n }\n\n if (dictionaryEnum != null)\n {\n while (true)\n {\n object key = null;\n object value = null;\n try\n {\n if (!dictionaryEnum.MoveNext())\n {\n break;\n }\n else\n {\n key = dictionaryEnum.Key;\n value = dictionaryEnum.Value;\n }\n }\n catch (Exception exception)\n {\n // Catch-all OK. This is a third-party call-out.\n CommandProcessorBase.CheckForSevereException(exception);\n\n PSEtwLog.LogAnalyticWarning(\n PSEventId.Serializer_EnumerationFailed, PSOpcode.Exception, PSTask.Serialization,\n PSKeyword.Serializer | PSKeyword.UseAlwaysAnalytic,\n dictionary.GetType().AssemblyQualifiedName,\n exception.ToString());\n\n break;\n }\n\n Dbg.Assert(key != null, \"Dictionary keys should never be null\");\n if (key == null) break;\n\n WriteStartElement(SerializationStrings.DictionaryEntryTag);\n WriteOneObject(key, null, SerializationStrings.DictionaryKey, depth);\n WriteOneObject(value, null, SerializationStrings.DictionaryValue, depth);\n _writer.WriteEndElement();\n }\n }\n\n //End element\n _writer.WriteEndElement();\n }\n\n #endregion enumerable and dictionary\n\n #region serialize as string\n\n private void HandlePSObjectAsString(\n PSObject source,\n string streamName,\n string property,\n int depth)\n {\n Dbg.Assert(source != null, \"caller should validate the information\");\n\n string value = GetSerializationString(source);\n\n TypeSerializationInfo pktInfo = null;\n if (value != null)\n {\n pktInfo = KnownTypes.GetTypeSerializationInfo(value.GetType());\n }\n\n WritePrimitiveTypePSObject(source, value, pktInfo, streamName, property, depth);\n }\n\n /// \n /// Gets the string from PSObject using the information from\n /// types.ps1xml. \n /// This string is used for serializing the PSObject at depth 0 \n /// or when pso.SerializationMethod == SerializationMethod.String.\n /// \n /// \n /// \n /// PSObject to be converted to string\n /// \n /// \n /// \n /// string value to use for serializing this PSObject.\n /// \n private string GetSerializationString(PSObject source)\n {\n Dbg.Assert(source != null, \"caller should have validated the information\");\n\n PSPropertyInfo serializationProperty = null;\n try\n {\n serializationProperty = source.GetStringSerializationSource(_typeTable);\n }\n catch (ExtendedTypeSystemException e)\n {\n PSEtwLog.LogAnalyticWarning(\n PSEventId.Serializer_ToStringFailed, PSOpcode.Exception, PSTask.Serialization,\n PSKeyword.Serializer | PSKeyword.UseAlwaysAnalytic,\n source.GetType().AssemblyQualifiedName,\n e.InnerException != null ? e.InnerException.ToString() : e.ToString());\n }\n\n string result = null;\n if (serializationProperty != null)\n {\n bool success;\n object val = SerializationUtilities.GetPropertyValueInThreadSafeManner(serializationProperty, this.CanUseDefaultRunspaceInThreadSafeManner, out success);\n if (success && (val != null))\n {\n result = SerializationUtilities.GetToString(val);\n }\n }\n else\n {\n result = SerializationUtilities.GetToString(source);\n }\n\n return result;\n }\n\n /// \n /// Reads the information the PSObject\n /// and returns true if this object should be serialized as\n /// string\n /// \n /// PSObject to be serialized\n /// true if the object needs to be serialized as a string\n private bool SerializeAsString(PSObject source)\n {\n SerializationMethod method = source.GetSerializationMethod(_typeTable);\n if (method == SerializationMethod.String)\n {\n PSEtwLog.LogAnalyticVerbose(\n PSEventId.Serializer_ModeOverride, PSOpcode.SerializationSettings, PSTask.Serialization,\n PSKeyword.Serializer | PSKeyword.UseAlwaysAnalytic,\n source.InternalTypeNames.Key,\n (UInt32)(SerializationMethod.String));\n\n return true;\n }\n else\n {\n return false;\n }\n }\n\n #endregion serialize as string\n\n /// \n /// compute the serialization depth for an PSObject instance subtree\n /// \n /// PSObject whose serialization depth has to be computed\n /// current depth\n /// \n private int GetDepthOfSerialization(object source, int depth)\n {\n Dbg.Assert(source != null, \"Caller should verify source != null\");\n\n PSObject pso = PSObject.AsPSObject(source);\n if (pso == null)\n {\n return depth;\n }\n\n if (pso.BaseObject is CimInstance)\n {\n return 1;\n }\n\n if (pso.BaseObject is PSCredential)\n {\n return 1;\n }\n\n if (pso.BaseObject is PSSenderInfo)\n {\n return 4;\n }\n\n if (pso.BaseObject is SwitchParameter)\n {\n return 1;\n }\n\n if (0 != (_context.options & SerializationOptions.UseDepthFromTypes))\n {\n // get the depth from the PSObject\n // NOTE: we assume that the depth out of the PSObject is > 0\n // else we consider it not set in types.ps1xml\n int typesPs1xmlDepth = pso.GetSerializationDepth(_typeTable);\n if (typesPs1xmlDepth > 0)\n {\n if (typesPs1xmlDepth != depth)\n {\n PSEtwLog.LogAnalyticVerbose(\n PSEventId.Serializer_DepthOverride, PSOpcode.SerializationSettings, PSTask.Serialization,\n PSKeyword.Serializer | PSKeyword.UseAlwaysAnalytic,\n pso.InternalTypeNames.Key, depth, typesPs1xmlDepth, _depthBelowTopLevel);\n\n return typesPs1xmlDepth;\n }\n }\n }\n\n if (0 != (_context.options & SerializationOptions.PreserveSerializationSettingOfOriginal))\n {\n if ((pso.isDeserialized) && (depth <= 0))\n {\n return 1;\n }\n }\n\n return depth;\n }\n\n /// \n /// Writes null\n /// \n /// \n /// \n private void WriteNull(string streamName, string property)\n {\n WriteStartElement(SerializationStrings.NilTag);\n\n if (streamName != null)\n {\n WriteAttribute(SerializationStrings.StreamNameAttribute, streamName);\n }\n\n if (property != null)\n {\n WriteNameAttribute(property);\n }\n _writer.WriteEndElement();\n }\n\n #region known type serialization\n\n /// \n /// Writes raw string as item or property in Monad namespace\n /// \n /// The serializer to which the object is serialized.\n /// name of the stream to write. Do not write if null.\n /// name of property. Pass null for item\n /// string to write\n /// serialization information\n private static void WriteRawString\n (\n InternalSerializer serializer,\n string streamName,\n string property,\n string raw,\n TypeSerializationInfo entry\n )\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(raw != null, \"caller should have validated the information\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n if (property != null)\n {\n serializer.WriteStartElement(entry.PropertyTag);\n serializer.WriteNameAttribute(property);\n }\n else\n {\n serializer.WriteStartElement(entry.ItemTag);\n }\n\n if (streamName != null)\n {\n serializer.WriteAttribute(SerializationStrings.StreamNameAttribute, streamName);\n }\n\n serializer._writer.WriteRaw(raw);\n serializer._writer.WriteEndElement();\n }\n\n /// \n /// Writes an item or property in Monad namespace\n /// \n /// The serializer to which the object is serialized.\n /// \n /// name of property. Pass null for item\n /// object to be written\n /// serialization information about source\n private static void WriteOnePrimitiveKnownType\n (\n InternalSerializer serializer,\n string streamName,\n string property,\n object source,\n TypeSerializationInfo entry\n )\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n if (entry.Serializer == null)\n {\n // we are not using GetToString, because we assume that\n // ToString() for primitive types never throws\n string value = Convert.ToString(source, CultureInfo.InvariantCulture);\n Dbg.Assert(value != null, \"ToString shouldn't return null for primitive types\");\n WriteRawString(serializer, streamName, property, value, entry);\n }\n else\n {\n entry.Serializer(serializer, streamName, property, source, entry);\n }\n }\n\n /// \n /// Writes DateTime as item or property\n /// \n /// The serializer to which the object is serialized.\n /// \n /// name of property. pass null for item\n /// DateTime to write\n /// serialization information about source\n internal static void WriteDateTime(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n WriteRawString(serializer, streamName, property, XmlConvert.ToString((DateTime)source, XmlDateTimeSerializationMode.RoundtripKind), entry);\n }\n\n /// \n /// Writes Version\n /// \n /// The serializer to which the object is serialized.\n /// \n /// name of property. pass null for item\n /// Version to write\n /// serialization information about source\n internal static void WriteVersion(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(source is Version, \"Caller should verify that typeof(source) is Version\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n WriteRawString(serializer, streamName, property, Convert.ToString(source, CultureInfo.InvariantCulture), entry);\n }\n\n /// \n /// Writes SemanticVersion\n /// \n /// The serializer to which the object is serialized.\n /// \n /// name of property. pass null for item\n /// Version to write\n /// serialization information about source\n internal static void WriteSemanticVersion(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(source is SemanticVersion, \"Caller should verify that typeof(source) is Version\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n WriteRawString(serializer, streamName, property, Convert.ToString(source, CultureInfo.InvariantCulture), entry);\n }\n\n /// \n /// Serialize scriptblock as item or property\n /// \n /// The serializer to which the object is serialized.\n /// \n /// name of property. pass null for item\n /// scriptblock to write\n /// serialization information about source\n internal static void WriteScriptBlock(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(source is ScriptBlock, \"Caller should verify that typeof(source) is ScriptBlock\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n WriteEncodedString(serializer, streamName, property, Convert.ToString(source, CultureInfo.InvariantCulture), entry);\n }\n\n /// \n /// Serialize URI as item or property\n /// \n /// The serializer to which the object is serialized.\n /// \n /// name of property. pass null for item\n /// URI to write\n /// serialization information about source\n internal static void WriteUri(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(source is Uri, \"Caller should verify that typeof(source) is Uri\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n WriteEncodedString(serializer, streamName, property, Convert.ToString(source, CultureInfo.InvariantCulture), entry);\n }\n\n\n /// \n /// Serialize string as item or property\n /// \n /// The serializer to which the object is serialized.\n /// \n /// name of property. pass null for item\n /// string to write\n /// serialization information about source\n internal static void WriteEncodedString(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(source is string, \"caller should have validated the information\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n if (property != null)\n {\n serializer.WriteStartElement(entry.PropertyTag);\n serializer.WriteNameAttribute(property);\n }\n else\n {\n serializer.WriteStartElement(entry.ItemTag);\n }\n\n if (streamName != null)\n {\n serializer.WriteAttribute(SerializationStrings.StreamNameAttribute, streamName);\n }\n\n //Note: We do not use WriteRaw for serializing string. WriteString \n //does necessary escaping which may be needed for certain\n //characters.\n Dbg.Assert(source is string, \"Caller should verify that typeof(source) is String\");\n string s = (string)source;\n string encoded = EncodeString(s);\n serializer._writer.WriteString(encoded);\n\n serializer._writer.WriteEndElement();\n }\n\n /// \n /// Writes Double as item or property\n /// \n /// The serializer to which the object is serialized.\n /// \n /// name of property. pass null for item\n /// Double to write\n /// serialization information about source\n internal static void WriteDouble(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n WriteRawString(serializer, streamName, property, XmlConvert.ToString((Double)source), entry);\n }\n\n /// \n /// Writes Char as item or property\n /// \n /// The serializer to which the object is serialized.\n /// \n /// name of property. pass null for item\n /// Char to write\n /// serialization information about source\n internal static void WriteChar(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n //Char is defined as unsigned short in schema\n WriteRawString(serializer, streamName, property, XmlConvert.ToString((UInt16)(Char)source), entry);\n }\n\n /// \n /// Writes Boolean as item or property\n /// \n /// The serializer to which the object is serialized.\n /// \n /// name of property. pass null for item\n /// Boolean to write\n /// serialization information about source\n internal static void WriteBoolean(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n WriteRawString(serializer, streamName, property, XmlConvert.ToString((Boolean)source), entry);\n }\n\n /// \n /// Writes Single as item or property\n /// \n /// The serializer to which the object is serialized.\n /// \n /// name of property. pass null for item\n /// single to write\n /// serialization information about source\n internal static void WriteSingle(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n WriteRawString(serializer, streamName, property, XmlConvert.ToString((Single)source), entry);\n }\n\n /// \n /// Writes TimeSpan as item or property\n /// \n /// The serializer to which the object is serialized.\n /// \n /// name of property. pass null for item\n /// DateTime to write\n /// serialization information about source\n internal static void WriteTimeSpan(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n WriteRawString(serializer, streamName, property, XmlConvert.ToString((TimeSpan)source), entry);\n }\n\n /// \n /// Writes Single as item or property\n /// \n /// The serializer to which the object is serialized.\n /// \n /// name of property. pass null for item\n /// bytearray to write\n /// serialization information about source\n internal static void WriteByteArray(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n Byte[] bytes = (Byte[])source;\n if (property != null)\n {\n serializer.WriteStartElement(entry.PropertyTag);\n serializer.WriteNameAttribute(property);\n }\n else\n {\n serializer.WriteStartElement(entry.ItemTag);\n }\n\n if (streamName != null)\n {\n serializer.WriteAttribute(SerializationStrings.StreamNameAttribute, streamName);\n }\n\n serializer._writer.WriteBase64(bytes, 0, bytes.Length);\n serializer._writer.WriteEndElement();\n }\n\n internal static void WriteXmlDocument(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n string xml = ((XmlDocument)source).OuterXml;\n WriteEncodedString(serializer, streamName, property, xml, entry);\n }\n\n internal static void WriteProgressRecord(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n ProgressRecord rec = (ProgressRecord)source;\n serializer.WriteStartElement(entry.PropertyTag);\n if (property != null)\n {\n serializer.WriteNameAttribute(property);\n }\n if (streamName != null)\n {\n serializer.WriteAttribute(SerializationStrings.StreamNameAttribute, streamName);\n }\n\n serializer.WriteEncodedElementString(SerializationStrings.ProgressRecordActivity, rec.Activity);\n serializer.WriteEncodedElementString(SerializationStrings.ProgressRecordActivityId, rec.ActivityId.ToString(CultureInfo.InvariantCulture));\n serializer.WriteOneObject(rec.CurrentOperation, null, null, 1);\n serializer.WriteEncodedElementString(SerializationStrings.ProgressRecordParentActivityId, rec.ParentActivityId.ToString(CultureInfo.InvariantCulture));\n serializer.WriteEncodedElementString(SerializationStrings.ProgressRecordPercentComplete, rec.PercentComplete.ToString(CultureInfo.InvariantCulture));\n serializer.WriteEncodedElementString(SerializationStrings.ProgressRecordType, rec.RecordType.ToString());\n serializer.WriteEncodedElementString(SerializationStrings.ProgressRecordSecondsRemaining, rec.SecondsRemaining.ToString(CultureInfo.InvariantCulture));\n serializer.WriteEncodedElementString(SerializationStrings.ProgressRecordStatusDescription, rec.StatusDescription);\n\n serializer._writer.WriteEndElement();\n }\n\n internal static void WriteSecureString(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry)\n {\n Dbg.Assert(serializer != null, \"caller should have validated the information\");\n Dbg.Assert(source != null, \"caller should have validated the information\");\n Dbg.Assert(entry != null, \"caller should have validated the information\");\n\n serializer.HandleSecureString(source, streamName, property);\n }\n\n #endregion known type serialization\n\n #region misc\n\n /// \n /// Writes start element in Monad namespace\n /// \n /// tag of element\n private void WriteStartElement(string elementTag)\n {\n Dbg.Assert(!string.IsNullOrEmpty(elementTag), \"Caller should validate the parameter\");\n if (SerializationOptions.NoNamespace == (_context.options & SerializationOptions.NoNamespace))\n {\n _writer.WriteStartElement(elementTag);\n }\n else\n {\n _writer.WriteStartElement(elementTag, SerializationStrings.MonadNamespace);\n }\n }\n\n /// \n /// Writes attribute in monad namespace\n /// \n /// name of attribute\n /// value of attribute\n private void WriteAttribute(string name, string value)\n {\n Dbg.Assert(!string.IsNullOrEmpty(name), \"Caller should validate the parameter\");\n Dbg.Assert(value != null, \"Caller should validate the parameter\");\n _writer.WriteAttributeString(name, value);\n }\n\n private void WriteNameAttribute(string value)\n {\n Dbg.Assert(!string.IsNullOrEmpty(value), \"Caller should validate the parameter\");\n WriteAttribute(\n SerializationStrings.NameAttribute,\n EncodeString(value));\n }\n\n /// \n /// Encodes the string to escape characters which would make XmlWriter.WriteString throw an exception.\n /// \n /// string to encode\n /// encoded string\n /// \n /// Output from this method can be reverted using XmlConvert.DecodeName method\n /// (or InternalDeserializer.DecodeString).\n /// This method has been introduced to produce shorter output than XmlConvert.EncodeName\n /// (which escapes everything that can't be part of an xml name - whitespace, punctuation).\n /// \n /// This method has been split into 2 parts to optimize its performance:\n /// 1) part1 (this method) checks if there are any encodable characters and \n /// if there aren't it simply (and efficiently) returns the original string\n /// 2) part2 (EncodeString(string, int)) picks up when part1 detects the first encodable \n /// character. It avoids looking at the characters already verified by part1\n /// and copies those already verified characters and then starts encoding \n /// the rest of the string.\n /// \n internal static string EncodeString(string s)\n {\n Dbg.Assert(s != null, \"Caller should validate the parameter\");\n\n int slen = s.Length;\n for (int i = 0; i < slen; ++i)\n {\n char c = s[i];\n // A control character is in ranges 0x00-0x1F or 0x7F-0x9F\n // The escape character is 0x5F ('_') if followed by an 'x'\n // A surrogate character is in range 0xD800-0xDFFF\n if (c <= 0x1F\n || (c >= 0x7F && c <= 0x9F)\n || (c >= 0xD800 && c <= 0xDFFF)\n || (c == 0x5F && (i + 1 < slen) &&\n ((s[i + 1] == 'x') || (s[i + 1] == 'X'))\n ))\n {\n return EncodeString(s, i);\n }\n }\n // No encodable characters were found above - simply return the original string\n return s;\n }\n\n private static readonly char[] s_hexlookup = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };\n\n /// \n /// This is the real workhorse that encodes strings.\n /// See for more information.\n /// \n /// string to encode\n /// indexOfFirstEncodableCharacter\n /// encoded string\n private static string EncodeString(string s, int indexOfFirstEncodableCharacter)\n {\n Dbg.Assert(s != null, \"Caller should validate the 's' parameter\");\n Dbg.Assert(indexOfFirstEncodableCharacter >= 0, \"Caller should verify validity of indexOfFirstEncodableCharacter\");\n Dbg.Assert(indexOfFirstEncodableCharacter < s.Length, \"Caller should verify validity of indexOfFirstEncodableCharacter\");\n\n int slen = s.Length;\n char[] result = new char[indexOfFirstEncodableCharacter + (slen - indexOfFirstEncodableCharacter) * 7];\n\n s.CopyTo(0, result, 0, indexOfFirstEncodableCharacter);\n int rlen = indexOfFirstEncodableCharacter;\n\n for (int i = indexOfFirstEncodableCharacter; i < slen; ++i)\n {\n char c = s[i];\n // A control character is in ranges 0x00-0x1F or 0x7F-0x9F\n // The escape character is 0x5F ('_') if followed by an 'x'\n // A surrogate character is in range 0xD800-0xDFFF\n if (c > 0x1F\n && (c < 0x7F || c > 0x9F)\n && (c < 0xD800 || c > 0xDFFF)\n && (c != 0x5F || ((i + 1 >= slen) ||\n ((s[i + 1] != 'x') && (s[i + 1] != 'X'))\n )))\n {\n result[rlen++] = c;\n }\n else if (c == 0x5F)\n {\n // Special case the escape character, encode _\n result[rlen + 0] = '_';\n result[rlen + 1] = 'x';\n result[rlen + 2] = '0';\n result[rlen + 3] = '0';\n result[rlen + 4] = '5';\n result[rlen + 5] = 'F';\n result[rlen + 6] = '_';\n rlen += 7;\n }\n else\n {\n // It is a control character or a unicode surrogate\n result[rlen + 0] = '_';\n result[rlen + 1] = 'x';\n\n result[rlen + 2 + 3] = s_hexlookup[c & 0x0F];\n c >>= 4;\n result[rlen + 2 + 2] = s_hexlookup[c & 0x0F];\n c >>= 4;\n result[rlen + 2 + 1] = s_hexlookup[c & 0x0F];\n c >>= 4;\n result[rlen + 2 + 0] = s_hexlookup[c & 0x0F];\n\n result[rlen + 6] = '_';\n\n rlen += 7;\n }\n }\n return new String(result, 0, rlen);\n }\n\n\n /// \n /// Writes element string in monad namespace\n /// \n /// \n /// \n private void WriteEncodedElementString(string name, string value)\n {\n Dbg.Assert(!string.IsNullOrEmpty(name), \"Caller should validate the parameter\");\n Dbg.Assert(value != null, \"Caller should validate the parameter\");\n this.CheckIfStopping();\n\n value = EncodeString(value);\n\n if (SerializationOptions.NoNamespace == (_context.options & SerializationOptions.NoNamespace))\n {\n _writer.WriteElementString(name, value);\n }\n else\n {\n _writer.WriteElementString(name, SerializationStrings.MonadNamespace, value);\n }\n }\n\n #endregion misc\n }\n\n /// \n /// This internal class provides methods for de-serializing mshObject.\n /// \n internal class InternalDeserializer\n {\n #region constructor\n\n /// \n /// XmlReader from which object is deserialized\n /// \n private readonly XmlReader _reader;\n\n /// \n /// Deserialization context\n /// \n private readonly DeserializationContext _context;\n\n /// Used by Remoting infrastructure. This TypeTable instance\n /// will be used by Serializer if ExecutionContext is not\n /// available (to get the ExecutionContext's TypeTable)\n private TypeTable _typeTable;\n\n /// \n /// If true, unknowntags are allowed inside PSObject\n /// \n private bool UnknownTagsAllowed\n {\n get\n {\n Dbg.Assert(_version.Major <= 1, \"Deserializer assumes clixml version is <= 1.1\");\n //If minor version is greater than 1, it means that there can be \n //some unknown tags in xml. Deserialization should ignore such element.\n return (_version.Minor > 1);\n }\n }\n\n private bool DuplicateRefIdsAllowed\n {\n get\n {\n#if DEBUG\n Dbg.Assert(_version.Major <= 1, \"Deserializer assumes clixml version is <= 1.1\");\n Version boundaryVersion = new Version(1, 1, 0, 1);\n return (_version < boundaryVersion);\n#else\n return true; // handle v1 stuff gracefully\n#endif\n }\n }\n\n /// \n /// Depth below top level - used to prevent stack overflow during deserialization\n /// \n private int _depthBelowTopLevel;\n\n /// \n /// Version declared by the clixml being read\n /// \n private Version _version;\n\n private const int MaxDepthBelowTopLevel = 50;\n\n private readonly ReferenceIdHandlerForDeserializer _objectRefIdHandler;\n private readonly ReferenceIdHandlerForDeserializer _typeRefIdHandler;\n\n /// \n /// \n /// \n /// \n /// \n internal InternalDeserializer(XmlReader reader, DeserializationContext context)\n {\n Dbg.Assert(reader != null, \"caller should validate the parameter\");\n\n _reader = reader;\n _context = context;\n\n _objectRefIdHandler = new ReferenceIdHandlerForDeserializer();\n _typeRefIdHandler = new ReferenceIdHandlerForDeserializer();\n }\n\n #endregion constructor\n\n #region deserialization\n /// \n /// Used by Remoting infrastructure. This TypeTable instance\n /// will be used by Deserializer if ExecutionContext is not\n /// available (to get the ExecutionContext's TypeTable)\n /// \n internal TypeTable TypeTable\n {\n get { return _typeTable; }\n set { _typeTable = value; }\n }\n\n /// \n /// Validates the version for correctness. Also validates that deserializer\n /// can deserialize this version.\n /// \n /// \n /// version in string format\n /// \n internal void ValidateVersion(string version)\n {\n Dbg.Assert(version != null, \"Caller should validate the parameter\");\n\n _version = null;\n Exception exceptionToRethrow = null;\n try\n {\n _version = new Version(version);\n }\n catch (ArgumentException e)\n {\n exceptionToRethrow = e;\n }\n catch (FormatException e)\n {\n exceptionToRethrow = e;\n }\n if (exceptionToRethrow != null)\n {\n throw NewXmlException(Serialization.InvalidVersion, exceptionToRethrow);\n }\n\n //Versioning Note:Future version of serialization can add new known types.\n //This version will ignore those known types, if they are base object.\n //It is expected that future version will still put information in base\n //and adapter properties which this serializer can read and use. \n //For example, assume the version 2 serialization engine supports a new known \n //type IPAddress. The version 1 deserializer doesn't know IPAddress as known \n //type and it must retrieve it as an PSObject. The version 2 serializer \n //can serialize this as follows:\n //\n // ...\n // \n // 120.23.35.53\n // \n // \n // 120.23.34.53\n // A\n // \n //\n // In above example, V1 serializer will ignore element and read\n // properties from \n // V2 serializer can read tag and ignore properties.\n // Read serialization note doc for information.\n\n //Now validate the major version number is 1\n if (_version.Major != 1)\n {\n throw NewXmlException(Serialization.UnexpectedVersion, null, _version.Major);\n }\n }\n\n private object ReadOneDeserializedObject(out string streamName, out bool isKnownPrimitiveType)\n {\n if (_reader.NodeType != XmlNodeType.Element)\n {\n throw NewXmlException(Serialization.InvalidNodeType, null,\n _reader.NodeType.ToString(), XmlNodeType.Element.ToString());\n }\n\n s_trace.WriteLine(\"Processing start node {0}\", _reader.LocalName);\n\n streamName = _reader.GetAttribute(SerializationStrings.StreamNameAttribute);\n isKnownPrimitiveType = false;\n\n //handle nil node\n if (IsNextElement(SerializationStrings.NilTag))\n {\n Skip();\n return null;\n }\n\n //Handle reference to previous deserialized object.\n if (IsNextElement(SerializationStrings.ReferenceTag))\n {\n string refId = _reader.GetAttribute(SerializationStrings.ReferenceIdAttribute);\n\n if (refId == null)\n {\n throw NewXmlException(Serialization.AttributeExpected, null, SerializationStrings.ReferenceIdAttribute);\n }\n\n object duplicate = _objectRefIdHandler.GetReferencedObject(refId);\n if (duplicate == null)\n {\n throw NewXmlException(Serialization.InvalidReferenceId, null, refId);\n }\n\n Skip();\n return duplicate;\n }\n\n //Handle primitive known types\n TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfoFromItemTag(_reader.LocalName);\n if (pktInfo != null)\n {\n s_trace.WriteLine(\"Primitive Knowntype Element {0}\", pktInfo.ItemTag);\n isKnownPrimitiveType = true;\n return ReadPrimaryKnownType(pktInfo);\n }\n\n //Handle PSObject\n if (IsNextElement(SerializationStrings.PSObjectTag))\n {\n s_trace.WriteLine(\"PSObject Element\");\n return ReadPSObject();\n }\n\n //If we are here, we have an unknown node. Unknown nodes may \n //be allowed inside PSObject. We do not allow them at top level.\n\n s_trace.TraceError(\"Invalid element {0} tag found\", _reader.LocalName);\n throw NewXmlException(Serialization.InvalidElementTag, null, _reader.LocalName);\n }\n\n private bool _isStopping = false;\n\n /// \n /// Called from a separate thread will stop the serialization process\n /// \n internal void Stop()\n {\n _isStopping = true;\n }\n\n private void CheckIfStopping()\n {\n if (_isStopping)\n {\n throw PSTraceSource.NewInvalidOperationException(Serialization.Stopping);\n }\n }\n\n internal const string CimInstanceMetadataProperty = \"__InstanceMetadata\";\n internal const string CimModifiedProperties = \"Modified\";\n internal const string CimClassMetadataProperty = \"__ClassMetadata\";\n internal const string CimClassNameProperty = \"ClassName\";\n internal const string CimNamespaceProperty = \"Namespace\";\n internal const string CimServerNameProperty = \"ServerName\";\n internal const string CimHashCodeProperty = \"Hash\";\n internal const string CimMiXmlProperty = \"MiXml\";\n\n private bool RehydrateCimInstanceProperty(\n CimInstance cimInstance,\n PSPropertyInfo deserializedProperty,\n HashSet namesOfModifiedProperties)\n {\n Dbg.Assert(cimInstance != null, \"Caller should make sure cimInstance != null\");\n Dbg.Assert(deserializedProperty != null, \"Caller should make sure deserializedProperty != null\");\n\n if (deserializedProperty.Name.Equals(RemotingConstants.ComputerNameNoteProperty, StringComparison.OrdinalIgnoreCase))\n {\n string psComputerNameValue = deserializedProperty.Value as string;\n if (psComputerNameValue != null)\n {\n cimInstance.SetCimSessionComputerName(psComputerNameValue);\n }\n return true;\n }\n\n CimProperty cimProperty = cimInstance.CimInstanceProperties[deserializedProperty.Name];\n if (cimProperty == null)\n {\n return false;\n }\n\n // TODO/FIXME - think if it is possible to do the array handling in a more efficient way\n object propertyValue = deserializedProperty.Value;\n if (propertyValue != null)\n {\n PSObject psoPropertyValue = PSObject.AsPSObject(propertyValue);\n if (psoPropertyValue.BaseObject is ArrayList)\n {\n if ((psoPropertyValue.InternalTypeNames == null) || (psoPropertyValue.InternalTypeNames.Count == 0))\n {\n return false;\n }\n string originalArrayTypeName = Deserializer.MaskDeserializationPrefix(psoPropertyValue.InternalTypeNames[0]);\n if (originalArrayTypeName == null)\n {\n return false;\n }\n Type originalArrayType;\n if (!LanguagePrimitives.TryConvertTo(originalArrayTypeName, CultureInfo.InvariantCulture, out originalArrayType))\n {\n return false;\n }\n if (!originalArrayType.IsArray)\n {\n return false;\n }\n object newPropertyValue;\n if (!LanguagePrimitives.TryConvertTo(propertyValue, originalArrayType, CultureInfo.InvariantCulture, out newPropertyValue))\n {\n return false;\n }\n psoPropertyValue = PSObject.AsPSObject(newPropertyValue);\n }\n propertyValue = psoPropertyValue.BaseObject;\n }\n\n try\n {\n cimProperty.Value = propertyValue;\n\n if (!namesOfModifiedProperties.Contains(deserializedProperty.Name))\n {\n cimProperty.IsValueModified = false;\n }\n#if DEBUG\n else\n {\n Dbg.Assert(cimProperty.IsValueModified, \"Deserialized CIM properties should by default be marked as 'modified' \");\n }\n#endif\n }\n catch (FormatException)\n {\n return false;\n }\n catch (InvalidCastException)\n {\n return false;\n }\n catch (ArgumentException)\n {\n return false;\n }\n catch (CimException)\n {\n return false;\n }\n\n return true;\n }\n\n private static Lazy s_cimDeserializer = new Lazy(CimDeserializer.Create);\n\n private CimClass RehydrateCimClass(PSPropertyInfo classMetadataProperty)\n {\n if ((classMetadataProperty == null) || (classMetadataProperty.Value == null))\n {\n return null;\n }\n\n IEnumerable deserializedClasses = LanguagePrimitives.GetEnumerable(classMetadataProperty.Value);\n if (deserializedClasses == null)\n {\n return null;\n }\n\n Stack> cimClassesToAddToCache = new Stack>();\n\n //\n // REHYDRATE CLASS METADATA\n //\n CimClass parentClass = null;\n CimClass currentClass = null;\n foreach (var deserializedClass in deserializedClasses)\n {\n parentClass = currentClass;\n\n if (deserializedClass == null)\n {\n return null;\n }\n PSObject psoDeserializedClass = PSObject.AsPSObject(deserializedClass);\n\n PSPropertyInfo namespaceProperty = psoDeserializedClass.InstanceMembers[InternalDeserializer.CimNamespaceProperty] as PSPropertyInfo;\n if (namespaceProperty == null)\n {\n return null;\n }\n string cimNamespace = namespaceProperty.Value as string;\n\n PSPropertyInfo classNameProperty = psoDeserializedClass.InstanceMembers[InternalDeserializer.CimClassNameProperty] as PSPropertyInfo;\n if (classNameProperty == null)\n {\n return null;\n }\n string cimClassName = classNameProperty.Value as string;\n\n PSPropertyInfo computerNameProperty = psoDeserializedClass.InstanceMembers[InternalDeserializer.CimServerNameProperty] as PSPropertyInfo;\n if (computerNameProperty == null)\n {\n return null;\n }\n string computerName = computerNameProperty.Value as string;\n\n PSPropertyInfo hashCodeProperty = psoDeserializedClass.InstanceMembers[InternalDeserializer.CimHashCodeProperty] as PSPropertyInfo;\n if (hashCodeProperty == null)\n {\n return null;\n }\n var hashCodeObject = hashCodeProperty.Value;\n if (hashCodeObject == null)\n {\n return null;\n }\n if (hashCodeObject is PSObject)\n {\n hashCodeObject = ((PSObject)hashCodeObject).BaseObject;\n }\n if (!(hashCodeObject is int))\n {\n return null;\n }\n int hashCode = (int)hashCodeObject;\n\n CimClassSerializationId cimClassSerializationId = new CimClassSerializationId(cimClassName, cimNamespace, computerName, hashCode);\n currentClass = _context.cimClassSerializationIdCache.GetCimClassFromCache(cimClassSerializationId);\n if (currentClass != null)\n {\n continue;\n }\n\n PSPropertyInfo miXmlProperty = psoDeserializedClass.InstanceMembers[InternalDeserializer.CimMiXmlProperty] as PSPropertyInfo;\n if ((miXmlProperty == null) || (miXmlProperty.Value == null))\n {\n return null;\n }\n string miXmlString = miXmlProperty.Value.ToString();\n byte[] miXmlBytes = Encoding.Unicode.GetBytes(miXmlString);\n uint offset = 0;\n try\n {\n currentClass = s_cimDeserializer.Value.DeserializeClass(\n miXmlBytes,\n ref offset,\n parentClass,\n computerName: computerName,\n namespaceName: cimNamespace);\n cimClassesToAddToCache.Push(new KeyValuePair(cimClassSerializationId, currentClass));\n }\n catch (CimException)\n {\n return null;\n }\n }\n\n //\n // UPDATE CLASSDECL DACHE\n //\n foreach (var cacheEntry in cimClassesToAddToCache)\n {\n _context.cimClassSerializationIdCache.AddCimClassToCache(cacheEntry.Key, cacheEntry.Value);\n }\n\n return currentClass;\n }\n\n // NOTE: Win7 change for refid-s that span multiple xml documents: ADMIN: changelist #226414\n\n private PSObject RehydrateCimInstance(PSObject deserializedObject)\n {\n if (!(deserializedObject.BaseObject is PSCustomObject))\n {\n return deserializedObject;\n }\n\n PSPropertyInfo classMetadataProperty = deserializedObject.InstanceMembers[CimClassMetadataProperty] as PSPropertyInfo;\n CimClass cimClass = RehydrateCimClass(classMetadataProperty);\n if (cimClass == null)\n {\n return deserializedObject;\n }\n CimInstance cimInstance;\n try\n {\n cimInstance = new CimInstance(cimClass);\n }\n catch (CimException)\n {\n return deserializedObject;\n }\n PSObject psoCimInstance = PSObject.AsPSObject(cimInstance);\n\n // process __InstanceMetadata\n HashSet namesOfModifiedProperties = new HashSet(StringComparer.OrdinalIgnoreCase);\n PSPropertyInfo instanceMetadataProperty = deserializedObject.InstanceMembers[CimInstanceMetadataProperty] as PSPropertyInfo;\n if ((instanceMetadataProperty != null) && (instanceMetadataProperty.Value != null))\n {\n PSObject instanceMetadata = PSObject.AsPSObject(instanceMetadataProperty.Value);\n\n PSPropertyInfo modifiedPropertiesProperty = instanceMetadata.InstanceMembers[CimModifiedProperties] as PSPropertyInfo;\n if ((modifiedPropertiesProperty != null) && (modifiedPropertiesProperty.Value != null))\n {\n string modifiedPropertiesString = modifiedPropertiesProperty.Value.ToString();\n foreach (string nameOfModifiedProperty in modifiedPropertiesString.Split(Utils.Separators.Space))\n {\n namesOfModifiedProperties.Add(nameOfModifiedProperty);\n }\n }\n }\n\n // process properties that were originally \"adapted\" properties\n if (deserializedObject.adaptedMembers != null)\n {\n foreach (PSMemberInfo deserializedMemberInfo in deserializedObject.adaptedMembers)\n {\n PSPropertyInfo deserializedProperty = deserializedMemberInfo as PSPropertyInfo;\n if (deserializedProperty == null)\n {\n continue;\n }\n\n bool propertyHandledSuccessfully = RehydrateCimInstanceProperty(\n cimInstance,\n deserializedProperty,\n namesOfModifiedProperties);\n\n if (!propertyHandledSuccessfully)\n {\n return deserializedObject;\n }\n }\n }\n\n // process properties that were originally \"extended\" properties\n foreach (PSMemberInfo deserializedMemberInfo in deserializedObject.InstanceMembers)\n {\n PSPropertyInfo deserializedProperty = deserializedMemberInfo as PSPropertyInfo;\n if (deserializedProperty == null)\n {\n continue;\n }\n\n // skip adapted properties\n if ((deserializedObject.adaptedMembers != null) && (deserializedObject.adaptedMembers[deserializedProperty.Name] != null))\n {\n continue;\n }\n\n // skip metadata introduced by CliXml/CimInstance serialization\n if (deserializedProperty.Name.Equals(CimClassMetadataProperty, StringComparison.OrdinalIgnoreCase))\n {\n continue;\n }\n\n // skip properties re-added by the client (i.e. through types.ps1xml)\n if (psoCimInstance.Properties[deserializedProperty.Name] != null)\n {\n continue;\n }\n\n PSNoteProperty noteProperty = new PSNoteProperty(deserializedProperty.Name, deserializedProperty.Value);\n psoCimInstance.Properties.Add(noteProperty);\n }\n\n return psoCimInstance;\n }\n\n /// \n /// Reads one object. At this point reader should be positioned\n /// at the start tag of object.\n /// \n /// \n /// Deserialized Object.\n /// \n internal object ReadOneObject(out string streamName)\n {\n this.CheckIfStopping();\n\n try\n {\n _depthBelowTopLevel++;\n\n Dbg.Assert(_depthBelowTopLevel <= MaxDepthBelowTopLevel, \"depthBelowTopLevel should be <= MaxDepthBelowTopLevel\");\n if (_depthBelowTopLevel == MaxDepthBelowTopLevel)\n {\n throw NewXmlException(Serialization.DeserializationTooDeep, null);\n }\n\n bool isKnownPrimitiveType;\n object result = ReadOneDeserializedObject(out streamName, out isKnownPrimitiveType);\n if (null == result)\n {\n return null;\n }\n\n if (!isKnownPrimitiveType)\n {\n PSObject mshSource = PSObject.AsPSObject(result);\n if (Deserializer.IsDeserializedInstanceOfType(mshSource, typeof(CimInstance)))\n {\n return RehydrateCimInstance(mshSource);\n }\n\n // Convert deserialized object to a user-defined type (specified in a types.ps1xml file)\n Type targetType = mshSource.GetTargetTypeForDeserialization(_typeTable);\n if (null != targetType)\n {\n Exception rehydrationException = null;\n try\n {\n object rehydratedResult = LanguagePrimitives.ConvertTo(\n result, targetType, true /* recurse */, CultureInfo.InvariantCulture, _typeTable);\n\n PSEtwLog.LogAnalyticVerbose(PSEventId.Serializer_RehydrationSuccess,\n PSOpcode.Rehydration, PSTask.Serialization, PSKeyword.Serializer,\n mshSource.InternalTypeNames.Key, targetType.FullName,\n rehydratedResult.GetType().FullName);\n\n return rehydratedResult;\n }\n catch (InvalidCastException e)\n {\n rehydrationException = e;\n }\n catch (ArgumentException e)\n {\n rehydrationException = e;\n }\n\n Dbg.Assert(rehydrationException != null,\n \"The only way to get here is with rehydrationException != null\");\n\n PSEtwLog.LogAnalyticError(PSEventId.Serializer_RehydrationFailure,\n PSOpcode.Rehydration, PSTask.Serialization, PSKeyword.Serializer,\n mshSource.InternalTypeNames.Key,\n targetType.FullName,\n rehydrationException.ToString(),\n rehydrationException.InnerException == null\n ? string.Empty\n : rehydrationException.InnerException.ToString());\n }\n }\n\n return result;\n }\n finally\n {\n _depthBelowTopLevel--;\n Dbg.Assert(_depthBelowTopLevel >= 0, \"depthBelowTopLevel should be >= 0\");\n }\n }\n\n private object ReadOneObject()\n {\n string ignore;\n return ReadOneObject(out ignore);\n }\n\n //Reads one PSObject\n private PSObject ReadPSObject()\n {\n PSObject dso = ReadAttributeAndCreatePSObject();\n\n //Read start element tag\n if (ReadStartElementAndHandleEmpty(SerializationStrings.PSObjectTag) == false)\n {\n //Empty element.\n return dso;\n }\n\n bool overrideTypeInfo = true;\n //Process all the child nodes\n while (_reader.NodeType == XmlNodeType.Element)\n {\n if (IsNextElement(SerializationStrings.TypeNamesTag) ||\n IsNextElement(SerializationStrings.TypeNamesReferenceTag))\n {\n ReadTypeNames(dso);\n overrideTypeInfo = false;\n }\n else if (IsNextElement(SerializationStrings.AdapterProperties))\n {\n ReadProperties(dso);\n }\n else if (IsNextElement(SerializationStrings.MemberSet))\n {\n ReadMemberSet(dso.InstanceMembers);\n }\n else if (IsNextElement(SerializationStrings.ToStringElementTag))\n {\n dso.ToStringFromDeserialization = ReadDecodedElementString(SerializationStrings.ToStringElementTag);\n dso.InstanceMembers.Add(PSObject.dotNetInstanceAdapter.GetDotNetMethod(dso, \"ToString\"));\n PSGetMemberBinder.SetHasInstanceMember(\"ToString\");\n // Fix for Win8:75437\n // The TokenText property is used in type conversion and it is not being populated during deserialization\n // As a result, parameter binding fails in the following case on a remote session\n // register-psssessionconfiguration -Name foo -psversion 3.0 \n // The value \"3.0\" is treated as a double and since the TokenText property holds null, the type converter tries to convert \n // from System.Double to System.Version using Parse method of System.Version and fails\n dso.TokenText = dso.ToStringFromDeserialization;\n }\n else\n {\n //Handle BaseObject\n object baseObject = null;\n ContainerType ct = ContainerType.None;\n\n //Check if tag is PrimaryKnownType. \n TypeSerializationInfo pktInfo = KnownTypes.GetTypeSerializationInfoFromItemTag(_reader.LocalName);\n if (pktInfo != null)\n {\n s_trace.WriteLine(\"Primitive Knowntype Element {0}\", pktInfo.ItemTag);\n baseObject = ReadPrimaryKnownType(pktInfo);\n }\n else if (IsKnownContainerTag(out ct))\n {\n s_trace.WriteLine(\"Found container node {0}\", ct);\n baseObject = ReadKnownContainer(ct);\n }\n else if (IsNextElement(SerializationStrings.PSObjectTag))\n {\n s_trace.WriteLine(\"Found PSObject node\");\n baseObject = ReadOneObject();\n }\n else\n {\n //We have an unknown tag\n s_trace.WriteLine(\"Unknown tag {0} encountered\", _reader.LocalName);\n if (UnknownTagsAllowed)\n {\n Skip();\n }\n else\n {\n throw NewXmlException(Serialization.InvalidElementTag, null, _reader.LocalName);\n }\n }\n if (baseObject != null)\n {\n dso.SetCoreOnDeserialization(baseObject, overrideTypeInfo);\n }\n }\n }\n\n ReadEndElement();\n\n PSObject immediateBasePso = dso.ImmediateBaseObject as PSObject;\n if (immediateBasePso != null)\n {\n PSObject.CopyDeserializerFields(source: immediateBasePso, target: dso);\n }\n\n return dso;\n }\n\n /// \n /// This function reads the refId attribute and creates a \n /// mshObject for that attribute\n /// \n /// mshObject which is created for refId\n private PSObject ReadAttributeAndCreatePSObject()\n {\n string refId = _reader.GetAttribute(SerializationStrings.ReferenceIdAttribute);\n PSObject sh = new PSObject();\n\n //RefId is not mandatory attribute\n if (refId != null)\n {\n s_trace.WriteLine(\"Read PSObject with refId: {0}\", refId);\n _objectRefIdHandler.SetRefId(sh, refId, this.DuplicateRefIdsAllowed);\n }\n return sh;\n }\n\n /// \n /// Read type names \n /// \n /// \n /// PSObject to which TypeNames are added\n /// \n private void ReadTypeNames(PSObject dso)\n {\n Dbg.Assert(dso != null, \"caller should validate the parameter\");\n Dbg.Assert(_reader.NodeType == XmlNodeType.Element, \"NodeType should be Element\");\n\n if (IsNextElement(SerializationStrings.TypeNamesTag))\n {\n Collection typeNames = new Collection();\n\n //Read refId attribute if available\n string refId = _reader.GetAttribute(SerializationStrings.ReferenceIdAttribute);\n\n s_trace.WriteLine(\"Processing TypeNamesTag with refId {0}\", refId);\n\n if (ReadStartElementAndHandleEmpty(SerializationStrings.TypeNamesTag))\n {\n while (_reader.NodeType == XmlNodeType.Element)\n {\n if (IsNextElement(SerializationStrings.TypeNamesItemTag))\n {\n string item = ReadDecodedElementString(SerializationStrings.TypeNamesItemTag);\n if (!string.IsNullOrEmpty(item))\n {\n Deserializer.AddDeserializationPrefix(ref item);\n typeNames.Add(item);\n }\n }\n else\n {\n throw NewXmlException(Serialization.InvalidElementTag, null, _reader.LocalName);\n }\n }\n ReadEndElement();\n }\n dso.InternalTypeNames = new ConsolidatedString(typeNames);\n\n if (refId != null)\n {\n _typeRefIdHandler.SetRefId(dso.InternalTypeNames, refId, this.DuplicateRefIdsAllowed);\n }\n }\n else if (IsNextElement(SerializationStrings.TypeNamesReferenceTag))\n {\n string refId = _reader.GetAttribute(SerializationStrings.ReferenceIdAttribute);\n s_trace.WriteLine(\"Processing TypeNamesReferenceTag with refId {0}\", refId);\n if (refId == null)\n {\n throw NewXmlException(Serialization.AttributeExpected, null, SerializationStrings.ReferenceIdAttribute);\n }\n\n ConsolidatedString typeNames = _typeRefIdHandler.GetReferencedObject(refId);\n if (typeNames == null)\n {\n throw NewXmlException(Serialization.InvalidTypeHierarchyReferenceId, null, refId);\n }\n\n // At this point we know that we will clone the ConsolidatedString object, so we might end up\n // allocating much more memory than the length of the xml string\n // We have to account for that to limit that to remoting quota and protect against OOM.\n _context.LogExtraMemoryUsage(\n typeNames.Key.Length * sizeof(char) // Key is shared among the cloned and original object\n // but the list of strings isn't. The expression to the left\n // is roughly the size of memory the list of strings occupies\n - 29 // size of in UTF8 encoding\n );\n dso.InternalTypeNames = new ConsolidatedString(typeNames);\n\n\n //Skip the node\n Skip();\n }\n else\n {\n Dbg.Assert(false, \"caller should validate that we do no reach here\");\n }\n }\n\n /// \n /// Read properties\n /// \n private void ReadProperties(PSObject dso)\n {\n Dbg.Assert(dso != null, \"caller should validate the parameter\");\n Dbg.Assert(_reader.NodeType == XmlNodeType.Element, \"NodeType should be Element\");\n\n //Since we are adding baseobject properties as propertybag, \n //mark the object as deserialized.\n dso.isDeserialized = true;\n dso.adaptedMembers = new PSMemberInfoInternalCollection();\n\n //Add the GetType method to the instance members, so that it works on deserialized psobjects\n dso.InstanceMembers.Add(PSObject.dotNetInstanceAdapter.GetDotNetMethod(dso, \"GetType\"));\n PSGetMemberBinder.SetHasInstanceMember(\"GetType\");\n\n //Set Clr members to a collection which is empty\n dso.clrMembers = new PSMemberInfoInternalCollection();\n\n if (ReadStartElementAndHandleEmpty(SerializationStrings.AdapterProperties))\n {\n //Read one or more property elements\n while (_reader.NodeType == XmlNodeType.Element)\n {\n string property = ReadNameAttribute();\n object value = ReadOneObject();\n PSProperty prop = new PSProperty(property, value);\n dso.adaptedMembers.Add(prop);\n }\n ReadEndElement();\n }\n }\n\n #region memberset\n\n /// \n /// Read memberset. \n /// \n /// \n /// collection to which members are added\n /// \n private void ReadMemberSet(PSMemberInfoCollection collection)\n {\n Dbg.Assert(collection != null, \"caller should validate the value\");\n\n if (ReadStartElementAndHandleEmpty(SerializationStrings.MemberSet))\n {\n while (_reader.NodeType == XmlNodeType.Element)\n {\n if (IsNextElement(SerializationStrings.MemberSet))\n {\n string name = ReadNameAttribute();\n PSMemberSet set = new PSMemberSet(name);\n collection.Add(set);\n ReadMemberSet(set.Members);\n\n PSGetMemberBinder.SetHasInstanceMember(name);\n }\n else\n {\n PSNoteProperty note = ReadNoteProperty();\n collection.Add(note);\n\n PSGetMemberBinder.SetHasInstanceMember(note.Name);\n }\n }\n\n ReadEndElement();\n }\n }\n\n /// \n /// read note \n /// \n /// \n private PSNoteProperty ReadNoteProperty()\n {\n string name = ReadNameAttribute();\n object value = ReadOneObject();\n PSNoteProperty note = new PSNoteProperty(name, value);\n return note;\n }\n\n #endregion memberset\n\n #region known container\n\n private bool IsKnownContainerTag(out ContainerType ct)\n {\n Dbg.Assert(_reader.NodeType == XmlNodeType.Element, \"Expected node type is element\");\n\n if (IsNextElement(SerializationStrings.DictionaryTag))\n {\n ct = ContainerType.Dictionary;\n }\n else if (IsNextElement(SerializationStrings.QueueTag))\n {\n ct = ContainerType.Queue;\n }\n else if (IsNextElement(SerializationStrings.StackTag))\n {\n ct = ContainerType.Stack;\n }\n else if (IsNextElement(SerializationStrings.ListTag))\n {\n ct = ContainerType.List;\n }\n else if (IsNextElement(SerializationStrings.CollectionTag))\n {\n ct = ContainerType.Enumerable;\n }\n else\n {\n ct = ContainerType.None;\n }\n\n return ct != ContainerType.None;\n }\n\n private object ReadKnownContainer(ContainerType ct)\n {\n switch (ct)\n {\n case ContainerType.Dictionary:\n return ReadDictionary(ct);\n\n case ContainerType.Enumerable:\n case ContainerType.List:\n case ContainerType.Queue:\n case ContainerType.Stack:\n return ReadListContainer(ct);\n\n default:\n Dbg.Assert(false, \"Unrecognized ContainerType enum\");\n return null;\n }\n }\n\n /// \n /// Read List Containers\n /// \n /// \n private object ReadListContainer(ContainerType ct)\n {\n Dbg.Assert(ct == ContainerType.Enumerable ||\n ct == ContainerType.List ||\n ct == ContainerType.Queue ||\n ct == ContainerType.Stack, \"ct should be queue, stack, enumerable or list\");\n\n ArrayList list = new ArrayList();\n if (ReadStartElementAndHandleEmpty(_reader.LocalName))\n {\n while (_reader.NodeType == XmlNodeType.Element)\n {\n list.Add(ReadOneObject());\n }\n ReadEndElement();\n }\n if (ct == ContainerType.Stack)\n {\n list.Reverse();\n return new Stack(list);\n }\n else if (ct == ContainerType.Queue)\n {\n return new Queue(list);\n }\n return list;\n }\n\n /// \n /// Deserialize Dictionary\n /// \n /// \n private object ReadDictionary(ContainerType ct)\n {\n Dbg.Assert(ct == ContainerType.Dictionary, \"Unrecognized ContainerType enum\");\n\n // We assume the hash table is a PowerShell hash table and hence uses\n // a case insensitive string comparer. If we discover a key collision,\n // we'll revert back to the default comparer.\n Hashtable table = new Hashtable(StringComparer.CurrentCultureIgnoreCase);\n int keyClashFoundIteration = 0;\n if (ReadStartElementAndHandleEmpty(SerializationStrings.DictionaryTag))\n {\n while (_reader.NodeType == XmlNodeType.Element)\n {\n ReadStartElement(SerializationStrings.DictionaryEntryTag);\n\n //Read Key\n if (_reader.NodeType != XmlNodeType.Element)\n {\n throw NewXmlException(Serialization.DictionaryKeyNotSpecified, null);\n }\n string name = ReadNameAttribute();\n if (string.Compare(name, SerializationStrings.DictionaryKey, StringComparison.OrdinalIgnoreCase) != 0)\n {\n throw NewXmlException(Serialization.InvalidDictionaryKeyName, null);\n }\n object key = ReadOneObject();\n\n if (key == null)\n {\n throw NewXmlException(Serialization.NullAsDictionaryKey, null);\n }\n //Read Value\n if (_reader.NodeType != XmlNodeType.Element)\n {\n throw NewXmlException(Serialization.DictionaryValueNotSpecified, null);\n }\n name = ReadNameAttribute();\n if (string.Compare(name, SerializationStrings.DictionaryValue, StringComparison.OrdinalIgnoreCase) != 0)\n {\n throw NewXmlException(Serialization.InvalidDictionaryValueName, null);\n }\n object value = ReadOneObject();\n\n // On the first collision, copy the hash table to one that uses the default comparer.\n if (table.ContainsKey(key) && (keyClashFoundIteration == 0))\n {\n keyClashFoundIteration++;\n Hashtable newHashTable = new Hashtable();\n foreach (DictionaryEntry entry in table)\n {\n newHashTable.Add(entry.Key, entry.Value);\n }\n\n table = newHashTable;\n }\n\n // win8: 389060. If there are still collisions even with case-sensitive default comparer,\n // use an IEqualityComparer that does object ref equality.\n if (table.ContainsKey(key) && (keyClashFoundIteration == 1))\n {\n keyClashFoundIteration++;\n IEqualityComparer equalityComparer = new ReferenceEqualityComparer();\n Hashtable newHashTable = new Hashtable(equalityComparer);\n foreach (DictionaryEntry entry in table)\n {\n newHashTable.Add(entry.Key, entry.Value);\n }\n\n table = newHashTable;\n }\n\n try\n {\n //Add entry to hashtable\n table.Add(key, value);\n }\n catch (ArgumentException e)\n {\n throw this.NewXmlException(Serialization.InvalidPrimitiveType, e, typeof(Hashtable));\n }\n\n ReadEndElement();\n }\n ReadEndElement();\n }\n\n return table;\n }\n\n #endregion known containers\n\n #endregion deserialization\n\n #region Getting XmlReaderSettings\n\n internal static XmlReaderSettings XmlReaderSettingsForCliXml { get; } = GetXmlReaderSettingsForCliXml();\n\n private static XmlReaderSettings GetXmlReaderSettingsForCliXml()\n {\n XmlReaderSettings xrs = new XmlReaderSettings();\n\n xrs.CheckCharacters = false;\n xrs.CloseInput = false;\n\n //The XML data needs to be in conformance to the rules for a well-formed XML 1.0 document.\n xrs.ConformanceLevel = ConformanceLevel.Document;\n xrs.IgnoreComments = true;\n xrs.IgnoreProcessingInstructions = true;\n xrs.IgnoreWhitespace = false;\n xrs.MaxCharactersFromEntities = 1024;\n //xrs.DtdProcessing = DtdProcessing.Prohibit; //because system.management.automation needs to build as 2.0\n //xrs.ProhibitDtd = true;\n#if !CORECLR\n // XmlReaderSettings.Schemas/ValidationFlags/ValidationType/XmlResolver Not In CoreCLR\n xrs.Schemas = null;\n xrs.ValidationFlags = System.Xml.Schema.XmlSchemaValidationFlags.None;\n xrs.ValidationType = ValidationType.None;\n xrs.XmlResolver = null;\n#endif\n return xrs;\n }\n\n internal static XmlReaderSettings XmlReaderSettingsForUntrustedXmlDocument { get; } = GetXmlReaderSettingsForUntrustedXmlDocument();\n\n private static XmlReaderSettings GetXmlReaderSettingsForUntrustedXmlDocument()\n {\n XmlReaderSettings settings = new XmlReaderSettings();\n\n settings.CheckCharacters = false;\n settings.ConformanceLevel = ConformanceLevel.Auto;\n settings.IgnoreComments = true;\n settings.IgnoreProcessingInstructions = true;\n settings.IgnoreWhitespace = true;\n settings.MaxCharactersFromEntities = 1024;\n settings.MaxCharactersInDocument = 512 * 1024 * 1024; // 512M characters = 1GB\n\n#if CORECLR // DtdProcessing.Parse Not In CoreCLR\n settings.DtdProcessing = DtdProcessing.Ignore;\n#else // XmlReaderSettings.ValidationFlags/ValidationType/XmlResolver Not In CoreCLR\n settings.DtdProcessing = DtdProcessing.Parse; // Allowing DTD parsing with limits of MaxCharactersFromEntities/MaxCharactersInDocument\n settings.ValidationFlags = System.Xml.Schema.XmlSchemaValidationFlags.None;\n settings.ValidationType = ValidationType.None;\n settings.XmlResolver = null;\n#endif\n return settings;\n }\n\n #endregion\n\n #region known type deserialization\n\n internal static object DeserializeBoolean(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n try\n {\n return XmlConvert.ToBoolean(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, e, typeof(bool).FullName);\n }\n }\n\n internal static object DeserializeByte(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return XmlConvert.ToByte(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(byte).FullName);\n }\n\n internal static object DeserializeChar(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return (Char)XmlConvert.ToUInt16(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(char).FullName);\n }\n\n internal static object DeserializeDateTime(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n try\n {\n return XmlConvert.ToDateTime(deserializer._reader.ReadElementContentAsString(), XmlDateTimeSerializationMode.RoundtripKind);\n }\n catch (FormatException e)\n {\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, e, typeof(DateTime).FullName);\n }\n }\n\n internal static object DeserializeDecimal(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return XmlConvert.ToDecimal(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(decimal).FullName);\n }\n\n internal static object DeserializeDouble(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return XmlConvert.ToDouble(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(double).FullName);\n }\n\n internal static object DeserializeGuid(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return XmlConvert.ToGuid(deserializer._reader.ReadElementContentAsString());\n }\n // MSDN for XmlConvert.ToGuid doesn't list any exceptions, but\n // Reflector shows that this just calls to new Guid(string)\n // which MSDN documents can throw Format/OverflowException\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(Guid).FullName);\n }\n\n internal static object DeserializeVersion(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return new Version(deserializer._reader.ReadElementContentAsString());\n }\n catch (ArgumentException e)\n {\n recognizedException = e;\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(Version).FullName);\n }\n\n internal static object DeserializeSemanticVersion(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return new SemanticVersion(deserializer._reader.ReadElementContentAsString());\n }\n catch (ArgumentException e)\n {\n recognizedException = e;\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(Version).FullName);\n }\n\n internal static object DeserializeInt16(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return XmlConvert.ToInt16(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(Int16).FullName);\n }\n\n internal static object DeserializeInt32(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return XmlConvert.ToInt32(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(Int32).FullName);\n }\n\n internal static object DeserializeInt64(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return XmlConvert.ToInt64(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(Int64).FullName);\n }\n\n internal static object DeserializeSByte(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return XmlConvert.ToSByte(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(sbyte).FullName);\n }\n\n internal static object DeserializeSingle(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return XmlConvert.ToSingle(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(float).FullName);\n }\n\n internal static object DeserializeScriptBlock(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n string scriptBlockBody = deserializer.ReadDecodedElementString(SerializationStrings.ScriptBlockTag);\n if (DeserializationOptions.DeserializeScriptBlocks == (deserializer._context.options & DeserializationOptions.DeserializeScriptBlocks))\n {\n return ScriptBlock.Create(scriptBlockBody);\n }\n else\n {\n //Scriptblock is deserialized as string\n return scriptBlockBody;\n }\n }\n\n internal static object DeserializeString(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n return deserializer.ReadDecodedElementString(SerializationStrings.StringTag);\n }\n\n internal static object DeserializeTimeSpan(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n try\n {\n return XmlConvert.ToTimeSpan(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, e, typeof(TimeSpan).FullName);\n }\n }\n\n internal static object DeserializeUInt16(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return XmlConvert.ToUInt16(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(UInt16).FullName);\n }\n\n internal static object DeserializeUInt32(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return XmlConvert.ToUInt32(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(UInt32).FullName);\n }\n\n internal static object DeserializeUInt64(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n Exception recognizedException = null;\n try\n {\n return XmlConvert.ToUInt64(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(UInt64).FullName);\n }\n\n internal static object DeserializeUri(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n try\n {\n string uriString = deserializer.ReadDecodedElementString(SerializationStrings.AnyUriTag);\n return new Uri(uriString, UriKind.RelativeOrAbsolute);\n }\n catch (UriFormatException e)\n {\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, e, typeof(Uri).FullName);\n }\n }\n\n internal static object DeserializeByteArray(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n try\n {\n return Convert.FromBase64String(deserializer._reader.ReadElementContentAsString());\n }\n catch (FormatException e)\n {\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, e, typeof(byte[]).FullName);\n }\n }\n\n /// \n internal static XmlDocument LoadUnsafeXmlDocument(FileInfo xmlPath, bool preserveNonElements, int? maxCharactersInDocument)\n {\n XmlDocument doc = null;\n // same FileStream options as Reflector shows for XmlDocument.Load(path) / XmlDownloadManager.GetStream:\n using (Stream stream = new FileStream(xmlPath.FullName, FileMode.Open, FileAccess.Read, FileShare.Read))\n {\n doc = LoadUnsafeXmlDocument(stream, preserveNonElements, maxCharactersInDocument);\n }\n\n return doc;\n }\n\n /// \n internal static XmlDocument LoadUnsafeXmlDocument(string xmlContents, bool preserveNonElements, int? maxCharactersInDocument)\n {\n using (TextReader textReader = new StringReader(xmlContents))\n {\n return LoadUnsafeXmlDocument(textReader, preserveNonElements, maxCharactersInDocument);\n }\n }\n\n /// \n internal static XmlDocument LoadUnsafeXmlDocument(Stream stream, bool preserveNonElements, int? maxCharactersInDocument)\n {\n using (TextReader textReader = new StreamReader(stream))\n {\n return LoadUnsafeXmlDocument(textReader, preserveNonElements, maxCharactersInDocument);\n }\n }\n\n /// \n internal static XmlDocument LoadUnsafeXmlDocument(TextReader textReader, bool preserveNonElements, int? maxCharactersInDocument)\n {\n XmlReaderSettings settings;\n if (maxCharactersInDocument.HasValue || preserveNonElements)\n {\n settings = InternalDeserializer.XmlReaderSettingsForUntrustedXmlDocument.Clone();\n if (maxCharactersInDocument.HasValue)\n {\n settings.MaxCharactersInDocument = maxCharactersInDocument.Value;\n }\n if (preserveNonElements)\n {\n settings.IgnoreWhitespace = false;\n settings.IgnoreProcessingInstructions = false;\n settings.IgnoreComments = false;\n }\n }\n else\n {\n settings = InternalDeserializer.XmlReaderSettingsForUntrustedXmlDocument;\n }\n\n try\n {\n XmlReader xmlReader = XmlReader.Create(textReader, settings);\n XmlDocument xmlDocument = new XmlDocument();\n xmlDocument.PreserveWhitespace = preserveNonElements;\n xmlDocument.Load(xmlReader);\n return xmlDocument;\n }\n catch (InvalidOperationException invalidOperationException)\n {\n throw new XmlException(invalidOperationException.Message, invalidOperationException);\n }\n }\n\n internal static object DeserializeXmlDocument(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n string docAsString = deserializer.ReadDecodedElementString(SerializationStrings.XmlDocumentTag);\n\n try\n {\n int? maxCharactersInDocument = null;\n if (deserializer._context.MaximumAllowedMemory.HasValue)\n {\n maxCharactersInDocument = deserializer._context.MaximumAllowedMemory.Value / sizeof(char);\n }\n\n XmlDocument doc = InternalDeserializer.LoadUnsafeXmlDocument(\n docAsString,\n true, /* preserve whitespace, comments, etc. */\n maxCharactersInDocument);\n\n deserializer._context.LogExtraMemoryUsage((docAsString.Length - doc.OuterXml.Length) * sizeof(char));\n\n return doc;\n }\n catch (XmlException e)\n {\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, e, typeof(XmlDocument).FullName);\n }\n }\n\n internal static object DeserializeProgressRecord(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n\n //\n // read deserialized elements of a progress record\n //\n\n deserializer.ReadStartElement(SerializationStrings.ProgressRecord);\n\n string activity = null, currentOperation = null, prt = null, statusDescription = null;\n int activityId = 0, parentActivityId = 0, percentComplete = 0, secondsRemaining = 0;\n\n Exception recognizedException = null;\n try\n {\n activity = deserializer.ReadDecodedElementString(SerializationStrings.ProgressRecordActivity);\n activityId = int.Parse(deserializer.ReadDecodedElementString(SerializationStrings.ProgressRecordActivityId), CultureInfo.InvariantCulture);\n\n object tmp = deserializer.ReadOneObject();\n currentOperation = (tmp == null) ? null : tmp.ToString();\n\n parentActivityId = int.Parse(deserializer.ReadDecodedElementString(SerializationStrings.ProgressRecordParentActivityId), CultureInfo.InvariantCulture);\n percentComplete = int.Parse(deserializer.ReadDecodedElementString(SerializationStrings.ProgressRecordPercentComplete), CultureInfo.InvariantCulture);\n prt = deserializer.ReadDecodedElementString(SerializationStrings.ProgressRecordType);\n secondsRemaining = int.Parse(deserializer.ReadDecodedElementString(SerializationStrings.ProgressRecordSecondsRemaining), CultureInfo.InvariantCulture);\n statusDescription = deserializer.ReadDecodedElementString(SerializationStrings.ProgressRecordStatusDescription);\n }\n catch (FormatException e)\n {\n recognizedException = e;\n }\n catch (OverflowException e)\n {\n recognizedException = e;\n }\n if (recognizedException != null)\n {\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, recognizedException, typeof(UInt64).FullName);\n }\n\n deserializer.ReadEndElement();\n\n //\n // Build the progress record\n //\n\n ProgressRecordType type;\n try\n {\n type = (ProgressRecordType)Enum.Parse(typeof(ProgressRecordType), prt, true);\n }\n catch (ArgumentException e)\n {\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, e, typeof(ProgressRecord).FullName);\n }\n\n try\n {\n ProgressRecord record = new ProgressRecord(activityId, activity, statusDescription);\n\n if (!string.IsNullOrEmpty(currentOperation))\n {\n record.CurrentOperation = currentOperation;\n }\n\n record.ParentActivityId = parentActivityId;\n record.PercentComplete = percentComplete;\n record.RecordType = type;\n record.SecondsRemaining = secondsRemaining;\n\n return record;\n }\n catch (ArgumentException e)\n {\n throw deserializer.NewXmlException(Serialization.InvalidPrimitiveType, e, typeof(ProgressRecord).FullName);\n }\n }\n\n internal static object DeserializeSecureString(InternalDeserializer deserializer)\n {\n Dbg.Assert(deserializer != null, \"Caller should validate the parameter\");\n\n //\n // read deserialized elements of a Secure String\n //\n return deserializer.ReadSecureString();\n }\n\n #endregion known type deserialization\n\n #region misc\n\n /// \n /// Check if LocalName of next element is \"tag\"\n /// \n /// \n /// \n private bool IsNextElement(string tag)\n {\n Dbg.Assert(!string.IsNullOrEmpty(tag), \"Caller should validate the parameter\");\n return (_reader.LocalName == tag) &&\n ((0 != (_context.options & DeserializationOptions.NoNamespace)) ||\n (_reader.NamespaceURI == SerializationStrings.MonadNamespace));\n }\n\n /// \n /// Read start element in monad namespace\n /// \n /// element tag to read\n /// true if not an empty element else false\n internal bool ReadStartElementAndHandleEmpty(string element)\n {\n Dbg.Assert(!string.IsNullOrEmpty(element), \"Caller should validate the parameter\");\n\n //IsEmpty is set to true when element is of the form \n bool isEmpty = _reader.IsEmptyElement;\n\n this.ReadStartElement(element);\n\n //This takes care of the case: or . In\n //this case isEmpty is false.\n if (isEmpty == false && _reader.NodeType == XmlNodeType.EndElement)\n {\n ReadEndElement();\n isEmpty = true;\n }\n return !isEmpty;\n }\n\n private void ReadStartElement(string element)\n {\n Dbg.Assert(!string.IsNullOrEmpty(element), \"Caller should validate the parameter\");\n\n if (DeserializationOptions.NoNamespace == (_context.options & DeserializationOptions.NoNamespace))\n {\n _reader.ReadStartElement(element);\n }\n else\n {\n _reader.ReadStartElement(element, SerializationStrings.MonadNamespace);\n }\n _reader.MoveToContent();\n }\n\n private void ReadEndElement()\n {\n _reader.ReadEndElement();\n _reader.MoveToContent();\n }\n\n private string ReadDecodedElementString(string element)\n {\n Dbg.Assert(!string.IsNullOrEmpty(element), \"Caller should validate the parameter\");\n this.CheckIfStopping();\n\n string temp = null;\n if (DeserializationOptions.NoNamespace == (_context.options & DeserializationOptions.NoNamespace))\n {\n temp = _reader.ReadElementContentAsString(element, string.Empty);\n }\n else\n {\n temp = _reader.ReadElementContentAsString(element, SerializationStrings.MonadNamespace);\n }\n _reader.MoveToContent();\n temp = DecodeString(temp);\n return temp;\n }\n\n /// \n /// Skips an element and all its child elements. \n /// Moves cursor to next content Node.\n /// \n private void Skip()\n {\n _reader.Skip();\n _reader.MoveToContent();\n }\n\n /// \n /// Reads Primary known type\n /// \n /// \n /// \n private object ReadPrimaryKnownType(TypeSerializationInfo pktInfo)\n {\n Dbg.Assert(pktInfo != null, \"Deserializer should be available\");\n Dbg.Assert(pktInfo.Deserializer != null, \"Deserializer should be available\");\n object result = pktInfo.Deserializer(this);\n _reader.MoveToContent();\n return result;\n }\n\n private object ReadSecureString()\n {\n String encryptedString = _reader.ReadElementContentAsString();\n\n try\n {\n object result;\n if (_context.cryptoHelper != null)\n {\n result = _context.cryptoHelper.DecryptSecureString(encryptedString);\n }\n else\n {\n result = Microsoft.PowerShell.SecureStringHelper.Unprotect(encryptedString);\n }\n\n _reader.MoveToContent();\n return result;\n }\n catch (PSCryptoException)\n {\n throw NewXmlException(Serialization.DeserializeSecureStringFailed, null);\n }\n }\n\n /// \n /// Helper function for building XmlException\n /// \n /// \n /// resource String \n /// \n /// \n /// \n /// params for format string obtained from resourceId\n /// \n private XmlException NewXmlException\n (\n string resourceString,\n Exception innerException,\n params object[] args\n )\n {\n Dbg.Assert(!string.IsNullOrEmpty(resourceString), \"Caller should validate the parameter\");\n\n string message = StringUtil.Format(resourceString, args);\n\n XmlException ex = null;\n IXmlLineInfo xmlLineInfo = _reader as IXmlLineInfo;\n if (xmlLineInfo != null)\n {\n if (xmlLineInfo.HasLineInfo())\n {\n ex = new XmlException\n (\n message,\n innerException,\n xmlLineInfo.LineNumber,\n xmlLineInfo.LinePosition\n );\n }\n }\n\n return ex ?? new XmlException(message, innerException);\n }\n\n private string ReadNameAttribute()\n {\n string encodedName = _reader.GetAttribute(SerializationStrings.NameAttribute);\n if (encodedName == null)\n {\n throw NewXmlException(Serialization.AttributeExpected, null, SerializationStrings.NameAttribute);\n }\n return DecodeString(encodedName);\n }\n\n private static string DecodeString(string s)\n {\n Dbg.Assert(s != null, \"Caller should validate the parameter\");\n return XmlConvert.DecodeName(s);\n }\n\n #endregion misc\n\n [TraceSourceAttribute(\"InternalDeserializer\", \"InternalDeserializer class\")]\n private static readonly PSTraceSource s_trace = PSTraceSource.GetTracer(\"InternalDeserializer\", \"InternalDeserializer class\");\n }\n\n /// \n /// Helper class for generating reference id.\n /// \n internal class ReferenceIdHandlerForSerializer where T : class\n {\n /// \n /// Get new reference id.\n /// \n /// New reference id\n private UInt64 GetNewReferenceId()\n {\n UInt64 refId = _seed++;\n return refId;\n }\n\n /// \n /// Seed is incremented by one after each reference generation\n /// \n private UInt64 _seed;\n\n // note:\n // any boxed UInt64 takes 16 bytes on the heap\n // one-character string (i.e. \"7\") takes 20 bytes on the heap\n private readonly IDictionary _object2refId;\n\n internal ReferenceIdHandlerForSerializer(IDictionary dictionary)\n {\n _object2refId = dictionary;\n }\n\n /// \n /// Assigns a RefId to the given object\n /// \n /// object to assign a RefId to\n /// RefId assigned to the object\n internal string SetRefId(T t)\n {\n if (_object2refId != null)\n {\n Dbg.Assert(!_object2refId.ContainsKey(t), \"SetRefId shouldn't be called when the object is already assigned a ref id\");\n UInt64 refId = GetNewReferenceId();\n _object2refId.Add(t, refId);\n return refId.ToString(System.Globalization.CultureInfo.InvariantCulture);\n }\n else\n {\n return null;\n }\n }\n\n /// \n /// Gets a RefId already assigned for the given object or null if there is no associated ref id\n /// \n /// \n /// \n internal string GetRefId(T t)\n {\n UInt64 refId;\n if ((_object2refId != null) && (_object2refId.TryGetValue(t, out refId)))\n {\n return refId.ToString(System.Globalization.CultureInfo.InvariantCulture);\n }\n else\n {\n return null;\n }\n }\n }\n\n internal class ReferenceIdHandlerForDeserializer where T : class\n {\n private readonly Dictionary _refId2object = new Dictionary();\n\n internal void SetRefId(T o, string refId, bool duplicateRefIdsAllowed)\n {\n#if DEBUG\n if (!duplicateRefIdsAllowed)\n {\n Dbg.Assert(!_refId2object.ContainsKey(refId), \"You can't change refId association\");\n }\n#endif\n _refId2object[refId] = o;\n }\n\n internal T GetReferencedObject(string refId)\n {\n Dbg.Assert(_refId2object.ContainsKey(refId), \"Reference id wasn't seen earlier\");\n T t;\n if (_refId2object.TryGetValue(refId, out t))\n {\n return t;\n }\n else\n {\n return null;\n }\n }\n }\n\n /// \n /// A delegate for serializing known type\n /// \n internal delegate void TypeSerializerDelegate(InternalSerializer serializer, string streamName, string property, object source, TypeSerializationInfo entry);\n /// \n /// A delegate for deserializing known type\n /// \n internal delegate object TypeDeserializerDelegate(InternalDeserializer deserializer);\n\n /// \n /// This class contains serialization information about a type.\n /// \n internal class TypeSerializationInfo\n {\n /// \n /// Constructor\n /// \n /// Type for which this entry is created\n /// ItemTag for the type\n /// PropertyTag for the type\n /// TypeSerializerDelegate for serializing the type\n /// TypeDeserializerDelegate for deserializing the type\n internal TypeSerializationInfo(Type type, string itemTag, string propertyTag, TypeSerializerDelegate serializer, TypeDeserializerDelegate deserializer)\n {\n Type = type;\n Serializer = serializer;\n Deserializer = deserializer;\n ItemTag = itemTag;\n PropertyTag = propertyTag;\n }\n\n #region properties\n\n /// \n /// Get the type for which this TypeSerializationInfo is created.\n /// \n internal Type Type { get; }\n\n /// \n /// Get the item tag for this type\n /// \n internal string ItemTag { get; }\n\n /// \n /// Get the Property tag for this type\n /// \n internal string PropertyTag { get; }\n\n /// \n /// Gets the delegate to serialize this type\n /// \n internal TypeSerializerDelegate Serializer { get; }\n\n /// \n /// Gets the delegate to deserialize this type\n /// \n internal TypeDeserializerDelegate Deserializer { get; }\n\n #endregion properties\n\n #region private\n\n #endregion private\n }\n\n /// \n /// A class for identifying types which are treated as KnownType by Monad.\n /// A KnownType is guranteed to be available on machine on which monad is \n /// running.\n /// \n internal static class KnownTypes\n {\n /// \n /// Static constructor \n /// \n static KnownTypes()\n {\n for (int i = 0; i < s_typeSerializationInfo.Length; i++)\n {\n s_knownTableKeyType.Add(s_typeSerializationInfo[i].Type.FullName, s_typeSerializationInfo[i]);\n s_knownTableKeyItemTag.Add(s_typeSerializationInfo[i].ItemTag, s_typeSerializationInfo[i]);\n }\n }\n\n /// \n /// Gets the type serialization information about a type\n /// \n /// Type for which information is retrieved\n /// TypeSerializationInfo for the type, null if it doesn't exist\n internal static TypeSerializationInfo GetTypeSerializationInfo(Type type)\n {\n TypeSerializationInfo temp;\n if (!s_knownTableKeyType.TryGetValue(type.FullName, out temp) && typeof(XmlDocument).IsAssignableFrom(type))\n {\n temp = s_xdInfo;\n }\n return temp;\n }\n\n /// \n /// Get TypeSerializationInfo using ItemTag as key\n /// \n /// ItemTag for which TypeSerializationInfo is to be fetched\n /// TypeSerializationInfo entry, null if no entry exist for the tag\n internal static TypeSerializationInfo GetTypeSerializationInfoFromItemTag(string itemTag)\n {\n TypeSerializationInfo temp;\n s_knownTableKeyItemTag.TryGetValue(itemTag, out temp);\n return temp;\n }\n\n #region private_fields\n\n //TypeSerializationInfo for XmlDocument\n private static readonly TypeSerializationInfo s_xdInfo =\n new TypeSerializationInfo(typeof(XmlDocument),\n SerializationStrings.XmlDocumentTag,\n SerializationStrings.XmlDocumentTag,\n InternalSerializer.WriteXmlDocument,\n InternalDeserializer.DeserializeXmlDocument);\n\n /// \n /// Array of known types.\n /// \n private static readonly TypeSerializationInfo[] s_typeSerializationInfo = new TypeSerializationInfo[]\n {\n new TypeSerializationInfo(typeof(Boolean),\n SerializationStrings.BooleanTag,\n SerializationStrings.BooleanTag,\n InternalSerializer.WriteBoolean,\n InternalDeserializer.DeserializeBoolean),\n\n new TypeSerializationInfo(typeof(Byte),\n SerializationStrings.UnsignedByteTag,\n SerializationStrings.UnsignedByteTag,\n null,\n InternalDeserializer.DeserializeByte),\n\n new TypeSerializationInfo(typeof(Char),\n SerializationStrings.CharTag,\n SerializationStrings.CharTag,\n InternalSerializer.WriteChar,\n InternalDeserializer.DeserializeChar),\n\n new TypeSerializationInfo(typeof(DateTime),\n SerializationStrings.DateTimeTag,\n SerializationStrings.DateTimeTag,\n InternalSerializer.WriteDateTime,\n InternalDeserializer.DeserializeDateTime),\n\n new TypeSerializationInfo(typeof(Decimal),\n SerializationStrings.DecimalTag,\n SerializationStrings.DecimalTag,\n null,\n InternalDeserializer.DeserializeDecimal),\n\n new TypeSerializationInfo(typeof(Double),\n SerializationStrings.DoubleTag,\n SerializationStrings.DoubleTag,\n InternalSerializer.WriteDouble,\n InternalDeserializer.DeserializeDouble),\n\n new TypeSerializationInfo(typeof(Guid),\n SerializationStrings.GuidTag,\n SerializationStrings.GuidTag,\n null,\n InternalDeserializer.DeserializeGuid),\n new TypeSerializationInfo(typeof(Int16),\n SerializationStrings.ShortTag,\n SerializationStrings.ShortTag,\n null,\n InternalDeserializer.DeserializeInt16),\n\n new TypeSerializationInfo(typeof(Int32),\n SerializationStrings.IntTag,\n SerializationStrings.IntTag,\n null,\n InternalDeserializer.DeserializeInt32),\n\n new TypeSerializationInfo(typeof(Int64),\n SerializationStrings.LongTag,\n SerializationStrings.LongTag,\n null,\n InternalDeserializer.DeserializeInt64),\n\n new TypeSerializationInfo(typeof(SByte),\n SerializationStrings.ByteTag,\n SerializationStrings.ByteTag,\n null,\n InternalDeserializer.DeserializeSByte),\n\n new TypeSerializationInfo(typeof(Single),\n SerializationStrings.FloatTag,\n SerializationStrings.FloatTag,\n InternalSerializer.WriteSingle,\n InternalDeserializer.DeserializeSingle),\n\n new TypeSerializationInfo(typeof(ScriptBlock),\n SerializationStrings.ScriptBlockTag,\n SerializationStrings.ScriptBlockTag,\n InternalSerializer.WriteScriptBlock,\n InternalDeserializer.DeserializeScriptBlock),\n\n new TypeSerializationInfo(typeof(String),\n SerializationStrings.StringTag,\n SerializationStrings.StringTag,\n InternalSerializer.WriteEncodedString,\n InternalDeserializer.DeserializeString),\n\n new TypeSerializationInfo(typeof(TimeSpan),\n SerializationStrings.DurationTag,\n SerializationStrings.DurationTag,\n InternalSerializer.WriteTimeSpan,\n InternalDeserializer.DeserializeTimeSpan),\n\n new TypeSerializationInfo(typeof(UInt16),\n SerializationStrings.UnsignedShortTag,\n SerializationStrings.UnsignedShortTag,\n null,\n InternalDeserializer.DeserializeUInt16),\n\n new TypeSerializationInfo(typeof(UInt32),\n SerializationStrings.UnsignedIntTag,\n SerializationStrings.UnsignedIntTag,\n null,\n InternalDeserializer.DeserializeUInt32),\n\n new TypeSerializationInfo(typeof(UInt64),\n SerializationStrings.UnsignedLongTag,\n SerializationStrings.UnsignedLongTag,\n null,\n InternalDeserializer.DeserializeUInt64),\n\n new TypeSerializationInfo(typeof(Uri),\n SerializationStrings.AnyUriTag,\n SerializationStrings.AnyUriTag,\n InternalSerializer.WriteUri,\n InternalDeserializer.DeserializeUri),\n\n new TypeSerializationInfo(typeof(byte[]),\n SerializationStrings.Base64BinaryTag,\n SerializationStrings.Base64BinaryTag,\n InternalSerializer.WriteByteArray,\n InternalDeserializer.DeserializeByteArray),\n\n new TypeSerializationInfo(typeof(System.Version),\n SerializationStrings.VersionTag,\n SerializationStrings.VersionTag,\n InternalSerializer.WriteVersion,\n InternalDeserializer.DeserializeVersion),\n\n new TypeSerializationInfo(typeof(SemanticVersion),\n SerializationStrings.SemanticVersionTag,\n SerializationStrings.SemanticVersionTag,\n InternalSerializer.WriteSemanticVersion,\n InternalDeserializer.DeserializeSemanticVersion),\n\n s_xdInfo,\n\n new TypeSerializationInfo(typeof(ProgressRecord),\n SerializationStrings.ProgressRecord,\n SerializationStrings.ProgressRecord,\n InternalSerializer.WriteProgressRecord,\n InternalDeserializer.DeserializeProgressRecord),\n\n new TypeSerializationInfo(typeof(SecureString),\n SerializationStrings.SecureStringTag,\n SerializationStrings.SecureStringTag,\n InternalSerializer.WriteSecureString,\n InternalDeserializer.DeserializeSecureString),\n };\n\n /// \n /// Hashtable of knowntypes. \n /// Key is Type.FullName and value is Type object.\n /// \n private static readonly Dictionary s_knownTableKeyType = new Dictionary();\n\n /// \n /// Hashtable of knowntypes. Key is ItemTag\n /// \n private static readonly Dictionary s_knownTableKeyItemTag = new Dictionary();\n\n #endregion private_fields\n }\n\n /// \n /// This class contains helper routined for serialization/deserialization\n /// \n internal static class SerializationUtilities\n {\n /// \n /// Extracts the value of a note property from a PSObject; returns null if the property does not exist\n /// \n internal static object GetPropertyValue(PSObject psObject, string propertyName)\n {\n PSNoteProperty property = (PSNoteProperty)psObject.Properties[propertyName];\n\n if (property == null)\n {\n return null;\n }\n\n return property.Value;\n }\n\n /// \n /// Returns the BaseObject of a note property encoded as a PSObject; returns null if the property does not exist\n /// \n internal static object GetPsObjectPropertyBaseObject(PSObject psObject, string propertyName)\n {\n PSObject propertyPsObject = (PSObject)GetPropertyValue(psObject, propertyName);\n\n if (propertyPsObject == null)\n {\n return null;\n }\n\n return propertyPsObject.BaseObject;\n }\n\n /// \n /// Checks if source is known container type and returns appropriate \n /// information\n /// \n /// \n /// \n /// \n /// \n internal static void GetKnownContainerTypeInfo(\n object source,\n out ContainerType ct,\n out IDictionary dictionary,\n out IEnumerable enumerable)\n {\n Dbg.Assert(source != null, \"caller should validate the parameter\");\n\n ct = ContainerType.None;\n dictionary = null;\n enumerable = null;\n\n dictionary = source as IDictionary;\n if (dictionary != null)\n {\n ct = ContainerType.Dictionary;\n }\n else if (source is Stack)\n {\n ct = ContainerType.Stack;\n enumerable = LanguagePrimitives.GetEnumerable(source);\n Dbg.Assert(enumerable != null, \"Stack is enumerable\");\n }\n else if (source is Queue)\n {\n ct = ContainerType.Queue;\n enumerable = LanguagePrimitives.GetEnumerable(source);\n Dbg.Assert(enumerable != null, \"Queue is enumerable\");\n }\n else if (source is IList)\n {\n ct = ContainerType.List;\n enumerable = LanguagePrimitives.GetEnumerable(source);\n Dbg.Assert(enumerable != null, \"IList is enumerable\");\n }\n else\n {\n Type gt = source.GetType();\n if (gt.GetTypeInfo().IsGenericType)\n {\n if (DerivesFromGenericType(gt, typeof(Stack<>)))\n {\n ct = ContainerType.Stack;\n enumerable = LanguagePrimitives.GetEnumerable(source);\n Dbg.Assert(enumerable != null, \"Stack is enumerable\");\n }\n else if (DerivesFromGenericType(gt, typeof(Queue<>)))\n {\n ct = ContainerType.Queue;\n enumerable = LanguagePrimitives.GetEnumerable(source);\n Dbg.Assert(enumerable != null, \"Queue is enumerable\");\n }\n else if (DerivesFromGenericType(gt, typeof(List<>)))\n {\n ct = ContainerType.List;\n enumerable = LanguagePrimitives.GetEnumerable(source);\n Dbg.Assert(enumerable != null, \"Queue is enumerable\");\n }\n }\n }\n\n // Check if LanguagePrimitive.GetEnumerable can do some magic to get IEnumerable instance\n if (ct == ContainerType.None)\n {\n try\n {\n enumerable = LanguagePrimitives.GetEnumerable(source);\n if (enumerable != null)\n {\n ct = ContainerType.Enumerable;\n }\n }\n catch (Exception exception)\n {\n // Catch-all OK. This is a third-party call-out.\n CommandProcessorBase.CheckForSevereException(exception);\n\n PSEtwLog.LogAnalyticWarning(PSEventId.Serializer_EnumerationFailed, PSOpcode.Exception,\n PSTask.Serialization, PSKeyword.Serializer, source.GetType().AssemblyQualifiedName,\n exception.ToString());\n }\n }\n\n //Check if type is IEnumerable \n //(LanguagePrimitives.GetEnumerable above should be enough - the check below is to preserve \n // backcompatibility in some corner-cases (see bugs in Windows7 - #372562 and #372563))\n if (ct == ContainerType.None)\n {\n enumerable = source as IEnumerable;\n if (enumerable != null)\n {\n //WinBlue: 206515 - There are no elements in the source. The source is of type XmlLinkedNode (which derives from XmlNode which implements IEnumerable). \n // So, adding an additional check to see if this contains any elements\n IEnumerator enumerator = enumerable.GetEnumerator();\n if (enumerator != null && enumerator.MoveNext())\n {\n ct = ContainerType.Enumerable;\n }\n }\n }\n }\n\n /// \n /// Checks if derived is of type baseType or a type derived from baseType\n /// \n /// \n /// \n /// \n private static bool DerivesFromGenericType(Type derived, Type baseType)\n {\n Dbg.Assert(derived != null, \"caller should validate the parameter\");\n Dbg.Assert(baseType != null, \"caller should validate the parameter\");\n while (derived != null)\n {\n if (derived.GetTypeInfo().IsGenericType)\n derived = derived.GetGenericTypeDefinition();\n\n if (derived == baseType)\n {\n return true;\n }\n derived = derived.GetTypeInfo().BaseType;\n }\n return false;\n }\n\n /// \n /// Gets the \"ToString\" from PSObject.\n /// \n /// \n /// \n /// PSObject to be converted to string\n /// \n /// \n /// \n /// \"ToString\" value\n /// \n internal static string GetToString(object source)\n {\n Dbg.Assert(source != null, \"caller should have validated the information\");\n\n // fall back value\n string result = null;\n\n try\n {\n result = Convert.ToString(source, CultureInfo.InvariantCulture);\n }\n catch (Exception e)\n {\n // Catch-all OK. This is a third-party call-out.\n CommandProcessorBase.CheckForSevereException(e);\n\n PSEtwLog.LogAnalyticWarning(\n PSEventId.Serializer_ToStringFailed, PSOpcode.Exception, PSTask.Serialization,\n PSKeyword.Serializer | PSKeyword.UseAlwaysAnalytic,\n source.GetType().AssemblyQualifiedName,\n e.ToString());\n }\n\n return result;\n }\n\n internal static string GetToStringForPrimitiveObject(PSObject pso)\n {\n // if object is not wrapped in a PSObject, then nothing modifies the ToString value of the primitive object\n if (pso == null)\n {\n return null;\n }\n\n // preserve ToString throughout deserialization/*re*serialization\n if (pso.ToStringFromDeserialization != null)\n {\n return pso.ToStringFromDeserialization;\n }\n\n // preserve token text (i.e. double: 0E1517567410; see Windows 7 bug #694057 for more details)\n string token = pso.TokenText;\n if (token != null)\n {\n string originalToString = GetToString(pso.BaseObject);\n if (originalToString == null || !string.Equals(token, originalToString, StringComparison.Ordinal))\n {\n return token;\n }\n }\n\n // no need to write element otherwise - the ToString method of a deserialized, live primitive object will return the right value\n return null;\n }\n\n internal static PSMemberInfoInternalCollection GetSpecificPropertiesToSerialize(PSObject source, Collection> allPropertiesCollection, TypeTable typeTable)\n {\n if (source == null)\n {\n return null;\n }\n\n if (source.GetSerializationMethod(typeTable) == SerializationMethod.SpecificProperties)\n {\n PSEtwLog.LogAnalyticVerbose(\n PSEventId.Serializer_ModeOverride, PSOpcode.SerializationSettings, PSTask.Serialization,\n PSKeyword.Serializer | PSKeyword.UseAlwaysAnalytic,\n source.InternalTypeNames.Key,\n (UInt32)(SerializationMethod.SpecificProperties));\n\n PSMemberInfoInternalCollection specificProperties =\n new PSMemberInfoInternalCollection();\n PSMemberInfoIntegratingCollection allProperties =\n new PSMemberInfoIntegratingCollection(\n source,\n allPropertiesCollection);\n\n Collection namesOfPropertiesToSerialize = source.GetSpecificPropertiesToSerialize(typeTable);\n foreach (string propertyName in namesOfPropertiesToSerialize)\n {\n PSPropertyInfo property = allProperties[propertyName];\n if (property == null)\n {\n PSEtwLog.LogAnalyticWarning(\n PSEventId.Serializer_SpecificPropertyMissing, PSOpcode.Exception, PSTask.Serialization,\n PSKeyword.Serializer | PSKeyword.UseAlwaysAnalytic,\n source.InternalTypeNames.Key,\n propertyName);\n }\n else\n {\n specificProperties.Add(property);\n }\n }\n\n return specificProperties;\n }\n\n return null;\n }\n\n internal static object GetPropertyValueInThreadSafeManner(PSPropertyInfo property, bool canUseDefaultRunspaceInThreadSafeManner, out bool success)\n {\n Dbg.Assert(property != null, \"Caller should validate the parameter\");\n\n if (!property.IsGettable)\n {\n success = false;\n return null;\n }\n\n PSAliasProperty alias = property as PSAliasProperty;\n if (alias != null)\n {\n property = alias.ReferencedMember as PSPropertyInfo;\n }\n\n PSScriptProperty script = property as PSScriptProperty;\n Dbg.Assert(script == null || script.GetterScript != null, \"scriptProperty.IsGettable => (scriptProperty.GetterScript != null)\");\n if ((script != null) && (!canUseDefaultRunspaceInThreadSafeManner))\n {\n PSEtwLog.LogAnalyticWarning(\n PSEventId.Serializer_ScriptPropertyWithoutRunspace, PSOpcode.Exception, PSTask.Serialization,\n PSKeyword.Serializer | PSKeyword.UseAlwaysAnalytic,\n property.Name,\n property.instance == null ? string.Empty : PSObject.GetTypeNames(property.instance).Key,\n script.GetterScript.ToString());\n\n success = false;\n return null;\n }\n\n try\n {\n object value = property.Value;\n success = true;\n return value;\n }\n catch (ExtendedTypeSystemException e)\n {\n PSEtwLog.LogAnalyticWarning(\n PSEventId.Serializer_PropertyGetterFailed, PSOpcode.Exception, PSTask.Serialization,\n PSKeyword.Serializer | PSKeyword.UseAlwaysAnalytic,\n property.Name,\n property.instance == null ? string.Empty : PSObject.GetTypeNames(property.instance).Key,\n e.ToString(),\n e.InnerException == null ? string.Empty : e.InnerException.ToString());\n\n success = false;\n return null;\n }\n }\n }\n\n /// \n /// A dictionary from object to T where\n /// 1) keys are objects, \n /// 2) keys use reference equality, \n /// 3) dictionary keeps only weak references to keys\n /// \n /// type of dictionary values\n internal class WeakReferenceDictionary : IDictionary\n {\n private class WeakReferenceEqualityComparer : IEqualityComparer\n {\n public bool Equals(WeakReference x, WeakReference y)\n {\n object tx = x.Target;\n if (tx == null)\n {\n return false; // collected object is not equal to anything (object.ReferenceEquals(null, null) == true)\n }\n\n object ty = y.Target;\n if (ty == null)\n {\n return false; // collected object is not equal to anything (object.ReferenceEquals(null, null) == true)\n }\n\n return object.ReferenceEquals(tx, ty);\n }\n\n public int GetHashCode(WeakReference obj)\n {\n object t = obj.Target;\n if (t == null)\n {\n // collected object doesn't have a hash code\n // return an arbitrary hashcode here and fall back on Equal method for comparison\n return RuntimeHelpers.GetHashCode(obj); // RuntimeHelpers.GetHashCode(null) returns 0 - this would cause many hashtable collisions for WeakReferences to dead objects\n }\n else\n {\n return RuntimeHelpers.GetHashCode(t);\n }\n }\n }\n\n private readonly IEqualityComparer _weakEqualityComparer;\n private Dictionary _dictionary;\n\n public WeakReferenceDictionary()\n {\n _weakEqualityComparer = new WeakReferenceEqualityComparer();\n _dictionary = new Dictionary(_weakEqualityComparer);\n }\n\n#if DEBUG\n private const int initialCleanupTriggerSize = 2; // 2 will stress this code more\n#else\n private const int initialCleanupTriggerSize = 1000;\n#endif\n private int _cleanupTriggerSize = initialCleanupTriggerSize;\n\n private void CleanUp()\n {\n if (this.Count > _cleanupTriggerSize)\n {\n Dictionary alive = new Dictionary(_weakEqualityComparer);\n foreach (KeyValuePair weakKeyValuePair in _dictionary)\n {\n object key = weakKeyValuePair.Key.Target;\n if (key != null)\n {\n alive.Add(weakKeyValuePair.Key, weakKeyValuePair.Value);\n }\n }\n _dictionary = alive;\n _cleanupTriggerSize = initialCleanupTriggerSize + this.Count * 2;\n }\n }\n\n #region IDictionary Members\n\n public void Add(object key, T value)\n {\n _dictionary.Add(new WeakReference(key), value);\n this.CleanUp();\n }\n\n public bool ContainsKey(object key)\n {\n return _dictionary.ContainsKey(new WeakReference(key));\n }\n\n public ICollection Keys\n {\n get\n {\n List keys = new List(_dictionary.Keys.Count);\n foreach (WeakReference weakKey in _dictionary.Keys)\n {\n object key = weakKey.Target;\n if (key != null)\n {\n keys.Add(key);\n }\n }\n return keys;\n }\n }\n\n public bool Remove(object key)\n {\n return _dictionary.Remove(new WeakReference(key));\n }\n\n public bool TryGetValue(object key, out T value)\n {\n WeakReference weakKey = new WeakReference(key);\n return _dictionary.TryGetValue(weakKey, out value);\n }\n\n public ICollection Values\n {\n get\n {\n return _dictionary.Values;\n }\n }\n\n public T this[object key]\n {\n get\n {\n return _dictionary[new WeakReference(key)];\n }\n set\n {\n _dictionary[new WeakReference(key)] = value;\n this.CleanUp();\n }\n }\n\n #endregion\n\n #region ICollection> Members\n\n private ICollection> WeakCollection\n {\n get\n {\n return _dictionary;\n }\n }\n\n private static KeyValuePair WeakKeyValuePair(KeyValuePair publicKeyValuePair)\n {\n return new KeyValuePair(new WeakReference(publicKeyValuePair.Key), publicKeyValuePair.Value);\n }\n\n public void Add(KeyValuePair item)\n {\n this.WeakCollection.Add(WeakKeyValuePair(item));\n this.CleanUp();\n }\n\n public void Clear()\n {\n this.WeakCollection.Clear();\n }\n\n public bool Contains(KeyValuePair item)\n {\n return this.WeakCollection.Contains(WeakKeyValuePair(item));\n }\n\n public void CopyTo(KeyValuePair[] array, int arrayIndex)\n {\n List> rawList = new List>(this.WeakCollection.Count);\n foreach (KeyValuePair keyValuePair in this)\n {\n rawList.Add(keyValuePair);\n }\n rawList.CopyTo(array, arrayIndex);\n }\n\n public int Count\n {\n get\n {\n return this.WeakCollection.Count;\n }\n }\n\n public bool IsReadOnly\n {\n get\n {\n return this.WeakCollection.IsReadOnly;\n }\n }\n\n public bool Remove(KeyValuePair item)\n {\n return this.WeakCollection.Remove(WeakKeyValuePair(item));\n }\n\n #endregion\n\n #region IEnumerable> Members\n\n public IEnumerator> GetEnumerator()\n {\n foreach (KeyValuePair weakKeyValuePair in this.WeakCollection)\n {\n object key = weakKeyValuePair.Key.Target;\n if (key != null)\n {\n yield return new KeyValuePair(key, weakKeyValuePair.Value);\n }\n }\n }\n\n #endregion\n\n #region IEnumerable Members\n\n IEnumerator IEnumerable.GetEnumerator()\n {\n IEnumerable> enumerable = this;\n IEnumerator> enumerator = enumerable.GetEnumerator();\n return enumerator;\n }\n\n #endregion\n }\n\n /// \n /// is a that is limited to \n /// 1) case-insensitive strings as keys and \n /// 2) values that can be serialized and deserialized during PowerShell remoting handshake \n /// (in major-version compatible versions of PowerShell remoting)\n /// \n [Serializable]\n public sealed class PSPrimitiveDictionary : Hashtable\n {\n #region Constructors\n\n /// \n /// Initializes a new empty instance of the class\n /// \n public PSPrimitiveDictionary()\n : base(StringComparer.OrdinalIgnoreCase)\n {\n }\n\n /// \n /// Initializes a new instance of the class with contents\n /// copied from the hashtable.\n /// \n /// hashtable to copy into the new instance of \n /// \n /// This constructor will throw if the hashtable contains keys that are not a strings\n /// or values that are not one of primitive types that will work during PowerShell remoting handshake.\n /// \n [SuppressMessage(\"Microsoft.Usage\", \"CA2214:DoNotCallOverridableMethodsInConstructors\", Justification = \"The class is sealed\")]\n public PSPrimitiveDictionary(Hashtable other)\n : base(StringComparer.OrdinalIgnoreCase)\n {\n if (other == null)\n {\n throw new ArgumentNullException(\"other\");\n }\n\n foreach (DictionaryEntry entry in other)\n {\n Hashtable valueAsHashtable = PSObject.Base(entry.Value) as Hashtable;\n if (valueAsHashtable != null)\n {\n this.Add(entry.Key, new PSPrimitiveDictionary(valueAsHashtable));\n }\n else\n {\n this.Add(entry.Key, entry.Value);\n }\n }\n }\n\n#if !CORECLR // No .NET Serialization In CoreCLR\n /// \n /// Support for .NET serialization\n /// \n private PSPrimitiveDictionary(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)\n : base(info, context)\n {\n }\n#endif\n #endregion\n\n #region Plumbing to make Hashtable reject all non-primitive types\n\n private string VerifyKey(object key)\n {\n key = PSObject.Base(key);\n string keyAsString = key as string;\n if (keyAsString == null)\n {\n string message = StringUtil.Format(Serialization.PrimitiveHashtableInvalidKey,\n key.GetType().FullName);\n throw new ArgumentException(message);\n }\n else\n {\n return keyAsString;\n }\n }\n\n private static readonly Type[] s_handshakeFriendlyTypes = new Type[] {\n typeof(Boolean),\n typeof(Byte),\n typeof(Char),\n typeof(DateTime),\n typeof(Decimal),\n typeof(Double),\n typeof(Guid),\n typeof(Int32),\n typeof(Int64),\n typeof(SByte),\n typeof(Single),\n\t\t\t\t// typeof(ScriptBlock) - don't want ScriptBlocks, because they are deserialized into strings\n\t\t\t\ttypeof(String),\n typeof(TimeSpan),\n typeof(UInt16),\n typeof(UInt32),\n typeof(UInt64),\n typeof(Uri),\n typeof(byte[]),\n typeof(Version),\n typeof(ProgressRecord),\n typeof(XmlDocument),\n\n typeof(PSPrimitiveDictionary)\n };\n\n private void VerifyValue(object value)\n {\n // null is a primitive type\n if (value == null)\n {\n return;\n }\n\n value = PSObject.Base(value);\n\n // this list is based on the list inside KnownTypes\n // it is copied here to make sure that a list of \"handshake friendly types\"\n // won't change even if we add new primitive types in v.next\n\n Type valueType = value.GetType();\n\n // if \"value\" is a \"primitiveType\" then we are good\n foreach (Type goodType in s_handshakeFriendlyTypes)\n {\n if (valueType == goodType)\n {\n return;\n }\n }\n\n // if \"value\" is an array of \"primitiveType\" items then we are good\n // (note: we could have used IEnumerable<> or ICollection<> (covariance/contravariance concerns),\n // but it is safer to limit the types to arrays.\n // (one concern is that in v.next we might allow overriding SerializationMethod for\n // types [i.e. check SerializationMethod *before* HandleKnownContainerTypes)\n if ((valueType.IsArray) || valueType == typeof(ArrayList))\n {\n foreach (object o in (IEnumerable)value)\n {\n VerifyValue(o);\n }\n return;\n }\n\n string message = StringUtil.Format(Serialization.PrimitiveHashtableInvalidValue,\n value.GetType().FullName);\n throw new ArgumentException(message);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n /// \n /// This method will throw if the is not a string and the \n /// is not one of primitive types that will work during PowerShell remoting handshake.\n /// Use of strongly-typed overloads of this method is suggested if throwing an exception is not acceptable.\n /// \n public override void Add(object key, object value)\n {\n string keyAsString = this.VerifyKey(key);\n this.VerifyValue(value);\n base.Add(keyAsString, value);\n }\n\n /// \n /// Gets or sets the value associated with the specified key. \n /// \n /// The key whose value to get or set\n /// The value associated with the specified key.\n /// \n /// If the specified key is not found, attempting to get it returns null\n /// and attempting to set it creates a new element using the specified key.\n /// \n /// \n /// The setter will throw if the is not a string and the value\n /// is not one of primitive types that will work during PowerShell remoting handshake.\n /// Use of strongly-typed overloads of Add method is suggested if throwing an exception is not acceptable.\n /// \n public override object this[object key]\n {\n get\n {\n return base[key];\n }\n set\n {\n string keyAsString = this.VerifyKey(key);\n this.VerifyValue(value);\n base[keyAsString] = value;\n }\n }\n\n /// \n /// Gets or sets the value associated with the specified key. \n /// \n /// The key whose value to get or set\n /// The value associated with the specified key.\n /// \n /// If the specified key is not found, attempting to get it returns null\n /// and attempting to set it creates a new element using the specified key.\n /// \n /// \n /// The setter will throw if the value\n /// is not one of primitive types that will work during PowerShell remoting handshake.\n /// Use of strongly-typed overloads of Add method is suggested if throwing an exception is not acceptable.\n /// \n public object this[string key]\n {\n get\n {\n return base[key];\n }\n set\n {\n this.VerifyValue(value);\n base[key] = value;\n }\n }\n\n #endregion\n\n #region Helper methods\n\n /// \n /// Creates a new instance by doing a shallow copy of the current instance.\n /// \n /// \n public override object Clone()\n {\n return new PSPrimitiveDictionary(this);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Boolean value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Boolean[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Byte value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, byte[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Char value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Char[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, DateTime value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, DateTime[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Decimal value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Decimal[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Double value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Double[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Guid value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Guid[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Int32 value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Int32[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Int64 value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Int64[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, SByte value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, SByte[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Single value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Single[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, String value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, String[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, TimeSpan value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, TimeSpan[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, UInt16 value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, UInt16[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, UInt32 value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, UInt32[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, UInt64 value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, UInt64[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Uri value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Uri[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Version value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, Version[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, PSPrimitiveDictionary value)\n {\n this.Add((object)key, (object)value);\n }\n\n /// \n /// Adds an element with the specified key and value into the Hashtable\n /// \n /// The key of the element to add\n /// The value of the element to add\n public void Add(string key, PSPrimitiveDictionary[] value)\n {\n this.Add((object)key, (object)value);\n }\n\n #endregion\n\n #region Internal Methods\n\n /// \n /// If originalHash contains PSVersionTable, then just returns the Cloned copy of \n /// the original hash. Othewise, creates a clone copy and add PSVersionInfo.GetPSVersionTable\n /// to the clone and returns.\n /// \n /// \n /// \n internal static PSPrimitiveDictionary CloneAndAddPSVersionTable(PSPrimitiveDictionary originalHash)\n {\n if ((null != originalHash) &&\n (originalHash.ContainsKey(PSVersionInfo.PSVersionTableName)))\n {\n return (PSPrimitiveDictionary)originalHash.Clone();\n }\n\n PSPrimitiveDictionary result = originalHash;\n if (null != originalHash)\n {\n result = (PSPrimitiveDictionary)originalHash.Clone();\n }\n else\n {\n result = new PSPrimitiveDictionary();\n }\n PSPrimitiveDictionary versionTable = new PSPrimitiveDictionary(PSVersionInfo.GetPSVersionTableForDownLevel())\n {\n {\"PSSemanticVersion\", PSVersionInfo.PSVersion.ToString()}\n };\n result.Add(PSVersionInfo.PSVersionTableName, versionTable);\n\n return result;\n }\n\n /// \n /// Tries to get a value that might be present in a chain of nested PSPrimitiveDictionaries.\n /// For example to get $sessionInfo.ApplicationPrivateData.ImplicitRemoting.Hash you could call\n /// TryPathGet&lt;string&gt;($sessionInfo.ApplicationPrivateData, out myHash, \"ImplicitRemoting\", \"Hash\").\n /// \n /// Expected type of the value\n /// The root dictionary\n /// \n /// A chain of keys leading from the root dictionary () to the value\n /// true if the value was found and was of the correct type; false otherwise\n internal static bool TryPathGet(IDictionary data, out T result, params string[] keys)\n {\n Dbg.Assert(keys != null, \"Caller should verify that keys != null\");\n Dbg.Assert(keys.Length >= 1, \"Caller should verify that keys.Length >= 1\");\n Dbg.Assert(keys[0] != null, \"Caller should verify that keys[i] != null\");\n\n if (data == null || !data.Contains(keys[0]))\n {\n result = default(T);\n return false;\n }\n\n if (keys.Length == 1)\n {\n return LanguagePrimitives.TryConvertTo(data[keys[0]], out result);\n }\n else\n {\n IDictionary subData;\n if (LanguagePrimitives.TryConvertTo(data[keys[0]], out subData)\n && subData != null)\n {\n string[] subKeys = new string[keys.Length - 1];\n Array.Copy(keys, 1, subKeys, 0, subKeys.Length);\n return TryPathGet(subData, out result, subKeys);\n }\n else\n {\n result = default(T);\n return false;\n }\n }\n }\n\n #endregion\n }\n}\n\nnamespace Microsoft.PowerShell\n{\n using System.Management.Automation;\n using System.Security.Principal;\n\n /// \n /// Rehydrating type converter used during deserialization.\n /// It takes results of serializing some common types\n /// and rehydrates them back from property bags into live objects.\n /// \n /// \n public sealed class DeserializingTypeConverter : PSTypeConverter\n {\n #region Infrastructure\n\n private static readonly Dictionary> s_converter;\n\n static DeserializingTypeConverter()\n {\n s_converter = new Dictionary>();\n\n s_converter.Add(typeof(PSPrimitiveDictionary), RehydratePrimitiveHashtable);\n\n s_converter.Add(typeof(SwitchParameter), RehydrateSwitchParameter);\n s_converter.Add(typeof(PSListModifier), RehydratePSListModifier);\n s_converter.Add(typeof(PSCredential), RehydratePSCredential);\n s_converter.Add(typeof(PSSenderInfo), RehydratePSSenderInfo);\n s_converter.Add(typeof(CultureInfo), RehydrateCultureInfo);\n s_converter.Add(typeof(ParameterSetMetadata), RehydrateParameterSetMetadata);\n\n s_converter.Add(typeof(System.Security.Cryptography.X509Certificates.X509Certificate2), RehydrateX509Certificate2);\n s_converter.Add(typeof(System.Security.Cryptography.X509Certificates.X500DistinguishedName), RehydrateX500DistinguishedName);\n s_converter.Add(typeof(System.Net.IPAddress), RehydrateIPAddress);\n\n s_converter.Add(typeof(MailAddress), RehydrateMailAddress);\n\n s_converter.Add(typeof(System.Security.AccessControl.DirectorySecurity), RehydrateObjectSecurity);\n s_converter.Add(typeof(System.Security.AccessControl.FileSecurity), RehydrateObjectSecurity);\n s_converter.Add(typeof(System.Security.AccessControl.RegistrySecurity), RehydrateObjectSecurity);\n\n s_converter.Add(typeof(ExtendedTypeDefinition), RehydrateExtendedTypeDefinition);\n s_converter.Add(typeof(FormatViewDefinition), RehydrateFormatViewDefinition);\n s_converter.Add(typeof(PSControl), RehydratePSControl);\n s_converter.Add(typeof(PSControlGroupBy), RehydrateGroupBy);\n s_converter.Add(typeof(DisplayEntry), RehydrateDisplayEntry);\n s_converter.Add(typeof(EntrySelectedBy), RehydrateEntrySelectedBy);\n s_converter.Add(typeof(TableControlColumnHeader), RehydrateTableControlColumnHeader);\n s_converter.Add(typeof(TableControlRow), RehydrateTableControlRow);\n s_converter.Add(typeof(TableControlColumn), RehydrateTableControlColumn);\n s_converter.Add(typeof(ListControlEntry), RehydrateListControlEntry);\n s_converter.Add(typeof(ListControlEntryItem), RehydrateListControlEntryItem);\n s_converter.Add(typeof(WideControlEntryItem), RehydrateWideControlEntryItem);\n s_converter.Add(typeof(CustomControlEntry), RehydrateCustomControlEntry);\n s_converter.Add(typeof(CustomItemBase), RehydrateCustomItemBase);\n\n s_converter.Add(typeof(CompletionResult), RehydrateCompletionResult);\n s_converter.Add(typeof(ModuleSpecification), RehydrateModuleSpecification);\n s_converter.Add(typeof(CommandCompletion), RehydrateCommandCompletion);\n s_converter.Add(typeof(JobStateInfo), RehydrateJobStateInfo);\n s_converter.Add(typeof(JobStateEventArgs), RehydrateJobStateEventArgs);\n s_converter.Add(typeof(PSSessionOption), RehydratePSSessionOption);\n s_converter.Add(typeof(LineBreakpoint), RehydrateLineBreakpoint);\n s_converter.Add(typeof(CommandBreakpoint), RehydrateCommandBreakpoint);\n s_converter.Add(typeof(VariableBreakpoint), RehydrateVariableBreakpoint);\n s_converter.Add(typeof(BreakpointUpdatedEventArgs), RehydrateBreakpointUpdatedEventArgs);\n s_converter.Add(typeof(DebuggerCommand), RehydrateDebuggerCommand);\n s_converter.Add(typeof(DebuggerCommandResults), RehydrateDebuggerCommandResults);\n s_converter.Add(typeof(DebuggerStopEventArgs), RehydrateDebuggerStopEventArgs);\n }\n\n /// \n /// Determines if the converter can convert the parameter to the parameter.\n /// \n /// The value to convert from\n /// The type to convert to\n /// True if the converter can convert the parameter to the parameter, otherwise false.\n public override bool CanConvertFrom(PSObject sourceValue, Type destinationType)\n {\n foreach (Type type in s_converter.Keys)\n {\n if (Deserializer.IsDeserializedInstanceOfType(sourceValue, type))\n {\n return true;\n }\n }\n\n return false;\n }\n\n /// \n /// Converts the parameter to the parameter using formatProvider and ignoreCase\n /// \n /// The value to convert from\n /// The type to convert to\n /// The format provider to use like in IFormattable's ToString\n /// true if case should be ignored\n /// the parameter converted to the parameter using formatProvider and ignoreCase\n /// if no conversion was possible\n public override object ConvertFrom(PSObject sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase)\n {\n if (destinationType == null)\n {\n throw PSTraceSource.NewArgumentNullException(\"destinationType\");\n }\n\n if (sourceValue == null)\n {\n throw new PSInvalidCastException(\n \"InvalidCastWhenRehydratingFromNull\",\n PSTraceSource.NewArgumentNullException(\"sourceValue\"),\n ExtendedTypeSystem.InvalidCastFromNull,\n destinationType.ToString());\n }\n\n foreach (KeyValuePair> item in s_converter)\n {\n Type type = item.Key;\n Func typeConverter = item.Value;\n if (Deserializer.IsDeserializedInstanceOfType(sourceValue, type))\n {\n return ConvertFrom(sourceValue, typeConverter);\n }\n }\n\n throw new PSInvalidCastException(\n \"InvalidCastEnumFromTypeNotAString\",\n null,\n ExtendedTypeSystem.InvalidCastException,\n sourceValue,\n destinationType);\n }\n\n private static object ConvertFrom(PSObject o, Func converter)\n {\n // rehydrate\n PSObject dso = o;\n object rehydratedObject = converter(dso);\n\n // re-add instance properties\n // (dso.InstanceMembers includes both instance and *type table* properties;\n // therefore this will also re-add type table properties if they are not present when the deserializer runs;\n // this is ok)\n bool returnPSObject = false;\n PSObject rehydratedPSObject = PSObject.AsPSObject(rehydratedObject);\n foreach (PSMemberInfo member in dso.InstanceMembers)\n {\n if (member.MemberType == (member.MemberType & (PSMemberTypes.Properties | PSMemberTypes.MemberSet | PSMemberTypes.PropertySet)))\n {\n if (rehydratedPSObject.Members[member.Name] == null)\n {\n rehydratedPSObject.InstanceMembers.Add(member);\n returnPSObject = true;\n }\n }\n }\n\n if (returnPSObject)\n {\n return rehydratedPSObject;\n }\n else\n {\n return rehydratedObject;\n }\n }\n\n /// \n /// Returns true if the converter can convert the parameter to the parameter\n /// \n /// The value to convert from\n /// The type to convert to\n /// True if the converter can convert the parameter to the parameter, otherwise false.\n public override bool CanConvertTo(object sourceValue, Type destinationType)\n {\n return false;\n }\n\n /// \n /// Converts the parameter to the parameter using formatProvider and ignoreCase\n /// \n /// The value to convert from\n /// The type to convert to\n /// The format provider to use like in IFormattable's ToString\n /// true if case should be ignored\n /// sourceValue converted to the parameter using formatProvider and ignoreCase\n /// if no conversion was possible\n public override object ConvertTo(object sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase)\n {\n throw PSTraceSource.NewNotSupportedException();\n }\n\n /// \n /// This method is not implemented - an overload taking a PSObject is implemented instead\n /// \n public override bool CanConvertFrom(object sourceValue, Type destinationType)\n {\n throw new NotImplementedException();\n }\n\n /// \n /// This method is not implemented - an overload taking a PSObject is implemented instead\n /// \n public override bool CanConvertTo(PSObject sourceValue, Type destinationType)\n {\n throw new NotImplementedException();\n }\n\n /// \n /// This method is not implemented - an overload taking a PSObject is implemented instead\n /// \n public override object ConvertFrom(object sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase)\n {\n throw new NotImplementedException();\n }\n\n /// \n /// This method is not implemented - an overload taking a PSObject is implemented instead\n /// \n public override object ConvertTo(PSObject sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase)\n {\n throw new NotImplementedException();\n }\n\n #endregion\n\n #region Rehydration helpers\n\n [Flags]\n internal enum RehydrationFlags\n {\n NullValueBad = 0,\n NullValueOk = 0x1,\n NullValueMeansEmptyList = 0x3,\n\n MissingPropertyBad = 0,\n MissingPropertyOk = 0x4,\n }\n\n /// \n /// Gets value of a property (has to be present, value has to be non-null). \n /// Can throw any exception (which is ok - LanguagePrimitives.ConvertTo will catch that).\n /// \n /// Expected type of the property\n /// Deserialized object\n /// Property name\n /// \n private static T GetPropertyValue(PSObject pso, string propertyName)\n {\n return GetPropertyValue(pso, propertyName, RehydrationFlags.NullValueBad | RehydrationFlags.MissingPropertyBad);\n }\n\n /// \n /// Gets value of a property. Can throw any exception (which is ok - LanguagePrimitives.ConvertTo will catch that).\n /// \n /// Expected type of the property\n /// Deserialized object\n /// Property name\n /// \n /// \n internal static T GetPropertyValue(PSObject pso, string propertyName, RehydrationFlags flags)\n {\n Dbg.Assert(pso != null, \"Caller should verify pso != null\");\n Dbg.Assert(!string.IsNullOrEmpty(propertyName), \"Caller should verify propertyName != null\");\n\n PSPropertyInfo property = pso.Properties[propertyName];\n if ((property == null) && (RehydrationFlags.MissingPropertyOk == (flags & RehydrationFlags.MissingPropertyOk)))\n {\n return default(T);\n }\n else\n {\n object propertyValue = property.Value;\n if ((propertyValue == null) && (RehydrationFlags.NullValueOk == (flags & RehydrationFlags.NullValueOk)))\n {\n return default(T);\n }\n else\n {\n T t = (T)LanguagePrimitives.ConvertTo(propertyValue, typeof(T), CultureInfo.InvariantCulture);\n return t;\n }\n }\n }\n\n private static ListType RehydrateList(PSObject pso, string propertyName, RehydrationFlags flags)\n where ListType : IList, new()\n {\n ArrayList deserializedList = GetPropertyValue(pso, propertyName, flags);\n if (deserializedList == null)\n {\n if (RehydrationFlags.NullValueMeansEmptyList == (flags & RehydrationFlags.NullValueMeansEmptyList))\n {\n return new ListType();\n }\n else\n {\n return default(ListType);\n }\n }\n else\n {\n ListType newList = new ListType();\n foreach (object deserializedItem in deserializedList)\n {\n ItemType item = (ItemType)LanguagePrimitives.ConvertTo(deserializedItem, typeof(ItemType), CultureInfo.InvariantCulture);\n newList.Add(item);\n }\n return newList;\n }\n }\n\n #endregion\n\n #region Rehydration of miscellaneous types\n\n private static object RehydratePrimitiveHashtable(PSObject pso)\n {\n Hashtable hashtable = (Hashtable)LanguagePrimitives.ConvertTo(pso, typeof(Hashtable), CultureInfo.InvariantCulture);\n return new PSPrimitiveDictionary(hashtable);\n }\n\n private static object RehydrateSwitchParameter(PSObject pso)\n {\n return GetPropertyValue(pso, \"IsPresent\");\n }\n\n private static CultureInfo RehydrateCultureInfo(PSObject pso)\n {\n string s = pso.ToString();\n return new CultureInfo(s);\n }\n\n private static PSListModifier RehydratePSListModifier(PSObject pso)\n {\n Hashtable h = new Hashtable();\n\n PSPropertyInfo addProperty = pso.Properties[PSListModifier.AddKey];\n if ((addProperty != null) && (addProperty.Value != null))\n {\n h.Add(PSListModifier.AddKey, addProperty.Value);\n }\n\n PSPropertyInfo removeProperty = pso.Properties[PSListModifier.RemoveKey];\n if ((removeProperty != null) && (removeProperty.Value != null))\n {\n h.Add(PSListModifier.RemoveKey, removeProperty.Value);\n }\n\n PSPropertyInfo replaceProperty = pso.Properties[PSListModifier.ReplaceKey];\n if ((replaceProperty != null) && (replaceProperty.Value != null))\n {\n h.Add(PSListModifier.ReplaceKey, replaceProperty.Value);\n }\n\n return new PSListModifier(h);\n }\n\n private static CompletionResult RehydrateCompletionResult(PSObject pso)\n {\n string completionText = GetPropertyValue(pso, \"CompletionText\");\n string listItemText = GetPropertyValue(pso, \"ListItemText\");\n string toolTip = GetPropertyValue(pso, \"ToolTip\");\n CompletionResultType resultType = GetPropertyValue(pso, \"ResultType\");\n\n return new CompletionResult(completionText, listItemText, resultType, toolTip);\n }\n\n private static ModuleSpecification RehydrateModuleSpecification(PSObject pso)\n {\n return new ModuleSpecification\n {\n Name = GetPropertyValue(pso, \"Name\"),\n Guid = GetPropertyValue(pso, \"Guid\"),\n Version = GetPropertyValue(pso, \"Version\"),\n MaximumVersion = GetPropertyValue(pso, \"MaximumVersion\"),\n RequiredVersion =\n GetPropertyValue(pso, \"RequiredVersion\")\n };\n }\n\n private static CommandCompletion RehydrateCommandCompletion(PSObject pso)\n {\n var completions = new Collection();\n foreach (var match in GetPropertyValue(pso, \"CompletionMatches\"))\n {\n completions.Add((CompletionResult)match);\n }\n var currentMatchIndex = GetPropertyValue(pso, \"CurrentMatchIndex\");\n var replacementIndex = GetPropertyValue(pso, \"ReplacementIndex\");\n var replacementLength = GetPropertyValue(pso, \"ReplacementLength\");\n return new CommandCompletion(completions, currentMatchIndex, replacementIndex, replacementLength);\n }\n\n private static JobStateInfo RehydrateJobStateInfo(PSObject pso)\n {\n var jobState = GetPropertyValue(pso, \"State\");\n\n Exception reason = null;\n object propertyValue = null;\n PSPropertyInfo property = pso.Properties[\"Reason\"];\n string message = string.Empty;\n\n if (property != null)\n {\n propertyValue = property.Value;\n }\n\n if (propertyValue != null)\n {\n if (Deserializer.IsDeserializedInstanceOfType(propertyValue, typeof(Exception)))\n {\n // if we have a deserialized remote or any other exception, use its message to construct\n // an exception\n message = PSObject.AsPSObject(propertyValue).Properties[\"Message\"].Value as string;\n }\n else if (propertyValue is Exception)\n {\n reason = (Exception)propertyValue;\n }\n else\n {\n message = propertyValue.ToString();\n }\n\n if (!string.IsNullOrEmpty(message))\n {\n try\n {\n reason = (Exception)LanguagePrimitives.ConvertTo(message, typeof(Exception), CultureInfo.InvariantCulture);\n }\n catch (Exception)\n {\n // it is ok to eat this exception since we do not want\n // rehydration to fail\n reason = null;\n }\n }\n }\n\n return new JobStateInfo(jobState, reason);\n }\n\n internal static JobStateEventArgs RehydrateJobStateEventArgs(PSObject pso)\n {\n var jobStateInfo = RehydrateJobStateInfo(PSObject.AsPSObject(pso.Properties[\"JobStateInfo\"].Value));\n JobStateInfo previousJobStateInfo = null;\n var previousJobStateInfoProperty = pso.Properties[\"PreviousJobStateInfo\"];\n\n if (previousJobStateInfoProperty != null && previousJobStateInfoProperty.Value != null)\n {\n previousJobStateInfo = RehydrateJobStateInfo(PSObject.AsPSObject(previousJobStateInfoProperty.Value));\n }\n\n return new JobStateEventArgs(jobStateInfo, previousJobStateInfo);\n }\n\n internal static PSSessionOption RehydratePSSessionOption(PSObject pso)\n {\n PSSessionOption option = new PSSessionOption();\n\n option.ApplicationArguments = GetPropertyValue(pso, \"ApplicationArguments\");\n option.CancelTimeout = GetPropertyValue(pso, \"CancelTimeout\");\n option.Culture = GetPropertyValue(pso, \"Culture\");\n option.IdleTimeout = GetPropertyValue(pso, \"IdleTimeout\");\n option.MaximumConnectionRedirectionCount = GetPropertyValue(pso, \"MaximumConnectionRedirectionCount\");\n option.MaximumReceivedDataSizePerCommand = GetPropertyValue>(pso, \"MaximumReceivedDataSizePerCommand\");\n option.MaximumReceivedObjectSize = GetPropertyValue>(pso, \"MaximumReceivedObjectSize\");\n option.NoCompression = GetPropertyValue(pso, \"NoCompression\");\n option.NoEncryption = GetPropertyValue(pso, \"NoEncryption\");\n option.NoMachineProfile = GetPropertyValue(pso, \"NoMachineProfile\");\n option.OpenTimeout = GetPropertyValue(pso, \"OpenTimeout\");\n option.OperationTimeout = GetPropertyValue(pso, \"OperationTimeout\");\n option.OutputBufferingMode = GetPropertyValue(pso, \"OutputBufferingMode\");\n option.MaxConnectionRetryCount = GetPropertyValue(pso, \"MaxConnectionRetryCount\");\n option.ProxyAccessType = GetPropertyValue(pso, \"ProxyAccessType\");\n option.ProxyAuthentication = GetPropertyValue(pso, \"ProxyAuthentication\");\n option.ProxyCredential = GetPropertyValue(pso, \"ProxyCredential\");\n option.SkipCACheck = GetPropertyValue(pso, \"SkipCACheck\");\n option.SkipCNCheck = GetPropertyValue(pso, \"SkipCNCheck\");\n option.SkipRevocationCheck = GetPropertyValue(pso, \"SkipRevocationCheck\");\n option.UICulture = GetPropertyValue(pso, \"UICulture\");\n option.UseUTF16 = GetPropertyValue(pso, \"UseUTF16\");\n option.IncludePortInSPN = GetPropertyValue(pso, \"IncludePortInSPN\");\n\n return option;\n }\n\n internal static LineBreakpoint RehydrateLineBreakpoint(PSObject pso)\n {\n string script = GetPropertyValue(pso, \"Script\");\n int line = GetPropertyValue(pso, \"Line\");\n int column = GetPropertyValue(pso, \"Column\");\n int id = GetPropertyValue(pso, \"Id\");\n bool enabled = GetPropertyValue(pso, \"Enabled\");\n ScriptBlock action = RehydrateScriptBlock(\n GetPropertyValue(pso, \"Action\", RehydrationFlags.MissingPropertyOk));\n\n var bp = new LineBreakpoint(script, line, column, action, id);\n bp.SetEnabled(enabled);\n return bp;\n }\n\n internal static CommandBreakpoint RehydrateCommandBreakpoint(PSObject pso)\n {\n string script = GetPropertyValue(pso, \"Script\", RehydrationFlags.MissingPropertyOk);\n string command = GetPropertyValue(pso, \"Command\");\n int id = GetPropertyValue(pso, \"Id\");\n bool enabled = GetPropertyValue(pso, \"Enabled\");\n WildcardPattern pattern = WildcardPattern.Get(command, WildcardOptions.Compiled | WildcardOptions.IgnoreCase);\n ScriptBlock action = RehydrateScriptBlock(\n GetPropertyValue(pso, \"Action\", RehydrationFlags.MissingPropertyOk));\n\n var bp = new CommandBreakpoint(script, pattern, command, action, id);\n bp.SetEnabled(enabled);\n return bp;\n }\n\n internal static VariableBreakpoint RehydrateVariableBreakpoint(PSObject pso)\n {\n string script = GetPropertyValue(pso, \"Script\", RehydrationFlags.MissingPropertyOk);\n string variableName = GetPropertyValue(pso, \"Variable\");\n int id = GetPropertyValue(pso, \"Id\");\n bool enabled = GetPropertyValue(pso, \"Enabled\");\n VariableAccessMode access = GetPropertyValue(pso, \"AccessMode\");\n ScriptBlock action = RehydrateScriptBlock(\n GetPropertyValue(pso, \"Action\", RehydrationFlags.MissingPropertyOk));\n\n var bp = new VariableBreakpoint(script, variableName, access, action, id);\n bp.SetEnabled(enabled);\n return bp;\n }\n\n internal static BreakpointUpdatedEventArgs RehydrateBreakpointUpdatedEventArgs(PSObject pso)\n {\n Breakpoint bp = GetPropertyValue(pso, \"Breakpoint\");\n BreakpointUpdateType bpUpdateType = GetPropertyValue(pso, \"UpdateType\");\n int bpCount = GetPropertyValue(pso, \"BreakpointCount\");\n\n return new BreakpointUpdatedEventArgs(bp, bpUpdateType, bpCount);\n }\n\n internal static DebuggerCommand RehydrateDebuggerCommand(PSObject pso)\n {\n string command = GetPropertyValue(pso, \"Command\");\n bool repeatOnEnter = GetPropertyValue(pso, \"RepeatOnEnter\");\n bool executedByDebugger = GetPropertyValue(pso, \"ExecutedByDebugger\");\n DebuggerResumeAction? resumeAction = GetPropertyValue(pso, \"ResumeAction\", RehydrationFlags.NullValueOk);\n\n return new DebuggerCommand(command, resumeAction, repeatOnEnter, executedByDebugger);\n }\n\n internal static DebuggerCommandResults RehydrateDebuggerCommandResults(PSObject pso)\n {\n DebuggerResumeAction? resumeAction = GetPropertyValue(pso, \"ResumeAction\", RehydrationFlags.NullValueOk);\n bool evaluatedByDebugger = GetPropertyValue(pso, \"EvaluatedByDebugger\");\n\n return new DebuggerCommandResults(resumeAction, evaluatedByDebugger);\n }\n\n internal static DebuggerStopEventArgs RehydrateDebuggerStopEventArgs(PSObject pso)\n {\n PSObject psoInvocationInfo = GetPropertyValue(pso, \"SerializedInvocationInfo\", RehydrationFlags.NullValueOk | RehydrationFlags.MissingPropertyOk);\n InvocationInfo invocationInfo = (psoInvocationInfo != null) ? new InvocationInfo(psoInvocationInfo) : null;\n DebuggerResumeAction resumeAction = GetPropertyValue(pso, \"ResumeAction\");\n Collection breakpoints = new Collection();\n foreach (var item in GetPropertyValue(pso, \"Breakpoints\"))\n {\n Breakpoint bp = item as Breakpoint;\n if (bp != null)\n {\n breakpoints.Add(bp);\n }\n }\n\n return new DebuggerStopEventArgs(invocationInfo, breakpoints, resumeAction);\n }\n\n private static ScriptBlock RehydrateScriptBlock(string script)\n {\n if (!string.IsNullOrEmpty(script))\n {\n return ScriptBlock.Create(script);\n }\n\n return null;\n }\n\n #endregion\n\n #region Rehydration of security-related types\n\n private static PSCredential RehydratePSCredential(PSObject pso)\n {\n string userName = GetPropertyValue(pso, \"UserName\");\n System.Security.SecureString password = GetPropertyValue(pso, \"Password\");\n\n if (String.IsNullOrEmpty(userName))\n {\n return PSCredential.Empty;\n }\n else\n {\n return new PSCredential(userName, password);\n }\n }\n\n internal static PSSenderInfo RehydratePSSenderInfo(PSObject pso)\n {\n PSObject userInfo = GetPropertyValue(pso, \"UserInfo\");\n PSObject userIdentity = GetPropertyValue(userInfo, \"Identity\");\n PSObject certDetails = GetPropertyValue(userIdentity, \"CertificateDetails\");\n\n PSCertificateDetails psCertDetails = certDetails == null ? null : new PSCertificateDetails(\n GetPropertyValue(certDetails, \"Subject\"),\n GetPropertyValue(certDetails, \"IssuerName\"),\n GetPropertyValue(certDetails, \"IssuerThumbprint\"));\n PSIdentity psIdentity = new PSIdentity(\n GetPropertyValue(userIdentity, \"AuthenticationType\"),\n GetPropertyValue(userIdentity, \"IsAuthenticated\"),\n GetPropertyValue(userIdentity, \"Name\"),\n psCertDetails);\n PSPrincipal psPrincipal = new PSPrincipal(psIdentity, WindowsIdentity.GetCurrent());\n\n PSSenderInfo senderInfo = new PSSenderInfo(psPrincipal, GetPropertyValue(pso, \"ConnectionString\"));\n\n#if !CORECLR // TimeZone Not In CoreCLR\n senderInfo.ClientTimeZone = TimeZone.CurrentTimeZone;\n#endif\n senderInfo.ApplicationArguments = GetPropertyValue(pso, \"ApplicationArguments\");\n\n return senderInfo;\n }\n\n private static System.Security.Cryptography.X509Certificates.X509Certificate2 RehydrateX509Certificate2(PSObject pso)\n {\n byte[] rawData = GetPropertyValue(pso, \"RawData\");\n return new System.Security.Cryptography.X509Certificates.X509Certificate2(rawData);\n }\n\n private static System.Security.Cryptography.X509Certificates.X500DistinguishedName RehydrateX500DistinguishedName(PSObject pso)\n {\n byte[] rawData = GetPropertyValue(pso, \"RawData\");\n return new System.Security.Cryptography.X509Certificates.X500DistinguishedName(rawData);\n }\n\n private static System.Net.IPAddress RehydrateIPAddress(PSObject pso)\n {\n string s = pso.ToString();\n return System.Net.IPAddress.Parse(s);\n }\n\n private static MailAddress RehydrateMailAddress(PSObject pso)\n {\n string s = pso.ToString();\n return new MailAddress(s);\n }\n\n private static T RehydrateObjectSecurity(PSObject pso)\n where T : System.Security.AccessControl.ObjectSecurity, new()\n {\n string sddl = GetPropertyValue(pso, \"SDDL\");\n\n T t = new T();\n t.SetSecurityDescriptorSddlForm(sddl);\n return t;\n }\n\n #endregion\n\n #region Rehydration of types needed by implicit remoting\n\n /// \n /// Gets the boolean properties of ParameterSetMetadata object encoded as an integer\n /// \n /// \n /// The PSObject for which to obtain the flags\n /// \n /// \n /// Boolean properties of ParameterSetMetadata object encoded as an integer\n /// \n public static UInt32 GetParameterSetMetadataFlags(PSObject instance)\n {\n if (instance == null)\n {\n throw PSTraceSource.NewArgumentNullException(\"instance\");\n }\n\n ParameterSetMetadata parameterSetMetadata = instance.BaseObject as ParameterSetMetadata;\n if (parameterSetMetadata == null)\n {\n throw PSTraceSource.NewArgumentNullException(\"instance\");\n }\n\n return (UInt32)(parameterSetMetadata.Flags);\n }\n\n /// \n /// Gets the full remoting serialized PSObject for the InvocationInfo property\n /// of the DebuggerStopEventArgs type.\n /// \n /// InvocationInfo instance.\n /// PSObject containing serialized InvocationInfo.\n public static PSObject GetInvocationInfo(PSObject instance)\n {\n if (instance == null)\n {\n throw PSTraceSource.NewArgumentNullException(\"instance\");\n }\n\n DebuggerStopEventArgs dbgStopEventArgs = instance.BaseObject as DebuggerStopEventArgs;\n if (dbgStopEventArgs == null)\n {\n throw PSTraceSource.NewArgumentNullException(\"instance\");\n }\n\n if (dbgStopEventArgs.InvocationInfo == null)\n {\n return null;\n }\n\n PSObject psoInvocationInfo = new PSObject();\n dbgStopEventArgs.InvocationInfo.ToPSObjectForRemoting(psoInvocationInfo);\n return psoInvocationInfo;\n }\n\n private static ParameterSetMetadata RehydrateParameterSetMetadata(PSObject pso)\n {\n int position = GetPropertyValue(pso, \"Position\");\n UInt32 flags = GetPropertyValue(pso, \"Flags\");\n string helpMessage = GetPropertyValue(pso, \"HelpMessage\");\n return new ParameterSetMetadata(position, (ParameterSetMetadata.ParameterFlags)flags, helpMessage);\n }\n\n private static DisplayEntry RehydrateDisplayEntry(PSObject deserializedDisplayEntry)\n {\n var result = new DisplayEntry\n {\n Value = GetPropertyValue(deserializedDisplayEntry, \"Value\"),\n ValueType = GetPropertyValue(deserializedDisplayEntry, \"ValueType\")\n };\n return result;\n }\n\n private static EntrySelectedBy RehydrateEntrySelectedBy(PSObject deserializedEsb)\n {\n var result = new EntrySelectedBy\n {\n TypeNames = RehydrateList, string>(deserializedEsb, \"TypeNames\", RehydrationFlags.MissingPropertyOk),\n SelectionCondition = RehydrateList, DisplayEntry>(deserializedEsb, \"SelectionCondition\", RehydrationFlags.MissingPropertyOk)\n };\n return result;\n }\n\n private static WideControlEntryItem RehydrateWideControlEntryItem(PSObject deserializedEntryItem)\n {\n var entrySelectedBy = GetPropertyValue(deserializedEntryItem, \"EntrySelectedBy\", RehydrationFlags.MissingPropertyOk);\n if (entrySelectedBy == null)\n {\n var selectedBy = RehydrateList, string>(deserializedEntryItem, \"SelectedBy\", RehydrationFlags.MissingPropertyOk);\n entrySelectedBy = EntrySelectedBy.Get(selectedBy, null);\n }\n\n var result = new WideControlEntryItem\n {\n DisplayEntry = GetPropertyValue(deserializedEntryItem, \"DisplayEntry\"),\n EntrySelectedBy = entrySelectedBy,\n FormatString = GetPropertyValue(deserializedEntryItem, \"FormatString\", RehydrationFlags.MissingPropertyOk),\n };\n return result;\n }\n\n private static ListControlEntryItem RehydrateListControlEntryItem(PSObject deserializedEntryItem)\n {\n var result = new ListControlEntryItem\n {\n DisplayEntry = GetPropertyValue(deserializedEntryItem, \"DisplayEntry\"),\n ItemSelectionCondition = GetPropertyValue(deserializedEntryItem, \"ItemSelectionCondition\", RehydrationFlags.MissingPropertyOk),\n FormatString = GetPropertyValue(deserializedEntryItem, \"FormatString\", RehydrationFlags.MissingPropertyOk),\n Label = GetPropertyValue(deserializedEntryItem, \"Label\", RehydrationFlags.NullValueOk)\n };\n return result;\n }\n\n private static ListControlEntry RehydrateListControlEntry(PSObject deserializedEntry)\n {\n var entrySelectedBy = GetPropertyValue(deserializedEntry, \"EntrySelectedBy\", RehydrationFlags.MissingPropertyOk);\n if (entrySelectedBy == null)\n {\n var selectedBy = RehydrateList, string>(deserializedEntry, \"SelectedBy\", RehydrationFlags.MissingPropertyOk);\n entrySelectedBy = EntrySelectedBy.Get(selectedBy, null);\n }\n\n var result = new ListControlEntry\n {\n Items = RehydrateList, ListControlEntryItem>(deserializedEntry, \"Items\", RehydrationFlags.NullValueBad),\n EntrySelectedBy = entrySelectedBy\n };\n return result;\n }\n\n private static TableControlColumnHeader RehydrateTableControlColumnHeader(PSObject deserializedHeader)\n {\n var result = new TableControlColumnHeader\n {\n Alignment = GetPropertyValue(deserializedHeader, \"Alignment\"),\n Label = GetPropertyValue(deserializedHeader, \"Label\", RehydrationFlags.NullValueOk),\n Width = GetPropertyValue(deserializedHeader, \"Width\")\n };\n return result;\n }\n\n private static TableControlColumn RehydrateTableControlColumn(PSObject deserializedColumn)\n {\n var result = new TableControlColumn\n {\n Alignment = GetPropertyValue(deserializedColumn, \"Alignment\"),\n DisplayEntry = GetPropertyValue(deserializedColumn, \"DisplayEntry\"),\n FormatString = GetPropertyValue(deserializedColumn, \"FormatString\", RehydrationFlags.MissingPropertyOk)\n };\n return result;\n }\n\n private static TableControlRow RehydrateTableControlRow(PSObject deserializedRow)\n {\n var result = new TableControlRow\n {\n Wrap = GetPropertyValue(deserializedRow, \"Wrap\", RehydrationFlags.MissingPropertyOk),\n SelectedBy = GetPropertyValue(deserializedRow, \"EntrySelectedBy\", RehydrationFlags.MissingPropertyOk),\n Columns = RehydrateList, TableControlColumn>(deserializedRow, \"Columns\", RehydrationFlags.NullValueBad)\n };\n return result;\n }\n\n private static CustomControlEntry RehydrateCustomControlEntry(PSObject deserializedEntry)\n {\n var result = new CustomControlEntry\n {\n CustomItems = RehydrateList, CustomItemBase>(deserializedEntry, \"CustomItems\", RehydrationFlags.MissingPropertyBad),\n SelectedBy = GetPropertyValue(deserializedEntry, \"SelectedBy\", RehydrationFlags.MissingPropertyOk)\n };\n return result;\n }\n\n private static CustomItemBase RehydrateCustomItemBase(PSObject deserializedItem)\n {\n CustomItemBase result;\n\n if (Deserializer.IsDeserializedInstanceOfType(deserializedItem, typeof(CustomItemNewline)))\n {\n result = new CustomItemNewline\n {\n Count = GetPropertyValue(deserializedItem, \"Count\", RehydrationFlags.MissingPropertyBad)\n };\n }\n else if (Deserializer.IsDeserializedInstanceOfType(deserializedItem, typeof(CustomItemText)))\n {\n result = new CustomItemText\n {\n Text = GetPropertyValue(deserializedItem, \"Text\", RehydrationFlags.MissingPropertyBad)\n };\n }\n else if (Deserializer.IsDeserializedInstanceOfType(deserializedItem, typeof(CustomItemFrame)))\n {\n result = new CustomItemFrame\n {\n FirstLineHanging = GetPropertyValue(deserializedItem, \"FirstLineHanging\"),\n FirstLineIndent = GetPropertyValue(deserializedItem, \"FirstLineIndent\"),\n RightIndent = GetPropertyValue(deserializedItem, \"RightIndent\"),\n LeftIndent = GetPropertyValue(deserializedItem, \"LeftIndent\"),\n CustomItems = RehydrateList, CustomItemBase>(deserializedItem, \"CustomItems\", RehydrationFlags.MissingPropertyBad)\n };\n }\n else if (Deserializer.IsDeserializedInstanceOfType(deserializedItem, typeof(CustomItemExpression)))\n {\n result = new CustomItemExpression\n {\n EnumerateCollection = GetPropertyValue(deserializedItem, \"EnumerateCollection\"),\n CustomControl = GetPropertyValue(deserializedItem, \"CustomControl\", RehydrationFlags.MissingPropertyOk),\n Expression = GetPropertyValue(deserializedItem, \"Expression\", RehydrationFlags.MissingPropertyOk),\n ItemSelectionCondition = GetPropertyValue(deserializedItem, \"ItemSelectionCondition\", RehydrationFlags.MissingPropertyOk)\n };\n }\n else\n {\n throw PSTraceSource.NewArgumentException(\"deserializedItem\");\n }\n return result;\n }\n\n private static PSControl RehydratePSControl(PSObject deserializedControl)\n {\n // Earlier versions of PowerShell did not have all of the possible properties in a control, so we must\n // use MissingPropertyOk to allow for connections to those older endpoints.\n PSControl result;\n if (Deserializer.IsDeserializedInstanceOfType(deserializedControl, typeof(TableControl)))\n {\n var tableControl = new TableControl\n {\n AutoSize = GetPropertyValue(deserializedControl, \"AutoSize\", RehydrationFlags.MissingPropertyOk),\n HideTableHeaders = GetPropertyValue(deserializedControl, \"HideTableHeaders\", RehydrationFlags.MissingPropertyOk),\n Headers = RehydrateList, TableControlColumnHeader>(deserializedControl, \"Headers\", RehydrationFlags.NullValueBad),\n Rows = RehydrateList, TableControlRow>(deserializedControl, \"Rows\", RehydrationFlags.NullValueBad)\n };\n result = tableControl;\n }\n else if (Deserializer.IsDeserializedInstanceOfType(deserializedControl, typeof(ListControl)))\n {\n var listControl = new ListControl\n {\n Entries = RehydrateList, ListControlEntry>(deserializedControl, \"Entries\", RehydrationFlags.NullValueBad)\n };\n result = listControl;\n }\n else if (Deserializer.IsDeserializedInstanceOfType(deserializedControl, typeof(WideControl)))\n {\n var wideControl = new WideControl\n {\n AutoSize = GetPropertyValue(deserializedControl, \"Alignment\", RehydrationFlags.MissingPropertyOk),\n Columns = GetPropertyValue(deserializedControl, \"Columns\"),\n Entries = RehydrateList, WideControlEntryItem>(deserializedControl, \"Entries\", RehydrationFlags.NullValueBad)\n };\n result = wideControl;\n }\n else if (Deserializer.IsDeserializedInstanceOfType(deserializedControl, typeof(CustomControl)))\n {\n var customControl = new CustomControl\n {\n Entries = RehydrateList, CustomControlEntry>(deserializedControl, \"Entries\", RehydrationFlags.NullValueBad)\n };\n result = customControl;\n }\n else\n {\n throw PSTraceSource.NewArgumentException(\"pso\");\n }\n\n result.GroupBy = GetPropertyValue(deserializedControl, \"GroupBy\", RehydrationFlags.MissingPropertyOk);\n result.OutOfBand = GetPropertyValue(deserializedControl, \"OutOfBand\", RehydrationFlags.MissingPropertyOk);\n return result;\n }\n\n private static PSControlGroupBy RehydrateGroupBy(PSObject deserializedGroupBy)\n {\n var result = new PSControlGroupBy\n {\n CustomControl = GetPropertyValue(deserializedGroupBy, \"CustomControl\", RehydrationFlags.MissingPropertyOk),\n Expression = GetPropertyValue(deserializedGroupBy, \"Expression\", RehydrationFlags.MissingPropertyOk),\n Label = GetPropertyValue(deserializedGroupBy, \"Label\", RehydrationFlags.NullValueOk)\n };\n return result;\n }\n\n /// \n /// Gets the boolean properties of ParameterSetMetadata object encoded as an integer\n /// \n /// \n /// The PSObject for which to obtain the flags\n /// \n /// \n /// Boolean properties of ParameterSetMetadata object encoded as an integer\n /// \n public static Guid GetFormatViewDefinitionInstanceId(PSObject instance)\n {\n if (instance == null)\n {\n throw PSTraceSource.NewArgumentNullException(\"instance\");\n }\n\n FormatViewDefinition formatViewDefinition = instance.BaseObject as FormatViewDefinition;\n if (formatViewDefinition == null)\n {\n throw PSTraceSource.NewArgumentNullException(\"instance\");\n }\n\n return formatViewDefinition.InstanceId;\n }\n\n private static FormatViewDefinition RehydrateFormatViewDefinition(PSObject deserializedViewDefinition)\n {\n string name = GetPropertyValue(deserializedViewDefinition, \"Name\");\n Guid instanceId = GetPropertyValue(deserializedViewDefinition, \"InstanceId\");\n PSControl control = GetPropertyValue(deserializedViewDefinition, \"Control\");\n\n return new FormatViewDefinition(name, control, instanceId);\n }\n\n private static ExtendedTypeDefinition RehydrateExtendedTypeDefinition(PSObject deserializedTypeDefinition)\n {\n // Prefer TypeNames to TypeName - as it was incorrect to create multiple ExtendedTypeDefinitions for a group of types.\n // But if a new PowerShell connects to an old endpoint, TypeNames will be missing, so fall back to TypeName in that case.\n string typeName;\n var typeNames = RehydrateList, string>(deserializedTypeDefinition, \"TypeNames\", RehydrationFlags.MissingPropertyOk);\n if (typeNames == null || typeNames.Count == 0)\n {\n typeName = GetPropertyValue(deserializedTypeDefinition, \"TypeName\");\n }\n else\n {\n typeName = typeNames[0];\n }\n\n List viewDefinitions = RehydrateList, FormatViewDefinition>(\n deserializedTypeDefinition,\n \"FormatViewDefinition\",\n RehydrationFlags.NullValueBad);\n\n var result = new ExtendedTypeDefinition(typeName, viewDefinitions);\n if (typeNames != null && typeNames.Count > 1)\n {\n for (var i = 1; i < typeNames.Count; i++)\n {\n result.TypeNames.Add(typeNames[i]);\n }\n }\n return result;\n }\n\n #endregion\n }\n}\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"44153828b4fb554450917893bcad0685\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 7529,\n \"max_line_length\": 210,\n \"avg_line_length\": 40.6350112896799,\n \"alnum_prop\": 0.566658277249535,\n \"repo_name\": \"jsoref/PowerShell\",\n \"id\": \"8bc6fafe631b051842269a5691a51115654f3d7f\",\n \"size\": \"306143\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/System.Management.Automation/engine/serialization.cs\",\n \"mode\": \"33188\",\n \"license\": \"mit\",\n \"language\": [\n {\n \"name\": \"C\",\n \"bytes\": \"5425\"\n },\n {\n \"name\": \"C#\",\n \"bytes\": \"37154150\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"304638\"\n },\n {\n \"name\": \"CMake\",\n \"bytes\": \"23659\"\n },\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"2535909\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"492\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"3521\"\n },\n {\n \"name\": \"XSLT\",\n \"bytes\": \"14407\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":994,"cells":{"text":{"kind":"string","value":"require('./styles/');\nrequire('./js/');\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"80d874f8b6de3ebbb7f7b9278d1c209a\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 2,\n \"max_line_length\": 21,\n \"avg_line_length\": 20,\n \"alnum_prop\": 0.55,\n \"repo_name\": \"thegsi/map-react-task\",\n \"id\": \"87a39a9118020d56f598846f00b42a4a447c3156\",\n \"size\": \"40\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"src/index.js\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"CSS\",\n \"bytes\": \"11477\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"1289\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"14000\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":995,"cells":{"text":{"kind":"string","value":"SYNONYM\n\n#### According to\nThe Catalogue of Life, 3rd January 2011\n\n#### Published in\nnull\n\n#### Original name\nnull\n\n### Remarks\nnull"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"06567a5b3bafb7ef6c5ba27065141eb9\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 13,\n \"max_line_length\": 39,\n \"avg_line_length\": 10.23076923076923,\n \"alnum_prop\": 0.6917293233082706,\n \"repo_name\": \"mdoering/backbone\",\n \"id\": \"47f80bf56e2b0c4411747934fcaa40b01c336f21\",\n \"size\": \"184\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"life/Bacteria/Cyanobacteria/Chroococcales/Synechococcaceae/Aphanothece/Aphanothece elabens/ Syn. Micraloa elabens/README.md\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":996,"cells":{"text":{"kind":"string","value":"namespace arangodb {\nnamespace application_features {\nclass ApplicationServer;\n}\nnamespace aql {\nclass QueryList;\n}\nnamespace velocypack {\nclass Builder;\nclass Slice;\nclass StringRef;\n} // namespace velocypack\n\nclass CursorRepository;\nstruct DatabaseJavaScriptCache;\nclass DatabaseReplicationApplier;\nclass LogicalCollection;\nclass LogicalDataSource;\nclass LogicalView;\nclass ReplicationClientsProgressTracker;\nclass StorageEngine;\n} // namespace arangodb\n\n/// @brief document handle separator as character\nconstexpr char TRI_DOCUMENT_HANDLE_SEPARATOR_CHR = '/';\n\n/// @brief document handle separator as string\nconstexpr auto TRI_DOCUMENT_HANDLE_SEPARATOR_STR = \"/\";\n\n/// @brief index handle separator as character\nconstexpr char TRI_INDEX_HANDLE_SEPARATOR_CHR = '/';\n\n/// @brief index handle separator as string\nconstexpr auto TRI_INDEX_HANDLE_SEPARATOR_STR = \"/\";\n\n/// @brief collection enum\nenum TRI_col_type_e : uint32_t {\n TRI_COL_TYPE_UNKNOWN = 0, // only used to signal an invalid collection type\n TRI_COL_TYPE_DOCUMENT = 2,\n TRI_COL_TYPE_EDGE = 3\n};\n\n/// @brief database type\nenum TRI_vocbase_type_e {\n TRI_VOCBASE_TYPE_NORMAL = 0,\n TRI_VOCBASE_TYPE_COORDINATOR = 1\n};\n\n/// @brief status of a collection\n/// note: the NEW_BORN status is not used in ArangoDB 1.3 anymore, but is left\n/// in this enum for compatibility with earlier versions\nenum TRI_vocbase_col_status_e : int {\n TRI_VOC_COL_STATUS_CORRUPTED = 0,\n TRI_VOC_COL_STATUS_NEW_BORN = 1, // DEPRECATED, and shouldn't be used anymore\n TRI_VOC_COL_STATUS_UNLOADED = 2,\n TRI_VOC_COL_STATUS_LOADED = 3,\n TRI_VOC_COL_STATUS_UNLOADING = 4,\n TRI_VOC_COL_STATUS_DELETED = 5,\n TRI_VOC_COL_STATUS_LOADING = 6\n};\n\n/// @brief database\nstruct TRI_vocbase_t {\n friend class arangodb::StorageEngine;\n\n TRI_vocbase_t(TRI_vocbase_type_e type, arangodb::CreateDatabaseInfo&&);\n TEST_VIRTUAL ~TRI_vocbase_t();\n\n private:\n // explicitly document implicit behavior (due to presence of locks)\n TRI_vocbase_t(TRI_vocbase_t&&) = delete;\n TRI_vocbase_t(TRI_vocbase_t const&) = delete;\n TRI_vocbase_t& operator=(TRI_vocbase_t&&) = delete;\n TRI_vocbase_t& operator=(TRI_vocbase_t const&) = delete;\n\n /// @brief sleep interval used when polling for a loading collection's status\n static constexpr unsigned collectionStatusPollInterval() { return 10 * 1000; }\n\n /// @brief states for dropping\n enum DropState {\n DROP_EXIT, // drop done, nothing else to do\n DROP_AGAIN, // drop not done, must try again\n DROP_PERFORM // drop done, must perform actual cleanup routine\n };\n\n arangodb::application_features::ApplicationServer& _server;\n\n arangodb::CreateDatabaseInfo _info;\n\n TRI_vocbase_type_e _type; // type (normal or coordinator)\n std::atomic _refCount;\n bool _isOwnAppsDirectory;\n\n std::vector> _collections; // ALL collections\n std::vector> _deadCollections; // collections dropped that can be removed later\n\n std::unordered_map>\n _dataSourceById; // data-source by id\n std::unordered_map> _dataSourceByName; // data-source by name\n std::unordered_map> _dataSourceByUuid; // data-source by uuid\n mutable arangodb::basics::ReadWriteLock _dataSourceLock; // data-source iterator lock\n mutable std::atomic _dataSourceLockWriteOwner; // current thread owning '_dataSourceLock'\n // write lock (workaround for non-recusrive\n // ReadWriteLock)\n\n std::unique_ptr _queries;\n std::unique_ptr _cursorRepository;\n\n std::unique_ptr _replicationApplier;\n std::unique_ptr _replicationClients;\n\n public:\n arangodb::basics::DeadlockDetector _deadlockDetector;\n arangodb::basics::ReadWriteLock _inventoryLock; // object lock needed when\n // replication is assessing\n // the state of the vocbase\n\n // structures for volatile cache data (used from JavaScript)\n std::unique_ptr _cacheData;\n\n public:\n /// @brief checks if a database name is allowed\n /// returns true if the name is allowed and false otherwise\n static bool IsAllowedName(arangodb::velocypack::Slice slice) noexcept;\n static bool IsAllowedName(bool allowSystem,\n arangodb::velocypack::StringRef const& name) noexcept;\n\n /// @brief determine whether a data-source name is a system data-source name\n static bool IsSystemName(std::string const& name) noexcept;\n\n arangodb::application_features::ApplicationServer& server() const {\n return _server;\n }\n\n TRI_voc_tick_t id() const { return _info.getId(); }\n std::string const& name() const { return _info.getName(); }\n std::string path() const;\n std::uint32_t replicationFactor() const;\n std::uint32_t writeConcern() const;\n std::string const& sharding() const;\n bool isOneShard() const;\n TRI_vocbase_type_e type() const { return _type; }\n\n void toVelocyPack(arangodb::velocypack::Builder& result) const;\n arangodb::ReplicationClientsProgressTracker& replicationClients() {\n return *_replicationClients;\n }\n\n arangodb::DatabaseReplicationApplier* replicationApplier() const {\n return _replicationApplier.get();\n }\n void addReplicationApplier();\n\n arangodb::aql::QueryList* queryList() const { return _queries.get(); }\n arangodb::CursorRepository* cursorRepository() const {\n return _cursorRepository.get();\n }\n\n bool isOwnAppsDirectory() const { return _isOwnAppsDirectory; }\n void setIsOwnAppsDirectory(bool value) { _isOwnAppsDirectory = value; }\n\n /// @brief increase the reference counter for a database.\n /// will return true if the refeence counter was increased, false otherwise\n /// in case false is returned, the database must not be used\n bool use();\n\n void forceUse();\n\n /// @brief decrease the reference counter for a database\n void release() noexcept;\n\n /// @brief returns whether the database is dangling\n bool isDangling() const;\n\n /// @brief whether or not the vocbase has been marked as deleted\n bool isDropped() const;\n\n /// @brief marks a database as deleted\n bool markAsDropped();\n\n /// @brief returns whether the database is the system database\n bool isSystem() const;\n\n /// @brief stop operations in this vocbase. must be called prior to\n /// shutdown to clean things up\n void stop();\n\n /// @brief closes a database and all collections\n void shutdown();\n\n /// @brief sets prototype collection for sharding (_users or _graphs)\n void setShardingPrototype(ShardingPrototype type);\n\n /// @brief gets prototype collection for sharding (_users or _graphs)\n ShardingPrototype shardingPrototype() const;\n \n /// @brief gets name of prototype collection for sharding (_users or _graphs)\n std::string const& shardingPrototypeName() const;\n\n /// @brief returns all known views\n std::vector> views();\n\n /// @brief returns all known collections\n std::vector> collections(bool includeDeleted);\n\n void processCollections(std::function const& cb,\n bool includeDeleted);\n\n /// @brief returns names of all known collections\n std::vector collectionNames();\n\n /// @brief creates a new view from parameter set\n std::shared_ptr createView(arangodb::velocypack::Slice parameters);\n\n /// @brief drops a view\n arangodb::Result dropView(arangodb::DataSourceId cid, bool allowDropSystem);\n\n /// @brief returns all known collections with their parameters\n /// and optionally indexes\n /// the result is sorted by type and name (vertices before edges)\n void inventory(arangodb::velocypack::Builder& result, TRI_voc_tick_t,\n std::function const& nameFilter);\n\n /// @brief looks up a collection by identifier\n std::shared_ptr lookupCollection(arangodb::DataSourceId id) const\n noexcept;\n\n /// @brief looks up a collection by name or stringified cid or uuid\n std::shared_ptr lookupCollection(std::string const& nameOrId) const\n noexcept;\n\n /// @brief looks up a collection by uuid\n std::shared_ptr lookupCollectionByUuid(std::string const& uuid) const\n noexcept;\n\n /// @brief looks up a data-source by identifier\n std::shared_ptr lookupDataSource(arangodb::DataSourceId id) const\n noexcept;\n\n /// @brief looks up a data-source by name or stringified cid or uuid\n std::shared_ptr lookupDataSource(std::string const& nameOrId) const\n noexcept;\n\n /// @brief looks up a view by identifier\n std::shared_ptr lookupView(arangodb::DataSourceId id) const;\n\n /// @brief looks up a view by name or stringified cid or uuid\n std::shared_ptr lookupView(std::string const& nameOrId) const;\n\n /// @brief renames a collection\n arangodb::Result renameCollection(arangodb::DataSourceId cid, std::string const& newName);\n\n /// @brief renames a view\n arangodb::Result renameView(arangodb::DataSourceId cid, std::string const& oldName);\n\n /// @brief creates a new collection from parameter set\n /// collection id (\"cid\") is normally passed with a value of 0\n /// this means that the system will assign a new collection id automatically\n /// using a cid of > 0 is supported to import dumps from other servers etc.\n /// but the functionality is not advertised\n std::shared_ptr createCollection(arangodb::velocypack::Slice parameters);\n\n /// @brief drops a collection, no timeout if timeout is < 0.0, otherwise\n /// timeout is in seconds. Essentially, the timeout counts to acquire the\n /// write lock for using the collection.\n arangodb::Result dropCollection(arangodb::DataSourceId cid,\n bool allowDropSystem, double timeout);\n\n /// @brief unloads a collection\n arangodb::Result unloadCollection(arangodb::LogicalCollection* collection, bool force);\n\n /// @brief locks a collection for usage by id\n /// Note that this will READ lock the collection you have to release the\n /// collection lock by yourself and call @ref TRI_ReleaseCollectionVocBase\n /// when you are done with the collection.\n std::shared_ptr useCollection(arangodb::DataSourceId cid,\n bool checkPermissions);\n\n /// @brief locks a collection for usage by name\n /// Note that this will READ lock the collection you have to release the\n /// collection lock by yourself and call @ref TRI_ReleaseCollectionVocBase\n /// when you are done with the collection.\n std::shared_ptr useCollection(std::string const& name, bool checkPermissions);\n\n /// @brief releases a collection from usage\n void releaseCollection(arangodb::LogicalCollection* collection);\n\n /// @brief visit all DataSources registered with this vocbase\n /// @param visitor returns if visitation should continue\n /// @param lockWrite acquire write lock (if 'visitor' will modify vocbase)\n /// @return visitation compleated successfully\n typedef std::function dataSourceVisitor;\n bool visitDataSources(dataSourceVisitor const& visitor, bool lockWrite = false);\n\n private:\n /// @brief callback for collection dropping\n static bool dropCollectionCallback(arangodb::LogicalCollection& collection);\n\n /// @brief check some invariants on the various lists of collections\n void checkCollectionInvariants() const;\n\n std::shared_ptr useCollectionInternal(\n std::shared_ptr const&, bool checkPermissions);\n\n arangodb::Result loadCollection(arangodb::LogicalCollection& collection,\n bool checkPermissions);\n\n /// @brief adds a new collection\n /// caller must hold _dataSourceLock in write mode or set doLock\n void registerCollection(bool doLock, std::shared_ptr const& collection);\n\n /// @brief removes a collection from the global list of collections\n /// This function is called when a collection is dropped.\n void unregisterCollection(arangodb::LogicalCollection& collection);\n\n /// @brief creates a new collection, worker function\n std::shared_ptr createCollectionWorker(arangodb::velocypack::Slice parameters);\n\n /// @brief drops a collection, worker function\n ErrorCode dropCollectionWorker(arangodb::LogicalCollection* collection,\n DropState& state, double timeout);\n\n /// @brief adds a new view\n /// caller must hold _dataSourceLock in write mode or set doLock\n void registerView(bool doLock, std::shared_ptr const& view);\n\n /// @brief removes a view from the global list of views\n /// This function is called when a view is dropped.\n bool unregisterView(arangodb::LogicalView const& view);\n};\n\n/// @brief sanitize an object, given as slice, builder must contain an\n/// open object which will remain open\nvoid TRI_SanitizeObject(arangodb::velocypack::Slice const slice,\n arangodb::velocypack::Builder& builder);\nvoid TRI_SanitizeObjectWithEdges(arangodb::velocypack::Slice const slice,\n arangodb::velocypack::Builder& builder);\n\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"31f1230ac2db4ee291ece9b3b4959aa3\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 339,\n \"max_line_length\": 127,\n \"avg_line_length\": 41.36873156342183,\n \"alnum_prop\": 0.7196948088990303,\n \"repo_name\": \"Simran-B/arangodb\",\n \"id\": \"c28240f4aaa1776d838647afd9a010bec8f4bdbc\",\n \"size\": \"15517\",\n \"binary\": false,\n \"copies\": \"1\",\n \"ref\": \"refs/heads/devel\",\n \"path\": \"arangod/VocBase/vocbase.h\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Assembly\",\n \"bytes\": \"61827\"\n },\n {\n \"name\": \"Batchfile\",\n \"bytes\": \"3282\"\n },\n {\n \"name\": \"C\",\n \"bytes\": \"275955\"\n },\n {\n \"name\": \"C++\",\n \"bytes\": \"29221660\"\n },\n {\n \"name\": \"CMake\",\n \"bytes\": \"375992\"\n },\n {\n \"name\": \"CSS\",\n \"bytes\": \"212174\"\n },\n {\n \"name\": \"EJS\",\n \"bytes\": \"218744\"\n },\n {\n \"name\": \"HTML\",\n \"bytes\": \"23114\"\n },\n {\n \"name\": \"JavaScript\",\n \"bytes\": \"30616196\"\n },\n {\n \"name\": \"LLVM\",\n \"bytes\": \"14753\"\n },\n {\n \"name\": \"Makefile\",\n \"bytes\": \"526\"\n },\n {\n \"name\": \"NASL\",\n \"bytes\": \"129286\"\n },\n {\n \"name\": \"NSIS\",\n \"bytes\": \"49153\"\n },\n {\n \"name\": \"PHP\",\n \"bytes\": \"46519\"\n },\n {\n \"name\": \"Pascal\",\n \"bytes\": \"75391\"\n },\n {\n \"name\": \"Perl\",\n \"bytes\": \"9811\"\n },\n {\n \"name\": \"PowerShell\",\n \"bytes\": \"7885\"\n },\n {\n \"name\": \"Python\",\n \"bytes\": \"181384\"\n },\n {\n \"name\": \"Ruby\",\n \"bytes\": \"1041531\"\n },\n {\n \"name\": \"SCSS\",\n \"bytes\": \"254419\"\n },\n {\n \"name\": \"Shell\",\n \"bytes\": \"128175\"\n },\n {\n \"name\": \"TypeScript\",\n \"bytes\": \"25245\"\n },\n {\n \"name\": \"Yacc\",\n \"bytes\": \"68516\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":997,"cells":{"text":{"kind":"string","value":"module MnoEnterprise\n class App < BaseResource\n scope :active, -> { where(active: true) }\n scope :cloud, -> { where(stack: 'cloud') }\n\n attributes :id, :uid, :nid, :name, :description, :tiny_description, :created_at, :updated_at, :logo, :website, :slug,\n :categories, :key_benefits, :key_features, :testimonials, :worldwide_usage, :tiny_description,\n :popup_description, :stack, :terms_url, :pictures, :tags, :api_key, :metadata_url, :metadata, :details, :rank,\n :multi_instantiable, :subcategories, :reviews, :average_rating, :running_instances_count, :pricing_text\n\n\n #================================\n # Associations\n #================================\n has_many :reviews, class_name: 'AppReview'\n has_many :feedbacks, class_name: 'AppFeedback'\n has_many :questions, class_name: 'AppQuestion'\n has_many :shared_entities\n\n # Return the list of available categories\n def self.categories(list = nil)\n app_list = list || self.all.to_a\n app_list.select { |a| a.categories.present? }.map(&:categories).flatten.uniq { |e| e.downcase }.sort\n end\n\n def to_audit_event\n {\n app_id: id,\n app_nid: nid,\n app_name: name\n }\n end\n\n # Sanitize the app description\n # E.g.: replace any mention of Maestrano by the tenant name\n def sanitized_description\n @sanitized_description ||= (self.description || '').gsub(/(? void replaceAll(List stats) {\n ListIterator iter = stats.listIterator();\n while (iter.hasNext())\n iter.set((T) replace(iter.next()));\n }\n\n /**\n * Replaces the currently visited statement with the specified statement.\n */\n protected void replaceVisitedStatementWith(Statement other) {\n replacement = other;\n }\n\n @SuppressWarnings(\"unchecked\")\n @Override\n public void visitBlockStatement(BlockStatement stat) {\n replaceAll(stat.getStatements());\n }\n\n @Override\n public void visitForLoop(ForStatement stat) {\n stat.getCollectionExpression().visit(this);\n stat.setLoopBlock(replace(stat.getLoopBlock()));\n }\n\n @Override\n public void visitWhileLoop(WhileStatement stat) {\n stat.getBooleanExpression().visit(this);\n stat.setLoopBlock(replace(stat.getLoopBlock()));\n }\n\n @Override\n public void visitDoWhileLoop(DoWhileStatement stat) {\n stat.getBooleanExpression().visit(this);\n stat.setLoopBlock(replace(stat.getLoopBlock()));\n }\n\n @Override\n public void visitIfElse(IfStatement stat) {\n stat.getBooleanExpression().visit(this);\n stat.setIfBlock(replace(stat.getIfBlock()));\n stat.setElseBlock(replace(stat.getElseBlock()));\n }\n\n @SuppressWarnings(\"unchecked\")\n @Override\n public void visitTryCatchFinally(TryCatchStatement stat) {\n stat.setTryStatement(replace(stat.getTryStatement()));\n replaceAll(stat.getCatchStatements());\n stat.setFinallyStatement(replace(stat.getFinallyStatement()));\n }\n\n @SuppressWarnings(\"unchecked\")\n @Override\n public void visitSwitch(SwitchStatement stat) {\n stat.getExpression().visit(this);\n replaceAll(stat.getCaseStatements());\n stat.setDefaultStatement(replace(stat.getDefaultStatement()));\n }\n\n @Override\n public void visitCaseStatement(CaseStatement stat) {\n stat.getExpression().visit(this);\n stat.setCode(replace(stat.getCode()));\n }\n\n @Override\n public void visitSynchronizedStatement(SynchronizedStatement stat) {\n stat.getExpression().visit(this);\n stat.setCode(replace(stat.getCode()));\n }\n\n @Override\n public void visitCatchStatement(CatchStatement stat) {\n stat.setCode(replace(stat.getCode()));\n }\n\n @Override\n protected SourceUnit getSourceUnit() {\n throw new UnsupportedOperationException(\"getSourceUnit\");\n }\n}\n"},"meta":{"kind":"string","value":"{\n \"content_hash\": \"40f84c106fe0398ab2e0f42c7ddf93eb\",\n \"timestamp\": \"\",\n \"source\": \"github\",\n \"line_count\": 123,\n \"max_line_length\": 88,\n \"avg_line_length\": 29.235772357723576,\n \"alnum_prop\": 0.7366518353726362,\n \"repo_name\": \"spockframework/spock\",\n \"id\": \"eea8b355676101797d401a0872d7e379c049a4fc\",\n \"size\": \"4211\",\n \"binary\": false,\n \"copies\": \"2\",\n \"ref\": \"refs/heads/master\",\n \"path\": \"spock-core/src/main/java/org/spockframework/compiler/StatementReplacingVisitorSupport.java\",\n \"mode\": \"33188\",\n \"license\": \"apache-2.0\",\n \"language\": [\n {\n \"name\": \"Groovy\",\n \"bytes\": \"1124541\"\n },\n {\n \"name\": \"Java\",\n \"bytes\": \"1514097\"\n }\n ],\n \"symlink_target\": \"\"\n}"}}},{"rowIdx":999,"cells":{"text":{"kind":"string","value":"\r\nBinary Downloads: https://github.com/AlliterativeAlice/simpleyui/releases\r\n\r\n## Introduction\r\n\r\nSimple YUI Compressor .NET is a .NET 2.0-compatible library for combining and minifying JavaScript and CSS files for display on websites. Usage of SimpleYUI is similar to [SquishIt](https://github.com/jetheredge/SquishIt). SimpleYUI is not intended to be a replacement to SquishIt, but rather is intended to provide a simpler, less feature-rich solution that's compatible with .NET 2.0 and up. \"Simple\" in this case means:\r\n\r\n- Just one .dll file to include\r\n- Only supports pure JS and CSS (no support for LESS, SASS, CofeeScript, etc. If you need those, use SquishIt)\r\n- Only supports one compression engine (YUI)\r\n- No configuration required\r\n\r\nSimple YUI Compressor .NET is in no way related to [SimpleYUI](http://www.yuiblog.com/blog/2010/09/03/coming-inyui-3-2-0-simpleyui/)\r\n\r\n## How To Use\r\n\r\nFirst, you have to reference SimpleYUI.dll.\r\n\r\nAn example of using SimpleYUI is:\r\n\r\n```aspx\r\n\r\n\r\n \r\n\t SimpleYUI Demo\r\n\t\t<%= SimpleYUI.Bundler.CSS()\r\n\t\t .Add(\"~/css/style1.css\")\r\n\t\t\t\t.Add(\"~/css/style2.css\")\r\n\t\t\t\t.Render(\"~/css/combined.css\") %>\r\n\t\t<%= SimpleYUI.Bundler.JavaScript()\r\n\t\t .Add(\"~/scripts/script1.js\")\r\n\t\t\t\t.Add(\"~/scripts/script2.js\")\r\n\t\t\t\t.Render(\"~/scripts/combined.js\") %>\r\n\t\r\n\t\r\n\t\r\n\r\n```\r\n\r\nSimpleYUI injects a hash into the rendered filename based on the parameters passed and the last modified times of the included files. Therefore SimpleYUI will not regenerate the combined file on every request (which would be extremely inefficient) but only when one of the included files is changed, or the parameters passed to CSS() or JavaScript() change. When debugging, you can have SimpleYUI output individual `