text:
#pragma once

#ifndef GEODE_TESTOBJECT_PDXTYPE_H_
#define GEODE_TESTOBJECT_PDXTYPE_H_

/*
 * PdxObject.hpp
 *
 *  Created on: Sep 29, 2011
 *      Author: npatel
 */

#include <geode/PdxSerializable.hpp>
#include <geode/CacheableEnum.hpp>
#include <geode/PdxWriter.hpp>
#include <geode/PdxReader.hpp>
#include <geode/CacheableObjectArray.hpp>
#include <util/Log.hpp>

#include "testobject_export.h"

using namespace apache::geode::client;

namespace PdxTests {

class TESTOBJECT_EXPORT GrandParent {
 public:
  int32_t m_a;
  int32_t m_b;

  inline void init() {
    this->m_a = 1;
    this->m_b = 2;
  }

  GrandParent() { init(); }

  int32_t getMember_a() { return m_a; }

  int32_t getMember_b() { return m_b; }
};

class TESTOBJECT_EXPORT Parent : public GrandParent {
 public:
  int32_t m_c;
  int32_t m_d;

  inline void init() {
    this->m_c = 3;
    this->m_d = 4;
  }

  int32_t getMember_c() { return m_c; }

  int32_t getMember_d() { return m_d; }

  Parent() { init(); }
};

class Child;

class TESTOBJECT_EXPORT Child : public Parent, public PdxSerializable {
 private:
  int32_t m_e;
  int32_t m_f;

 public:
  inline void init() {
    this->m_e = 5;
    this->m_f = 6;
  }

  Child() { init(); }

  int32_t getMember_e() { return m_e; }

  int32_t getMember_f() { return m_f; }

  std::string toString() const override {
    char idbuf[512];
    sprintf(idbuf, " Child:: %d %d %d %d %d %d ", m_a, m_b, m_c, m_d, m_e, m_f);
    return idbuf;
  }

  const std::string& getClassName() const override {
    static std::string className = "PdxTests.Child";
    return className;
  }

  using PdxSerializable::fromData;
  using PdxSerializable::toData;

  void toData(PdxWriter& pw) const override {
    pw.writeInt("m_a", m_a);
    pw.writeInt("m_b", m_b);
    pw.writeInt("m_c", m_c);
    pw.writeInt("m_d", m_d);
    pw.writeInt("m_e", m_e);
    pw.writeInt("m_f", m_f);
  }

  void fromData(PdxReader& pr) override {
    m_a = pr.readInt("m_a");
    m_b = pr.readInt("m_b");
    m_c = pr.readInt("m_c");
    m_d = pr.readInt("m_d");
    m_e = pr.readInt("m_e");
    m_f = pr.readInt("m_f");
  }

  static std::shared_ptr<PdxSerializable> createDeserializable() {
    return std::make_shared<Child>();
  }

  bool equals(std::shared_ptr<PdxSerializable> obj) {
    if (obj == nullptr) return false;

    auto pap = std::dynamic_pointer_cast<Child>(obj);
    if (pap == nullptr) return false;

    if (pap.get() == this) return true;

    if (m_a == pap->m_a && m_b == pap->m_b && m_c == pap->m_c &&
        m_d == pap->m_d && m_e == pap->m_e && m_f == pap->m_f) {
      return true;
    }

    return false;
  }
};

class TESTOBJECT_EXPORT CharTypes : public PdxSerializable {
 private:
  char16_t m_ch;
  std::vector<char16_t> m_chArray;

  int32_t m_charArrayLen;

 public:
  inline void init() {
    m_ch = 'C';

    m_chArray = std::vector<char16_t>(2);
    m_chArray[0] = 'X';
    m_chArray[1] = 'Y';

    m_charArrayLen = 0;
  }

  CharTypes() { init(); }

  std::string toString() const override {
    char idbuf[1024];
    sprintf(idbuf, "%c %c %c", m_ch, m_chArray[0], m_chArray[1]);
    return idbuf;
  }

  bool equals(CharTypes& other) const {
    LOGDEBUG("Inside CharTypes equals");
    CharTypes* ot = dynamic_cast<CharTypes*>(&other);
    if (ot == NULL) {
      return false;
    }
    if (ot == this) {
      return true;
    }
    LOGINFO("CharTypes::equals ot->m_ch = %c m_ch = %c", ot->m_ch, m_ch);
    if (ot->m_ch != m_ch) {
      return false;
    }

    int i = 0;
    while (i < 2) {
      LOGINFO(
          "CharTypes::equals Normal char array values ot->m_chArray[%d] = %c "
          "m_chArray[%d] = %c",
          i, ot->m_chArray[i], i, m_chArray[i]);
      if (ot->m_chArray[i] != m_chArray[i]) {
        return false;
      } else {
        i++;
      }
    }

    return true;
  }

  const std::string& getClassName() const override {
    static std::string className = "PdxTests.CharTypes";
    return className;
  }

  using PdxSerializable::fromData;
  using PdxSerializable::toData;

  void toData(PdxWriter& pw) const override {
    pw.writeChar("m_ch", m_ch);
    pw.writeCharArray("m_chArray", m_chArray);
  }

  void fromData(PdxReader& pr) override {
    m_ch = pr.readChar("m_ch");
    m_chArray = pr.readCharArray("m_chArray");
  }

  static std::shared_ptr<PdxSerializable> createDeserializable() {
    return std::make_shared<CharTypes>();
  }
};

/**********/
class TESTOBJECT_EXPORT Address : public PdxSerializable {
 private:
  int32_t _aptNumber;
  std::string _street;
  std::string _city;

 public:
  Address() {}

  std::string toString() const override {
    return std::to_string(_aptNumber) + " " + _street + " " + _city;
  }

  Address(int32_t aptN, const char* street, const char* city) {
    _aptNumber = aptN;
    _street = street;
    _city = city;
  }

  bool equals(Address& other) const {
    LOGDEBUG("Inside Address equals");
    Address* ot = dynamic_cast<Address*>(&other);
    if (ot == NULL) {
      return false;
    }
    if (ot == this) {
      return true;
    }
    if (ot->_aptNumber != _aptNumber) {
      return false;
    }
    if (ot->_street != _street) {
      return false;
    }
    if (ot->_city != _city) {
      return false;
    }

    return true;
  }

  const std::string& getClassName() const override {
    static std::string className = "PdxTests.Address";
    return className;
  }

  using PdxSerializable::fromData;
  using PdxSerializable::toData;

  void toData(PdxWriter& pw) const override {
    pw.writeInt("_aptNumber", _aptNumber);  // 4
    pw.writeString("_street", _street);
    pw.writeString("_city", _city);
  }

  void fromData(PdxReader& pr) override {
    _aptNumber = pr.readInt("_aptNumber");
    _street = pr.readString("_street");
    _city = pr.readString("_city");
  }

  static std::shared_ptr<PdxSerializable> createDeserializable() {
    return std::make_shared<Address>();
  }

  int32_t getAptNum() { return _aptNumber; }

  const std::string& getStreet() { return _street; }

  const std::string& getCity() { return _city; }

  /*static std::shared_ptr<Address> create(int32_t aptN, char* street, char*
  city)
  {
        std::shared_ptr<Address> str = nullptr;
    if (value != NULL) {
      str = new Address();
    }
    return str;
  }*/
};
enum pdxEnumTest { pdx1, pdx2, pdx3 };
class TESTOBJECT_EXPORT PdxType : public PdxSerializable {
 private:
  char16_t m_char;
  bool m_bool;
  int8_t m_byte;
  int8_t m_sbyte;  //
  int16_t m_int16;
  int16_t m_uint16;  ///
  int32_t m_int32;
  int32_t m_uint32;  ///
  int64_t m_long;
  int64_t m_ulong;  ///
  float m_float;
  double m_double;

  std::string m_string;

  std::vector<bool> m_boolArray;
  std::vector<int8_t> m_byteArray;
  std::vector<int8_t> m_sbyteArray;  ///

  std::vector<char16_t> m_charArray;

  std::shared_ptr<CacheableDate> m_date;

  std::vector<int16_t> m_int16Array;
  std::vector<int16_t> m_uint16Array;

  std::vector<int32_t> m_int32Array;
  std::vector<int32_t> m_uint32Array;

  std::vector<int64_t> m_longArray;
  std::vector<int64_t> m_ulongArray;

  std::vector<float> m_floatArray;
  std::vector<double> m_doubleArray;

  int8_t** m_byteByteArray;

  std::vector<std::string> m_stringArray;
  std::shared_ptr<Serializable> m_address;
  Address* m_add[10];

  std::shared_ptr<CacheableArrayList> m_arraylist;
  std::shared_ptr<CacheableLinkedList> m_linkedlist;
  std::shared_ptr<CacheableHashMap> m_map;
  std::shared_ptr<CacheableHashTable> m_hashtable;
  std::shared_ptr<CacheableVector> m_vector;

  std::shared_ptr<CacheableHashSet> m_chs;
  std::shared_ptr<CacheableLinkedHashSet> m_clhs;

  std::vector<int8_t> m_byte252;
  std::vector<int8_t> m_byte253;
  std::vector<int8_t> m_byte65535;
  std::vector<int8_t> m_byte65536;
  std::shared_ptr<Cacheable> m_pdxEnum;
  std::shared_ptr<CacheableObjectArray> m_objectArray;
  std::shared_ptr<CacheableObjectArray> m_objectArrayEmptyPdxFieldName;

  int32_t boolArrayLen;
  int32_t charArrayLen;
  int32_t byteArrayLen;
  int32_t shortArrayLen;
  int32_t intArrayLen;
  int32_t longArrayLen;
  int32_t doubleArrayLen;
  int32_t floatArrayLen;
  int32_t strLenArray;
  int32_t byteByteArrayLen;

  int* lengthArr;

