text:
'use strict';

const test = require('tape');
const mavencc = require('../index');
const fs = require('fs');

test('basic artifact search.', (t) => {
  mavencc.basicArtifactSearch('wildfly-swarm', 3)
    .then(response => {
      const artifact = JSON.parse(response.body).response.docs[0].a;
      t.equal(artifact, 'wildfly-swarm', 'wildfly-swarm found.');
      t.end();
    })
    .catch(e => {
      console.error(e.stack);
      t.fail(e);
    });
});

test('artifact search.', (t) => {
  mavencc.artifactSearch('wildfly-swarm', 3)
    .then(response => {
      const artifact = JSON.parse(response.body).response.docs[0].a;
      t.equal(artifact, 'wildfly-swarm', 'wildfly-swarm found.');
      t.end();
    })
    .catch(e => {
      console.error(e.stack);
      t.fail(e);
    });
});

test('list versions.', (t) => {
  mavencc.listVersions('org.wildfly.swarm', 'wildfly-swarm', 5)
    .then(response => {
      const artifact = JSON.parse(response.body).response.docs[0].a;
      t.equal(artifact, 'wildfly-swarm', 'wildfly-swarm found.');
      t.end();
    })
    .catch(e => {
      console.error(e.stack);
      t.fail(e);
    });
});

test('artifacts by groupId.', (t) => {
  mavencc.artifactsByGroupId('org.wildfly.swarm', 5)
    .then(response => {
      const artifact = JSON.parse(response.body).response.docs[4].a;
      t.equal(artifact, 'testsuite', 'testsuite found.');
      t.end();
    })
    .catch(e => {
      console.error(e.stack);
      t.fail(e);
    });
});

test('artifacts by className.', (t) => {
  mavencc.artifactByClassname('junit', 5)
    .then(response => {
      const artifact = JSON.parse(response.body).response.docs[4].a;
      t.equal(artifact, 'junit', 'junit found.');
      t.end();
    })
    .catch(e => {
      console.error(e.stack);
      t.fail(e);
    });
});

test('artifacts by fully-classname.', (t) => {
  mavencc.artifactByFullyClassname('org.specs.runner.JUnit', 5)
    .then(response => {
      const artifact = JSON.parse(response.body).response.docs[0].a;
      t.notEqual(artifact, '', 'one result was found');
      t.end();
    })
    .catch(e => {
      console.error(e.stack);
      t.fail(e);
    });
});

test('artifacts by sha1.', (t) => {
  mavencc.artifactBySHA1('35379fb6526fd019f331542b4e9ae2e566c57933', 5)
    .then(response => {
      const artifact = JSON.parse(response.body).response.docs[0].a;
      t.equal(artifact, 'jetty-webapp', 'jetty-webapp found.');
      t.end();
    })
    .catch(e => {
      console.error(e.stack);
      t.fail(e);
    });
});

test('list tags', (t) => {
  mavencc.searchTags('sbtplugin', 5)
    .then(response => {
      const artifact = JSON.parse(response.body).response.docs[0].a;
      t.notEqual(artifact, '', 'one result was found');
      t.end();
    })
    .catch(e => {
      console.error(e.stack);
      t.fail(e);
    });
});

test('should download artifact', (t) => {
  mavencc.downloadArtifact('com/jolira/guice/3.0.0/guice-3.0.0.pom', '/tmp/guice.pom')
    .then(x => {
      try {
        t.equal(fs.statSync('/tmp/guice.pom').isFile(), true, 'File found.');
      } catch (e) {
        console.error(e);
        t.fail(e);
      }
      t.end();
    });
});


text:
import crypto from 'crypto';

import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';

import { settings } from '../../../settings/server';
import { TOTPCheck } from './TOTPCheck';
import { EmailCheck } from './EmailCheck';
import { PasswordCheckFallback } from './PasswordCheckFallback';
import { IUser } from '../../../../definition/IUser';
import { ICodeCheck } from './ICodeCheck';
import { Users } from '../../../models/server';
import { IMethodConnection } from '../../../../definition/IMethodThisType';

export interface ITwoFactorOptions {
	disablePasswordFallback?: boolean;
	disableRememberMe?: boolean;
	requireSecondFactor?: boolean; // whether any two factor should be required
}

export const totpCheck = new TOTPCheck();
export const emailCheck = new EmailCheck();
export const passwordCheckFallback = new PasswordCheckFallback();

export const checkMethods = new Map<string, ICodeCheck>();

checkMethods.set(totpCheck.name, totpCheck);
checkMethods.set(emailCheck.name, emailCheck);

export function getMethodByNameOrFirstActiveForUser(user: IUser, name?: string): ICodeCheck | undefined {
	if (name && checkMethods.has(name)) {
		return checkMethods.get(name);
	}

	return Array.from(checkMethods.values()).find((method) => method.isEnabled(user));
}

export function getAvailableMethodNames(user: IUser): string[] | [] {
	return Array.from(checkMethods).filter(([, method]) => method.isEnabled(user)).map(([name]) => name) || [];
}

export function getUserForCheck(userId: string): IUser {
	return Users.findOneById(userId, {
		fields: {
			emails: 1,
			language: 1,
			createdAt: 1,
			'services.totp': 1,
			'services.email2fa': 1,
			'services.emailCode': 1,
			'services.password': 1,
			'services.resume.loginTokens': 1,
		},
	});
}

export function getFingerprintFromConnection(connection: IMethodConnection): string {
	const data = JSON.stringify({
		userAgent: connection.httpHeaders['user-agent'],
		clientAddress: connection.clientAddress,
	});

	return crypto.createHash('md5').update(data).digest('hex');
}

function getRememberDate(from: Date = new Date()): Date | undefined {
	const rememberFor = parseInt(settings.get('Accounts_TwoFactorAuthentication_RememberFor') as string, 10);

	if (rememberFor <= 0) {
		return;
	}

	const expires = new Date(from);
	expires.setSeconds(expires.getSeconds() + rememberFor);

	return expires;
}

export function isAuthorizedForToken(connection: IMethodConnection, user: IUser, options: ITwoFactorOptions): boolean {
	const currentToken = Accounts._getLoginToken(connection.id);
	const tokenObject = user.services?.resume?.loginTokens?.find((i) => i.hashedToken === currentToken);

	if (!tokenObject) {
		return false;
	}

	// if any two factor is required, early abort
	if (options.requireSecondFactor) {
		return false;
	}

	if (tokenObject.bypassTwoFactor === true) {
		return true;
	}

	if (options.disableRememberMe === true) {
		return false;
	}

	// remember user right after their registration
	const rememberAfterRegistration = user.createdAt && getRememberDate(user.createdAt);
	if (rememberAfterRegistration && rememberAfterRegistration >= new Date()) {
		return true;
	}

	if (!tokenObject.twoFactorAuthorizedUntil || !tokenObject.twoFactorAuthorizedHash) {
		return false;
	}

	if (tokenObject.twoFactorAuthorizedUntil < new Date()) {
		return false;
	}

	if (tokenObject.twoFactorAuthorizedHash !== getFingerprintFromConnection(connection)) {
		return false;
	}

	return true;
}

export function rememberAuthorization(connection: IMethodConnection, user: IUser): void {
	const currentToken = Accounts._getLoginToken(connection.id);

	const expires = getRememberDate();
	if (!expires) {
		return;
	}

	Users.setTwoFactorAuthorizationHashAndUntilForUserIdAndToken(user._id, currentToken, getFingerprintFromConnection(connection), expires);
}

interface ICheckCodeForUser {
	user: IUser | string;
	code?: string;
	method?: string;
	options?: ITwoFactorOptions;
	connection?: IMethodConnection;
}

const getSecondFactorMethod = (user: IUser, method: string | undefined, options: ITwoFactorOptions): ICodeCheck | undefined => {
	// try first getting one of the available methods or the one that was already provided
	const selectedMethod = getMethodByNameOrFirstActiveForUser(user, method);
	if (selectedMethod) {
		return selectedMethod;
	}

	// if none found but a second factor is required, chose the password check
	if (options.requireSecondFactor) {
		return passwordCheckFallback;
	}

	// check if password fallback is enabled
	if (!options.disablePasswordFallback && passwordCheckFallback.isEnabled(user, !!options.requireSecondFactor)) {
		return passwordCheckFallback;
	}
};

export function checkCodeForUser({ user, code, method, options = {}, connection }: ICheckCodeForUser): boolean {
	if (process.env.TEST_MODE && !options.requireSecondFactor) {
		return true;
	}

	if (typeof user === 'string') {
		user = getUserForCheck(user);
	}

	if (!code && !method && connection?.httpHeaders?.['x-2fa-code'] && connection.httpHeaders['x-2fa-method']) {
		code = connection.httpHeaders['x-2fa-code'];
		method = connection.httpHeaders['x-2fa-method'];
	}

	if (connection && isAuthorizedForToken(connection, user, options)) {
		return true;
	}

	// select a second factor method or return if none is found/available
	const selectedMethod = getSecondFactorMethod(user, method, options);
	if (!selectedMethod) {
		return true;
	}

	if (!code) {
		const data = selectedMethod.processInvalidCode(user);
		const availableMethods = getAvailableMethodNames(user);

		throw new Meteor.Error('totp-required', 'TOTP Required', { method: selectedMethod.name, ...data, availableMethods });
	}

	const valid = selectedMethod.verify(user, code, options.requireSecondFactor);

	if (!valid) {
		throw new Meteor.Error('totp-invalid', 'TOTP Invalid', { method: selectedMethod.name });
	}

	if (options.disableRememberMe !== true && connection) {
		rememberAuthorization(connection, user);
	}

	return true;
}

redpajama_set_name: RedPajamaGithub


text:
'use strict';
module.exports = PasswordValidator;

const auth = require('auth-utilities');

const ErrorFactory = require('simple-error-factory');
const AuthError = ErrorFactory('auth');
const status = { code: 401 };

function PasswordValidator(findUser, secret, rounds) {
  /**
   * @param {Function} findUser - Promise that resolves with:
   *    {payload, hash, plain}
   *    payload === for encoding as a JWT
   *    hash === user's hashed password
   *    plain === user's plaintext password parsed from req
   * @param {String} secret - secret for encoding JWT
   * @param {Number} rounds - bcrypt rounds
   *
   * @returns {Promise} resolve with token, reject with error
   */

  if (!findUser || !secret) {
    throw new ReferenceError('findUser or secret undefined');
  }

  if (typeof findUser !== 'function') {
    throw new TypeError('findUser not a function');
  }

  if (typeof secret !== 'string') {
    throw new TypeError('secret not a string');
  }

  var password = auth.password(rounds);
  var generateToken = auth.token(secret).generate;

  return function(req) {

    return new Promise(function(resolve, reject) {

      findUser(req).then(function(user) {
        // {payload, hash, plain, data}
        password.check(user.plain, user.hash)
        // nested because #check resolves with a bool...
        .then(function(isValid) {
          if (isValid) {
            resolve({
              token: generateToken(user.payload),
              data: user.data
            });
          } else {
            reject(AuthError('Bad password', status));
          }
        });
      })
      .catch(function(err) {
        reject(err);
      });

    });
  }

}


