text:
@implementation EndLevelLayer

- (void)levelEndWithVictory:(BOOL)victory {
    CCDirector *director = [CCDirector sharedDirector];
    CGSize screenSize = [director winSize];
    CGPoint position = CGPointMake(screenSize.width/2.0f, screenSize.height/2.0f);
    CCSpriteFrameCache *frameCache = [CCSpriteFrameCache sharedSpriteFrameCache];

    CCMenuItemFont* replay = [CCMenuItemFont itemWithString:@"Rigioca" block:^(id sender) {
        CCNode* scene = (CCNode*)self.parent;
        GameLayer* gl = (GameLayer*)[scene getChildByTag:1];
        [gl replayLevel];
        [scene removeChild:self cleanup:YES];
    }];

    if (victory == YES) {
        CCMenuItemFont* nextLevel = [CCMenuItemFont itemWithString:@"Livello successivo" block:^(id sender) {
            CCNode* scene = (CCNode*)self.parent;
            GameLayer* gl = (GameLayer*)[scene getChildByTag:1];
            [gl nextLevel];
            [scene removeChild:self cleanup:YES];
        }];
        CCMenu* menu = [CCMenu menuWithItems:replay, nextLevel, nil];
        menu.position = CGPointMake(screenSize.width/2, screenSize.height/2 - 200);
        [self addChild:menu];
        [menu alignItemsVerticallyWithPadding:40];

        NSString *spriteNameWonNemo = @"wonNemo.png";
        CCSpriteFrame *wonFrame = [frameCache spriteFrameByName:spriteNameWonNemo];
        CCSprite *wonSprite = [[CCSprite alloc] initWithSpriteFrame:wonFrame];
        [self addChild:wonSprite];

        wonSprite.position = position;
    } else {
        CCMenu* menu = [CCMenu menuWithItems:replay, nil];
        menu.position = CGPointMake(screenSize.width/2, screenSize.height/2 - 200);
        [self addChild:menu];
        [menu alignItemsVerticallyWithPadding:40];

        NSString *spriteNameLostNemo = @"lostNemo.png";
        CCSpriteFrame *lostFrame = [frameCache spriteFrameByName:spriteNameLostNemo];
        CCSprite *lostSprite = [[CCSprite alloc] initWithSpriteFrame:lostFrame];
        [self addChild:lostSprite];

        lostSprite.position = position;
    }
}

@end


text:
layout: archive
title: "Archiwum"
date: 2016-02-21
modified: 2016-02-27
excerpt: "Poprzednie spotkania PAZURa"
tags: []
image:
  feature:
  teaser:
---

<div class="tiles">
{% for post in site.categories.archiwum %}
  {% include post-grid.html %}
{% endfor %}
</div><!-- /.tiles -->

redpajama_set_name: RedPajamaGithub