 public:
  inline void init() {
    m_char = 'C';
    m_bool = true;
    m_byte = 0x74;
    m_sbyte = 0x67;
    m_int16 = 0xab;
    m_uint16 = 0x2dd5;
    m_int32 = 0x2345abdc;
    m_uint32 = 0x2a65c434;
    m_long = 324897980;
    m_ulong = 238749898;
    m_float = 23324.324f;
    m_double = 3243298498.00;

    m_string = "gfestring";

    m_boolArray = std::vector<bool>(3);
    m_boolArray[0] = true;
    m_boolArray[1] = false;
    m_boolArray[2] = true;
    /*for(int i=0; i<3; i++){
      m_boolArray[i] = true;
    };*/

    m_byteArray = std::vector<int8_t>(2);
    m_byteArray[0] = 0x34;
    m_byteArray[1] = 0x64;

    m_sbyteArray = std::vector<int8_t>(2);
    m_sbyteArray[0] = 0x34;
    m_sbyteArray[1] = 0x64;

    m_charArray = std::vector<char16_t>(2);
    m_charArray[0] = L'c';
    m_charArray[1] = L'v';

    int64_t d = 1310447869154L;
    m_date = CacheableDate::create(CacheableDate::duration(d));

    m_int16Array = std::vector<int16_t>(2);
    m_int16Array[0] = 0x2332;
    m_int16Array[1] = 0x4545;

    m_uint16Array = std::vector<int16_t>(2);
    m_uint16Array[0] = 0x3243;
    m_uint16Array[1] = 0x3232;

    m_int32Array = std::vector<int32_t>(4);
    m_int32Array[0] = 23;
    m_int32Array[1] = 676868;
    m_int32Array[2] = 34343;
    m_int32Array[3] = 2323;

    m_uint32Array = std::vector<int32_t>(4);
    m_uint32Array[0] = 435;
    m_uint32Array[1] = 234324;
    m_uint32Array[2] = 324324;
    m_uint32Array[3] = 23432432;

    m_longArray = std::vector<int64_t>(2);
    m_longArray[0] = 324324L;
    m_longArray[1] = 23434545L;

    m_ulongArray = std::vector<int64_t>(2);
    m_ulongArray[0] = 3245435;
    m_ulongArray[1] = 3425435;

    m_floatArray = std::vector<float>(2);
    m_floatArray[0] = 232.565f;
    m_floatArray[1] = 2343254.67f;

    m_doubleArray = std::vector<double>(2);
    m_doubleArray[0] = 23423432;
    m_doubleArray[1] = 4324235435.00;

    m_byteByteArray = new int8_t*[2];
    // for(int i=0; i<2; i++){
    //  m_byteByteArray[i] = new int8_t[1];
    //}
    m_byteByteArray[0] = new int8_t[1];
    m_byteByteArray[1] = new int8_t[2];
    m_byteByteArray[0][0] = 0x23;
    m_byteByteArray[1][0] = 0x34;
    m_byteByteArray[1][1] = 0x55;

    m_stringArray = {"one", "two"};

    m_arraylist = CacheableArrayList::create();
    m_arraylist->push_back(CacheableInt32::create(1));
    m_arraylist->push_back(CacheableInt32::create(2));

    m_linkedlist = CacheableLinkedList::create();
    m_linkedlist->push_back(CacheableInt32::create(1));
    m_linkedlist->push_back(CacheableInt32::create(2));

    m_map = CacheableHashMap::create();
    m_map->emplace(CacheableInt32::create(1), CacheableInt32::create(1));
    m_map->emplace(CacheableInt32::create(2), CacheableInt32::create(2));

    m_hashtable = CacheableHashTable::create();
    m_hashtable->emplace(CacheableInt32::create(1),
                         CacheableString::create("1111111111111111"));
    m_hashtable->emplace(
        CacheableInt32::create(2),
        CacheableString::create("2222222222221111111111111111"));

    m_vector = CacheableVector::create();
    m_vector->push_back(CacheableInt32::create(1));
    m_vector->push_back(CacheableInt32::create(2));
    m_vector->push_back(CacheableInt32::create(3));

    m_chs = CacheableHashSet::create();
    m_chs->insert(CacheableInt32::create(1));

    m_clhs = CacheableLinkedHashSet::create();
    m_clhs->insert(CacheableInt32::create(1));
    m_clhs->insert(CacheableInt32::create(2));

    m_pdxEnum = CacheableEnum::create("PdxTests.pdxEnumTest", "pdx2", pdx2);

    // std::shared_ptr<Address>* addPtr = NULL;
    // m_add = new Address[10];
    // addPtr[i] = Address::create();

    m_add[0] = new Address(1, "street0", "city0");
    m_add[1] = new Address(2, "street1", "city1");
    m_add[2] = new Address(3, "street2", "city2");
    m_add[3] = new Address(4, "street3", "city3");
    m_add[4] = new Address(5, "street4", "city4");
    m_add[5] = new Address(6, "street5", "city5");
    m_add[6] = new Address(7, "street6", "city6");
    m_add[7] = new Address(8, "street7", "city7");
    m_add[8] = new Address(9, "street8", "city8");
    m_add[9] = new Address(10, "street9", "city9");

    m_objectArray = nullptr;
    m_objectArrayEmptyPdxFieldName = nullptr;

    m_objectArray = CacheableObjectArray::create();
    m_objectArray->push_back(
        std::shared_ptr<Address>(new Address(1, "street0", "city0")));
    m_objectArray->push_back(
        std::shared_ptr<Address>(new Address(2, "street1", "city1")));
    m_objectArray->push_back(
        std::shared_ptr<Address>(new Address(3, "street2", "city2")));
    m_objectArray->push_back(
        std::shared_ptr<Address>(new Address(4, "street3", "city3")));
    m_objectArray->push_back(
        std::shared_ptr<Address>(new Address(5, "street4", "city4")));
    m_objectArray->push_back(
        std::shared_ptr<Address>(new Address(6, "street5", "city5")));
    m_objectArray->push_back(
        std::shared_ptr<Address>(new Address(7, "street6", "city6")));
    m_objectArray->push_back(
        std::shared_ptr<Address>(new Address(8, "street7", "city7")));
    m_objectArray->push_back(
        std::shared_ptr<Address>(new Address(9, "street8", "city8")));
    m_objectArray->push_back(
        std::shared_ptr<Address>(new Address(10, "street9", "city9")));

    m_objectArrayEmptyPdxFieldName = CacheableObjectArray::create();
    m_objectArrayEmptyPdxFieldName->push_back(
        std::shared_ptr<Address>(new Address(1, "street0", "city0")));
    m_objectArrayEmptyPdxFieldName->push_back(
        std::shared_ptr<Address>(new Address(2, "street1", "city1")));
    m_objectArrayEmptyPdxFieldName->push_back(
        std::shared_ptr<Address>(new Address(3, "street2", "city2")));
    m_objectArrayEmptyPdxFieldName->push_back(
        std::shared_ptr<Address>(new Address(4, "street3", "city3")));
    m_objectArrayEmptyPdxFieldName->push_back(
        std::shared_ptr<Address>(new Address(5, "street4", "city4")));
    m_objectArrayEmptyPdxFieldName->push_back(
        std::shared_ptr<Address>(new Address(6, "street5", "city5")));
    m_objectArrayEmptyPdxFieldName->push_back(
        std::shared_ptr<Address>(new Address(7, "street6", "city6")));
    m_objectArrayEmptyPdxFieldName->push_back(
        std::shared_ptr<Address>(new Address(8, "street7", "city7")));
    m_objectArrayEmptyPdxFieldName->push_back(
        std::shared_ptr<Address>(new Address(9, "street8", "city8")));
    m_objectArrayEmptyPdxFieldName->push_back(
        std::shared_ptr<Address>(new Address(10, "street9", "city9")));

    m_byte252 = std::vector<int8_t>(252, 0);

    m_byte253 = std::vector<int8_t>(253, 0);

    m_byte65535 = std::vector<int8_t>(65535, 0);

    m_byte65536 = std::vector<int8_t>(65536, 0);

    /*for (int32_t index = 0; index <3; ++index) {
      m_objectArray->push_back(objectArray[index]);
    }*/
    /*
    if (keys.size() > 0) {
      m_objectArray = CacheableObjectArray::create();
      for (int32_t index = 0; index < keys.size(); ++index) {
        m_objectArray->push_back(keys.operator[](index));
      }
    }*/

    boolArrayLen = 3;
    byteArrayLen = 2;
    shortArrayLen = 2;
    intArrayLen = 4;
    longArrayLen = 2;
    doubleArrayLen = 2;
    floatArrayLen = 2;
    strLenArray = 2;
    charArrayLen = 2;
    byteByteArrayLen = 2;

    lengthArr = new int[2];

    lengthArr[0] = 1;
    lengthArr[1] = 2;
  }

  PdxType() { init(); }

  inline bool compareBool(bool b, bool b2) {
    if (b == b2) return b;
    throw IllegalStateException("Not got expected value for bool type: ");
  }

  ~PdxType() override = default;

  virtual size_t objectSize() const override {
    auto objectSize = sizeof(PdxType);
    return objectSize;
  }

  char16_t getChar() { return m_char; }

  std::vector<char16_t> getCharArray() { return m_charArray; }

  int8_t** getArrayOfByteArrays() { return m_byteByteArray; }

  bool getBool() { return m_bool; }

  std::shared_ptr<CacheableHashMap> getHashMap() { return m_map; }

  int8_t getSByte() { return m_sbyte; }

  int16_t getUint16() { return m_uint16; }

  int32_t getUInt() { return m_uint32; }

  int64_t getULong() { return m_ulong; }

  std::vector<int16_t> getUInt16Array() { return m_uint16Array; }

  std::vector<int32_t> getUIntArray() { return m_uint32Array; }

  std::vector<int64_t> getULongArray() { return m_ulongArray; }

  std::vector<int8_t> getByte252() { return m_byte252; }

  std::vector<int8_t> getByte253() { return m_byte253; }

  std::vector<int8_t> getByte65535() { return m_byte65535; }

  std::vector<int8_t> getByte65536() { return m_byte65536; }

  std::vector<int8_t> getSByteArray() { return m_sbyteArray; }

  std::shared_ptr<CacheableHashSet> getHashSet() { return m_chs; }

  std::shared_ptr<CacheableLinkedHashSet> getLinkedHashSet() { return m_clhs; }

  std::shared_ptr<CacheableArrayList> getArrayList() { return m_arraylist; }

  std::shared_ptr<CacheableLinkedList> getLinkedList() { return m_linkedlist; }

  std::shared_ptr<CacheableHashTable> getHashTable() { return m_hashtable; }

  std::shared_ptr<CacheableVector> getVector() { return m_vector; }

  int8_t getByte() { return m_byte; }

  int16_t getShort() { return m_int16; }

  int32_t getInt() { return m_int32; }

  int64_t getLong() { return m_long; }

  float getFloat() { return m_float; }

  double getDouble() { return m_double; }

  const std::string& getString() { return m_string; }

  std::vector<bool> getBoolArray() { return m_boolArray; }

  std::vector<int8_t> getByteArray() { return m_byteArray; }

  std::vector<int16_t> getShortArray() { return m_int16Array; }

  std::vector<int32_t> getIntArray() { return m_int32Array; }

  std::vector<int64_t> getLongArray() { return m_longArray; }

  std::vector<double> getDoubleArray() { return m_doubleArray; }

  std::vector<float> getFloatArray() { return m_floatArray; }

  const std::vector<std::string>& getStringArray() { return m_stringArray; }

  std::shared_ptr<CacheableDate> getDate() { return m_date; }

  std::shared_ptr<CacheableObjectArray> getCacheableObjectArray() {
    return m_objectArray;
  }

  std::shared_ptr<CacheableObjectArray>
  getCacheableObjectArrayEmptyPdxFieldName() {
    return m_objectArrayEmptyPdxFieldName;
  }

  std::shared_ptr<CacheableEnum> getEnum() {
    return std::static_pointer_cast<CacheableEnum>(m_pdxEnum);
  }

  int32_t getByteArrayLength() { return byteArrayLen; }

  int32_t getBoolArrayLength() { return boolArrayLen; }

  int32_t getShortArrayLength() { return shortArrayLen; }

  int32_t getStringArrayLength() { return strLenArray; }

  int32_t getIntArrayLength() { return intArrayLen; }

  int32_t getLongArrayLength() { return longArrayLen; }

  int32_t getFloatArrayLength() { return floatArrayLen; }

  int32_t getDoubleArrayLength() { return doubleArrayLen; }

  int32_t getbyteByteArrayLength() { return byteByteArrayLen; }

  int32_t getCharArrayLength() { return charArrayLen; }

  using PdxSerializable::fromData;
  using PdxSerializable::toData;

  virtual void toData(PdxWriter& pw) const override;

  virtual void fromData(PdxReader& pr) override;

  std::string toString() const override;

  const std::string& getClassName() const override {
    static std::string className = "PdxTests.PdxType";
    return className;
  }

  static std::shared_ptr<PdxSerializable> createDeserializable() {
    return std::make_shared<PdxType>();
  }

  bool equals(PdxTests::PdxType& other, bool isPdxReadSerialized) const;

  template <typename T1, typename T2>
  bool genericValCompare(T1 value1, T2 value2) const;

  template <typename T1, typename T2, typename L>
  bool genericCompare(T1* value1, T2* value2, L length) const;

  template <typename T1, typename T2>
  bool generic2DCompare(T1** value1, T2** value2, int length,
                        int* arrLengths) const;
};

}  // namespace PdxTests

#endif  // GEODE_TESTOBJECT_PDXTYPE_H_