text:
module VagrantPlugins
  module GuestALT
    module Cap
      class RSync
        def self.rsync_install(machine)
          machine.communicate.sudo <<-EOH.gsub(/^ {12}/, '')
            apt-get install -y -qq install rsync
          EOH
        end
      end
    end
  end
end


text:
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#define __STDC_LIMIT_MACROS

#include <algorithm>
#include <set>

#include <bmx/mxf_reader/MXFGroupReader.h>
#include <bmx/mxf_reader/MXFFileReader.h>
#include <bmx/Utils.h>
#include <bmx/BMXException.h>
#include <bmx/Logging.h>

using namespace std;
using namespace bmx;
using namespace mxfpp;

#define CONVERT_GROUP_DUR(dur)   convert_duration_higher(dur, mSampleSequences[i], mSampleSequenceSizes[i])
#define CONVERT_MEMBER_DUR(dur)  convert_duration_lower(dur, mSampleSequences[i], mSampleSequenceSizes[i])
#define CONVERT_GROUP_POS(pos)   convert_position_higher(pos, mSampleSequences[i], mSampleSequenceSizes[i])
#define CONVERT_MEMBER_POS(pos)  convert_position_lower(pos, mSampleSequences[i], mSampleSequenceSizes[i])

typedef struct
{
    size_t index;
    MXFTrackReader *track_reader;
} GroupTrackReader;

static bool compare_group_track_reader(const GroupTrackReader &left_reader, const GroupTrackReader &right_reader)
{
    const MXFTrackInfo *left_info = left_reader.track_reader->GetTrackInfo();
    const MXFTrackInfo *right_info = right_reader.track_reader->GetTrackInfo();

    // material package
    if (left_info->material_package_uid != right_info->material_package_uid)
        return left_reader.index < right_reader.index;

    // data kind
    if (left_info->data_def != right_info->data_def)
        return left_info->data_def < right_info->data_def;

    // track number
    if (left_info->material_track_number != 0) {
        return right_info->material_track_number == 0 ||
               left_info->material_track_number < right_info->material_track_number;
    }
    if (right_info->material_track_number != 0)
        return false;

    // track id
    if (left_info->material_track_id != 0) {
        return right_info->material_track_id == 0 ||
               left_info->material_track_id < right_info->material_track_id;
    }
    return right_info->material_track_id == 0;
}

MXFGroupReader::MXFGroupReader()
: MXFReader()
{
    mEmptyFrames = false;
    mEmptyFramesSet = false;
    mReadStartPosition = 0;
    mReadDuration = -1;
}

MXFGroupReader::~MXFGroupReader()
{
    size_t i;
    for (i = 0; i < mReaders.size(); i++)
        delete mReaders[i];
}

void MXFGroupReader::SetEmptyFrames(bool enable)
{
    mEmptyFrames = enable;
    mEmptyFramesSet = true;

    size_t i;
    for (i = 0; i < mTrackReaders.size(); i++)
        mTrackReaders[i]->SetEmptyFrames(enable);
}

void MXFGroupReader::SetFileIndex(MXFFileIndex *file_index, bool take_ownership)
{
    MXFReader::SetFileIndex(file_index, take_ownership);

    size_t i;
    for (i = 0; i < mReaders.size(); i++)
        mReaders[i]->SetFileIndex(file_index, false);
}

void MXFGroupReader::AddReader(MXFReader *reader)
{
    reader->SetFileIndex(mFileIndex, false);
    reader->SetMCALabelIndex(mMCALabelIndex, false);
    mReaders.push_back(reader);
}

bool MXFGroupReader::Finalize()
{
    try
    {
        if (mReaders.empty()) {
            log_error("Group reader has no members\n");
            throw false;
        }

        // the lowest input edit rate is the group edit rate
        float lowest_edit_rate = 1000000.0;
        size_t i;
        for (i = 0; i < mReaders.size(); i++) {
            float member_edit_rate = mReaders[i]->GetEditRate().numerator /
                                        (float)mReaders[i]->GetEditRate().denominator;
            if (member_edit_rate < lowest_edit_rate) {
                mEditRate = mReaders[i]->GetEditRate();
                lowest_edit_rate = member_edit_rate;
            }
        }
        BMX_CHECK(mEditRate.numerator != 0);

        // create temporary group track readers and sort according to material package, data kind, track number and track id
        vector<GroupTrackReader> group_track_readers;
        GroupTrackReader group_track_reader;
        size_t j;
        for (i = 0; i < mReaders.size(); i++) {
            for (j = 0; j < mReaders[i]->GetNumTrackReaders(); j++) {
                group_track_reader.index = i;
                group_track_reader.track_reader = mReaders[i]->GetTrackReader(j);
                group_track_readers.push_back(group_track_reader);
            }
        }
        stable_sort(group_track_readers.begin(), group_track_readers.end(), compare_group_track_reader);

        // create track readers from sorted list
        for (i = 0; i < group_track_readers.size(); i++)
            mTrackReaders.push_back(group_track_readers[i].track_reader);

        // extract the sample sequences for each reader. The samples sequences determine how many member samples
        // are read for each group sample. They are also used for converting position and durations
        for (i = 0; i < mReaders.size(); i++) {
            vector<uint32_t> sample_sequence;
            if (!get_sample_sequence(mEditRate, mReaders[i]->GetEditRate(), &sample_sequence)) {
                mxfRational member_edit_rate = mReaders[i]->GetEditRate();
                log_error("Incompatible group edit rate (%d/%d) and member edit rate (%d/%d)\n",
                          mEditRate.numerator, mEditRate.denominator,
                          member_edit_rate.numerator, member_edit_rate.denominator);
                throw false;
            }

            mSampleSequences.push_back(sample_sequence);
            mSampleSequenceSizes.push_back(get_sequence_size(sample_sequence));
        }

        // group duration is the minimum member duration
        mDuration = -1;
        for (i = 0; i < mReaders.size(); i++) {
            if (mReaders[i]->GetDuration() < 0) {
                mDuration = -1;
                break;
            }

            int64_t member_duration = CONVERT_MEMBER_DUR(mReaders[i]->GetDuration());
            if (mDuration < 0 || member_duration < mDuration)
                mDuration = member_duration;
        }

        // group origin is the maximum member origin
        mOrigin = 0;
        for (i = 0; i < mReaders.size(); i++) {
            int64_t member_origin = CONVERT_MEMBER_POS(mReaders[i]->GetOrigin());
            if (member_origin > mOrigin)
                mOrigin = member_origin;
        }

        // set group timecodes and package infos if all members have the same values
        for (i = 0; i < mReaders.size(); i++) {
            if (i == 0) {
                if (mReaders[i]->mMaterialStartTimecode)
                    mMaterialStartTimecode = new Timecode(*mReaders[i]->mMaterialStartTimecode);
                if (mReaders[i]->mFileSourceStartTimecode)
                    mFileSourceStartTimecode = new Timecode(*mReaders[i]->mFileSourceStartTimecode);
                if (mReaders[i]->mPhysicalSourceStartTimecode)
                    mPhysicalSourceStartTimecode = new Timecode(*mReaders[i]->mPhysicalSourceStartTimecode);
                mMaterialPackageName = mReaders[i]->mMaterialPackageName;
                mMaterialPackageUID = mReaders[i]->mMaterialPackageUID;
                mPhysicalSourcePackageName = mReaders[i]->mPhysicalSourcePackageName;
                mMaterialPackage = mReaders[i]->GetMaterialPackage();
            } else {
    #define CHECK_TIMECODE(tc_var) \
                if ((tc_var != 0) != (mReaders[i]->tc_var != 0) || \
                    (tc_var && *tc_var != *mReaders[i]->tc_var)) \
                { \
                    delete tc_var; \
                    tc_var = 0; \
                }
                CHECK_TIMECODE(mMaterialStartTimecode)
                CHECK_TIMECODE(mFileSourceStartTimecode)
                CHECK_TIMECODE(mPhysicalSourceStartTimecode)
                if (mMaterialPackageName != mReaders[i]->mMaterialPackageName)
                    mMaterialPackageName.clear();
                if (mMaterialPackageUID != mReaders[i]->mMaterialPackageUID) {
                    mMaterialPackageUID = g_Null_UMID;
                    mMaterialPackage = 0;
                }
                if (mPhysicalSourcePackageName != mReaders[i]->mPhysicalSourcePackageName)
                    mPhysicalSourcePackageName.clear();
            }
        }

        // collect together all text objects
        for (i = 0; i < mReaders.size(); i++) {
            size_t k;
            for (k = 0; k < mReaders[i]->GetNumTextObjects(); k++)
                mTextObjects.push_back(mReaders[i]->GetTextObject(k));
        }

        if (IsComplete()) {
            if (GetMaxPrecharge(0, true) != GetMaxPrecharge(0, false)) {
                log_warn("Possibly not enough precharge available in group (available=%d, required=%d)\n",
                         GetMaxPrecharge(0, true), GetMaxPrecharge(0, false));
            }
            if (GetMaxRollout(mDuration - 1, true) != GetMaxRollout(mDuration - 1, false)) {
                log_warn("Possibly not enough rollout available in group (available=%d, required=%d)\n",
                         GetMaxRollout(mDuration - 1, true), GetMaxRollout(mDuration - 1, false));
            }

            SetReadLimits();
        } else if (mDuration > 0) {
            SetReadLimits(- mOrigin, mOrigin + mDuration, false);
        }

        if (mEmptyFramesSet) {
            for (i = 0; i < mTrackReaders.size(); i++)
                mTrackReaders[i]->SetEmptyFrames(mEmptyFrames);
        }

        return true;
    }
    catch (const bool &err)
    {
        (void)err;

        size_t i;
        for (i = 0; i < mTrackReaders.size(); i++)
            delete mTrackReaders[i];
        mTrackReaders.clear();

        mSampleSequences.clear();
        mSampleSequenceSizes.clear();
        mDuration = 0;

        return false;
    }
}

MXFFileReader* MXFGroupReader::GetFileReader(size_t file_id)
{
    MXFFileReader *reader = 0;
    size_t i;
    for (i = 0; i < mReaders.size(); i++) {
        reader = mReaders[i]->GetFileReader(file_id);
        if (reader)
            break;
    }

    return reader;
}

vector<size_t> MXFGroupReader::GetFileIds(bool internal_ess_only) const
{
    set<size_t> file_id_set;
    size_t i;
    for (i = 0; i < mTrackReaders.size(); i++) {
        vector<size_t> track_file_ids = mTrackReaders[i]->GetFileIds(internal_ess_only);
        file_id_set.insert(track_file_ids.begin(), track_file_ids.end());
    }

    vector<size_t> file_ids;
    file_ids.insert(file_ids.begin(), file_id_set.begin(), file_id_set.end());

    return file_ids;
}

bool MXFGroupReader::IsComplete() const
{
    size_t i;
    for (i = 0; i < mReaders.size(); i++) {
        if (!mReaders[i]->IsComplete())
            return false;
    }

    return true;
}

bool MXFGroupReader::IsSeekable() const
{
    size_t i;
    for (i = 0; i < mReaders.size(); i++) {
        if (!mReaders[i]->IsSeekable())
            return false;
    }

    return true;
}