text:
--------------------------------
--
-- @function [parent=#ToggleVisibility] clone
-- @param self
-- @return ToggleVisibility#ToggleVisibility ret (return value: cc.ToggleVisibility)

--------------------------------
-- param time in seconds
-- @function [parent=#ToggleVisibility] update
-- @param self
-- @param #float time
-- @return ToggleVisibility#ToggleVisibility self (return value: cc.ToggleVisibility)

--------------------------------
--
-- @function [parent=#ToggleVisibility] reverse
-- @param self
-- @return ToggleVisibility#ToggleVisibility ret (return value: cc.ToggleVisibility)

return nil


text:
#include <iostream>
#include "CSContentJsonDictionary.h"

namespace cs {

    JsonDictionary::JsonDictionary()
    {
        m_cValue.clear();
    }

    JsonDictionary::~JsonDictionary()
    {
        m_cValue.clear();
    }

    void JsonDictionary::initWithDescription(const char *pszDescription)
    {
        CSJson::Reader cReader;
        m_cValue.clear();
        if (pszDescription && *pszDescription)
        {
            std::string strValue = pszDescription;
            cReader.parse(strValue, m_cValue, false);
        }
    }

    void JsonDictionary::initWithValue(CSJson::Value& value)
    {
        m_cValue = value;
    }

    void JsonDictionary::insertItem(const char *pszKey, int nValue)
    {
        m_cValue[pszKey] = nValue;
    }

    void JsonDictionary::insertItem(const char *pszKey, double fValue)
    {
        m_cValue[pszKey] = fValue;
    }

    void JsonDictionary::insertItem(const char *pszKey, const char * pszValue)
    {
        m_cValue[pszKey] = pszValue;
    }

    void JsonDictionary::insertItem(const char *pszKey, bool bValue)
    {
        m_cValue[pszKey] = bValue;
    }

    void JsonDictionary::insertItem(const char *pszKey, JsonDictionary * subDictionary)
    {
        if (subDictionary)
            m_cValue[pszKey] = subDictionary->m_cValue;
    }

    bool JsonDictionary::deleteItem(const char *pszKey)
    {
        if(!m_cValue.isMember(pszKey))
            return false;

        m_cValue.removeMember(pszKey);

        return true;
    }

    void JsonDictionary::cleanUp()
    {
        m_cValue.clear();
    }

    bool JsonDictionary::isKeyValidate(const char *pszKey)
    {
        return m_cValue.isMember(pszKey);
    }

    int JsonDictionary::getItemIntValue(const char *pszKey, int nDefaultValue)
    {
        if (!isKeyValidate(pszKey, m_cValue) || !m_cValue[pszKey].isNumeric())
            return nDefaultValue;

        return m_cValue[pszKey].asInt();
    }

    double JsonDictionary::getItemFloatValue(const char *pszKey, double fDefaultValue)
    {
        if (!isKeyValidate(pszKey, m_cValue) || !m_cValue[pszKey].isNumeric())
            return fDefaultValue;

        return m_cValue[pszKey].asDouble();
    }

    const char * JsonDictionary::getItemStringValue(const char *pszKey)
    {
        if (!isKeyValidate(pszKey, m_cValue) || !m_cValue[pszKey].isString())
            return NULL;

        return m_cValue[pszKey].asCString();
    }

    bool JsonDictionary::getItemBoolvalue(const char *pszKey, bool bDefaultValue)
    {
        if (!isKeyValidate(pszKey, m_cValue) || !m_cValue[pszKey].isBool())
            return bDefaultValue;

        return m_cValue[pszKey].asBool();
    }

    JsonDictionary * JsonDictionary::getSubDictionary(const char *pszKey)
    {
        JsonDictionary * pNewDictionary;
        if (!isKeyValidate(pszKey, m_cValue) || (!m_cValue[pszKey].isArray() &&
                                                 !m_cValue[pszKey].isObject() &&
                                                 !m_cValue[pszKey].isConvertibleTo(CSJson::arrayValue) &&
                                                 !m_cValue[pszKey].isConvertibleTo(CSJson::objectValue)))
        {
            pNewDictionary = NULL;
        }
        else
        {
            pNewDictionary = new JsonDictionary();
            pNewDictionary->initWithValue(m_cValue[pszKey]);
        }
        return pNewDictionary;
    }

    std::string JsonDictionary::getDescription()
    {
        std::string strReturn = m_cValue.toStyledString();
        return strReturn;
    }

    bool JsonDictionary::insertItemToArray(const char *pszArrayKey, int nValue)
    {
        CSJson::Value array;
        if(m_cValue.isMember(pszArrayKey))
        {
            if (!m_cValue[pszArrayKey].isArray() && !m_cValue[pszArrayKey].isConvertibleTo(CSJson::arrayValue))
                return false;

            array = m_cValue[pszArrayKey];
        }

        array.append(nValue);
        m_cValue[pszArrayKey] = array;

        return true;
    }

    bool JsonDictionary::insertItemToArray(const char *pszArrayKey, double fValue)
    {
        CSJson::Value array;
        if(m_cValue.isMember(pszArrayKey))
        {
            if (!m_cValue[pszArrayKey].isArray() && !m_cValue[pszArrayKey].isConvertibleTo(CSJson::arrayValue))
                return false;

            array = m_cValue[pszArrayKey];
        }

        array.append(fValue);
        m_cValue[pszArrayKey] = array;

        return true;
    }

    bool JsonDictionary::insertItemToArray(const char *pszArrayKey, const char * pszValue)
    {
        CSJson::Value array;
        if(m_cValue.isMember(pszArrayKey))
        {
            if (!m_cValue[pszArrayKey].isArray() && !m_cValue[pszArrayKey].isConvertibleTo(CSJson::arrayValue))
                return false;

            array = m_cValue[pszArrayKey];
        }

        array.append(pszValue);
        m_cValue[pszArrayKey] = array;

        return true;
    }

    bool JsonDictionary::insertItemToArray(const char *pszArrayKey, JsonDictionary * subDictionary)
    {
        CSJson::Value array;
        if(m_cValue.isMember(pszArrayKey))
        {
            if (!m_cValue[pszArrayKey].isArray() && !m_cValue[pszArrayKey].isConvertibleTo(CSJson::arrayValue))
                return false;

            array = m_cValue[pszArrayKey];
        }

        array.append(subDictionary->m_cValue);
        m_cValue[pszArrayKey] = array;

        return true;
    }

    int JsonDictionary::getItemCount()
    {
        return m_cValue.size();
    }

    DicItemType JsonDictionary::getItemType(int nIndex)
    {
        return (DicItemType)m_cValue[nIndex].type();
    }

    DicItemType JsonDictionary::getItemType(const char *pszKey)
    {
        return (DicItemType)m_cValue[pszKey].type();
    }

    std::vector<std::string> JsonDictionary::getAllMemberNames()
    {
        return m_cValue.getMemberNames();
    }

    int JsonDictionary::getArrayItemCount(const char *pszArrayKey)
    {
        int nRet = 0;
        if (!isKeyValidate(pszArrayKey, m_cValue) ||
            (!m_cValue[pszArrayKey].isArray() && !m_cValue[pszArrayKey].isObject() &&
             !m_cValue[pszArrayKey].isConvertibleTo(CSJson::arrayValue) && !m_cValue[pszArrayKey].isConvertibleTo(CSJson::objectValue)))
        {
            nRet = 0;
        }
        else
        {
            CSJson::Value arrayValue = m_cValue[pszArrayKey];
            nRet = arrayValue.size();
        }

        return nRet;
    }

    int JsonDictionary::getIntValueFromArray(const char *pszArrayKey, int nIndex, int nDefaultValue)
    {
        int nRet = nDefaultValue;
        CSJson::Value * arrayValue = validateArrayItem(pszArrayKey, nIndex);
        if (arrayValue)
        {
            if ((*arrayValue)[nIndex].isNumeric())
                nRet = (*arrayValue)[nIndex].asInt();
        }

        return nRet;
    }

    double JsonDictionary::getFloatValueFromArray(const char *pszArrayKey, int nIndex, double fDefaultValue)
    {
        double fRet = fDefaultValue;
        CSJson::Value * arrayValue = validateArrayItem(pszArrayKey, nIndex);
        if (arrayValue)
        {
            if ((*arrayValue)[nIndex].isNumeric())
                fRet = (*arrayValue)[nIndex].asDouble();
        }

        return fRet;
    }

    bool JsonDictionary::getBoolValueFromArray(const char *pszArrayKey, int nIndex, bool bDefaultValue)
    {
        bool bRet = bDefaultValue;
        CSJson::Value * arrayValue = validateArrayItem(pszArrayKey, nIndex);
        if (arrayValue)
        {
            if ((*arrayValue)[nIndex].isNumeric())
                bRet = (*arrayValue)[nIndex].asBool();
        }

        return bRet;
    }

    const char * JsonDictionary::getStringValueFromArray(const char *pszArrayKey, int nIndex)
    {
        CSJson::Value * arrayValue = validateArrayItem(pszArrayKey, nIndex);
        if (arrayValue)
        {
            if ((*arrayValue)[nIndex].isString())
                return (*arrayValue)[nIndex].asCString();
        }

        return NULL;
    }

    JsonDictionary * JsonDictionary::getSubItemFromArray(const char *pszArrayKey, int nIndex)
    {
        CSJson::Value * arrayValue = validateArrayItem(pszArrayKey, nIndex);
        if (arrayValue)
        {
            if ((*arrayValue)[nIndex].isArray() || (*arrayValue)[nIndex].isObject())
            {
                JsonDictionary * pNewDictionary = new JsonDictionary();
                pNewDictionary->initWithValue((*arrayValue)[nIndex]);
                return pNewDictionary;
            }
        }

        return NULL;
    }

    DicItemType JsonDictionary::getItemTypeFromArray(const char *pszArrayKey, int nIndex)
    {
        CSJson::Value * arrayValue = validateArrayItem(pszArrayKey, nIndex);
        if (arrayValue)
            return (DicItemType)((*arrayValue)[nIndex].type());

        return (DicItemType)CSJson::nullValue;
    }

    inline bool JsonDictionary::isKeyValidate(const char *pszKey, CSJson::Value& root)
    {
        if (root.isNull() || !root.isMember(pszKey))
            return false;

        return true;
    }

    inline CSJson::Value * JsonDictionary::validateArrayItem(const char *pszArrayKey, int nIndex)
    {
        if (!isKeyValidate(pszArrayKey, m_cValue) && !m_cValue[pszArrayKey].isArray() && !m_cValue[pszArrayKey].isConvertibleTo(CSJson::arrayValue))
            return NULL;
        if (!m_cValue[pszArrayKey].isValidIndex(nIndex))
            return NULL;

        return &m_cValue[pszArrayKey];
    }
}


text:
package com.intellij.util;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.openapi.vfs.newvfs.BulkFileListener;
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
import com.intellij.openapi.vfs.newvfs.events.VFilePropertyChangeEvent;
import consulo.annotation.access.RequiredWriteAction;
import consulo.ui.annotation.RequiredUIAccess;
import org.jetbrains.annotations.NonNls;

import javax.annotation.Nonnull;
import java.util.*;

/**
 * @author peter
 */
public class FileContentUtilCore {
  @NonNls public static final String FORCE_RELOAD_REQUESTOR = "FileContentUtilCore.saveOrReload";

  @RequiredUIAccess
  public static void reparseFiles(@Nonnull VirtualFile... files) {
    reparseFiles(Arrays.asList(files));
  }

  @RequiredUIAccess
  public static void reparseFiles(@Nonnull final Collection<? extends VirtualFile> files) {
    ApplicationManager.getApplication().runWriteAction(new Runnable() {
      @Override
      public void run() {
        // files must be processed under one write action to prevent firing event for invalid files.
        final Set<VFilePropertyChangeEvent> events = new HashSet<VFilePropertyChangeEvent>();
        for (VirtualFile file : files) {
          saveOrReload(file, events);
        }

        BulkFileListener publisher = ApplicationManager.getApplication().getMessageBus().syncPublisher(VirtualFileManager.VFS_CHANGES);
        List<VFileEvent> eventList = new ArrayList<VFileEvent>(events);
        publisher.before(eventList);
        publisher.after(eventList);
      }
    });
  }

  @RequiredWriteAction
  private static void saveOrReload(VirtualFile file, @Nonnull Collection<VFilePropertyChangeEvent> events) {
    if (file == null || file.isDirectory() || !file.isValid()) {
      return;
    }

    FileDocumentManager documentManager = FileDocumentManager.getInstance();
    if (documentManager.isFileModified(file)) {
      Document document = documentManager.getDocument(file);
      if (document != null) {
        documentManager.saveDocument(document);
      }
    }

    events.add(new VFilePropertyChangeEvent(FORCE_RELOAD_REQUESTOR, file, VirtualFile.PROP_NAME, file.getName(), file.getName(), false));
  }
}


text:
The driver provides support for all the CQL numerical datatypes, such as int, float, double, bigint, varint, and
decimal. There is only one numerical datatype in ECMAScript standard, `Number` which represent a
double-precision 64-bit value. It is used by the driver to handle double, float, int, smallint and tinyint values.

## int, float, and double

JavaScript provides methods to operate with Numbers (that is, IEEE 754 double-precision floats) and built-in operators
(sum, subtraction, division, bitwise, etc), making it a good fit for CQL datatypes int, float. and double.

When decoding any of these datatype values, it is returned as a `Number`.

```javascript
client.execute('SELECT int_val, float_val, double_val FROM tbl')
  .then(function (result) {
    console.log(typeof result.rows[0]['int_val']);    // Number
    console.log(typeof result.rows[0]['float_val']);  // Number
    console.log(typeof result.rows[0]['double_val']); // Number
  });
```

When encoding the data, the driver tries to encode a `Number` as double because it can not automatically determine if is
dealing with an int, a float, or a double.

Inserting a Number value as a double succeeds:

```javascript
const query = 'INSERT INTO tbl (id, double_val) VALUES (?, ?)';
client.execute(query, [ id, 1.2 ]);
```

But doing the same with a float fails:

```javascript
const query = 'INSERT INTO tbl (id, float_val) VALUES (?, ?)';
client.execute(query, [ id, 1.2 ])
  .catch(function (err) {
    console.log(err) // ResponseError: Expected 4 or 0 byte value for a float (8)
  });
```

Trying to do the same with an int, also fails because Cassandra expects a float or an int, and the driver sent a 64-bit
double.

```javascript
const query = 'INSERT INTO tbl (id, int_val) VALUES (?, ?)';
client.execute(query, [ id, 1 ])
  .catch(function (err) {
    console.log(err) // ResponseError: Expected 4 or 0 byte int (8)
  });
```

To overcome this limitation, you should prepare your queries. Because preparing and executing statements in the driver
does not require chaining two asynchronous calls, you can set the prepare flag in the query options and the driver
handles the rest.

The previous query, using the prepare flag, succeeds no matter if it is an int, float, or double:

```javascript
const query = 'INSERT INTO tbl (id, int_val) VALUES (?, ?)';
client.execute(query, [ id, 1 ], { prepare: true });
```

## decimal

The [`BigDecimal` class](/api/module.types/class.BigDecimal/) provides support for representing the CQL decimal datatype, because JavaScript has no built-in
arbitrary precision decimal representation.

```javascript
const BigDecimal = require('cassandra-driver').types.BigDecimal;
const value1 = new BigDecimal(153, 2);
const value2 = BigDecimal.fromString('1.53');
console.log(value1.toString());     // 1.53
console.log(value2.toString());     // 1.53
console.log(value1.equals(value2)); // true
```

The driver decodes CQL decimal datatype values as instances of `BigDecimal`.

```javascript
client.execute('SELECT decimal_val FROM users')
  .then(function (result) {
    console.log(result.rows[0]['decimal_val'] instanceof BigDecimal); // true
  });
```

## bigint

The [`Long` class](/api/module.types/class.Long/) provides support for representing the CQL bigint datatype, because JavaScript has no built-in 64-bit
integer representation.

```javascript
const Long = require('cassandra-driver').types.Long;
const value1 = Long.fromNumber(101);
const value2 = Long.fromString('101');
console.log(value1.toString());             // 101
console.log(value2.toString());             // 101
console.log(value1.equals(value2));         // true
console.log(value1.add(value2).toString()); // 202
```

The driver decodes CQL bigint datatype values as instances of `Long`.

```javascript
client.execute('SELECT bigint_val FROM users')
  .then(function (result) {
    console.log(result.rows[0]['bigint_val'] instanceof Long); // true
  });
```

## varint

The [`Integer` class](/api/module.types/class.Integer/), originally part of the Google Closure math library, provides support for representing CQL varint
datatype values, because JavaScript has no arbitrarily-large signed integer representation.

```javascript
const Integer = require('cassandra-driver').types.Integer;
const value1 = Integer.fromNumber(404);
const value2 = Integer.fromString(404);
console.log(value1.toString());             // 404
console.log(value2.toString());             // 404
console.log(value1.equals(value2));         // true
console.log(value1.add(value2).toString()); // 808
```

The driver decodes CQL varint datatype values as instances of `Integer`.

```javascript
client.execute('SELECT varint_val FROM users')
  .then(function (result) {
    console.log(result.rows[0]['varint_val'] instanceof Integer); // true
  });
```

## smallint and tinyint

Cassandra 2.2 introduced `smallint` for 2-byte numerical representation and `tinyint` for 1-byte numerical
representation.

The driver represents these types as `Number` to take advantage of the ECMAScript built-in operations for `Number` (sum,
subtraction, division, bitwise, etc).

For `tinyint`, only Numbers between -128 and 127 are valid, and for `smallint` only Numbers between -32768 and 32767.
Numbers outside valid ranges will callback with `TypeError` when executing.

## ECMAScript BigInt support

On modern JavaScript engines with [`BigInt`][bigint] support (e.g., Node.js 10+), you can use ECMAScript
`BigInt` to represent `varint` and/or `bigint` CQL data types with the Node.js driver.

To enable this option, you must specify it in the client options:

```javascript
const client = new Client({
  contactPoints,
  localDataCenter,
  encoding: {
      useBigIntAsLong: true,
      useBigIntAsVarint: true
  }
});
```

You can use `BigInt` to represent `varint` or `bigint` CQL data types or both.

```javascript
client.execute('SELECT varint_value FROM table')
  .then(rs => console.log(typeof rs.rows[0]['varint_value'])); // "bigint"
```

[bigint]: https://github.com/tc39/proposal-bigint


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <solid android:color="@color/color_white" />

    <corners android:radius="@dimen/dimen_5"/>
    <!--描边 -->
    <stroke
        android:width="0.5dip"
        android:color="@color/color_dialog_line" />

</shape>


text:
var vows = require('vows');
var assert = require('assert');
var fs = require('fs');
var path = require('path');
var cp = require('child_process');
var fsext = require('../helper/fsext');
var dbmUtil = require('../../lib/util');

function wipeMigrations(callback) {
  var dir = path.join(__dirname, 'migrations');
  fsext.rm_r(dir, callback);
}

function dbMigrate() {
  var args = dbmUtil.toArray(arguments);
  var dbm = path.join(__dirname, '..', '..', 'bin', 'db-migrate');
  args.unshift(dbm);
  return cp.spawn('node', args, { cwd: __dirname });
}

vows.describe('create').addBatch({
  'without a migration directory': {
    topic: function() {
      wipeMigrations(function(err) {
        assert.isNull(err);
        dbMigrate('create', 'first migration').on('exit', this.callback);
      }.bind(this));
    },

    'does not cause an error': function(code) {
      assert.isNull(code);
    },

    'will create a new migration directory': function(code) {
      fs.stat(path.join(__dirname, 'migrations'), function(err, stats) {
        assert.isNull(err);
        assert.isTrue(stats.isDirectory());
      });
    },

    'will create a new migration': function(code) {
      fs.readdir(path.join(__dirname, 'migrations'), function(err, files) {
        assert.isNull(err);
        assert.isEqual(files.length, 1);
        assert.match(file, /first-migration\.js$/);

        var migration = require(path.join(__dirname, 'migrations', file));
        assert.isNotNull(migration.up);
        assert.isNotNull(migration.down);
      });
    }
  }
}).export(module);


text:
@implementation OneMatchVC

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

@end


text:
package org.apache.hadoop.hive.ql.optimizer;

import org.apache.hadoop.hive.ql.log.PerfLogger;
import org.apache.hadoop.hive.ql.parse.ParseContext;
import org.apache.hadoop.hive.ql.parse.SemanticException;
import org.apache.hadoop.hive.ql.session.SessionState;

/**
 * Optimizer interface. All the rule-based optimizations implement this
 * interface. All the transformations are invoked sequentially. They take the
 * current parse context (which contains the operator tree among other things),
 * perform all the optimizations, and then return the updated parse context.
 */
public abstract class Transform {
  /**
   * All transformation steps implement this interface.
   *
   * @param pctx
   *          input parse context
   * @return ParseContext
   * @throws SemanticException
   */
  public abstract ParseContext transform(ParseContext pctx) throws SemanticException;

  public void beginPerfLogging() {
    PerfLogger perfLogger = SessionState.getPerfLogger();
    perfLogger.perfLogBegin(this.getClass().getName(), PerfLogger.OPTIMIZER);
  }

  public void endPerfLogging() {
    PerfLogger perfLogger = SessionState.getPerfLogger();
    perfLogger.perfLogEnd(this.getClass().getName(), PerfLogger.OPTIMIZER);
  }
  public void endPerfLogging(String additionalInfo) {
    PerfLogger perfLogger = SessionState.getPerfLogger();
	perfLogger.perfLogEnd(this.getClass().getName(), PerfLogger.OPTIMIZER, additionalInfo);
  }
}


text:
"""
Compatibility layer for Python 3/Python 2 single codebase
"""

try:
    _basestring = basestring
    _bytes_or_unicode = (str, unicode)
except NameError:
    _basestring = str
    _bytes_or_unicode = (bytes, str)


text:
<?php

namespace OCA\Files\Command;

use OC\Encryption\Manager;
use OC\Files\Filesystem;
use OC\Files\View;
use OC\Share20\ProviderFactory;
use OC\User\NoUserException;
use OCP\Files\FileInfo;
use OCP\Files\IRootFolder;
use OCP\Files\Mount\IMountManager;
use OCP\Files\NotFoundException;
use OCP\IUserManager;
use OCP\Share\IManager;
use OCP\Share\IShare;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;

class TransferOwnership extends Command {

	/** @var IUserManager $userManager */
	private $userManager;

	/** @var IManager */
	private $shareManager;

	/** @var IMountManager */
	private $mountManager;

	/** @var IRootFolder */
	private $rootFolder;

	/** @var Manager  */
	private $encryptionManager;

	/** @var ProviderFactory  */
	private $shareProviderFactory;

	/** @var bool */
	private $filesExist = false;

	/** @var bool */
	private $foldersExist = false;

	/** @var FileInfo[] */
	private $encryptedFiles = [];

	/** @var IShare[] */
	private $shares = [];

	/** @var string */
	private $sourceUser;

	/** @var string */
	private $destinationUser;

	/** @var string */
	private $inputPath;

	/** @var string */
	private $finalTarget;

	public function __construct(
		IUserManager $userManager,
		IManager $shareManager,
		IMountManager $mountManager,
		IRootFolder $rootFolder,
		Manager $encryptionManager,
		ProviderFactory $shareProviderFactory
	) {
		$this->userManager = $userManager;
		$this->shareManager = $shareManager;
		$this->mountManager = $mountManager;
		$this->rootFolder = $rootFolder;
		$this->encryptionManager = $encryptionManager;
		$this->shareProviderFactory = $shareProviderFactory;
		parent::__construct();
	}

	protected function configure() {
		$this
			->setName('files:transfer-ownership')
			->setDescription('All files and folders are moved to another user - shares are moved as well.')
			->addArgument(
				'source-user',
				InputArgument::REQUIRED,
				'owner of files which shall be moved'
			)
			->addArgument(
				'destination-user',
				InputArgument::REQUIRED,
				'user who will be the new owner of the files'
			)
			->addOption(
				'path',
				null,
				InputOption::VALUE_REQUIRED,
				'selectively provide the path to transfer. For example --path="folder_name"'
			)
			->addOption(
				'accept-skipped-shares',
				's',
				InputOption::VALUE_NONE,
				'always confirm to continue in case of skipped shares.'
			);
	}

	protected function execute(InputInterface $input, OutputInterface $output) {
		$sourceUserObject = $this->userManager->get($input->getArgument('source-user'));
		$destinationUserObject = $this->userManager->get($input->getArgument('destination-user'));
		if ($sourceUserObject === null) {
			$output->writeln("<error>Unknown source user $this->sourceUser</error>");
			return 1;
		}
		if ($destinationUserObject === null) {
			$output->writeln("<error>Unknown destination user $this->destinationUser</error>");
			return 1;
		}

		$this->sourceUser = $sourceUserObject->getUID();
		$this->destinationUser = $destinationUserObject->getUID();
		$this->inputPath = $input->getOption('path');
		$this->inputPath = \ltrim($this->inputPath, '/');

		// target user has to be ready
		if ($destinationUserObject->getLastLogin() === 0) {
			// based on \OC\User\Session->prepareUserLogin
			\OC_Util::setupFS($this->destinationUser);
			$userFolder = $this->rootFolder->getUserFolder($this->destinationUser);
			\OC_Util::copySkeleton($this->destinationUser, $userFolder);  // exceptions might be thrown here
			\OC_Util::tearDownFS();
		}
		if (!$this->encryptionManager->isReadyForUser($this->destinationUser)) {
			$output->writeln("<error>The target user is not ready to accept files. The user has at least to be logged in once.</error>");
			return 2;
		}

		// use a date format compatible across client OS
		$date = \date('Ymd_his');
		$this->finalTarget = "$this->destinationUser/files/transferred from $this->sourceUser on $date";

		// setup filesystem
		Filesystem::initMountPoints($this->sourceUser);
		Filesystem::initMountPoints($this->destinationUser);

		if (\strlen($this->inputPath) >= 1) {
			$view = new View();
			$unknownDir = $this->inputPath;
			$this->inputPath = $this->sourceUser . "/files/" . $this->inputPath;
			if (!$view->is_dir($this->inputPath)) {
				$output->writeln("<error>Unknown path provided: $unknownDir</error>");
				return 1;
			}
		}

		// analyse source folder
		$this->analyse($output);

		if (!$this->filesExist and !$this->foldersExist) {
			$output->writeln("<comment>No files/folders to transfer</comment>");
			return 1;
		}

		// collect all the shares
		$hasSkipped = $this->collectUsersShares($input, $output);

		if ($hasSkipped && !$input->getOption('accept-skipped-shares')) {
			// ask (if possible) how to handle missing accounts. Disable the accounts by default.
			$helper = $this->getHelper('question');
			$question = new ChoiceQuestion(
				'There are user shares that cannot be transferred. Do you want to continue with the transfer and skip these shares?',
				['yes', 'no'],
				0
			);
			$continue = $helper->ask($input, $output, $question);
			if ($continue == 'no') {
				$output->writeln("<comment>Execution terminated</comment>");
				return 1;
			}
		}

		// transfer the files
		$this->transfer($output);

		// restore the shares
		return $this->restoreShares($output);
	}

	private function walkFiles(View $view, $path, \Closure $callBack) {
		foreach ($view->getDirectoryContent($path) as $fileInfo) {
			if (!$callBack($fileInfo)) {
				return;
			}
			if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) {
				$this->walkFiles($view, $fileInfo->getPath(), $callBack);
			}
		}
	}

	/**
	 * @param OutputInterface $output
	 * @throws \Exception
	 */
	protected function analyse(OutputInterface $output) {
		$view = new View();
		$output->writeln("Analysing files of $this->sourceUser ...");
		$progress = new ProgressBar($output);
		$progress->start();
		$walkPath = "$this->sourceUser/files";
		if (\strlen($this->inputPath) > 0) {
			if ($this->inputPath !== "$this->sourceUser/files") {
				$walkPath = $this->inputPath;
				$this->foldersExist = true;
			}
		}

		$this->walkFiles($view, $walkPath,
				function (FileInfo $fileInfo) use ($progress) {
					if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) {
						// only analyze into folders from main storage,
						// sub-storages have an empty internal path
						if ($fileInfo->getInternalPath() === '' && $fileInfo->getPath() !== '') {
							return false;
						}

						$this->foldersExist = true;
						return true;
					}
					$progress->advance();
					$this->filesExist = true;
					if ($fileInfo->isEncrypted()) {
						if (\OC::$server->getAppConfig()->getValue('encryption', 'useMasterKey', 0) !== 0) {
							/**
							 * We are not going to add this to encryptedFiles array.
							 * Because its encrypted with masterKey and hence it doesn't
							 * require user's specific password.
							 */
							return true;
						}
						$this->encryptedFiles[] = $fileInfo;
					}
					return true;
				});
		$progress->finish();
		$output->writeln('');

		// no file is allowed to be encrypted
		if (!empty($this->encryptedFiles)) {
			$output->writeln("<error>Some files are encrypted - please decrypt them first</error>");
			foreach ($this->encryptedFiles as $encryptedFile) {
				/** @var FileInfo $encryptedFile */
				$output->writeln("  " . $encryptedFile->getPath());
			}
			throw new \Exception('Execution terminated.');
		}
	}

	/**
	 * @param InputInterface $input
	 * @param OutputInterface $output
	 * @return boolean if there were some skipped shares
	 */
	private function collectUsersShares(InputInterface $input, OutputInterface $output) {
		$output->writeln("Collecting all share information for files and folder of $this->sourceUser ...");

		$skipped = 0;
		$progress = new ProgressBar($output, \count($this->shares));
		foreach ([\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE] as $shareType) {
			$offset = 0;
			while (true) {
				$sharePage = $this->shareManager->getSharesBy($this->sourceUser, $shareType, null, true, 50, $offset);
				if (empty($sharePage)) {
					break;
				}

				if (\strlen($this->inputPath)>1) {
					$inputPathWithEndingSlash = \rtrim($this->inputPath, '/') . '/';
					/**
					 * filter only shares within the source folder
					 */
					$filteredShares = [];
					foreach ($sharePage as $share) {
						/**
						 * trim sharePath, because `/` character trimmed with ltrim in inputPath
						 */
						try {
							$trimmedSharePath = \ltrim($share->getNode()->getPath(), '/');
							if ($trimmedSharePath === $this->inputPath || (\strpos($trimmedSharePath, $inputPathWithEndingSlash) === 0)) {
								$filteredShares[] = $share;
							}
						} catch (NotFoundException | NoUserException $e) {
							$skipped++;
							$output->writeln('<error>Share with id ' . $share->getId() . ' and type ' . $share->getShareType() . ' points at deleted file or share that is no longer accessible, skipping</error>');
							$progress->advance(1);
						}
					}
				} else {
					$filteredShares = $sharePage;
				}

				// filter out the reshares as transfer ownership only transfers
				// files owned by the user - in case of reshares source
				// user is not file owner
				$filteredShares = \array_filter($filteredShares, function (IShare $share) {
					return $share->getShareOwner() === $this->sourceUser;
				});

				$progress->advance(\count($filteredShares));
				$this->shares = \array_merge($this->shares, $filteredShares);
				$offset += 50;
			}
		}

		$progress->finish();
		$output->writeln('');

		return $skipped > 0;
	}

	/**
	 * @param OutputInterface $output
	 */
	protected function transfer(OutputInterface $output) {
		$view = new View();
		$output->writeln("Transferring files to $this->finalTarget ...");
		$sourcePath = (\strlen($this->inputPath) > 0) ? $this->inputPath : "$this->sourceUser/files";
		// This change will help user to transfer the folder specified using --path option.
		// Else only the content inside folder is transferred which is not correct.
		if (\strlen($this->inputPath) > 0) {
			if ($this->inputPath !== \ltrim("$this->sourceUser/files", '/')) {
				$view->mkdir($this->finalTarget);
				$this->finalTarget = $this->finalTarget . '/' . \basename($sourcePath);
			}
		}

		$view->rename($sourcePath, $this->finalTarget);

		if (!\is_dir("$this->sourceUser/files")) {
			// because the files folder is moved away we need to recreate it
			$view->mkdir("$this->sourceUser/files");
		}
	}

	/**
	 * @param OutputInterface $output
	 */
	private function restoreShares(OutputInterface $output) {
		$output->writeln("Restoring shares ...");
		$progress = new ProgressBar($output, \count($this->shares));
		$status = 0;

		$childShares = [];
		foreach ($this->shares as $share) {
			try {
				/**
				 * Do not process children which are already processed.
				 * This piece of code populates the childShare array
				 * with the child shares which will be processed. And
				 * hence will avoid further processing of same share
				 * again.
				 */
				if ($share->getSharedWith() === $this->destinationUser) {
					$provider = $this->shareProviderFactory->getProviderForType($share->getShareType());
					'@phan-var \OC\Share20\DefaultShareProvider $provider';
					foreach ($provider->getChildren($share) as $child) {
						$childShares[] = $child->getId();
					}
				} else {
					/**
					 * Before doing handover to transferShare, check if the share
					 * id is present in the childShares. If so then just ignore
					 * this share and continue. If not ignored, the child shares
					 * would be processed again, if their parent share was shared
					 * with destination user. And hence we can safely avoid the
					 * duplicate processing of shares here.
					 */
					if (\in_array($share->getId(), $childShares, true)) {
						continue;
					}
				}
				$this->shareManager->transferShare($share, $this->sourceUser, $this->destinationUser, $this->finalTarget);
			} catch (NotFoundException | NoUserException $e) {
				$output->writeln('<error>Share with id ' . $share->getId() . ' and type ' . $share->getShareType() . ' points at deleted file or share that is no longer accessible, skipping</error>');
			} catch (\Exception $e) {
				$output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>');
				$status = 1;
			}
			$progress->advance();
		}
		$progress->finish();
		$output->writeln('');
		return $status;
	}
}


text:
namespace base {
class FilePath;
}  // namespace base

namespace extensions {
class EventRouter;
}  // namespace extensions

namespace ash {
namespace file_system_provider {
namespace operations {

// Deletes an entry. If |recursive| is passed and the entry is a directory, then
// all contents of it (recursively) will be deleted too. Created per request.
class DeleteEntry : public Operation {
 public:
  DeleteEntry(extensions::EventRouter* event_router,
              const ProvidedFileSystemInfo& file_system_info,
              const base::FilePath& entry_path,
              bool recursive,
              storage::AsyncFileUtil::StatusCallback callback);

  DeleteEntry(const DeleteEntry&) = delete;
  DeleteEntry& operator=(const DeleteEntry&) = delete;

  ~DeleteEntry() override;

  // Operation overrides.
  bool Execute(int request_id) override;
  void OnSuccess(int request_id,
                 std::unique_ptr<RequestValue> result,
                 bool has_more) override;
  void OnError(int request_id,
               std::unique_ptr<RequestValue> result,
               base::File::Error error) override;

 private:
  base::FilePath entry_path_;
  bool recursive_;
  storage::AsyncFileUtil::StatusCallback callback_;
};

}  // namespace operations
}  // namespace file_system_provider
}  // namespace ash

#endif  // CHROME_BROWSER_ASH_FILE_SYSTEM_PROVIDER_OPERATIONS_DELETE_ENTRY_H_


text:
The installers and binary archives on this page include .NET Core 1.1 Preview 1 (runtime and shared framework) and the .NET Core 1.0 SDK Preview 2.1. If you only need the runtime and shared framework (no SDK), download links are available on the [Runtime Download](https://github.com/dotnet/core/blob/master/release-notes/preview-runtime-download.md) page. [Checksums](https://dotnetcli.blob.core.windows.net/dotnet/checksums/1.1-Preview-1-SDK-Preview-2.1-3155-SHA.txt) are available to verify downloads.

| .NET Core 1.1 Preview 1 | SDK Installer                                        | SDK Binaries                                        | Runtime Installer | Runtime Binaries |
| ----------------------- | :----------------------------------------------: | :----------------------------------------------:|:--|:--|
| Windows                 | [32-bit](https://go.microsoft.com/fwlink/?LinkID=831458) / [64-bit](https://go.microsoft.com/fwlink/?LinkID=831453)  | [32-bit](https://go.microsoft.com/fwlink/?LinkID=831474) / [64-bit](https://go.microsoft.com/fwlink/?LinkID=831469) | [32-bit](https://go.microsoft.com/fwlink/?LinkID=831452) / [64-bit](https://go.microsoft.com/fwlink/?LinkID=831444) | [32-bit](https://go.microsoft.com/fwlink/?LinkID=831483) / [64-bit](https://go.microsoft.com/fwlink/?LinkID=831476) |
| Windows Server Hosting  | [32-bit/64-bit](https://go.microsoft.com/fwlink/?linkid=832756) | - | - | - |
| macOS                   | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831445)  | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831486) | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831446) | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831486) |
| CentOS 7.1              | -                                                         | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831470) | - | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831487) |
| Debian 8                | -                                                         | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831481) | - | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831477) |
| Fedora 23               | -                                                         | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831489) | - | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831484) |
| openSUSE 13.2           | -                                                         | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831491) | - | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831491) |
| openSUSE 42.1           | -                                                         | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831478) | - | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831475) |
| Ubuntu 14.04            | See notes below for Ubuntu 14.04 and Mint 17 installers   | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831488) | - | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831468) |
| Ubuntu 16.04            | See notes below for Ubuntu 16.04 and Mint 18 installers   | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831471) | - | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831482) |
| Ubuntu 16.10            | See notes below for Ubuntu 16.10                          | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831479) | - | [64-bit](https://go.microsoft.com/fwlink/?LinkID=831490) |

## Installation from a binary archive

When using binary archives to install, we recommend the contents be extracted to /opt/dotnet and a symbolic link created for dotnet. If an earlier release of .NET Core is already installed, the directory and symbolic link may already exist.

```bash
sudo mkdir -p /opt/dotnet
sudo tar zxf [tar.gz filename] -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin
```

## Ubuntu installation

dotnet-host-ubuntu-x64.1.1.0-preview1-001100-00.deb
dotnet-hostfxr-ubuntu-x64.1.1.0-preview1-001100-00.deb
dotnet-sharedframework-ubuntu-x64.1.1.0-preview1-001100-00.deb
dotnet-sdk-ubuntu-x64.1.0.0-preview2.1-003155.deb

### Set up package source

The first step is to establish the source feed for the package manager. This is only needed if you have not previously set up the source or if you are installing on Ubuntu 16.10 for the first time.

#### Ubuntu 14.04 and Linux Mint 17

```bash
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
sudo apt-get update
sudo apt-get install dotnet-dev-1.0.0-preview2.1-003155
```

Installed packages

```
dotnet-host-ubuntu-x64.1.1.0-preview1-001100-00.deb
dotnet-hostfxr-ubuntu-x64.1.1.0-preview1-001100-00.deb
dotnet-sharedframework-ubuntu-x64.1.1.0-preview1-001100-00.deb
dotnet-sdk-ubuntu-x64.1.0.0-preview2.1-003155.deb
```

#### Ubuntu 16.04 and Linux Mint 18

```bash
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
sudo apt-get update
sudo apt-get install dotnet-dev-1.0.0-preview2.1-003155
```

Installed packages

```
dotnet-host-ubuntu.16.04-x64.1.1.0-preview1-001100-00.deb
dotnet-hostfxr-ubuntu.16.04-x64.1.1.0-preview1-001100-00.deb
dotnet-sharedframework-ubuntu.16.04-x64.1.1.0-preview1-001100-00.deb
dotnet-sdk-ubuntu.16.04-x64.1.0.0-preview2.1-003155.deb
```

#### Ubuntu 16.10

```bash
sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ yakkety main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
sudo apt-get update
sudo apt-get install dotnet-dev-1.0.0-preview2.1-003155
```

Installed packages

```
dotnet-hostfxr-ubuntu.16.10-x64.1.1.0-preview1-001100-00.deb
dotnet-host-ubuntu.16.10-x64.1.1.0-preview1-001100-00.deb
dotnet-sharedframework-ubuntu.16.10-x64.1.1.0-preview1-001100-00.deb
dotnet-sdk-ubuntu.16.10-x64.1.0.0-preview2.1-003155.deb
```

## Windows Server Hosting
If you are looking to host stand-alone apps on Windows Servers, the ASP.NET Core Module for IIS can be installed separately on servers without installing .NET Core runtime. You can download the Windows (Server Hosting) installer and run the following command from an Administrator command prompt:
``DotNetCore.1.1.0.Preview1-WindowsHosting.exe OPT_INSTALL_LTS_REDIST=0 OPT_INSTALL_FTS_REDIST=0``


text:
<!DOCTYPE html>

  <meta charset="UTF-8">
  <title>Code Coverage for /var/www/source/hca_draft/src/HealthCareAbroad/FrontendBundle/Controller</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="css/bootstrap.min.css" rel="stylesheet">
  <link href="css/bootstrap-responsive.min.css" rel="stylesheet">
  <link href="css/style.css" rel="stylesheet">

/var/www/source/hca_draft/src/HealthCareAbroad /

FrontendBundle /

Controller

(Dashboard)

Code Coverage

Lines

Functions and Methods

Classes and Traits

      Total

0.00%

0 / 195

0.00%

0 / 20

0.00%

0 / 5

       AdvertisementController.php

0.00%

0 / 35

0.00%

0 / 3

0.00%

0 / 1

       DefaultController.php

0.00%

0 / 75

0.00%

0 / 8

0.00%

0 / 1

       InquiryController.php

0.00%

0 / 28

0.00%

0 / 1

0.00%

0 / 1

       InstitutionController.php

0.00%

0 / 41

0.00%

0 / 4

0.00%

0 / 1

       SidebarController.php

0.00%

0 / 16

0.00%

0 / 4

0.00%

0 / 1

Legend

     Low: 0% to 35%
     Medium: 35% to 70%
     High: 70% to 100%

     Generated by PHP_CodeCoverage 1.2.2 using PHP 5.3.10-1ubuntu3.2 and PHPUnit 3.7.1 at Tue Oct 9 16:19:45 PHT 2012.


text:
using System.Reflection;
using System.Threading;
using DogAgilityCompetition.Circe.Protocol;
using DogAgilityCompetition.Circe.Protocol.Operations;
using DogAgilityCompetition.Circe.Session;

namespace DogAgilityCompetition.Circe.Controller;

/// <summary>
/// Provides a controller session by delegating access to a remotely connected CIRCE mediator.
/// </summary>
public sealed class CirceControllerSessionManager : IDisposable
{
    // When performance stagnates on high load, consider increasing Thread-pool size.
    // Defaults for .exe are: Min=8, Max=1000

    private static readonly ISystemLogger Log = new Log4NetSystemLogger(MethodBase.GetCurrentMethod()!.DeclaringType!);

    private readonly ActionQueue outgoingOperationsQueue;
    private readonly SessionGuard sessionGuard;
    private readonly ControllerIncomingOperationDispatcher operationDispatcher;

    public DeviceTracker DeviceTracker { get; }

    public event EventHandler? PacketSending;
    public event EventHandler? PacketReceived;
    public event EventHandler<ControllerConnectionStateEventArgs>? ConnectionStateChanged;
    public event EventHandler<EventArgs<DeviceAction>>? DeviceActionReceived;

    public CirceControllerSessionManager()
    {
        operationDispatcher = new ControllerIncomingOperationDispatcher(this);
        DeviceTracker = new DeviceTracker();
        outgoingOperationsQueue = new ActionQueue();

        sessionGuard = new SessionGuard(outgoingOperationsQueue);
        sessionGuard.StateChanged += SessionGuardOnStateChanged;
        sessionGuard.OperationReceived += OperationReceived;
    }

    public void Start()
    {
        sessionGuard.BeforePacketSent += PacketSending;
        sessionGuard.AfterPacketReceived += PacketReceived;

        sessionGuard.Start();
    }

    public void Dispose()
    {
        // Order is important here: the session guard will pause the queue before cleaning up the connection.
        sessionGuard.Dispose();
        outgoingOperationsQueue.Dispose();

        DeviceTracker.Dispose();
    }

    public Task AlertAsync(WirelessNetworkAddress destinationAddress, CancellationToken cancellationToken = default)
    {
        Guard.NotNull(destinationAddress, nameof(destinationAddress));

        var operation = new AlertOperation(destinationAddress);

        return sessionGuard.SendAsync(operation, cancellationToken);
    }

    public Task NetworkSetupAsync(WirelessNetworkAddress destinationAddress, bool joinNetwork, DeviceRoles roles, CancellationToken cancellationToken = default)
    {
        Guard.NotNull(destinationAddress, nameof(destinationAddress));

        var operation = new NetworkSetupOperation(destinationAddress, joinNetwork, roles);

        return sessionGuard.SendAsync(operation, cancellationToken);
    }

    public Task SynchronizeClocksAsync(CancellationToken cancellationToken = default)
    {
        var operation = new SynchronizeClocksOperation();
        return sessionGuard.SendAsync(operation, cancellationToken);
    }

    public Task VisualizeAsync(IEnumerable<WirelessNetworkAddress> destinationAddresses, VisualizeFieldSet fieldSet,
        CancellationToken cancellationToken = default)
    {
        var operation = new VisualizeOperation(destinationAddresses)
        {
            CurrentCompetitorNumber = fieldSet.CurrentCompetitorNumber,
            NextCompetitorNumber = fieldSet.NextCompetitorNumber,
            StartTimer = fieldSet.StartPrimaryTimer,
            PrimaryTimerValue = fieldSet.PrimaryTimerValue,
            SecondaryTimerValue = fieldSet.SecondaryTimerValue,
            FaultCount = fieldSet.CurrentFaultCount,
            RefusalCount = fieldSet.CurrentRefusalCount,
            Eliminated = fieldSet.CurrentIsEliminated,
            PreviousPlacement = fieldSet.PreviousPlacement
        };

        return sessionGuard.SendAsync(operation, cancellationToken);
    }

    private void SessionGuardOnStateChanged(object? sender, ControllerConnectionStateEventArgs e)
    {
        ConnectionStateChanged?.Invoke(this, e);
    }

    private void HandleIncomingKeepAliveOperation(KeepAliveOperation operation)
    {
        // Justification for nullable suppression: Operation has been validated for required parameters when this code is reached.
        DeviceTracker.UpdateMediatorStatus(operation.MediatorStatus!.Value);
    }

    private void HandleIncomingNotifyStatusOperation(NotifyStatusOperation operation)
    {
        if (IsDeviceCompliant(operation))
        {
            DeviceStatus deviceStatus = DeviceStatus.FromOperation(operation);
            DeviceTracker.SetDeviceStatus(deviceStatus);
        }
    }

    private void HandleIncomingNotifyActionOperation(NotifyActionOperation operation)
    {
        // Justification for nullable suppression: Operation has been validated for required parameters when this code is reached.
        DeviceTracker.NotifyDeviceIsAlive(operation.OriginatingAddress!);

        DeviceActionReceived?.Invoke(this, new EventArgs<DeviceAction>(DeviceAction.FromOperation(operation)));
    }

    private void OperationReceived(object? sender, IncomingOperationEventArgs e)
    {
        e.Operation.Visit(operationDispatcher);
    }

    private static bool IsDeviceCompliant(NotifyStatusOperation notifyStatusOperation)
    {
        // Justification for nullable suppression: Operation has been validated for required parameters when this code is reached.
        if (!AreCapabilitiesValid(notifyStatusOperation.Capabilities!.Value))
        {
            Log.Warn($"Discarding device {notifyStatusOperation.OriginatingAddress} " +
                $"because combination of capabilities is invalid ({notifyStatusOperation.Capabilities}).");

            return false;
        }

        if (notifyStatusOperation.OriginatingAddress == WirelessNetworkAddress.Default)
        {
            Log.Warn($"Discarding unconfigured device {notifyStatusOperation.OriginatingAddress}.");
            return false;
        }

        return true;
    }

    private static bool AreCapabilitiesValid(DeviceCapabilities capabilities)
    {
        if (capabilities == DeviceCapabilities.None)
        {
            return false;
        }

        if ((capabilities & DeviceCapabilities.TimeSensor) != 0 && capabilities != DeviceCapabilities.TimeSensor)
        {
            return false;
        }

        if ((capabilities & DeviceCapabilities.Display) != 0 && capabilities != DeviceCapabilities.Display)
        {
            return false;
        }

        return true;
    }

    private sealed class ControllerIncomingOperationDispatcher : IOperationAcceptor
    {
        private static readonly ISystemLogger InnerLog = new Log4NetSystemLogger(MethodBase.GetCurrentMethod()!.DeclaringType!);

        private readonly CirceControllerSessionManager owner;
        private readonly object nonReentrantProcessIncomingOperationLock = new();

        public ControllerIncomingOperationDispatcher(CirceControllerSessionManager owner)
        {
            Guard.NotNull(owner, nameof(owner));
            this.owner = owner;
        }

        public void Accept(LoginOperation operation)
        {
            WarnForUnexpectedOperation(operation);
        }

        public void Accept(LogoutOperation operation)
        {
            WarnForUnexpectedOperation(operation);
        }

        public void Accept(AlertOperation operation)
        {
            WarnForUnexpectedOperation(operation);
        }

        public void Accept(NetworkSetupOperation operation)
        {
            WarnForUnexpectedOperation(operation);
        }

        public void Accept(DeviceSetupOperation operation)
        {
            WarnForUnexpectedOperation(operation);
        }

        public void Accept(SynchronizeClocksOperation operation)
        {
            WarnForUnexpectedOperation(operation);
        }

        public void Accept(VisualizeOperation operation)
        {
            WarnForUnexpectedOperation(operation);
        }

        public void Accept(KeepAliveOperation operation)
        {
            using var lockTracker = new LockTracker(InnerLog, MethodBase.GetCurrentMethod()!);

            lock (nonReentrantProcessIncomingOperationLock)
            {
                lockTracker.Acquired();

                owner.HandleIncomingKeepAliveOperation(operation);
            }
        }

        public void Accept(NotifyStatusOperation operation)
        {
            using var lockTracker = new LockTracker(InnerLog, MethodBase.GetCurrentMethod()!);

            lock (nonReentrantProcessIncomingOperationLock)
            {
                lockTracker.Acquired();

                owner.HandleIncomingNotifyStatusOperation(operation);
            }
        }

        public void Accept(NotifyActionOperation operation)
        {
            using var lockTracker = new LockTracker(InnerLog, MethodBase.GetCurrentMethod()!);

            lock (nonReentrantProcessIncomingOperationLock)
            {
                lockTracker.Acquired();

                owner.HandleIncomingNotifyActionOperation(operation);
            }
        }

        private static void WarnForUnexpectedOperation(Operation operation)
        {
            InnerLog.Warn($"Discarding unexpected incoming operation: {operation}");
        }
    }
}


text:
from app import db
import simplejson

ROLE_USER = 0
ROLE_ADMIN = 1

class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(64), index=True, unique=True)
    email = db.Column(db.String(120), index=True, unique=True)
    role = db.Column(db.SmallInteger, default=ROLE_USER)
    name = db.Column(db.String(120), index=True, unique=True)
    brews = db.relationship(
        'Brew',
        backref=db.backref('user', lazy='select')
    )

    def is_authenticated(self):
        return True

    def is_active(self):
        return True

    def is_anonymous(self):
        return False

    def get_id(self):
        return unicode(self.id)

    def __repr__(self):
        return '<User %r>' % (self.username)