text:
<?php
namespace api\controllers;
use Yii;
use yii\web\Controller;
use common\models\LoginForm;
use api\components\ApiController;
use common\models\Company;

/**
 * Site controller
 */
class CompanyController extends ApiController
{
    public $enableCsrfValidation = false;
    public $layout = false;

    public function init()
    {
        \Yii::$app->response->format = 'json';
    }

    /**
     * Displays homepage.
     *
     * @return mixed
     */
    public function actionIndex()
    {
        die("HELLO API");
    }

    public function actionGet()
    {
        if (Yii::$app->user->isGuest) {
            return ['error_code' => 1, 'message' => 'Not login'];
        }
        $company = [];
        $message = '';
        $id = isset(Yii::$app->request->get()['id']) ? Yii::$app->request->get()['id'] : '';
        $staff_id = isset(Yii::$app->request->get()['staff_id']) ? Yii::$app->request->get()['staff_id'] : '';
		$company = Company::getList($id,$staff_id);
		if (!empty($company)) {
			return ['error_code' => 0, 'message' => 'Success', 'data' => $company];
		}
		if (empty($company)) {
			return ['error_code' => 401, 'message' => 'Data empty', 'data' => []];
		}
    }

}

redpajama_set_name: RedPajamaGithub


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

namespace Balanced
{
    public class Reversal : Resource
    {
        [JsonIgnore]
        public static string resource_href
        {
            get { return "/reversals"; }
        }

        // fields
        [ResourceField]
        public int amount { get; set; }
        [ResourceField]
        public string description { get; set; }

        // attributes
        [ResourceField(serialize = false)]
        public string currency { get; set; }
        [ResourceField(serialize = false)]
        public string failure_reason { get; set; }
        [ResourceField(serialize = false)]
        public string failure_reason_code { get; set; }
        [ResourceField(serialize = false)]
        public string status { get; set; }
        [ResourceField(serialize = false)]
        public string transaction_number { get; set; }

        [ResourceField(field = "reversals.credit", link = true, serialize = false)]
        public Credit credit { get; set; }

        [ResourceField(field = "reversals.events", link = true, serialize = false)]
        public Event.Collection events { get; set; }

        [ResourceField(field = "reversals.order", link = true, serialize = false)]
        public Order order { get; set; }

        public Reversal() { }

        public Reversal(Dictionary<string, object> payload) { }

        public static Reversal Fetch(string href)
        {
            return Resource.Fetch<Reversal>(href);
        }

        public void Save()
        {
            this.Save<Reversal>();
        }

        public void Reload()
        {
            this.Reload<Reversal>();
        }

        public class Collection : ResourceCollection<Reversal>
        {
            public Collection() : base(resource_href) { }
            public Collection(string href) : base(href) { }
        }

        public static ResourceQuery<Reversal> Query()
        {
            return new ResourceQuery<Reversal>(resource_href);
        }
    }
}


text:
package org.bouncycastle.crypto.test;

import junit.extensions.TestSetup;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.bouncycastle.PrintTestResult;

public class AllTests
    extends TestCase
{
    public static void main (String[] args)
    {
       PrintTestResult.printResult(junit.textui.TestRunner.run(suite()));
    }

    public static Test suite()
    {
        TestSuite suite = new TestSuite("Lightweight Crypto Tests");

        suite.addTestSuite(SimpleTestTest.class);
        suite.addTestSuite(GCMReorderTest.class);
        suite.addTestSuite(HPKETestVectors.class);

        return new BCTestSetup(suite);
    }

    static class BCTestSetup
        extends TestSetup
    {
        public BCTestSetup(Test test)
        {
            super(test);
        }

        protected void setUp()
        {

        }

        protected void tearDown()
        {

        }
    }
}


text:
package ariba.util.formatter;

import java.math.BigDecimal;

/**
    This class contains information generated by parsing a given
    BigDecimal string.

    @aribaapi documented
*/
public class DecimalParseInfo
{
    /**
        The number of digits before the decimal separator
        @aribaapi documented
    */
    public int integerDigits;

    /**
        The number of digits after the decimal separator
        @aribaapi documented
    */
    public int decimalDigits;

    /**
        The parse location of the decimal separator (in characters)
        @aribaapi documented
    */
    public int decimalLocation;

    /**
        The string prefix of the number
        @aribaapi documented
    */
    public String prefix;

    /**
        The string suffix of the number
        @aribaapi documented
    */
    public String suffix;

    /**
        The number parsed
        @aribaapi documented
    */
    public BigDecimal number;

    /**
        Constructor for initializing the public fields on this
        class.  It is of package visibility since this class should
        only be created by the MoneyFormatter.
        @aribaapi documented
    */
    DecimalParseInfo (int        integerDigits,
                      int        decimalDigits,
                      int        decimalLocation,
                      String     prefix,
                      String     suffix,
                      BigDecimal number)
    {
        this.integerDigits   = integerDigits;
        this.decimalDigits   = decimalDigits;
        this.decimalLocation = decimalLocation;
        this.prefix          = prefix;
        this.suffix          = suffix;
        this.number          = number;
    }
}


text:
#!/usr/bin/env python
# coding=utf-8

import re
import os
import sys
import json
import urllib
import subprocess
import time
import socket
import urllib2
import traceback
import zipfile
import shutil
import executelimit
import send
from util.colorlog import *

UPDATEDURATION_HOUR = 24 #每隔多少小时更新一次
TIMEOUT = 20
GITHOOKSURL = "https://api.github.com/repos/spWang/gitHooks/tags"
MAX_FALI_COUNT = 0 #检查和更新脚本失败时抛异常的最大次数,0不抛异常
MIN_ALARM_COUNT = 1 #失败报警的最小次数
MAX_CHECK_FAIL_ONE_DAY = 1 #检查失败时,每天最大次数,超过后当天不在检查
VERSIONNAMEKEY = "name"
ZIPBALLKEY = "zipball_url"
GITHOOK_ZIP_NAME = "gitHooks.zip"
CHANGE_LOG_NAME = "changelog.md"

GOLBAL_DOWNLOAD_URL = ""
GOLBAL_REMOTE_VERSION = ""
GOLBAL_LOCAL_VERSION = ""

GOLBAL_DEFINE_VERSION = ""

#更新至指定版本
def update_to_define_version(verson_str):
    global GOLBAL_DEFINE_VERSION
    GOLBAL_DEFINE_VERSION = verson_str

    if len(verson_str)>0:
        print "你指定了升级的版本为"+GOLBAL_DEFINE_VERSION
        logred("谨慎:指定版本功能仅从1.5.1之后开始支持,若切回之前版本,则无法再使用切换版本的功能,需要手动再初始化一次")
        pass

    update_if_need(force_update=True)

    pass

def update_if_need(force_update=False):

    #是否需要检查更新
    if not need_check_update(force_update):
        return
        pass

    #是否有新的代码
    if not have_new_code_for_check():
        return
        pass

    #新代码是否下载成功
    if not download_new_code():
        return
        pass

    #解压和复制新代码文件到hooks文件夹下
    update_success = False
    if unzip_files():
        move_code_files()
        deal_success_events()
        update_success = True
        pass

    #检查并开启可执行权限
    executelimit.open_execute_limit()

    if update_success:
        #放于后边的原因是要复制已经获的可执行权限的文件
        copy_code_files_to_template()
        write_global_version()
        show_change_log()
        pass

    pass

#处理后事
def deal_success_events():
    if os.path.exists(unzip_path()):
        shutil.rmtree(unzip_path())
        pass

    update_check_update_time()
    update_version()
    send_mail()

    pass

def send_mail():
    content = "脚本更新成功(版本:" + GOLBAL_LOCAL_VERSION + "-->" + GOLBAL_REMOTE_VERSION +")"
    send.send_mail_for_content(content)
    pass

#将代码拷贝到模板路径
def copy_code_files_to_template():
    template_path = os.environ['HOME']+"/.git_template/"
    template_hooks_path = template_path+"hooks"

    if os.path.exists(template_hooks_path):
        shutil.rmtree(template_hooks_path)
        pass

    shutil.copytree(hooks_path(),template_hooks_path)

    pass

def write_global_version():
    command = 'git config --global githooks.globalversion ' + GOLBAL_REMOTE_VERSION
    check_out_put(command,False,None)
    print "模板脚本的版本%s已更新录入本地" % GOLBAL_REMOTE_VERSION
    pass

def unzip_path():
    return hooks_path().replace('.git/hooks/','.git/temp_hooks/')
    pass

def unzip_files():
    zipfile_path = hooks_path()+GITHOOK_ZIP_NAME

    isZipfile = zipfile.is_zipfile(zipfile_path)
    if isZipfile == False:
        print "文件不存在或者不是zip类型,无法解压"
        return False

    fz = zipfile.ZipFile(zipfile_path, 'r')

    unZipPath = unzip_path()
    if not os.path.exists(unZipPath):
        os.mkdir(unZipPath)
        pass

    for file in fz.namelist():
        fz.extract(file, unZipPath)
    fz.close()
    return True

    pass

def move_code_files():
    unzip_fils_path = ""
    for file in os.listdir(unzip_path()):
        if "spWang" in file:
            unzip_fils_path = unzip_path()+file
            break
            pass
        pass

    down_hooks_path = unzip_path()+"hooks"
    os.rename(unzip_fils_path,down_hooks_path)
    new_hooks_path = hooks_path()
    if os.path.exists(new_hooks_path):
        shutil.rmtree(new_hooks_path)
        pass
    shutil.copytree(down_hooks_path,new_hooks_path)

    pass

def download_new_code():
    if not "http" in GOLBAL_DOWNLOAD_URL:
        return False
        pass

    print "代码下载中,请稍候..."
    zipfile_path = hooks_path()+GITHOOK_ZIP_NAME
    socket.setdefaulttimeout(TIMEOUT)
    # send_headers = {
    # 'Host' : 'codeload.github.com',
    # 'User-Agent' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:57.0) Gecko/20100101 Firefox/57.0',
    # 'Accept' : 'text/html,application/xhtml+xm…plication/xml;q=0.9,*/*;q=0.8',
    # 'Connection': 'keep-alive',
    # }

    try:
        #下载完的zip包有问题,不用这个
        # response = requests.get(GOLBAL_DOWNLOAD_URL,headers=send_headers)
        # with open(zipfile_path, 'wb') as f:
        #     f.write(response.content)
        #     f.flush()
        urllib.urlretrieve(GOLBAL_DOWNLOAD_URL, zipfile_path, download_progress)
        check_out_put("git config --unset githooks.downFailCount", False , None)
        print "下载完毕。"
        return True
        pass
    except Exception, e:
        fail_count = check_out_put('git config githooks.downFailCount', False, 0)
        current_fail_count = str(int(fail_count)+1)

        print "代码下载失败时,前%s次会中断提交并抛出异常,如有疑问,请联系脚本开发者" % MAX_FALI_COUNT
        print "这是第%s次下载失败。在下次commit时会重新检查并下载,以下是异常信息:" % current_fail_count

        fail_count_cammand = "git config githooks.downFailCount "+ current_fail_count
        check_out_put(fail_count_cammand, False , 1)
        traceback_str = traceback.format_exc()
        if int(current_fail_count) >= MIN_ALARM_COUNT:
            send.send_mail_for_fail(current_fail_count,"下载脚本失败",traceback_str)
            pass

        if int(fail_count) < MAX_FALI_COUNT:
            raise e
            pass

        print traceback_str
        return False

    pass

def download_progress(a,b,c):
    per = 100.0 * a * b / c
    if per < 0:
        return

    if per > 100 :
        per = 100.00
    print '%.2f%%' % per
    pass