void MXFGroupReader::GetReadLimits(bool limit_to_available, int64_t *start_position, int64_t *duration) const
{
    int16_t precharge = GetMaxPrecharge(0, limit_to_available);
    int16_t rollout = GetMaxRollout(mDuration - 1, limit_to_available);
    *start_position = 0 + precharge;
    *duration = - precharge + mDuration + rollout;
}

void MXFGroupReader::SetReadLimits()
{
    int64_t start_position;
    int64_t duration;
    GetReadLimits(false, &start_position, &duration);
    SetReadLimits(start_position, duration, true);
}

void MXFGroupReader::SetReadLimits(int64_t start_position, int64_t duration, bool seek_start_position)
{
    mReadStartPosition = start_position;
    mReadDuration = duration;

    size_t i;
    for (i = 0; i < mReaders.size(); i++) {
        if (!mReaders[i]->IsEnabled())
            continue;

        int64_t member_start_position = CONVERT_GROUP_POS(start_position);
        int64_t member_duration;
        if (duration == 0)
            member_duration = 0;
        else
            member_duration = CONVERT_GROUP_DUR(start_position + duration) - member_start_position;
        mReaders[i]->SetReadLimits(member_start_position, member_duration, false);
    }

    if (seek_start_position)
        Seek(start_position);
}

uint32_t MXFGroupReader::Read(uint32_t num_samples, bool is_top)
{
    mReadError = false;
    mReadErrorMessage.clear();

    int64_t current_position = GetPosition();

    StartRead();
    try
    {
        if (is_top) {
            SetNextFramePosition(mEditRate, current_position);
            SetNextFrameTrackPositions();
        }

        uint32_t max_read_num_samples = 0;
        size_t i;
        for (i = 0; i < mReaders.size(); i++) {
            if (!mReaders[i]->IsEnabled())
                continue;

            int64_t member_current_position = CONVERT_GROUP_POS(current_position);

            // ensure external reader is in sync
            if (mReaders[i]->GetPosition() != member_current_position)
                mReaders[i]->Seek(member_current_position);

            uint32_t member_num_samples = (uint32_t)convert_duration_higher(num_samples,
                                                                            current_position,
                                                                            mSampleSequences[i],
                                                                            mSampleSequenceSizes[i]);

            uint32_t member_num_read = mReaders[i]->Read(member_num_samples, false);
            if (member_num_read < member_num_samples && mReaders[i]->ReadError())
                throw BMXException(mReaders[i]->ReadErrorMessage());

            uint32_t group_num_read = (uint32_t)convert_duration_lower(member_num_read,
                                                                       member_current_position,
                                                                       mSampleSequences[i],
                                                                       mSampleSequenceSizes[i]);

            if (group_num_read > max_read_num_samples)
                max_read_num_samples = group_num_read;
        }

        CompleteRead();

        return max_read_num_samples;
    }
    catch (const MXFException &ex)
    {
        mReadErrorMessage = ex.getMessage();
    }
    catch (const BMXException &ex)
    {
        mReadErrorMessage = ex.what();
    }
    catch (...)
    {
    }

    mReadError = true;
    AbortRead();
    Seek(current_position);

    return 0;
}

void MXFGroupReader::Seek(int64_t position)
{
    size_t i;
    for (i = 0; i < mReaders.size(); i++) {
        if (!mReaders[i]->IsEnabled())
            continue;

        mReaders[i]->Seek(CONVERT_GROUP_POS(position));
    }
}

int64_t MXFGroupReader::GetPosition() const
{
    size_t i;
    for (i = 0; i < mReaders.size(); i++) {
        if (!mReaders[i]->IsEnabled())
            continue;

        return CONVERT_MEMBER_POS(mReaders[i]->GetPosition());
    }

    return 0;
}

int16_t MXFGroupReader::GetMaxPrecharge(int64_t position, bool limit_to_available) const
{
    int64_t max_precharge = 0;

    int64_t max_start_position = INT64_MIN;
    size_t i;
    for (i = 0; i < mReaders.size(); i++) {
        if (!mReaders[i]->IsEnabled())
            continue;

        int16_t precharge = mReaders[i]->GetMaxPrecharge(CONVERT_GROUP_POS(position), limit_to_available);
        if (precharge != 0) {
            BMX_CHECK_M(mReaders[i]->GetEditRate() == mEditRate,
                        ("Currently only support precharge in group members if "
                         "member edit rate equals group edit rate"));
            if (precharge < max_precharge)
                max_precharge = precharge;
        }

        if (limit_to_available) {
            int64_t mem_start_position, mem_duration;
            mReaders[i]->GetReadLimits(true, &mem_start_position, &mem_duration);
            int64_t mem_max_start_position = CONVERT_MEMBER_POS(mem_start_position);
            if (mem_max_start_position > max_start_position)
                max_start_position = mem_max_start_position;
        }
    }

    if (limit_to_available && max_precharge < max_start_position - position)
        max_precharge = max_start_position - position;

    return max_precharge < 0 ? (int16_t)max_precharge : 0;
}

int16_t MXFGroupReader::GetMaxRollout(int64_t position, bool limit_to_available) const
{
    int64_t max_rollout = 0;

    int64_t min_end_position = INT64_MAX;
    size_t i;
    for (i = 0; i < mReaders.size(); i++) {
        if (!mReaders[i]->IsEnabled())
            continue;

        int16_t rollout = mReaders[i]->GetMaxRollout(CONVERT_GROUP_POS(position + 1) - 1, limit_to_available);
        if (rollout != 0) {
            BMX_CHECK_M(mReaders[i]->GetEditRate() == mEditRate,
                        ("Currently only support rollout in group members if "
                         "member edit rate equals group edit rate"));
            if (rollout > max_rollout)
                max_rollout = rollout;
        }

        if (limit_to_available) {
            int64_t mem_start_position, mem_duration;
            mReaders[i]->GetReadLimits(true, &mem_start_position, &mem_duration);
            int64_t mem_min_end_position = CONVERT_MEMBER_DUR(mem_start_position + mem_duration);
            if (mem_min_end_position < min_end_position)
                min_end_position = mem_min_end_position;
        }
    }

    if (limit_to_available && max_rollout > min_end_position - position)
        max_rollout = min_end_position - position;

    return max_rollout > 0 ? (int16_t)max_rollout : 0;
}

bool MXFGroupReader::HaveFixedLeadFillerOffset() const
{
    int64_t fixed_offset = -1;
    size_t i;
    for (i = 0; i < mReaders.size(); i++) {
        if (!mReaders[i]->IsEnabled())
            continue;

        if (!mReaders[i]->HaveFixedLeadFillerOffset())
            return false;

        int64_t reader_fixed_offset = CONVERT_MEMBER_POS(mReaders[i]->GetFixedLeadFillerOffset());
        if (fixed_offset == -1)
            fixed_offset = reader_fixed_offset;
        else if (fixed_offset != reader_fixed_offset)
            return false;
    }

    return true;
}

int64_t MXFGroupReader::GetFixedLeadFillerOffset() const
{
    int64_t fixed_offset = -1;
    size_t i;
    for (i = 0; i < mReaders.size(); i++) {
        if (!mReaders[i]->IsEnabled())
            continue;

        if (!mReaders[i]->HaveFixedLeadFillerOffset())
            return 0;

        int64_t reader_fixed_offset = CONVERT_MEMBER_POS(mReaders[i]->GetFixedLeadFillerOffset());
        if (fixed_offset == -1)
            fixed_offset = reader_fixed_offset;
        else if (fixed_offset != reader_fixed_offset)
            return 0;
    }

    return fixed_offset >= 0 ? fixed_offset : 0;
}

MXFTrackReader* MXFGroupReader::GetTrackReader(size_t track_index) const
{
    BMX_CHECK(track_index < mTrackReaders.size());
    return mTrackReaders[track_index];
}

bool MXFGroupReader::IsEnabled() const
{
    size_t i;
    for (i = 0; i < mReaders.size(); i++) {
        if (mReaders[i]->IsEnabled())
            return true;
    }

    return false;
}

int16_t MXFGroupReader::GetTrackPrecharge(size_t track_index, int64_t clip_position, int16_t clip_precharge) const
{
    if (clip_precharge >= 0)
        return 0;

    MXFTrackReader *track_reader = GetTrackReader(track_index);

    BMX_CHECK_M(track_reader->GetEditRate() == mEditRate,
                ("Currently only support precharge in group members if "
                 "member edit rate equals group edit rate"));
    (void)clip_position;

    return clip_precharge;
}

int16_t MXFGroupReader::GetTrackRollout(size_t track_index, int64_t clip_position, int16_t clip_rollout) const
{
    if (clip_rollout <= 0)
        return 0;

    MXFTrackReader *track_reader = GetTrackReader(track_index);

    BMX_CHECK_M(track_reader->GetEditRate() == mEditRate,
                ("Currently only support rollout in group members if "
                 "member edit rate equals group edit rate"));
    (void)clip_position;

    return clip_rollout;
}

MXFTextObject* MXFGroupReader::GetTextObject(size_t index) const
{
    BMX_CHECK(index < mTextObjects.size());
    return mTextObjects[index];
}

void MXFGroupReader::SetNextFramePosition(Rational edit_rate, int64_t position)
{
    size_t i;
    for (i = 0; i < mReaders.size(); i++) {
        if (mReaders[i]->IsEnabled())
            mReaders[i]->SetNextFramePosition(edit_rate, position);
    }
}

void MXFGroupReader::SetNextFrameTrackPositions()
{
    size_t i;
    for (i = 0; i < mReaders.size(); i++) {
        if (mReaders[i]->IsEnabled())
            mReaders[i]->SetNextFrameTrackPositions();
    }
}

void MXFGroupReader::SetTemporaryFrameBuffer(bool enable)
{
    size_t i;
    for (i = 0; i < mReaders.size(); i++)
        mReaders[i]->SetTemporaryFrameBuffer(enable);
}

void MXFGroupReader::StartRead()
{
    size_t i;
    for (i = 0; i < mTrackReaders.size(); i++) {
        if (mTrackReaders[i]->IsEnabled())
            mTrackReaders[i]->GetMXFFrameBuffer()->StartRead();
    }
}

void MXFGroupReader::CompleteRead()
{
    size_t i;
    for (i = 0; i < mTrackReaders.size(); i++) {
        if (mTrackReaders[i]->IsEnabled())
            mTrackReaders[i]->GetMXFFrameBuffer()->CompleteRead();
    }
}

void MXFGroupReader::AbortRead()
{
    size_t i;
    for (i = 0; i < mTrackReaders.size(); i++) {
        if (mTrackReaders[i]->IsEnabled())
            mTrackReaders[i]->GetMXFFrameBuffer()->AbortRead();
    }
}


text:
import React from 'react';
import axios from 'axios';
import autobind from 'class-autobind';
import { connect } from '../../../store';
import getClassMethods from '../../../helpers/get-class-methods';
import { buildClientSchema, parse, print } from 'graphql';
import cuid from 'cuid';
import { initialState } from '../redux/redux-query';
import { initialState as formsInitialState } from '../../forms/redux/redux-forms';