class Style(db.Model):
    id = db.Column(db.String(10), primary_key=True)
    name = db.Column(db.Text)
    og_high = db.Column(db.Float)
    og_low = db.Column(db.Float)
    fg_low = db.Column(db.Float)
    fg_high = db.Column(db.Float)
    abv_low = db.Column(db.Float)
    abv_high = db.Column(db.Float)
    ibu_low = db.Column(db.Float)
    ibu_high = db.Column(db.Float)
    srm_low = db.Column(db.Float)
    srm_high = db.Column(db.Float)

    def __repr__(self):
        return '<Style %r>' % (self.name)

    @property
    def serialize(self):
        return {
            'id': self.id,
            'name': self.name,
            'stats': [
                {'name': 'og', 'low': self.og_low, 'high': self.og_high},
                {'name': 'fg', 'low': self.fg_low, 'high': self.fg_high},
                {'name': 'abv', 'low': self.abv_low, 'high': self.abv_high},
                {'name': 'ibu', 'low': self.ibu_low, 'high': self.ibu_high},
                {'name': 'srm', 'low': self.srm_low, 'high': self.srm_high},
            ]
        }

class Brew(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(140))
    data = db.Column(db.Text)
    public = db.Column(db.Boolean)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))

    def __repr__(self):
        return '<Brew %r>' % (self.name)

    @property
    def serialize(self):
        """Return object data in easily serializeable format"""
        data = simplejson.loads(self.data)
        data["id"] = self.id
        return data