def have_new_code_for_check():
    print "如果你开启了蓝灯,而发现迟迟不能更新脚本,请暂时关闭蓝灯,蓝灯可能和github冲突,在脚本更新完毕后再开启它"

    if len(GOLBAL_DEFINE_VERSION)>0:
        print "正在获取脚本所有版本信息,请稍后..."
    else:
        print "正在检查脚本是否有新版本,请稍候..."
        pass

    socket.setdefaulttimeout(TIMEOUT)
    send_headers = {
    'Host' : 'api.github.com',
    'User-Agent' : 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:57.0) Gecko/20100101 Firefox/57.0',
    'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
    'Connection': 'keep-alive',
    }

    req = urllib2.Request(GITHOOKSURL)

    try:
        response = urllib2.urlopen(req)
        have_new_code = deal_check_result(response)
        clear_check_fail_count()
        clear_last_check_fail_date()
        return have_new_code
        pass
    except Exception, e:
        fail_count = check_out_put('git config githooks.checkFailCount', False, 0)
        current_fail_count = str(int(fail_count)+1)

        print "检查更新失败时,前%s次会中断提交并抛出异常,如有疑问,请联系脚本开发者" % MAX_FALI_COUNT
        print "这是今天第%s次检查失败。在下次commit时会重新检查,以下是异常信息:" % current_fail_count

        fail_count_cammand = "git config githooks.checkFailCount "+ current_fail_count
        check_out_put(fail_count_cammand, False , 1)

        currentDate = time.strftime('%Y%m%d',time.localtime(time.time()))
        fail_date_cammand = "git config githooks.lastCheckFailDate "+currentDate
        check_out_put(fail_date_cammand, False , 1)

        traceback_str = traceback.format_exc()
        if int(current_fail_count) >= MIN_ALARM_COUNT:
            send.send_mail_for_fail(current_fail_count,"检查更新失败",traceback_str)
            pass

        if int(fail_count) < MAX_FALI_COUNT:
            raise e
            pass

        print traceback_str
        return False
    pass

def deal_check_result(response):
    gitHooksStr = response.read()
    hooksList = json.loads(gitHooksStr)

    if len(hooksList)<=0:
        print "未检查到远端脚本,无法更新"
        return False
        pass

    global GOLBAL_DOWNLOAD_URL
    global GOLBAL_REMOTE_VERSION
    global GOLBAL_LOCAL_VERSION

    GOLBAL_LOCAL_VERSION = check_out_put("git config githooks.version", False, "0")
    GOLBAL_REMOTE_VERSION = hooksList[0][VERSIONNAMEKEY].encode('unicode-escape')
    GOLBAL_DOWNLOAD_URL = hooksList[0][ZIPBALLKEY]

    #优先处理指定版本的升级
    if len(GOLBAL_DEFINE_VERSION)>0:
        return deal_define_version(hooksList)
        pass

    if GOLBAL_LOCAL_VERSION == "0":
        print "本地未检测到版本信息,需要更新脚本"
        return True
        pass

    if GOLBAL_LOCAL_VERSION != GOLBAL_REMOTE_VERSION:
        print "当前版本号为%s,最新版本为%s" % (GOLBAL_LOCAL_VERSION,GOLBAL_REMOTE_VERSION)
        print "版本不一致,需要更新脚本"
        return True
        pass

    print "本地和远端版本号一致,无脚本更新"
    update_check_update_time()
    return False
    pass

def deal_define_version(hooks_list):

    in_list = False
    for index, hooks_info in enumerate(hooks_list):

        remote_version = hooks_info[VERSIONNAMEKEY].encode('unicode-escape')
        if remote_version == GOLBAL_DEFINE_VERSION:
            in_list = True
            GOLBAL_REMOTE_VERSION = hooks_list[index][VERSIONNAMEKEY].encode('unicode-escape')
            GOLBAL_DOWNLOAD_URL = hooks_list[index][ZIPBALLKEY]
            break

            pass
        pass

    if not in_list:
        print "远端版本号列表未发现你指定的版本!!!"
        print "请检查后重新输入"
        exit(-1)
        pass

    print "正在切换至版本"+GOLBAL_REMOTE_VERSION
    return True
    pass

#根据上次检查时间看是否需要检查更新
def need_check_update(force_update=False):

    last_update_time = check_out_put('git config githooks.updateTime', False, 0)
    if last_update_time == 0:
        print "未检测到上次脚本更新的时间,需要检查是否有新版本"
        return True
        pass
    currentTime = time.time()
    if not force_update:
        currentDate = time.strftime('%Y%m%d',time.localtime(currentTime))
        lastCheckFailDate = check_out_put('git config githooks.lastCheckFailDate', False, "19700101")

        #清空上次失败的次数
        if currentDate !=lastCheckFailDate:
            clear_check_fail_count()
            pass
        checkFailCount = int(check_out_put('git config githooks.checkFailCount', False, 0))
        if checkFailCount >= MAX_CHECK_FAIL_ONE_DAY and (currentDate ==lastCheckFailDate):
            print "今日失败次数:"+str(checkFailCount)
            print "当前已经达到当天最大检查失败的次数,今日不再检查更新;若需要强制检查,执行命令python .git/hooks/upgrade.py"
            return False
            pass
        pass

    currentHour = int(time.strftime('%H',time.localtime(currentTime)))

    if (currentHour<10 or currentHour>17) and not force_update:
        print "脚本仅在上午10点-下午5点期间检查是否有新版本;若需要强制检查,执行命令python .git/hooks/upgrade.py"
        return  False
        pass

    duration = currentTime -float(last_update_time)
    if duration>UPDATEDURATION_HOUR*60*60:
        print "距离上次检查是否有新版本的时间已经大于%s小时,需要检查更新是否有新版本" % UPDATEDURATION_HOUR
        return True

    duration_diff = calculate_canupdate_duration(last_update_time,currentTime)
    print "脚本每隔%s小时检查更新一次,还差%s检查是否有新版本;若需要强制检查,执行命令python .git/hooks/upgrade.py" % (UPDATEDURATION_HOUR, duration_diff)
    return  False

    pass

def update_version():
    command = 'git config githooks.version ' + GOLBAL_REMOTE_VERSION
    check_out_put(command,False,None)
    print "当前版本%s已更新录入本地" % GOLBAL_REMOTE_VERSION
    pass

#清空上次检查失败的日期
def clear_last_check_fail_date():
    check_out_put("git config --unset githooks.lastCheckFailDate", False , None)
    pass
def clear_check_fail_count():
    check_out_put("git config --unset githooks.checkFailCount", False , None)
    pass

#更新检测时间
def update_check_update_time():
    currentTime = time.time()
    command = 'git config githooks.updateTime ' + str(currentTime)
    check_out_put(command,False,None)
    print "本次检测的时间已更新录入本地"
    pass

#打开更新说明
def show_change_log():
    if updatelog().find(GOLBAL_LOCAL_VERSION) != -1:
        print "┏"+"┳"*50+"┓\n"
        print updatelog()
        print "┗"+"┻"*50+"┛"
        pass
    print "更新完毕✅✅✅"
    pass

def updatelog():
    updateFile = hooks_path()+CHANGE_LOG_NAME

    if os.path.exists(updateFile) == False:
        return ""
    all_changelog = open(updateFile, 'r').read()

    if all_changelog.find(GOLBAL_LOCAL_VERSION) == -1:
        return ""
        pass

    change_log = all_changelog.split(GOLBAL_LOCAL_VERSION, 1)[0]
    if len(change_log)>0:
        return change_log
        pass

    return ""
    pass

#计算还差多久要更新
def calculate_canupdate_duration(last_update_time, currentTime):
    diff = float(last_update_time)+float(UPDATEDURATION_HOUR)*60*60 - currentTime
    if diff<=0:
        return "0秒"
        pass
    m, s = divmod(diff, 60)
    h, m = divmod(m, 60)
    d, h = divmod(h, 24)

    duration_diff = ("%01d天%01d小时%01d分钟%01d秒" % (d, h, m, s))
    if d == 0:
        duration_diff = ("%01d小时%01d分钟%01d秒" % (h, m, s))
        pass
    if d == 0 and h == 0:
        duration_diff = ("%01d分钟%01d秒" % (m, s))
        pass

    if d == 0 and h == 0 and m == 0:
        duration_diff = ("%01d秒" % s)
        pass

    return duration_diff
    pass

#基础支撑方法
def check_out_put(cammand, can_raise, return_value):
    try:
        return subprocess.check_output(cammand, shell=True).strip()
        pass
    except subprocess.CalledProcessError as e:
        if can_raise:
            raise(e)
        else:
            return return_value
            pass
    pass

#项目/.git/hooks/
def hooks_path():
    currentPath = os.path.realpath(__file__);
    fileName = os.path.basename(__file__);
    hooksPath = currentPath.replace(fileName,"");
    return hooksPath
    pass

#项目/.git/
def dot_git_path():
    return hooks_path().replace("hooks/","")
    pass

def main():
    # ok = need_check_update(force_update=True)
    # if not ok:
    #     print "不检查更新"
    #     return
    #     pass
    # print "在检查更新,模拟失败"
    # fail_count = check_out_put('git config githooks.checkFailCount', False, 0)
    # current_fail_count = str(int(fail_count)+1)

    # print "检查更新失败时,前%s次会中断提交并抛出异常,如有疑问,请联系脚本开发者" % MAX_FALI_COUNT
    # print "这是今天第%s次检查失败。在下次commit时会重新检查,以下是异常信息:" % current_fail_count

    # fail_count_cammand = "git config githooks.checkFailCount "+ current_fail_count
    # check_out_put(fail_count_cammand, False , 1)

    # currentDate = time.strftime('%Y%m%d',time.localtime(time.time()))
    # fail_date_cammand = "git config githooks.lastCheckFailDate "+currentDate
    # check_out_put(fail_date_cammand, False , 1)
    pass
if __name__ == '__main__':
    main()


text:
/* ** GENEREATED FILE - DO NOT MODIFY ** */
package com.wilutions.mslib.uccollaborationlib;
import com.wilutions.com.*;

/**
 * _IShareableContentCallback.
 * _IAutomationCallback Interface
 */
@CoInterface(guid="{3187885C-A8AF-4D4B-8E80-F4B9D447A7B2}")
public interface _IShareableContentCallback extends IDispatch {
  static boolean __typelib__loaded = __TypeLib.load();
  @DeclDISPID(5110)  public void OnDownloadFile(final IShareableContent _source, final String _localPath, final IAsynchronousOperation _asyncOperation) throws ComException;
}


text:
'use strict';

var $Array = require('./Array');
var $Object = require('./Object');
var $String = require('./String');

module.exports = {
	Array: $Array,
	Object: $Object,
	String: $String,
	shim: function shimES7() {
		$Array.shim();
		$Object.shim();
		$String.shim();
	}
};


text:
import DCTabPanelComponent from 'dc-tabs/components/dc-tab-panel';
export default DCTabPanelComponent;


text:
currDir=$(basename $(pwd))
if [ "$currDir" == "Tests" ]
then
	cd ..
fi

make || { echo 'Build failed!' ; exit 1; }