class GraphiQLContainer extends React.Component {
  constructor () {
    super(...arguments);
    autobind(this);

    this.query = {
      id: null,
      collection: { value: this.props.forms.saveForm.fields.collection.value },
      query: '',
      variables: ''
    };
  }

  componentWillMount () {
    const {
      createQueryCollections,
      createQueryHistory,
      getQueries,
      selectedQuery
    } = this.props;

    const endpoint = selectedQuery.endpoint;

    if (endpoint && endpoint.trim() !== '') {
      // fetch graphql schema
      this.getGraphQLSchema(endpoint);

      // fetch queries and history from server
      getQueries().payload
        .then(response => {
          if (response.data.ideQueryFindAll) {
            createQueryCollections(response.data.ideQueryFindAll);
          }

          if (response.data.ideQueryHistoryFindAll) {
            createQueryHistory(response.data.ideQueryHistoryFindAll);
          }
        })
        .catch(error => console.log(error));
    }
  }

  buildSchema () {
    if (this.props.introspection.__schema) {
      return buildClientSchema(this.props.introspection);
    } else {
      return null;
    }
  }

  fetcher (graphQLParams) {
    if (graphQLParams.query === '') {
      return Promise.resolve('Please provide a query.');
    } else {
      const {
        addQueryHistoryItem,
        saveQueryHistory,
        selectedQuery,
        setQueryResultProps,
        setSelectedQuery
      } = this.props;

      const endpoint = selectedQuery.endpoint;

      // axios defaults
      axios.defaults.baseURL = endpoint;
      axios.defaults.headers.post['Content-Type'] =
        'application/x-www-form-urlencoded';

      const axiosConfig = {
        url: endpoint,
        method: 'POST'
      };

      const startResponseTime = new Date().getTime();

      return axios({
        ...axiosConfig,
        data: graphQLParams
      })
        .then(response => {
          const payload = {
            endpoint,
            query: graphQLParams.query,
            results: {
              request: {
                data: response.config.data,
                headers: response.config.headers,
                method: 'POST',
                url: response.config.url,
                xsrfCookieName: response.config.xsrfCookieName,
                xsrfHeaderName: response.config.xsrfHeaderName
              },

              headers: response.headers,
              status: `${response.status} ${response.statusText}`,
              code: 200,
              time: `${new Date().getTime() - startResponseTime}`,
              response: response.data
            },
            variables: graphQLParams.variables
            ? JSON.stringify(graphQLParams.variables)
            : ''
          };

          const date = Date.parse(new Date());

          setSelectedQuery({
            ...selectedQuery,
            ...this.query,
            ...payload
          });

          addQueryHistoryItem({
            [date]: payload
          });
          saveQueryHistory({
            [date]: payload
          });

          return response.data.data;
        })
        .catch(error => {
          if (error.response) {
            console.log(error.response);
            // Response status code 2xx
            setQueryResultProps({
              response: error.response.data,
              status: `${error.response.status} failed`,
              code: parseInt(error.response.code, 10),
              headers: error.response.headers
            });
          } else if (error.request) {
            // No response was received
            console.log(error.request);
            setQueryResultProps({
              response:  error.response.data,
              status: '502 failed...',
              code: 502,
              headers: {}
            });

          } else {
            console.log(error);
            setQueryResultProps({
              response: 'Connection failed',
              status:'500 failed',
              code: 500,
              headers: {}
            });
          }
        });
    }
  }

  handleClickPrettify (event) {
    const { setSelectedQuery, selectedQuery } = this.props;

    const query =
      this.query.query.trim() !== ''
        ? this.query.query.trim()
        : selectedQuery.query;

    const prettyText = this.prettyQuery(query);
    setSelectedQuery({
      ...selectedQuery,
      query: prettyText
    });
  }

  handelOnEditQuery (query) {
    this.query.query = query;
  }

  handelOnEditVariables (variables) {
    this.query.variables = variables;
  }

  handleClickRest () {
    this.query = {
      id: null,
      collection: { value: '' },
      query: '',
      variables: ''
    };

    this.props.selectedQueryToInitialState();
    this.forceUpdate();
    this.props.resetForm('saveForm');
  }

  setInfoModal (bool) {
    this.props.setUiQueryProps({ isInfoModalOpen: bool });
  }

  setSaveModal (bool) {
    const { selectedQuery, setQueryResultProps, setUiQueryProps, setSaveFormFields, setSelectedQueryProps } = this.props;

    setSelectedQueryProps({ query: this.query.query });
    setSaveFormFields({
      name: { value: selectedQuery.name },
      collection: { value: selectedQuery.collection },
      description: { value: selectedQuery.description }
    });

    if ((this.query.query === '') && (selectedQuery.query.trim() === '')) {
      setQueryResultProps({ response: 'Please provide a query.' });
    } else {
      setUiQueryProps({ isSaveModalOpen: bool });
    }
  }

  handleClickSave (values) {
    const {
      addQueryCollection,
      createQuery,
      resetForm,
      selectedQuery,
      setSelectedQuery,
      setUiQueryProps
    } = this.props;

    const { collection, description, name } = values;

    const data = {
      ...this.query,
      collection,
      description,
      endpoint: selectedQuery.endpoint,
      id: selectedQuery.id || cuid(),
      name,
      results: JSON.stringify(selectedQuery.results)
    };

    setSelectedQuery(data);
    addQueryCollection(data);
    createQuery(data).payload
      .then(response => {
        if (response.data.ideQueryCreate.RESULTS_.result === 'failed') {
        }
      })
      .catch(error => console.log(error));
    setUiQueryProps({ isSaveModalOpen: false });
    resetForm('saveForm');
  }

  validateSaveModule (data) {
    const errors = {};
    const { name, collection } = data;

    if (collection == null || collection.trim() === '') {
      errors.collection = 'Please enter a collection name';
    }

    if (name == null || name.trim() === '') {
      errors.name = 'Please enter a query name';
    }
    return Object.keys(errors).length !== 0 ? errors : null;
  }

  showSidebarQueryCollection (event) {
    this.props.setUiQueryProps({ sidebarQueryContent: 'collection' });
  }

  showSidebarQueryHistory (event) {
    this.props.setUiQueryProps({ sidebarQueryContent: 'history' });
  }

  handleQueryCollectionItemClick (event) {
    if (event.nativeEvent.target.tagName.toUpperCase() === 'BUTTON') return;

    const { queryCollectionAll, selectedQuery, setSelectedQuery } = this.props;
    const target = event.nativeEvent.target;
    const id = target.dataset.kitid;
    const collection =
      target.parentNode.dataset.collection || target.dataset.collection;
    const query = queryCollectionAll[collection][id];

    this.getGraphQLSchema(query.endpoint);

    if (query.id !== selectedQuery.id) {
      this.query = {
        collection: { value: query.collection },
        description: query.description,
        id: query.id,
        name: query.name,
        query: query.query,
        variables: query.variables
      };

      setSelectedQuery({
        ...query,
        results: {
          ...query.results,
          status: 'Waiting...',
          time: null
        }
      });
    } else {
      setSelectedQuery({
        ...query,
        results: initialState.selectedQuery.results
      });
    }
  }

  handleQueryHistoryItemClick (event) {
    const {
      initialState,
      queryHistoryAll,
      setQueryResultProps,
      setSelectedQuery
    } = this.props;

    const target = event.nativeEvent.target;
    const id = target.dataset.kitid;
    const historyItem = queryHistoryAll[id];

    const data = {
      ...initialState.query.selectedQuery,
      ...historyItem
    };

    this.query.query = data.query;
    this.query.variables = data.variables;

    this.getGraphQLSchema(historyItem.endpoint);

    setSelectedQuery(data);
    setQueryResultProps({ status: 'Waiting' });
  }

  getGraphQLSchema (endpoint) {
    const {
      getGraphqlSchema,
      selectedQuery,
      setGraphqlSchema,
      setSchemaIsConnected
    } = this.props;

    if (endpoint !== selectedQuery.endpoint) {
      getGraphqlSchema(endpoint).payload
        .then(response => {
          if (response.data && response.data.__schema) {
            setGraphqlSchema(response.data);
            setSchemaIsConnected(true);
          }
        })
        .catch(error => {
          console.log(error);
          setGraphqlSchema({});
          setSchemaIsConnected(false);
        });
    }
  }

  prettyQuery (query) {
    return print(parse(query));
  }

  getQuery () {
    const { selectedQuery } = this.props;
    if (this.query.query.trim() !== '') {
      return this.prettyQuery(this.query.query);
    } else if (selectedQuery.query && selectedQuery.query.trim() !== '') {
      return this.prettyQuery(selectedQuery.query);
    } else {
      return '';
    }
  }

  render () {
    const { component, uiQueryEditor, selectedQuery } = this.props;
    const { gqlTheme, gqlThemePaper } = uiQueryEditor;

    const query = this.getQuery();

    const variables = selectedQuery ? selectedQuery.variables : '';
    const Component = component;
    const schema = this.buildSchema();

    const _response =
      JSON.stringify(selectedQuery.results.response, null, 2) || '';
    const response =
      _response.trim() === '' || _response === '{}' || _response === '""'
        ? null
        : _response;

    return (
      <div
        className={`graphiql-theme ${gqlTheme} ${gqlThemePaper ? 'paper' : ''}`}
      >
        <Component
          {...getClassMethods(this)}
          query={query}
          response={response}
          variables={variables}
          schema={schema}
          operationName={null}
          storage={null}
          defaultQuery={null}
          onEditQuery={this.handelOnEditQuery}
          onEditVariables={this.handelOnEditVariables}
          onEditOperationName={null}
          getDefaultFieldNames={null}
          editorTheme={gqlTheme}
          resultTheme={gqlTheme}
          result={selectedQuery.results}
          queryCollection={this.query.collection.value}
        />
      </div>
    );
  }
}

export default connect(GraphiQLContainer);


text:
using System;
using System.Linq;
using System.Web.Mvc;
using System.Web.Routing;

namespace XperiCode.FeaturesMvc.Sample.App_Start
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}


text:
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.Vector3;

/**
 * Basic class that allows the camera to orbit around a given pivot point.
 * Contains built-in input adapter to handle it.
 * If one were to use an {@link com.badlogic.gdx.InputMultiplexer}, this should be the last InputProcessor added to order.
 *
 * NOTE: the actualXXX values have animation smoothing applied to them (i.e. the ones actually seen by the player)
 *
 * This code is distributed under MIT license
 *
 * @author themorfeus
 */
public class OrbitingCameraController extends InputAdapter{
    /**
     * Temporary vector used in various calculations.
     * */
    private Vector3 tempV3 = new Vector3();

    /**
     * Animation smoothing. The lower the value, the more jittery the movement gets.
     * */
    public float animSmoothing = 5;

    /**
     * Camera's orbit radius
     * */
    private float orbitRadius = 55;
    private float actualOrbitRadius = 55;

    /**
     * Minimal orbit radius value
     * Set to 0 to ignore
     * */
    private float minimalOrbitRadius = 15;

    /**
     * Maximal orbit radius value
     * Set to 0 to ignore
     * */
    private float maximalOrbitRadius = 0;

    /**
     * Camera's yaw
     * */
    private float yaw;
    private float actualYaw;