class Malt(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(140))
    color = db.Column(db.Float)
    ppg = db.Column(db.Float)
    description = db.Column(db.Text)

    def __repr__(self):
        return '<Malt %r>' % (self.name)

    @property
    def serialize(self):
        """Return object data in easily serializeable format"""
        return {
            'id': self.id,
            'name': self.name,
            'color': self.color,
            'ppg': self.ppg,
            'description': self.description
        }

class Hop(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(140))
    alpha_acid = db.Column(db.Float)
    profile = db.Column(db.Text)

    def __repr__(self):
        return '<Hop %r>' % (self.name)

    @property
    def serialize(self):
        """Return object data in easily serializeable format"""
        return {
            'id': self.id,
            'name': self.name,
            'alpha_acid': self.alpha_acid,
            'profile': self.profile
        }

class Yeast(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(140))
    attenuation = db.Column(db.Integer)
    type = db.Column(db.String(20))
    flavor = db.Column(db.Text)

    def __repr__(self):
        return '<Yeast %r>' % (self.name)

    @property
    def serialize(self):
        """Return object data in easily serializeable format"""
        return {
            'id': self.id,
            'name': self.name,
            'attenuation': self.attenuation,
            'type': self.type,
            'flavor': self.flavor
        }


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kooboo.CMS.Sites.Models;
using Ionic.Zip;
using System.IO;
using Kooboo;
namespace Kooboo.CMS.Sites.Services
{
    public class LayoutItemTemplateManager : ItemTemplateManager
    {
        protected override string BasePath
        {
            get { return Kooboo.Web.Mvc.AreaHelpers.CombineAreaFilePhysicalPath("Sites", "Templates", "Layout"); }
        }