cd Tests
for path in ./*; do
	[ -d "${path}" ] || continue # if not a directory, skip
	dirname="$(basename "${path}")"

	inPath=$(ls "$dirname"/in.*)
	correctPath=$(ls "$dirname"/correct.*)
	correctName=$(basename "$correctPath")
	extension="${correctName##*.}"
	outPath="$dirname/out.$extension"

	echo "Testing: ../wrangell $dirname/run.wl $inPath $outPath"
	../wrangell "$dirname/run.wl" "$inPath" "$outPath"

	diff $correctPath $outPath > /tmp/thediff 2>&1
   	if [ $? != 0 ]
   	then
    	cat /tmp/thediff
   	fi

   	rm $outPath

done


text:
Dropbin is a Python based, elegant and simple pastebin web service. It takes a
simplistic twist off hastebin.com's beautiful frontend with a little bit more
integration and added features.

## Warning!

The webservice currently hosted at https://dropb.in is very much so in beta status,
and as such, I would not recommend storing any import information within it, as
the backend and front are likely to change, and databases will be wiped prior to
its initial release out in the wild.

##### Guidelines

   * All users with accounts will have their pastes stored forever
   * All guest pastes will be stored for 2 weeks after the last time they were
     accessed

## Setup

#### Databases

Create the database to use (make sure this matches the one listed within your
configuration file) by opening a mysql command prompt `$ mysql -u root -p`:

```sql
mysql> CREATE DATABASE drop_db;
```

Generate a user to use for the database:

```sql
CREATE USER 'drop_user'@'localhost' IDENTIFIED BY 'yourpassword';
```

And last but not least, grant that user permissions for the database:

```sql
mysql> GRANT ALL PRIVILEGES ON drop_db.* TO 'drop_user'@'localhost';
```

```sql
mysql> FLUSH PRIVILEGES;
```

#### The application

Following [this guide](https://pip.pypa.io/en/latest/installing.html) to ensure
That you've got **pip** installed correctly, then once done, assuming it's linux:

```
$ sudo pip install mysql-python gunicorn
```

If you happen to run into an error when installing **mysql-python**, closely
related to `EnvironmentError: mysql_config not found`, and you're running Debian:

```
$ sudo apt-get install libmysqlclient-dev python-dev
```

Then re-run the below:

```
$ sudo pip install mysql-python gunicorn
```

Now copy the configuration file, and edit it to match the above setup:

```
$ cp example.cfg main.cfg
```

Once everything is installed, you should be able to startup the site:

```
$ gunicorn -w 4 -b 0.0.0.0:4444 app:app
```

If you happen to have any further issues, feel free to submit it with more
information [here](https://github.com/lrstanley/dropbin/issues)


text:
using OrchardCore.ContentManagement.Metadata;
using OrchardCore.ContentManagement.Metadata.Settings;
using OrchardCore.ContentManagement.Records;
using OrchardCore.Data.Migration;
using OrchardCore.Taxonomies.Fields;
using OrchardCore.Taxonomies.Indexing;
using OrchardCore.Taxonomies.Settings;
using YesSql.Sql;

namespace OrchardCore.Taxonomies
{
    public class Migrations : DataMigration
    {
        private IContentDefinitionManager _contentDefinitionManager;

        public Migrations(IContentDefinitionManager contentDefinitionManager)
        {
            _contentDefinitionManager = contentDefinitionManager;
        }

        public int Create()
        {
            _contentDefinitionManager.AlterTypeDefinition("Taxonomy", taxonomy => taxonomy
                .Draftable()
                .Versionable()
                .Creatable()
                .Listable()
                .WithPart("TitlePart", part => part.WithPosition("1"))
                .WithPart("AliasPart", part => part
                    .WithPosition("2")
                    .WithSettings(new AliasPartSettings
                    {
                        Pattern = "{{ Model.ContentItem | display_text | slugify }}"
                    }))
                .WithPart("AutoroutePart", part => part
                    .WithPosition("3")
                    .WithSettings(new AutoroutePartSettings
                    {
                        Pattern = "{{ Model.ContentItem | display_text | slugify }}",
                        AllowRouteContainedItems = true
                    }))
                .WithPart("TaxonomyPart", part => part.WithPosition("4"))
            );

            SchemaBuilder.CreateMapIndexTable<TaxonomyIndex>(table => table
                .Column<string>("TaxonomyContentItemId", c => c.WithLength(26))
                .Column<string>("ContentItemId", c => c.WithLength(26))
                .Column<string>("ContentType", column => column.WithLength(ContentItemIndex.MaxContentTypeSize))
                .Column<string>("ContentPart", column => column.WithLength(ContentItemIndex.MaxContentPartSize))
                .Column<string>("ContentField", column => column.WithLength(ContentItemIndex.MaxContentFieldSize))
                .Column<string>("TermContentItemId", column => column.WithLength(26))
            );

            SchemaBuilder.AlterTable(nameof(TaxonomyIndex), table => table
                .CreateIndex("IDX_TaxonomyIndex_List", "ContentType", "ContentPart", "ContentField")
            );

            SchemaBuilder.AlterTable(nameof(TaxonomyIndex), table => table
                .CreateIndex("IDX_TaxonomyIndex_Search", "TermContentItemId")
            );

            // Return 3 to shortcut the migrations on new content definition schemas.
            return 3;
        }

        // Migrate FieldSettings. This only needs to run on old content definition schemas.
        // This code can be removed in a later version.
        public int UpdateFrom1()
        {
            _contentDefinitionManager.MigrateFieldSettings<TaxonomyField, TaxonomyFieldSettings>();
            return 2;
        }

        public int UpdateFrom2()
        {
            _contentDefinitionManager.AlterTypeDefinition("Taxonomy", taxonomy => taxonomy
                .WithPart("AutoroutePart", part => part
                    .WithPosition("3")
                    .WithSettings(new AutoroutePartSettings
                    {
                        Pattern = "{{ Model.ContentItem | display_text | slugify }}",
                        AllowRouteContainedItems = true
                    }))
                .WithPart("TaxonomyPart", part => part.WithPosition("4"))
            );

            return 3;
        }
    }

    internal class AliasPartSettings
    {
        public string Pattern { get; set; }
    }

    internal class AutoroutePartSettings
    {
        public string Pattern { get; set; }
        public bool AllowRouteContainedItems { get; set; }
    }
}


text:
module Geemail
  class Label
    attr_reader :id, :name

    def self.parse(representation)
      new(representation)
    end

    def initialize(representation)
      @id = representation.fetch('id')
      @name = representation.fetch('name')
    end
  end
end


text:
.class final Landroid/net/Network$1;
.super Ljava/lang/Object;
.source "Network.java"

# interfaces
.implements Landroid/os/Parcelable$Creator;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/net/Network;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = null
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Landroid/os/Parcelable$Creator",
        "<",
        "Landroid/net/Network;",
        ">;"
    }
.end annotation

# direct methods
.method constructor <init>()V
    .locals 0

    .prologue
    .line 397
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public createFromParcel(Landroid/os/Parcel;)Landroid/net/Network;
    .locals 2
    .param p1, "in"    # Landroid/os/Parcel;

    .prologue
    .line 399
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v0

    .line 401
    .local v0, "netId":I
    new-instance v1, Landroid/net/Network;

    invoke-direct {v1, v0}, Landroid/net/Network;-><init>(I)V

    return-object v1
.end method

.method public bridge synthetic createFromParcel(Landroid/os/Parcel;)Ljava/lang/Object;
    .locals 1
    .param p1, "in"    # Landroid/os/Parcel;

    .prologue
    .line 398
    invoke-virtual {p0, p1}, Landroid/net/Network$1;->createFromParcel(Landroid/os/Parcel;)Landroid/net/Network;

    move-result-object v0

    return-object v0
.end method

.method public newArray(I)[Landroid/net/Network;
    .locals 1
    .param p1, "size"    # I

    .prologue
    .line 405
    new-array v0, p1, [Landroid/net/Network;

    return-object v0
.end method

.method public bridge synthetic newArray(I)[Ljava/lang/Object;
    .locals 1
    .param p1, "size"    # I

    .prologue
    .line 404
    invoke-virtual {p0, p1}, Landroid/net/Network$1;->newArray(I)[Landroid/net/Network;

    move-result-object v0

    return-object v0
.end method


text:
<?php

namespace SimpleBus\SymfonyBridge\Tests\SymfonyBundle\DependencyInjection\Compiler;

use PHPUnit\Framework\TestCase;
use SimpleBus\SymfonyBridge\DependencyInjection\Compiler\ConfigureMiddlewares;
use SimpleBus\SymfonyBridge\Tests\Functional\SmokeTest\Auto\AutoEvent1;
use SimpleBus\SymfonyBridge\Tests\Functional\SmokeTest\Auto\AutoEvent2;
use SimpleBus\SymfonyBridge\Tests\Functional\SmokeTest\Auto\AutoEvent3;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

class ConfigureMiddlewaresTest extends TestCase
{
    private ContainerBuilder $container;

    private string $mainBusId = 'main_bus';

    private string $middlewareTag = 'middleware';

    private Definition $mainBusDefinition;

    protected function setUp(): void
    {
        $this->container = new ContainerBuilder();
        $this->mainBusDefinition = new Definition('stdClass');
        $this->mainBusDefinition->setPublic(true);
        $this->container->setDefinition($this->mainBusId, $this->mainBusDefinition);
        $this->container->addCompilerPass(new ConfigureMiddlewares($this->mainBusId, $this->middlewareTag));
    }

    /**
     * @test
     */
    public function itConfiguresAChainOfBusesAccordingToTheGivenPriorities(): void
    {
        $classes = [
            AutoEvent1::class => 100,
            AutoEvent2::class => -100,
            AutoEvent3::class => 200,
        ];

        foreach ($classes as $class => $priority) {
            $this->createBusDefinition($class, $priority);
        }

        $this->container->compile();

        $this->commandBusContainsMiddlewares($classes);
    }

    /**
     * @param class-string $class
     */
    private function createBusDefinition(string $class, int $priority): Definition
    {
        $definition = new Definition($class);
        $definition->addTag($this->middlewareTag, ['priority' => $priority]);

        $this->container->setDefinition($class, $definition);

        return $definition;
    }

    /**
     * @param array<class-string, int> $expectedMiddlewareclasses
     */
    private function commandBusContainsMiddlewares(array $expectedMiddlewareclasses): void
    {
        $actualMiddlewareClasses = [];

        foreach ($this->mainBusDefinition->getMethodCalls() as $methodCall) {
            [$method, $arguments] = $methodCall;
            $this->assertSame('appendMiddleware', $method);
            $this->assertCount(1, $arguments);
            $referencedService = $arguments[0];

            $this->assertInstanceOf(
                'Symfony\Component\DependencyInjection\Definition',
                $referencedService
            );

            $actualMiddlewareClasses[$referencedService->getClass()] = $referencedService->getTag('middleware')[0]['priority'];
        }

        $this->assertEquals($expectedMiddlewareclasses, $actualMiddlewareClasses);
    }
}


text:
layout: default
title: Joey Jo-Jo Jr. Shabadoo
subtitle: Writer
---


text:
.class public Lcom/google/android/mms/util/DrmConvertSession;
.super Ljava/lang/Object;
.source "DrmConvertSession.java"

# static fields
.field private static final TAG:Ljava/lang/String; = "DrmConvertSession"

# instance fields
.field private mConvertSessionId:I

.field private mDrmClient:Landroid/drm/DrmManagerClient;

# direct methods
.method private constructor <init>(Landroid/drm/DrmManagerClient;I)V
    .locals 0
    .parameter "drmClient"
    .parameter "convertSessionId"

    .prologue
    .line 35
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 36
    iput-object p1, p0, Lcom/google/android/mms/util/DrmConvertSession;->mDrmClient:Landroid/drm/DrmManagerClient;

    .line 37
    iput p2, p0, Lcom/google/android/mms/util/DrmConvertSession;->mConvertSessionId:I

    .line 38
    return-void
.end method