    /**
     * Camera's pitch
     * */
    private float pitch = 70;
    private float actualPitch = 70;

    /**
     * Whether or not allow for camera pitch movement (i.e. up and down)
     * */
    private boolean allowPitchMovement = false;

    /**
     * Whether or not allow for camera yaw movement (i.e. left to right)
     * */
    private boolean allowYawMovement = false;

    /**
     * Camera's pivot point. The point at which the camera is looking at.
     * */
    private static Vector3 pivotPoint = new Vector3();
    private static Vector3 actualPivotPoint = new Vector3();

    private float touchStartX, touchStartY;
    private float lastTouchX, lastTouchY;

    /**
     * Camera object to control.
     * */
    private Camera camera;

    public OrbitingCameraController(Camera cam){
        this.camera = cam;
    }

    /**
     * An update method
     * */
    public void update(){
        if(animSmoothing<1)animSmoothing = 1;

        actualPivotPoint.x += (pivotPoint.x - actualPivotPoint.x)/animSmoothing;
        actualPivotPoint.y += (pivotPoint.y - actualPivotPoint.y)/animSmoothing;
        actualPivotPoint.z += (pivotPoint.z - actualPivotPoint.z)/animSmoothing;

        actualYaw += (yaw - actualYaw)/animSmoothing;
        actualPitch += (pitch - actualPitch)/animSmoothing;
        actualOrbitRadius += (orbitRadius - actualOrbitRadius)/animSmoothing;

        if(camera instanceof OrthographicCamera)((OrthographicCamera)camera).zoom = actualOrbitRadius/50;

        camera.position.set(
                actualPivotPoint.x + (float) (Math.cos(Math.toRadians(actualYaw)) * Math.sin(Math.toRadians(actualPitch)) * actualOrbitRadius),
                actualPivotPoint.y + (float) (Math.cos(Math.toRadians(actualPitch)) * actualOrbitRadius),
                actualPivotPoint.z + (float) (Math.sin(Math.toRadians(actualYaw)) * Math.sin(Math.toRadians(actualPitch)) * actualOrbitRadius));
        tempV3 = actualPivotPoint.cpy().sub(camera.position).nor();
        camera.direction.set(tempV3);
    }

    /**
     * @return The camera's pivot point
     * */
    public Vector3 getPivotPoint(){
        return pivotPoint.cpy();
    }

    /**
     * Sets the camera's pivot point
     * @param x Pivot's new X position
     * @param y Pivot's new Y position
     * @param z Pivot's new Z position
     * */
    public void setPivotPoint(float x, float y, float z){
        this.pivotPoint.set(x,y,z);
    }

    /**
     * Sets the camera's pivot point
     * @param pivot The new pivot position
     * */
    public void setPivotPoint(Vector3 pivot){
        this.pivotPoint.set(pivot);
    }

    /**
     * Sets the camera's yaw
     * @param yaw New camera yaw
     * */
    public void setYaw(float yaw){
        this.yaw = yaw;
    }

    /**
     * Adds a value to the camera's yaw
     * @param yaw The value to add to yaw
     * */
    public void addYaw(float yaw){
        this.yaw += yaw;
    }

    /**
     * Sets the camera's pitch
     * @param pitch New camera pitch
     * */
    public void setPitch(float pitch){
        this.pitch = pitch;
    }

    /**
     * Adds a value to the camera's pitch
     * @param pitch The value to add to camera's pitch
     * */
    public void addPitch(float pitch){
        this.pitch += pitch;
    }

    /**
     * @return Current orbit radius of the camera
     * */
    public float getOrbitRadius(){
        return orbitRadius;
    }

    /**
     * @return Current yaw of the camera
     * */
    public float getYaw(){
        return yaw;
    }

    /**
     * @return Current pitch of the camera
     * */
    public float getPitch(){
        return pitch;
    }

    /**
     * Sets wheter or not pitch movement is allowed
     * */
    public void setAllowPitchMovement(boolean allow){
        this.allowPitchMovement = allow;
    }

    /**
     * Sets wheter or not yaw movement is allowed
     * */
    public void setAllowYawMovement(boolean allow){
        this.allowYawMovement = allow;
    }

    /**
     * @return false, for further input handling
     * */
    @Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        touchStartX = screenX;
        touchStartY = Gdx.graphics.getHeight() - screenY;
        lastTouchX = touchStartX;
        lastTouchY = touchStartY;
        return false;
    }

    /**
     * @return false, for further input handling
     * */
    @Override
    public boolean touchDragged(int screenX, int screenY, int pointer) {
        if(Gdx.input.isButtonPressed(Input.Buttons.LEFT)){

            if(allowPitchMovement)pitch += (lastTouchY - (Gdx.graphics.getHeight() - screenY))/10;

        }else if(Gdx.input.isButtonPressed(Input.Buttons.MIDDLE)){

            float dx = lastTouchX - screenX;
            float dy = lastTouchY - (Gdx.graphics.getHeight() - screenY);

            tempV3.set(camera.direction).crs(0,1,0).nor().scl(dx/60f).scl(orbitRadius * .02f);
            pivotPoint.x += tempV3.x;
            pivotPoint.z += tempV3.z;

            tempV3.set(camera.direction).nor().scl(dy/20f).scl(orbitRadius * .02f);
            pivotPoint.x += tempV3.x;
            pivotPoint.z += tempV3.z;

        }else if(Gdx.input.isButtonPressed(Input.Buttons.RIGHT)){

            if(allowYawMovement)yaw += (lastTouchX - screenX)/5f;

        }

        lastTouchX = screenX;
        lastTouchY = Gdx.graphics.getHeight() - screenY;
        return false;
    }

    /**
     * @return false, for further input handling
     * */
    @Override
    public boolean scrolled(int amount) {
        orbitRadius += (amount * orbitRadius * .02f)/.25f;
        if(orbitRadius<minimalOrbitRadius && minimalOrbitRadius!=0)orbitRadius = minimalOrbitRadius;
        if(orbitRadius>maximalOrbitRadius&& maximalOrbitRadius!=0)orbitRadius = maximalOrbitRadius;
        return false;
    }
}


text:
// Copyright © 2010-2017 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

namespace CefSharp
{
    public interface IPopupFeatures
    {
        int X { get; }
        int XSet { get; }
        int Y { get; }
        int YSet { get; }
        int Width { get; }
        int WidthSet { get; }
        int Height { get; }
        int HeightSet { get; }
        bool MenuBarVisible { get; }
        bool StatusBarVisible { get; }
        bool ToolBarVisible { get; }
        bool LocationBarVisible { get; }
        bool ScrollbarsVisible { get; }
        bool Resizable { get; }
        bool Fullscreen { get; }
        bool Dialog { get; }
    }
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using Xunit;

namespace System.Drawing.Tests
{
    public class TextureBrushTests
    {
        public static IEnumerable<object[]> Ctor_Bitmap_TestData()
        {
            yield return new object[] { new Bitmap(10, 10), PixelFormat.Format32bppPArgb, new Size(10, 10) };
            yield return new object[] { new Metafile(Helpers.GetTestBitmapPath("telescope_01.wmf")), PixelFormat.Format32bppArgb, new Size(490, 654) };
        }

        [ActiveIssue(20884, TestPlatforms.AnyUnix)]
        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [MemberData(nameof(Ctor_Bitmap_TestData))]
        public void Ctor_Bitmap(Image bitmap, PixelFormat expectedPixelFormat, Size expectedSize)
        {
            try
            {
                using (var brush = new TextureBrush(bitmap))
                using (var matrix = new Matrix())
                {
                    Bitmap brushImage = Assert.IsType<Bitmap>(brush.Image);
                    Assert.NotSame(bitmap, brushImage);
                    Assert.Equal(expectedPixelFormat, brushImage.PixelFormat);
                    Assert.Equal(expectedSize, brushImage.Size);
                    Assert.Equal(matrix, brush.Transform);
                    Assert.Equal(WrapMode.Tile, brush.WrapMode);
                }
            }
            finally
            {
                bitmap.Dispose();
            }
        }

        [ActiveIssue(20884, TestPlatforms.AnyUnix)]
        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void Ctor_BitmapFromIconHandle_Success()
        {
            using (var icon = new Icon(Helpers.GetTestBitmapPath("10x16_one_entry_32bit.ico")))
            using (var image = Bitmap.FromHicon(icon.Handle))
            {
                Ctor_Bitmap(image, PixelFormat.Format32bppPArgb, new Size(11, 22));
            }
        }

        public static IEnumerable<object[]> Ctor_Image_WrapMode_TestData()
        {
            foreach (object[] data in Ctor_Bitmap_TestData())
            {
                yield return new object[] { ((Image)data[0]).Clone(), WrapMode.Clamp, data[1], data[2] };
                yield return new object[] { ((Image)data[0]).Clone(), WrapMode.Tile, data[1], data[2] };
                yield return new object[] { ((Image)data[0]).Clone(), WrapMode.TileFlipX, data[1], data[2] };
                yield return new object[] { ((Image)data[0]).Clone(), WrapMode.TileFlipXY, data[1], data[2] };
                yield return new object[] { ((Image)data[0]).Clone(), WrapMode.TileFlipY, data[1], data[2] };
            }
        }

        [ActiveIssue(20884, TestPlatforms.AnyUnix)]
        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [MemberData(nameof(Ctor_Image_WrapMode_TestData))]
        public void Ctor_Image_WrapMode(Image image, WrapMode wrapMode, PixelFormat expectedPixelFormat, Size expectedSize)
        {
            try
            {
                using (var brush = new TextureBrush(image, wrapMode))
                using (var matrix = new Matrix())
                {
                    Bitmap brushImage = Assert.IsType<Bitmap>(brush.Image);
                    Assert.NotSame(image, brushImage);
                    Assert.Equal(expectedPixelFormat, brushImage.PixelFormat);
                    Assert.Equal(expectedSize, brushImage.Size);
                    Assert.Equal(matrix, brush.Transform);
                    Assert.Equal(wrapMode, brush.WrapMode);
                }
            }
            finally
            {
                image.Dispose();
            }
        }

        public static IEnumerable<object[]> Ctor_Image_Rectangle_TestData()
        {
            yield return new object[] { new Bitmap(10, 10), new Rectangle(0, 0, 10, 10) };
            yield return new object[] { new Bitmap(10, 10), new Rectangle(5, 5, 5, 5) };
        }

        [ActiveIssue(20884, TestPlatforms.AnyUnix)]
        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [MemberData(nameof(Ctor_Image_Rectangle_TestData))]
        public void Ctor_Image_Rectangle(Image image, Rectangle rectangle)
        {
            try
            {
                using (var brush = new TextureBrush(image, rectangle))
                using (var matrix = new Matrix())
                {
                    Bitmap brushImage = Assert.IsType<Bitmap>(brush.Image);
                    Assert.NotSame(image, brushImage);
                    Assert.Equal(PixelFormat.Format32bppPArgb, brushImage.PixelFormat);
                    Assert.Equal(rectangle.Size, brushImage.Size);
                    Assert.Equal(matrix, brush.Transform);
                    Assert.Equal(WrapMode.Tile, brush.WrapMode);
                }
            }
            finally
            {
                image.Dispose();
            }
        }