        public virtual IEnumerable<LayoutSample> GetLayoutSamples(string engineName)
        {
            var itemTemplates = this.All(engineName);

            foreach (var item in itemTemplates)
            {
                using (ZipFile zipFile = new ZipFile(item.TemplateFile))
                {
                    var settingEntryName = PathResource.SettingFileName;
                    if (!zipFile.ContainsEntry(settingEntryName))
                    {
                        throw new KoobooException("The layout item template is invalid, setting.config is required.");
                    }
                    Layout layout = null;
                    using (MemoryStream ms = new MemoryStream())
                    {
                        zipFile[settingEntryName].Extract(ms);
                        ms.Position = 0;
                        layout = (Layout)Kooboo.Runtime.Serialization.DataContractSerializationHelper.Deserialize(typeof(Layout), null, ms);
                    }
                    var templateEntryName = layout.TemplateFileName;
                    if (!zipFile.ContainsEntry(templateEntryName))
                    {
                        throw new KoobooException(string.Format("The layout item template is invalid.{0} is requried.", templateEntryName));
                    }
                    LayoutSample sample = new LayoutSample() { Name = item.TemplateName, ThumbnailVirtualPath = item.Thumbnail };
                    using (MemoryStream ms = new MemoryStream())
                    {
                        zipFile[templateEntryName].Extract(ms);
                        ms.Position = 0;
                        using (StreamReader sr = new StreamReader(ms))
                        {
                            sample.Template = sr.ReadToEnd();
                        }
                    }
                    yield return sample;
                }
            }
        }