.method public static open(Landroid/content/Context;Ljava/lang/String;)Lcom/google/android/mms/util/DrmConvertSession;
    .locals 7
    .parameter "context"
    .parameter "mimeType"

    .prologue
    .line 48
    const/4 v1, 0x0

    .line 49
    .local v1, drmClient:Landroid/drm/DrmManagerClient;
    const/4 v0, -0x1

    .line 50
    .local v0, convertSessionId:I
    if-eqz p0, :cond_0

    if-eqz p1, :cond_0

    const-string v4, ""

    invoke-virtual {p1, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v4

    if-nez v4, :cond_0

    .line 52
    :try_start_0
    new-instance v2, Landroid/drm/DrmManagerClient;

    invoke-direct {v2, p0}, Landroid/drm/DrmManagerClient;-><init>(Landroid/content/Context;)V
    :try_end_0
    .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_5
    .catch Ljava/lang/IllegalStateException; {:try_start_0 .. :try_end_0} :catch_4

    .line 54
    .end local v1           #drmClient:Landroid/drm/DrmManagerClient;
    .local v2, drmClient:Landroid/drm/DrmManagerClient;
    :try_start_1
    invoke-virtual {v2, p1}, Landroid/drm/DrmManagerClient;->openConvertSession(Ljava/lang/String;)I
    :try_end_1
    .catch Ljava/lang/IllegalArgumentException; {:try_start_1 .. :try_end_1} :catch_0
    .catch Ljava/lang/IllegalStateException; {:try_start_1 .. :try_end_1} :catch_2

    move-result v0

    :goto_0
    move-object v1, v2

    .line 69
    .end local v2           #drmClient:Landroid/drm/DrmManagerClient;
    .restart local v1       #drmClient:Landroid/drm/DrmManagerClient;
    :cond_0
    :goto_1
    if-eqz v1, :cond_1

    if-gez v0, :cond_2

    .line 70
    :cond_1
    const/4 v4, 0x0

    .line 72
    :goto_2
    return-object v4

    .line 55
    .end local v1           #drmClient:Landroid/drm/DrmManagerClient;
    .restart local v2       #drmClient:Landroid/drm/DrmManagerClient;
    :catch_0
    move-exception v3

    .line 56
    .local v3, e:Ljava/lang/IllegalArgumentException;
    :try_start_2
    const-string v4, "DrmConvertSession"

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "Conversion of Mimetype: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    const-string v6, " is not supported."

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v4, v5, v3}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_2
    .catch Ljava/lang/IllegalArgumentException; {:try_start_2 .. :try_end_2} :catch_1
    .catch Ljava/lang/IllegalStateException; {:try_start_2 .. :try_end_2} :catch_3

    goto :goto_0

    .line 61
    .end local v3           #e:Ljava/lang/IllegalArgumentException;
    :catch_1
    move-exception v3

    move-object v1, v2

    .line 62
    .end local v2           #drmClient:Landroid/drm/DrmManagerClient;
    .restart local v1       #drmClient:Landroid/drm/DrmManagerClient;
    .restart local v3       #e:Ljava/lang/IllegalArgumentException;
    :goto_3
    const-string v4, "DrmConvertSession"

    const-string v5, "DrmManagerClient instance could not be created, context is Illegal."

    invoke-static {v4, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_1

    .line 58
    .end local v1           #drmClient:Landroid/drm/DrmManagerClient;
    .end local v3           #e:Ljava/lang/IllegalArgumentException;
    .restart local v2       #drmClient:Landroid/drm/DrmManagerClient;
    :catch_2
    move-exception v3

    .line 59
    .local v3, e:Ljava/lang/IllegalStateException;
    :try_start_3
    const-string v4, "DrmConvertSession"

    const-string v5, "Could not access Open DrmFramework."

    invoke-static {v4, v5, v3}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_3
    .catch Ljava/lang/IllegalArgumentException; {:try_start_3 .. :try_end_3} :catch_1
    .catch Ljava/lang/IllegalStateException; {:try_start_3 .. :try_end_3} :catch_3

    goto :goto_0

    .line 64
    .end local v3           #e:Ljava/lang/IllegalStateException;
    :catch_3
    move-exception v3

    move-object v1, v2

    .line 65
    .end local v2           #drmClient:Landroid/drm/DrmManagerClient;
    .restart local v1       #drmClient:Landroid/drm/DrmManagerClient;
    .restart local v3       #e:Ljava/lang/IllegalStateException;
    :goto_4
    const-string v4, "DrmConvertSession"

    const-string v5, "DrmManagerClient didn\'t initialize properly."

    invoke-static {v4, v5}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_1

    .line 72
    .end local v3           #e:Ljava/lang/IllegalStateException;
    :cond_2
    new-instance v4, Lcom/google/android/mms/util/DrmConvertSession;

    invoke-direct {v4, v1, v0}, Lcom/google/android/mms/util/DrmConvertSession;-><init>(Landroid/drm/DrmManagerClient;I)V

    goto :goto_2

    .line 64
    :catch_4
    move-exception v3

    goto :goto_4

    .line 61
    :catch_5
    move-exception v3

    goto :goto_3
.end method

# virtual methods
.method public close(Ljava/lang/String;)I
    .locals 9
    .parameter "filename"

    .prologue
    .line 125
    const/4 v0, 0x0

    .line 126
    .local v0, convertedStatus:Landroid/drm/DrmConvertedStatus;
    const/16 v2, 0x1eb

    .line 127
    .local v2, result:I
    iget-object v5, p0, Lcom/google/android/mms/util/DrmConvertSession;->mDrmClient:Landroid/drm/DrmManagerClient;

    if-eqz v5, :cond_1

    iget v5, p0, Lcom/google/android/mms/util/DrmConvertSession;->mConvertSessionId:I

    if-ltz v5, :cond_1

    .line 129
    :try_start_0
    iget-object v5, p0, Lcom/google/android/mms/util/DrmConvertSession;->mDrmClient:Landroid/drm/DrmManagerClient;

    iget v6, p0, Lcom/google/android/mms/util/DrmConvertSession;->mConvertSessionId:I

    invoke-virtual {v5, v6}, Landroid/drm/DrmManagerClient;->closeConvertSession(I)Landroid/drm/DrmConvertedStatus;

    move-result-object v0

    .line 130
    if-eqz v0, :cond_0

    iget v5, v0, Landroid/drm/DrmConvertedStatus;->statusCode:I

    const/4 v6, 0x1

    if-ne v5, v6, :cond_0

    iget-object v5, v0, Landroid/drm/DrmConvertedStatus;->convertedData:[B
    :try_end_0
    .catch Ljava/lang/IllegalStateException; {:try_start_0 .. :try_end_0} :catch_1

    if-nez v5, :cond_2

    .line 133
    :cond_0
    const/16 v2, 0x196

    .line 170
    :cond_1
    :goto_0
    return v2

    .line 135
    :cond_2
    const/4 v3, 0x0

    .line 137
    .local v3, rndAccessFile:Ljava/io/RandomAccessFile;
    :try_start_1
    new-instance v4, Ljava/io/RandomAccessFile;

    const-string/jumbo v5, "rw"

    invoke-direct {v4, p1, v5}, Ljava/io/RandomAccessFile;-><init>(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0
    .catch Ljava/io/FileNotFoundException; {:try_start_1 .. :try_end_1} :catch_2
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_4
    .catch Ljava/lang/IllegalArgumentException; {:try_start_1 .. :try_end_1} :catch_6
    .catch Ljava/lang/SecurityException; {:try_start_1 .. :try_end_1} :catch_8

    .line 138
    .end local v3           #rndAccessFile:Ljava/io/RandomAccessFile;
    .local v4, rndAccessFile:Ljava/io/RandomAccessFile;
    :try_start_2
    iget v5, v0, Landroid/drm/DrmConvertedStatus;->offset:I

    int-to-long v5, v5

    invoke-virtual {v4, v5, v6}, Ljava/io/RandomAccessFile;->seek(J)V

    .line 139
    iget-object v5, v0, Landroid/drm/DrmConvertedStatus;->convertedData:[B

    invoke-virtual {v4, v5}, Ljava/io/RandomAccessFile;->write([B)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_1
    .catch Ljava/io/FileNotFoundException; {:try_start_2 .. :try_end_2} :catch_e
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_d
    .catch Ljava/lang/IllegalArgumentException; {:try_start_2 .. :try_end_2} :catch_c
    .catch Ljava/lang/SecurityException; {:try_start_2 .. :try_end_2} :catch_b

    .line 140
    const/16 v2, 0xc8

    .line 154
    if-eqz v4, :cond_1

    .line 156
    :try_start_3
    invoke-virtual {v4}, Ljava/io/RandomAccessFile;->close()V
    :try_end_3
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_0
    .catch Ljava/lang/IllegalStateException; {:try_start_3 .. :try_end_3} :catch_1

    goto :goto_0

    .line 157
    :catch_0
    move-exception v1

    .line 158
    .local v1, e:Ljava/io/IOException;
    const/16 v2, 0x1ec

    .line 159
    :try_start_4
    const-string v5, "DrmConvertSession"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "Failed to close File:"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, "."

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_4
    .catch Ljava/lang/IllegalStateException; {:try_start_4 .. :try_end_4} :catch_1

    goto :goto_0

    .line 165
    .end local v1           #e:Ljava/io/IOException;
    .end local v4           #rndAccessFile:Ljava/io/RandomAccessFile;
    :catch_1
    move-exception v1

    .line 166
    .local v1, e:Ljava/lang/IllegalStateException;
    const-string v5, "DrmConvertSession"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "Could not close convertsession. Convertsession: "

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    iget v7, p0, Lcom/google/android/mms/util/DrmConvertSession;->mConvertSessionId:I

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_0

    .line 141
    .end local v1           #e:Ljava/lang/IllegalStateException;
    .restart local v3       #rndAccessFile:Ljava/io/RandomAccessFile;
    :catch_2
    move-exception v1

    .line 142
    .local v1, e:Ljava/io/FileNotFoundException;
    :goto_1
    const/16 v2, 0x1ec

    .line 143
    :try_start_5
    const-string v5, "DrmConvertSession"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "File: "

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, " could not be found."

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_5
    .catchall {:try_start_5 .. :try_end_5} :catchall_0

    .line 154
    if-eqz v3, :cond_1

    .line 156
    :try_start_6
    invoke-virtual {v3}, Ljava/io/RandomAccessFile;->close()V
    :try_end_6
    .catch Ljava/io/IOException; {:try_start_6 .. :try_end_6} :catch_3
    .catch Ljava/lang/IllegalStateException; {:try_start_6 .. :try_end_6} :catch_1

    goto/16 :goto_0

    .line 157
    :catch_3
    move-exception v1

    .line 158
    .local v1, e:Ljava/io/IOException;
    const/16 v2, 0x1ec

    .line 159
    :try_start_7
    const-string v5, "DrmConvertSession"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "Failed to close File:"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, "."

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_7
    .catch Ljava/lang/IllegalStateException; {:try_start_7 .. :try_end_7} :catch_1

    goto/16 :goto_0

    .line 144
    .end local v1           #e:Ljava/io/IOException;
    :catch_4
    move-exception v1

    .line 145
    .restart local v1       #e:Ljava/io/IOException;
    :goto_2
    const/16 v2, 0x1ec

    .line 146
    :try_start_8
    const-string v5, "DrmConvertSession"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "Could not access File: "

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, " ."

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_8
    .catchall {:try_start_8 .. :try_end_8} :catchall_0

    .line 154
    if-eqz v3, :cond_1

    .line 156
    :try_start_9
    invoke-virtual {v3}, Ljava/io/RandomAccessFile;->close()V
    :try_end_9
    .catch Ljava/io/IOException; {:try_start_9 .. :try_end_9} :catch_5
    .catch Ljava/lang/IllegalStateException; {:try_start_9 .. :try_end_9} :catch_1

    goto/16 :goto_0

    .line 157
    :catch_5
    move-exception v1

    .line 158
    const/16 v2, 0x1ec

    .line 159
    :try_start_a
    const-string v5, "DrmConvertSession"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "Failed to close File:"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, "."

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_a
    .catch Ljava/lang/IllegalStateException; {:try_start_a .. :try_end_a} :catch_1

    goto/16 :goto_0

    .line 147
    .end local v1           #e:Ljava/io/IOException;
    :catch_6
    move-exception v1

    .line 148
    .local v1, e:Ljava/lang/IllegalArgumentException;
    :goto_3
    const/16 v2, 0x1ec

    .line 149
    :try_start_b
    const-string v5, "DrmConvertSession"

    const-string v6, "Could not open file in mode: rw"

    invoke-static {v5, v6, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_b
    .catchall {:try_start_b .. :try_end_b} :catchall_0

    .line 154
    if-eqz v3, :cond_1

    .line 156
    :try_start_c
    invoke-virtual {v3}, Ljava/io/RandomAccessFile;->close()V
    :try_end_c
    .catch Ljava/io/IOException; {:try_start_c .. :try_end_c} :catch_7
    .catch Ljava/lang/IllegalStateException; {:try_start_c .. :try_end_c} :catch_1

    goto/16 :goto_0

    .line 157
    :catch_7
    move-exception v1

    .line 158
    .local v1, e:Ljava/io/IOException;
    const/16 v2, 0x1ec

    .line 159
    :try_start_d
    const-string v5, "DrmConvertSession"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "Failed to close File:"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, "."

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_d
    .catch Ljava/lang/IllegalStateException; {:try_start_d .. :try_end_d} :catch_1

    goto/16 :goto_0

    .line 150
    .end local v1           #e:Ljava/io/IOException;
    :catch_8
    move-exception v1

    .line 151
    .local v1, e:Ljava/lang/SecurityException;
    :goto_4
    :try_start_e
    const-string v5, "DrmConvertSession"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "Access to File: "

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, " was denied denied by SecurityManager."

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_e
    .catchall {:try_start_e .. :try_end_e} :catchall_0

    .line 154
    if-eqz v3, :cond_1

    .line 156
    :try_start_f
    invoke-virtual {v3}, Ljava/io/RandomAccessFile;->close()V
    :try_end_f
    .catch Ljava/io/IOException; {:try_start_f .. :try_end_f} :catch_9
    .catch Ljava/lang/IllegalStateException; {:try_start_f .. :try_end_f} :catch_1

    goto/16 :goto_0

    .line 157
    :catch_9
    move-exception v1

    .line 158
    .local v1, e:Ljava/io/IOException;
    const/16 v2, 0x1ec

    .line 159
    :try_start_10
    const-string v5, "DrmConvertSession"

    new-instance v6, Ljava/lang/StringBuilder;

    invoke-direct {v6}, Ljava/lang/StringBuilder;-><init>()V

    const-string v7, "Failed to close File:"

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    const-string v7, "."

    invoke-virtual {v6, v7}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v6

    invoke-virtual {v6}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-static {v5, v6, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_10
    .catch Ljava/lang/IllegalStateException; {:try_start_10 .. :try_end_10} :catch_1

    goto/16 :goto_0

    .line 154
    .end local v1           #e:Ljava/io/IOException;
    :catchall_0
    move-exception v5

    :goto_5
    if-eqz v3, :cond_3

    .line 156
    :try_start_11
    invoke-virtual {v3}, Ljava/io/RandomAccessFile;->close()V
    :try_end_11
    .catch Ljava/io/IOException; {:try_start_11 .. :try_end_11} :catch_a
    .catch Ljava/lang/IllegalStateException; {:try_start_11 .. :try_end_11} :catch_1

    .line 154
    :cond_3
    :goto_6
    :try_start_12
    throw v5

    .line 157
    :catch_a
    move-exception v1

    .line 158
    .restart local v1       #e:Ljava/io/IOException;
    const/16 v2, 0x1ec

    .line 159
    const-string v6, "DrmConvertSession"

    new-instance v7, Ljava/lang/StringBuilder;

    invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V

    const-string v8, "Failed to close File:"

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, "."

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    invoke-static {v6, v7, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
    :try_end_12
    .catch Ljava/lang/IllegalStateException; {:try_start_12 .. :try_end_12} :catch_1

    goto :goto_6

    .line 154
    .end local v1           #e:Ljava/io/IOException;
    .end local v3           #rndAccessFile:Ljava/io/RandomAccessFile;
    .restart local v4       #rndAccessFile:Ljava/io/RandomAccessFile;
    :catchall_1
    move-exception v5

    move-object v3, v4

    .end local v4           #rndAccessFile:Ljava/io/RandomAccessFile;
    .restart local v3       #rndAccessFile:Ljava/io/RandomAccessFile;
    goto :goto_5

    .line 150
    .end local v3           #rndAccessFile:Ljava/io/RandomAccessFile;
    .restart local v4       #rndAccessFile:Ljava/io/RandomAccessFile;
    :catch_b
    move-exception v1

    move-object v3, v4

    .end local v4           #rndAccessFile:Ljava/io/RandomAccessFile;
    .restart local v3       #rndAccessFile:Ljava/io/RandomAccessFile;
    goto :goto_4

    .line 147
    .end local v3           #rndAccessFile:Ljava/io/RandomAccessFile;
    .restart local v4       #rndAccessFile:Ljava/io/RandomAccessFile;
    :catch_c
    move-exception v1

    move-object v3, v4

    .end local v4           #rndAccessFile:Ljava/io/RandomAccessFile;
    .restart local v3       #rndAccessFile:Ljava/io/RandomAccessFile;
    goto/16 :goto_3

    .line 144
    .end local v3           #rndAccessFile:Ljava/io/RandomAccessFile;
    .restart local v4       #rndAccessFile:Ljava/io/RandomAccessFile;
    :catch_d
    move-exception v1

    move-object v3, v4

    .end local v4           #rndAccessFile:Ljava/io/RandomAccessFile;
    .restart local v3       #rndAccessFile:Ljava/io/RandomAccessFile;
    goto/16 :goto_2

    .line 141
    .end local v3           #rndAccessFile:Ljava/io/RandomAccessFile;
    .restart local v4       #rndAccessFile:Ljava/io/RandomAccessFile;
    :catch_e
    move-exception v1

    move-object v3, v4

    .end local v4           #rndAccessFile:Ljava/io/RandomAccessFile;
    .restart local v3       #rndAccessFile:Ljava/io/RandomAccessFile;
    goto/16 :goto_1
.end method

.method public convert([BI)[B
    .locals 7
    .parameter "inBuffer"
    .parameter "size"

    .prologue
    .line 84
    const/4 v3, 0x0

    .line 85
    .local v3, result:[B
    if-eqz p1, :cond_2

    .line 86
    const/4 v1, 0x0

    .line 88
    .local v1, convertedStatus:Landroid/drm/DrmConvertedStatus;
    :try_start_0
    array-length v4, p1

    if-eq p2, v4, :cond_1

    .line 89
    new-array v0, p2, [B

    .line 90
    .local v0, buf:[B
    const/4 v4, 0x0

    const/4 v5, 0x0

    invoke-static {p1, v4, v0, v5, p2}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 91
    iget-object v4, p0, Lcom/google/android/mms/util/DrmConvertSession;->mDrmClient:Landroid/drm/DrmManagerClient;

    iget v5, p0, Lcom/google/android/mms/util/DrmConvertSession;->mConvertSessionId:I

    invoke-virtual {v4, v5, v0}, Landroid/drm/DrmManagerClient;->convertData(I[B)Landroid/drm/DrmConvertedStatus;

    move-result-object v1

    .line 96
    .end local v0           #buf:[B
    :goto_0
    if-eqz v1, :cond_0

    iget v4, v1, Landroid/drm/DrmConvertedStatus;->statusCode:I

    const/4 v5, 0x1

    if-ne v4, v5, :cond_0

    iget-object v4, v1, Landroid/drm/DrmConvertedStatus;->convertedData:[B

    if-eqz v4, :cond_0

    .line 99
    iget-object v3, v1, Landroid/drm/DrmConvertedStatus;->convertedData:[B

    .line 111
    :cond_0
    :goto_1
    return-object v3

    .line 93
    :cond_1
    iget-object v4, p0, Lcom/google/android/mms/util/DrmConvertSession;->mDrmClient:Landroid/drm/DrmManagerClient;

    iget v5, p0, Lcom/google/android/mms/util/DrmConvertSession;->mConvertSessionId:I

    invoke-virtual {v4, v5, p1}, Landroid/drm/DrmManagerClient;->convertData(I[B)Landroid/drm/DrmConvertedStatus;
    :try_end_0
    .catch Ljava/lang/IllegalArgumentException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljava/lang/IllegalStateException; {:try_start_0 .. :try_end_0} :catch_1

    move-result-object v1

    goto :goto_0

    .line 101
    :catch_0
    move-exception v2

    .line 102
    .local v2, e:Ljava/lang/IllegalArgumentException;
    const-string v4, "DrmConvertSession"

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "Buffer with data to convert is illegal. Convertsession: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    iget v6, p0, Lcom/google/android/mms/util/DrmConvertSession;->mConvertSessionId:I

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v4, v5, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_1

    .line 104
    .end local v2           #e:Ljava/lang/IllegalArgumentException;
    :catch_1
    move-exception v2

    .line 105
    .local v2, e:Ljava/lang/IllegalStateException;
    const-string v4, "DrmConvertSession"

    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string v6, "Could not convert data. Convertsession: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    iget v6, p0, Lcom/google/android/mms/util/DrmConvertSession;->mConvertSessionId:I

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-static {v4, v5, v2}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_1

    .line 109
    .end local v1           #convertedStatus:Landroid/drm/DrmConvertedStatus;
    .end local v2           #e:Ljava/lang/IllegalStateException;
    :cond_2
    new-instance v4, Ljava/lang/IllegalArgumentException;

    const-string v5, "Parameter inBuffer is null"

    invoke-direct {v4, v5}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v4
.end method


text:
using System;
using SharpDX;
using SharpDX.Direct3D11;
#if !NETFX_CORE
namespace HelixToolkit.Wpf.SharpDX.Core
#else
namespace HelixToolkit.UWP.Core
#endif
{
    using Utilities;
    using Render;
    using Shaders;
    /// <summary>
    ///
    /// </summary>
    /// <typeparam name="MODELSTRUCT"></typeparam>
    public abstract class GeometryRenderCore<MODELSTRUCT> : RenderCoreBase<MODELSTRUCT>, IGeometryRenderCore where MODELSTRUCT : struct
    {
        private RasterizerStateProxy rasterState = null;
        /// <summary>
        ///
        /// </summary>
        public RasterizerStateProxy RasterState { get { return rasterState; } }

        private RasterizerStateProxy invertCullModeState = null;
        public RasterizerStateProxy InvertCullModeState { get { return invertCullModeState; } }

        /// <summary>
        ///
        /// </summary>
        public InputLayout VertexLayout { private set; get; }
        private IElementsBufferModel instanceBuffer;
        /// <summary>
        ///
        /// </summary>
        public IElementsBufferModel InstanceBuffer
        {
            set
            {
                if (instanceBuffer != value)
                {
                    if (instanceBuffer != null)
                    {
                        instanceBuffer.OnElementChanged -= InvalidateRenderEvent;
                    }
                    instanceBuffer = value;
                    if (instanceBuffer != null)
                    {
                        instanceBuffer.OnElementChanged += InvalidateRenderEvent;
                    }
                }
            }
            get
            {
                return instanceBuffer;
            }
        }

        private IGeometryBufferModel geometryBuffer;
        /// <summary>
        ///
        /// </summary>
        public IGeometryBufferModel GeometryBuffer
        {
            set
            {
                if(geometryBuffer == value)
                {
                    return;
                }
                if(geometryBuffer != null)
                {
                    geometryBuffer.OnInvalidateRender -= InvalidateRenderEvent;
                }
                geometryBuffer = value;
                if (geometryBuffer != null)
                {
                    geometryBuffer.OnInvalidateRender += InvalidateRenderEvent;
                }
            }
            get { return geometryBuffer; }
        }

        private RasterizerStateDescription rasterDescription = new RasterizerStateDescription()
        {
            FillMode = FillMode.Solid,
            CullMode = CullMode.None,
        };
        /// <summary>
        ///
        /// </summary>
        public RasterizerStateDescription RasterDescription
        {
            set
            {
                if(SetAffectsRender(ref rasterDescription, value))
                {
                    CreateRasterState(value, false);
                }
            }
            get
            {
                return rasterDescription;
            }
        }

        private string defaultPassName = DefaultPassNames.Default;
        /// <summary>
        /// Name of the default pass inside a technique.
        /// <para>Default: <see cref="DefaultPassNames.Default"/></para>
        /// </summary>
        public string DefaultShaderPassName
        {
            set
            {
                if(Set(ref defaultPassName, value) && IsAttached)
                {
                    DefaultShaderPass = EffectTechnique[value];
                }
            }
            get
            {
                return defaultPassName;
            }
        }

        private string defaultShadowPassName = DefaultPassNames.ShadowPass;
        /// <summary>
        ///
        /// </summary>
        public string DefaultShadowPassName
        {
            set
            {
                if (Set(ref defaultShadowPassName, value) && IsAttached)
                {
                    ShadowPass = EffectTechnique[value];
                }
            }
            get
            {
                return defaultShadowPassName;
            }
        }
        private ShaderPass defaultShaderPass = ShaderPass.NullPass;
        /// <summary>
        ///
        /// </summary>
        protected ShaderPass DefaultShaderPass
        {
            private set
            {
                if(Set(ref defaultShaderPass, value))
                {
                    OnDefaultPassChanged(value);
                    InvalidateRenderer();
                }
            }
            get
            {
                return defaultShaderPass;
            }
        }

        private ShaderPass shadowPass = ShaderPass.NullPass;
        /// <summary>
        ///
        /// </summary>
        protected ShaderPass ShadowPass
        {
            private set
            {
                if(Set(ref shadowPass, value))
                {
                    OnShadowPassChanged(value);
                    InvalidateRenderer();
                }
            }
            get
            {
                return shadowPass;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GeometryRenderCore{MODELSTRUCT}"/> class.
        /// </summary>
        public GeometryRenderCore() : base(RenderType.Opaque) { }
        /// <summary>
        /// Initializes a new instance of the <see cref="GeometryRenderCore{MODELSTRUCT}"/> class.
        /// </summary>
        /// <param name="renderType">Type of the render.</param>
        public GeometryRenderCore(RenderType renderType) : base(renderType) { }
        /// <summary>
        ///
        /// </summary>
        /// <param name="description"></param>
        /// <param name="force"></param>
        /// <returns></returns>
        protected virtual bool CreateRasterState(RasterizerStateDescription description, bool force)
        {
            RemoveAndDispose(ref rasterState);
            RemoveAndDispose(ref invertCullModeState);
            rasterDescription = description;
            if (!IsAttached && !force)
            { return false; }
            rasterState = Collect(EffectTechnique.EffectsManager.StateManager.Register(description));
            if(description.CullMode != CullMode.None)
            {
                var invCull = description;
                invCull.CullMode = description.CullMode == CullMode.Back ? CullMode.Front : CullMode.Back;
                invertCullModeState = Collect(EffectTechnique.EffectsManager.StateManager.Register(invCull));
            }
            return true;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="technique"></param>
        /// <returns></returns>
        protected override bool OnAttach(IRenderTechnique technique)
        {
            if(base.OnAttach(technique))
            {
                DefaultShaderPass = technique[DefaultShaderPassName];
                ShadowPass = technique[DefaultShadowPassName];
                this.VertexLayout = technique.Layout;
                CreateRasterState(rasterDescription, true);
                return true;
            }
            return false;
        }

        protected override void OnDetach()
        {
            rasterState = null;
            invertCullModeState = null;
            base.OnDetach();
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="pass"></param>
        protected virtual void OnDefaultPassChanged(ShaderPass pass) { }
        /// <summary>
        ///
        /// </summary>
        /// <param name="pass"></param>
        protected virtual void OnShadowPassChanged(ShaderPass pass) { }
        /// <summary>
        /// Set all necessary states and buffers
        /// </summary>
        /// <param name="context"></param>
        /// <param name="isInvertCullMode"></param>
        protected override void OnBindRasterState(DeviceContextProxy context, bool isInvertCullMode)
        {
            if (isInvertCullMode && invertCullModeState != null)
            {
                context.SetRasterState(invertCullModeState);
            }
            else
            {
                context.SetRasterState(rasterState);
            }
        }
        /// <summary>
        /// Attach vertex buffer routine
        /// </summary>
        /// <param name="context"></param>
        /// <param name="vertStartSlot"></param>
        protected override void OnAttachBuffers(DeviceContext context, ref int vertStartSlot)
        {
            GeometryBuffer.AttachBuffers(context, this.VertexLayout, ref vertStartSlot, EffectTechnique.EffectsManager);
            InstanceBuffer?.AttachBuffer(context, ref vertStartSlot);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        protected override bool CanRender(RenderContext context)
        {
            return base.CanRender(context) && GeometryBuffer != null;
        }

        /// <summary>
        /// Draw call
        /// </summary>
        /// <param name="context"></param>
        /// <param name="instanceModel"></param>
        protected virtual void OnDraw(DeviceContext context, IElementsBufferModel instanceModel)
        {
            if (GeometryBuffer.IndexBuffer != null)
            {
                if (instanceModel == null || !instanceModel.HasElements)
                {
                    context.DrawIndexed(GeometryBuffer.IndexBuffer.ElementCount, GeometryBuffer.IndexBuffer.Offset, 0);
                }
                else
                {
                    context.DrawIndexedInstanced(GeometryBuffer.IndexBuffer.ElementCount, instanceModel.Buffer.ElementCount, GeometryBuffer.IndexBuffer.Offset, 0, instanceModel.Buffer.Offset);
                }
            }
            else if (GeometryBuffer.VertexBuffer.Length > 0)
            {
                if (instanceModel == null || !instanceModel.HasElements)
                {
                    context.Draw(GeometryBuffer.VertexBuffer[0].ElementCount, 0);
                }
                else
                {
                    context.DrawInstanced(GeometryBuffer.VertexBuffer[0].ElementCount, instanceModel.Buffer.ElementCount,
                        0, instanceModel.Buffer.Offset);
                }
            }
        }

        protected override void OnRenderShadow(RenderContext context, DeviceContextProxy deviceContext)
        {
            if (!IsThrowingShadow || ShadowPass.IsNULL)
            { return; }
            ShadowPass.BindShader(deviceContext);
            ShadowPass.BindStates(deviceContext, ShadowStateBinding);
            OnDraw(deviceContext, InstanceBuffer);
        }

        protected override void OnRenderCustom(RenderContext context, DeviceContextProxy deviceContext, ShaderPass shaderPass)
        {
            OnDraw(deviceContext, InstanceBuffer);
        }

        protected void InvalidateRenderEvent(object sender, EventArgs e)
        {
            InvalidateRenderer();
        }
    }
}


text:
import { Universe } from "../../core/Universe";

import { TOGGLE_CELL_STATE } from "../actions/worldviewActions";
import { RESET_EVOLUTION, NEXT_GENERATION, SUPER_GENERATION } from "../actions/evolutionActions";
import { IMPORT_DONE } from "../../import-lib";

export default function worldviewReducer(world = resetWorldview(), action = {}) {
    switch (action.type) {
        case TOGGLE_CELL_STATE:
            return toggleCell(world, action);

        case NEXT_GENERATION:
            return nextGeneration(world);

        case SUPER_GENERATION:
            return superGeneration(world);

        case RESET_EVOLUTION:
            return resetWorldview();

        case IMPORT_DONE:
            return { ...resetWorldview(), root: action.root };
    }

    return world;
}

function toggleCell({ root, generation }, { x, y }) {
    const nextUniverse = Universe(root, generation).toggleCell(x, y);
    return serialize(nextUniverse);
}

function nextGeneration({ root, generation }) {
    const nextUniverse = Universe(root, generation).evolve();
    return serialize(nextUniverse);
}

function superGeneration({ root, generation }) {
    const nextUniverse = Universe(root, generation).superEvolve();
    return serialize(nextUniverse);
}

function resetWorldview() {
    return serialize(Universe.create());
}

function serialize({ root, generation }) {
    return { root, generation };
}


text:
<?xml version="1.0"?>
<Document>

	<Sentence>
		<value>Dermatoses is a general term used to describe any skin defect or lesion on the skin.</value>
		<pattern_crowdsource> [[Dermatoses|C0037274]] is a [[general term|C0278060]] used to describe any skin defect or lesion on the skin.		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>Dermatoses</surface-form>
				<RDF-ID>C0037274</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>general term</surface-form>
				<RDF-ID>C0278060</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>skin</surface-form>
				<RDF-ID>C0037267</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>defect</surface-form>
				<RDF-ID>C1457869</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>lesion</surface-form>
				<RDF-ID>C0221198</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>skin</surface-form>
				<RDF-ID>C0037267</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0037274 ISA C0278060</triple>
		</triples>
	</Sentence>
	<Sentence>
		<value>Systemic dermatoses may be linked to problems in other organs.</value>
		<pattern_crowdsource> Systemic [[dermatoses|C0037274]] may be linked to problems in other [[organs|C0178784]].		</pattern_crowdsource>
		<annotations>
			<annotation>
				<surface-form>Systemic</surface-form>
				<RDF-ID>C0205373</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>dermatoses</surface-form>
				<RDF-ID>C0037274</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>problems</surface-form>
				<RDF-ID>C1546466</RDF-ID>
			</annotation>
			<annotation>
				<surface-form>organs</surface-form>
				<RDF-ID>C0178784</RDF-ID>
			</annotation>
		</annotations>
		<triples>
			<triple>C0178784 LOCATION_OF C0037274</triple>
		</triples>
	</Sentence>

</Document>


text:
def turn_on_lights(lights, begin, end):
    for x in range(begin[0], end[0]+1):
        for y in range(begin[1], end[1]+1):
            lights[x][y] = True

def turn_off_lights(lights, begin, end):
    for x in range(begin[0], end[0]+1):
        for y in range(begin[1], end[1]+1):
            lights[x][y] = False

def toggle_lights(lights, begin, end):
    for x in range(begin[0], end[0]+1):
        for y in range(begin[1], end[1]+1):
            if lights[x][y]: lights[x][y] = False
            else: lights[x][y] = True

def coordinate_from_string(s):
    return tuple([int(x) for x in s.split(",")])

def lit_lights(lights):
    return sum(row.count(True) for row in lights)

def all_lights_off():
    return [([False] * 1000).copy() for x in range(0,1000)]

def main():
    lights = all_lights_off()
    with open("Day6.txt") as f:
        for command in [l.rstrip() for l in f.readlines()]:
            parts = command.split(" ")
            begin = coordinate_from_string(parts[-3])
            end = coordinate_from_string(parts[-1])
            if command.startswith("toggle"): toggle_lights(lights, begin, end)
            if parts[1] == "on": turn_on_lights(lights, begin, end)
            if parts[1] == "off": turn_off_lights(lights, begin, end)
    print("Lit lights: %d" % (lit_lights(lights),))

if __name__ == "__main__":
    main()


text:
#ifndef NGX_HTTP_INFO_RESPONSE_H
#define NGX_HTTP_INFO_RESPONSE_H

ngx_int_t ngx_http_info_build_response(ngx_str_t *response, ngx_http_info_response_format_t response_format, size_t response_buffer_size);

#endif /* NGX_HTTP_INFO_RESPONSE_H */