        [ActiveIssue(20884, TestPlatforms.AnyUnix)]
        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [MemberData(nameof(Ctor_Image_Rectangle_TestData))]
        public void Ctor_Image_RectangleF(Image image, Rectangle rectangle)
        {
            try
            {
                using (var brush = new TextureBrush(image, (RectangleF)rectangle))
                using (var matrix = new Matrix())
                {
                    Bitmap brushImage = Assert.IsType<Bitmap>(brush.Image);
                    Assert.NotSame(image, brushImage);
                    Assert.Equal(PixelFormat.Format32bppPArgb, brushImage.PixelFormat);
                    Assert.Equal(rectangle.Size, brushImage.Size);
                    Assert.Equal(matrix, brush.Transform);
                    Assert.Equal(WrapMode.Tile, brush.WrapMode);
                }
            }
            finally
            {
                image.Dispose();
            }
        }

        public static IEnumerable<object[]> Ctor_Image_WrapMode_Rectangle_TestData()
        {
            foreach (object[] data in Ctor_Image_Rectangle_TestData())
            {
                yield return new object[] { ((Image)data[0]).Clone(), WrapMode.Clamp, data[1] };
                yield return new object[] { ((Image)data[0]).Clone(), WrapMode.Tile, data[1] };
                yield return new object[] { ((Image)data[0]).Clone(), WrapMode.TileFlipX, data[1] };
                yield return new object[] { ((Image)data[0]).Clone(), WrapMode.TileFlipXY, data[1] };
                yield return new object[] { ((Image)data[0]).Clone(), WrapMode.TileFlipY, data[1] };
            }
        }

        [ActiveIssue(20884, TestPlatforms.AnyUnix)]
        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [MemberData(nameof(Ctor_Image_WrapMode_Rectangle_TestData))]
        public void Ctor_Image_WrapMode_Rectangle(Image image, WrapMode wrapMode, Rectangle rectangle)
        {
            try
            {
                using (var brush = new TextureBrush(image, wrapMode, rectangle))
                using (var matrix = new Matrix())
                {
                    Bitmap brushImage = Assert.IsType<Bitmap>(brush.Image);
                    Assert.NotSame(image, brushImage);
                    Assert.Equal(PixelFormat.Format32bppPArgb, brushImage.PixelFormat);
                    Assert.Equal(rectangle.Size, brushImage.Size);
                    Assert.Equal(matrix, brush.Transform);
                    Assert.Equal(wrapMode, brush.WrapMode);
                }
            }
            finally
            {
                image.Dispose();
            }
        }

        [ActiveIssue(20884, TestPlatforms.AnyUnix)]
        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [MemberData(nameof(Ctor_Image_WrapMode_Rectangle_TestData))]
        public void Ctor_Image_WrapMode_RectangleF(Image image, WrapMode wrapMode, Rectangle rectangle)
        {
            try
            {
                using (var brush = new TextureBrush(image, wrapMode, (RectangleF)rectangle))
                using (var matrix = new Matrix())
                {
                    Bitmap brushImage = Assert.IsType<Bitmap>(brush.Image);
                    Assert.NotSame(image, brushImage);
                    Assert.Equal(PixelFormat.Format32bppPArgb, brushImage.PixelFormat);
                    Assert.Equal(rectangle.Size, brushImage.Size);
                    Assert.Equal(matrix, brush.Transform);
                    Assert.Equal(wrapMode, brush.WrapMode);
                }
            }
            finally
            {
                image.Dispose();
            }
        }

        public static IEnumerable<object[]> Ctor_Image_Rectangle_ImageAttributes_TestData()
        {
            foreach (object[] data in Ctor_Image_Rectangle_TestData())
            {
                yield return new object[] { ((Image)data[0]).Clone(), data[1], null, WrapMode.Tile };
                yield return new object[] { ((Image)data[0]).Clone(), data[1], new ImageAttributes(), WrapMode.Clamp };

                var customWrapMode = new ImageAttributes();
                customWrapMode.SetWrapMode(WrapMode.TileFlipXY);
                yield return new object[] { ((Image)data[0]).Clone(), data[1], customWrapMode, WrapMode.TileFlipXY };
            }
        }

        [ActiveIssue(20884, TestPlatforms.AnyUnix)]
        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [MemberData(nameof(Ctor_Image_Rectangle_ImageAttributes_TestData))]
        public void Ctor_Image_Rectangle_ImageAttributes(Image image, Rectangle rectangle, ImageAttributes attributes, WrapMode expectedWrapMode)
        {
            try
            {
                using (var brush = new TextureBrush(image, rectangle, attributes))
                using (var matrix = new Matrix())
                {
                    Bitmap brushImage = Assert.IsType<Bitmap>(brush.Image);
                    Assert.NotSame(image, brushImage);
                    Assert.Equal(PixelFormat.Format32bppPArgb, brushImage.PixelFormat);
                    Assert.Equal(rectangle.Size, brushImage.Size);
                    Assert.Equal(matrix, brush.Transform);
                    Assert.Equal(expectedWrapMode, brush.WrapMode);
                }
            }
            finally
            {
                image.Dispose();
                attributes?.Dispose();
            }
        }