        public virtual LayoutSample GetDefaultLayoutSample(string engineName)
        {
            var defaultLayout = GetLayoutSample(engineName, "default");
            if (defaultLayout == null)
            {
                defaultLayout = GetLayoutSamples(engineName).FirstOrDefault();
            }
            return defaultLayout;
        }

        public virtual LayoutSample GetLayoutSample(string engineName, string templateName)
        {
            return GetLayoutSamples(engineName).Where(it => it.Name.EqualsOrNullEmpty(templateName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
        }
    }
}


text:
package org.spdx.rdfparser.license;

import org.spdx.rdfparser.InvalidSPDXAnalysisException;

/**
 * Exception caused by an invalid license expression
 * @author Gary O'Neall
 *
 */
public class LicenseParserException extends InvalidSPDXAnalysisException {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * @param msg
	 */
	public LicenseParserException(String msg) {
		super(msg);
	}

	public LicenseParserException(String msg, Throwable inner) {
		super(msg, inner);
	}
}


text:
<?php
namespace AliyunMNS\Responses;

use AliyunMNS\Constants;
use AliyunMNS\Model\QueueAttributes;
use AliyunMNS\Exception\MnsException;
use AliyunMNS\Exception\QueueNotExistException;
use AliyunMNS\Exception\InvalidArgumentException;
use AliyunMNS\Responses\BaseResponse;
use AliyunMNS\Common\XMLParser;

class GetQueueAttributeResponse extends BaseResponse
{
    private $attributes;

    public function __construct()
    {
        $this->attributes = NULL;
    }

    public function getQueueAttributes()
    {
        return $this->attributes;
    }

    public function parseResponse($statusCode, $content)
    {
        $this->statusCode = $statusCode;
        if ($statusCode == 200) {
            $this->succeed = TRUE;
        } else {
            $this->parseErrorResponse($statusCode, $content);
        }

        $xmlReader = new \XMLReader();
        try {
            $xmlReader->XML($content);
            $this->attributes = QueueAttributes::fromXML($xmlReader);
        } catch (\Exception $e) {
            throw new MnsException($statusCode, $e->getMessage(), $e);
        } catch (\Throwable $t) {
            throw new MnsException($statusCode, $t->getMessage());
        }

    }

    public function parseErrorResponse($statusCode, $content, MnsException $exception = NULL)
    {
        $this->succeed = FALSE;
        $xmlReader = new \XMLReader();
        try {
            $xmlReader->XML($content);
            $result = XMLParser::parseNormalError($xmlReader);
            if ($result['Code'] == Constants::QUEUE_NOT_EXIST)
            {
                throw new QueueNotExistException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
            }
            throw new MnsException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
        } catch (\Exception $e) {
            if ($exception != NULL) {
                throw $exception;
            } elseif($e instanceof MnsException) {
                throw $e;
            } else {
                throw new MnsException($statusCode, $e->getMessage());
            }
        } catch (\Throwable $t) {
            throw new MnsException($statusCode, $t->getMessage());
        }
    }
}

?>


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.network.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.SubResource;
import com.azure.resourcemanager.network.models.IpsecPolicy;
import com.azure.resourcemanager.network.models.ProvisioningState;
import com.azure.resourcemanager.network.models.RoutingConfiguration;
import com.azure.resourcemanager.network.models.TrafficSelectorPolicy;
import com.azure.resourcemanager.network.models.VirtualNetworkGatewayConnectionProtocol;
import com.azure.resourcemanager.network.models.VpnConnectionStatus;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Parameters for VpnConnection. */
@Fluent
public final class VpnConnectionProperties {
    /*
     * Id of the connected vpn site.
     */
    @JsonProperty(value = "remoteVpnSite")
    private SubResource remoteVpnSite;

    /*
     * Routing weight for vpn connection.
     */
    @JsonProperty(value = "routingWeight")
    private Integer routingWeight;

    /*
     * DPD timeout in seconds for vpn connection.
     */
    @JsonProperty(value = "dpdTimeoutSeconds")
    private Integer dpdTimeoutSeconds;

    /*
     * The connection status.
     */
    @JsonProperty(value = "connectionStatus", access = JsonProperty.Access.WRITE_ONLY)
    private VpnConnectionStatus connectionStatus;

    /*
     * Connection protocol used for this connection.
     */
    @JsonProperty(value = "vpnConnectionProtocolType")
    private VirtualNetworkGatewayConnectionProtocol vpnConnectionProtocolType;

    /*
     * Ingress bytes transferred.
     */
    @JsonProperty(value = "ingressBytesTransferred", access = JsonProperty.Access.WRITE_ONLY)
    private Long ingressBytesTransferred;

    /*
     * Egress bytes transferred.
     */
    @JsonProperty(value = "egressBytesTransferred", access = JsonProperty.Access.WRITE_ONLY)
    private Long egressBytesTransferred;

    /*
     * Expected bandwidth in MBPS.
     */
    @JsonProperty(value = "connectionBandwidth")
    private Integer connectionBandwidth;

    /*
     * SharedKey for the vpn connection.
     */
    @JsonProperty(value = "sharedKey")
    private String sharedKey;

    /*
     * EnableBgp flag.
     */
    @JsonProperty(value = "enableBgp")
    private Boolean enableBgp;

    /*
     * Enable policy-based traffic selectors.
     */
    @JsonProperty(value = "usePolicyBasedTrafficSelectors")
    private Boolean usePolicyBasedTrafficSelectors;

    /*
     * The IPSec Policies to be considered by this connection.
     */
    @JsonProperty(value = "ipsecPolicies")
    private List<IpsecPolicy> ipsecPolicies;

    /*
     * The Traffic Selector Policies to be considered by this connection.
     */
    @JsonProperty(value = "trafficSelectorPolicies")
    private List<TrafficSelectorPolicy> trafficSelectorPolicies;

    /*
     * EnableBgp flag.
     */
    @JsonProperty(value = "enableRateLimiting")
    private Boolean enableRateLimiting;

    /*
     * Enable internet security.
     */
    @JsonProperty(value = "enableInternetSecurity")
    private Boolean enableInternetSecurity;

    /*
     * Use local azure ip to initiate connection.
     */
    @JsonProperty(value = "useLocalAzureIpAddress")
    private Boolean useLocalAzureIpAddress;

    /*
     * The provisioning state of the VPN connection resource.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

    /*
     * List of all vpn site link connections to the gateway.
     */
    @JsonProperty(value = "vpnLinkConnections")
    private List<VpnSiteLinkConnectionInner> vpnLinkConnections;

    /*
     * The Routing Configuration indicating the associated and propagated route tables on this connection.
     */
    @JsonProperty(value = "routingConfiguration")
    private RoutingConfiguration routingConfiguration;

    /** Creates an instance of VpnConnectionProperties class. */
    public VpnConnectionProperties() {
    }

    /**
     * Get the remoteVpnSite property: Id of the connected vpn site.
     *
     * @return the remoteVpnSite value.
     */
    public SubResource remoteVpnSite() {
        return this.remoteVpnSite;
    }

    /**
     * Set the remoteVpnSite property: Id of the connected vpn site.
     *
     * @param remoteVpnSite the remoteVpnSite value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withRemoteVpnSite(SubResource remoteVpnSite) {
        this.remoteVpnSite = remoteVpnSite;
        return this;
    }

    /**
     * Get the routingWeight property: Routing weight for vpn connection.
     *
     * @return the routingWeight value.
     */
    public Integer routingWeight() {
        return this.routingWeight;
    }

    /**
     * Set the routingWeight property: Routing weight for vpn connection.
     *
     * @param routingWeight the routingWeight value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withRoutingWeight(Integer routingWeight) {
        this.routingWeight = routingWeight;
        return this;
    }

    /**
     * Get the dpdTimeoutSeconds property: DPD timeout in seconds for vpn connection.
     *
     * @return the dpdTimeoutSeconds value.
     */
    public Integer dpdTimeoutSeconds() {
        return this.dpdTimeoutSeconds;
    }

    /**
     * Set the dpdTimeoutSeconds property: DPD timeout in seconds for vpn connection.
     *
     * @param dpdTimeoutSeconds the dpdTimeoutSeconds value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withDpdTimeoutSeconds(Integer dpdTimeoutSeconds) {
        this.dpdTimeoutSeconds = dpdTimeoutSeconds;
        return this;
    }

    /**
     * Get the connectionStatus property: The connection status.
     *
     * @return the connectionStatus value.
     */
    public VpnConnectionStatus connectionStatus() {
        return this.connectionStatus;
    }