        [ActiveIssue(20884, TestPlatforms.AnyUnix)]
        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [MemberData(nameof(Ctor_Image_Rectangle_ImageAttributes_TestData))]
        public void Ctor_Image_RectangleF_ImageAttributes(Image image, Rectangle rectangle, ImageAttributes attributes, WrapMode expectedWrapMode)
        {
            try
            {
                using (var brush = new TextureBrush(image, (RectangleF)rectangle, attributes))
                using (var matrix = new Matrix())
                {
                    Bitmap brushImage = Assert.IsType<Bitmap>(brush.Image);
                    Assert.NotSame(image, brushImage);
                    Assert.Equal(PixelFormat.Format32bppPArgb, brushImage.PixelFormat);
                    Assert.Equal(rectangle.Size, brushImage.Size);
                    Assert.Equal(matrix, brush.Transform);
                    Assert.Equal(expectedWrapMode, brush.WrapMode);
                }
            }
            finally
            {
                image.Dispose();
                attributes?.Dispose();
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void Ctor_NullImage_ThrowsArgumentNullException()
        {
            AssertExtensions.Throws<ArgumentNullException>("image", () => new TextureBrush(null));
            AssertExtensions.Throws<ArgumentNullException>("image", () => new TextureBrush(null, WrapMode.Tile));
            AssertExtensions.Throws<ArgumentNullException>("image", () => new TextureBrush(null, RectangleF.Empty));
            AssertExtensions.Throws<ArgumentNullException>("image", () => new TextureBrush(null, Rectangle.Empty));
            AssertExtensions.Throws<ArgumentNullException>("image", () => new TextureBrush(null, RectangleF.Empty, null));
            AssertExtensions.Throws<ArgumentNullException>("image", () => new TextureBrush(null, Rectangle.Empty, null));
            AssertExtensions.Throws<ArgumentNullException>("image", () => new TextureBrush(null, WrapMode.Tile, RectangleF.Empty));
            AssertExtensions.Throws<ArgumentNullException>("image", () => new TextureBrush(null, WrapMode.Tile, Rectangle.Empty));
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void Ctor_DisposedImage_ThrowsArgumentException()
        {
            var image = new Bitmap(10, 10);
            image.Dispose();

            AssertExtensions.Throws<ArgumentException>(null, () => new TextureBrush(image));
            AssertExtensions.Throws<ArgumentException>(null, () => new TextureBrush(image, WrapMode.Tile));
            AssertExtensions.Throws<ArgumentException>(null, () => new TextureBrush(image, RectangleF.Empty));
            AssertExtensions.Throws<ArgumentException>(null, () => new TextureBrush(image, Rectangle.Empty));
            AssertExtensions.Throws<ArgumentException>(null, () => new TextureBrush(image, RectangleF.Empty, null));
            AssertExtensions.Throws<ArgumentException>(null, () => new TextureBrush(image, Rectangle.Empty, null));
            AssertExtensions.Throws<ArgumentException>(null, () => new TextureBrush(image, WrapMode.Tile, RectangleF.Empty));
            AssertExtensions.Throws<ArgumentException>(null, () => new TextureBrush(image, WrapMode.Tile, Rectangle.Empty));
        }

        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [InlineData(WrapMode.Tile - 1)]
        [InlineData(WrapMode.Clamp + 1)]
        public void Ctor_InvalidWrapMode_ThrowsInvalidEnumArgumentException(WrapMode wrapMode)
        {
            using (var image = new Bitmap(10, 10))
            {
                Assert.ThrowsAny<ArgumentException>(() => new TextureBrush(image, wrapMode));
                Assert.ThrowsAny<ArgumentException>(() => new TextureBrush(image, wrapMode, RectangleF.Empty));
                Assert.ThrowsAny<ArgumentException>(() => new TextureBrush(image, wrapMode, Rectangle.Empty));
            }
        }

        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [InlineData(-1, 0, 1, 1)]
        [InlineData(10, 0, 1, 1)]
        [InlineData(5, 0, 6, 1)]
        [InlineData(0, -1, 1, 1)]
        [InlineData(0, 10, 1, 1)]
        [InlineData(0, 5, 1, 6)]
        [InlineData(0, 0, 1, 0)]
        [InlineData(0, 0, 0, 1)]
        public void Ctor_InvalidRectangle_ThrowsOutOfMemoryException(int x, int y, int width, int height)
        {
            var rectangle = new Rectangle(x, y, width, height);
            using (var image = new Bitmap(10, 10))
            {
                Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, rectangle));
                Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, (RectangleF)rectangle));
                Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, WrapMode.Tile, rectangle));
                Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, WrapMode.Tile, (RectangleF)rectangle));
                Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, rectangle, null));
                Assert.Throws<OutOfMemoryException>(() => new TextureBrush(image, (RectangleF)rectangle, null));
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void Clone_Invoke_Success()
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image, WrapMode.Clamp))
            {
                TextureBrush clone = Assert.IsType<TextureBrush>(brush.Clone());
                Assert.NotSame(brush, clone);

                Assert.Equal(new Size(10, 10), brush.Image.Size);
                Assert.Equal(WrapMode.Clamp, clone.WrapMode);
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void Clone_Disposed_ThrowsArgumentException()
        {
            using (var image = new Bitmap(10, 10))
            {
                var brush = new TextureBrush(image);
                brush.Dispose();

                AssertExtensions.Throws<ArgumentException>(null, () => brush.Clone());
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void Image_GetWhenDisposed_ThrowsArgumentException()
        {
            using (var image = new Bitmap(10, 10))
            {
                var brush = new TextureBrush(image);
                brush.Dispose();

                AssertExtensions.Throws<ArgumentException>(null, () => brush.Image);
            }
        }

        public static IEnumerable<object[]> MultiplyTransform_TestData()
        {
            yield return new object[] { new Matrix(), new Matrix(1, 2, 3, 4, 5, 6), MatrixOrder.Prepend };
            yield return new object[] { new Matrix(), new Matrix(1, 2, 3, 4, 5, 6), MatrixOrder.Append };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), new Matrix(2, 3, 4, 5, 6, 7), MatrixOrder.Prepend };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), new Matrix(2, 3, 4, 5, 6, 7), MatrixOrder.Append };
        }

        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [MemberData(nameof(MultiplyTransform_TestData))]
        public void MultiplyTransform_Matrix_SetsTransformToExpected(Matrix originalTransform, Matrix matrix, MatrixOrder matrixOrder)
        {
            try
            {
                using (var image = new Bitmap(10, 10))
                using (var brush = new TextureBrush(image))
                using (var expected = (Matrix)originalTransform.Clone())
                {
                    expected.Multiply(matrix, matrixOrder);
                    brush.Transform = originalTransform;

                    if (matrixOrder == MatrixOrder.Prepend)
                    {
                        TextureBrush clone = (TextureBrush)brush.Clone();
                        clone.MultiplyTransform(matrix);
                        Assert.Equal(expected, clone.Transform);
                    }

                    brush.MultiplyTransform(matrix, matrixOrder);
                    Assert.Equal(expected, brush.Transform);
                }
            }
            finally
            {
                originalTransform.Dispose();
                matrix.Dispose();
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void MultiplyTransform_NullMatrix_ThrowsArgumentNullException()
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image))
            {
                AssertExtensions.Throws<ArgumentNullException>("matrix", () => brush.MultiplyTransform(null));
                AssertExtensions.Throws<ArgumentNullException>("matrix", () => brush.MultiplyTransform(null, MatrixOrder.Prepend));
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void MultiplyTransform_NotInvertibleMatrix_ThrowsArgumentException()
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image))
            using (var matrix = new Matrix(123, 24, 82, 16, 47, 30))
            {
                AssertExtensions.Throws<ArgumentException>(null, () => brush.MultiplyTransform(matrix));
                AssertExtensions.Throws<ArgumentException>(null, () => brush.MultiplyTransform(matrix, MatrixOrder.Prepend));
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void MultiplyTransform_DisposedMatrix_Nop()
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image))
            using (var transform = new Matrix(1, 2, 3, 4, 5, 6))
            {
                brush.Transform = transform;

                var matrix = new Matrix();
                matrix.Dispose();

                brush.MultiplyTransform(matrix);
                brush.MultiplyTransform(matrix, MatrixOrder.Append);

                Assert.Equal(transform, brush.Transform);
            }
        }

        [ActiveIssue(20884, TestPlatforms.AnyUnix)]
        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [InlineData(MatrixOrder.Prepend - 1)]
        [InlineData(MatrixOrder.Append + 1)]
        public void MultiplyTransform_InvalidOrder_Nop(MatrixOrder matrixOrder)
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image))
            using (var transform = new Matrix(1, 2, 3, 4, 5, 6))
            using (var matrix = new Matrix())
            {
                brush.Transform = transform;

                brush.MultiplyTransform(matrix, matrixOrder);
                Assert.Equal(transform, brush.Transform);
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void MultiplyTransform_Disposed_ThrowsArgumentException()
        {
            using (var image = new Bitmap(10, 10))
            using (var matrix = new Matrix())
            {
                var brush = new TextureBrush(image);
                brush.Dispose();

                AssertExtensions.Throws<ArgumentException>(null, () => brush.MultiplyTransform(matrix));
                AssertExtensions.Throws<ArgumentException>(null, () => brush.MultiplyTransform(matrix, MatrixOrder.Prepend));
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void ResetTransform_Invoke_SetsTransformToZero()
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image))
            using (var transform = new Matrix(1, 2, 3, 4, 5, 6))
            using (var matrix = new Matrix())
            {
                brush.Transform = transform;
                brush.ResetTransform();
                Assert.Equal(matrix, brush.Transform);

                brush.ResetTransform();
                Assert.Equal(matrix, brush.Transform);
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void ResetTransform_Disposed_ThrowsArgumentException()
        {
            using (var image = new Bitmap(10, 10))
            {
                var brush = new TextureBrush(image);
                brush.Dispose();

                AssertExtensions.Throws<ArgumentException>(null, () => brush.ResetTransform());
            }
        }

        public static IEnumerable<object[]> RotateTransform_TestData()
        {
            yield return new object[] { new Matrix(), 90, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(), 90, MatrixOrder.Append };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0, MatrixOrder.Append };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 360, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 360, MatrixOrder.Append };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), -45, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), -45, MatrixOrder.Append };
        }

        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [MemberData(nameof(RotateTransform_TestData))]
        public void RotateTransform_Invoke_SetsTransformToExpected(Matrix originalTransform, float angle, MatrixOrder matrixOrder)
        {
            try
            {
                using (var image = new Bitmap(10, 10))
                using (var brush = new TextureBrush(image))
                using (Matrix expected = originalTransform.Clone())
                {
                    expected.Rotate(angle, matrixOrder);
                    brush.Transform = originalTransform;

                    if (matrixOrder == MatrixOrder.Prepend)
                    {
                        TextureBrush clone = (TextureBrush)brush.Clone();
                        clone.RotateTransform(angle);
                        Assert.Equal(expected, clone.Transform);
                    }

                    brush.RotateTransform(angle, matrixOrder);
                    Assert.Equal(expected, brush.Transform);
                }
            }
            finally
            {
                originalTransform.Dispose();
            }
        }

        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [InlineData(MatrixOrder.Prepend - 1)]
        [InlineData(MatrixOrder.Append + 1)]
        public void RotateTransform_InvalidOrder_ThrowsArgumentException(MatrixOrder matrixOrder)
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image))
            {
                AssertExtensions.Throws<ArgumentException>(null, () => brush.RotateTransform(10, matrixOrder));
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void RotateTransform_Disposed_ThrowsArgumentException()
        {
            using (var image = new Bitmap(10, 10))
            using (var matrix = new Matrix())
            {
                var brush = new TextureBrush(image);
                brush.Dispose();

                AssertExtensions.Throws<ArgumentException>(null, () => brush.RotateTransform(1));
                AssertExtensions.Throws<ArgumentException>(null, () => brush.RotateTransform(1, MatrixOrder.Prepend));
            }
        }

        public static IEnumerable<object[]> ScaleTransform_TestData()
        {
            yield return new object[] { new Matrix(), 2, 3, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(), 2, 3, MatrixOrder.Append };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0, 0, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0, 0, MatrixOrder.Append };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 1, 1, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 1, 1, MatrixOrder.Append };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), -2, -3, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), -2, -3, MatrixOrder.Append };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0.5, 0.75, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0.5, 0.75, MatrixOrder.Append };
        }

        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [MemberData(nameof(ScaleTransform_TestData))]
        public void ScaleTransform_Invoke_SetsTransformToExpected(Matrix originalTransform, float scaleX, float scaleY, MatrixOrder matrixOrder)
        {
            try
            {
                using (var image = new Bitmap(10, 10))
                using (var brush = new TextureBrush(image))
                using (Matrix expected = originalTransform.Clone())
                {
                    expected.Scale(scaleX, scaleY, matrixOrder);
                    brush.Transform = originalTransform;

                    if (matrixOrder == MatrixOrder.Prepend)
                    {
                        TextureBrush clone = (TextureBrush)brush.Clone();
                        clone.ScaleTransform(scaleX, scaleY);
                        Assert.Equal(expected, clone.Transform);
                    }

                    brush.ScaleTransform(scaleX, scaleY, matrixOrder);
                    Assert.Equal(expected, brush.Transform);
                }
            }
            finally
            {
                originalTransform.Dispose();
            }
        }

        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [InlineData(MatrixOrder.Prepend - 1)]
        [InlineData(MatrixOrder.Append + 1)]
        public void ScaleTransform_InvalidOrder_ThrowsArgumentException(MatrixOrder matrixOrder)
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image))
            {
                AssertExtensions.Throws<ArgumentException>(null, () => brush.ScaleTransform(1, 2, matrixOrder));
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void ScaleTransform_Disposed_ThrowsArgumentException()
        {
            using (var image = new Bitmap(10, 10))
            using (var matrix = new Matrix())
            {
                var brush = new TextureBrush(image);
                brush.Dispose();

                AssertExtensions.Throws<ArgumentException>(null, () => brush.ScaleTransform(1, 2));
                AssertExtensions.Throws<ArgumentException>(null, () => brush.ScaleTransform(1, 2, MatrixOrder.Prepend));
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void Transform_SetValid_GetReturnsExpected()
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image))
            using (var matrix = new Matrix(1, 2, 3, 4, 5, 6))
            {
                brush.Transform = matrix;
                Assert.Equal(matrix, brush.Transform);
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void Transform_SetNull_ThrowsArgumentNullException()
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image))
            {
                AssertExtensions.Throws<ArgumentNullException>("value", () => brush.Transform = null);
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void Transform_SetDisposedMatrix_ThrowsArgumentException()
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image))
            {
                var matrix = new Matrix();
                matrix.Dispose();

                AssertExtensions.Throws<ArgumentException>(null, () => brush.Transform = matrix);
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void Transform_GetSetWhenDisposed_ThrowsArgumentException()
        {
            using (var image = new Bitmap(10, 10))
            using (var matrix = new Matrix())
            {
                var brush = new TextureBrush(image);
                brush.Dispose();

                AssertExtensions.Throws<ArgumentException>(null, () => brush.Transform);
                AssertExtensions.Throws<ArgumentException>(null, () => brush.Transform = matrix);
            }
        }

        public static IEnumerable<object[]> TranslateTransform_TestData()
        {
            yield return new object[] { new Matrix(), 2, 3, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(), 2, 3, MatrixOrder.Append };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0, 0, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0, 0, MatrixOrder.Append };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 1, 1, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 1, 1, MatrixOrder.Append };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), -2, -3, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), -2, -3, MatrixOrder.Append };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0.5, 0.75, MatrixOrder.Prepend };
            yield return new object[] { new Matrix(1, 2, 3, 4, 5, 6), 0.5, 0.75, MatrixOrder.Append };
        }

        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [MemberData(nameof(TranslateTransform_TestData))]
        public void TranslateTransform_Invoke_SetsTransformToExpected(Matrix originalTransform, float dX, float dY, MatrixOrder matrixOrder)
        {
            try
            {
                using (var image = new Bitmap(10, 10))
                using (var brush = new TextureBrush(image))
                using (Matrix expected = originalTransform.Clone())
                {
                    expected.Translate(dX, dY, matrixOrder);
                    brush.Transform = originalTransform;

                    if (matrixOrder == MatrixOrder.Prepend)
                    {
                        TextureBrush clone = (TextureBrush)brush.Clone();
                        clone.TranslateTransform(dX, dY);
                        Assert.Equal(expected, clone.Transform);
                    }

                    brush.TranslateTransform(dX, dY, matrixOrder);
                    Assert.Equal(expected, brush.Transform);
                }
            }
            finally
            {
                originalTransform.Dispose();
            }
        }

        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [InlineData(MatrixOrder.Prepend - 1)]
        [InlineData(MatrixOrder.Append + 1)]
        public void TranslateTransform_InvalidOrder_ThrowsArgumentException(MatrixOrder matrixOrder)
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image))
            {
                AssertExtensions.Throws<ArgumentException>(null, () => brush.TranslateTransform(1, 2, matrixOrder));
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void TranslateTransform_Disposed_ThrowsArgumentException()
        {
            using (var image = new Bitmap(10, 10))
            using (var matrix = new Matrix())
            {
                var brush = new TextureBrush(image);
                brush.Dispose();

                AssertExtensions.Throws<ArgumentException>(null, () => brush.TranslateTransform(1, 2));
                AssertExtensions.Throws<ArgumentException>(null, () => brush.TranslateTransform(1, 2, MatrixOrder.Prepend));
            }
        }

        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [InlineData(WrapMode.Clamp)]
        [InlineData(WrapMode.Tile)]
        [InlineData(WrapMode.TileFlipX)]
        [InlineData(WrapMode.TileFlipXY)]
        [InlineData(WrapMode.TileFlipY)]
        public void WrapMode_SetValid_GetReturnsExpected(WrapMode wrapMode)
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image))
            {
                brush.WrapMode = wrapMode;
                Assert.Equal(wrapMode, brush.WrapMode);
            }
        }

        [ConditionalTheory(Helpers.IsDrawingSupported)]
        [InlineData(WrapMode.Tile - 1)]
        [InlineData(WrapMode.Clamp + 1)]
        public void WrapMode_SetInvalid_ThrowsInvalidEnumArgumentException(WrapMode wrapMode)
        {
            using (var image = new Bitmap(10, 10))
            using (var brush = new TextureBrush(image))
            {
                Assert.ThrowsAny<ArgumentException>(() => brush.WrapMode = wrapMode);
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void WrapMode_GetSetWhenDisposed_ThrowsArgumentException()
        {
            using (var image = new Bitmap(10, 10))
            {
                var brush = new TextureBrush(image);
                brush.Dispose();

                AssertExtensions.Throws<ArgumentException>(null, () => brush.WrapMode);
                AssertExtensions.Throws<ArgumentException>(null, () => brush.WrapMode = WrapMode.Tile);
            }
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void WrapMode_Clamp_ReturnsExpected()
        {
            // R|G|_|_
            // B|Y|_|_
            // _|_|_|_
            // _|_|_|_
            Color empty = Color.FromArgb(0, 0, 0, 0);
            VerifyFillRect(WrapMode.Clamp, new Color[][]
            {
                new Color[] { Color.Red,    Color.Green,    empty,  empty },
                new Color[] { Color.Blue,   Color.Yellow,   empty,  empty },
                new Color[] { empty,        empty,          empty,  empty },
                new Color[] { empty,        empty,          empty,  empty }
            });
        }

        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void WrapMode_Tile_ReturnsExpected()
        {
            // R|G|R|G
            // B|Y|B|Y
            // R|G|R|G
            // B|Y|B|Y
            VerifyFillRect(WrapMode.Tile, new Color[][]
            {
                new Color[] { Color.Red,  Color.Green,  Color.Red,  Color.Green  },
                new Color[] { Color.Blue, Color.Yellow, Color.Blue, Color.Yellow },
                new Color[] { Color.Red,  Color.Green,  Color.Red,  Color.Green  },
                new Color[] { Color.Blue, Color.Yellow, Color.Blue, Color.Yellow }
            });
        }

        [ActiveIssue(20884, TestPlatforms.AnyUnix)]
        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void WrapMode_TileFlipX_ReturnsExpected()
        {
            // R|G|G|R
            // B|Y|Y|B
            // R|G|G|R
            // B|Y|Y|B
            VerifyFillRect(WrapMode.TileFlipX, new Color[][]
            {
                new Color[] { Color.Red,    Color.Green,    Color.Green,    Color.Red  },
                new Color[] { Color.Blue,   Color.Yellow,   Color.Yellow,   Color.Blue },
                new Color[] { Color.Red,    Color.Green,    Color.Green,    Color.Red  },
                new Color[] { Color.Blue,   Color.Yellow,   Color.Yellow,   Color.Blue }
            });
        }

        [ActiveIssue(20884, TestPlatforms.AnyUnix)]
        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void WrapMode_TileFlipY_ReturnsExpected()
        {
            // R|G|R|G
            // B|Y|B|Y
            // B|Y|B|Y
            // R|G|R|G
            VerifyFillRect(WrapMode.TileFlipY, new Color[][]
            {
                new Color[] { Color.Red,    Color.Green,    Color.Red,    Color.Green  },
                new Color[] { Color.Blue,   Color.Yellow,   Color.Blue,   Color.Yellow },
                new Color[] { Color.Blue,   Color.Yellow,   Color.Blue,   Color.Yellow },
                new Color[] { Color.Red,    Color.Green,    Color.Red,    Color.Green  }
            });
        }

        [ActiveIssue(20884, TestPlatforms.AnyUnix)]
        [ConditionalFact(Helpers.IsDrawingSupported)]
        public void WrapMode_TileFlipXY_ReturnsExpected()
        {
            // R|G|G|R
            // B|Y|Y|B
            // B|Y|Y|B
            // R|G|G|R
            VerifyFillRect(WrapMode.TileFlipXY, new Color[][]
            {
                new Color[] { Color.Red,    Color.Green,    Color.Green,    Color.Red  },
                new Color[] { Color.Blue,   Color.Yellow,   Color.Yellow,   Color.Blue },
                new Color[] { Color.Blue,   Color.Yellow,   Color.Yellow,   Color.Blue },
                new Color[] { Color.Red,    Color.Green,    Color.Green,    Color.Red  }
            });
        }

        private static void VerifyFillRect(WrapMode wrapMode, Color[][] expectedColors)
        {
            using (var brushBitmap = new Bitmap(2, 2))
            {
                brushBitmap.SetPixel(0, 0, Color.Red);
                brushBitmap.SetPixel(1, 0, Color.Green);
                brushBitmap.SetPixel(0, 1, Color.Blue);
                brushBitmap.SetPixel(1, 1, Color.Yellow);

                using (var brush = new TextureBrush(brushBitmap, wrapMode))
                using (var targetImage = new Bitmap(4, 4))
                using (Graphics targetGraphics = Graphics.FromImage(targetImage))
                {
                    targetGraphics.FillRectangle(brush, new Rectangle(0, 0, 4, 4));

                    Helpers.VerifyBitmap(targetImage, expectedColors);
                }
            }
        }
    }
}


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
Syll. fung. (Abellini) 2: 647 (1883)

#### Original name
Dothidea granulosa Klotzsch & Berk., 1839

### Remarks
null


text:
#include "CtrlrNative.h"

typedef struct vmtotal vmtotal_t;

class CtrlrMac : public CtrlrNative
{
	public:
		CtrlrMac(CtrlrManager &_owner);
		~CtrlrMac();
		const Result exportWithDefaultPanel(CtrlrPanel*  panelToWrite, const bool isRestricted=false, const bool signPanel=false);
		const Result getDefaultPanel(MemoryBlock &dataToWrite);
		const Result getDefaultResources(MemoryBlock& dataToWrite);
		const Result setBundleInfo (CtrlrPanel *sourceInfo, const File &bundle);
		const Result setBundleInfoCarbon (CtrlrPanel *sourceInfo, const File &bundle);

    private:
        CtrlrManager &owner;
};
#endif


text:
/**
 * This file is for any css that you may want for this visualizer.
 *
 * Ideally, you would use the scss file also provided in this directory
 * and then generate this file automatically from that. However, you can
 * simply write css if you prefer
 */

.generic-attribute-editor {
  outline: none;
}

.generic-attribute-editor .empty-msg {
  font-style: italic;
  color: grey;
}


text:
package com.thinkgem.jeesite.modules.sys.web;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.sys.entity.Office;
import com.thinkgem.jeesite.modules.sys.entity.WashInfo;
import com.thinkgem.jeesite.modules.sys.service.CompanyService;
import com.thinkgem.jeesite.modules.sys.service.OfficeService;

/**
 * 用户Controller
 * @author ThinkGem
 * @version 2013-5-31
 */
@Controller
@RequestMapping(value = "${adminPath}/sys/wash")
public class WashController extends BaseController {

	@Autowired
	private CompanyService companyService;

	@Resource
	private OfficeService officeService;

	@ModelAttribute
	public WashInfo get(@RequestParam(required=false) String id) {
		if (StringUtils.isNotBlank(id)){
			return companyService.getWashInfo(id);
		}else{
			return new WashInfo();
		}
	}
	@RequestMapping({"addUI"})
	public String addUI(WashInfo washInfo, Model model) {
		model.addAttribute("washProduct", washInfo);
		return "modules/sys/wash/editUI";

	}
	@RequestMapping({"add"})
	public String add(WashInfo washInfo, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
		//默认添加根公司
		Office office = officeService.get("1");
		washInfo.setOffice(office);
		washInfo.setDelFlag(WashInfo.DEL_FLAG_NORMAL);
		companyService.saveWashInfo(washInfo);
		addMessage(redirectAttributes, "保存清洗货物成功成功");
		return "redirect:"+ Global.getAdminPath() +"/sys/wash/list";

	}
	@RequestMapping({"list",""})
	public String list(WashInfo washInfo, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<WashInfo> page = companyService.findWashInfo(new Page<WashInfo>(request, response), washInfo);
	    model.addAttribute("page", page);
		return "modules/sys/wash/list";

	}
	@RequestMapping({"delete"})
	public String delete(String id, RedirectAttributes redirectAttributes) {
		companyService.deleteWashInfo(id);
		addMessage(redirectAttributes, "删除成功");
		return "redirect:"+ Global.getAdminPath() +"/sys/wash/list";

	}
	@RequestMapping({"editUI"})
	public String editUI(WashInfo washInfo, Model model) {
		model.addAttribute("washProduct", washInfo);
		return "modules/sys/wash/editUI";
	}

	@RequestMapping({"getCleanGoodsJsonList"})
	@ResponseBody
	public List<WashInfo> getCleanGoodsJson(){
		List<WashInfo> list = companyService.listAllCleanGoods();
		return list;
	}

}


text:
<?php
namespace console\rbac;

use console\controllers\RbacController;
use common\models\User;
use Yii;
use yii\rbac\Rule;

/**
 * Created by PhpStorm.
 * User: DezMonT
 * Date: 31.03.2015
 * Time: 12:23
 */
class UserGroupRule extends Rule
{
    public $name = 'userGroup';

    public function execute($user, $item, $params)
    {
        /**@var User $current_user
         */
        $current_user = Yii::$app->user->identity;
        if (!Yii::$app->user->isGuest) {
            $role = $current_user->role;
            if(isset(RbacController::$role_hierarchy[$item->name]) || array_key_exists($item->name,RbacController::$role_hierarchy))
                return self::generateRoleCondition($item->name,$role);
        }
        return false;
    }

    protected  function  generateRoleCondition($role,$checking_role)
    {

            $parent_role = isset(RbacController::$role_hierarchy[$role]) || array_key_exists($role,RbacController::$role_hierarchy) ?  RbacController::$role_hierarchy[$role] : null;

            if(!is_null($parent_role))
            {
                $condition = self::generateRoleCondition($parent_role, $checking_role);
                $condition = $condition || $role == $checking_role;
            }
            else
            {
                $condition = $role == $checking_role;
            }

        return $condition;
    }
}