    /**
     * Get the vpnConnectionProtocolType property: Connection protocol used for this connection.
     *
     * @return the vpnConnectionProtocolType value.
     */
    public VirtualNetworkGatewayConnectionProtocol vpnConnectionProtocolType() {
        return this.vpnConnectionProtocolType;
    }

    /**
     * Set the vpnConnectionProtocolType property: Connection protocol used for this connection.
     *
     * @param vpnConnectionProtocolType the vpnConnectionProtocolType value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withVpnConnectionProtocolType(
        VirtualNetworkGatewayConnectionProtocol vpnConnectionProtocolType) {
        this.vpnConnectionProtocolType = vpnConnectionProtocolType;
        return this;
    }

    /**
     * Get the ingressBytesTransferred property: Ingress bytes transferred.
     *
     * @return the ingressBytesTransferred value.
     */
    public Long ingressBytesTransferred() {
        return this.ingressBytesTransferred;
    }

    /**
     * Get the egressBytesTransferred property: Egress bytes transferred.
     *
     * @return the egressBytesTransferred value.
     */
    public Long egressBytesTransferred() {
        return this.egressBytesTransferred;
    }

    /**
     * Get the connectionBandwidth property: Expected bandwidth in MBPS.
     *
     * @return the connectionBandwidth value.
     */
    public Integer connectionBandwidth() {
        return this.connectionBandwidth;
    }

    /**
     * Set the connectionBandwidth property: Expected bandwidth in MBPS.
     *
     * @param connectionBandwidth the connectionBandwidth value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withConnectionBandwidth(Integer connectionBandwidth) {
        this.connectionBandwidth = connectionBandwidth;
        return this;
    }

    /**
     * Get the sharedKey property: SharedKey for the vpn connection.
     *
     * @return the sharedKey value.
     */
    public String sharedKey() {
        return this.sharedKey;
    }

    /**
     * Set the sharedKey property: SharedKey for the vpn connection.
     *
     * @param sharedKey the sharedKey value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withSharedKey(String sharedKey) {
        this.sharedKey = sharedKey;
        return this;
    }

    /**
     * Get the enableBgp property: EnableBgp flag.
     *
     * @return the enableBgp value.
     */
    public Boolean enableBgp() {
        return this.enableBgp;
    }

    /**
     * Set the enableBgp property: EnableBgp flag.
     *
     * @param enableBgp the enableBgp value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withEnableBgp(Boolean enableBgp) {
        this.enableBgp = enableBgp;
        return this;
    }

    /**
     * Get the usePolicyBasedTrafficSelectors property: Enable policy-based traffic selectors.
     *
     * @return the usePolicyBasedTrafficSelectors value.
     */
    public Boolean usePolicyBasedTrafficSelectors() {
        return this.usePolicyBasedTrafficSelectors;
    }

    /**
     * Set the usePolicyBasedTrafficSelectors property: Enable policy-based traffic selectors.
     *
     * @param usePolicyBasedTrafficSelectors the usePolicyBasedTrafficSelectors value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withUsePolicyBasedTrafficSelectors(Boolean usePolicyBasedTrafficSelectors) {
        this.usePolicyBasedTrafficSelectors = usePolicyBasedTrafficSelectors;
        return this;
    }

    /**
     * Get the ipsecPolicies property: The IPSec Policies to be considered by this connection.
     *
     * @return the ipsecPolicies value.
     */
    public List<IpsecPolicy> ipsecPolicies() {
        return this.ipsecPolicies;
    }

    /**
     * Set the ipsecPolicies property: The IPSec Policies to be considered by this connection.
     *
     * @param ipsecPolicies the ipsecPolicies value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withIpsecPolicies(List<IpsecPolicy> ipsecPolicies) {
        this.ipsecPolicies = ipsecPolicies;
        return this;
    }

    /**
     * Get the trafficSelectorPolicies property: The Traffic Selector Policies to be considered by this connection.
     *
     * @return the trafficSelectorPolicies value.
     */
    public List<TrafficSelectorPolicy> trafficSelectorPolicies() {
        return this.trafficSelectorPolicies;
    }

    /**
     * Set the trafficSelectorPolicies property: The Traffic Selector Policies to be considered by this connection.
     *
     * @param trafficSelectorPolicies the trafficSelectorPolicies value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withTrafficSelectorPolicies(List<TrafficSelectorPolicy> trafficSelectorPolicies) {
        this.trafficSelectorPolicies = trafficSelectorPolicies;
        return this;
    }

    /**
     * Get the enableRateLimiting property: EnableBgp flag.
     *
     * @return the enableRateLimiting value.
     */
    public Boolean enableRateLimiting() {
        return this.enableRateLimiting;
    }

    /**
     * Set the enableRateLimiting property: EnableBgp flag.
     *
     * @param enableRateLimiting the enableRateLimiting value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withEnableRateLimiting(Boolean enableRateLimiting) {
        this.enableRateLimiting = enableRateLimiting;
        return this;
    }

    /**
     * Get the enableInternetSecurity property: Enable internet security.
     *
     * @return the enableInternetSecurity value.
     */
    public Boolean enableInternetSecurity() {
        return this.enableInternetSecurity;
    }

    /**
     * Set the enableInternetSecurity property: Enable internet security.
     *
     * @param enableInternetSecurity the enableInternetSecurity value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withEnableInternetSecurity(Boolean enableInternetSecurity) {
        this.enableInternetSecurity = enableInternetSecurity;
        return this;
    }

    /**
     * Get the useLocalAzureIpAddress property: Use local azure ip to initiate connection.
     *
     * @return the useLocalAzureIpAddress value.
     */
    public Boolean useLocalAzureIpAddress() {
        return this.useLocalAzureIpAddress;
    }

    /**
     * Set the useLocalAzureIpAddress property: Use local azure ip to initiate connection.
     *
     * @param useLocalAzureIpAddress the useLocalAzureIpAddress value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withUseLocalAzureIpAddress(Boolean useLocalAzureIpAddress) {
        this.useLocalAzureIpAddress = useLocalAzureIpAddress;
        return this;
    }

    /**
     * Get the provisioningState property: The provisioning state of the VPN connection resource.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the vpnLinkConnections property: List of all vpn site link connections to the gateway.
     *
     * @return the vpnLinkConnections value.
     */
    public List<VpnSiteLinkConnectionInner> vpnLinkConnections() {
        return this.vpnLinkConnections;
    }

    /**
     * Set the vpnLinkConnections property: List of all vpn site link connections to the gateway.
     *
     * @param vpnLinkConnections the vpnLinkConnections value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withVpnLinkConnections(List<VpnSiteLinkConnectionInner> vpnLinkConnections) {
        this.vpnLinkConnections = vpnLinkConnections;
        return this;
    }

    /**
     * Get the routingConfiguration property: The Routing Configuration indicating the associated and propagated route
     * tables on this connection.
     *
     * @return the routingConfiguration value.
     */
    public RoutingConfiguration routingConfiguration() {
        return this.routingConfiguration;
    }

    /**
     * Set the routingConfiguration property: The Routing Configuration indicating the associated and propagated route
     * tables on this connection.
     *
     * @param routingConfiguration the routingConfiguration value to set.
     * @return the VpnConnectionProperties object itself.
     */
    public VpnConnectionProperties withRoutingConfiguration(RoutingConfiguration routingConfiguration) {
        this.routingConfiguration = routingConfiguration;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (ipsecPolicies() != null) {
            ipsecPolicies().forEach(e -> e.validate());
        }
        if (trafficSelectorPolicies() != null) {
            trafficSelectorPolicies().forEach(e -> e.validate());
        }
        if (vpnLinkConnections() != null) {
            vpnLinkConnections().forEach(e -> e.validate());
        }
        if (routingConfiguration() != null) {
            routingConfiguration().validate();
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _04.Hornet_Armada
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var data = new Dictionary<string, Dictionary<string, long>>();
            var activity = new SortedDictionary<string, int>();
            for (int i = 0; i < n; i++)
            {
                string[] inputToken = Console.ReadLine().Split(new char[] { '=', '-', '>', ':', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                int lastActivity = int.Parse(inputToken[0]);
                string legionName = inputToken[1];
                string soldierType = inputToken[2];
                long soldierCount = long.Parse(inputToken[3]);
                if (!data.ContainsKey(legionName))
                {
                    data.Add(legionName, new Dictionary<string, long>());
                }
                if (!data[legionName].ContainsKey(soldierType))
                {
                    data[legionName].Add(soldierType, soldierCount);
                }
                else
                {
                    data[legionName][soldierType] += soldierCount;
                }
                if (!activity.ContainsKey(legionName))
                {
                    activity.Add(legionName, lastActivity);
                }
                else
                {
                    if (activity[legionName] < lastActivity)
                    {
                        activity[legionName] = lastActivity;
                    }
                }
            }
            string[] filter = Console.ReadLine().Split('\\');
            if (filter.Length == 1)
            {
                string soldType = filter[0];
                foreach (KeyValuePair<string, int> act in activity.OrderByDescending(a => a.Value))
                {
                    if (data[act.Key].ContainsKey(soldType))
                    {
                        Console.WriteLine($"{act.Value} : {act.Key}");
                    }
                }
            }
            else
            {
                int maxActivity = int.Parse(filter[0]);
                string soldType = filter[1];
                foreach (var legion in data.Where(l => l.Value.ContainsKey(soldType)).OrderByDescending(s => s.Value[soldType]))
                {
                    if (activity[legion.Key] < maxActivity)
                    {
                        Console.WriteLine($"{legion.Key} -> {legion.Value[soldType]}");
                    }
                }
            }
        }
    }
}