repo_name
stringlengths 4
116
| path
stringlengths 4
379
| size
stringlengths 1
7
| content
stringlengths 3
1.05M
| license
stringclasses 15
values |
---|---|---|---|---|
alexfilth/quezacotl | Quezacotl/InitWorker.cs | 173000 | using System;
using System.Text;
namespace Quezacotl
{
class InitWorker
{
#region Declarations
public static byte[] Init;
public static byte[] BackupInit;
public static int GfDataOffset = -1;
public static int OffsetToGfSelected = -1;
public static int CharacterDataOffset = -1;
public static int OffsetToCharacterSelected = -1;
public static int ShopsDataOffset = -1;
public static int OffsetToShopsSelected = -1;
public static int ConfigDataOffset = -1;
public static int OffsetToConfigSelected = -1;
public static int MiscDataOffset = -1;
public static int OffsetToMiscSelected = -1;
public static int ItemsBattleOrderDataOffset = -1;
public static int OffsetToItemsBattleOrderSelected = -1;
public static int ItemsDataOffset = -1;
public static int OffsetToItemsSelected = -1;
public static GfData GetSelectedGfData;
public static CharactersData GetSelectedCharactersData;
public static ConfigData GetSelectedConfigData;
public static MiscData GetSelectedMiscData;
public static ItemsBattleOrderData GetSelectedItemsBattleOrderData;
public static ItemsData GetSelectedItemsData;
public struct GfData
{
public string Name;
public UInt32 Exp;
public byte Unknown1;
public byte Available;
public UInt16 CurrentHp;
public byte LearnedAbility1;
public byte LearnedAbility2;
public byte LearnedAbility3;
public byte LearnedAbility4;
public byte LearnedAbility5;
public byte LearnedAbility6;
public byte LearnedAbility7;
public byte LearnedAbility8;
public byte LearnedAbility9;
public byte LearnedAbility10;
public byte LearnedAbility11;
public byte LearnedAbility12;
public byte LearnedAbility13;
public byte LearnedAbility14;
public byte LearnedAbility15;
public byte LearnedAbility16;
public byte ApAbility1;
public byte ApAbility2;
public byte ApAbility3;
public byte ApAbility4;
public byte ApAbility5;
public byte ApAbility6;
public byte ApAbility7;
public byte ApAbility8;
public byte ApAbility9;
public byte ApAbility10;
public byte ApAbility11;
public byte ApAbility12;
public byte ApAbility13;
public byte ApAbility14;
public byte ApAbility15;
public byte ApAbility16;
public byte ApAbility17;
public byte ApAbility18;
public byte ApAbility19;
public byte ApAbility20;
public byte ApAbility21;
public byte ApAbility22;
public UInt16 Kills;
public UInt16 KOs;
public byte LearningAbility;
public byte ForgottenAbilities;
}
public struct CharactersData
{
public UInt16 CurrentHp;
public UInt16 HpBonus;
public UInt32 Exp;
public byte ModelId;
public byte WeaponId;
public byte Str;
public byte Vit;
public byte Mag;
public byte Spr;
public byte Spd;
public byte Luck;
public byte Magic1;
public byte Magic1Quantity;
public byte Magic2;
public byte Magic2Quantity;
public byte Magic3;
public byte Magic3Quantity;
public byte Magic4;
public byte Magic4Quantity;
public byte Magic5;
public byte Magic5Quantity;
public byte Magic6;
public byte Magic6Quantity;
public byte Magic7;
public byte Magic7Quantity;
public byte Magic8;
public byte Magic8Quantity;
public byte Magic9;
public byte Magic9Quantity;
public byte Magic10;
public byte Magic10Quantity;
public byte Magic11;
public byte Magic11Quantity;
public byte Magic12;
public byte Magic12Quantity;
public byte Magic13;
public byte Magic13Quantity;
public byte Magic14;
public byte Magic14Quantity;
public byte Magic15;
public byte Magic15Quantity;
public byte Magic16;
public byte Magic16Quantity;
public byte Magic17;
public byte Magic17Quantity;
public byte Magic18;
public byte Magic18Quantity;
public byte Magic19;
public byte Magic19Quantity;
public byte Magic20;
public byte Magic20Quantity;
public byte Magic21;
public byte Magic21Quantity;
public byte Magic22;
public byte Magic22Quantity;
public byte Magic23;
public byte Magic23Quantity;
public byte Magic24;
public byte Magic24Quantity;
public byte Magic25;
public byte Magic25Quantity;
public byte Magic26;
public byte Magic26Quantity;
public byte Magic27;
public byte Magic27Quantity;
public byte Magic28;
public byte Magic28Quantity;
public byte Magic29;
public byte Magic29Quantity;
public byte Magic30;
public byte Magic30Quantity;
public byte Magic31;
public byte Magic31Quantity;
public byte Magic32;
public byte Magic32Quantity;
public byte Command1;
public byte Command2;
public byte Command3;
public byte Unknown1;
public byte Ability1;
public byte Ability2;
public byte Ability3;
public byte Ability4;
public byte JunGf1;
public byte JunGf2;
public byte Unknown2;
public byte AltModel;
public byte JunHP;
public byte JunStr;
public byte JunVit;
public byte JunMag;
public byte JunSpr;
public byte JunSpd;
public byte JunEva;
public byte JunHit;
public byte JunLuck;
public byte JunEleAtk;
public byte JunStatusAtk;
public byte JunEleDef1;
public byte JunEleDef2;
public byte JunEleDef3;
public byte JunEleDef4;
public byte JunStatusDef1;
public byte JunStatusDef2;
public byte JunStatusDef3;
public byte JunStatusDef4;
public byte Unknown3;
public UInt16 GfComp1;
public UInt16 GfComp2;
public UInt16 GfComp3;
public UInt16 GfComp4;
public UInt16 GfComp5;
public UInt16 GfComp6;
public UInt16 GfComp7;
public UInt16 GfComp8;
public UInt16 GfComp9;
public UInt16 GfComp10;
public UInt16 GfComp11;
public UInt16 GfComp12;
public UInt16 GfComp13;
public UInt16 GfComp14;
public UInt16 GfComp15;
public UInt16 GfComp16;
public UInt16 Kills;
public UInt16 KOs;
public byte Exist;
public byte Unknown4;
public byte CurrentStatus;
public byte Unknown5;
}
public struct ConfigData
{
public byte BattleSpeed;
public byte BattleMessage;
public byte FieldMessage;
public byte Volume;
public byte Flag;
public byte Scan;
public byte Camera;
public byte KeyUnk1;
public byte KeyEscape;
public byte KeyPov;
public byte KeyWindow;
public byte KeyTrigger;
public byte KeyCancel;
public byte KeyMenu;
public byte KeyTalk;
public byte KeyTripleTriad;
public byte KeySelect;
public byte KeyUnk2;
public byte KeyUnk3;
public byte KeyStart;
}
public struct MiscData
{
public byte PartyMem1;
public byte PartyMem2;
public byte PartyMem3;
public byte KnownWeapons1;
public byte KnownWeapons2;
public byte KnownWeapons3;
public byte KnownWeapons4;
public string GrieverName;
public UInt16 Unknown1;
public UInt16 Unknown2;
public UInt32 Gil;
public UInt32 GilLaguna;
public byte limitQuistis1;
public byte limitQuistis2;
public byte limitZell1;
public byte limitZell2;
public byte limitIrvine;
public byte limitSelphie;
public byte limitAngeloCompleted;
public byte limitAngeloKnown;
public byte limitAngeloPoints1;
public byte limitAngeloPoints2;
public byte limitAngeloPoints3;
public byte limitAngeloPoints4;
public byte limitAngeloPoints5;
public byte limitAngeloPoints6;
public byte limitAngeloPoints7;
public byte limitAngeloPoints8;
}
public struct ItemsBattleOrderData
{
}
public struct ItemsData
{
public byte Item1;
public byte Item2;
public byte Item3;
public byte Item4;
public byte Item5;
public byte Item6;
public byte Item7;
public byte Item8;
public byte Item9;
public byte Item10;
public byte Item11;
public byte Item12;
public byte Item13;
public byte Item14;
public byte Item15;
public byte Item16;
public byte Item17;
public byte Item18;
public byte Item19;
public byte Item20;
public byte Item21;
public byte Item22;
public byte Item23;
public byte Item24;
public byte Item25;
public byte Item26;
public byte Item27;
public byte Item28;
public byte Item29;
public byte Item30;
public byte Item31;
public byte Item32;
public byte Item33;
public byte Item34;
public byte Item35;
public byte Item36;
public byte Item37;
public byte Item38;
public byte Item39;
public byte Item40;
public byte Item41;
public byte Item42;
public byte Item43;
public byte Item44;
public byte Item45;
public byte Item46;
public byte Item47;
public byte Item48;
public byte Item49;
public byte Item50;
public byte Item51;
public byte Item52;
public byte Item53;
public byte Item54;
public byte Item55;
public byte Item56;
public byte Item57;
public byte Item58;
public byte Item59;
public byte Item60;
public byte Item61;
public byte Item62;
public byte Item63;
public byte Item64;
public byte Item65;
public byte Item66;
public byte Item67;
public byte Item68;
public byte Item69;
public byte Item70;
public byte Item71;
public byte Item72;
public byte Item73;
public byte Item74;
public byte Item75;
public byte Item76;
public byte Item77;
public byte Item78;
public byte Item79;
public byte Item80;
public byte Item81;
public byte Item82;
public byte Item83;
public byte Item84;
public byte Item85;
public byte Item86;
public byte Item87;
public byte Item88;
public byte Item89;
public byte Item90;
public byte Item91;
public byte Item92;
public byte Item93;
public byte Item94;
public byte Item95;
public byte Item96;
public byte Item97;
public byte Item98;
public byte Item99;
public byte Item100;
public byte Item101;
public byte Item102;
public byte Item103;
public byte Item104;
public byte Item105;
public byte Item106;
public byte Item107;
public byte Item108;
public byte Item109;
public byte Item110;
public byte Item111;
public byte Item112;
public byte Item113;
public byte Item114;
public byte Item115;
public byte Item116;
public byte Item117;
public byte Item118;
public byte Item119;
public byte Item120;
public byte Item121;
public byte Item122;
public byte Item123;
public byte Item124;
public byte Item125;
public byte Item126;
public byte Item127;
public byte Item128;
public byte Item129;
public byte Item130;
public byte Item131;
public byte Item132;
public byte Item133;
public byte Item134;
public byte Item135;
public byte Item136;
public byte Item137;
public byte Item138;
public byte Item139;
public byte Item140;
public byte Item141;
public byte Item142;
public byte Item143;
public byte Item144;
public byte Item145;
public byte Item146;
public byte Item147;
public byte Item148;
public byte Item149;
public byte Item150;
public byte Item151;
public byte Item152;
public byte Item153;
public byte Item154;
public byte Item155;
public byte Item156;
public byte Item157;
public byte Item158;
public byte Item159;
public byte Item160;
public byte Item161;
public byte Item162;
public byte Item163;
public byte Item164;
public byte Item165;
public byte Item166;
public byte Item167;
public byte Item168;
public byte Item169;
public byte Item170;
public byte Item171;
public byte Item172;
public byte Item173;
public byte Item174;
public byte Item175;
public byte Item176;
public byte Item177;
public byte Item178;
public byte Item179;
public byte Item180;
public byte Item181;
public byte Item182;
public byte Item183;
public byte Item184;
public byte Item185;
public byte Item186;
public byte Item187;
public byte Item188;
public byte Item189;
public byte Item190;
public byte Item191;
public byte Item192;
public byte Item193;
public byte Item194;
public byte Item195;
public byte Item196;
public byte Item197;
public byte Item198;
public byte Item1Quantity;
public byte Item2Quantity;
public byte Item3Quantity;
public byte Item4Quantity;
public byte Item5Quantity;
public byte Item6Quantity;
public byte Item7Quantity;
public byte Item8Quantity;
public byte Item9Quantity;
public byte Item10Quantity;
public byte Item11Quantity;
public byte Item12Quantity;
public byte Item13Quantity;
public byte Item14Quantity;
public byte Item15Quantity;
public byte Item16Quantity;
public byte Item17Quantity;
public byte Item18Quantity;
public byte Item19Quantity;
public byte Item20Quantity;
public byte Item21Quantity;
public byte Item22Quantity;
public byte Item23Quantity;
public byte Item24Quantity;
public byte Item25Quantity;
public byte Item26Quantity;
public byte Item27Quantity;
public byte Item28Quantity;
public byte Item29Quantity;
public byte Item30Quantity;
public byte Item31Quantity;
public byte Item32Quantity;
public byte Item33Quantity;
public byte Item34Quantity;
public byte Item35Quantity;
public byte Item36Quantity;
public byte Item37Quantity;
public byte Item38Quantity;
public byte Item39Quantity;
public byte Item40Quantity;
public byte Item41Quantity;
public byte Item42Quantity;
public byte Item43Quantity;
public byte Item44Quantity;
public byte Item45Quantity;
public byte Item46Quantity;
public byte Item47Quantity;
public byte Item48Quantity;
public byte Item49Quantity;
public byte Item50Quantity;
public byte Item51Quantity;
public byte Item52Quantity;
public byte Item53Quantity;
public byte Item54Quantity;
public byte Item55Quantity;
public byte Item56Quantity;
public byte Item57Quantity;
public byte Item58Quantity;
public byte Item59Quantity;
public byte Item60Quantity;
public byte Item61Quantity;
public byte Item62Quantity;
public byte Item63Quantity;
public byte Item64Quantity;
public byte Item65Quantity;
public byte Item66Quantity;
public byte Item67Quantity;
public byte Item68Quantity;
public byte Item69Quantity;
public byte Item70Quantity;
public byte Item71Quantity;
public byte Item72Quantity;
public byte Item73Quantity;
public byte Item74Quantity;
public byte Item75Quantity;
public byte Item76Quantity;
public byte Item77Quantity;
public byte Item78Quantity;
public byte Item79Quantity;
public byte Item80Quantity;
public byte Item81Quantity;
public byte Item82Quantity;
public byte Item83Quantity;
public byte Item84Quantity;
public byte Item85Quantity;
public byte Item86Quantity;
public byte Item87Quantity;
public byte Item88Quantity;
public byte Item89Quantity;
public byte Item90Quantity;
public byte Item91Quantity;
public byte Item92Quantity;
public byte Item93Quantity;
public byte Item94Quantity;
public byte Item95Quantity;
public byte Item96Quantity;
public byte Item97Quantity;
public byte Item98Quantity;
public byte Item99Quantity;
public byte Item100Quantity;
public byte Item101Quantity;
public byte Item102Quantity;
public byte Item103Quantity;
public byte Item104Quantity;
public byte Item105Quantity;
public byte Item106Quantity;
public byte Item107Quantity;
public byte Item108Quantity;
public byte Item109Quantity;
public byte Item110Quantity;
public byte Item111Quantity;
public byte Item112Quantity;
public byte Item113Quantity;
public byte Item114Quantity;
public byte Item115Quantity;
public byte Item116Quantity;
public byte Item117Quantity;
public byte Item118Quantity;
public byte Item119Quantity;
public byte Item120Quantity;
public byte Item121Quantity;
public byte Item122Quantity;
public byte Item123Quantity;
public byte Item124Quantity;
public byte Item125Quantity;
public byte Item126Quantity;
public byte Item127Quantity;
public byte Item128Quantity;
public byte Item129Quantity;
public byte Item130Quantity;
public byte Item131Quantity;
public byte Item132Quantity;
public byte Item133Quantity;
public byte Item134Quantity;
public byte Item135Quantity;
public byte Item136Quantity;
public byte Item137Quantity;
public byte Item138Quantity;
public byte Item139Quantity;
public byte Item140Quantity;
public byte Item141Quantity;
public byte Item142Quantity;
public byte Item143Quantity;
public byte Item144Quantity;
public byte Item145Quantity;
public byte Item146Quantity;
public byte Item147Quantity;
public byte Item148Quantity;
public byte Item149Quantity;
public byte Item150Quantity;
public byte Item151Quantity;
public byte Item152Quantity;
public byte Item153Quantity;
public byte Item154Quantity;
public byte Item155Quantity;
public byte Item156Quantity;
public byte Item157Quantity;
public byte Item158Quantity;
public byte Item159Quantity;
public byte Item160Quantity;
public byte Item161Quantity;
public byte Item162Quantity;
public byte Item163Quantity;
public byte Item164Quantity;
public byte Item165Quantity;
public byte Item166Quantity;
public byte Item167Quantity;
public byte Item168Quantity;
public byte Item169Quantity;
public byte Item170Quantity;
public byte Item171Quantity;
public byte Item172Quantity;
public byte Item173Quantity;
public byte Item174Quantity;
public byte Item175Quantity;
public byte Item176Quantity;
public byte Item177Quantity;
public byte Item178Quantity;
public byte Item179Quantity;
public byte Item180Quantity;
public byte Item181Quantity;
public byte Item182Quantity;
public byte Item183Quantity;
public byte Item184Quantity;
public byte Item185Quantity;
public byte Item186Quantity;
public byte Item187Quantity;
public byte Item188Quantity;
public byte Item189Quantity;
public byte Item190Quantity;
public byte Item191Quantity;
public byte Item192Quantity;
public byte Item193Quantity;
public byte Item194Quantity;
public byte Item195Quantity;
public byte Item196Quantity;
public byte Item197Quantity;
public byte Item198Quantity;
}
#endregion
#region WORD and DWORD to Init
/// <summary>
/// This is for 2 bytes
/// </summary>
/// <param name="a"></param>
/// <param name="add"></param>
private static void WordToInit(uint a, int add, byte mode)
{
byte[] bytes = BitConverter.GetBytes(a);
switch (mode)
{
case (byte)Mode.Mode_GF:
Array.Copy(bytes, 0, Init, OffsetToGfSelected + add, 2);
break;
case (byte)Mode.Mode_Characters:
Array.Copy(bytes, 0, Init, OffsetToCharacterSelected + add, 2);
break;
case (byte)Mode.Mode_Config:
Array.Copy(bytes, 0, Init, OffsetToConfigSelected + add, 2);
break;
case (byte)Mode.Mode_Misc:
Array.Copy(bytes, 0, Init, OffsetToMiscSelected + add, 2);
break;
case (byte)Mode.Mode_Items:
Array.Copy(bytes, 0, Init, OffsetToItemsSelected + add, 2);
break;
default:
return;
}
}
/// <summary>
/// This is for 4 bytes
/// </summary>
/// <param name="a"></param>
/// <param name="add"></param>
private static void DwordToInit(uint a, int add, byte mode)
{
byte[] bytes = BitConverter.GetBytes(a);
switch (mode)
{
case (byte)Mode.Mode_GF:
Array.Copy(bytes, 0, Init, OffsetToGfSelected + add, 4);
break;
case (byte)Mode.Mode_Characters:
Array.Copy(bytes, 0, Init, OffsetToCharacterSelected + add, 4);
break;
case (byte)Mode.Mode_Config:
Array.Copy(bytes, 0, Init, OffsetToConfigSelected + add, 4);
break;
case (byte)Mode.Mode_Misc:
Array.Copy(bytes, 0, Init, OffsetToMiscSelected + add, 4);
break;
case (byte)Mode.Mode_Items:
Array.Copy(bytes, 0, Init, OffsetToItemsSelected + add, 4);
break;
default:
return;
}
}
enum Mode : byte
{
Mode_GF,
Mode_Characters,
Mode_Config,
Mode_Misc,
Mode_Items,
}
#endregion
#region Write GF Variables
public static void UpdateVariable_GF(int index, object variable)
{
if (!Form1._loaded || Init == null)
return;
switch (index)
{
case 0:
byte[] text = FF8Text.Cipher((string)variable);
int emptyLenght = 12 - text.Length;
if (emptyLenght > 0)
{
byte[] empty = new byte[emptyLenght];
byte[] temp = new byte[text.Length + empty.Length];
Buffer.BlockCopy(text, 0, temp, 0, text.Length);
Buffer.BlockCopy(empty, 0, temp, text.Length, empty.Length);
Array.Copy(temp, 0, Init, OffsetToGfSelected, 12);
}
else
Array.Copy(text, 0, Init, OffsetToGfSelected, 12);
return;
case 1:
DwordToInit(Convert.ToUInt32(variable), 12, (byte)Mode.Mode_GF); //Exp
return;
case 2:
Init[OffsetToGfSelected + 16] = Convert.ToByte(variable); //Unknown 1
return;
case 3:
Init[OffsetToGfSelected + 17] = Convert.ToByte(variable); //Available
return;
case 4:
WordToInit(Convert.ToUInt16(variable), 18, (byte)Mode.Mode_GF); //Current Hp
return;
case 5:
Init[OffsetToGfSelected + 20] = (byte)(Init[OffsetToGfSelected + 20] ^ Convert.ToByte(variable)); //Ability 1
return;
case 6:
Init[OffsetToGfSelected + 21] = (byte)(Init[OffsetToGfSelected + 21] ^ Convert.ToByte(variable)); //Ability 2
return;
case 7:
Init[OffsetToGfSelected + 22] = (byte)(Init[OffsetToGfSelected + 22] ^ Convert.ToByte(variable)); //Ability 3
return;
case 8:
Init[OffsetToGfSelected + 23] = (byte)(Init[OffsetToGfSelected + 23] ^ Convert.ToByte(variable)); //Ability 4
return;
case 9:
Init[OffsetToGfSelected + 24] = (byte)(Init[OffsetToGfSelected + 24] ^ Convert.ToByte(variable)); //Ability 5
return;
case 10:
Init[OffsetToGfSelected + 25] = (byte)(Init[OffsetToGfSelected + 25] ^ Convert.ToByte(variable)); //Ability 6
return;
case 11:
Init[OffsetToGfSelected + 26] = (byte)(Init[OffsetToGfSelected + 26] ^ Convert.ToByte(variable)); //Ability 7
return;
case 12:
Init[OffsetToGfSelected + 27] = (byte)(Init[OffsetToGfSelected + 27] ^ Convert.ToByte(variable)); //Ability 8
return;
case 13:
Init[OffsetToGfSelected + 28] = (byte)(Init[OffsetToGfSelected + 28] ^ Convert.ToByte(variable)); //Ability 9
return;
case 14:
Init[OffsetToGfSelected + 29] = (byte)(Init[OffsetToGfSelected + 29] ^ Convert.ToByte(variable)); //Ability 10
return;
case 15:
Init[OffsetToGfSelected + 30] = (byte)(Init[OffsetToGfSelected + 30] ^ Convert.ToByte(variable)); //Ability 11
return;
case 16:
Init[OffsetToGfSelected + 31] = (byte)(Init[OffsetToGfSelected + 31] ^ Convert.ToByte(variable)); //Ability 12
return;
case 17:
Init[OffsetToGfSelected + 32] = (byte)(Init[OffsetToGfSelected + 32] ^ Convert.ToByte(variable)); //Ability 13
return;
case 18:
Init[OffsetToGfSelected + 33] = (byte)(Init[OffsetToGfSelected + 33] ^ Convert.ToByte(variable)); //Ability 14
return;
case 19:
Init[OffsetToGfSelected + 34] = (byte)(Init[OffsetToGfSelected + 34] ^ Convert.ToByte(variable)); //Ability 15
return;
case 20:
Init[OffsetToGfSelected + 35] = (byte)(Init[OffsetToGfSelected + 35] ^ Convert.ToByte(variable)); //Ability 16
return;
case 21:
Init[OffsetToGfSelected + 36] = Convert.ToByte(variable); //Ap Ability 1
return;
case 22:
Init[OffsetToGfSelected + 37] = Convert.ToByte(variable); //Ap Ability 2
return;
case 23:
Init[OffsetToGfSelected + 38] = Convert.ToByte(variable); //Ap Ability 3
return;
case 24:
Init[OffsetToGfSelected + 39] = Convert.ToByte(variable); //Ap Ability 4
return;
case 25:
Init[OffsetToGfSelected + 40] = Convert.ToByte(variable); //Ap Ability 5
return;
case 26:
Init[OffsetToGfSelected + 41] = Convert.ToByte(variable); //Ap Ability 6
return;
case 27:
Init[OffsetToGfSelected + 42] = Convert.ToByte(variable); //Ap Ability 7
return;
case 28:
Init[OffsetToGfSelected + 43] = Convert.ToByte(variable); //Ap Ability 8
return;
case 29:
Init[OffsetToGfSelected + 44] = Convert.ToByte(variable); //Ap Ability 9
return;
case 30:
Init[OffsetToGfSelected + 45] = Convert.ToByte(variable); //Ap Ability 10
return;
case 31:
Init[OffsetToGfSelected + 46] = Convert.ToByte(variable); //Ap Ability 11
return;
case 32:
Init[OffsetToGfSelected + 47] = Convert.ToByte(variable); //Ap Ability 12
return;
case 33:
Init[OffsetToGfSelected + 48] = Convert.ToByte(variable); //Ap Ability 13
return;
case 34:
Init[OffsetToGfSelected + 49] = Convert.ToByte(variable); //Ap Ability 14
return;
case 35:
Init[OffsetToGfSelected + 50] = Convert.ToByte(variable); //Ap Ability 15
return;
case 36:
Init[OffsetToGfSelected + 51] = Convert.ToByte(variable); //Ap Ability 16
return;
case 37:
Init[OffsetToGfSelected + 52] = Convert.ToByte(variable); //Ap Ability 17
return;
case 38:
Init[OffsetToGfSelected + 53] = Convert.ToByte(variable); //Ap Ability 18
return;
case 39:
Init[OffsetToGfSelected + 54] = Convert.ToByte(variable); //Ap Ability 19
return;
case 40:
Init[OffsetToGfSelected + 55] = Convert.ToByte(variable); //Ap Ability 20
return;
case 41:
Init[OffsetToGfSelected + 56] = Convert.ToByte(variable); //Ap Ability 21
return;
case 42:
Init[OffsetToGfSelected + 57] = Convert.ToByte(variable); //Ap Ability 22
return;
case 43:
WordToInit(Convert.ToUInt16(variable), 60, (byte)Mode.Mode_GF); //Kills
return;
case 44:
WordToInit(Convert.ToUInt16(variable), 62, (byte)Mode.Mode_GF); //KOs
return;
case 45:
Init[OffsetToGfSelected + 64] = Convert.ToByte(variable); //Learning Ability
return;
case 46:
//Reserved for forgotten abilities
return;
}
}
#endregion
#region Write Characters Variables
public static void UpdateVariable_Characters(int index, object variable)
{
if (!Form1._loaded || Init == null)
return;
switch (index)
{
case 0:
WordToInit(Convert.ToUInt16(variable), 0, (byte)Mode.Mode_Characters); //Current Hp
return;
case 1:
WordToInit(Convert.ToUInt16(variable), 2, (byte)Mode.Mode_Characters); //Max Hp
return;
case 2:
DwordToInit(Convert.ToUInt32(variable), 4, (byte)Mode.Mode_Characters); //Exp
return;
case 3:
Init[OffsetToCharacterSelected + 8] = Convert.ToByte(variable); //model id
return;
case 4:
Init[OffsetToCharacterSelected + 9] = Convert.ToByte(variable); //weapon id
return;
case 5:
Init[OffsetToCharacterSelected + 10] = Convert.ToByte(variable); //str
return;
case 6:
Init[OffsetToCharacterSelected + 11] = Convert.ToByte(variable); //vit
return;
case 7:
Init[OffsetToCharacterSelected + 12] = Convert.ToByte(variable); //mag
return;
case 8:
Init[OffsetToCharacterSelected + 13] = Convert.ToByte(variable); //spr
return;
case 9:
Init[OffsetToCharacterSelected + 14] = Convert.ToByte(variable); //spd
return;
case 10:
Init[OffsetToCharacterSelected + 15] = Convert.ToByte(variable); //luck
return;
case 11:
Init[OffsetToCharacterSelected + 16] = Convert.ToByte(variable); //magic 1
return;
case 12:
Init[OffsetToCharacterSelected + 17] = Convert.ToByte(variable); //magic quantity 1
return;
case 13:
Init[OffsetToCharacterSelected + 18] = Convert.ToByte(variable); //magic 2
return;
case 14:
Init[OffsetToCharacterSelected + 19] = Convert.ToByte(variable); //magic quantity 2
return;
case 15:
Init[OffsetToCharacterSelected + 20] = Convert.ToByte(variable); //magic 3
return;
case 16:
Init[OffsetToCharacterSelected + 21] = Convert.ToByte(variable); //magic quantity 3
return;
case 17:
Init[OffsetToCharacterSelected + 22] = Convert.ToByte(variable); //magic 4
return;
case 18:
Init[OffsetToCharacterSelected + 23] = Convert.ToByte(variable); //magic quantity 4
return;
case 19:
Init[OffsetToCharacterSelected + 24] = Convert.ToByte(variable); //magic 5
return;
case 20:
Init[OffsetToCharacterSelected + 25] = Convert.ToByte(variable); //magic quantity 5
return;
case 21:
Init[OffsetToCharacterSelected + 26] = Convert.ToByte(variable); //magic 6
return;
case 22:
Init[OffsetToCharacterSelected + 27] = Convert.ToByte(variable); //magic quantity 6
return;
case 23:
Init[OffsetToCharacterSelected + 28] = Convert.ToByte(variable); //magic 7
return;
case 24:
Init[OffsetToCharacterSelected + 29] = Convert.ToByte(variable); //magic quantity 7
return;
case 25:
Init[OffsetToCharacterSelected + 30] = Convert.ToByte(variable); //magic 8
return;
case 26:
Init[OffsetToCharacterSelected + 31] = Convert.ToByte(variable); //magic quantity 8
return;
case 27:
Init[OffsetToCharacterSelected + 32] = Convert.ToByte(variable); //magic 9
return;
case 28:
Init[OffsetToCharacterSelected + 33] = Convert.ToByte(variable); //magic quantity 9
return;
case 29:
Init[OffsetToCharacterSelected + 34] = Convert.ToByte(variable); //magic 10
return;
case 30:
Init[OffsetToCharacterSelected + 35] = Convert.ToByte(variable); //magic quantity 10
return;
case 31:
Init[OffsetToCharacterSelected + 36] = Convert.ToByte(variable); //magic 10
return;
case 32:
Init[OffsetToCharacterSelected + 37] = Convert.ToByte(variable); //magic quantity 11
return;
case 33:
Init[OffsetToCharacterSelected + 38] = Convert.ToByte(variable); //magic 12
return;
case 34:
Init[OffsetToCharacterSelected + 39] = Convert.ToByte(variable); //magic quantity 12
return;
case 35:
Init[OffsetToCharacterSelected + 40] = Convert.ToByte(variable); //magic 13
return;
case 36:
Init[OffsetToCharacterSelected + 41] = Convert.ToByte(variable); //magic quantity 13
return;
case 37:
Init[OffsetToCharacterSelected + 42] = Convert.ToByte(variable); //magic 14
return;
case 38:
Init[OffsetToCharacterSelected + 43] = Convert.ToByte(variable); //magic quantity 14
return;
case 39:
Init[OffsetToCharacterSelected + 44] = Convert.ToByte(variable); //magic 15
return;
case 40:
Init[OffsetToCharacterSelected + 45] = Convert.ToByte(variable); //magic quantity 15
return;
case 41:
Init[OffsetToCharacterSelected + 46] = Convert.ToByte(variable); //magic 16
return;
case 42:
Init[OffsetToCharacterSelected + 47] = Convert.ToByte(variable); //magic quantity 16
return;
case 43:
Init[OffsetToCharacterSelected + 48] = Convert.ToByte(variable); //magic 17
return;
case 44:
Init[OffsetToCharacterSelected + 49] = Convert.ToByte(variable); //magic quantity 17
return;
case 45:
Init[OffsetToCharacterSelected + 50] = Convert.ToByte(variable); //magic 18
return;
case 46:
Init[OffsetToCharacterSelected + 51] = Convert.ToByte(variable); //magic quantity 18
return;
case 47:
Init[OffsetToCharacterSelected + 52] = Convert.ToByte(variable); //magic 19
return;
case 48:
Init[OffsetToCharacterSelected + 53] = Convert.ToByte(variable); //magic quantity 19
return;
case 49:
Init[OffsetToCharacterSelected + 54] = Convert.ToByte(variable); //magic 20
return;
case 50:
Init[OffsetToCharacterSelected + 55] = Convert.ToByte(variable); //magic quantity 20
return;
case 51:
Init[OffsetToCharacterSelected + 56] = Convert.ToByte(variable); //magic 21
return;
case 52:
Init[OffsetToCharacterSelected + 57] = Convert.ToByte(variable); //magic quantity 21
return;
case 53:
Init[OffsetToCharacterSelected + 58] = Convert.ToByte(variable); //magic 22
return;
case 54:
Init[OffsetToCharacterSelected + 59] = Convert.ToByte(variable); //magic quantity 22
return;
case 55:
Init[OffsetToCharacterSelected + 60] = Convert.ToByte(variable); //magic 23
return;
case 56:
Init[OffsetToCharacterSelected + 61] = Convert.ToByte(variable); //magic quantity 23
return;
case 57:
Init[OffsetToCharacterSelected + 62] = Convert.ToByte(variable); //magic 24
return;
case 58:
Init[OffsetToCharacterSelected + 63] = Convert.ToByte(variable); //magic quantity 24
return;
case 59:
Init[OffsetToCharacterSelected + 64] = Convert.ToByte(variable); //magic 25
return;
case 60:
Init[OffsetToCharacterSelected + 65] = Convert.ToByte(variable); //magic quantity 25
return;
case 61:
Init[OffsetToCharacterSelected + 66] = Convert.ToByte(variable); //magic 26
return;
case 62:
Init[OffsetToCharacterSelected + 67] = Convert.ToByte(variable); //magic quantity 26
return;
case 63:
Init[OffsetToCharacterSelected + 68] = Convert.ToByte(variable); //magic 27
return;
case 64:
Init[OffsetToCharacterSelected + 69] = Convert.ToByte(variable); //magic quantity 27
return;
case 65:
Init[OffsetToCharacterSelected + 70] = Convert.ToByte(variable); //magic 28
return;
case 66:
Init[OffsetToCharacterSelected + 71] = Convert.ToByte(variable); //magic quantity 28
return;
case 67:
Init[OffsetToCharacterSelected + 72] = Convert.ToByte(variable); //magic 29
return;
case 68:
Init[OffsetToCharacterSelected + 73] = Convert.ToByte(variable); //magic quantity 29
return;
case 69:
Init[OffsetToCharacterSelected + 74] = Convert.ToByte(variable); //magic 30
return;
case 70:
Init[OffsetToCharacterSelected + 75] = Convert.ToByte(variable); //magic quantity 30
return;
case 71:
Init[OffsetToCharacterSelected + 76] = Convert.ToByte(variable); //magic 31
return;
case 72:
Init[OffsetToCharacterSelected + 77] = Convert.ToByte(variable); //magic quantity 31
return;
case 73:
Init[OffsetToCharacterSelected + 78] = Convert.ToByte(variable); //magic 32
return;
case 74:
Init[OffsetToCharacterSelected + 79] = Convert.ToByte(variable); //magic quantity 32
return;
case 75:
Init[OffsetToCharacterSelected + 80] = Convert.ToByte(variable); //command 1
return;
case 76:
Init[OffsetToCharacterSelected + 81] = Convert.ToByte(variable); //command 2
return;
case 77:
Init[OffsetToCharacterSelected + 82] = Convert.ToByte(variable); //command 3
return;
case 78:
Init[OffsetToCharacterSelected + 83] = Convert.ToByte(variable); //unk 1
return;
case 79:
Init[OffsetToCharacterSelected + 84] = Convert.ToByte(variable); //ability 1
return;
case 80:
Init[OffsetToCharacterSelected + 85] = Convert.ToByte(variable); //ability 2
return;
case 81:
Init[OffsetToCharacterSelected + 86] = Convert.ToByte(variable); //ability 3
return;
case 82:
Init[OffsetToCharacterSelected + 87] = Convert.ToByte(variable); //ability 4
return;
case 83:
Init[OffsetToCharacterSelected + 88] = (byte)(Init[OffsetToCharacterSelected + 88] ^ Convert.ToByte(variable)); //jun gf 1
return;
case 84:
Init[OffsetToCharacterSelected + 89] = (byte)(Init[OffsetToCharacterSelected + 89] ^ Convert.ToByte(variable)); //jun gf 2
return;
case 85:
Init[OffsetToCharacterSelected + 90] = Convert.ToByte(variable); //unk 2
return;
case 86:
Init[OffsetToCharacterSelected + 91] = (byte)(Init[OffsetToCharacterSelected + 91] ^ Convert.ToByte(variable)); //alt model
return;
case 87:
Init[OffsetToCharacterSelected + 92] = Convert.ToByte(variable); //jun hp
return;
case 88:
Init[OffsetToCharacterSelected + 93] = Convert.ToByte(variable); //jun str
return;
case 89:
Init[OffsetToCharacterSelected + 94] = Convert.ToByte(variable); //jun vit
return;
case 90:
Init[OffsetToCharacterSelected + 95] = Convert.ToByte(variable); //jun mag
return;
case 91:
Init[OffsetToCharacterSelected + 96] = Convert.ToByte(variable); //jun spr
return;
case 92:
Init[OffsetToCharacterSelected + 97] = Convert.ToByte(variable); //jun spd
return;
case 93:
Init[OffsetToCharacterSelected + 98] = Convert.ToByte(variable); //jun eva
return;
case 94:
Init[OffsetToCharacterSelected + 99] = Convert.ToByte(variable); //jun hit
return;
case 95:
Init[OffsetToCharacterSelected + 100] = Convert.ToByte(variable); //jun luck
return;
case 96:
Init[OffsetToCharacterSelected + 101] = Convert.ToByte(variable); //jun ele atk
return;
case 97:
Init[OffsetToCharacterSelected + 102] = Convert.ToByte(variable); //jun status atk
return;
case 98:
Init[OffsetToCharacterSelected + 103] = Convert.ToByte(variable); //JunEleDef1
return;
case 99:
Init[OffsetToCharacterSelected + 104] = Convert.ToByte(variable); //JunEleDef2
return;
case 100:
Init[OffsetToCharacterSelected + 105] = Convert.ToByte(variable); //JunEleDef3
return;
case 101:
Init[OffsetToCharacterSelected + 106] = Convert.ToByte(variable); //JunEleDef4
return;
case 102:
Init[OffsetToCharacterSelected + 107] = Convert.ToByte(variable); //JunStatusDef1
return;
case 103:
Init[OffsetToCharacterSelected + 108] = Convert.ToByte(variable); //JunStatusDef2
return;
case 104:
Init[OffsetToCharacterSelected + 109] = Convert.ToByte(variable); //JunStatusDef3
return;
case 105:
Init[OffsetToCharacterSelected + 110] = Convert.ToByte(variable); //JunStatusDef4
return;
case 106:
Init[OffsetToCharacterSelected + 111] = Convert.ToByte(variable); //Unk 3
return;
case 107:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 112, (byte)Mode.Mode_Characters); //GF Compatibility 1
return;
case 108:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 114, (byte)Mode.Mode_Characters); //GF Compatibility 2
return;
case 109:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 116, (byte)Mode.Mode_Characters); //GF Compatibility 3
return;
case 110:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 118, (byte)Mode.Mode_Characters); //GF Compatibility 4
return;
case 111:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 120, (byte)Mode.Mode_Characters); //GF Compatibility 5
return;
case 112:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 122, (byte)Mode.Mode_Characters); //GF Compatibility 6
return;
case 113:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 124, (byte)Mode.Mode_Characters); //GF Compatibility 7
return;
case 114:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 126, (byte)Mode.Mode_Characters); //GF Compatibility 8
return;
case 115:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 128, (byte)Mode.Mode_Characters); //GF Compatibility 9
return;
case 116:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 130, (byte)Mode.Mode_Characters); //GF Compatibility 10
return;
case 117:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 132, (byte)Mode.Mode_Characters); //GF Compatibility 11
return;
case 118:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 134, (byte)Mode.Mode_Characters); //GF Compatibility 12
return;
case 119:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 136, (byte)Mode.Mode_Characters); //GF Compatibility 13
return;
case 120:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 138, (byte)Mode.Mode_Characters); //GF Compatibility 14
return;
case 121:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 140, (byte)Mode.Mode_Characters); //GF Compatibility 15
return;
case 122:
WordToInit(6000 - (Convert.ToUInt16(variable)) * (uint)5, 142, (byte)Mode.Mode_Characters); //GF Compatibility 16
return;
case 123:
WordToInit(Convert.ToUInt16(variable), 144, (byte)Mode.Mode_Characters); //Kills
return;
case 124:
WordToInit(Convert.ToUInt16(variable), 146, (byte)Mode.Mode_Characters); //KOs
return;
case 125:
Init[OffsetToCharacterSelected + 148] = (byte)(Init[OffsetToCharacterSelected + 148] ^ Convert.ToByte(variable)); //Exist
return;
case 126:
Init[OffsetToCharacterSelected + 149] = Convert.ToByte(variable); //Unk 4
return;
case 127:
Init[OffsetToCharacterSelected + 150] = (byte)(Init[OffsetToCharacterSelected + 150] ^ Convert.ToByte(variable)); //Current Status
return;
case 128:
Init[OffsetToCharacterSelected + 151] = Convert.ToByte(variable); //Unk 5
return;
}
}
#endregion
#region Write Config Variables
public static void UpdateVariable_Config(int index, object variable)
{
if (!Form1._loaded || Init == null)
return;
switch (index)
{
case 0:
Init[OffsetToConfigSelected] = Convert.ToByte(variable); //battle speed
return;
case 1:
Init[OffsetToConfigSelected + 1] = Convert.ToByte(variable); //battle message
return;
case 2:
Init[OffsetToConfigSelected + 2] = Convert.ToByte(variable); //field message
return;
case 3:
Init[OffsetToConfigSelected + 3] = Convert.ToByte(variable); //Volume
return;
case 4:
Init[OffsetToConfigSelected + 4] = (byte)(Init[OffsetToConfigSelected + 4] ^ Convert.ToByte(variable)); //flag
return;
case 5:
Init[OffsetToConfigSelected + 5] = (byte)(Init[OffsetToConfigSelected + 5] ^ Convert.ToByte(variable)); //scan
return;
case 6:
Init[OffsetToConfigSelected + 6] = Convert.ToByte(variable); //camera movement
return;
case 7:
Init[OffsetToConfigSelected + 7] = Convert.ToByte(variable); // key unk 1
return;
case 8:
Init[OffsetToConfigSelected + 8] = Convert.ToByte(variable); //key escape
return;
case 9:
Init[OffsetToConfigSelected + 9] = Convert.ToByte(variable); //key pov
return;
case 10:
Init[OffsetToConfigSelected + 10] = Convert.ToByte(variable); //key window
return;
case 11:
Init[OffsetToConfigSelected + 11] = Convert.ToByte(variable); //key trigger
return;
case 12:
Init[OffsetToConfigSelected + 12] = Convert.ToByte(variable); //key cancel
return;
case 13:
Init[OffsetToConfigSelected + 13] = Convert.ToByte(variable); //key menu
return;
case 14:
Init[OffsetToConfigSelected + 14] = Convert.ToByte(variable); //key talk
return;
case 15:
Init[OffsetToConfigSelected + 15] = Convert.ToByte(variable); //key triple triad
return;
case 16:
Init[OffsetToConfigSelected + 16] = Convert.ToByte(variable); //key select
return;
case 17:
Init[OffsetToConfigSelected + 17] = Convert.ToByte(variable); //key unk 2
return;
case 18:
Init[OffsetToConfigSelected + 18] = Convert.ToByte(variable); //key unk 3
return;
case 19:
Init[OffsetToConfigSelected + 19] = Convert.ToByte(variable); //key start
return;
}
}
#endregion
#region Write Misc Variables
public static void UpdateVariable_Misc(int index, object variable)
{
if (!Form1._loaded || Init == null)
return;
switch (index)
{
case 0:
Init[OffsetToMiscSelected] = Convert.ToByte(variable); //party member 1
return;
case 1:
Init[OffsetToMiscSelected + 1] = Convert.ToByte(variable); //party member 2
return;
case 2:
Init[OffsetToMiscSelected + 2] = Convert.ToByte(variable); //party member 3
return;
case 3:
Init[OffsetToMiscSelected + 3] = (byte)(Init[OffsetToMiscSelected + 4] ^ Convert.ToByte(variable)); //known weapons 1
return;
case 4:
Init[OffsetToMiscSelected + 4] = (byte)(Init[OffsetToMiscSelected + 5] ^ Convert.ToByte(variable)); //known weapons 2
return;
case 5:
Init[OffsetToMiscSelected + 5] = (byte)(Init[OffsetToMiscSelected + 6] ^ Convert.ToByte(variable)); //known weapons 3
return;
case 6:
Init[OffsetToMiscSelected + 6] = (byte)(Init[OffsetToMiscSelected + 7] ^ Convert.ToByte(variable)); //known weapons 4
return;
case 7:
byte[] text = FF8Text.Cipher((string)variable);
int emptyLenght = 12 - text.Length;
if (emptyLenght > 0)
{
byte[] empty = new byte[emptyLenght];
byte[] temp = new byte[text.Length + empty.Length];
Buffer.BlockCopy(text, 0, temp, 0, text.Length);
Buffer.BlockCopy(empty, 0, temp, text.Length, empty.Length);
Array.Copy(temp, 0, Init, OffsetToMiscSelected + 8, 12);
}
else
Array.Copy(text, 0, Init, OffsetToMiscSelected + 8, 12);
return;
case 8:
WordToInit(Convert.ToUInt16(variable), 20, (byte)Mode.Mode_Misc); //Unknown 1
return;
case 9:
WordToInit(Convert.ToUInt16(variable), 22, (byte)Mode.Mode_Misc); //Unknown 2
return;
case 10:
DwordToInit(Convert.ToUInt32(variable), 24, (byte)Mode.Mode_Misc); //Gil
return;
case 11:
DwordToInit(Convert.ToUInt32(variable), 28, (byte)Mode.Mode_Misc); //Gil Laguna
return;
case 12:
Init[OffsetToMiscSelected + 32] = (byte)(Init[OffsetToMiscSelected + 32] ^ Convert.ToByte(variable)); //Quistis LB 1
return;
case 13:
Init[OffsetToMiscSelected + 33] = (byte)(Init[OffsetToMiscSelected + 33] ^ Convert.ToByte(variable)); //Quistis LB 1
return;
case 14:
Init[OffsetToMiscSelected + 34] = (byte)(Init[OffsetToMiscSelected + 34] ^ Convert.ToByte(variable)); //Zell LB 1
return;
case 15:
Init[OffsetToMiscSelected + 35] = (byte)(Init[OffsetToMiscSelected + 35] ^ Convert.ToByte(variable)); //Zell LB 1
return;
case 16:
Init[OffsetToMiscSelected + 36] = (byte)(Init[OffsetToMiscSelected + 36] ^ Convert.ToByte(variable)); //Irvine LB 1
return;
case 17:
Init[OffsetToMiscSelected + 37] = (byte)(Init[OffsetToMiscSelected + 37] ^ Convert.ToByte(variable)); //Selphie LB 1
return;
case 18:
Init[OffsetToMiscSelected + 38] = (byte)(Init[OffsetToMiscSelected + 38] ^ Convert.ToByte(variable)); //Angelo Completed
return;
case 19:
Init[OffsetToMiscSelected + 39] = (byte)(Init[OffsetToMiscSelected + 39] ^ Convert.ToByte(variable)); //Angelo Known
return;
case 20:
Init[OffsetToItemsSelected + 40] = Convert.ToByte(variable); //Angelo Point 1
return;
case 21:
Init[OffsetToItemsSelected + 41] = Convert.ToByte(variable); //Angelo Point 2
return;
case 22:
Init[OffsetToItemsSelected + 42] = Convert.ToByte(variable); //Angelo Point 3
return;
case 23:
Init[OffsetToItemsSelected + 43] = Convert.ToByte(variable); //Angelo Point 4
return;
case 24:
Init[OffsetToItemsSelected + 44] = Convert.ToByte(variable); //Angelo Point 5
return;
case 25:
Init[OffsetToItemsSelected + 45] = Convert.ToByte(variable); //Angelo Point 6
return;
case 26:
Init[OffsetToItemsSelected + 46] = Convert.ToByte(variable); //Angelo Point 7
return;
case 27:
Init[OffsetToItemsSelected + 47] = Convert.ToByte(variable); //Angelo Point 8
return;
}
}
#endregion
#region Write Items Variables
public static void UpdateVariable_Items(int index, object variable)
{
if (!Form1._loaded || Init == null)
return;
switch (index)
{
case 0:
Init[OffsetToItemsSelected + 0] = Convert.ToByte(variable); //Item 1
return;
case 1:
Init[OffsetToItemsSelected + 1] = Convert.ToByte(variable); //Item 1 Quantity
return;
case 2:
Init[OffsetToItemsSelected + 2] = Convert.ToByte(variable); //Item 2
return;
case 3:
Init[OffsetToItemsSelected + 3] = Convert.ToByte(variable); //Item 2 Quantity
return;
case 4:
Init[OffsetToItemsSelected + 4] = Convert.ToByte(variable); //Item 3
return;
case 5:
Init[OffsetToItemsSelected + 5] = Convert.ToByte(variable); //Item 3 Quantity
return;
case 6:
Init[OffsetToItemsSelected + 6] = Convert.ToByte(variable); //Item 4
return;
case 7:
Init[OffsetToItemsSelected + 7] = Convert.ToByte(variable); //Item 4 Quantity
return;
case 8:
Init[OffsetToItemsSelected + 8] = Convert.ToByte(variable); //Item 5
return;
case 9:
Init[OffsetToItemsSelected + 9] = Convert.ToByte(variable); //Item 5 Quantity
return;
case 10:
Init[OffsetToItemsSelected + 10] = Convert.ToByte(variable); //Item 6
return;
case 11:
Init[OffsetToItemsSelected + 11] = Convert.ToByte(variable); //Item 6 Quantity
return;
case 12:
Init[OffsetToItemsSelected + 12] = Convert.ToByte(variable); //Item 7
return;
case 13:
Init[OffsetToItemsSelected + 13] = Convert.ToByte(variable); //Item 7 Quantity
return;
case 14:
Init[OffsetToItemsSelected + 14] = Convert.ToByte(variable); //Item 8
return;
case 15:
Init[OffsetToItemsSelected + 15] = Convert.ToByte(variable); //Item 8 Quantity
return;
case 16:
Init[OffsetToItemsSelected + 16] = Convert.ToByte(variable); //Item 9
return;
case 17:
Init[OffsetToItemsSelected + 17] = Convert.ToByte(variable); //Item 9 Quantity
return;
case 18:
Init[OffsetToItemsSelected + 18] = Convert.ToByte(variable); //Item 10
return;
case 19:
Init[OffsetToItemsSelected + 19] = Convert.ToByte(variable); //Item 10 Quantity
return;
case 20:
Init[OffsetToItemsSelected + 20] = Convert.ToByte(variable); //Item 11
return;
case 21:
Init[OffsetToItemsSelected + 21] = Convert.ToByte(variable); //Item 11 Quantity
return;
case 22:
Init[OffsetToItemsSelected + 22] = Convert.ToByte(variable); //Item 12
return;
case 23:
Init[OffsetToItemsSelected + 23] = Convert.ToByte(variable); //Item 12 Quantity
return;
case 24:
Init[OffsetToItemsSelected + 24] = Convert.ToByte(variable); //Item 13
return;
case 25:
Init[OffsetToItemsSelected + 25] = Convert.ToByte(variable); //Item 13 Quantity
return;
case 26:
Init[OffsetToItemsSelected + 26] = Convert.ToByte(variable); //Item 14
return;
case 27:
Init[OffsetToItemsSelected + 27] = Convert.ToByte(variable); //Item 14 Quantity
return;
case 28:
Init[OffsetToItemsSelected + 28] = Convert.ToByte(variable); //Item 15
return;
case 29:
Init[OffsetToItemsSelected + 29] = Convert.ToByte(variable); //Item 15 Quantity
return;
case 30:
Init[OffsetToItemsSelected + 30] = Convert.ToByte(variable); //Item 16
return;
case 31:
Init[OffsetToItemsSelected + 31] = Convert.ToByte(variable); //Item 16 Quantity
return;
case 32:
Init[OffsetToItemsSelected + 32] = Convert.ToByte(variable); //Item 17
return;
case 33:
Init[OffsetToItemsSelected + 33] = Convert.ToByte(variable); //Item 17 Quantity
return;
case 34:
Init[OffsetToItemsSelected + 34] = Convert.ToByte(variable); //Item 18
return;
case 35:
Init[OffsetToItemsSelected + 35] = Convert.ToByte(variable); //Item 18 Quantity
return;
case 36:
Init[OffsetToItemsSelected + 36] = Convert.ToByte(variable); //Item 19
return;
case 37:
Init[OffsetToItemsSelected + 37] = Convert.ToByte(variable); //Item 19 Quantity
return;
case 38:
Init[OffsetToItemsSelected + 38] = Convert.ToByte(variable); //Item 20
return;
case 39:
Init[OffsetToItemsSelected + 39] = Convert.ToByte(variable); //Item 20 Quantity
return;
case 40:
Init[OffsetToItemsSelected + 40] = Convert.ToByte(variable); //Item 21
return;
case 41:
Init[OffsetToItemsSelected + 41] = Convert.ToByte(variable); //Item 21 Quantity
return;
case 42:
Init[OffsetToItemsSelected + 42] = Convert.ToByte(variable); //Item 22
return;
case 43:
Init[OffsetToItemsSelected + 43] = Convert.ToByte(variable); //Item 22 Quantity
return;
case 44:
Init[OffsetToItemsSelected + 44] = Convert.ToByte(variable); //Item 23
return;
case 45:
Init[OffsetToItemsSelected + 45] = Convert.ToByte(variable); //Item 23 Quantity
return;
case 46:
Init[OffsetToItemsSelected + 46] = Convert.ToByte(variable); //Item 24
return;
case 47:
Init[OffsetToItemsSelected + 47] = Convert.ToByte(variable); //Item 24 Quantity
return;
case 48:
Init[OffsetToItemsSelected + 48] = Convert.ToByte(variable); //Item 25
return;
case 49:
Init[OffsetToItemsSelected + 49] = Convert.ToByte(variable); //Item 25 Quantity
return;
case 50:
Init[OffsetToItemsSelected + 50] = Convert.ToByte(variable); //Item 26
return;
case 51:
Init[OffsetToItemsSelected + 51] = Convert.ToByte(variable); //Item 26 Quantity
return;
case 52:
Init[OffsetToItemsSelected + 52] = Convert.ToByte(variable); //Item 27
return;
case 53:
Init[OffsetToItemsSelected + 53] = Convert.ToByte(variable); //Item 27 Quantity
return;
case 54:
Init[OffsetToItemsSelected + 54] = Convert.ToByte(variable); //Item 28
return;
case 55:
Init[OffsetToItemsSelected + 55] = Convert.ToByte(variable); //Item 28 Quantity
return;
case 56:
Init[OffsetToItemsSelected + 56] = Convert.ToByte(variable); //Item 29
return;
case 57:
Init[OffsetToItemsSelected + 57] = Convert.ToByte(variable); //Item 29 Quantity
return;
case 58:
Init[OffsetToItemsSelected + 58] = Convert.ToByte(variable); //Item 30
return;
case 59:
Init[OffsetToItemsSelected + 59] = Convert.ToByte(variable); //Item 30 Quantity
return;
case 60:
Init[OffsetToItemsSelected + 60] = Convert.ToByte(variable); //Item 31
return;
case 61:
Init[OffsetToItemsSelected + 61] = Convert.ToByte(variable); //Item 31 Quantity
return;
case 62:
Init[OffsetToItemsSelected + 62] = Convert.ToByte(variable); //Item 32
return;
case 63:
Init[OffsetToItemsSelected + 63] = Convert.ToByte(variable); //Item 32 Quantity
return;
case 64:
Init[OffsetToItemsSelected + 64] = Convert.ToByte(variable); //Item 33
return;
case 65:
Init[OffsetToItemsSelected + 65] = Convert.ToByte(variable); //Item 33 Quantity
return;
case 66:
Init[OffsetToItemsSelected + 66] = Convert.ToByte(variable); //Item 34
return;
case 67:
Init[OffsetToItemsSelected + 67] = Convert.ToByte(variable); //Item 34 Quantity
return;
case 68:
Init[OffsetToItemsSelected + 68] = Convert.ToByte(variable); //Item 35
return;
case 69:
Init[OffsetToItemsSelected + 69] = Convert.ToByte(variable); //Item 35 Quantity
return;
case 70:
Init[OffsetToItemsSelected + 70] = Convert.ToByte(variable); //Item 36
return;
case 71:
Init[OffsetToItemsSelected + 71] = Convert.ToByte(variable); //Item 36 Quantity
return;
case 72:
Init[OffsetToItemsSelected + 72] = Convert.ToByte(variable); //Item 37
return;
case 73:
Init[OffsetToItemsSelected + 73] = Convert.ToByte(variable); //Item 37 Quantity
return;
case 74:
Init[OffsetToItemsSelected + 74] = Convert.ToByte(variable); //Item 38
return;
case 75:
Init[OffsetToItemsSelected + 75] = Convert.ToByte(variable); //Item 38 Quantity
return;
case 76:
Init[OffsetToItemsSelected + 76] = Convert.ToByte(variable); //Item 39
return;
case 77:
Init[OffsetToItemsSelected + 77] = Convert.ToByte(variable); //Item 39 Quantity
return;
case 78:
Init[OffsetToItemsSelected + 78] = Convert.ToByte(variable); //Item 40
return;
case 79:
Init[OffsetToItemsSelected + 79] = Convert.ToByte(variable); //Item 40 Quantity
return;
case 80:
Init[OffsetToItemsSelected + 80] = Convert.ToByte(variable); //Item 41
return;
case 81:
Init[OffsetToItemsSelected + 81] = Convert.ToByte(variable); //Item 41 Quantity
return;
case 82:
Init[OffsetToItemsSelected + 82] = Convert.ToByte(variable); //Item 42
return;
case 83:
Init[OffsetToItemsSelected + 83] = Convert.ToByte(variable); //Item 42 Quantity
return;
case 84:
Init[OffsetToItemsSelected + 84] = Convert.ToByte(variable); //Item 43
return;
case 85:
Init[OffsetToItemsSelected + 85] = Convert.ToByte(variable); //Item 43 Quantity
return;
case 86:
Init[OffsetToItemsSelected + 86] = Convert.ToByte(variable); //Item 44
return;
case 87:
Init[OffsetToItemsSelected + 87] = Convert.ToByte(variable); //Item 44 Quantity
return;
case 88:
Init[OffsetToItemsSelected + 88] = Convert.ToByte(variable); //Item 45
return;
case 89:
Init[OffsetToItemsSelected + 89] = Convert.ToByte(variable); //Item 45 Quantity
return;
case 90:
Init[OffsetToItemsSelected + 90] = Convert.ToByte(variable); //Item 46
return;
case 91:
Init[OffsetToItemsSelected + 91] = Convert.ToByte(variable); //Item 46 Quantity
return;
case 92:
Init[OffsetToItemsSelected + 92] = Convert.ToByte(variable); //Item 47
return;
case 93:
Init[OffsetToItemsSelected + 93] = Convert.ToByte(variable); //Item 47 Quantity
return;
case 94:
Init[OffsetToItemsSelected + 94] = Convert.ToByte(variable); //Item 48
return;
case 95:
Init[OffsetToItemsSelected + 95] = Convert.ToByte(variable); //Item 48 Quantity
return;
case 96:
Init[OffsetToItemsSelected + 96] = Convert.ToByte(variable); //Item 49
return;
case 97:
Init[OffsetToItemsSelected + 97] = Convert.ToByte(variable); //Item 49 Quantity
return;
case 98:
Init[OffsetToItemsSelected + 98] = Convert.ToByte(variable); //Item 50
return;
case 99:
Init[OffsetToItemsSelected + 99] = Convert.ToByte(variable); //Item 50 Quantity
return;
case 100:
Init[OffsetToItemsSelected + 100] = Convert.ToByte(variable); //Item 51
return;
case 101:
Init[OffsetToItemsSelected + 101] = Convert.ToByte(variable); //Item 51 Quantity
return;
case 102:
Init[OffsetToItemsSelected + 102] = Convert.ToByte(variable); //Item 52
return;
case 103:
Init[OffsetToItemsSelected + 103] = Convert.ToByte(variable); //Item 52 Quantity
return;
case 104:
Init[OffsetToItemsSelected + 104] = Convert.ToByte(variable); //Item 53
return;
case 105:
Init[OffsetToItemsSelected + 105] = Convert.ToByte(variable); //Item 53 Quantity
return;
case 106:
Init[OffsetToItemsSelected + 106] = Convert.ToByte(variable); //Item 54
return;
case 107:
Init[OffsetToItemsSelected + 107] = Convert.ToByte(variable); //Item 54 Quantity
return;
case 108:
Init[OffsetToItemsSelected + 108] = Convert.ToByte(variable); //Item 55
return;
case 109:
Init[OffsetToItemsSelected + 109] = Convert.ToByte(variable); //Item 55 Quantity
return;
case 110:
Init[OffsetToItemsSelected + 110] = Convert.ToByte(variable); //Item 56
return;
case 111:
Init[OffsetToItemsSelected + 111] = Convert.ToByte(variable); //Item 56 Quantity
return;
case 112:
Init[OffsetToItemsSelected + 112] = Convert.ToByte(variable); //Item 57
return;
case 113:
Init[OffsetToItemsSelected + 113] = Convert.ToByte(variable); //Item 57 Quantity
return;
case 114:
Init[OffsetToItemsSelected + 114] = Convert.ToByte(variable); //Item 58
return;
case 115:
Init[OffsetToItemsSelected + 115] = Convert.ToByte(variable); //Item 58 Quantity
return;
case 116:
Init[OffsetToItemsSelected + 116] = Convert.ToByte(variable); //Item 59
return;
case 117:
Init[OffsetToItemsSelected + 117] = Convert.ToByte(variable); //Item 59 Quantity
return;
case 118:
Init[OffsetToItemsSelected + 118] = Convert.ToByte(variable);
return;
case 119:
Init[OffsetToItemsSelected + 119] = Convert.ToByte(variable);
return;
case 120:
Init[OffsetToItemsSelected + 120] = Convert.ToByte(variable);
return;
case 121:
Init[OffsetToItemsSelected + 121] = Convert.ToByte(variable);
return;
case 122:
Init[OffsetToItemsSelected + 122] = Convert.ToByte(variable);
return;
case 123:
Init[OffsetToItemsSelected + 123] = Convert.ToByte(variable);
return;
case 124:
Init[OffsetToItemsSelected + 124] = Convert.ToByte(variable);
return;
case 125:
Init[OffsetToItemsSelected + 125] = Convert.ToByte(variable);
return;
case 126:
Init[OffsetToItemsSelected + 126] = Convert.ToByte(variable);
return;
case 127:
Init[OffsetToItemsSelected + 127] = Convert.ToByte(variable);
return;
case 128:
Init[OffsetToItemsSelected + 128] = Convert.ToByte(variable);
return;
case 129:
Init[OffsetToItemsSelected + 129] = Convert.ToByte(variable);
return;
case 130:
Init[OffsetToItemsSelected + 130] = Convert.ToByte(variable);
return;
case 131:
Init[OffsetToItemsSelected + 131] = Convert.ToByte(variable);
return;
case 132:
Init[OffsetToItemsSelected + 132] = Convert.ToByte(variable);
return;
case 133:
Init[OffsetToItemsSelected + 133] = Convert.ToByte(variable);
return;
case 134:
Init[OffsetToItemsSelected + 134] = Convert.ToByte(variable);
return;
case 135:
Init[OffsetToItemsSelected + 135] = Convert.ToByte(variable);
return;
case 136:
Init[OffsetToItemsSelected + 136] = Convert.ToByte(variable);
return;
case 137:
Init[OffsetToItemsSelected + 137] = Convert.ToByte(variable);
return;
case 138:
Init[OffsetToItemsSelected + 138] = Convert.ToByte(variable);
return;
case 139:
Init[OffsetToItemsSelected + 139] = Convert.ToByte(variable);
return;
case 140:
Init[OffsetToItemsSelected + 140] = Convert.ToByte(variable);
return;
case 141:
Init[OffsetToItemsSelected + 141] = Convert.ToByte(variable);
return;
case 142:
Init[OffsetToItemsSelected + 142] = Convert.ToByte(variable);
return;
case 143:
Init[OffsetToItemsSelected + 143] = Convert.ToByte(variable);
return;
case 144:
Init[OffsetToItemsSelected + 144] = Convert.ToByte(variable);
return;
case 145:
Init[OffsetToItemsSelected + 145] = Convert.ToByte(variable);
return;
case 146:
Init[OffsetToItemsSelected + 146] = Convert.ToByte(variable);
return;
case 147:
Init[OffsetToItemsSelected + 147] = Convert.ToByte(variable);
return;
case 148:
Init[OffsetToItemsSelected + 148] = Convert.ToByte(variable);
return;
case 149:
Init[OffsetToItemsSelected + 149] = Convert.ToByte(variable);
return;
case 150:
Init[OffsetToItemsSelected + 150] = Convert.ToByte(variable);
return;
case 151:
Init[OffsetToItemsSelected + 151] = Convert.ToByte(variable);
return;
case 152:
Init[OffsetToItemsSelected + 152] = Convert.ToByte(variable);
return;
case 153:
Init[OffsetToItemsSelected + 153] = Convert.ToByte(variable);
return;
case 154:
Init[OffsetToItemsSelected + 154] = Convert.ToByte(variable);
return;
case 155:
Init[OffsetToItemsSelected + 155] = Convert.ToByte(variable);
return;
case 156:
Init[OffsetToItemsSelected + 156] = Convert.ToByte(variable);
return;
case 157:
Init[OffsetToItemsSelected + 157] = Convert.ToByte(variable);
return;
case 158:
Init[OffsetToItemsSelected + 158] = Convert.ToByte(variable);
return;
case 159:
Init[OffsetToItemsSelected + 159] = Convert.ToByte(variable);
return;
case 160:
Init[OffsetToItemsSelected + 160] = Convert.ToByte(variable);
return;
case 161:
Init[OffsetToItemsSelected + 161] = Convert.ToByte(variable);
return;
case 162:
Init[OffsetToItemsSelected + 162] = Convert.ToByte(variable);
return;
case 163:
Init[OffsetToItemsSelected + 163] = Convert.ToByte(variable);
return;
case 164:
Init[OffsetToItemsSelected + 164] = Convert.ToByte(variable);
return;
case 165:
Init[OffsetToItemsSelected + 165] = Convert.ToByte(variable);
return;
case 166:
Init[OffsetToItemsSelected + 166] = Convert.ToByte(variable);
return;
case 167:
Init[OffsetToItemsSelected + 167] = Convert.ToByte(variable);
return;
case 168:
Init[OffsetToItemsSelected + 168] = Convert.ToByte(variable);
return;
case 169:
Init[OffsetToItemsSelected + 169] = Convert.ToByte(variable);
return;
case 170:
Init[OffsetToItemsSelected + 170] = Convert.ToByte(variable);
return;
case 171:
Init[OffsetToItemsSelected + 171] = Convert.ToByte(variable);
return;
case 172:
Init[OffsetToItemsSelected + 172] = Convert.ToByte(variable);
return;
case 173:
Init[OffsetToItemsSelected + 173] = Convert.ToByte(variable);
return;
case 174:
Init[OffsetToItemsSelected + 174] = Convert.ToByte(variable);
return;
case 175:
Init[OffsetToItemsSelected + 175] = Convert.ToByte(variable);
return;
case 176:
Init[OffsetToItemsSelected + 176] = Convert.ToByte(variable);
return;
case 177:
Init[OffsetToItemsSelected + 177] = Convert.ToByte(variable);
return;
case 178:
Init[OffsetToItemsSelected + 178] = Convert.ToByte(variable);
return;
case 179:
Init[OffsetToItemsSelected + 179] = Convert.ToByte(variable);
return;
case 180:
Init[OffsetToItemsSelected + 180] = Convert.ToByte(variable);
return;
case 181:
Init[OffsetToItemsSelected + 181] = Convert.ToByte(variable);
return;
case 182:
Init[OffsetToItemsSelected + 182] = Convert.ToByte(variable);
return;
case 183:
Init[OffsetToItemsSelected + 183] = Convert.ToByte(variable);
return;
case 184:
Init[OffsetToItemsSelected + 184] = Convert.ToByte(variable);
return;
case 185:
Init[OffsetToItemsSelected + 185] = Convert.ToByte(variable);
return;
case 186:
Init[OffsetToItemsSelected + 186] = Convert.ToByte(variable);
return;
case 187:
Init[OffsetToItemsSelected + 187] = Convert.ToByte(variable);
return;
case 188:
Init[OffsetToItemsSelected + 188] = Convert.ToByte(variable);
return;
case 189:
Init[OffsetToItemsSelected + 189] = Convert.ToByte(variable);
return;
case 190:
Init[OffsetToItemsSelected + 190] = Convert.ToByte(variable);
return;
case 191:
Init[OffsetToItemsSelected + 191] = Convert.ToByte(variable);
return;
case 192:
Init[OffsetToItemsSelected + 192] = Convert.ToByte(variable);
return;
case 193:
Init[OffsetToItemsSelected + 193] = Convert.ToByte(variable);
return;
case 194:
Init[OffsetToItemsSelected + 194] = Convert.ToByte(variable);
return;
case 195:
Init[OffsetToItemsSelected + 195] = Convert.ToByte(variable);
return;
case 196:
Init[OffsetToItemsSelected + 196] = Convert.ToByte(variable);
return;
case 197:
Init[OffsetToItemsSelected + 197] = Convert.ToByte(variable);
return;
case 198:
Init[OffsetToItemsSelected + 198] = Convert.ToByte(variable);
return;
case 199:
Init[OffsetToItemsSelected + 199] = Convert.ToByte(variable);
return;
case 200:
Init[OffsetToItemsSelected + 200] = Convert.ToByte(variable);
return;
case 201:
Init[OffsetToItemsSelected + 201] = Convert.ToByte(variable);
return;
case 202:
Init[OffsetToItemsSelected + 202] = Convert.ToByte(variable);
return;
case 203:
Init[OffsetToItemsSelected + 203] = Convert.ToByte(variable);
return;
case 204:
Init[OffsetToItemsSelected + 204] = Convert.ToByte(variable);
return;
case 205:
Init[OffsetToItemsSelected + 205] = Convert.ToByte(variable);
return;
case 206:
Init[OffsetToItemsSelected + 206] = Convert.ToByte(variable);
return;
case 207:
Init[OffsetToItemsSelected + 207] = Convert.ToByte(variable);
return;
case 208:
Init[OffsetToItemsSelected + 208] = Convert.ToByte(variable);
return;
case 209:
Init[OffsetToItemsSelected + 209] = Convert.ToByte(variable);
return;
case 210:
Init[OffsetToItemsSelected + 210] = Convert.ToByte(variable);
return;
case 211:
Init[OffsetToItemsSelected + 211] = Convert.ToByte(variable);
return;
case 212:
Init[OffsetToItemsSelected + 212] = Convert.ToByte(variable);
return;
case 213:
Init[OffsetToItemsSelected + 213] = Convert.ToByte(variable);
return;
case 214:
Init[OffsetToItemsSelected + 214] = Convert.ToByte(variable);
return;
case 215:
Init[OffsetToItemsSelected + 215] = Convert.ToByte(variable);
return;
case 216:
Init[OffsetToItemsSelected + 216] = Convert.ToByte(variable);
return;
case 217:
Init[OffsetToItemsSelected + 217] = Convert.ToByte(variable);
return;
case 218:
Init[OffsetToItemsSelected + 218] = Convert.ToByte(variable);
return;
case 219:
Init[OffsetToItemsSelected + 219] = Convert.ToByte(variable);
return;
case 220:
Init[OffsetToItemsSelected + 220] = Convert.ToByte(variable);
return;
case 221:
Init[OffsetToItemsSelected + 221] = Convert.ToByte(variable);
return;
case 222:
Init[OffsetToItemsSelected + 222] = Convert.ToByte(variable);
return;
case 223:
Init[OffsetToItemsSelected + 223] = Convert.ToByte(variable);
return;
case 224:
Init[OffsetToItemsSelected + 224] = Convert.ToByte(variable);
return;
case 225:
Init[OffsetToItemsSelected + 225] = Convert.ToByte(variable);
return;
case 226:
Init[OffsetToItemsSelected + 226] = Convert.ToByte(variable);
return;
case 227:
Init[OffsetToItemsSelected + 227] = Convert.ToByte(variable);
return;
case 228:
Init[OffsetToItemsSelected + 228] = Convert.ToByte(variable);
return;
case 229:
Init[OffsetToItemsSelected + 229] = Convert.ToByte(variable);
return;
case 230:
Init[OffsetToItemsSelected + 230] = Convert.ToByte(variable);
return;
case 231:
Init[OffsetToItemsSelected + 231] = Convert.ToByte(variable);
return;
case 232:
Init[OffsetToItemsSelected + 232] = Convert.ToByte(variable);
return;
case 233:
Init[OffsetToItemsSelected + 233] = Convert.ToByte(variable);
return;
case 234:
Init[OffsetToItemsSelected + 234] = Convert.ToByte(variable);
return;
case 235:
Init[OffsetToItemsSelected + 235] = Convert.ToByte(variable);
return;
case 236:
Init[OffsetToItemsSelected + 236] = Convert.ToByte(variable);
return;
case 237:
Init[OffsetToItemsSelected + 237] = Convert.ToByte(variable);
return;
case 238:
Init[OffsetToItemsSelected + 238] = Convert.ToByte(variable);
return;
case 239:
Init[OffsetToItemsSelected + 239] = Convert.ToByte(variable);
return;
case 240:
Init[OffsetToItemsSelected + 240] = Convert.ToByte(variable);
return;
case 241:
Init[OffsetToItemsSelected + 241] = Convert.ToByte(variable);
return;
case 242:
Init[OffsetToItemsSelected + 242] = Convert.ToByte(variable);
return;
case 243:
Init[OffsetToItemsSelected + 243] = Convert.ToByte(variable);
return;
case 244:
Init[OffsetToItemsSelected + 244] = Convert.ToByte(variable);
return;
case 245:
Init[OffsetToItemsSelected + 245] = Convert.ToByte(variable);
return;
case 246:
Init[OffsetToItemsSelected + 246] = Convert.ToByte(variable);
return;
case 247:
Init[OffsetToItemsSelected + 247] = Convert.ToByte(variable);
return;
case 248:
Init[OffsetToItemsSelected + 248] = Convert.ToByte(variable);
return;
case 249:
Init[OffsetToItemsSelected + 249] = Convert.ToByte(variable);
return;
case 250:
Init[OffsetToItemsSelected + 250] = Convert.ToByte(variable);
return;
case 251:
Init[OffsetToItemsSelected + 251] = Convert.ToByte(variable);
return;
case 252:
Init[OffsetToItemsSelected + 252] = Convert.ToByte(variable);
return;
case 253:
Init[OffsetToItemsSelected + 253] = Convert.ToByte(variable);
return;
case 254:
Init[OffsetToItemsSelected + 254] = Convert.ToByte(variable);
return;
case 255:
Init[OffsetToItemsSelected + 255] = Convert.ToByte(variable);
return;
case 256:
Init[OffsetToItemsSelected + 256] = Convert.ToByte(variable);
return;
case 257:
Init[OffsetToItemsSelected + 257] = Convert.ToByte(variable);
return;
case 258:
Init[OffsetToItemsSelected + 258] = Convert.ToByte(variable);
return;
case 259:
Init[OffsetToItemsSelected + 259] = Convert.ToByte(variable);
return;
case 260:
Init[OffsetToItemsSelected + 260] = Convert.ToByte(variable);
return;
case 261:
Init[OffsetToItemsSelected + 261] = Convert.ToByte(variable);
return;
case 262:
Init[OffsetToItemsSelected + 262] = Convert.ToByte(variable);
return;
case 263:
Init[OffsetToItemsSelected + 263] = Convert.ToByte(variable);
return;
case 264:
Init[OffsetToItemsSelected + 264] = Convert.ToByte(variable);
return;
case 265:
Init[OffsetToItemsSelected + 265] = Convert.ToByte(variable);
return;
case 266:
Init[OffsetToItemsSelected + 266] = Convert.ToByte(variable);
return;
case 267:
Init[OffsetToItemsSelected + 267] = Convert.ToByte(variable);
return;
case 268:
Init[OffsetToItemsSelected + 268] = Convert.ToByte(variable);
return;
case 269:
Init[OffsetToItemsSelected + 269] = Convert.ToByte(variable);
return;
case 270:
Init[OffsetToItemsSelected + 270] = Convert.ToByte(variable);
return;
case 271:
Init[OffsetToItemsSelected + 271] = Convert.ToByte(variable);
return;
case 272:
Init[OffsetToItemsSelected + 272] = Convert.ToByte(variable);
return;
case 273:
Init[OffsetToItemsSelected + 273] = Convert.ToByte(variable);
return;
case 274:
Init[OffsetToItemsSelected + 274] = Convert.ToByte(variable);
return;
case 275:
Init[OffsetToItemsSelected + 275] = Convert.ToByte(variable);
return;
case 276:
Init[OffsetToItemsSelected + 276] = Convert.ToByte(variable);
return;
case 277:
Init[OffsetToItemsSelected + 277] = Convert.ToByte(variable);
return;
case 278:
Init[OffsetToItemsSelected + 278] = Convert.ToByte(variable);
return;
case 279:
Init[OffsetToItemsSelected + 279] = Convert.ToByte(variable);
return;
case 280:
Init[OffsetToItemsSelected + 280] = Convert.ToByte(variable);
return;
case 281:
Init[OffsetToItemsSelected + 281] = Convert.ToByte(variable);
return;
case 282:
Init[OffsetToItemsSelected + 282] = Convert.ToByte(variable);
return;
case 283:
Init[OffsetToItemsSelected + 283] = Convert.ToByte(variable);
return;
case 284:
Init[OffsetToItemsSelected + 284] = Convert.ToByte(variable);
return;
case 285:
Init[OffsetToItemsSelected + 285] = Convert.ToByte(variable);
return;
case 286:
Init[OffsetToItemsSelected + 286] = Convert.ToByte(variable);
return;
case 287:
Init[OffsetToItemsSelected + 287] = Convert.ToByte(variable);
return;
case 288:
Init[OffsetToItemsSelected + 288] = Convert.ToByte(variable);
return;
case 289:
Init[OffsetToItemsSelected + 289] = Convert.ToByte(variable);
return;
case 290:
Init[OffsetToItemsSelected + 290] = Convert.ToByte(variable);
return;
case 291:
Init[OffsetToItemsSelected + 291] = Convert.ToByte(variable);
return;
case 292:
Init[OffsetToItemsSelected + 292] = Convert.ToByte(variable);
return;
case 293:
Init[OffsetToItemsSelected + 293] = Convert.ToByte(variable);
return;
case 294:
Init[OffsetToItemsSelected + 294] = Convert.ToByte(variable);
return;
case 295:
Init[OffsetToItemsSelected + 295] = Convert.ToByte(variable);
return;
case 296:
Init[OffsetToItemsSelected + 296] = Convert.ToByte(variable);
return;
case 297:
Init[OffsetToItemsSelected + 297] = Convert.ToByte(variable);
return;
case 298:
Init[OffsetToItemsSelected + 298] = Convert.ToByte(variable);
return;
case 299:
Init[OffsetToItemsSelected + 299] = Convert.ToByte(variable);
return;
case 300:
Init[OffsetToItemsSelected + 300] = Convert.ToByte(variable);
return;
case 301:
Init[OffsetToItemsSelected + 301] = Convert.ToByte(variable);
return;
case 302:
Init[OffsetToItemsSelected + 302] = Convert.ToByte(variable);
return;
case 303:
Init[OffsetToItemsSelected + 303] = Convert.ToByte(variable);
return;
case 304:
Init[OffsetToItemsSelected + 304] = Convert.ToByte(variable);
return;
case 305:
Init[OffsetToItemsSelected + 305] = Convert.ToByte(variable);
return;
case 306:
Init[OffsetToItemsSelected + 306] = Convert.ToByte(variable);
return;
case 307:
Init[OffsetToItemsSelected + 307] = Convert.ToByte(variable);
return;
case 308:
Init[OffsetToItemsSelected + 308] = Convert.ToByte(variable);
return;
case 309:
Init[OffsetToItemsSelected + 309] = Convert.ToByte(variable);
return;
case 310:
Init[OffsetToItemsSelected + 310] = Convert.ToByte(variable);
return;
case 311:
Init[OffsetToItemsSelected + 311] = Convert.ToByte(variable);
return;
case 312:
Init[OffsetToItemsSelected + 312] = Convert.ToByte(variable);
return;
case 313:
Init[OffsetToItemsSelected + 313] = Convert.ToByte(variable);
return;
case 314:
Init[OffsetToItemsSelected + 314] = Convert.ToByte(variable);
return;
case 315:
Init[OffsetToItemsSelected + 315] = Convert.ToByte(variable);
return;
case 316:
Init[OffsetToItemsSelected + 316] = Convert.ToByte(variable);
return;
case 317:
Init[OffsetToItemsSelected + 317] = Convert.ToByte(variable);
return;
case 318:
Init[OffsetToItemsSelected + 318] = Convert.ToByte(variable);
return;
case 319:
Init[OffsetToItemsSelected + 319] = Convert.ToByte(variable);
return;
case 320:
Init[OffsetToItemsSelected + 320] = Convert.ToByte(variable);
return;
case 321:
Init[OffsetToItemsSelected + 321] = Convert.ToByte(variable);
return;
case 322:
Init[OffsetToItemsSelected + 322] = Convert.ToByte(variable);
return;
case 323:
Init[OffsetToItemsSelected + 323] = Convert.ToByte(variable);
return;
case 324:
Init[OffsetToItemsSelected + 324] = Convert.ToByte(variable);
return;
case 325:
Init[OffsetToItemsSelected + 325] = Convert.ToByte(variable);
return;
case 326:
Init[OffsetToItemsSelected + 326] = Convert.ToByte(variable);
return;
case 327:
Init[OffsetToItemsSelected + 327] = Convert.ToByte(variable);
return;
case 328:
Init[OffsetToItemsSelected + 328] = Convert.ToByte(variable);
return;
case 329:
Init[OffsetToItemsSelected + 329] = Convert.ToByte(variable);
return;
case 330:
Init[OffsetToItemsSelected + 330] = Convert.ToByte(variable);
return;
case 331:
Init[OffsetToItemsSelected + 331] = Convert.ToByte(variable);
return;
case 332:
Init[OffsetToItemsSelected + 332] = Convert.ToByte(variable);
return;
case 333:
Init[OffsetToItemsSelected + 333] = Convert.ToByte(variable);
return;
case 334:
Init[OffsetToItemsSelected + 334] = Convert.ToByte(variable);
return;
case 335:
Init[OffsetToItemsSelected + 335] = Convert.ToByte(variable);
return;
case 336:
Init[OffsetToItemsSelected + 336] = Convert.ToByte(variable);
return;
case 337:
Init[OffsetToItemsSelected + 337] = Convert.ToByte(variable);
return;
case 338:
Init[OffsetToItemsSelected + 338] = Convert.ToByte(variable);
return;
case 339:
Init[OffsetToItemsSelected + 339] = Convert.ToByte(variable);
return;
case 340:
Init[OffsetToItemsSelected + 340] = Convert.ToByte(variable);
return;
case 341:
Init[OffsetToItemsSelected + 341] = Convert.ToByte(variable);
return;
case 342:
Init[OffsetToItemsSelected + 342] = Convert.ToByte(variable);
return;
case 343:
Init[OffsetToItemsSelected + 343] = Convert.ToByte(variable);
return;
case 344:
Init[OffsetToItemsSelected + 344] = Convert.ToByte(variable);
return;
case 345:
Init[OffsetToItemsSelected + 345] = Convert.ToByte(variable);
return;
case 346:
Init[OffsetToItemsSelected + 346] = Convert.ToByte(variable);
return;
case 347:
Init[OffsetToItemsSelected + 347] = Convert.ToByte(variable);
return;
case 348:
Init[OffsetToItemsSelected + 348] = Convert.ToByte(variable);
return;
case 349:
Init[OffsetToItemsSelected + 349] = Convert.ToByte(variable);
return;
case 350:
Init[OffsetToItemsSelected + 350] = Convert.ToByte(variable);
return;
case 351:
Init[OffsetToItemsSelected + 351] = Convert.ToByte(variable);
return;
case 352:
Init[OffsetToItemsSelected + 352] = Convert.ToByte(variable);
return;
case 353:
Init[OffsetToItemsSelected + 353] = Convert.ToByte(variable);
return;
case 354:
Init[OffsetToItemsSelected + 354] = Convert.ToByte(variable);
return;
case 355:
Init[OffsetToItemsSelected + 355] = Convert.ToByte(variable);
return;
case 356:
Init[OffsetToItemsSelected + 356] = Convert.ToByte(variable);
return;
case 357:
Init[OffsetToItemsSelected + 357] = Convert.ToByte(variable);
return;
case 358:
Init[OffsetToItemsSelected + 358] = Convert.ToByte(variable);
return;
case 359:
Init[OffsetToItemsSelected + 359] = Convert.ToByte(variable);
return;
case 360:
Init[OffsetToItemsSelected + 360] = Convert.ToByte(variable);
return;
case 361:
Init[OffsetToItemsSelected + 361] = Convert.ToByte(variable);
return;
case 362:
Init[OffsetToItemsSelected + 362] = Convert.ToByte(variable);
return;
case 363:
Init[OffsetToItemsSelected + 363] = Convert.ToByte(variable);
return;
case 364:
Init[OffsetToItemsSelected + 364] = Convert.ToByte(variable);
return;
case 365:
Init[OffsetToItemsSelected + 365] = Convert.ToByte(variable);
return;
case 366:
Init[OffsetToItemsSelected + 366] = Convert.ToByte(variable);
return;
case 367:
Init[OffsetToItemsSelected + 367] = Convert.ToByte(variable);
return;
case 368:
Init[OffsetToItemsSelected + 368] = Convert.ToByte(variable);
return;
case 369:
Init[OffsetToItemsSelected + 369] = Convert.ToByte(variable);
return;
case 370:
Init[OffsetToItemsSelected + 370] = Convert.ToByte(variable);
return;
case 371:
Init[OffsetToItemsSelected + 371] = Convert.ToByte(variable);
return;
case 372:
Init[OffsetToItemsSelected + 372] = Convert.ToByte(variable);
return;
case 373:
Init[OffsetToItemsSelected + 373] = Convert.ToByte(variable);
return;
case 374:
Init[OffsetToItemsSelected + 374] = Convert.ToByte(variable);
return;
case 375:
Init[OffsetToItemsSelected + 375] = Convert.ToByte(variable);
return;
case 376:
Init[OffsetToItemsSelected + 376] = Convert.ToByte(variable);
return;
case 377:
Init[OffsetToItemsSelected + 377] = Convert.ToByte(variable);
return;
case 378:
Init[OffsetToItemsSelected + 378] = Convert.ToByte(variable);
return;
case 379:
Init[OffsetToItemsSelected + 379] = Convert.ToByte(variable);
return;
case 380:
Init[OffsetToItemsSelected + 380] = Convert.ToByte(variable);
return;
case 381:
Init[OffsetToItemsSelected + 381] = Convert.ToByte(variable);
return;
case 382:
Init[OffsetToItemsSelected + 382] = Convert.ToByte(variable);
return;
case 383:
Init[OffsetToItemsSelected + 383] = Convert.ToByte(variable);
return;
case 384:
Init[OffsetToItemsSelected + 384] = Convert.ToByte(variable);
return;
case 385:
Init[OffsetToItemsSelected + 385] = Convert.ToByte(variable);
return;
case 386:
Init[OffsetToItemsSelected + 386] = Convert.ToByte(variable);
return;
case 387:
Init[OffsetToItemsSelected + 387] = Convert.ToByte(variable);
return;
case 388:
Init[OffsetToItemsSelected + 388] = Convert.ToByte(variable);
return;
case 389:
Init[OffsetToItemsSelected + 389] = Convert.ToByte(variable);
return;
case 390:
Init[OffsetToItemsSelected + 390] = Convert.ToByte(variable);
return;
case 391:
Init[OffsetToItemsSelected + 391] = Convert.ToByte(variable);
return;
case 392:
Init[OffsetToItemsSelected + 392] = Convert.ToByte(variable);
return;
case 393:
Init[OffsetToItemsSelected + 393] = Convert.ToByte(variable);
return;
case 394:
Init[OffsetToItemsSelected + 394] = Convert.ToByte(variable);
return;
case 395:
Init[OffsetToItemsSelected + 395] = Convert.ToByte(variable);
return;
}
}
#endregion
#region READ INIT VARIABLES
#region Init Offsets
public static void ReadInit(byte[] init)
{
Init = init;
FF8Text.SetInit(Init);
GfDataOffset = 0;
CharacterDataOffset = 1088;
ShopsDataOffset = 2304;
ConfigDataOffset = 2704;
MiscDataOffset = 2724;
ItemsDataOffset = 2804;
}
#endregion
#region Gf
public static void ReadGF(int GfId_List, byte[] Init)
{
GetSelectedGfData = new GfData();
int selectedGfOffset = GfDataOffset + (GfId_List * 68);
OffsetToGfSelected = selectedGfOffset;
byte[] byteArray = new byte[12];
Array.Copy(Init, selectedGfOffset, byteArray, 0, 12);
byte[] buffer = FF8Text.BuildString_b(byteArray);
GetSelectedGfData.Name = Encoding.UTF8.GetString(buffer);
GetSelectedGfData.Exp = BitConverter.ToUInt32(Init, selectedGfOffset + 12);
GetSelectedGfData.Unknown1 = Init[selectedGfOffset + 16];
GetSelectedGfData.Available = Init[selectedGfOffset + 17];
GetSelectedGfData.CurrentHp = BitConverter.ToUInt16(Init, selectedGfOffset + 18);
GetSelectedGfData.LearnedAbility1 = Init[selectedGfOffset + 20];
GetSelectedGfData.LearnedAbility2 = Init[selectedGfOffset + 21];
GetSelectedGfData.LearnedAbility3 = Init[selectedGfOffset + 22];
GetSelectedGfData.LearnedAbility4 = Init[selectedGfOffset + 23];
GetSelectedGfData.LearnedAbility5 = Init[selectedGfOffset + 24];
GetSelectedGfData.LearnedAbility6 = Init[selectedGfOffset + 25];
GetSelectedGfData.LearnedAbility7 = Init[selectedGfOffset + 26];
GetSelectedGfData.LearnedAbility8 = Init[selectedGfOffset + 27];
GetSelectedGfData.LearnedAbility9 = Init[selectedGfOffset + 28];
GetSelectedGfData.LearnedAbility10 = Init[selectedGfOffset + 29];
GetSelectedGfData.LearnedAbility11 = Init[selectedGfOffset + 30];
GetSelectedGfData.LearnedAbility12 = Init[selectedGfOffset + 31];
GetSelectedGfData.LearnedAbility13 = Init[selectedGfOffset + 32];
GetSelectedGfData.LearnedAbility14 = Init[selectedGfOffset + 33];
GetSelectedGfData.LearnedAbility15 = Init[selectedGfOffset + 34];
GetSelectedGfData.LearnedAbility16 = Init[selectedGfOffset + 35];
GetSelectedGfData.ApAbility1 = Init[selectedGfOffset + 36];
GetSelectedGfData.ApAbility2 = Init[selectedGfOffset + 37];
GetSelectedGfData.ApAbility3 = Init[selectedGfOffset + 38];
GetSelectedGfData.ApAbility4 = Init[selectedGfOffset + 39];
GetSelectedGfData.ApAbility5 = Init[selectedGfOffset + 40];
GetSelectedGfData.ApAbility6 = Init[selectedGfOffset + 41];
GetSelectedGfData.ApAbility7 = Init[selectedGfOffset + 42];
GetSelectedGfData.ApAbility8 = Init[selectedGfOffset + 43];
GetSelectedGfData.ApAbility9 = Init[selectedGfOffset + 44];
GetSelectedGfData.ApAbility10 = Init[selectedGfOffset + 45];
GetSelectedGfData.ApAbility11 = Init[selectedGfOffset + 46];
GetSelectedGfData.ApAbility12 = Init[selectedGfOffset + 47];
GetSelectedGfData.ApAbility13 = Init[selectedGfOffset + 48];
GetSelectedGfData.ApAbility14 = Init[selectedGfOffset + 49];
GetSelectedGfData.ApAbility15 = Init[selectedGfOffset + 50];
GetSelectedGfData.ApAbility16 = Init[selectedGfOffset + 51];
GetSelectedGfData.ApAbility17 = Init[selectedGfOffset + 52];
GetSelectedGfData.ApAbility18 = Init[selectedGfOffset + 53];
GetSelectedGfData.ApAbility19 = Init[selectedGfOffset + 54];
GetSelectedGfData.ApAbility20 = Init[selectedGfOffset + 55];
GetSelectedGfData.ApAbility21 = Init[selectedGfOffset + 56];
GetSelectedGfData.ApAbility22 = Init[selectedGfOffset + 57];
GetSelectedGfData.Kills = BitConverter.ToUInt16(Init, selectedGfOffset + 60);
GetSelectedGfData.KOs = BitConverter.ToUInt16(Init, selectedGfOffset + 62);
GetSelectedGfData.LearningAbility = Init[selectedGfOffset + 64];
//to add forgotten abilities
}
#endregion
#region Characters
public static void ReadCharacters(int CharactersId_List, byte[] Init)
{
GetSelectedCharactersData = new CharactersData();
int selectedCharactersOffset = CharacterDataOffset + (CharactersId_List * 152);
OffsetToCharacterSelected = selectedCharactersOffset;
GetSelectedCharactersData.CurrentHp = BitConverter.ToUInt16(Init, selectedCharactersOffset + 0);
GetSelectedCharactersData.HpBonus = BitConverter.ToUInt16(Init, selectedCharactersOffset + 2);
GetSelectedCharactersData.Exp = BitConverter.ToUInt32(Init, selectedCharactersOffset + 4);
GetSelectedCharactersData.ModelId = Init[selectedCharactersOffset + 8];
GetSelectedCharactersData.WeaponId = Init[selectedCharactersOffset + 9];
GetSelectedCharactersData.Str = Init[selectedCharactersOffset + 10];
GetSelectedCharactersData.Vit = Init[selectedCharactersOffset + 11];
GetSelectedCharactersData.Mag = Init[selectedCharactersOffset + 12];
GetSelectedCharactersData.Spr = Init[selectedCharactersOffset + 13];
GetSelectedCharactersData.Spd = Init[selectedCharactersOffset + 14];
GetSelectedCharactersData.Luck = Init[selectedCharactersOffset + 15];
GetSelectedCharactersData.Magic1 = Init[selectedCharactersOffset + 16];
GetSelectedCharactersData.Magic1Quantity = Init[selectedCharactersOffset + 17];
GetSelectedCharactersData.Magic2 = Init[selectedCharactersOffset + 18];
GetSelectedCharactersData.Magic2Quantity = Init[selectedCharactersOffset + 19];
GetSelectedCharactersData.Magic3 = Init[selectedCharactersOffset + 20];
GetSelectedCharactersData.Magic3Quantity = Init[selectedCharactersOffset + 21];
GetSelectedCharactersData.Magic4 = Init[selectedCharactersOffset + 22];
GetSelectedCharactersData.Magic4Quantity = Init[selectedCharactersOffset + 23];
GetSelectedCharactersData.Magic5 = Init[selectedCharactersOffset + 24];
GetSelectedCharactersData.Magic5Quantity = Init[selectedCharactersOffset + 25];
GetSelectedCharactersData.Magic6 = Init[selectedCharactersOffset + 26];
GetSelectedCharactersData.Magic6Quantity = Init[selectedCharactersOffset + 27];
GetSelectedCharactersData.Magic7 = Init[selectedCharactersOffset + 28];
GetSelectedCharactersData.Magic7Quantity = Init[selectedCharactersOffset + 29];
GetSelectedCharactersData.Magic8 = Init[selectedCharactersOffset + 30];
GetSelectedCharactersData.Magic8Quantity = Init[selectedCharactersOffset + 31];
GetSelectedCharactersData.Magic9 = Init[selectedCharactersOffset + 32];
GetSelectedCharactersData.Magic9Quantity = Init[selectedCharactersOffset + 33];
GetSelectedCharactersData.Magic10 = Init[selectedCharactersOffset + 34];
GetSelectedCharactersData.Magic10Quantity = Init[selectedCharactersOffset + 35];
GetSelectedCharactersData.Magic11 = Init[selectedCharactersOffset + 36];
GetSelectedCharactersData.Magic11Quantity = Init[selectedCharactersOffset + 37];
GetSelectedCharactersData.Magic12 = Init[selectedCharactersOffset + 38];
GetSelectedCharactersData.Magic12Quantity = Init[selectedCharactersOffset + 39];
GetSelectedCharactersData.Magic13 = Init[selectedCharactersOffset + 40];
GetSelectedCharactersData.Magic13Quantity = Init[selectedCharactersOffset + 41];
GetSelectedCharactersData.Magic14 = Init[selectedCharactersOffset + 42];
GetSelectedCharactersData.Magic14Quantity = Init[selectedCharactersOffset + 43];
GetSelectedCharactersData.Magic15 = Init[selectedCharactersOffset + 44];
GetSelectedCharactersData.Magic15Quantity = Init[selectedCharactersOffset + 45];
GetSelectedCharactersData.Magic16 = Init[selectedCharactersOffset + 46];
GetSelectedCharactersData.Magic16Quantity = Init[selectedCharactersOffset + 47];
GetSelectedCharactersData.Magic17 = Init[selectedCharactersOffset + 48];
GetSelectedCharactersData.Magic17Quantity = Init[selectedCharactersOffset + 49];
GetSelectedCharactersData.Magic18 = Init[selectedCharactersOffset + 50];
GetSelectedCharactersData.Magic18Quantity = Init[selectedCharactersOffset + 51];
GetSelectedCharactersData.Magic19 = Init[selectedCharactersOffset + 52];
GetSelectedCharactersData.Magic19Quantity = Init[selectedCharactersOffset + 53];
GetSelectedCharactersData.Magic20 = Init[selectedCharactersOffset + 54];
GetSelectedCharactersData.Magic20Quantity = Init[selectedCharactersOffset + 55];
GetSelectedCharactersData.Magic21 = Init[selectedCharactersOffset + 56];
GetSelectedCharactersData.Magic21Quantity = Init[selectedCharactersOffset + 57];
GetSelectedCharactersData.Magic22 = Init[selectedCharactersOffset + 58];
GetSelectedCharactersData.Magic22Quantity = Init[selectedCharactersOffset + 59];
GetSelectedCharactersData.Magic23 = Init[selectedCharactersOffset + 60];
GetSelectedCharactersData.Magic23Quantity = Init[selectedCharactersOffset + 61];
GetSelectedCharactersData.Magic24 = Init[selectedCharactersOffset + 62];
GetSelectedCharactersData.Magic24Quantity = Init[selectedCharactersOffset + 63];
GetSelectedCharactersData.Magic25 = Init[selectedCharactersOffset + 64];
GetSelectedCharactersData.Magic25Quantity = Init[selectedCharactersOffset + 65];
GetSelectedCharactersData.Magic26 = Init[selectedCharactersOffset + 66];
GetSelectedCharactersData.Magic26Quantity = Init[selectedCharactersOffset + 67];
GetSelectedCharactersData.Magic27 = Init[selectedCharactersOffset + 68];
GetSelectedCharactersData.Magic27Quantity = Init[selectedCharactersOffset + 69];
GetSelectedCharactersData.Magic28 = Init[selectedCharactersOffset + 70];
GetSelectedCharactersData.Magic28Quantity = Init[selectedCharactersOffset + 71];
GetSelectedCharactersData.Magic29 = Init[selectedCharactersOffset + 72];
GetSelectedCharactersData.Magic29Quantity = Init[selectedCharactersOffset + 73];
GetSelectedCharactersData.Magic30 = Init[selectedCharactersOffset + 74];
GetSelectedCharactersData.Magic30Quantity = Init[selectedCharactersOffset + 75];
GetSelectedCharactersData.Magic31 = Init[selectedCharactersOffset + 76];
GetSelectedCharactersData.Magic31Quantity = Init[selectedCharactersOffset + 77];
GetSelectedCharactersData.Magic32 = Init[selectedCharactersOffset + 78];
GetSelectedCharactersData.Magic32Quantity = Init[selectedCharactersOffset + 79];
GetSelectedCharactersData.Command1 = Init[selectedCharactersOffset + 80];
GetSelectedCharactersData.Command2 = Init[selectedCharactersOffset + 81];
GetSelectedCharactersData.Command3 = Init[selectedCharactersOffset + 82];
GetSelectedCharactersData.Unknown1 = Init[selectedCharactersOffset + 83];
GetSelectedCharactersData.Ability1 = Init[selectedCharactersOffset + 84];
GetSelectedCharactersData.Ability2 = Init[selectedCharactersOffset + 85];
GetSelectedCharactersData.Ability3 = Init[selectedCharactersOffset + 86];
GetSelectedCharactersData.Ability4 = Init[selectedCharactersOffset + 87];
GetSelectedCharactersData.JunGf1 = Init[selectedCharactersOffset + 88];
GetSelectedCharactersData.JunGf2 = Init[selectedCharactersOffset + 89];
GetSelectedCharactersData.Unknown2 = Init[selectedCharactersOffset + 90];
GetSelectedCharactersData.AltModel = Init[selectedCharactersOffset + 91];
GetSelectedCharactersData.JunHP = Init[selectedCharactersOffset + 92];
GetSelectedCharactersData.JunStr = Init[selectedCharactersOffset + 93];
GetSelectedCharactersData.JunVit = Init[selectedCharactersOffset + 94];
GetSelectedCharactersData.JunMag = Init[selectedCharactersOffset + 95];
GetSelectedCharactersData.JunSpr = Init[selectedCharactersOffset + 96];
GetSelectedCharactersData.JunSpd = Init[selectedCharactersOffset + 97];
GetSelectedCharactersData.JunEva = Init[selectedCharactersOffset + 98];
GetSelectedCharactersData.JunHit = Init[selectedCharactersOffset + 99];
GetSelectedCharactersData.JunLuck = Init[selectedCharactersOffset + 100];
GetSelectedCharactersData.JunEleAtk = Init[selectedCharactersOffset + 101];
GetSelectedCharactersData.JunStatusAtk = Init[selectedCharactersOffset + 102];
GetSelectedCharactersData.JunEleDef1 = Init[selectedCharactersOffset + 103];
GetSelectedCharactersData.JunEleDef2 = Init[selectedCharactersOffset + 104];
GetSelectedCharactersData.JunEleDef3 = Init[selectedCharactersOffset + 105];
GetSelectedCharactersData.JunEleDef4 = Init[selectedCharactersOffset + 106];
GetSelectedCharactersData.JunStatusDef1 = Init[selectedCharactersOffset + 107];
GetSelectedCharactersData.JunStatusDef2 = Init[selectedCharactersOffset + 108];
GetSelectedCharactersData.JunStatusDef3 = Init[selectedCharactersOffset + 109];
GetSelectedCharactersData.JunStatusDef4 = Init[selectedCharactersOffset + 110];
GetSelectedCharactersData.Unknown3 = Init[selectedCharactersOffset + 111];
GetSelectedCharactersData.GfComp1 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 112);
GetSelectedCharactersData.GfComp2 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 114);
GetSelectedCharactersData.GfComp3 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 116);
GetSelectedCharactersData.GfComp4 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 118);
GetSelectedCharactersData.GfComp5 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 120);
GetSelectedCharactersData.GfComp6 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 122);
GetSelectedCharactersData.GfComp7 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 124);
GetSelectedCharactersData.GfComp8 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 126);
GetSelectedCharactersData.GfComp9 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 128);
GetSelectedCharactersData.GfComp10 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 130);
GetSelectedCharactersData.GfComp11 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 132);
GetSelectedCharactersData.GfComp12 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 134);
GetSelectedCharactersData.GfComp13 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 136);
GetSelectedCharactersData.GfComp14 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 138);
GetSelectedCharactersData.GfComp15 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 140);
GetSelectedCharactersData.GfComp16 = BitConverter.ToUInt16(Init, selectedCharactersOffset + 142);
GetSelectedCharactersData.Kills = BitConverter.ToUInt16(Init, selectedCharactersOffset + 144);
GetSelectedCharactersData.KOs = BitConverter.ToUInt16(Init, selectedCharactersOffset + 146);
GetSelectedCharactersData.Exist = Init[selectedCharactersOffset + 148];
GetSelectedCharactersData.Unknown4 = Init[selectedCharactersOffset + 149];
GetSelectedCharactersData.CurrentStatus = Init[selectedCharactersOffset + 150];
GetSelectedCharactersData.Unknown5 = Init[selectedCharactersOffset + 151];
}
#endregion
#region Config
public static void ReadConfig(byte[] Init)
{
GetSelectedConfigData = new ConfigData();
int selectedConfigOffset = ConfigDataOffset;
OffsetToConfigSelected = selectedConfigOffset;
GetSelectedConfigData.BattleSpeed = Init[selectedConfigOffset];
GetSelectedConfigData.BattleMessage = Init[selectedConfigOffset + 1];
GetSelectedConfigData.FieldMessage = Init[selectedConfigOffset + 2];
GetSelectedConfigData.Volume = Init[selectedConfigOffset + 3];
GetSelectedConfigData.Flag = Init[selectedConfigOffset + 4];
GetSelectedConfigData.Scan = Init[selectedConfigOffset + 5];
GetSelectedConfigData.Camera = Init[selectedConfigOffset + 6];
GetSelectedConfigData.KeyUnk1 = Init[selectedConfigOffset + 7];
GetSelectedConfigData.KeyEscape = Init[selectedConfigOffset + 8];
GetSelectedConfigData.KeyPov = Init[selectedConfigOffset + 9];
GetSelectedConfigData.KeyWindow = Init[selectedConfigOffset + 10];
GetSelectedConfigData.KeyTrigger = Init[selectedConfigOffset + 11];
GetSelectedConfigData.KeyCancel = Init[selectedConfigOffset + 12];
GetSelectedConfigData.KeyMenu = Init[selectedConfigOffset + 13];
GetSelectedConfigData.KeyTalk = Init[selectedConfigOffset + 14];
GetSelectedConfigData.KeyTripleTriad = Init[selectedConfigOffset + 15];
GetSelectedConfigData.KeySelect = Init[selectedConfigOffset + 16];
GetSelectedConfigData.KeyUnk2 = Init[selectedConfigOffset + 17];
GetSelectedConfigData.KeyUnk3 = Init[selectedConfigOffset + 18];
GetSelectedConfigData.KeyStart = Init[selectedConfigOffset + 19];
}
#endregion
#region Misc
public static void ReadMisc(byte[] Init)
{
GetSelectedMiscData = new MiscData();
int selectedMiscOffset = MiscDataOffset;
OffsetToMiscSelected = selectedMiscOffset;
GetSelectedMiscData.PartyMem1 = Init[selectedMiscOffset];
GetSelectedMiscData.PartyMem2 = Init[selectedMiscOffset + 1];
GetSelectedMiscData.PartyMem3 = Init[selectedMiscOffset + 2];
GetSelectedMiscData.KnownWeapons1 = Init[selectedMiscOffset + 4];
GetSelectedMiscData.KnownWeapons2 = Init[selectedMiscOffset + 5];
GetSelectedMiscData.KnownWeapons3 = Init[selectedMiscOffset + 6];
GetSelectedMiscData.KnownWeapons4 = Init[selectedMiscOffset + 7];
byte[] byteArray = new byte[12];
Array.Copy(Init, selectedMiscOffset + 8, byteArray, 0, 12);
byte[] buffer = FF8Text.BuildString_b(byteArray);
GetSelectedMiscData.GrieverName = Encoding.UTF8.GetString(buffer);
GetSelectedMiscData.Unknown1 = BitConverter.ToUInt16(Init, selectedMiscOffset + 20);
GetSelectedMiscData.Unknown2 = BitConverter.ToUInt16(Init, selectedMiscOffset + 22);
GetSelectedMiscData.Gil = BitConverter.ToUInt32(Init, selectedMiscOffset + 24);
GetSelectedMiscData.GilLaguna = BitConverter.ToUInt32(Init, selectedMiscOffset + 28);
GetSelectedMiscData.limitQuistis1 = Init[selectedMiscOffset + 32];
GetSelectedMiscData.limitQuistis2 = Init[selectedMiscOffset + 33];
GetSelectedMiscData.limitZell1 = Init[selectedMiscOffset + 34];
GetSelectedMiscData.limitZell2 = Init[selectedMiscOffset + 35];
GetSelectedMiscData.limitIrvine = Init[selectedMiscOffset + 36];
GetSelectedMiscData.limitSelphie = Init[selectedMiscOffset + 37];
GetSelectedMiscData.limitAngeloCompleted = Init[selectedMiscOffset + 38];
GetSelectedMiscData.limitAngeloKnown = Init[selectedMiscOffset + 39];
GetSelectedMiscData.limitAngeloPoints1 = Init[selectedMiscOffset + 40];
GetSelectedMiscData.limitAngeloPoints2 = Init[selectedMiscOffset + 41];
GetSelectedMiscData.limitAngeloPoints3 = Init[selectedMiscOffset + 42];
GetSelectedMiscData.limitAngeloPoints4 = Init[selectedMiscOffset + 43];
GetSelectedMiscData.limitAngeloPoints5 = Init[selectedMiscOffset + 44];
GetSelectedMiscData.limitAngeloPoints6 = Init[selectedMiscOffset + 45];
GetSelectedMiscData.limitAngeloPoints7 = Init[selectedMiscOffset + 46];
GetSelectedMiscData.limitAngeloPoints8 = Init[selectedMiscOffset + 47];
}
#endregion
#region Items
public static void ReadItems(byte[] Init)
{
GetSelectedItemsData = new ItemsData();
int selectedItemsOffset = ItemsDataOffset;
OffsetToItemsSelected = selectedItemsOffset;
GetSelectedItemsData.Item1 = Init[selectedItemsOffset + 0];
GetSelectedItemsData.Item1Quantity = Init[selectedItemsOffset + 1];
GetSelectedItemsData.Item2 = Init[selectedItemsOffset + 2];
GetSelectedItemsData.Item2Quantity = Init[selectedItemsOffset + 3];
GetSelectedItemsData.Item3 = Init[selectedItemsOffset + 4];
GetSelectedItemsData.Item3Quantity = Init[selectedItemsOffset + 5];
GetSelectedItemsData.Item4 = Init[selectedItemsOffset + 6];
GetSelectedItemsData.Item4Quantity = Init[selectedItemsOffset + 7];
GetSelectedItemsData.Item5 = Init[selectedItemsOffset + 8];
GetSelectedItemsData.Item5Quantity = Init[selectedItemsOffset + 9];
GetSelectedItemsData.Item6 = Init[selectedItemsOffset + 10];
GetSelectedItemsData.Item6Quantity = Init[selectedItemsOffset + 11];
GetSelectedItemsData.Item7 = Init[selectedItemsOffset + 12];
GetSelectedItemsData.Item7Quantity = Init[selectedItemsOffset + 13];
GetSelectedItemsData.Item8 = Init[selectedItemsOffset + 14];
GetSelectedItemsData.Item8Quantity = Init[selectedItemsOffset + 15];
GetSelectedItemsData.Item9 = Init[selectedItemsOffset + 16];
GetSelectedItemsData.Item9Quantity = Init[selectedItemsOffset + 17];
GetSelectedItemsData.Item10 = Init[selectedItemsOffset + 18];
GetSelectedItemsData.Item10Quantity = Init[selectedItemsOffset + 19];
GetSelectedItemsData.Item11 = Init[selectedItemsOffset + 20];
GetSelectedItemsData.Item11Quantity = Init[selectedItemsOffset + 21];
GetSelectedItemsData.Item12 = Init[selectedItemsOffset + 22];
GetSelectedItemsData.Item12Quantity = Init[selectedItemsOffset + 23];
GetSelectedItemsData.Item13 = Init[selectedItemsOffset + 24];
GetSelectedItemsData.Item13Quantity = Init[selectedItemsOffset + 25];
GetSelectedItemsData.Item14 = Init[selectedItemsOffset + 26];
GetSelectedItemsData.Item14Quantity = Init[selectedItemsOffset + 27];
GetSelectedItemsData.Item15 = Init[selectedItemsOffset + 28];
GetSelectedItemsData.Item15Quantity = Init[selectedItemsOffset + 29];
GetSelectedItemsData.Item16 = Init[selectedItemsOffset + 30];
GetSelectedItemsData.Item16Quantity = Init[selectedItemsOffset + 31];
GetSelectedItemsData.Item17 = Init[selectedItemsOffset + 32];
GetSelectedItemsData.Item17Quantity = Init[selectedItemsOffset + 33];
GetSelectedItemsData.Item18 = Init[selectedItemsOffset + 34];
GetSelectedItemsData.Item18Quantity = Init[selectedItemsOffset + 35];
GetSelectedItemsData.Item19 = Init[selectedItemsOffset + 36];
GetSelectedItemsData.Item19Quantity = Init[selectedItemsOffset + 37];
GetSelectedItemsData.Item20 = Init[selectedItemsOffset + 38];
GetSelectedItemsData.Item20Quantity = Init[selectedItemsOffset + 39];
GetSelectedItemsData.Item21 = Init[selectedItemsOffset + 40];
GetSelectedItemsData.Item21Quantity = Init[selectedItemsOffset + 41];
GetSelectedItemsData.Item22 = Init[selectedItemsOffset + 42];
GetSelectedItemsData.Item22Quantity = Init[selectedItemsOffset + 43];
GetSelectedItemsData.Item23 = Init[selectedItemsOffset + 44];
GetSelectedItemsData.Item23Quantity = Init[selectedItemsOffset + 45];
GetSelectedItemsData.Item24 = Init[selectedItemsOffset + 46];
GetSelectedItemsData.Item24Quantity = Init[selectedItemsOffset + 47];
GetSelectedItemsData.Item25 = Init[selectedItemsOffset + 48];
GetSelectedItemsData.Item25Quantity = Init[selectedItemsOffset + 49];
GetSelectedItemsData.Item26 = Init[selectedItemsOffset + 50];
GetSelectedItemsData.Item26Quantity = Init[selectedItemsOffset + 51];
GetSelectedItemsData.Item27 = Init[selectedItemsOffset + 52];
GetSelectedItemsData.Item27Quantity = Init[selectedItemsOffset + 53];
GetSelectedItemsData.Item28 = Init[selectedItemsOffset + 54];
GetSelectedItemsData.Item28Quantity = Init[selectedItemsOffset + 55];
GetSelectedItemsData.Item29 = Init[selectedItemsOffset + 56];
GetSelectedItemsData.Item29Quantity = Init[selectedItemsOffset + 57];
GetSelectedItemsData.Item30 = Init[selectedItemsOffset + 58];
GetSelectedItemsData.Item30Quantity = Init[selectedItemsOffset + 59];
GetSelectedItemsData.Item31 = Init[selectedItemsOffset + 60];
GetSelectedItemsData.Item31Quantity = Init[selectedItemsOffset + 61];
GetSelectedItemsData.Item32 = Init[selectedItemsOffset + 62];
GetSelectedItemsData.Item32Quantity = Init[selectedItemsOffset + 63];
GetSelectedItemsData.Item33 = Init[selectedItemsOffset + 64];
GetSelectedItemsData.Item33Quantity = Init[selectedItemsOffset + 65];
GetSelectedItemsData.Item34 = Init[selectedItemsOffset + 66];
GetSelectedItemsData.Item34Quantity = Init[selectedItemsOffset + 67];
GetSelectedItemsData.Item35 = Init[selectedItemsOffset + 68];
GetSelectedItemsData.Item35Quantity = Init[selectedItemsOffset + 69];
GetSelectedItemsData.Item36 = Init[selectedItemsOffset + 70];
GetSelectedItemsData.Item36Quantity = Init[selectedItemsOffset + 71];
GetSelectedItemsData.Item37 = Init[selectedItemsOffset + 72];
GetSelectedItemsData.Item37Quantity = Init[selectedItemsOffset + 73];
GetSelectedItemsData.Item38 = Init[selectedItemsOffset + 74];
GetSelectedItemsData.Item38Quantity = Init[selectedItemsOffset + 75];
GetSelectedItemsData.Item39 = Init[selectedItemsOffset + 76];
GetSelectedItemsData.Item39Quantity = Init[selectedItemsOffset + 77];
GetSelectedItemsData.Item40 = Init[selectedItemsOffset + 78];
GetSelectedItemsData.Item40Quantity = Init[selectedItemsOffset + 79];
GetSelectedItemsData.Item41 = Init[selectedItemsOffset + 80];
GetSelectedItemsData.Item41Quantity = Init[selectedItemsOffset + 81];
GetSelectedItemsData.Item42 = Init[selectedItemsOffset + 82];
GetSelectedItemsData.Item42Quantity = Init[selectedItemsOffset + 83];
GetSelectedItemsData.Item43 = Init[selectedItemsOffset + 84];
GetSelectedItemsData.Item43Quantity = Init[selectedItemsOffset + 85];
GetSelectedItemsData.Item44 = Init[selectedItemsOffset + 86];
GetSelectedItemsData.Item44Quantity = Init[selectedItemsOffset + 87];
GetSelectedItemsData.Item45 = Init[selectedItemsOffset + 88];
GetSelectedItemsData.Item45Quantity = Init[selectedItemsOffset + 89];
GetSelectedItemsData.Item46 = Init[selectedItemsOffset + 90];
GetSelectedItemsData.Item46Quantity = Init[selectedItemsOffset + 91];
GetSelectedItemsData.Item47 = Init[selectedItemsOffset + 92];
GetSelectedItemsData.Item47Quantity = Init[selectedItemsOffset + 93];
GetSelectedItemsData.Item48 = Init[selectedItemsOffset + 94];
GetSelectedItemsData.Item48Quantity = Init[selectedItemsOffset + 95];
GetSelectedItemsData.Item49 = Init[selectedItemsOffset + 96];
GetSelectedItemsData.Item49Quantity = Init[selectedItemsOffset + 97];
GetSelectedItemsData.Item50 = Init[selectedItemsOffset + 98];
GetSelectedItemsData.Item50Quantity = Init[selectedItemsOffset + 99];
GetSelectedItemsData.Item51 = Init[selectedItemsOffset + 100];
GetSelectedItemsData.Item51Quantity = Init[selectedItemsOffset + 101];
GetSelectedItemsData.Item52 = Init[selectedItemsOffset + 102];
GetSelectedItemsData.Item52Quantity = Init[selectedItemsOffset + 103];
GetSelectedItemsData.Item53 = Init[selectedItemsOffset + 104];
GetSelectedItemsData.Item53Quantity = Init[selectedItemsOffset + 105];
GetSelectedItemsData.Item54 = Init[selectedItemsOffset + 106];
GetSelectedItemsData.Item54Quantity = Init[selectedItemsOffset + 107];
GetSelectedItemsData.Item55 = Init[selectedItemsOffset + 108];
GetSelectedItemsData.Item55Quantity = Init[selectedItemsOffset + 109];
GetSelectedItemsData.Item56 = Init[selectedItemsOffset + 110];
GetSelectedItemsData.Item56Quantity = Init[selectedItemsOffset + 111];
GetSelectedItemsData.Item57 = Init[selectedItemsOffset + 112];
GetSelectedItemsData.Item57Quantity = Init[selectedItemsOffset + 113];
GetSelectedItemsData.Item58 = Init[selectedItemsOffset + 114];
GetSelectedItemsData.Item58Quantity = Init[selectedItemsOffset + 115];
GetSelectedItemsData.Item59 = Init[selectedItemsOffset + 116];
GetSelectedItemsData.Item59Quantity = Init[selectedItemsOffset + 117];
GetSelectedItemsData.Item60 = Init[selectedItemsOffset + 118];
GetSelectedItemsData.Item60Quantity = Init[selectedItemsOffset + 119];
GetSelectedItemsData.Item61 = Init[selectedItemsOffset + 120];
GetSelectedItemsData.Item61Quantity = Init[selectedItemsOffset + 121];
GetSelectedItemsData.Item62 = Init[selectedItemsOffset + 122];
GetSelectedItemsData.Item62Quantity = Init[selectedItemsOffset + 123];
GetSelectedItemsData.Item63 = Init[selectedItemsOffset + 124];
GetSelectedItemsData.Item63Quantity = Init[selectedItemsOffset + 125];
GetSelectedItemsData.Item64 = Init[selectedItemsOffset + 126];
GetSelectedItemsData.Item64Quantity = Init[selectedItemsOffset + 127];
GetSelectedItemsData.Item65 = Init[selectedItemsOffset + 128];
GetSelectedItemsData.Item65Quantity = Init[selectedItemsOffset + 129];
GetSelectedItemsData.Item66 = Init[selectedItemsOffset + 130];
GetSelectedItemsData.Item66Quantity = Init[selectedItemsOffset + 131];
GetSelectedItemsData.Item67 = Init[selectedItemsOffset + 132];
GetSelectedItemsData.Item67Quantity = Init[selectedItemsOffset + 133];
GetSelectedItemsData.Item68 = Init[selectedItemsOffset + 134];
GetSelectedItemsData.Item68Quantity = Init[selectedItemsOffset + 135];
GetSelectedItemsData.Item69 = Init[selectedItemsOffset + 136];
GetSelectedItemsData.Item69Quantity = Init[selectedItemsOffset + 137];
GetSelectedItemsData.Item70 = Init[selectedItemsOffset + 138];
GetSelectedItemsData.Item70Quantity = Init[selectedItemsOffset + 139];
GetSelectedItemsData.Item71 = Init[selectedItemsOffset + 140];
GetSelectedItemsData.Item71Quantity = Init[selectedItemsOffset + 141];
GetSelectedItemsData.Item72 = Init[selectedItemsOffset + 142];
GetSelectedItemsData.Item72Quantity = Init[selectedItemsOffset + 143];
GetSelectedItemsData.Item73 = Init[selectedItemsOffset + 144];
GetSelectedItemsData.Item73Quantity = Init[selectedItemsOffset + 145];
GetSelectedItemsData.Item74 = Init[selectedItemsOffset + 146];
GetSelectedItemsData.Item74Quantity = Init[selectedItemsOffset + 147];
GetSelectedItemsData.Item75 = Init[selectedItemsOffset + 148];
GetSelectedItemsData.Item75Quantity = Init[selectedItemsOffset + 149];
GetSelectedItemsData.Item76 = Init[selectedItemsOffset + 150];
GetSelectedItemsData.Item76Quantity = Init[selectedItemsOffset + 151];
GetSelectedItemsData.Item77 = Init[selectedItemsOffset + 152];
GetSelectedItemsData.Item77Quantity = Init[selectedItemsOffset + 153];
GetSelectedItemsData.Item78 = Init[selectedItemsOffset + 154];
GetSelectedItemsData.Item78Quantity = Init[selectedItemsOffset + 155];
GetSelectedItemsData.Item79 = Init[selectedItemsOffset + 156];
GetSelectedItemsData.Item79Quantity = Init[selectedItemsOffset + 157];
GetSelectedItemsData.Item80 = Init[selectedItemsOffset + 158];
GetSelectedItemsData.Item80Quantity = Init[selectedItemsOffset + 159];
GetSelectedItemsData.Item81 = Init[selectedItemsOffset + 160];
GetSelectedItemsData.Item81Quantity = Init[selectedItemsOffset + 161];
GetSelectedItemsData.Item82 = Init[selectedItemsOffset + 162];
GetSelectedItemsData.Item82Quantity = Init[selectedItemsOffset + 163];
GetSelectedItemsData.Item83 = Init[selectedItemsOffset + 164];
GetSelectedItemsData.Item83Quantity = Init[selectedItemsOffset + 165];
GetSelectedItemsData.Item84 = Init[selectedItemsOffset + 166];
GetSelectedItemsData.Item84Quantity = Init[selectedItemsOffset + 167];
GetSelectedItemsData.Item85 = Init[selectedItemsOffset + 168];
GetSelectedItemsData.Item85Quantity = Init[selectedItemsOffset + 169];
GetSelectedItemsData.Item86 = Init[selectedItemsOffset + 170];
GetSelectedItemsData.Item86Quantity = Init[selectedItemsOffset + 171];
GetSelectedItemsData.Item87 = Init[selectedItemsOffset + 172];
GetSelectedItemsData.Item87Quantity = Init[selectedItemsOffset + 173];
GetSelectedItemsData.Item88 = Init[selectedItemsOffset + 174];
GetSelectedItemsData.Item88Quantity = Init[selectedItemsOffset + 175];
GetSelectedItemsData.Item89 = Init[selectedItemsOffset + 176];
GetSelectedItemsData.Item89Quantity = Init[selectedItemsOffset + 177];
GetSelectedItemsData.Item90 = Init[selectedItemsOffset + 178];
GetSelectedItemsData.Item90Quantity = Init[selectedItemsOffset + 179];
GetSelectedItemsData.Item91 = Init[selectedItemsOffset + 180];
GetSelectedItemsData.Item91Quantity = Init[selectedItemsOffset + 181];
GetSelectedItemsData.Item92 = Init[selectedItemsOffset + 182];
GetSelectedItemsData.Item92Quantity = Init[selectedItemsOffset + 183];
GetSelectedItemsData.Item93 = Init[selectedItemsOffset + 184];
GetSelectedItemsData.Item93Quantity = Init[selectedItemsOffset + 185];
GetSelectedItemsData.Item94 = Init[selectedItemsOffset + 186];
GetSelectedItemsData.Item94Quantity = Init[selectedItemsOffset + 187];
GetSelectedItemsData.Item95 = Init[selectedItemsOffset + 188];
GetSelectedItemsData.Item95Quantity = Init[selectedItemsOffset + 189];
GetSelectedItemsData.Item96 = Init[selectedItemsOffset + 190];
GetSelectedItemsData.Item96Quantity = Init[selectedItemsOffset + 191];
GetSelectedItemsData.Item97 = Init[selectedItemsOffset + 192];
GetSelectedItemsData.Item97Quantity = Init[selectedItemsOffset + 193];
GetSelectedItemsData.Item98 = Init[selectedItemsOffset + 194];
GetSelectedItemsData.Item98Quantity = Init[selectedItemsOffset + 195];
GetSelectedItemsData.Item99 = Init[selectedItemsOffset + 196];
GetSelectedItemsData.Item99Quantity = Init[selectedItemsOffset + 197];
GetSelectedItemsData.Item100 = Init[selectedItemsOffset + 198];
GetSelectedItemsData.Item100Quantity = Init[selectedItemsOffset + 199];
GetSelectedItemsData.Item101 = Init[selectedItemsOffset + 200];
GetSelectedItemsData.Item101Quantity = Init[selectedItemsOffset + 201];
GetSelectedItemsData.Item102 = Init[selectedItemsOffset + 202];
GetSelectedItemsData.Item102Quantity = Init[selectedItemsOffset + 203];
GetSelectedItemsData.Item103 = Init[selectedItemsOffset + 204];
GetSelectedItemsData.Item103Quantity = Init[selectedItemsOffset + 205];
GetSelectedItemsData.Item104 = Init[selectedItemsOffset + 206];
GetSelectedItemsData.Item104Quantity = Init[selectedItemsOffset + 207];
GetSelectedItemsData.Item105 = Init[selectedItemsOffset + 208];
GetSelectedItemsData.Item105Quantity = Init[selectedItemsOffset + 209];
GetSelectedItemsData.Item106 = Init[selectedItemsOffset + 210];
GetSelectedItemsData.Item106Quantity = Init[selectedItemsOffset + 211];
GetSelectedItemsData.Item107 = Init[selectedItemsOffset + 212];
GetSelectedItemsData.Item107Quantity = Init[selectedItemsOffset + 213];
GetSelectedItemsData.Item108 = Init[selectedItemsOffset + 214];
GetSelectedItemsData.Item108Quantity = Init[selectedItemsOffset + 215];
GetSelectedItemsData.Item109 = Init[selectedItemsOffset + 216];
GetSelectedItemsData.Item109Quantity = Init[selectedItemsOffset + 217];
GetSelectedItemsData.Item110 = Init[selectedItemsOffset + 218];
GetSelectedItemsData.Item110Quantity = Init[selectedItemsOffset + 219];
GetSelectedItemsData.Item111 = Init[selectedItemsOffset + 220];
GetSelectedItemsData.Item111Quantity = Init[selectedItemsOffset + 221];
GetSelectedItemsData.Item112 = Init[selectedItemsOffset + 222];
GetSelectedItemsData.Item112Quantity = Init[selectedItemsOffset + 223];
GetSelectedItemsData.Item113 = Init[selectedItemsOffset + 224];
GetSelectedItemsData.Item113Quantity = Init[selectedItemsOffset + 225];
GetSelectedItemsData.Item114 = Init[selectedItemsOffset + 226];
GetSelectedItemsData.Item114Quantity = Init[selectedItemsOffset + 227];
GetSelectedItemsData.Item115 = Init[selectedItemsOffset + 228];
GetSelectedItemsData.Item115Quantity = Init[selectedItemsOffset + 229];
GetSelectedItemsData.Item116 = Init[selectedItemsOffset + 230];
GetSelectedItemsData.Item116Quantity = Init[selectedItemsOffset + 231];
GetSelectedItemsData.Item117 = Init[selectedItemsOffset + 232];
GetSelectedItemsData.Item117Quantity = Init[selectedItemsOffset + 233];
GetSelectedItemsData.Item118 = Init[selectedItemsOffset + 234];
GetSelectedItemsData.Item118Quantity = Init[selectedItemsOffset + 235];
GetSelectedItemsData.Item119 = Init[selectedItemsOffset + 236];
GetSelectedItemsData.Item119Quantity = Init[selectedItemsOffset + 237];
GetSelectedItemsData.Item120 = Init[selectedItemsOffset + 238];
GetSelectedItemsData.Item120Quantity = Init[selectedItemsOffset + 239];
GetSelectedItemsData.Item121 = Init[selectedItemsOffset + 240];
GetSelectedItemsData.Item121Quantity = Init[selectedItemsOffset + 241];
GetSelectedItemsData.Item122 = Init[selectedItemsOffset + 242];
GetSelectedItemsData.Item122Quantity = Init[selectedItemsOffset + 243];
GetSelectedItemsData.Item123 = Init[selectedItemsOffset + 244];
GetSelectedItemsData.Item123Quantity = Init[selectedItemsOffset + 245];
GetSelectedItemsData.Item124 = Init[selectedItemsOffset + 246];
GetSelectedItemsData.Item124Quantity = Init[selectedItemsOffset + 247];
GetSelectedItemsData.Item125 = Init[selectedItemsOffset + 248];
GetSelectedItemsData.Item125Quantity = Init[selectedItemsOffset + 249];
GetSelectedItemsData.Item126 = Init[selectedItemsOffset + 250];
GetSelectedItemsData.Item126Quantity = Init[selectedItemsOffset + 251];
GetSelectedItemsData.Item127 = Init[selectedItemsOffset + 252];
GetSelectedItemsData.Item127Quantity = Init[selectedItemsOffset + 253];
GetSelectedItemsData.Item128 = Init[selectedItemsOffset + 254];
GetSelectedItemsData.Item128Quantity = Init[selectedItemsOffset + 255];
GetSelectedItemsData.Item129 = Init[selectedItemsOffset + 256];
GetSelectedItemsData.Item129Quantity = Init[selectedItemsOffset + 257];
GetSelectedItemsData.Item130 = Init[selectedItemsOffset + 258];
GetSelectedItemsData.Item130Quantity = Init[selectedItemsOffset + 259];
GetSelectedItemsData.Item131 = Init[selectedItemsOffset + 260];
GetSelectedItemsData.Item131Quantity = Init[selectedItemsOffset + 261];
GetSelectedItemsData.Item132 = Init[selectedItemsOffset + 262];
GetSelectedItemsData.Item132Quantity = Init[selectedItemsOffset + 263];
GetSelectedItemsData.Item133 = Init[selectedItemsOffset + 264];
GetSelectedItemsData.Item133Quantity = Init[selectedItemsOffset + 265];
GetSelectedItemsData.Item134 = Init[selectedItemsOffset + 266];
GetSelectedItemsData.Item134Quantity = Init[selectedItemsOffset + 267];
GetSelectedItemsData.Item135 = Init[selectedItemsOffset + 268];
GetSelectedItemsData.Item135Quantity = Init[selectedItemsOffset + 269];
GetSelectedItemsData.Item136 = Init[selectedItemsOffset + 270];
GetSelectedItemsData.Item136Quantity = Init[selectedItemsOffset + 271];
GetSelectedItemsData.Item137 = Init[selectedItemsOffset + 272];
GetSelectedItemsData.Item137Quantity = Init[selectedItemsOffset + 273];
GetSelectedItemsData.Item138 = Init[selectedItemsOffset + 274];
GetSelectedItemsData.Item138Quantity = Init[selectedItemsOffset + 275];
GetSelectedItemsData.Item139 = Init[selectedItemsOffset + 276];
GetSelectedItemsData.Item139Quantity = Init[selectedItemsOffset + 277];
GetSelectedItemsData.Item140 = Init[selectedItemsOffset + 278];
GetSelectedItemsData.Item140Quantity = Init[selectedItemsOffset + 279];
GetSelectedItemsData.Item141 = Init[selectedItemsOffset + 280];
GetSelectedItemsData.Item141Quantity = Init[selectedItemsOffset + 281];
GetSelectedItemsData.Item142 = Init[selectedItemsOffset + 282];
GetSelectedItemsData.Item142Quantity = Init[selectedItemsOffset + 283];
GetSelectedItemsData.Item143 = Init[selectedItemsOffset + 284];
GetSelectedItemsData.Item143Quantity = Init[selectedItemsOffset + 285];
GetSelectedItemsData.Item144 = Init[selectedItemsOffset + 286];
GetSelectedItemsData.Item144Quantity = Init[selectedItemsOffset + 287];
GetSelectedItemsData.Item145 = Init[selectedItemsOffset + 288];
GetSelectedItemsData.Item145Quantity = Init[selectedItemsOffset + 289];
GetSelectedItemsData.Item146 = Init[selectedItemsOffset + 290];
GetSelectedItemsData.Item146Quantity = Init[selectedItemsOffset + 291];
GetSelectedItemsData.Item147 = Init[selectedItemsOffset + 292];
GetSelectedItemsData.Item147Quantity = Init[selectedItemsOffset + 293];
GetSelectedItemsData.Item148 = Init[selectedItemsOffset + 294];
GetSelectedItemsData.Item148Quantity = Init[selectedItemsOffset + 295];
GetSelectedItemsData.Item149 = Init[selectedItemsOffset + 296];
GetSelectedItemsData.Item149Quantity = Init[selectedItemsOffset + 297];
GetSelectedItemsData.Item150 = Init[selectedItemsOffset + 298];
GetSelectedItemsData.Item150Quantity = Init[selectedItemsOffset + 299];
GetSelectedItemsData.Item151 = Init[selectedItemsOffset + 300];
GetSelectedItemsData.Item151Quantity = Init[selectedItemsOffset + 301];
GetSelectedItemsData.Item152 = Init[selectedItemsOffset + 302];
GetSelectedItemsData.Item152Quantity = Init[selectedItemsOffset + 303];
GetSelectedItemsData.Item153 = Init[selectedItemsOffset + 304];
GetSelectedItemsData.Item153Quantity = Init[selectedItemsOffset + 305];
GetSelectedItemsData.Item154 = Init[selectedItemsOffset + 306];
GetSelectedItemsData.Item154Quantity = Init[selectedItemsOffset + 307];
GetSelectedItemsData.Item155 = Init[selectedItemsOffset + 308];
GetSelectedItemsData.Item155Quantity = Init[selectedItemsOffset + 309];
GetSelectedItemsData.Item156 = Init[selectedItemsOffset + 310];
GetSelectedItemsData.Item156Quantity = Init[selectedItemsOffset + 311];
GetSelectedItemsData.Item157 = Init[selectedItemsOffset + 312];
GetSelectedItemsData.Item157Quantity = Init[selectedItemsOffset + 313];
GetSelectedItemsData.Item158 = Init[selectedItemsOffset + 314];
GetSelectedItemsData.Item158Quantity = Init[selectedItemsOffset + 315];
GetSelectedItemsData.Item159 = Init[selectedItemsOffset + 316];
GetSelectedItemsData.Item159Quantity = Init[selectedItemsOffset + 317];
GetSelectedItemsData.Item160 = Init[selectedItemsOffset + 318];
GetSelectedItemsData.Item160Quantity = Init[selectedItemsOffset + 319];
GetSelectedItemsData.Item161 = Init[selectedItemsOffset + 320];
GetSelectedItemsData.Item161Quantity = Init[selectedItemsOffset + 321];
GetSelectedItemsData.Item162 = Init[selectedItemsOffset + 322];
GetSelectedItemsData.Item162Quantity = Init[selectedItemsOffset + 323];
GetSelectedItemsData.Item163 = Init[selectedItemsOffset + 324];
GetSelectedItemsData.Item163Quantity = Init[selectedItemsOffset + 325];
GetSelectedItemsData.Item164 = Init[selectedItemsOffset + 326];
GetSelectedItemsData.Item164Quantity = Init[selectedItemsOffset + 327];
GetSelectedItemsData.Item165 = Init[selectedItemsOffset + 328];
GetSelectedItemsData.Item165Quantity = Init[selectedItemsOffset + 329];
GetSelectedItemsData.Item166 = Init[selectedItemsOffset + 330];
GetSelectedItemsData.Item166Quantity = Init[selectedItemsOffset + 331];
GetSelectedItemsData.Item167 = Init[selectedItemsOffset + 332];
GetSelectedItemsData.Item167Quantity = Init[selectedItemsOffset + 333];
GetSelectedItemsData.Item168 = Init[selectedItemsOffset + 334];
GetSelectedItemsData.Item168Quantity = Init[selectedItemsOffset + 335];
GetSelectedItemsData.Item169 = Init[selectedItemsOffset + 336];
GetSelectedItemsData.Item169Quantity = Init[selectedItemsOffset + 337];
GetSelectedItemsData.Item170 = Init[selectedItemsOffset + 338];
GetSelectedItemsData.Item170Quantity = Init[selectedItemsOffset + 339];
GetSelectedItemsData.Item171 = Init[selectedItemsOffset + 340];
GetSelectedItemsData.Item171Quantity = Init[selectedItemsOffset + 341];
GetSelectedItemsData.Item172 = Init[selectedItemsOffset + 342];
GetSelectedItemsData.Item172Quantity = Init[selectedItemsOffset + 343];
GetSelectedItemsData.Item173 = Init[selectedItemsOffset + 344];
GetSelectedItemsData.Item173Quantity = Init[selectedItemsOffset + 345];
GetSelectedItemsData.Item174 = Init[selectedItemsOffset + 346];
GetSelectedItemsData.Item174Quantity = Init[selectedItemsOffset + 347];
GetSelectedItemsData.Item175 = Init[selectedItemsOffset + 348];
GetSelectedItemsData.Item175Quantity = Init[selectedItemsOffset + 349];
GetSelectedItemsData.Item176 = Init[selectedItemsOffset + 350];
GetSelectedItemsData.Item176Quantity = Init[selectedItemsOffset + 351];
GetSelectedItemsData.Item177 = Init[selectedItemsOffset + 352];
GetSelectedItemsData.Item177Quantity = Init[selectedItemsOffset + 353];
GetSelectedItemsData.Item178 = Init[selectedItemsOffset + 354];
GetSelectedItemsData.Item178Quantity = Init[selectedItemsOffset + 355];
GetSelectedItemsData.Item179 = Init[selectedItemsOffset + 356];
GetSelectedItemsData.Item179Quantity = Init[selectedItemsOffset + 357];
GetSelectedItemsData.Item180 = Init[selectedItemsOffset + 358];
GetSelectedItemsData.Item180Quantity = Init[selectedItemsOffset + 359];
GetSelectedItemsData.Item181 = Init[selectedItemsOffset + 360];
GetSelectedItemsData.Item181Quantity = Init[selectedItemsOffset + 361];
GetSelectedItemsData.Item182 = Init[selectedItemsOffset + 362];
GetSelectedItemsData.Item182Quantity = Init[selectedItemsOffset + 363];
GetSelectedItemsData.Item183 = Init[selectedItemsOffset + 364];
GetSelectedItemsData.Item183Quantity = Init[selectedItemsOffset + 365];
GetSelectedItemsData.Item184 = Init[selectedItemsOffset + 366];
GetSelectedItemsData.Item184Quantity = Init[selectedItemsOffset + 367];
GetSelectedItemsData.Item185 = Init[selectedItemsOffset + 368];
GetSelectedItemsData.Item185Quantity = Init[selectedItemsOffset + 369];
GetSelectedItemsData.Item186 = Init[selectedItemsOffset + 370];
GetSelectedItemsData.Item186Quantity = Init[selectedItemsOffset + 371];
GetSelectedItemsData.Item187 = Init[selectedItemsOffset + 372];
GetSelectedItemsData.Item187Quantity = Init[selectedItemsOffset + 373];
GetSelectedItemsData.Item188 = Init[selectedItemsOffset + 374];
GetSelectedItemsData.Item188Quantity = Init[selectedItemsOffset + 375];
GetSelectedItemsData.Item189 = Init[selectedItemsOffset + 376];
GetSelectedItemsData.Item189Quantity = Init[selectedItemsOffset + 377];
GetSelectedItemsData.Item190 = Init[selectedItemsOffset + 378];
GetSelectedItemsData.Item190Quantity = Init[selectedItemsOffset + 379];
GetSelectedItemsData.Item191 = Init[selectedItemsOffset + 380];
GetSelectedItemsData.Item191Quantity = Init[selectedItemsOffset + 381];
GetSelectedItemsData.Item192 = Init[selectedItemsOffset + 382];
GetSelectedItemsData.Item192Quantity = Init[selectedItemsOffset + 383];
GetSelectedItemsData.Item193 = Init[selectedItemsOffset + 384];
GetSelectedItemsData.Item193Quantity = Init[selectedItemsOffset + 385];
GetSelectedItemsData.Item194 = Init[selectedItemsOffset + 386];
GetSelectedItemsData.Item194Quantity = Init[selectedItemsOffset + 387];
GetSelectedItemsData.Item195 = Init[selectedItemsOffset + 388];
GetSelectedItemsData.Item195Quantity = Init[selectedItemsOffset + 389];
GetSelectedItemsData.Item196 = Init[selectedItemsOffset + 390];
GetSelectedItemsData.Item196Quantity = Init[selectedItemsOffset + 391];
GetSelectedItemsData.Item197 = Init[selectedItemsOffset + 392];
GetSelectedItemsData.Item197Quantity = Init[selectedItemsOffset + 393];
GetSelectedItemsData.Item198 = Init[selectedItemsOffset + 394];
GetSelectedItemsData.Item198Quantity = Init[selectedItemsOffset + 395];
}
#endregion
#endregion
}
} | gpl-3.0 |
mmmovania/libjpeg_VS2012 | control/residualblockhelper.hpp | 5301 | /*************************************************************************
** Copyright (c) 2011-2012 Accusoft **
** This program is free software, licensed under the GPLv3 **
** see README.license for details **
** **
** For obtaining other licenses, contact the author at **
** [email protected] **
** **
** Written by Thomas Richter (THOR Software) **
** Sponsored by Accusoft, Tampa, FL and **
** the Computing Center of the University of Stuttgart **
**************************************************************************
This software is a complete implementation of ITU T.81 - ISO/IEC 10918,
also known as JPEG. It implements the standard in all its variations,
including lossless coding, hierarchical coding, arithmetic coding and
DNL, restart markers and 12bpp coding.
In addition, it includes support for new proposed JPEG technologies that
are currently under discussion in the SC29/WG1 standardization group of
the ISO (also known as JPEG). These technologies include lossless coding
of JPEG backwards compatible to the DCT process, and various other
extensions.
The author is a long-term member of the JPEG committee and it is hoped that
this implementation will trigger and facilitate the future development of
the JPEG standard, both for private use, industrial applications and within
the committee itself.
Copyright (C) 2011-2012 Accusoft, Thomas Richter <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*************************************************************************/
/*
**
** This class computes, prepares or includes residual data for block
** based processing. It abstracts parts of the residual coding
** process.
**
** $Id: residualblockhelper.hpp,v 1.13 2012-09-14 18:56:35 thor Exp $
**
*/
#ifndef CONTROL_RESIDUALBLOCKHELPER_HPP
#define CONTROL_RESIDUALBLOCKHELPER_HPP
/// Includes
#include "../tools/environment.hpp"
#include "../tools/rectangle.hpp"
#include "../marker/frame.hpp"
///
/// Forwards
struct ImageBitMap;
class DCT;
///
/// Class ResidualBlockHelper
// This class computes, prepares or includes residual data for block
// based processing. It abstracts parts of the residual coding
// process.
class ResidualBlockHelper : public JKeeper {
//
// The frame that contains the image.
class Frame *m_pFrame;
//
// The color transformer.
class ColorTrafo *m_pOriginalData;
//
// Temporary image bitmaps.
struct ImageBitMap **m_ppTransformed;
//
// Reconstructed data for computing the residual.
LONG **m_ppReconstructed;
//
// Number of components in the frame, number of components we handle.
UBYTE m_ucCount;
//
// One point pixel transform for higher bitdepth coding, to
// be applied before color transformation. This creates
// residual data potentially coded by the residual scan.
// Or it creates loss.
UBYTE m_ucPointShift;
//
// The identity tone mapping transform for the HDR encoding.
UWORD *m_pusIdentity;
//
// The Hadamard transformation.
class DCT **m_ppTrafo;
//
// The luma DC quantization factor if Hadamard transformation
// is disabled.
UWORD m_usLumaQuant;
//
// The chroma DC quantization factor if Hadamard transformation
// is disabled.
UWORD m_usChromaQuant;
//
// Create a trivial color transformation that pulls the data from the source
class ColorTrafo *CreateTrivialTrafo(class ColorTrafo *ctrafo,UBYTE bpp);
//
// Allocate the temporary buffers to hold the residuals and their bitmaps.
// Only required during encoding.
void AllocateBuffers(void);
//
// Allocate the Hadamard transformations
// and initialize their quantization factors. Returns false
// in case the Hadamard transformation is disabled.
bool BuildTransformations(void);
//
public:
//
ResidualBlockHelper(class Frame *frame);
//
~ResidualBlockHelper(void);
//
// Add residual coding errors from a side-channel if there is such a thing.
void AddResidual(const RectAngle<LONG> &r,const struct ImageBitMap *const *dest,
LONG * const *residual,ULONG max);
//
// Compute the residuals of a block given the DCT data
void ComputeResiduals(const RectAngle<LONG> &r,class BlockBitmapRequester *req,
const struct ImageBitMap *const *source,
LONG *const *dct,LONG **residual,ULONG max);
//
};
///
///
#endif
| gpl-3.0 |
Stefie/aframe-curvedimage-calculator | webpack.config.js | 1432 | const path = require('path'),
webpack = require('webpack'),
poststylus = require('poststylus'),
HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
context: __dirname + "/app",
entry: ['babel-polyfill','./app.jsx'],
output: {
path: __dirname,
filename: "bundle.js"
},
resolve: {
// Tell webpack to look for required files in node
modulesDirectories: ['node_modules'],
extensions: ['', '.js', '.jsx', '.json', '.styl']
},
module: {
// npParse === aframe Bugfix for console warning
noParse: [
/node_modules\/aframe\/dist\/aframe-master.js/, // for aframe from NPM
/node_modules\/cannon\/build\/cannon.js/, // for aframe-extras from NPM
],
loaders: [
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'stage-0', 'react'],
}
},{
test: /\.styl$/,
loader: 'style-loader!css-loader!stylus-loader'
},{ test: /\.(png|jpg|woff|woff2|eot|ttf|svg)(\?[a-z0-9=&.]+)?$/, loader: 'url-loader?limit=100000' }
]
},
stylus: {
use: [
poststylus([ 'autoprefixer'])
]
},
plugins: [
new HtmlWebpackPlugin({
title: 'A-Frame Curverimge Calculator',
template: __dirname + '/app/index.html',
inject: 'body',
files: {
'css': [ __dirname + '/app/style.styl']
}
})
]
};
| gpl-3.0 |
douniwan5788/netbox | NetBox2/BoxConsole.cpp | 3561 | // BoxConsole.cpp : implementation file
//
#include "stdafx.h"
#include "BoxConsole.h"
#include "BoxSystem.h"
#include "NetBox2.h"
#include <openssl\rand.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CBoxConsole
IMPLEMENT_DYNAMIC(CBoxConsole, CBoxSafeObject)
CBoxConsole::CBoxConsole() : m_hStdin(NULL), m_hStdout(NULL)
{
}
BEGIN_DISPATCH_MAP(CBoxConsole, CBoxSafeObject)
DISP_FUNCTION(CBoxConsole, "Read", Read, VT_I4, VTS_NONE)
DISP_FUNCTION(CBoxConsole, "ReadLine", ReadLine, VT_BSTR, VTS_NONE)
DISP_FUNCTION(CBoxConsole, "ReadPassword", ReadPassword, VT_BSTR, VTS_NONE)
DISP_FUNCTION(CBoxConsole, "Write", Write, VT_EMPTY, VTS_BSTR)
DISP_FUNCTION(CBoxConsole, "WriteLine", WriteLine, VT_EMPTY, VTS_BSTR)
DISP_FUNCTION(CBoxConsole, "WriteBlankLines", WriteBlankLines, VT_EMPTY, VTS_I4)
DISP_PROPERTY_EX(CBoxConsole, "Caption", get_Caption, put_Caption, VT_BSTR)
END_DISPATCH_MAP()
HWND g_hWndConsole;
void CBoxConsole::AllocConsole()
{
if(m_hStdin == NULL && m_hStdout == NULL)
{
BYTE randstr[11];
::AllocConsole();
m_hStdin = ::GetStdHandle(STD_INPUT_HANDLE);
m_hStdout = ::GetStdHandle(STD_OUTPUT_HANDLE);
RAND_bytes(randstr, 10);
for(int i = 0; i < 10; i ++)
randstr[i] = (randstr[i] % 26) + 'A';
randstr[10] = 0;
::SetConsoleTitle((LPSTR)randstr);
g_hWndConsole = ::FindWindow(NULL, (LPSTR)randstr);
::SetConsoleTitle(CBoxSystem::getVersion());
::SetForegroundWindow(g_hWndConsole);
}
}
// CBoxConsole message handlers
void CBoxConsole::Write(LPCTSTR pstr)
{
if(!pstr)return;
DWORD dwSize = 0;
DWORD dwStrLen = (DWORD)_tcslen(pstr);
while(dwStrLen > 1024)
{
::WriteConsole(m_hStdout, pstr, 1024, &dwSize, NULL);
dwSize = 0;
pstr += 1024;
dwStrLen -= 1024;
}
::WriteConsole(m_hStdout, pstr, dwStrLen, &dwSize, NULL);
}
void CBoxConsole::WriteLine(LPCTSTR pstr)
{
DWORD dwSize;
if(!pstr)return;
Write(pstr);
::WriteConsole(m_hStdout, _T("\r\n"), 2, &dwSize, NULL);
}
void CBoxConsole::WriteBlankLines(long nLine)
{
if(nLine > 0)
{
TCHAR strNewLine[1024];
DWORD dwSize;
for(int i = 0; i < 1024; i += 2)
{
strNewLine[i] = _T('\r');
strNewLine[i + 1] = _T('\n');
}
while(nLine > 512)
{
::WriteConsole(m_hStdout, strNewLine, 1024, &dwSize, NULL);
nLine -= 512;
}
if(nLine > 0)
::WriteConsole(m_hStdout, strNewLine, nLine * 2, &dwSize, NULL);
}
}
long CBoxConsole::Read(void)
{
TCHAR ch;
DWORD dwSize;
::ReadConsole(m_hStdin, &ch, 1, &dwSize, NULL);
return (long)ch;
}
BSTR CBoxConsole::ReadPassword(void)
{
DWORD dwMode;
DWORD dwSize;
GetConsoleMode(m_hStdin, &dwMode);
SetConsoleMode(m_hStdin, ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT);
BSTR bstr = ReadLine();
SetConsoleMode(m_hStdin, dwMode);
::WriteConsole(m_hStdout, _T("\r\n"), 2, &dwSize, NULL);
return bstr;
}
CString CBoxConsole::ReadString(void)
{
CString str;
LPTSTR lpstr = str.GetBuffer(1024 + 1);
DWORD dwSize;
::ReadConsole(m_hStdin, lpstr, 1024, &dwSize, NULL);
if(dwSize >= 2)dwSize -= 2;
else dwSize = 0;
lpstr[dwSize] = 0;
str.ReleaseBuffer();
return str;
}
BSTR CBoxConsole::ReadLine(void)
{
return ReadString().AllocSysString();
}
void CBoxConsole::put_Caption(LPCTSTR pstrTitle)
{
::SetConsoleTitle(pstrTitle);
}
BSTR CBoxConsole::get_Caption()
{
TCHAR strTitle[1024];
::GetConsoleTitle(strTitle, 1024);
CComBSTR bstr(strTitle);
return bstr.Detach();
}
| gpl-3.0 |
MikeMatt16/Abide | Abide Halo Library/Abide.HaloLibrary/Halo2/Retail/Tag/Generated/GlobalTagImportInfoBlock.Generated.cs | 2607 | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Abide.HaloLibrary.Halo2.Retail.Tag.Generated
{
using System;
using Abide.HaloLibrary;
using Abide.HaloLibrary.Halo2.Retail.Tag;
/// <summary>
/// Represents the generated global_tag_import_info_block tag block.
/// </summary>
internal sealed class GlobalTagImportInfoBlock : Block
{
/// <summary>
/// Initializes a new instance of the <see cref="GlobalTagImportInfoBlock"/> class.
/// </summary>
public GlobalTagImportInfoBlock()
{
this.Fields.Add(new LongIntegerField("build*"));
this.Fields.Add(new LongStringField("version*"));
this.Fields.Add(new StringField("import date*"));
this.Fields.Add(new StringField("culprit*"));
this.Fields.Add(new PadField("", 96));
this.Fields.Add(new StringField("import time*"));
this.Fields.Add(new PadField("", 4));
this.Fields.Add(new BlockField<TagImportFileBlock>("files*", 1024));
this.Fields.Add(new PadField("", 128));
}
/// <summary>
/// Gets and returns the name of the global_tag_import_info_block tag block.
/// </summary>
public override string BlockName
{
get
{
return "global_tag_import_info_block";
}
}
/// <summary>
/// Gets and returns the display name of the global_tag_import_info_block tag block.
/// </summary>
public override string DisplayName
{
get
{
return "import info";
}
}
/// <summary>
/// Gets and returns the maximum number of elements allowed of the global_tag_import_info_block tag block.
/// </summary>
public override int MaximumElementCount
{
get
{
return 1;
}
}
/// <summary>
/// Gets and returns the alignment of the global_tag_import_info_block tag block.
/// </summary>
public override int Alignment
{
get
{
return 4;
}
}
}
}
| gpl-3.0 |
telerik/justdecompile-plugins | De4dot.JustDecompile/De4dot/sources/dnlib/src/DotNet/MD/MetaData.cs | 25722 | /*
Copyright (C) 2012-2014 [email protected]
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System;
using System.Collections.Generic;
using System.Threading;
using dnlib.PE;
using dnlib.Threading;
#if THREAD_SAFE
using ThreadSafe = dnlib.Threading.Collections;
#else
using ThreadSafe = System.Collections.Generic;
#endif
namespace dnlib.DotNet.MD {
/// <summary>
/// Common base class for #~ and #- metadata classes
/// </summary>
abstract class MetaData : IMetaData {
/// <summary>
/// The PE image
/// </summary>
protected IPEImage peImage;
/// <summary>
/// The .NET header
/// </summary>
protected ImageCor20Header cor20Header;
/// <summary>
/// The MD header
/// </summary>
protected MetaDataHeader mdHeader;
/// <summary>
/// The #Strings stream
/// </summary>
protected StringsStream stringsStream;
/// <summary>
/// The #US stream
/// </summary>
protected USStream usStream;
/// <summary>
/// The #Blob stream
/// </summary>
protected BlobStream blobStream;
/// <summary>
/// The #GUID stream
/// </summary>
protected GuidStream guidStream;
/// <summary>
/// The #~ or #- stream
/// </summary>
protected TablesStream tablesStream;
/// <summary>
/// All the streams that are present in the PE image
/// </summary>
protected ThreadSafe.IList<DotNetStream> allStreams;
uint[] fieldRidToTypeDefRid;
uint[] methodRidToTypeDefRid;
uint[] eventRidToTypeDefRid;
uint[] propertyRidToTypeDefRid;
uint[] gpRidToOwnerRid;
uint[] gpcRidToOwnerRid;
uint[] paramRidToOwnerRid;
Dictionary<uint, RandomRidList> typeDefRidToNestedClasses;
RandomRidList nonNestedTypes;
/// <inheritdoc/>
public ImageCor20Header ImageCor20Header {
get { return cor20Header; }
}
/// <inheritdoc/>
public ushort MajorVersion {
get { return mdHeader.MajorVersion; }
}
/// <inheritdoc/>
public ushort MinorVersion {
get { return mdHeader.MinorVersion; }
}
/// <inheritdoc/>
public string VersionString {
get { return mdHeader.VersionString; }
}
/// <inheritdoc/>
public IPEImage PEImage {
get { return peImage; }
}
/// <inheritdoc/>
public MetaDataHeader MetaDataHeader {
get { return mdHeader; }
}
/// <inheritdoc/>
public StringsStream StringsStream {
get { return stringsStream; }
}
/// <inheritdoc/>
public USStream USStream {
get { return usStream; }
}
/// <inheritdoc/>
public BlobStream BlobStream {
get { return blobStream; }
}
/// <inheritdoc/>
public GuidStream GuidStream {
get { return guidStream; }
}
/// <inheritdoc/>
public TablesStream TablesStream {
get { return tablesStream; }
}
/// <inheritdoc/>
public ThreadSafe.IList<DotNetStream> AllStreams {
get { return allStreams; }
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="peImage">The PE image</param>
/// <param name="cor20Header">The .NET header</param>
/// <param name="mdHeader">The MD header</param>
protected MetaData(IPEImage peImage, ImageCor20Header cor20Header, MetaDataHeader mdHeader) {
try {
this.allStreams = ThreadSafeListCreator.Create<DotNetStream>();
this.peImage = peImage;
this.cor20Header = cor20Header;
this.mdHeader = mdHeader;
}
catch {
if (peImage != null)
peImage.Dispose();
throw;
}
}
/// <summary>
/// Initializes the metadata, tables, streams
/// </summary>
public void Initialize() {
InitializeInternal();
if (tablesStream == null)
throw new BadImageFormatException("Missing MD stream");
InitializeNonExistentHeaps();
}
/// <summary>
/// Creates empty heap objects if they're not present in the metadata
/// </summary>
protected void InitializeNonExistentHeaps() {
if (stringsStream == null)
stringsStream = new StringsStream();
if (usStream == null)
usStream = new USStream();
if (blobStream == null)
blobStream = new BlobStream();
if (guidStream == null)
guidStream = new GuidStream();
}
/// <summary>
/// Called by <see cref="Initialize()"/>
/// </summary>
protected abstract void InitializeInternal();
/// <inheritdoc/>
public virtual RidList GetTypeDefRidList() {
return new ContiguousRidList(1, tablesStream.TypeDefTable.Rows);
}
/// <inheritdoc/>
public virtual RidList GetExportedTypeRidList() {
return new ContiguousRidList(1, tablesStream.ExportedTypeTable.Rows);
}
/// <inheritdoc/>
public abstract RidList GetFieldRidList(uint typeDefRid);
/// <inheritdoc/>
public abstract RidList GetMethodRidList(uint typeDefRid);
/// <inheritdoc/>
public abstract RidList GetParamRidList(uint methodRid);
/// <inheritdoc/>
public abstract RidList GetEventRidList(uint eventMapRid);
/// <inheritdoc/>
public abstract RidList GetPropertyRidList(uint propertyMapRid);
/// <summary>
/// Binary searches the table for a <c>rid</c> whose key column at index
/// <paramref name="keyColIndex"/> is equal to <paramref name="key"/>.
/// </summary>
/// <param name="tableSource">Table to search</param>
/// <param name="keyColIndex">Key column index</param>
/// <param name="key">Key</param>
/// <returns>The <c>rid</c> of the found row, or 0 if none found</returns>
protected abstract uint BinarySearch(MDTable tableSource, int keyColIndex, uint key);
/// <summary>
/// Finds all rows owned by <paramref name="key"/> in table <paramref name="tableSource"/>
/// whose index is <paramref name="keyColIndex"/>
/// </summary>
/// <param name="tableSource">Table to search</param>
/// <param name="keyColIndex">Key column index</param>
/// <param name="key">Key</param>
/// <returns>A <see cref="RidList"/> instance</returns>
protected RidList FindAllRows(MDTable tableSource, int keyColIndex, uint key) {
uint startRid = BinarySearch(tableSource, keyColIndex, key);
if (tableSource == null || tableSource.IsInvalidRID(startRid))
return RidList.Empty;
uint endRid = startRid + 1;
for (; startRid > 1; startRid--) {
uint key2;
if (!tablesStream.ReadColumn(tableSource, startRid - 1, keyColIndex, out key2))
break; // Should never happen since startRid is valid
if (key != key2)
break;
}
for (; endRid <= tableSource.Rows; endRid++) {
uint key2;
if (!tablesStream.ReadColumn(tableSource, endRid, keyColIndex, out key2))
break; // Should never happen since endRid is valid
if (key != key2)
break;
}
return new ContiguousRidList(startRid, endRid - startRid);
}
/// <summary>
/// Finds all rows owned by <paramref name="key"/> in table <paramref name="tableSource"/>
/// whose index is <paramref name="keyColIndex"/>. Should be called if <paramref name="tableSource"/>
/// could be unsorted.
/// </summary>
/// <param name="tableSource">Table to search</param>
/// <param name="keyColIndex">Key column index</param>
/// <param name="key">Key</param>
/// <returns>A <see cref="RidList"/> instance</returns>
protected virtual RidList FindAllRowsUnsorted(MDTable tableSource, int keyColIndex, uint key) {
return FindAllRows(tableSource, keyColIndex, key);
}
/// <inheritdoc/>
public RidList GetInterfaceImplRidList(uint typeDefRid) {
var tbl = tablesStream.TypeDefTable;
if (tbl == null || tbl.IsInvalidRID(typeDefRid))
return RidList.Empty;
return FindAllRowsUnsorted(tablesStream.InterfaceImplTable, 0, typeDefRid);
}
/// <inheritdoc/>
public RidList GetGenericParamRidList(Table table, uint rid) {
var tbl = tablesStream.Get(table);
if (tbl == null || tbl.IsInvalidRID(rid))
return RidList.Empty;
uint codedToken;
if (!CodedToken.TypeOrMethodDef.Encode(new MDToken(table, rid), out codedToken))
return RidList.Empty;
// Sorted or not, the CLR only searches this table as if it were sorted.
return FindAllRows(tablesStream.GenericParamTable, 2, codedToken);
}
/// <inheritdoc/>
public RidList GetGenericParamConstraintRidList(uint genericParamRid) {
var tbl = tablesStream.GenericParamTable;
if (tbl == null || tbl.IsInvalidRID(genericParamRid))
return RidList.Empty;
return FindAllRowsUnsorted(tablesStream.GenericParamConstraintTable, 0, genericParamRid);
}
/// <inheritdoc/>
public RidList GetCustomAttributeRidList(Table table, uint rid) {
var tbl = tablesStream.Get(table);
if (tbl == null || tbl.IsInvalidRID(rid))
return RidList.Empty;
uint codedToken;
if (!CodedToken.HasCustomAttribute.Encode(new MDToken(table, rid), out codedToken))
return RidList.Empty;
return FindAllRowsUnsorted(tablesStream.CustomAttributeTable, 0, codedToken);
}
/// <inheritdoc/>
public RidList GetDeclSecurityRidList(Table table, uint rid) {
var tbl = tablesStream.Get(table);
if (tbl == null || tbl.IsInvalidRID(rid))
return RidList.Empty;
uint codedToken;
if (!CodedToken.HasDeclSecurity.Encode(new MDToken(table, rid), out codedToken))
return RidList.Empty;
return FindAllRowsUnsorted(tablesStream.DeclSecurityTable, 1, codedToken);
}
/// <inheritdoc/>
public RidList GetMethodSemanticsRidList(Table table, uint rid) {
var tbl = tablesStream.Get(table);
if (tbl == null || tbl.IsInvalidRID(rid))
return RidList.Empty;
uint codedToken;
if (!CodedToken.HasSemantic.Encode(new MDToken(table, rid), out codedToken))
return RidList.Empty;
return FindAllRowsUnsorted(tablesStream.MethodSemanticsTable, 2, codedToken);
}
/// <inheritdoc/>
public RidList GetMethodImplRidList(uint typeDefRid) {
var tbl = tablesStream.TypeDefTable;
if (tbl == null || tbl.IsInvalidRID(typeDefRid))
return RidList.Empty;
return FindAllRowsUnsorted(tablesStream.MethodImplTable, 0, typeDefRid);
}
/// <inheritdoc/>
public uint GetClassLayoutRid(uint typeDefRid) {
var tbl = tablesStream.TypeDefTable;
if (tbl == null || tbl.IsInvalidRID(typeDefRid))
return 0;
var list = FindAllRowsUnsorted(tablesStream.ClassLayoutTable, 2, typeDefRid);
return list.Length == 0 ? 0 : list[0];
}
/// <inheritdoc/>
public uint GetFieldLayoutRid(uint fieldRid) {
var tbl = tablesStream.FieldTable;
if (tbl == null || tbl.IsInvalidRID(fieldRid))
return 0;
var list = FindAllRowsUnsorted(tablesStream.FieldLayoutTable, 1, fieldRid);
return list.Length == 0 ? 0 : list[0];
}
/// <inheritdoc/>
public uint GetFieldMarshalRid(Table table, uint rid) {
var tbl = tablesStream.Get(table);
if (tbl == null || tbl.IsInvalidRID(rid))
return 0;
uint codedToken;
if (!CodedToken.HasFieldMarshal.Encode(new MDToken(table, rid), out codedToken))
return 0;
var list = FindAllRowsUnsorted(tablesStream.FieldMarshalTable, 0, codedToken);
return list.Length == 0 ? 0 : list[0];
}
/// <inheritdoc/>
public uint GetFieldRVARid(uint fieldRid) {
var tbl = tablesStream.FieldTable;
if (tbl == null || tbl.IsInvalidRID(fieldRid))
return 0;
var list = FindAllRowsUnsorted(tablesStream.FieldRVATable, 1, fieldRid);
return list.Length == 0 ? 0 : list[0];
}
/// <inheritdoc/>
public uint GetImplMapRid(Table table, uint rid) {
var tbl = tablesStream.Get(table);
if (tbl == null || tbl.IsInvalidRID(rid))
return 0;
uint codedToken;
if (!CodedToken.MemberForwarded.Encode(new MDToken(table, rid), out codedToken))
return 0;
var list = FindAllRowsUnsorted(tablesStream.ImplMapTable, 1, codedToken);
return list.Length == 0 ? 0 : list[0];
}
/// <inheritdoc/>
public uint GetNestedClassRid(uint typeDefRid) {
var tbl = tablesStream.TypeDefTable;
if (tbl == null || tbl.IsInvalidRID(typeDefRid))
return 0;
var list = FindAllRowsUnsorted(tablesStream.NestedClassTable, 0, typeDefRid);
return list.Length == 0 ? 0 : list[0];
}
/// <inheritdoc/>
public uint GetEventMapRid(uint typeDefRid) {
var tbl = tablesStream.TypeDefTable;
if (tbl == null || tbl.IsInvalidRID(typeDefRid))
return 0;
var list = FindAllRowsUnsorted(tablesStream.EventMapTable, 0, typeDefRid);
return list.Length == 0 ? 0 : list[0];
}
/// <inheritdoc/>
public uint GetPropertyMapRid(uint typeDefRid) {
var tbl = tablesStream.TypeDefTable;
if (tbl == null || tbl.IsInvalidRID(typeDefRid))
return 0;
var list = FindAllRowsUnsorted(tablesStream.PropertyMapTable, 0, typeDefRid);
return list.Length == 0 ? 0 : list[0];
}
/// <inheritdoc/>
public uint GetConstantRid(Table table, uint rid) {
var tbl = tablesStream.Get(table);
if (tbl == null || tbl.IsInvalidRID(rid))
return 0;
uint codedToken;
if (!CodedToken.HasConstant.Encode(new MDToken(table, rid), out codedToken))
return 0;
var list = FindAllRowsUnsorted(tablesStream.ConstantTable, 1, codedToken);
return list.Length == 0 ? 0 : list[0];
}
/// <inheritdoc/>
public uint GetOwnerTypeOfField(uint fieldRid) {
if (fieldRidToTypeDefRid == null)
InitializeInverseFieldOwnerRidList();
uint index = fieldRid - 1;
if (index >= fieldRidToTypeDefRid.LongLength)
return 0;
return fieldRidToTypeDefRid[index];
}
void InitializeInverseFieldOwnerRidList() {
if (fieldRidToTypeDefRid != null)
return;
var newFieldRidToTypeDefRid = new uint[tablesStream.FieldTable.Rows];
var ownerList = GetTypeDefRidList();
for (uint i = 0; i < ownerList.Length; i++) {
var ownerRid = ownerList[i];
var fieldList = GetFieldRidList(ownerRid);
for (uint j = 0; j < fieldList.Length; j++) {
uint ridIndex = fieldList[j] - 1;
if (newFieldRidToTypeDefRid[ridIndex] != 0)
continue;
newFieldRidToTypeDefRid[ridIndex] = ownerRid;
}
}
Interlocked.CompareExchange(ref fieldRidToTypeDefRid, newFieldRidToTypeDefRid, null);
}
/// <inheritdoc/>
public uint GetOwnerTypeOfMethod(uint methodRid) {
if (methodRidToTypeDefRid == null)
InitializeInverseMethodOwnerRidList();
uint index = methodRid - 1;
if (index >= methodRidToTypeDefRid.LongLength)
return 0;
return methodRidToTypeDefRid[index];
}
void InitializeInverseMethodOwnerRidList() {
if (methodRidToTypeDefRid != null)
return;
var newMethodRidToTypeDefRid = new uint[tablesStream.MethodTable.Rows];
var ownerList = GetTypeDefRidList();
for (uint i = 0; i < ownerList.Length; i++) {
var ownerRid = ownerList[i];
var methodList = GetMethodRidList(ownerRid);
for (uint j = 0; j < methodList.Length; j++) {
uint ridIndex = methodList[j] - 1;
if (newMethodRidToTypeDefRid[ridIndex] != 0)
continue;
newMethodRidToTypeDefRid[ridIndex] = ownerRid;
}
}
Interlocked.CompareExchange(ref methodRidToTypeDefRid, newMethodRidToTypeDefRid, null);
}
/// <inheritdoc/>
public uint GetOwnerTypeOfEvent(uint eventRid) {
if (eventRidToTypeDefRid == null)
InitializeInverseEventOwnerRidList();
uint index = eventRid - 1;
if (index >= eventRidToTypeDefRid.LongLength)
return 0;
return eventRidToTypeDefRid[index];
}
void InitializeInverseEventOwnerRidList() {
if (eventRidToTypeDefRid != null)
return;
var newEventRidToTypeDefRid = new uint[tablesStream.EventTable.Rows];
var ownerList = GetTypeDefRidList();
for (uint i = 0; i < ownerList.Length; i++) {
var ownerRid = ownerList[i];
var eventList = GetEventRidList(GetEventMapRid(ownerRid));
for (uint j = 0; j < eventList.Length; j++) {
uint ridIndex = eventList[j] - 1;
if (newEventRidToTypeDefRid[ridIndex] != 0)
continue;
newEventRidToTypeDefRid[ridIndex] = ownerRid;
}
}
Interlocked.CompareExchange(ref eventRidToTypeDefRid, newEventRidToTypeDefRid, null);
}
/// <inheritdoc/>
public uint GetOwnerTypeOfProperty(uint propertyRid) {
if (propertyRidToTypeDefRid == null)
InitializeInversePropertyOwnerRidList();
uint index = propertyRid - 1;
if (index >= propertyRidToTypeDefRid.LongLength)
return 0;
return propertyRidToTypeDefRid[index];
}
void InitializeInversePropertyOwnerRidList() {
if (propertyRidToTypeDefRid != null)
return;
var newPropertyRidToTypeDefRid = new uint[tablesStream.PropertyTable.Rows];
var ownerList = GetTypeDefRidList();
for (uint i = 0; i < ownerList.Length; i++) {
var ownerRid = ownerList[i];
var propertyList = GetPropertyRidList(GetPropertyMapRid(ownerRid));
for (uint j = 0; j < propertyList.Length; j++) {
uint ridIndex = propertyList[j] - 1;
if (newPropertyRidToTypeDefRid[ridIndex] != 0)
continue;
newPropertyRidToTypeDefRid[ridIndex] = ownerRid;
}
}
Interlocked.CompareExchange(ref propertyRidToTypeDefRid, newPropertyRidToTypeDefRid, null);
}
/// <inheritdoc/>
public uint GetOwnerOfGenericParam(uint gpRid) {
// Don't use GenericParam.Owner column. If the GP table is sorted, it's
// possible to have two blocks of GPs with the same owner. Only one of the
// blocks is the "real" generic params for the owner. Of course, rarely
// if ever will this occur, but could happen if some obfuscator has
// added it.
if (gpRidToOwnerRid == null)
InitializeInverseGenericParamOwnerRidList();
uint index = gpRid - 1;
if (index >= gpRidToOwnerRid.LongLength)
return 0;
return gpRidToOwnerRid[index];
}
void InitializeInverseGenericParamOwnerRidList() {
if (gpRidToOwnerRid != null)
return;
var gpTable = tablesStream.GenericParamTable;
var newGpRidToOwnerRid = new uint[gpTable.Rows];
// Find all owners by reading the GenericParam.Owner column
var ownerCol = gpTable.TableInfo.Columns[2];
var ownersDict = new Dictionary<uint, bool>();
for (uint rid = 1; rid <= gpTable.Rows; rid++) {
uint owner;
if (!tablesStream.ReadColumn(gpTable, rid, ownerCol, out owner))
continue;
ownersDict[owner] = true;
}
// Now that we have the owners, find all the generic params they own. An obfuscated
// module could have 2+ owners pointing to the same generic param row.
var owners = new List<uint>(ownersDict.Keys);
owners.Sort();
for (int i = 0; i < owners.Count; i++) {
uint ownerToken;
if (!CodedToken.TypeOrMethodDef.Decode(owners[i], out ownerToken))
continue;
var ridList = GetGenericParamRidList(MDToken.ToTable(ownerToken), MDToken.ToRID(ownerToken));
for (uint j = 0; j < ridList.Length; j++) {
uint ridIndex = ridList[j] - 1;
if (newGpRidToOwnerRid[ridIndex] != 0)
continue;
newGpRidToOwnerRid[ridIndex] = owners[i];
}
}
Interlocked.CompareExchange(ref gpRidToOwnerRid, newGpRidToOwnerRid, null);
}
/// <inheritdoc/>
public uint GetOwnerOfGenericParamConstraint(uint gpcRid) {
// Don't use GenericParamConstraint.Owner column for the same reason
// as described in GetOwnerOfGenericParam().
if (gpcRidToOwnerRid == null)
InitializeInverseGenericParamConstraintOwnerRidList();
uint index = gpcRid - 1;
if (index >= gpcRidToOwnerRid.LongLength)
return 0;
return gpcRidToOwnerRid[index];
}
void InitializeInverseGenericParamConstraintOwnerRidList() {
if (gpcRidToOwnerRid != null)
return;
var gpcTable = tablesStream.GenericParamConstraintTable;
var newGpcRidToOwnerRid = new uint[gpcTable.Rows];
var ownerCol = gpcTable.TableInfo.Columns[0];
var ownersDict = new Dictionary<uint, bool>();
for (uint rid = 1; rid <= gpcTable.Rows; rid++) {
uint owner;
if (!tablesStream.ReadColumn(gpcTable, rid, ownerCol, out owner))
continue;
ownersDict[owner] = true;
}
var owners = new List<uint>(ownersDict.Keys);
owners.Sort();
for (int i = 0; i < owners.Count; i++) {
uint ownerToken = owners[i];
var ridList = GetGenericParamConstraintRidList(ownerToken);
for (uint j = 0; j < ridList.Length; j++) {
uint ridIndex = ridList[j] - 1;
if (newGpcRidToOwnerRid[ridIndex] != 0)
continue;
newGpcRidToOwnerRid[ridIndex] = ownerToken;
}
}
Interlocked.CompareExchange(ref gpcRidToOwnerRid, newGpcRidToOwnerRid, null);
}
/// <inheritdoc/>
public uint GetOwnerOfParam(uint paramRid) {
if (paramRidToOwnerRid == null)
InitializeInverseParamOwnerRidList();
uint index = paramRid - 1;
if (index >= paramRidToOwnerRid.LongLength)
return 0;
return paramRidToOwnerRid[index];
}
void InitializeInverseParamOwnerRidList() {
if (paramRidToOwnerRid != null)
return;
var newParamRidToOwnerRid = new uint[tablesStream.ParamTable.Rows];
var table = tablesStream.MethodTable;
for (uint rid = 1; rid <= table.Rows; rid++) {
var ridList = GetParamRidList(rid);
for (uint j = 0; j < ridList.Length; j++) {
uint ridIndex = ridList[j] - 1;
if (newParamRidToOwnerRid[ridIndex] != 0)
continue;
newParamRidToOwnerRid[ridIndex] = rid;
}
}
Interlocked.CompareExchange(ref paramRidToOwnerRid, newParamRidToOwnerRid, null);
}
/// <inheritdoc/>
public RidList GetNestedClassRidList(uint typeDefRid) {
if (typeDefRidToNestedClasses == null)
InitializeNestedClassesDictionary();
RandomRidList ridList;
if (typeDefRidToNestedClasses.TryGetValue(typeDefRid, out ridList))
return ridList;
return RidList.Empty;
}
void InitializeNestedClassesDictionary() {
var table = tablesStream.NestedClassTable;
var destTable = tablesStream.TypeDefTable;
Dictionary<uint, bool> validTypeDefRids = null;
var typeDefRidList = GetTypeDefRidList();
if (typeDefRidList.Length != destTable.Rows) {
validTypeDefRids = new Dictionary<uint, bool>((int)typeDefRidList.Length);
for (uint i = 0; i < typeDefRidList.Length; i++)
validTypeDefRids[typeDefRidList[i]] = true;
}
var nestedRidsDict = new Dictionary<uint, bool>((int)table.Rows);
var nestedRids = new List<uint>((int)table.Rows); // Need it so we add the rids in correct order
for (uint rid = 1; rid <= table.Rows; rid++) {
if (validTypeDefRids != null && !validTypeDefRids.ContainsKey(rid))
continue;
var row = tablesStream.ReadNestedClassRow(rid);
if (row == null)
continue; // Should never happen since rid is valid
if (!destTable.IsValidRID(row.NestedClass) || !destTable.IsValidRID(row.EnclosingClass))
continue;
if (nestedRidsDict.ContainsKey(row.NestedClass))
continue;
nestedRidsDict[row.NestedClass] = true;
nestedRids.Add(row.NestedClass);
}
var newTypeDefRidToNestedClasses = new Dictionary<uint, RandomRidList>();
foreach (var nestedRid in nestedRids) {
var row = tablesStream.ReadNestedClassRow(GetNestedClassRid(nestedRid));
if (row == null)
continue;
RandomRidList ridList;
if (!newTypeDefRidToNestedClasses.TryGetValue(row.EnclosingClass, out ridList))
newTypeDefRidToNestedClasses[row.EnclosingClass] = ridList = new RandomRidList();
ridList.Add(nestedRid);
}
var newNonNestedTypes = new RandomRidList((int)(destTable.Rows - nestedRidsDict.Count));
for (uint rid = 1; rid <= destTable.Rows; rid++) {
if (validTypeDefRids != null && !validTypeDefRids.ContainsKey(rid))
continue;
if (nestedRidsDict.ContainsKey(rid))
continue;
newNonNestedTypes.Add(rid);
}
Interlocked.CompareExchange(ref nonNestedTypes, newNonNestedTypes, null);
// Initialize this one last since it's tested by the callers of this method
Interlocked.CompareExchange(ref typeDefRidToNestedClasses, newTypeDefRidToNestedClasses, null);
}
public RidList GetNonNestedClassRidList() {
// Check typeDefRidToNestedClasses and not nonNestedTypes since
// InitializeNestedClassesDictionary() writes to typeDefRidToNestedClasses last.
if (typeDefRidToNestedClasses == null)
InitializeNestedClassesDictionary();
return nonNestedTypes;
}
/// <inheritdoc/>
public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Dispose method
/// </summary>
/// <param name="disposing"><c>true</c> if called by <see cref="Dispose()"/></param>
protected virtual void Dispose(bool disposing) {
if (!disposing)
return;
Dispose(peImage);
Dispose(stringsStream);
Dispose(usStream);
Dispose(blobStream);
Dispose(guidStream);
Dispose(tablesStream);
var as2 = allStreams;
if (as2 != null) {
foreach (var stream in as2.GetSafeEnumerable())
Dispose(stream);
}
peImage = null;
cor20Header = null;
mdHeader = null;
stringsStream = null;
usStream = null;
blobStream = null;
guidStream = null;
tablesStream = null;
allStreams = null;
fieldRidToTypeDefRid = null;
methodRidToTypeDefRid = null;
typeDefRidToNestedClasses = null;
}
static void Dispose(IDisposable id) {
if (id != null)
id.Dispose();
}
}
}
| gpl-3.0 |
alemart/mestrado | html5/Cesium-1.6/Specs/Core/createGuidSpec.js | 1095 | /*global defineSuite*/
defineSuite([
'Core/createGuid'
], function(
createGuid) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
it('creates GUIDs', function() {
var isGuidRegex = /^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$/;
//Create three GUIDs
var guid1 = createGuid();
var guid2 = createGuid();
var guid3 = createGuid();
//Make sure they are all unique
expect(guid1).toNotEqual(guid2);
expect(guid1).toNotEqual(guid3);
expect(guid2).toNotEqual(guid3);
//Make sure they are all properly formatted
expect(isGuidRegex.test(guid1)).toEqual(true);
expect(guid1.length).toEqual(36);
expect(isGuidRegex.test(guid2)).toEqual(true);
expect(guid2.length).toEqual(36);
expect(isGuidRegex.test(guid3)).toEqual(true);
expect(guid3.length).toEqual(36);
});
});
| gpl-3.0 |
v4nz666/7drl2016 | py2exe-setup.py | 1728 | from distutils.core import setup
import py2exe
import os
import sys
sys.argv.append('py2exe')
# The filename of the script you use to start your program.
target_file = 'main.py'
# The root directory containing your assets, libraries, etc.
assets_dir = '.\\'
# Filetypes not to be included in the above.
excluded_file_types = ['py','pyc','project','pydevproject', 'bat']
def get_data_files(base_dir, target_dir, list=[]):
"""
" * get_data_files
" * base_dir: The full path to the current working directory.
" * target_dir: The directory of assets to include.
" * list: Current list of assets. Used for recursion.
" *
" * returns: A list of relative and full path pairs. This is
" * specified by distutils.
"""
for file in os.listdir(base_dir + target_dir):
full_path = base_dir + target_dir + file
if os.path.isdir(full_path):
get_data_files(base_dir, target_dir + file + '\\', list)
elif os.path.isfile(full_path):
if (len(file.split('.')) == 2 and file.split('.')[1] not in excluded_file_types):
list.append((target_dir, [full_path]))
return list
# The directory of assets to include.
my_files = get_data_files(os.path.dirname(os.path.realpath(__file__)) + '\\', assets_dir)
# Build a dictionary of the options we want.
opts = { 'py2exe': {
'ascii':'True',
'excludes':['_ssl','_hashlib', 'numpy'],
#'includes' : ['anydbm', 'dbhash'],
'bundle_files':'1',
'compressed':'True',
'optimize': 0,
'dll_excludes':['w9xpopen.exe', 'build.bat']
}}
# Run the setup utility.
setup(console=[target_file], data_files=my_files, zipfile=None, options=opts);
| gpl-3.0 |
exmex/DCNC | src/GameServer/Network/Handlers/Join/PlayerInfoReq.cs | 6734 | using System.Collections.Generic;
using System.Linq;
using Shared.Network;
using Shared.Network.GameServer;
using Shared.Objects;
using Shared.Util;
namespace GameServer.Network.Handlers.Join
{
public class PlayerInfoReq
{
[Packet(Packets.CmdPlayerInfoReq)]
public static void Handle(Packet packet)
{
/*
amPerl: No known scenarios where the requested info count is > 1
*/
var pinfoReq = new PlayerInfoReqPacket(packet);
if (pinfoReq.VehicleSerials.Length != 1)
{
Log.Error($"Sent PlayerInfoReq with {pinfoReq.VehicleSerials.Length} serials!");
return;
}
var client = GameServer.Instance.Server.GetClient(pinfoReq.VehicleSerials[0]);
if (client?.User?.ActiveCharacter == null) // Make sure we have loaded a char
{
Log.Error("firstClient.User.ActiveCharacter == null");
#if !DEBUG
packet.Sender.KillConnection("Character for CmdPlayerInfoReq not found");
#else
packet.Sender.SendError("Character not loaded!");
packet.Sender.Send(new PlayerInfoOldAnswer().CreatePacket());
#endif
return;
}
var ack = new PlayerInfoOldAnswer
{
PlayerInfo = new XiPlayerInfo(client.User.VehicleSerial, client.User.ActiveCharacter)
};
packet.Sender.Send(ack.CreatePacket());
/*
var clients = (List<Client>)GameServer.Instance.Server.GetClients(pinfoReq.VehicleSerials);
var ack = new PlayerInfoOldAnswer();
if (clients == null || clients.Count == 0)
{
Log.Error($"PlayerInfoReq: Requested serial {pinfoReq.VehicleSerials[0]} no client was found.");
#if !DEBUG
packet.Sender.KillConnection("Character for CmdGameCharInfo not found");
#else
packet.Sender.SendError("Vehicle for serial not found");
packet.Sender.Send(ack.CreatePacket());
#endif
return;
}
var firstClient = clients[0];
if (firstClient.User.ActiveCharacter == null) // Make sure we have loaded a char for first client
{
Log.Error("firstClient.User.ActiveCharacter == null");
#if !DEBUG
packet.Sender.KillConnection("Character for CmdPlayerInfoReq not found");
#else
packet.Sender.SendError("Character not loaded!");
packet.Sender.Send(ack.CreatePacket());
#endif
return;
}
ack.PlayerInfo = new XiPlayerInfo()
{
CharacterName = firstClient.User.ActiveCharacter.Name,
Serial = (ushort)firstClient.User.VehicleSerial,
Age = 0
};
clients.RemoveAt(0); // Make sure we don't have a first player info anymore
ack.PlayerInfos = new XiPlayerInfo[clients.Count];
for (var i = 0; i < clients.Count; i++)
{
var client = clients[i];
if (client.User.ActiveCharacter == null) // Make sure we have loaded a char
{
Log.Error("client.User.ActiveCharacter == null");
#if !DEBUG
packet.Sender.KillConnection("Character for CmdPlayerInfoReq not found");
return;
#else
packet.Sender.SendError("Character not loaded!");
ack.PlayerInfos[i] = ack.PlayerInfo = new XiPlayerInfo()
{
CharacterName = "InvalidChar",
Serial = (ushort)client.User.VehicleSerial,
Age = 0
};
continue;
#endif
}
ack.PlayerInfos[i] = ack.PlayerInfo = new XiPlayerInfo()
{
CharacterName = client.User.ActiveCharacter.Name,
Serial = (ushort)client.User.VehicleSerial,
Age = 0
};
}*/
/* Send only one:
var serial = packet.Reader.ReadUInt16(); // amPerl: No known scenarios where the requested info count is > 1
var res = new Packet(Packets.PlayerInfoOldAck);
var ack = new PlayerInfoOldAnswer();
var client = GameServer.Instance.Server.GetClient(serial);
if (client == null)
{
Log.Error($"No client with vehicle serial {serial} was found.");
packet.Sender.Send(ack.CreatePacket());
return;
}
if (client.User.ActiveCharacter == null)
{
Log.Error("Clients character info was invalid.");
packet.Sender.Send(ack.CreatePacket());
return;
}
var character = client.User.ActiveCharacter;
ack.PlayerInfo = new XiPlayerInfo()
{
CharacterName = character.Name,
Serial = (ushort)client.User.VehicleSerial,
Age = 0
};
packet.Sender.Send(ack.CreatePacket());
*/
// Old leaked Server sends also BS_PktStickerInfoRes
}
/* Pulled from Rice:
[RicePacket(801, RiceServer.ServerType.Game)]
public static void PlayerInfoReq(RicePacket packet)
{
var reqCnt = packet.Reader.ReadUInt32();
var serial = packet.Reader.ReadUInt16(); // No known scenarios where the requested info count is > 1
// Followed by the session age of the player we are requesting info for. nplutowhy.avi
foreach(var p in RiceServer.GetPlayers())
{
if(p.ActiveCharacter != null && p.ActiveCharacter.CarSerial == serial)
{
var character = p.ActiveCharacter;
var playerInfo = new Structures.PlayerInfo()
{
Name = character.Name,
Serial = character.CarSerial,
Age = 0
};
var res = new RicePacket(802);
res.Writer.Write(1);
res.Writer.Write(playerInfo);
packet.Sender.Send(res);
break;
}
}
}
*/
}
} | gpl-3.0 |
DMCsys/smartalkaudio | oss-survey/EqualizerAPO-src-1.2/Editor/AnalysisPlotView.cpp | 2524 | /*
This file is part of EqualizerAPO, a system-wide equalizer.
Copyright (C) 2015 Jonas Thedering
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <algorithm>
#include "helpers/GainIterator.h"
#include "AnalysisPlotScene.h"
#include "AnalysisPlotView.h"
using namespace std;
AnalysisPlotView::AnalysisPlotView(QWidget* parent)
: FrequencyPlotView(parent)
{
}
void AnalysisPlotView::drawBackground(QPainter* painter, const QRectF& rect)
{
FrequencyPlotView::drawBackground(painter, rect);
painter->setRenderHint(QPainter::Antialiasing, true);
AnalysisPlotScene* s = qobject_cast<AnalysisPlotScene*>(scene());
std::vector<FilterNode>& nodes = s->getNodes();
GainIterator gainIterator(nodes);
QPainterPath path;
bool first = true;
double lastDb = -1000;
for (int x = rect.left() - 1; x <= rect.right() + 1; x++)
{
double hz = s->xToHz(x);
double db = gainIterator.gainAt(hz);
double y = s->dbToY(db);
if (y == -1)
{
if (db < 0)
y = sceneRect().bottom() + 1;
else
y = sceneRect().top() - 1;
}
if (db == lastDb)
y = floor(y) + 0.5;
lastDb = db;
if (first)
{
path.moveTo(x, y);
first = false;
}
else
{
path.lineTo(x, y);
}
}
path.lineTo(rect.right() + 1, rect.bottom() + 1);
path.lineTo(rect.left() - 1, rect.bottom() + 1);
double thresholdY = s->dbToY(0);
if (rect.top() < thresholdY)
{
QPainterPath rectPath;
rectPath.addRect(rect.left(), rect.top(), rect.width(), min(thresholdY - rect.top(), rect.height()));
QPainterPath clippingPath = path.intersected(rectPath);
painter->setPen(Qt::NoPen);
painter->setBrush(Qt::red);
painter->drawPath(clippingPath);
painter->setBrush(Qt::NoBrush);
}
painter->setPen(Qt::black);
painter->drawPath(path);
}
| gpl-3.0 |
Drakuwa/aTrip2Europe | src/com/app/trip/Macedonia.java | 2101 | package com.app.trip;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class Macedonia extends Activity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.country_info);
TextView tv1 = (TextView)findViewById(R.id.country_name);
tv1.setText(R.string.mac_name);
TextView tv2 = (TextView)findViewById(R.id.text_1);
tv2.setText(R.string.mac_1);
TextView tv3 = (TextView)findViewById(R.id.text_2);
tv3.setText(R.string.mac_2);
ImageView iv1 = (ImageView)findViewById(R.id.country_flag);
iv1.setImageResource(R.drawable.flag_of_macedonia);
ImageView iv2 = (ImageView)findViewById(R.id.country_pic);
iv2.setImageResource(R.drawable.mac);
Button holidays = (Button)findViewById(R.id.holidays);
holidays.setOnClickListener(new OnClickListener() {
public void onClick(View v2) {
setContentView(R.layout.mac_holidays);
Button back2 = (Button)findViewById(R.id.mac_back);
back2.setOnClickListener(new OnClickListener() {
public void onClick(View v4) {
finish();
Intent myIntent = new Intent();
myIntent.setClassName("com.app.trip", "com.app.trip.Macedonia");
startActivity(myIntent);
}
});
}
});
Button back = (Button)findViewById(R.id.back_button);
back.setOnClickListener(new OnClickListener() {
public void onClick(View v3) {
finish();
}
});
}
}
| gpl-3.0 |
Nehmulos/ascension-switch | editor/pub/src/Selection.js | 3245 | function Selection(x,y) {
this.x = x || 0;
this.y = y || 0;
this.w = 0;
this.h = 0;
}
Selection.prototype.serialize = function() {
return {
x: this.x,
y: this.y,
w: this.w,
h: this.h
};
}
Selection.prototype.resetore = function(serialized) {
this.x = serialized.x;
this.y = serialized.y;
this.w = serialized.w;
this.h = serialized.h;
}
Selection.prototype.draw = function(context, color) {
color = color || "rgba(200, 170, 20, 0.8)";
context.fillStyle = color;
context.fillRect(this.x, this.y, this.w, this.h);
}
Selection.prototype.isInside = function(x, y) {
return x >= this.x && x <= (this.x + this.w) &&
y >= this.y && y <= (this.y + this.h);
}
Selection.prototype.validate = function(context) {
if (this.w < 0) {
this.x += this.w;
this.w = -this.w;
}
if (this.h < 0) {
this.y += this.h;
this.h = -this.h;
}
return this.w > 0 && this.h > 0;
}
Selection.prototype.snapToAlpha = function(context) {
if (!this.validate()) {
return;
}
var imgd = context.getImageData(this.x, this.y, this.w, this.h);
var pix = imgd.data;
var offsets = [0,0,0,0];
// x offset
var pos = 0;
for (var x = 0; x < this.w; ++x) {
var columnHasAlpha = false;
for (var y = 0; y < this.h; ++y) {
pos = ((y*this.w) +x) * 4;
if (pix[pos+3] > 0) {
columnHasAlpha = true;
}
}
if (!columnHasAlpha) {
offsets[0] += 1;
//console.log("shrink x");
} else {
break;
}
}
// y offset
pos = 0;
for (var y = 0; y < this.h; ++y) {
var rowHasAlpha = false;
for (var x = 0; x < this.w; ++x) {
if (pix[pos+3] > 0) {
rowHasAlpha = true;
}
pos += 4;
}
if (!rowHasAlpha) {
offsets[1] += 1;
//console.log("shrink y");
} else {
break;
}
}
// w offset
pos = 0;
for (var x = this.w-1; x >= 0; --x) {
var columnHasAlpha = false;
for (var y = this.h-1; y >= 0; --y) {
pos = ((y*this.w) +x) * 4;
if (pix[pos+3] > 0) {
columnHasAlpha = true;
}
}
if (!columnHasAlpha) {
offsets[2] += 1;
//console.log("shrink w");
} else {
break;
}
}
// h offset
pos = pix.length -4;
for (var y = this.h-1; y >= 0; --y) {
var rowHasAlpha = false;
for (var x = this.w-1; x >= 0; --x) {
if (pix[pos+3] > 0) {
rowHasAlpha = true;
}
pos -= 4;
}
if (!rowHasAlpha) {
offsets[3] += 1;
//console.log("shrink h");
} else {
break;
}
}
//console.log(offsets);
this.x += offsets[0];
this.y += offsets[1];
this.w -= offsets[2] + offsets[0];
this.h -= offsets[3] + offsets[1];
}
| gpl-3.0 |
formtools/module-pages | lang/en_us.php | 2952 | <?php
/*
Form Tools - Module Language File
---------------------------------
File created: Oct 24th, 2:46 AM
If you would like to help translate this module, please visit:
http://www.formtools.org/translations/
*/
$L = array();
// required
$L["module_name"] = "Pages";
$L["module_description"] = "This module lets you define your own custom pages to link to from within the Form Tools UI. This lets you to add help pages, client splash pages or any other custom information.";
// custom
$L["word_help"] = "Help";
$L["word_page"] = "Page";
$L["word_settings"] = "Settings";
$L["word_pages"] = "Pages";
$L["word_about"] = "About";
$L["word_help"] = "Help";
$L["word_smarty"] = "Smarty";
$L["word_php"] = "PHP";
$L["phrase_list_pages"] = "List Pages";
$L["phrase_page_heading"] = "Page Heading";
$L["phrase_page_content"] = "Page Content";
$L["phrase_add_page"] = "Add Page";
$L["phrase_edit_page"] = "Edit Page";
$L["phrase_back_to_pages"] = "Back to Pages";
$L["phrase_page_name"] = "Page Name";
$L["phrase_add_new_page"] = "add a new page";
$L["phrase_change_your_settings"] = "change your settings";
$L["phrase_display_custom_pages"] = "display all of your custom pages";
$L["phrase_view_page"] = "View Page";
$L["phrase_pages_module"] = "Pages module";
$L["confirm_delete_page"] = "Are you sure you want to delete this page?";
$L["text_page_name_desc"] = "This value is used internally to help you identify the page and as the menu item label.";
$L["text_intro_para_1"] = "The Pages module lets you to customize the Form Tools user interface by adding your own pages containing whatever information you or your clients need. This can be helpful if you would like to add a splash page, links page or other such information.";
$L["text_intro_para_2"] = "After creating your page(s), go to the <a href=\"{\$url}\">Menus page</a> in the settings section to assign the page to a menu for yourself or your clients.";
$L["text_help_link"] = "For help on how to use this module, please see the <a href=\"http://modules.formtools.org/pages/\">module help documentation</a>.";
$L["notify_settings_updated"] = "Your settings have been updated.";
$L["notify_no_pages"] = "Currently, you don't have any pages in the database. Click the button below to add a new page.";
$L["notify_delete_page"] = "The page has been deleted.";
$L["notify_problem_installing"] = "There following error occurred when trying to create the database tables for this module: <b>{\$error}</b>";
$L["notify_module_uninstalled"] = "The Pages module has been uninstalled. If any user account (admin or client) was using a Page in their menu, it has been removed.";
$L["notify_no_permissions"] = "Sorry, you do not have permissions to see this page.";
$L["notify_page_updated"] = "The page has been updated.";
$L["notify_page_not_added"] = "The page could not be added.";
$L["notify_page_added"] = "The page has been added."; | gpl-3.0 |
tahg/CraftPail | src/main/java/net/minecraft/server/NetLoginHandler.java | 4788 | package net.minecraft.server;
import java.net.Socket;
import java.util.Random;
import java.util.logging.Logger;
public class NetLoginHandler extends NetHandler {
public static Logger a = Logger.getLogger("Minecraft");
private static Random d = new Random();
public NetworkManager networkManager;
public boolean c = false;
private MinecraftServer server;
private int f = 0;
private String g = null;
private Packet1Login h = null;
private String i = "";
public NetLoginHandler(MinecraftServer minecraftserver, Socket socket, String s) {
this.server = minecraftserver;
this.networkManager = new NetworkManager(socket, s, this);
this.networkManager.f = 0;
}
// CraftBukkit start
public Socket getSocket() {
return networkManager.socket;
}
// CraftBukkit end
public void a() {
if (this.h != null) {
this.b(this.h);
this.h = null;
}
if (this.f++ == 600) {
this.disconnect("Took too long to log in");
} else {
this.networkManager.b();
}
}
public void disconnect(String s) {
try {
a.info("Disconnecting " + this.b() + ": " + s);
this.networkManager.a((Packet) (new Packet255KickDisconnect(s)));
this.networkManager.d();
this.c = true;
} catch (Exception exception) {
exception.printStackTrace();
}
}
public void a(Packet2Handshake packet2handshake) {
if (this.server.onlineMode) {
this.i = Long.toHexString(d.nextLong());
this.networkManager.a((Packet) (new Packet2Handshake(this.i)));
} else {
this.networkManager.a((Packet) (new Packet2Handshake("-")));
}
}
public void a(Packet1Login packet1login) {
this.g = packet1login.name;
if (packet1login.a != 13) {
if (packet1login.a > 13) {
this.disconnect("Outdated server!");
} else {
this.disconnect("Outdated client!");
}
} else {
if (!this.server.onlineMode) {
this.b(packet1login);
} else {
(new ThreadLoginVerifier(this, packet1login, this.server.server)).start(); // CraftBukkit
}
}
}
public void b(Packet1Login packet1login) {
EntityPlayer entityplayer = this.server.serverConfigurationManager.a(this, packet1login.name);
if (entityplayer != null) {
this.server.serverConfigurationManager.b(entityplayer);
entityplayer.a((World) this.server.a(entityplayer.dimension));
a.info(this.b() + " logged in with entity id " + entityplayer.id + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
WorldServer worldserver = this.server.a(entityplayer.dimension);
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
NetServerHandler netserverhandler = new NetServerHandler(this.server, this.networkManager, entityplayer);
netserverhandler.sendPacket(new Packet1Login("", entityplayer.id, worldserver.getSeed(), (byte) worldserver.worldProvider.dimension));
netserverhandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
this.server.serverConfigurationManager.a(entityplayer, worldserver);
// this.server.serverConfigurationManager.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - message moved to join event
this.server.serverConfigurationManager.c(entityplayer);
netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.server.networkListenThread.a(netserverhandler);
netserverhandler.sendPacket(new Packet4UpdateTime(worldserver.getTime()));
entityplayer.syncInventory();
}
this.c = true;
}
public void a(String s, Object[] aobject) {
a.info(this.b() + " lost connection");
this.c = true;
}
public void a(Packet packet) {
this.disconnect("Protocol error");
}
public String b() {
return this.g != null ? this.g + " [" + this.networkManager.getSocketAddress().toString() + "]" : this.networkManager.getSocketAddress().toString();
}
public boolean c() {
return true;
}
static String a(NetLoginHandler netloginhandler) {
return netloginhandler.i;
}
static Packet1Login a(NetLoginHandler netloginhandler, Packet1Login packet1login) {
return netloginhandler.h = packet1login;
}
}
| gpl-3.0 |
cloudsploit/scans | plugins/google/storage/bucketRetentionPolicy.spec.js | 7519 | const expect = require('chai').expect;
var bucketRetentionPolicy = require('./bucketRetentionPolicy');
var failDate = new Date();
failDate.setMonth(failDate.getMonth() - 1);
const bucket = [
{
'kind': 'storage#bucket',
'selfLink': 'https://www.googleapis.com/storage/v1/b/bucket-1',
'id': 'bucket-1',
'name': 'bucket-1',
'projectNumber': '768447683925',
'metageneration': '1',
'location': 'US-EAST1',
'storageClass': 'STANDARD',
'etag': 'CAE=',
'defaultEventBasedHold': false,
'retentionPolicy': {
'retentionPeriod': '864000',
'effectiveTime': new Date(),
'isLocked': true
},
'timeCreated': '2021-02-13T05:44:29.181Z',
'updated': '2021-02-13T05:44:29.181Z',
'locationType': 'region',
'satisfiesPZS': false
},
{
'kind': 'storage#bucket',
'selfLink': 'https://www.googleapis.com/storage/v1/b/bucket-2',
'id': 'bucket-2',
'name': 'bucket-2',
'projectNumber': '768447683925',
'metageneration': '1',
'location': 'US-EAST1',
'storageClass': 'STANDARD',
'etag': 'CAE=',
'defaultEventBasedHold': false,
'retentionPolicy': {
'retentionPeriod': '86400',
'effectiveTime': '2021-02-10T05:53:02.998Z',
'isLocked': false
},
'timeCreated': '2021-02-13T05:44:29.181Z',
'updated': '2021-02-13T05:44:29.181Z',
'locationType': 'region',
'satisfiesPZS': false
},
{
'kind': 'storage#bucket',
'selfLink': 'https://www.googleapis.com/storage/v1/b/bucket-3',
'id': 'bucket-3',
'name': 'bucket-3',
'projectNumber': '768447683925',
'metageneration': '1',
'location': 'US-EAST1',
'storageClass': 'STANDARD',
'etag': 'CAE=',
'defaultEventBasedHold': false,
'retentionPolicy': {
'retentionPeriod': '864000',
'effectiveTime': new Date(),
'isLocked': false
},
'timeCreated': '2021-02-13T05:44:29.181Z',
'updated': '2021-02-13T05:44:29.181Z',
'locationType': 'region',
'satisfiesPZS': false
},
{
'kind': 'storage#bucket',
'selfLink': 'https://www.googleapis.com/storage/v1/b/bucket-4',
'id': 'bucket-4',
'name': 'bucket-4',
'projectNumber': '768447683925',
'metageneration': '1',
'location': 'US-EAST1',
'storageClass': 'STANDARD',
'etag': 'CAE=',
'defaultEventBasedHold': false,
'timeCreated': '2021-02-13T05:44:29.181Z',
'updated': '2021-02-13T05:44:29.181Z',
'locationType': 'region',
'satisfiesPZS': false
},
{
'kind': 'storage#bucket',
'selfLink': 'https://www.googleapis.com/storage/v1/b/bucket-5',
'id': 'bucket-5',
'name': 'bucket-5',
'projectNumber': '768447683925',
'metageneration': '1',
'location': 'US-EAST1',
'storageClass': 'STANDARD',
'etag': 'CAE=',
'defaultEventBasedHold': false,
'retentionPolicy': {
'retentionPeriod': '8640000',
'effectiveTime': failDate,
'isLocked': false
},
'timeCreated': '2021-02-13T05:44:29.181Z',
'updated': '2021-02-13T05:44:29.181Z',
'locationType': 'region',
'satisfiesPZS': false
}
];
const createCache = (bucketData, bucketErr) => {
return {
buckets: {
list: {
'global': {
err: bucketErr,
data: bucketData
}
},
}
};
};
const createNullCache = () => {
return {
buckets: {
list: {
'global': null
}
}
}
}
describe('bucketRetentionPolicy', function () {
describe('run', function () {
it('should PASS if Storage bucket retention expiration is in more than set days', function (done) {
const cache = createCache([bucket[0]]);
bucketRetentionPolicy.run(cache, { bucket_retention_days: '2' }, (err, results) => {
expect(results.length).to.equal(1);
expect(results[0].status).to.equal(0);
expect(results[0].region).to.equal('global');
done();
});
});
it('should FAIL if Storage bucket retention expiration is in less than set days', function (done) {
const cache = createCache([bucket[4]]);
bucketRetentionPolicy.run(cache, { bucket_retention_days: '90' }, (err, results) => {
expect(results.length).to.equal(1);
expect(results[0].status).to.equal(2);
expect(results[0].region).to.equal('global');
done();
});
});
it('should FAIL if Storage bucket retention has already expired', function (done) {
const cache = createCache([bucket[1]]);
bucketRetentionPolicy.run(cache, { bucket_retention_days: '5' }, (err, results) => {
expect(results.length).to.equal(1);
expect(results[0].status).to.equal(2);
expect(results[0].region).to.equal('global');
done();
});
});
it('should FAIL if Storage bucket retention policy is not locked', function (done) {
const cache = createCache([bucket[2]]);
bucketRetentionPolicy.run(cache, { bucket_retention_days: '3' }, (err, results) => {
expect(results.length).to.equal(1);
expect(results[0].status).to.equal(2);
expect(results[0].region).to.equal('global');
done();
});
});
it('should FAIL if Storage bucket does not have aretention policy', function (done) {
const cache = createCache([bucket[3]]);
bucketRetentionPolicy.run(cache, { bucket_retention_days: '3' }, (err, results) => {
expect(results.length).to.equal(1);
expect(results[0].status).to.equal(2);
expect(results[0].region).to.equal('global');
done();
});
});
it('should PASS if no storage buckets found', function (done) {
const cache = createCache([]);
bucketRetentionPolicy.run(cache, { bucket_retention_days: '10' }, (err, results) => {
expect(results.length).to.equal(1);
expect(results[0].status).to.equal(0);
expect(results[0].region).to.equal('global');
done();
});
});
it('should UNKNOWN if unable to query storage buckets', function (done) {
const cache = createCache([], { message: 'Uanble to query storage buckets'});
bucketRetentionPolicy.run(cache, {}, (err, results) => {
expect(results.length).to.equal(1);
expect(results[0].status).to.equal(3);
done();
});
});
it('should not return anything if list storage buckets response not found', function (done) {
const cache = createNullCache();
bucketRetentionPolicy.run(cache, {}, (err, results) => {
expect(results.length).to.equal(0);
done();
});
});
});
});
| gpl-3.0 |
chiara-paci/santaclara-css | santaclara_css/template_vars_delegate.py | 1955 | from django.conf import settings
from django.core.urlresolvers import resolve
from django.core.exceptions import ImproperlyConfigured
from importlib import import_module
def app_delegate(request):
"""
Leverage the DELEGATED_TEMPLATE_CONTEXT_PROCESSORS setting and url
application namespaces to delegate template context processors to
individual apps.
E.g.
# settings.py
TEMPLATE_CONTEXT_PROCESSORS = (
# ...
'path.to.app_delegate'
)
DELEGATED_TEMPLATE_CONTEXT_PROCESSORS = {
'myapp': (
'myproject.myapp.context_processors.do_something',
)
}
# urls.py
(r'^myapp', include('myproject.myapp.urls', app_name='myapp'))
# The above will execute the "do_something" template context processor for
# views accessed via urls in the "myapp" application namespace.
"""
app_name = resolve(request.path).app_name
try:
processors = settings.DELEGATED_TEMPLATE_CONTEXT_PROCESSORS[app_name]
except KeyError:
# Not delegating any processors to this app
return {}
except AttributeError:
raise ImproperlyConfigured('DELEGATED_TEMPLATE_CONTEXT_PROCESSORS setting required to use app delegation of template context processors')
context = {}
# Adapted from django.template.context.get_standard_processors
for path in processors:
i = path.rfind('.')
module, attr = path[:i], path[i+1:]
try:
mod = import_module(module)
except ImportError as e:
raise ImproperlyConfigured('Error importing request processor module %s: "%s"' % (module, e))
try:
func = getattr(mod, attr)
except AttributeError:
raise ImproperlyConfigured('Module "%s" does not define a "%s" callable request processor' % (module, attr))
context.update(func(request))
return context
| gpl-3.0 |
ubports-weblate/gallery-app | tests/autopilot/gallery_app/emulators/media_selector.py | 1186 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2013 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
from gallery_app.emulators.gallery_utils import GalleryUtils
class MediaSelector(GalleryUtils):
"""A class that makes it easy to interact with the gallery app"""
def __init__(self, app):
self.app = app
def get_media_selector(self):
"""Return the media selector"""
return self.app.wait_select_single("MediaSelector")
def get_second_photo(self):
"""Return the second photo item"""
selector = self.get_media_selector()
# get the first row in the selector
events = self.app.select_many('OrganicMediaList')
photos = events[0].select_many( 'QQuickItem', objectName='eventPhoto')
# return the item itself
return photos[0]
def ensure_fully_open(self):
"""Ensure media selector is fully open"""
media_selector = self.get_media_selector()
media_selector.opacity.wait_for(1.0)
| gpl-3.0 |
HParker/tin | plugins/whoami/ip.rb | 421 | # frozen_string_literal: true
require_relative '../plugin'
require 'maxminddb'
module Plugins
class Ip < Plugin
KEYWORD = 'whoami'
keyword KEYWORD, info: 'Show your identification'
def initialize(info)
@info = info
end
def title
KEYWORD
end
def contents
{
ip: @info.ip,
city: @info.city_name,
country: @info.country_name
}
end
end
end
| gpl-3.0 |
valmynd/MediaFetcher | src/plugins/youtube_dl/youtube_dl/extractor/ku6.py | 845 | from __future__ import unicode_literals
from .common import InfoExtractor
class Ku6IE(InfoExtractor):
_VALID_URL = r'https?://v\.ku6\.com/show/(?P<id>[a-zA-Z0-9\-\_]+)(?:\.)*html'
_TEST = {
'url': 'http://v.ku6.com/show/JG-8yS14xzBr4bCn1pu0xw...html',
'md5': '01203549b9efbb45f4b87d55bdea1ed1',
'info_dict': {
'id': 'JG-8yS14xzBr4bCn1pu0xw',
'ext': 'f4v',
'title': 'techniques test',
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(
r'<h1 title=.*>(.*?)</h1>', webpage, 'title')
dataUrl = 'http://v.ku6.com/fetchVideo4Player/%s.html' % video_id
jsonData = self._download_json(dataUrl, video_id)
downloadUrl = jsonData['data']['f']
return {
'id': video_id,
'title': title,
'url': downloadUrl
}
| gpl-3.0 |
bjtj/http-server | tests/test-url.cpp | 4627 | #include "utils.hpp"
#include <libhttp-server/Url.hpp>
#include <liboslayer/Logger.hpp>
#include <libhttp-server/UrlEncoderDecoder.hpp>
using namespace std;
using namespace osl;
using namespace http;
static void test_url() {
string text = "http://10.0.12.96:2869/upnphost/udhisapi.dll?content=uuid:27151292-513d-4dcd-912a-a2b8cdc0a128";
Url url(text);
ASSERT(url.toString(), ==, text);
ASSERT(url.getPath(), ==, "/upnphost/udhisapi.dll");
ASSERT(url.getPathAndQuery(), ==, "/upnphost/udhisapi.dll?content=uuid:27151292-513d-4dcd-912a-a2b8cdc0a128");
ASSERT(url.getHost(), ==, "10.0.12.96");
ASSERT(url.getPort(), ==, "2869");
ASSERT(url.getScheme(), ==, "http");
url = Url("http://localhost/");
ASSERT(url.getHost(), ==, "localhost");
ASSERT(url.getPort(), ==, "80");
ASSERT(url.getScheme(), ==, "http");
url = Url("https://localhost/");
ASSERT(url.getScheme(), ==, "https");
ASSERT(url.getHost(), ==, "localhost");
ASSERT(url.getPort(), ==, "443");
url = Url("http://username:password@localhost");
ASSERT(url.getScheme(), ==, "http");
ASSERT(url.getUsername(), ==, "username");
ASSERT(url.getPassword(), ==, "password");
ASSERT(url.getHost(), ==, "localhost");
ASSERT(url.getPort(), ==, "80");
ASSERT(url.toString(), ==, "http://username:password@localhost:80/");
// validate
try {
Url::validateUrlFormat("");
throw "It should not be thrown!";
} catch (UrlParseException & e) {
ASSERT(e.toString().size(), >, 0);
}
try {
Url::validateUrlFormat("//");
throw "It should not be thrown!";
} catch (UrlParseException & e) {
ASSERT(e.toString().size(), >, 0);
}
try {
Url::validateUrlFormat("/home/user/");
throw "It should not be thrown!";
} catch (UrlParseException & e) {
ASSERT(e.toString().size(), >, 0);
}
Url::validateUrlFormat("file:///home/user/");
}
static void test_url_tostring() {
string u = "http://localhost:9000/page.html?a=A&b=B&c=C";
Url url(u);
ASSERT(url.toString(), ==, u);
}
static void test_file_url() {
Url url("file:///test.txt");
ASSERT(url.getPath(), ==, "/test.txt");
}
static void test_url_encode() {
string sample =
" 1 Raw_Read_Error_Rate 0x002f 100 100 051 Pre-fail Always - 1\n"
" 2 Throughput_Performance 0x0026 252 252 000 Old_age Always - 0\n"
" 3 Spin_Up_Time 0x0023 092 092 025 Pre-fail Always - 2573\n"
" 4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 182\n"
" 5 Reallocated_Sector_Ct 0x0033 252 252 010 Pre-fail Always - 0\n"
" 7 Seek_Error_Rate 0x002e 252 252 051 Old_age Always - 0\n"
" 8 Seek_Time_Performance 0x0024 252 252 015 Old_age Offline - 0\n"
" 9 Power_On_Hours 0x0032 100 100 000 Old_age Always - 318\n"
" 10 Spin_Retry_Count 0x0032 252 252 051 Old_age Always - 0\n"
" 11 Calibration_Retry_Count 0x0032 100 100 000 Old_age Always - 1\n"
" 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 397\n"
"191 G-Sense_Error_Rate 0x0022 100 100 000 Old_age Always - 1\n"
"192 Power-Off_Retract_Count 0x0022 100 100 000 Old_age Always - 316\n"
"194 Temperature_Celsius 0x0002 035 060 000 Old_age Always - 35 (0 21 0 0 0)\n"
"195 Hardware_ECC_Recovered 0x003a 100 100 000 Old_age Always - 0\n"
"196 Reallocated_Event_Count 0x0032 252 252 000 Old_age Always - 0\n"
"197 Current_Pending_Sector 0x0032 252 252 000 Old_age Always - 0\n"
"198 Offline_Uncorrectable 0x0030 252 252 000 Old_age Offline - 0\n"
"199 UDMA_CRC_Error_Count 0x0036 200 200 000 Old_age Always - 0\n"
"200 Multi_Zone_Error_Rate 0x002a 100 100 000 Old_age Always - 30\n"
"223 Load_Retry_Count 0x0032 100 100 000 Old_age Always - 1\n"
"225 Load_Cycle_Count 0x0032 100 100 000 Old_age Always - 83";
ASSERT(UrlDecoder::decode(UrlEncoder::encode(sample)), ==, sample);
ASSERT(UrlDecoder::decode_plus(UrlEncoder::encode_plus(sample)), ==, sample);
}
int main(int argc, char *args[]) {
LoggerProfile profile("*");
profile.allFormatters("basic");
profile.allWriters("console");
LoggerFactory::instance().setProfile(profile);
Url url;
test_url();
test_url_tostring();
test_file_url();
test_url_encode();
return 0;
}
| gpl-3.0 |
spanishtech/RGGE-Engine | src/me/soxey6/engine/managers/scene/Scene.java | 2939 | package me.soxey6.engine.managers.scene;
import me.soxey6.engine.events.scene.FocusEvent;
import me.soxey6.engine.events.scene.SceneCreateEvent;
import me.soxey6.engine.main.Engine;
import me.soxey6.engine.main.Wrapper;
import me.soxey6.engine.managers.event.objects.listener.EventListener;
import me.soxey6.engine.objects.gui.Gui;
/**
* Scene class: This class is used to segment code into different levels or
* screens. This allows things such as menus and multiple levels to be created
* It is recomended to destroy these objects when not in use and recreate them
* when you need them You can unfocus and focus them, when they are unfocused to
* logic, rendering, or input processing is done. NOTICE: Place your code here
* if it DOES NOT need to be executed at ANY time. These scenes are more
* efficient then running all the code from the main game class.
*
* @author spanish
*
*/
public class Scene extends Wrapper {
private final boolean LIMIT_LOGIC = true;
private final long LOGIC_INCREMENT_MS = 100;
private String name;
private String title;
private boolean focused;
private Engine game;
private Gui gui;
private long lastLogicTime;
private EventListener<FocusEvent> focusListener = new EventListener<FocusEvent>(FocusEvent.class, event -> {
getLogger().log(DEBUG, event.isFocused());
onFocus(event.isFocused());
});
public Scene(String name) {
// Setup variables
this.name = name;
this.title = name;
this.game = Engine.getEngine();
this.gui = new Gui(this);
this.getSceneManager().addScene(this);
getEventManager().dispatch(new SceneCreateEvent(this));
// Log the creation
this.getLogger().log(this.getLogger().DEBUG, "Creating Scene: " + this.getName());
}
public void onFocus(boolean focused) {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public boolean isFocused() {
return focused;
}
public void setFocused(boolean focused) {
this.focused = focused;
}
public Engine getGame() {
return game;
}
public void setGame(Engine game) {
this.game = game;
}
public Gui getGui() {
return gui;
}
public void setGui(Gui gui) {
this.gui = gui;
}
public long getLastLogicTime() {
return lastLogicTime;
}
public void setLastLogicTime(long lastLogicTime) {
this.lastLogicTime = lastLogicTime;
}
public boolean isLimitLogic() {
return LIMIT_LOGIC;
}
public long getLogicIncrementMS() {
return LOGIC_INCREMENT_MS;
}
public EventListener<FocusEvent> getFocusListener() {
return focusListener;
}
public void setFocusListener(EventListener<FocusEvent> focusListener) {
this.focusListener = focusListener;
}
public void finalize() throws Throwable {
getSceneManager().getScenes().remove(this);
focusListener.finalize();
super.finalize();
}
}
| gpl-3.0 |
applifireAlgo/ZenClubApp | zenws/src/main/webapp/app/zenws/shared/com/zen/viewmodel/app/AddClubMembersViewModel.js | 207 | Ext.define('Zenws.zenws.shared.com.zen.viewmodel.app.AddClubMembersViewModel', {
'extend': 'Ext.app.ViewModel',
'alias': 'viewmodel.AddClubMembersViewModel',
'model': 'AddClubMembersModel'
}); | gpl-3.0 |
bocheninc/L0 | core/p2p/peer_manager.go | 9639 | // Copyright (C) 2017, Beijing Bochen Technology Co.,Ltd. All rights reserved.
//
// This file is part of L0
//
// The L0 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The L0 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package p2p
import (
"bytes"
"net"
"time"
"github.com/bocheninc/L0/components/db"
"github.com/bocheninc/L0/components/log"
"github.com/bocheninc/L0/core/params"
)
const (
columnFamily = "peer"
)
var (
dbInstance *db.BlockchainDB
pm *peerManager
)
type peerManager struct {
localPeer *Peer
peers *peerMap
handshakings *peerMap
dialings map[string]bool
quit chan struct{}
addPeer chan *Peer
delPeer chan net.Conn
alivePeer chan net.Conn
// banPeer chan net.Conn
// blacklist []string
dialTaskDone chan string
broadcastCh chan *Msg
clientConn chan net.Conn
dialTask chan *Peer
}
// getPeerManager returns a peerManager
func getPeerManager() *peerManager {
if pm == nil {
pm = &peerManager{
localPeer: NewPeer(
[]byte(config.NodeID),
nil, config.Address, nil),
peers: newPeerMap(),
handshakings: newPeerMap(),
dialings: make(map[string]bool),
quit: make(chan struct{}, 1),
addPeer: make(chan *Peer, 1),
delPeer: make(chan net.Conn, 1),
alivePeer: make(chan net.Conn, 1),
// banPeer: make([]string, 1),
// addBlackList: make(chan net.Conn, 1),
broadcastCh: make(chan *Msg, 10),
clientConn: make(chan net.Conn, 8),
dialTask: make(chan *Peer, 8),
dialTaskDone: make(chan string),
}
// log.Debugf("local peerinfo %s", pm.localPeer)
}
return pm
}
// GetPeer returns a peer according the conn
func (pm *peerManager) GetPeer(conn net.Conn) *Peer {
if p, ok := pm.peers.get(conn); ok {
return p
}
return nil
}
// GetPeers returns all peers info
func (pm *peerManager) GetPeers() []*Peer {
return pm.peers.getPeers()
}
// GetLocalPeer returns local peer info
func (pm *peerManager) GetLocalPeer() *Peer {
return pm.localPeer
}
func (pm *peerManager) stop() {
pm.savePeers()
// close(pm.banPeer)
close(pm.addPeer)
close(pm.delPeer)
close(pm.alivePeer)
close(pm.dialTask)
dbInstance.Close()
}
func (pm *peerManager) add(peer *Peer) {
// if utils.Contain(string(peer.ID), pm.blacklist) {
// log.Debugf("Forbid,peer id [%s] in black lispm.", peer.ID)
// peer.Conn.Close()
// }
if pm.peers.contains(peer.ID) {
log.Debugf("Peer [%s] already connected", peer.ID)
peer.Conn.Close()
return
}
peer.LastActiveTime = time.Now()
pm.peers.set(peer.Conn, peer)
log.Infof("Add Peer [%s] Success.", peer)
// start all protocols
peer.startProtocols()
err := dbInstance.Put(columnFamily, peer.ID, []byte(peer.Address))
if err != nil {
log.Error(err.Error())
}
}
func (pm *peerManager) del(conn net.Conn) {
defer conn.Close()
if peer, ok := pm.peers.get(conn); ok {
log.Infof("Delete Peer [%s] Success.", peer)
err := dbInstance.Delete(columnFamily, peer.ID)
if err != nil {
log.Error(err.Error())
}
pm.peers.remove(conn)
}
pm.handshakings.remove(conn)
}
// func (pm *peerManager) ban(conn net.Conn) {
// if peer, ok := pm.peers.get(conn); ok {
// pm.blacklist = append(pm.blacklist, string(peer.ID))
// }
// pm.delPeer <- conn
// }
// process peers option , usually run as goroutine
func (pm *peerManager) run() {
pm.init()
log.Infoln("PeerManager Start ...")
log.Debugf("Local PeerInfo %s", pm.localPeer)
go pm.connectLoop()
go pm.broadcastLoop()
ticker := time.NewTicker(time.Duration(int64(config.KeepAliveInterval)))
for {
select {
case <-pm.quit:
pm.stop()
case peer := <-pm.addPeer:
pm.add(peer)
case conn := <-pm.delPeer:
pm.del(conn)
// case conn := <-pm.banPeer:
// pm.ban(conn)
case conn := <-pm.alivePeer:
pm.updateActiveTime(conn)
case <-ticker.C:
pm.manage()
}
}
}
// init read peers from database and connect it
// if no peers data, connect bootstrap node
func (pm *peerManager) init() {
if dbInstance == nil {
log.Fatalln("Error,the database is not initialized.")
}
list, err := dbInstance.Get(columnFamily, []byte("peerList"))
if err != nil {
log.Errorln("Database get peers error :", err.Error())
}
if len(list) > 0 {
peerList := bytes.Split(list, []byte{'&'})
for _, peerID := range peerList {
peerAddr, err := dbInstance.Get(columnFamily, peerID)
if err != nil {
log.Errorln(err.Error())
continue
}
peer, _ := ParsePeer(string(peerAddr))
pm.dialTask <- peer
}
} else {
pm.getPeers()
}
}
// connectLoop handles dial tasks
func (pm *peerManager) connectLoop() {
for {
select {
case peer := <-pm.dialTask:
pm.connect(peer)
case peer := <-pm.dialTaskDone:
delete(pm.dialings, peer)
}
}
}
// broadcastLoop handles brodcast tasks
func (pm *peerManager) broadcastLoop() {
for {
select {
case msg := <-pm.broadcastCh:
pm.broadcast(msg)
}
}
}
// connect connects peer,if success add to connections
func (pm *peerManager) connect(peer *Peer) {
if bytes.Equal(pm.localPeer.ID, peer.ID) {
log.Debugf("can ont connect self[%s]", peer.ID)
return
}
if _, ok := pm.dialings[peer.String()]; ok ||
pm.peers.contains(peer.ID) ||
pm.handshakings.contains(peer.ID) {
// log.Debugf("peer [%s] already connected", peer.ID)
// log.Debugf("%s - %s - %s - %s", ok, pm.peers.contains(peer.ID), pm.handshakings.contains(peer.ID), peer)
return
}
if pm.peers.count() >= config.MaxPeers {
log.Debugf("connected peer more than max peers.")
return
}
log.Debugf("peer manager try connect : %s", peer)
// prevent connect a peer many times
pm.dialings[peer.String()] = true
go func() {
defer func() {
pm.dialTaskDone <- peer.String()
}()
for i := 0; i < config.ReconnectTimes; i++ {
conn := Dial(peer.Address)
if conn != nil {
pm.clientConn <- conn
return
}
log.Debugf("Reconnect Peer %v", peer.Address)
time.Sleep(time.Duration(int64(config.ConnectTimeInterval)))
if pm.peers.contains(peer.ID) || pm.handshakings.contains(peer.ID) {
return
}
}
}()
}
// keepAlive manages peers, send ping msg or reconnect
// make sure the minimum peers
func (pm *peerManager) manage() {
log.Debugf("Peer Info [number: %d]", pm.peers.count())
// add to test
params.ConnNums = pm.peers.count()
params.LocalIp = GetLocalIP()
//end
now := time.Now()
for _, peer := range pm.peers.getPeers() {
sec := now.Sub(peer.LastActiveTime)
if int(sec) > config.KeepAliveInterval*config.KeepAliveTimes {
log.Debugf("Peer Keep Alive Timeout %d > %d, lastActiveTime %v", int(sec), config.KeepAliveInterval*config.KeepAliveTimes, peer.LastActiveTime)
pm.delPeer <- peer.Conn
pm.dialTask <- peer
continue
}
if int(sec) > config.KeepAliveInterval {
msg := NewMsg(pingMsg, nil)
if n, err := msg.write(peer.Conn); n == 0 || err != nil {
log.Errorf("Send pingMsg error n: %d, err: %v", n, err)
}
}
}
if pm.peers.count() < config.MaxPeers {
pm.getPeers()
}
}
// getPeers sends getpeers msg to connected peers
// if the number of peers less than minPeers, try to connect bootstrap node
func (pm *peerManager) getPeers() {
for _, bNode := range config.BootstrapNodes {
peer, err := ParsePeer(bNode)
if err != nil {
log.Errorln(err.Error())
continue
}
pm.dialTask <- peer
}
msg := NewMsg(getPeersMsg, pm.localPeer.ID[:])
pm.broadcastCh <- msg
}
func (pm *peerManager) updateActiveTime(conn net.Conn) {
// peer, ok := pm.peers.get(conn)
// log.Debugf("keep alive %s peer %s ok %d", peer.LastActiveTime, peer, ok)
if peer, ok := pm.peers.get(conn); ok {
peer.LastActiveTime = time.Now()
// log.Debugf("keep alive %s", peer.LastActiveTime)
}
}
// savePeers saves peers to database
func (pm *peerManager) savePeers() {
// TODO: lcnd exit call this
log.Debugf("peer manager try to write %d records to database", pm.peers.count())
if pm.peers.count() == 0 {
log.Debugln("savePeerList: There is no peer in connections")
return
}
peerList := make([][]byte, pm.peers.count())
for _, peer := range pm.peers.getPeers() {
if err := dbInstance.Put(columnFamily, peer.ID, []byte(peer.Address)); err != nil {
log.Errorf("savePeerList: save peer [%s] to database error %v", peer.ID, err.Error())
continue
}
peerList = append(peerList, peer.ID)
}
peers := bytes.Join(peerList, []byte{'&'})
err := dbInstance.Put(columnFamily, []byte("peerList"), peers)
if err != nil {
log.Errorf("savePeerList: save peers to database error %v", err.Error())
}
}
func (pm *peerManager) broadcast(msg *Msg) {
if msg != nil {
for _, peer := range pm.peers.getPeers() {
log.Debugf("Peer Manager broadcast message %d to peer %s", msg.Cmd, peer.Address)
// if msg.Cmd <= peersMsg || msg.Cmd == 23 || !peer.TestFilter(msg.CheckSum[:]) {
if n, err := msg.write(peer.Conn); err != nil {
log.Errorf("broadcast message write error %d - %v", n, err)
}
// } else {
// log.Errorf("Peer Manager broadcast error %d %s", msg.Cmd, peer.Address)
// }
}
} else {
log.Errorf("broadcast message error, msg is nil %v", msg)
}
}
| gpl-3.0 |
JuBra/GEMEditor | GEMEditor/connect/ncbi.py | 4095 | from six.moves.urllib.request import urlopen
from six.moves.urllib.parse import quote_plus
# Mapping between month abbreviations and the numerical month
month_int_mapping = {'': 0,
'Jan': 1,
'Feb': 2,
'Sep': 9,
'Oct': 10,
'Aug': 8,
'Apr': 4,
'Jun': 6,
'Mar': 3,
'Dec': 12,
'May': 5,
'Jul': 7,
'Nov': 11,
'01': 1,
'02': 2,
'03': 3,
'04': 4,
'05': 5,
'06': 6,
'07': 7,
'08': 8,
'09': 9,
'10': 10,
'11': 11,
'12': 12,
'1': 1,
'2': 2,
'3': 3,
'4': 4,
'5': 5,
'6': 6,
'7': 7,
'8': 8,
'9': 9,
"10": 10,
"11": 11,
"12": 12}
# List of all ncbi databases - 2016-02-24
NCBI_DATABASES = {"bioproject": "BioProject",
"biosample": "BioSample",
"biosystems": "Biosystems",
"books": "Books",
"cdd": "Conserved Domains",
"gap": "dbGaP",
"dbvar": "dbVar",
"epigenomics": "Epigenomics",
"nucest": "EST",
"gene": "Gene",
"genome": "Genome",
"gds": "GEO Datasets",
"geoprofiles": "GEO Profiles",
"nucgss": "GSS",
"homologene": "HomoloGene",
"mesh": "MeSH",
"toolkit": "NCBI C++ Toolkit",
"ncbisearch": "NCBI Web Site",
"nlmcatalog": "NLM Catalog",
"nuccore": "Nucleotide",
"omia": "OMIA",
"popset": "PopSet",
"probe": "Probe",
"protein": "Protein",
"proteinclusters": "Protein Clusters",
"pcassay": "PubChem BioAssay",
"pccompound": "PubChem Compound",
"pcsubstance": "PubChem Substance",
"pubmed": "PubMed",
"pmc": "PubMed Central",
"snp": "SNP",
"sra": "SRA",
"structure": "Structure",
"taxonomy": "Taxonomy",
"unigene": "UniGene",
"unists": "UniSTS"}
def search_ncbi(search_term, email, tool, database="pubmed", retstart=0, retmax=100000):
"""
Search pubmed using NCBI's eutils API
Parameters
----------
search_term: Input string - spaces will be replaced by "+"
email: E-mail addresse
tool: The name of the tool you are using
database : A identifier of a NCBI database
retstart: The start index from which on results will be returned
retmax: The maximum number of results to be returned
Returns: A string containing the xml information returned by eutils
-------
"""
if database not in NCBI_DATABASES:
raise ValueError('Unknown NCBI database "{0}"'.format(database))
search_term = quote_plus(search_term)
search_url = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db={database}&term={term}&retstart={retstart}&retmax={retmax}&email={email}&tool={tool}"
url_data = urlopen(search_url.format(database=database,
tool=tool,
term=search_term,
email=email,
retmax=str(retmax),
retstart=str(retstart)))
return url_data.read()
| gpl-3.0 |
cfbarragan/CleaningShop | gulpfile.js | 1317 | var gulp = require('gulp');
var jshint = require('gulp-jshint');
var jscs = require('gulp-jscs');
var nodemon = require('gulp-nodemon');
var jsFiles = ['*.js','src/**/*.js'];
gulp.task('style', function() {
return gulp.src(jsFiles)
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish', {
verbose : true
}))
.pipe(jscs());
});
gulp.task('inject', function() {
var wiredep = require('wiredep').stream;
var inject = require('gulp-inject');
var injectSrc = gulp.src(['./public/css/*.css', './public/js/*.js'], {read : false});
var injectoptions = {
ignorePath : '/public'
};
var options = {
bowerJson : require('./bower.json'),
directory : './public/lib',
ignorePath : '../../public'
};
return gulp.src('./src/views/*.ejs')
.pipe(wiredep(options))
.pipe(inject(injectSrc, injectoptions))
.pipe(gulp.dest('./src/views'));
});
gulp.task('serve', ['style', 'inject'], function() {
});
gulp.task('servedev', function() {
var options = {
script : 'app.js',
delaytime: 1,
env: {
'PORT' : 5000
},
watch: jsFiles
};
return nodemon(options)
.on('restart', function(ev) {
console.log('Restarting....');
});
}); | gpl-3.0 |
yonatanm/faceoff | template-portfolio.php | 1781 | <?php
/**
Template Name: Portfolio
*
*
* @file template-portfolio.php
* @package StanleyWP
* @author Brad Williams & Carlos Alvarez
* @copyright 2003 - 2014 Gents Themes
* @license license.txt
* @version Release: 3.0.3
* @link http://codex.wordpress.org/Theme_Development#Pages_.28page.php.29
* @since available since Release 1.0
*/
?>
<?php get_header(); ?>
<div class="row">
<div class="col-lg-8">
<div class="container pt">
<div class="row mt">
<div class="col-lg-6 col-lg-offset-3 centered">
<?php if( rwmb_meta( 'wtf_portfolio_title' ) !== '' ) { ?>
<?php echo rwmb_meta( 'wtf_portfolio_title' ); ?>
<hr>
<?php } ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
</div>
<?php
$loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => -1));
$count =0;
?>
<div class="row mt centered">
<?php if ( $loop ) :
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="col-lg-4">
<?php if ( has_post_thumbnail()) : ?>
<a class="zoom green" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
<?php the_post_thumbnail(); ?>
</a>
<?php endif; ?>
<?php if(bi_get_data('project_title', '1')) {?>
<p><?php the_title(); ?></p>
<?php } ?>
</div> <!-- /col -->
<?php endwhile; else: ?>
</div>
<div class="error-not-found">Sorry, no portfolio entries for while.</div>
<?php endif; ?>
</div><!-- end of container -->
</div>
<div class="col-lg-4">
<?php get_sidebar(); ?>
</div>
</div>
<?php get_footer(); ?> | gpl-3.0 |
Saican/Whitman | src/p_terrain.cpp | 16930 | /*
** p_terrain.cpp
** Terrain maintenance
**
**---------------------------------------------------------------------------
** Copyright 1998-2006 Randy Heit
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
// HEADER FILES ------------------------------------------------------------
#include <string.h>
#include "doomtype.h"
#include "cmdlib.h"
#include "p_terrain.h"
#include "gi.h"
#include "r_state.h"
#include "w_wad.h"
#include "sc_man.h"
#include "s_sound.h"
#include "p_local.h"
#include "templates.h"
// MACROS ------------------------------------------------------------------
#define SET_FIELD(type,val) *((type*)((BYTE *)fields + \
parser[keyword].u.Offset)) = val;
// TYPES -------------------------------------------------------------------
enum EOuterKeywords
{
OUT_SPLASH,
OUT_TERRAIN,
OUT_FLOOR,
OUT_IFDOOM,
OUT_IFHERETIC,
OUT_IFHEXEN,
OUT_IFSTRIFE,
OUT_ENDIF,
OUT_DEFAULTTERRAIN
};
enum ETerrainKeywords
{
TR_CLOSE,
TR_SPLASH,
TR_DAMAGEAMOUNT,
TR_DAMAGETYPE,
TR_DAMAGETIMEMASK,
TR_FOOTCLIP,
TR_STEPVOLUME,
TR_WALKINGSTEPTIME,
TR_RUNNINGSTEPTIME,
TR_LEFTSTEPSOUNDS,
TR_RIGHTSTEPSOUNDS,
TR_LIQUID,
TR_FRICTION,
TR_ALLOWPROTECTION
};
enum EGenericType
{
GEN_End,
GEN_Sound,
GEN_Byte,
GEN_Class,
GEN_Splash,
GEN_Float,
GEN_Double,
GEN_Time,
GEN_Bool,
GEN_Int,
GEN_Custom,
};
struct FGenericParse
{
EGenericType Type;
union {
size_t Offset;
void (*Handler) (FScanner &sc, int type, void *fields);
} u;
};
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
static void MakeDefaultTerrain ();
static void ParseOuter (FScanner &sc);
static void ParseSplash (FScanner &sc);
static void ParseTerrain (FScanner &sc);
static void ParseFloor (FScanner &sc);
static int FindSplash (FName name);
static void GenericParse (FScanner &sc, FGenericParse *parser, const char **keywords,
void *fields, const char *type, FName name);
static void ParseDamage (FScanner &sc, int keyword, void *fields);
static void ParseFriction (FScanner &sc, int keyword, void *fields);
static void ParseDefault (FScanner &sc);
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
// PUBLIC DATA DEFINITIONS -------------------------------------------------
FTerrainTypeArray TerrainTypes;
TArray<FSplashDef> Splashes;
TArray<FTerrainDef> Terrains;
WORD DefaultTerrainType;
// PRIVATE DATA DEFINITIONS ------------------------------------------------
static const char *OuterKeywords[] =
{
"splash",
"terrain",
"floor",
"ifdoom",
"ifheretic",
"ifhexen",
"ifstrife",
"endif",
"defaultterrain",
NULL
};
static const char *SplashKeywords[] =
{
"}",
"smallsound",
"smallclip",
"sound",
"smallclass",
"baseclass",
"chunkclass",
"chunkxvelshift",
"chunkyvelshift",
"chunkzvelshift",
"chunkbasezvel",
"noalert",
NULL
};
static const char *TerrainKeywords[] =
{
"}",
"splash",
"damageamount",
"damagetype",
"damagetimemask",
"footclip",
"stepvolume",
"walkingsteptime",
"runningsteptime",
"leftstepsounds",
"rightstepsounds",
"liquid",
"friction",
"allowprotection",
NULL
};
static FGenericParse SplashParser[] =
{
{ GEN_End, {0} },
{ GEN_Sound, {myoffsetof(FSplashDef, SmallSplashSound)} },
{ GEN_Double, {myoffsetof(FSplashDef, SmallSplashClip)} },
{ GEN_Sound, {myoffsetof(FSplashDef, NormalSplashSound)} },
{ GEN_Class, {myoffsetof(FSplashDef, SmallSplash)} },
{ GEN_Class, {myoffsetof(FSplashDef, SplashBase)} },
{ GEN_Class, {myoffsetof(FSplashDef, SplashChunk)} },
{ GEN_Byte, {myoffsetof(FSplashDef, ChunkXVelShift)} },
{ GEN_Byte, {myoffsetof(FSplashDef, ChunkYVelShift)} },
{ GEN_Byte, {myoffsetof(FSplashDef, ChunkZVelShift)} },
{ GEN_Double, {myoffsetof(FSplashDef, ChunkBaseZVel)} },
{ GEN_Bool, {myoffsetof(FSplashDef, NoAlert)} }
};
static FGenericParse TerrainParser[] =
{
{ GEN_End, {0} },
{ GEN_Splash, {myoffsetof(FTerrainDef, Splash)} },
{ GEN_Int, {myoffsetof(FTerrainDef, DamageAmount)} },
{ GEN_Custom, {(size_t)ParseDamage} },
{ GEN_Int, {myoffsetof(FTerrainDef, DamageTimeMask)} },
{ GEN_Double, {myoffsetof(FTerrainDef, FootClip)} },
{ GEN_Float, {myoffsetof(FTerrainDef, StepVolume)} },
{ GEN_Time, {myoffsetof(FTerrainDef, WalkStepTics)} },
{ GEN_Time, {myoffsetof(FTerrainDef, RunStepTics)} },
{ GEN_Sound, {myoffsetof(FTerrainDef, LeftStepSound)} },
{ GEN_Sound, {myoffsetof(FTerrainDef, RightStepSound)} },
{ GEN_Bool, {myoffsetof(FTerrainDef, IsLiquid)} },
{ GEN_Custom, {(size_t)ParseFriction} },
{ GEN_Bool, {myoffsetof(FTerrainDef, AllowProtection)} },
};
// CODE --------------------------------------------------------------------
//==========================================================================
//
// P_InitTerrainTypes
//
//==========================================================================
void P_InitTerrainTypes ()
{
int lastlump;
int lump;
int size;
Splashes.Clear();
Terrains.Clear();
size = (TexMan.NumTextures()+1);
TerrainTypes.Resize(size);
TerrainTypes.Clear();
MakeDefaultTerrain ();
lastlump = 0;
while (-1 != (lump = Wads.FindLump ("TERRAIN", &lastlump)) )
{
FScanner sc(lump);
ParseOuter (sc);
}
Splashes.ShrinkToFit ();
Terrains.ShrinkToFit ();
}
//==========================================================================
//
// MakeDefaultTerrain
//
//==========================================================================
static void MakeDefaultTerrain ()
{
FTerrainDef def;
memset (&def, 0, sizeof(def));
def.Name = "Solid";
def.Splash = -1;
Terrains.Push (def);
}
//==========================================================================
//
// ParseOuter
//
//==========================================================================
static void ParseOuter (FScanner &sc)
{
int bracedepth = 0;
bool ifskip = false;
while (sc.GetString ())
{
if (ifskip)
{
if (bracedepth > 0)
{
if (sc.Compare ("}"))
{
bracedepth--;
continue;
}
}
else if (sc.Compare ("endif"))
{
ifskip = false;
continue;
}
if (sc.Compare ("{"))
{
bracedepth++;
}
else if (sc.Compare ("}"))
{
sc.ScriptError ("Too many left braces ('}')");
}
}
else
{
switch (sc.MustMatchString (OuterKeywords))
{
case OUT_SPLASH:
ParseSplash (sc);
break;
case OUT_TERRAIN:
ParseTerrain (sc);
break;
case OUT_FLOOR:
ParseFloor (sc);
break;
case OUT_DEFAULTTERRAIN:
ParseDefault (sc);
break;
case OUT_IFDOOM:
case OUT_IFHERETIC:
case OUT_IFHEXEN:
case OUT_IFSTRIFE:
ifskip = !CheckGame(sc.String+2, true);
break;
case OUT_ENDIF:
break;
}
}
}
}
//==========================================================================
//
// SetSplashDefaults
//
//==========================================================================
static void SetSplashDefaults (FSplashDef *splashdef)
{
splashdef->SmallSplashSound =
splashdef->NormalSplashSound = 0;
splashdef->SmallSplash =
splashdef->SplashBase =
splashdef->SplashChunk = NULL;
splashdef->ChunkXVelShift =
splashdef->ChunkYVelShift =
splashdef->ChunkZVelShift = 8;
splashdef->ChunkBaseZVel = 1;
splashdef->SmallSplashClip = 12.;
splashdef->NoAlert = false;
}
//==========================================================================
//
// ParseSplash
//
//==========================================================================
void ParseSplash (FScanner &sc)
{
int splashnum;
FSplashDef *splashdef;
bool isnew = false;
FName name;
sc.MustGetString ();
name = sc.String;
splashnum = (int)FindSplash (name);
if (splashnum < 0)
{
FSplashDef def;
SetSplashDefaults (&def);
def.Name = name;
splashnum = (int)Splashes.Push (def);
isnew = true;
}
splashdef = &Splashes[splashnum];
sc.MustGetString ();
if (!sc.Compare ("modify"))
{ // Set defaults
if (!isnew)
{ // New ones already have their defaults set before they're pushed.
SetSplashDefaults (splashdef);
}
}
else
{
sc.MustGetString();
}
if (!sc.Compare ("{"))
{
sc.ScriptError ("Expected {");
}
else
{
GenericParse (sc, SplashParser, SplashKeywords, splashdef, "splash",
splashdef->Name);
}
}
//==========================================================================
//
// ParseTerrain
//
//==========================================================================
void ParseTerrain (FScanner &sc)
{
int terrainnum;
FName name;
sc.MustGetString ();
name = sc.String;
terrainnum = (int)P_FindTerrain (name);
if (terrainnum < 0)
{
FTerrainDef def;
memset (&def, 0, sizeof(def));
def.Splash = -1;
def.Name = name;
terrainnum = (int)Terrains.Push (def);
}
// Set defaults
sc.MustGetString ();
if (!sc.Compare ("modify"))
{
name = Terrains[terrainnum].Name;
memset (&Terrains[terrainnum], 0, sizeof(FTerrainDef));
Terrains[terrainnum].Splash = -1;
Terrains[terrainnum].Name = name;
}
else
{
sc.MustGetString ();
}
if (sc.Compare ("{"))
{
GenericParse (sc, TerrainParser, TerrainKeywords, &Terrains[terrainnum],
"terrain", Terrains[terrainnum].Name);
}
else
{
sc.ScriptError ("Expected {");
}
}
//==========================================================================
//
// ParseDamage
//
//==========================================================================
static void ParseDamage (FScanner &sc, int keyword, void *fields)
{
FTerrainDef *def = (FTerrainDef *)fields;
sc.MustGetString ();
// Lava is synonymous with Fire here!
if (sc.Compare("Lava")) def->DamageMOD=NAME_Fire;
else def->DamageMOD=sc.String;
}
//==========================================================================
//
// ParseFriction
//
//==========================================================================
static void ParseFriction (FScanner &sc, int keyword, void *fields)
{
FTerrainDef *def = (FTerrainDef *)fields;
double friction, movefactor;
sc.MustGetFloat ();
// These calculations should match those in P_SetSectorFriction().
// A friction of 1.0 is equivalent to ORIG_FRICTION.
friction = (0x1EB8*(sc.Float*100))/0x80 + 0xD001;
friction = clamp<double> (friction, 0, 65536.);
if (friction > ORIG_FRICTION * 65536.) // ice
movefactor = ((0x10092 - friction) * 1024) / 4352 + 568;
else
movefactor = ((friction - 0xDB34)*(0xA))/0x80;
if (movefactor < 32)
movefactor = 32;
def->Friction = friction / 65536.;
def->MoveFactor = movefactor / 65536.;
}
//==========================================================================
//
// GenericParse
//
//==========================================================================
static void GenericParse (FScanner &sc, FGenericParse *parser, const char **keywords,
void *fields, const char *type, FName name)
{
bool notdone = true;
int keyword;
int val = 0;
const PClass *info;
do
{
sc.MustGetString ();
keyword = sc.MustMatchString (keywords);
switch (parser[keyword].Type)
{
case GEN_End:
notdone = false;
break;
case GEN_Sound:
sc.MustGetString ();
SET_FIELD (FSoundID, FSoundID(sc.String));
/* unknown sounds never produce errors anywhere else so they shouldn't here either.
if (val == 0)
{
Printf ("Unknown sound %s in %s %s\n",
sc.String, type, name.GetChars());
}
*/
break;
case GEN_Byte:
sc.MustGetNumber ();
SET_FIELD (BYTE, sc.Number);
break;
case GEN_Class:
sc.MustGetString ();
if (sc.Compare ("None"))
{
info = NULL;
}
else
{
info = PClass::FindClass (sc.String);
if (!info->IsDescendantOf (RUNTIME_CLASS(AActor)))
{
Printf ("%s is not an Actor (in %s %s)\n",
sc.String, type, name.GetChars());
info = NULL;
}
else if (info == NULL)
{
Printf ("Unknown actor %s in %s %s\n",
sc.String, type, name.GetChars());
}
}
SET_FIELD (const PClass *, info);
break;
case GEN_Splash:
sc.MustGetString ();
val = FindSplash (sc.String);
SET_FIELD (int, val);
if (val == -1)
{
Printf ("Splash %s is not defined yet (in %s %s)\n",
sc.String, type, name.GetChars());
}
break;
case GEN_Float:
sc.MustGetFloat ();
SET_FIELD (float, float(sc.Float));
break;
case GEN_Double:
sc.MustGetFloat();
SET_FIELD(double, sc.Float);
break;
case GEN_Time:
sc.MustGetFloat ();
SET_FIELD (int, (int)(sc.Float * TICRATE));
break;
case GEN_Bool:
SET_FIELD (bool, true);
break;
case GEN_Int:
sc.MustGetNumber ();
SET_FIELD (int, sc.Number);
break;
case GEN_Custom:
parser[keyword].u.Handler (sc, keyword, fields);
break;
}
} while (notdone);
}
//==========================================================================
//
// ParseFloor
//
//==========================================================================
static void ParseFloor (FScanner &sc)
{
FTextureID picnum;
int terrain;
bool opt = sc.CheckString("optional");
sc.MustGetString ();
picnum = TexMan.CheckForTexture (sc.String, FTexture::TEX_Flat,
FTextureManager::TEXMAN_Overridable|FTextureManager::TEXMAN_TryAny);
if (!picnum.Exists())
{
if (!opt)
{
Printf("Unknown flat %s\n", sc.String);
}
sc.MustGetString();
return;
}
sc.MustGetString ();
terrain = P_FindTerrain (sc.String);
if (terrain == -1)
{
Printf ("Unknown terrain %s\n", sc.String);
terrain = 0;
}
TerrainTypes.Set(picnum.GetIndex(), terrain);
}
//==========================================================================
//
// ParseDefault
//
//==========================================================================
static void ParseDefault (FScanner &sc)
{
int terrain;
sc.MustGetString ();
terrain = P_FindTerrain (sc.String);
if (terrain == -1)
{
Printf ("Unknown terrain %s\n", sc.String);
terrain = 0;
}
DefaultTerrainType = terrain;
}
//==========================================================================
//
// FindSplash
//
//==========================================================================
int FindSplash (FName name)
{
unsigned int i;
for (i = 0; i < Splashes.Size (); i++)
{
if (Splashes[i].Name == name)
{
return (int)i;
}
}
return -1;
}
//==========================================================================
//
// FindTerrain
//
//==========================================================================
int P_FindTerrain (FName name)
{
unsigned int i;
if (name == NAME_Null) return -1;
for (i = 0; i < Terrains.Size (); i++)
{
if (Terrains[i].Name == name)
{
return (int)i;
}
}
return -1;
}
FName P_GetTerrainName(int terrainnum)
{
if (terrainnum < 0 || terrainnum >= (int)Terrains.Size())
{
return NAME_Null;
}
else
{
return Terrains[terrainnum].Name;
}
}
DEFINE_FIELD_NAMED(FTerrainDef, Name, TerrainName)
DEFINE_FIELD(FTerrainDef, Splash)
DEFINE_FIELD(FTerrainDef, DamageAmount)
DEFINE_FIELD(FTerrainDef, DamageMOD)
DEFINE_FIELD(FTerrainDef, DamageTimeMask)
DEFINE_FIELD(FTerrainDef, FootClip)
DEFINE_FIELD(FTerrainDef, StepVolume)
DEFINE_FIELD(FTerrainDef, WalkStepTics)
DEFINE_FIELD(FTerrainDef, RunStepTics)
DEFINE_FIELD(FTerrainDef, LeftStepSound)
DEFINE_FIELD(FTerrainDef, RightStepSound)
DEFINE_FIELD(FTerrainDef, IsLiquid)
DEFINE_FIELD(FTerrainDef, AllowProtection)
DEFINE_FIELD(FTerrainDef, Friction)
DEFINE_FIELD(FTerrainDef, MoveFactor)
| gpl-3.0 |
pinky39/grove | source/Grove/Core/Events/PermanentModifiedEvent.cs | 305 | namespace Grove.Events
{
using Modifiers;
public class PermanentModifiedEvent
{
public readonly Card Card;
public readonly IModifier Modifier;
public PermanentModifiedEvent(Card card, IModifier modifier)
{
Card = card;
Modifier = modifier;
}
}
} | gpl-3.0 |
mater06/LEGOChimaOnlineReloaded | LoCO Client Files/Decompressed Client/Extracted DLL/System.Web/System/Web/UI/HtmlControls/HtmlInputImage.cs | 10670 | // Decompiled with JetBrains decompiler
// Type: System.Web.UI.HtmlControls.HtmlInputImage
// Assembly: System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: 7E68A73E-4066-4F24-AB0A-F147209F50EC
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Web.dll
using System;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime;
using System.Web;
using System.Web.UI;
namespace System.Web.UI.HtmlControls
{
/// <summary>
/// Allows programmatic access to the HTML <input type= image> element on the server.
/// </summary>
[DefaultEvent("ServerClick")]
[SupportsEventValidation]
public class HtmlInputImage : HtmlInputControl, IPostBackDataHandler, IPostBackEventHandler
{
private static readonly object EventServerClick = new object();
private int _x;
private int _y;
/// <summary>
/// Gets or sets the alignment of the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control in relation to other elements on the Web page.
/// </summary>
///
/// <returns>
/// The alignment of the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control in relation to other elements on the Web page.
/// </returns>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[WebCategory("Appearance")]
[DefaultValue("")]
public string Align
{
get
{
return this.Attributes["align"] ?? string.Empty;
}
set
{
this.Attributes["align"] = HtmlControl.MapStringAttributeToString(value);
}
}
/// <summary>
/// Gets or sets the alternative text that the browser displays if the image is unavailable or has not been downloaded.
/// </summary>
///
/// <returns>
/// The alternative text for the specified image. The default value is an empty string ("").
/// </returns>
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Localizable(true)]
[DefaultValue("")]
[WebCategory("Appearance")]
public string Alt
{
get
{
return this.Attributes["alt"] ?? string.Empty;
}
set
{
this.Attributes["alt"] = HtmlControl.MapStringAttributeToString(value);
}
}
/// <summary>
/// Gets or sets the border width for the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control.
/// </summary>
///
/// <returns>
/// The border width, in pixels, for the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control.
/// </returns>
[DefaultValue(-1)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[WebCategory("Appearance")]
public int Border
{
get
{
string s = this.Attributes["border"];
if (s == null)
return -1;
return int.Parse(s, (IFormatProvider) CultureInfo.InvariantCulture);
}
set
{
this.Attributes["border"] = HtmlControl.MapIntegerAttributeToString(value);
}
}
/// <summary>
/// Gets or sets the location of the image file.
/// </summary>
///
/// <returns>
/// The location of the image file. The default value is an empty string ("").
/// </returns>
[WebCategory("Appearance")]
[UrlProperty]
[DefaultValue("")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Src
{
get
{
return this.Attributes["src"] ?? string.Empty;
}
set
{
this.Attributes["src"] = HtmlControl.MapStringAttributeToString(value);
}
}
/// <summary>
/// Gets or sets a value indicating whether validation is performed when the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control is clicked.
/// </summary>
///
/// <returns>
/// true if validation is performed when the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control is clicked; otherwise, false. The default value is true.
/// </returns>
[WebCategory("Behavior")]
[DefaultValue(true)]
public virtual bool CausesValidation
{
get
{
object obj = this.ViewState["CausesValidation"];
if (obj != null)
return (bool) obj;
return true;
}
set
{
this.ViewState["CausesValidation"] = (object) (bool) (value ? 1 : 0);
}
}
/// <summary>
/// Gets or sets the group of controls for which the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control causes validation when it posts back to the server.
/// </summary>
///
/// <returns>
/// The group of controls for which the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control causes validation when it posts back to the server. The default value is an empty string (""), indicating that this property is not set.
/// </returns>
[DefaultValue("")]
[WebSysDescription("PostBackControl_ValidationGroup")]
[WebCategory("Behavior")]
public virtual string ValidationGroup
{
get
{
return (string) this.ViewState["ValidationGroup"] ?? string.Empty;
}
set
{
this.ViewState["ValidationGroup"] = (object) value;
}
}
/// <summary>
/// Occurs on the server when the user clicks an <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control.
/// </summary>
[WebCategory("Action")]
[WebSysDescription("HtmlInputImage_OnServerClick")]
public event ImageClickEventHandler ServerClick
{
add
{
this.Events.AddHandler(HtmlInputImage.EventServerClick, (Delegate) value);
}
remove
{
this.Events.RemoveHandler(HtmlInputImage.EventServerClick, (Delegate) value);
}
}
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> class.
/// </summary>
public HtmlInputImage()
: base("image")
{
}
/// <summary>
/// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
/// </summary>
/// <param name="e">An <see cref="T:System.EventArgs"/> that contains the event data. </param>
protected internal override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (this.Page == null)
return;
if (!this.Disabled)
this.Page.RegisterRequiresPostBack((Control) this);
if (!this.CausesValidation)
return;
this.Page.RegisterPostBackScript();
}
/// <summary>
/// Raises the <see cref="E:System.Web.UI.HtmlControls.HtmlInputImage.ServerClick"/> event.
/// </summary>
/// <param name="e">An <see cref="T:System.Web.UI.ImageClickEventArgs"/> that contains event data. </param>
protected virtual void OnServerClick(ImageClickEventArgs e)
{
ImageClickEventHandler clickEventHandler = (ImageClickEventHandler) this.Events[HtmlInputImage.EventServerClick];
if (clickEventHandler == null)
return;
clickEventHandler((object) this, e);
}
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
{
this.RaisePostBackEvent(eventArgument);
}
/// <summary>
/// Raises events for the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control when it posts back to the server.
/// </summary>
/// <param name="eventArgument">The argument for the event.</param>
protected virtual void RaisePostBackEvent(string eventArgument)
{
if (this.CausesValidation)
this.Page.Validate(this.ValidationGroup);
this.OnServerClick(new ImageClickEventArgs(this._x, this._y));
}
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
{
return this.LoadPostData(postDataKey, postCollection);
}
/// <summary>
/// Processes the postback data for the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control.
/// </summary>
///
/// <returns>
/// true if the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control's state has changed as a result of the postback; otherwise, false.
/// </returns>
/// <param name="postDataKey">The key identifier for the control.</param><param name="postCollection">The collection of all incoming name values.</param>
protected virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)
{
string s1 = postCollection[this.RenderedNameAttribute + ".x"];
string s2 = postCollection[this.RenderedNameAttribute + ".y"];
if (s1 != null && s2 != null && (s1.Length > 0 && s2.Length > 0))
{
this.ValidateEvent(this.UniqueID);
this._x = int.Parse(s1, (IFormatProvider) CultureInfo.InvariantCulture);
this._y = int.Parse(s2, (IFormatProvider) CultureInfo.InvariantCulture);
this.Page.RegisterRequiresRaiseEvent((IPostBackEventHandler) this);
}
return false;
}
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
void IPostBackDataHandler.RaisePostDataChangedEvent()
{
this.RaisePostDataChangedEvent();
}
/// <summary>
/// Notifies the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control that the state of the control has changed.
/// </summary>
protected virtual void RaisePostDataChangedEvent()
{
}
/// <summary>
/// Renders the <see cref="T:System.Web.UI.HtmlControls.HtmlInputImage"/> control's attributes to the specified <see cref="T:System.Web.UI.HtmlTextWriter"/> object.
/// </summary>
/// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"/> that contains the output stream to render on the client.</param><exception cref="T:System.Web.HttpException">The <see cref="P:System.Web.UI.HtmlControls.HtmlInputImage.Src"/> property contains a malformed URL.</exception>
protected override void RenderAttributes(HtmlTextWriter writer)
{
this.PreProcessRelativeReferenceAttribute(writer, "src");
if (this.Page != null)
Util.WriteOnClickAttribute(writer, (HtmlControl) this, true, false, this.CausesValidation && this.Page.GetValidators(this.ValidationGroup).Count > 0, this.ValidationGroup);
base.RenderAttributes(writer);
}
}
}
| gpl-3.0 |
papamas/DMS-KANGREG-XI-MANADO | src/main/java/com/openkm/frontend/client/bean/GWTToken.java | 3514 | /**
* OpenKM, Open Document Management System (http://www.openkm.com)
* Copyright (c) 2006-2015 Paco Avila & Josep Llort
*
* No bytes were intentionally harmed during the development of this application.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package com.openkm.frontend.client.bean;
import java.util.Collection;
import java.util.Date;
import com.google.gwt.user.client.rpc.IsSerializable;
public class GWTToken implements IsSerializable {
private double id;
private String name;
private boolean suspended;
private GWTToken parent;
private String node;
private Date start;
private Date end;
private Collection<GWTTransition> availableTransitions;
private Collection<GWTWorkflowComment> comments;
private GWTProcessInstance processInstance;
public double getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isSuspended() {
return suspended;
}
public void setSuspended(boolean suspended) {
this.suspended = suspended;
}
public Collection<GWTWorkflowComment> getComments() {
return comments;
}
public void setComments(Collection<GWTWorkflowComment> comments2) {
this.comments = comments2;
}
public GWTToken getParent() {
return parent;
}
public void setParent(GWTToken parent) {
this.parent = parent;
}
public String getNode() {
return node;
}
public void setNode(String node) {
this.node = node;
}
public Date getStart() {
return start;
}
public void setStart(Date start) {
this.start = start;
}
public Date getEnd() {
return end;
}
public void setEnd(Date end) {
this.end = end;
}
public Collection<GWTTransition> getAvailableTransitions() {
return availableTransitions;
}
public void setAvailableTransitions(Collection<GWTTransition> availableTransitions) {
this.availableTransitions = availableTransitions;
}
public GWTProcessInstance getProcessInstance() {
return processInstance;
}
public void setProcessInstance(GWTProcessInstance processInstance) {
this.processInstance = processInstance;
}
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("[");
sb.append("id="); sb.append(id);
sb.append(", name="); sb.append(name);
sb.append(", node="); sb.append(node);
sb.append(", availableTransitions="); sb.append(availableTransitions);
sb.append(", suspended="); sb.append(suspended);
sb.append(", start="); sb.append(start==null?null:start.getTime());
sb.append(", end="); sb.append(end==null?null:end.getTime());
sb.append(", parent="); sb.append(parent);
sb.append(", comments="); sb.append(comments);
sb.append(", processInstance="); sb.append(processInstance);
sb.append("]");
return sb.toString();
}
}
| gpl-3.0 |
MrCrayfish/MrCrayfishSkateboardingMod | src/main/java/com/mrcrayfish/skateboarding/network/message/MessageTrick.java | 1258 | package com.mrcrayfish.skateboarding.network.message;
import io.netty.buffer.ByteBuf;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
import net.minecraftforge.fml.common.network.simpleimpl.MessageContext;
import com.mrcrayfish.skateboarding.api.TrickRegistry;
import com.mrcrayfish.skateboarding.entity.EntitySkateboard;
public class MessageTrick implements IMessage, IMessageHandler<MessageTrick, IMessage>
{
private int entityId;
private int trickId;
public MessageTrick()
{
}
public MessageTrick(int entityId, int trickId)
{
this.entityId = entityId;
this.trickId = trickId;
}
@Override
public void toBytes(ByteBuf buf)
{
buf.writeInt(entityId);
buf.writeInt(trickId);
}
@Override
public void fromBytes(ByteBuf buf)
{
this.entityId = buf.readInt();
this.trickId = buf.readInt();
}
@Override
public IMessage onMessage(MessageTrick message, MessageContext ctx)
{
World world = ctx.getServerHandler().player.world;
EntitySkateboard skateboard = (EntitySkateboard) world.getEntityByID(message.entityId);
skateboard.startTrick(TrickRegistry.getTrick(message.trickId));
return null;
}
}
| gpl-3.0 |
Dax89/harbour-sailorgram | harbour-sailorgram/translations/harbour-sailorgram-ru.ts | 38035 | <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru">
<context>
<name>AboutPage</name>
<message>
<source>About SailorGram</source>
<translation>О SailorGram</translation>
</message>
<message>
<source>Version</source>
<translation>Версия</translation>
</message>
<message>
<source>An unofficial Telegram Client for SailfishOS</source>
<translation>Неофициальное приложение Telegram для Sailfish OS</translation>
</message>
<message>
<source>GitHub Repository</source>
<translation>Репозиторий на GitHub</translation>
</message>
<message>
<source>Report an Issue</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>SailorGram is distributed under the GPLv3 license</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>License</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Developers</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Translations</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Third Party</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AddContactPage</name>
<message>
<source>Add Contact</source>
<translation>Добавить контакт</translation>
</message>
<message>
<source>First Name</source>
<translation>Имя</translation>
</message>
<message>
<source>Last Name</source>
<translation>Фамилия</translation>
</message>
<message>
<source>Telephone Number</source>
<translation>Номер телефона</translation>
</message>
</context>
<context>
<name>AddContactsPage</name>
<message>
<source>Add Chat Member</source>
<translation>Добавить собеседника</translation>
</message>
</context>
<context>
<name>AudioRecorder</name>
<message>
<source>Error : %1</source>
<translation>Ошибка : %1</translation>
</message>
<message>
<source>Recording...</source>
<translation>Запись...</translation>
</message>
<message>
<source>Stopped.</source>
<translation>Остановлено.</translation>
</message>
</context>
<context>
<name>AuthorizationPage</name>
<message>
<source>Sign In</source>
<translation>Войти</translation>
</message>
<message>
<source>Authorization Code</source>
<translation>Код авторизации</translation>
</message>
<message>
<source>You have entered a wrong Authorization Code</source>
<translation>Вы ввели неверный код авторизации</translation>
</message>
<message>
<source>Wait for the SMS containing the activation code and press 'Sign In'</source>
<translation>Дождитесь SMS с кодом активации и нажмите 'Войти'</translation>
</message>
<message>
<source>Resend Activation Code</source>
<translation>Отправить код активации ещё раз</translation>
</message>
<message>
<source>Sending Activation Code</source>
<translation>Отправка кода активации</translation>
</message>
<message>
<source>Exit</source>
<translation>Выйти</translation>
</message>
</context>
<context>
<name>ChangeChatTitle</name>
<message>
<source>Change</source>
<translation>Изменить</translation>
</message>
</context>
<context>
<name>ChangeUsernamePage</name>
<message>
<source>Change</source>
<translation>Изменить</translation>
</message>
<message>
<source>Username</source>
<translation>Юзернейм</translation>
</message>
<message>
<source>You can choose an username on Telegram. If you do, other people may contact you without knowing your phone number.
You can use a-z, 0-9 and underscores.
Minimum length is 5 characters.</source>
<translation>Вы можете выбрать юзернейм для Telegram, после чего другие пользователи могут связаться с Вами не зная номер телефона
Вы можете использовать латинский алфавит, цифры и подчеркивания
Минимальная длина - 5 символов.</translation>
</message>
<message>
<source>This username is already occupied</source>
<translation>Этот юзернейм уже занят</translation>
</message>
</context>
<context>
<name>ChatInfo</name>
<message>
<source>Members</source>
<translation>Участники</translation>
</message>
<message>
<source>Leave group</source>
<translation>Покинуть беседу</translation>
</message>
<message>
<source>Leaving group</source>
<translation>Выход из беседы</translation>
</message>
<message>
<source>Change title</source>
<translation>Изменить название</translation>
</message>
<message>
<source>Add member</source>
<translation>Добавить участника</translation>
</message>
</context>
<context>
<name>ChatInfoMenu</name>
<message>
<source>Remove from Group</source>
<translation>Исключить</translation>
</message>
<message>
<source>Removing from group</source>
<translation>Исключение</translation>
</message>
<message>
<source>Profile</source>
<translation type="unfinished">Профиль</translation>
</message>
</context>
<context>
<name>ChatSettingsPage</name>
<message>
<source>Save</source>
<translation>Сохранить</translation>
</message>
<message>
<source>Send Messages by pressing Return Key</source>
<translation>Отправка сообщений клавишей ввода</translation>
</message>
<message>
<source>Background enabled</source>
<translation>Фон</translation>
</message>
<message>
<source>Chat header visible</source>
<translation>Заголовок диалога</translation>
</message>
<message>
<source>Bubbles visible</source>
<translation>Пузыри сообщений</translation>
</message>
<message>
<source>Bubble opacity</source>
<translation>Прозрачность пузырей сообщений</translation>
</message>
<message>
<source>Keyboard</source>
<translation>Клавиатура</translation>
</message>
<message>
<source>Appearance</source>
<translation>Интерфейс</translation>
</message>
<message>
<source>Bubbles with angle</source>
<translation>Пузыри с уголочком</translation>
</message>
<message>
<source>Open media without waiting</source>
<translation>Открывать файлы при получении</translation>
</message>
<message>
<source>Load images automatically</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConnectingLabel</name>
<message>
<source>Not connected</source>
<translation>Не в сети</translation>
</message>
</context>
<context>
<name>ConnectionPage</name>
<message>
<source>Connecting</source>
<translation>Подключение</translation>
</message>
<message>
<source>Login Again</source>
<translation>Войти ещё раз</translation>
</message>
<message>
<source>Telegram Status</source>
<translation>Состояние Telegram</translation>
</message>
<message>
<source>Error log</source>
<translation>Журнал ошибок</translation>
</message>
<message>
<source>Exit</source>
<translation>Выйти</translation>
</message>
</context>
<context>
<name>ContactsPage</name>
<message>
<source>Add Contact</source>
<translation>Добавить контакт</translation>
</message>
<message>
<source>Contacts</source>
<translation>Контакты</translation>
</message>
<message>
<source>Profile</source>
<translation>Профиль</translation>
</message>
<message>
<source>Settings</source>
<translation>Настройки</translation>
</message>
</context>
<context>
<name>CoverPage</name>
<message>
<source>Disconnected</source>
<translation>Не в сети</translation>
</message>
<message>
<source>Connected</source>
<translation>В сети</translation>
</message>
<message>
<source>Recent chats:</source>
<translation>Недавние диалоги:</translation>
</message>
<message>
<source>Unread
message(s)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CreateChatPage</name>
<message>
<source>Group Name</source>
<translation>Название беседы</translation>
</message>
<message>
<source>New Group</source>
<translation>Создать беседу</translation>
</message>
</context>
<context>
<name>CreateSecretDialogPage</name>
<message>
<source>New Secret Chat</source>
<translation>Создать тайный диалог</translation>
</message>
</context>
<context>
<name>DaemonSettingsPage</name>
<message>
<source>Save</source>
<translation>Сохранить</translation>
</message>
<message>
<source>Keep running</source>
<translation>Фоновый режим</translation>
</message>
<message>
<source>SailorGram keeps running in background even when closed</source>
<translation>SailorGram работает в фоне, даже если закрыт</translation>
</message>
<message>
<source>Autostart</source>
<translation>Автозагрузка</translation>
</message>
<message>
<source>SailorGram starts automatically</source>
<translation>SailorGram запускается автоматически</translation>
</message>
</context>
<context>
<name>DebugSettingsPage</name>
<message>
<source>Error log</source>
<translation>Журнал ошибок</translation>
</message>
<message>
<source>Clear errors</source>
<translation>Очистить ошибки</translation>
</message>
<message>
<source>Deleting errors</source>
<translation>Удаление ошибок</translation>
</message>
<message>
<source>Error log is empty</source>
<translation>Журнал ошибок пуст</translation>
</message>
<message>
<source>Error code:</source>
<translation>Код ошибки:</translation>
</message>
<message>
<source>Function:</source>
<translation>Функция:</translation>
</message>
<message>
<source>Message:</source>
<translation>Сообщение:</translation>
</message>
</context>
<context>
<name>DevelopersPage</name>
<message>
<source>Developers</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Author</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Contributors</source>
<translation type="unfinished">Участники разработки</translation>
</message>
<message>
<source>Icon Designers</source>
<translation type="unfinished">Дизайнеры иконки</translation>
</message>
</context>
<context>
<name>DialogInfoPage</name>
<message>
<source>Delete secret chat</source>
<translation>Удалить тайный диалог</translation>
</message>
<message>
<source>Delete group</source>
<translation>Удалить беседу</translation>
</message>
<message>
<source>Delete conversation</source>
<translation>Удалить диалог</translation>
</message>
<message>
<source>Deleting secret chat</source>
<translation>Удаление тайного диалога</translation>
</message>
<message>
<source>Deleting group</source>
<translation>Удаление беседы</translation>
</message>
<message>
<source>Deleting conversation</source>
<translation>Удаление диалога</translation>
</message>
<message>
<source>Actions</source>
<translation>Действия</translation>
</message>
<message>
<source>Enable notifications</source>
<translation>Включить уведомления</translation>
</message>
<message>
<source>Disable notifications</source>
<translation>Отключить уведомления</translation>
</message>
<message>
<source>Add to contacts</source>
<translation>Добавить в контакты</translation>
</message>
<message>
<source>Chat information</source>
<translation>Информация о чате</translation>
</message>
<message>
<source>Delete channel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Deleting channel</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DialogItem</name>
<message>
<source>You:</source>
<translation type="unfinished">Вы:</translation>
</message>
</context>
<context>
<name>DialogItemMenu</name>
<message>
<source>Delete</source>
<translation>Удалить</translation>
</message>
<message>
<source>Deleting Conversation</source>
<translation>Удаление диалога</translation>
</message>
<message>
<source>Deleting Secret Chat</source>
<translation>Удаление секретного диалога</translation>
</message>
<message>
<source>Deleting Group</source>
<translation>Удаление беседы</translation>
</message>
<message>
<source>Mark as read</source>
<translation>Отметить как прочитанное</translation>
</message>
<message>
<source>Enable notifications</source>
<translation type="unfinished">Включить уведомления</translation>
</message>
<message>
<source>Disable notifications</source>
<translation type="unfinished">Отключить уведомления</translation>
</message>
<message>
<source>Deleting Channel</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DialogPage</name>
<message>
<source>Load more messages</source>
<translation>Загрузить больше сообщений</translation>
</message>
<message>
<source>Cancel selection</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select messages</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Select all</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Clear selection</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Deleting Messages</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DialogReplyPreview</name>
<message>
<source>Reply to</source>
<translation>Ответить</translation>
</message>
<message>
<source>Forward message from</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DialogTextInput</name>
<message>
<source>Message...</source>
<translation>Сообщение...</translation>
</message>
</context>
<context>
<name>DialogsPage</name>
<message>
<source>Chats</source>
<translation>Диалоги</translation>
</message>
<message>
<source>Connecting...</source>
<translation>Подключение...</translation>
</message>
<message>
<source>No Chats
Do a swype to the right to select a contact</source>
<translation>Диалоги отсутствуют
Свайпните вправо, чтобы выбрать контакта</translation>
</message>
<message>
<source>Exit</source>
<translation>Выйти</translation>
</message>
<message>
<source>New Secret Chat</source>
<translation>Создать тайный диалог</translation>
</message>
<message>
<source>New Group</source>
<translation>Создать беседу</translation>
</message>
<message>
<source>Hide Search Field</source>
<translation>Скрыть строку поиска</translation>
</message>
<message>
<source>Show Search Field</source>
<translation>Показать строку поиска</translation>
</message>
</context>
<context>
<name>ForwardContactPage</name>
<message>
<source>Forward to contact</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ForwardDialogPage</name>
<message>
<source>Forward to chat</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MediaPhotoPage</name>
<message>
<source>Save in Gallery</source>
<translation>Сохранить в Галерее</translation>
</message>
<message>
<source>Image saved in Gallery</source>
<translation>Изображение сохранено в галерее</translation>
</message>
</context>
<context>
<name>MediaPlayerToolBar</name>
<message>
<source>Downloading media</source>
<translation>Загрузка медиа</translation>
</message>
<message>
<source>Media saved in Gallery</source>
<translation>Медиа сохранено в Галерее</translation>
</message>
</context>
<context>
<name>MessageAudio</name>
<message>
<source>Duration: %1</source>
<translation>Длительность: %1</translation>
</message>
<message>
<source>Audio recording</source>
<translation>Аудиозапись</translation>
</message>
<message>
<source>Size: %1</source>
<translation>Размер: %1</translation>
</message>
</context>
<context>
<name>MessageItem</name>
<message>
<source>Opening media</source>
<translation>Открытие медиа</translation>
</message>
<message>
<source>Forwarded from %1</source>
<translation>Переслано от %1</translation>
</message>
</context>
<context>
<name>MessageMenu</name>
<message>
<source>Copy</source>
<translation>Скопировать</translation>
</message>
<message>
<source>Message copied to clipboard</source>
<translation>Сообщение скопировано в буфер обмена</translation>
</message>
<message>
<source>Delete</source>
<translation>Удалить</translation>
</message>
<message>
<source>Cancel</source>
<translation>Отменить</translation>
</message>
<message>
<source>Download</source>
<translation>Загрузить</translation>
</message>
<message>
<source>Downloading media</source>
<translation>Загрузка медиа</translation>
</message>
<message>
<source>Install Sticker set</source>
<translation>Установить набор стикеров</translation>
</message>
<message>
<source>Open</source>
<translation>Открыть</translation>
</message>
<message>
<source>Reply</source>
<translation>Ответить</translation>
</message>
<message>
<source>Forward</source>
<translation>Переслать</translation>
</message>
<message>
<source>Add to Telegram</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MessagePreview</name>
<message>
<source>You</source>
<translation>Вы</translation>
</message>
</context>
<context>
<name>MessageSearchItem</name>
<message>
<source>You:</source>
<translation>Вы:</translation>
</message>
</context>
<context>
<name>MessageView</name>
<message>
<source>Deleting message...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PeerProfile</name>
<message>
<source>Group</source>
<translation type="unfinished">Беседа</translation>
</message>
</context>
<context>
<name>PhoneNumberPage</name>
<message>
<source>Next</source>
<translation>Далее</translation>
</message>
<message>
<source>Phone Number</source>
<translation>Номер телефона</translation>
</message>
<message>
<source>Country Code</source>
<translation>Код страны</translation>
</message>
<message>
<source>Insert your phone number and press 'Next'</source>
<translation>Введите свой номер и нажмите 'Далее'</translation>
</message>
<message>
<source>Exit</source>
<translation>Выйти</translation>
</message>
</context>
<context>
<name>ProfilePage</name>
<message>
<source>Change Picture</source>
<translation>Изменить картинку</translation>
</message>
<message>
<source>Phone number</source>
<translation>Номер телефона</translation>
</message>
<message>
<source>Profile</source>
<translation>Профиль</translation>
</message>
<message>
<source>Change Username</source>
<translation>Изменить юзернейм</translation>
</message>
<message>
<source>Actions</source>
<translation>Действия</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<source>Yesterday %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>GIF</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Sticker</source>
<translation type="unfinished">Стикер</translation>
</message>
<message>
<source>Audio</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished">Видео</translation>
</message>
<message>
<source>Document</source>
<translation type="unfinished">Документ</translation>
</message>
<message>
<source>Contact</source>
<translation type="unfinished">Контакт</translation>
</message>
<message>
<source>Photo</source>
<translation type="unfinished">Фото</translation>
</message>
<message>
<source>Location</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Web Page</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unsupported</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Unknown</source>
<translation type="unfinished">Неизвестный</translation>
</message>
</context>
<context>
<name>SailorgramDialogItem</name>
<message>
<source>%1 is typing...</source>
<translation type="unfinished">%1 пишет...</translation>
</message>
<message>
<source>%1 and %2 are typing...</source>
<translation type="unfinished">%1 и %2 пишут...</translation>
</message>
<message>
<source>%1 member(s) are typing...</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Typing...</source>
<translation type="unfinished">Пишет...</translation>
</message>
</context>
<context>
<name>SecretDialogDiscarded</name>
<message>
<source>Secret chat cancelled</source>
<translation>Тайный диалог отменён</translation>
</message>
</context>
<context>
<name>SecretDialogWaiting</name>
<message>
<source>Waiting for %1 to get online</source>
<translation>Ждём появления %1 в сети</translation>
</message>
</context>
<context>
<name>SelectorFilesPage</name>
<message>
<source>Android storage</source>
<translation>Память Android</translation>
</message>
<message>
<source>SD Card</source>
<translation>Карта памяти</translation>
</message>
<message>
<source>Home</source>
<translation>Домой</translation>
</message>
<message>
<source>Back</source>
<translation>Назад</translation>
</message>
<message numerus="yes">
<source>Send %n file(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>Select files</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SelectorImagesPage</name>
<message>
<source>Android storage</source>
<translation>Хранилище Android</translation>
</message>
<message>
<source>SD Card</source>
<translation>Карта памяти</translation>
</message>
<message>
<source>Home</source>
<translation>Домой</translation>
</message>
<message>
<source>Sort ascending</source>
<translation>Сортировать по возрастанию</translation>
</message>
<message>
<source>Sort descending</source>
<translation>Сортировать по убыванию</translation>
</message>
<message>
<source>Sort by name</source>
<translation>Сортировать по имени</translation>
</message>
<message>
<source>Sort by date</source>
<translation>Сортировать по дате</translation>
</message>
<message>
<source>Back</source>
<translation>Назад</translation>
</message>
<message>
<source>Cancel</source>
<translation>Отмена</translation>
</message>
<message numerus="yes">
<source>Send %n image(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
<numerusform></numerusform>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>Select images</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SelectorLocationPage</name>
<message>
<source>Waiting for coordinates...</source>
<translation>Ожидание координат...</translation>
</message>
<message>
<source>Coordinates</source>
<translation>Координаты</translation>
</message>
<message>
<source>lat: %1</source>
<translation>широта: %1</translation>
</message>
<message>
<source>long: %1</source>
<translation>долгота: %1</translation>
</message>
</context>
<context>
<name>SelectorMainPage</name>
<message>
<source>Send file</source>
<translation>Прикрепить</translation>
</message>
<message>
<source>Image from gallery</source>
<translation>Изображение из галереи</translation>
</message>
<message>
<source>Capture photo</source>
<translation>Сделать фото</translation>
</message>
<message>
<source>Record sound</source>
<translation>Аудиосообщение</translation>
</message>
<message>
<source>My location</source>
<translation>Геолокация</translation>
</message>
<message>
<source>Sticker</source>
<translation>Стикер</translation>
</message>
<message>
<source>Browse files</source>
<translation>Файл</translation>
</message>
</context>
<context>
<name>SelectorSoundRecordPage</name>
<message>
<source>%1 sec</source>
<translation>%1 сек</translation>
</message>
<message>
<source>~%1 B</source>
<translation>~%1 B</translation>
</message>
<message>
<source>~%1 KiB</source>
<translation>~%1 KiB</translation>
</message>
<message>
<source>~%1 MiB</source>
<translation>~%1 MiB</translation>
</message>
<message>
<source>~%1 GiB</source>
<translation>~%1 GiB</translation>
</message>
<message>
<source>Start</source>
<translation>Начать</translation>
</message>
<message>
<source>Stop</source>
<translation>Остановить</translation>
</message>
</context>
<context>
<name>SelectorStickerPage</name>
<message>
<source>Send</source>
<translation>Отправить</translation>
</message>
<message>
<source>Select a Sticker Set from below</source>
<translation>Выберите набор стикеров внизу</translation>
</message>
</context>
<context>
<name>SettingsPage</name>
<message>
<source>Settings</source>
<translation>Настройки</translation>
</message>
<message>
<source>Chats</source>
<translation>Диалоги</translation>
</message>
<message>
<source>Debug</source>
<translation>Отладка</translation>
</message>
<message>
<source>Daemon</source>
<translation>Daemon</translation>
</message>
</context>
<context>
<name>SignUpPage</name>
<message>
<source>Sign Up</source>
<translation>Войти</translation>
</message>
<message>
<source>Wait for the SMS containing the activation code and press 'Sign Up'</source>
<translation>Дождитесь SMS с кодом активации и нажмите 'Войти'</translation>
</message>
<message>
<source>First Name</source>
<translation>Имя</translation>
</message>
<message>
<source>Last Name (Optional)</source>
<translation>Фамилия (по желанию)</translation>
</message>
<message>
<source>Exit</source>
<translation>Выйти</translation>
</message>
</context>
<context>
<name>TelegramAction</name>
<message>
<source>%1 has left the group</source>
<translation>%1 покинул беседу</translation>
</message>
<message>
<source>%1 has joined the group</source>
<translation>%1 вступил в беседу</translation>
</message>
<message>
<source>%1 has joined the group via invite link</source>
<translation>%1 вступил в беседу по ссылке</translation>
</message>
<message>
<source>Secret chat created by ��%1��</source>
<translation>��%1�� создал(а) тайный диалог</translation>
</message>
<message>
<source>Group created by ��%1��</source>
<translation>��%1�� создал(а) беседу</translation>
</message>
<message>
<source>Group name changed to ��%1��</source>
<translation>Название беседы изменено на ��%1��</translation>
</message>
<message>
<source>%1 added %2</source>
<translation>%1 создано %2</translation>
</message>
<message>
<source>��%1�� updated group photo</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The group was upgraded to a supergroup</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TelegramHelper</name>
<message>
<source>Unknown</source>
<translation>Неизвестный</translation>
</message>
<message>
<source>Document</source>
<translation>Документ</translation>
</message>
<message>
<source>Contact</source>
<translation>Контакт</translation>
</message>
<message>
<source>Video</source>
<translation>Видео</translation>
</message>
<message>
<source>Photo</source>
<translation>Фото</translation>
</message>
<message>
<source>Sticker</source>
<translation>Стикер</translation>
</message>
<message>
<source>Position</source>
<translation>Позиция</translation>
</message>
<message>
<source>Unsupported media</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>GIF</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Audio recording</source>
<translation type="unfinished">Аудиозапись</translation>
</message>
<message>
<source>Unknown media: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ThirdPartyLabel</name>
<message>
<source>License</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Project Page</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ThirdPartyPage</name>
<message>
<source>Third Party</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The GPLv3 license</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Attribution 4.0 International (CC BY 4.0)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TranslationsPage</name>
<message>
<source>Translation Platform</source>
<translation type="unfinished">Платформа для перевода</translation>
</message>
<message>
<source>Translations</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Coordinators</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Translators</source>
<translation type="unfinished">Переводчики</translation>
</message>
<message>
<source>Reviewers</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserInfo</name>
<message>
<source>Send Message</source>
<translation>Отправить сообщение</translation>
</message>
<message>
<source>Begin Secret Chat</source>
<translation>Начать секретный диалог</translation>
</message>
<message>
<source>Phone Number</source>
<translation>Номер телефона</translation>
</message>
<message>
<source>Actions</source>
<translation>Действия</translation>
</message>
<message>
<source>Copy to clipboard</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>UserMenu</name>
<message>
<source>Send Message</source>
<translation>Отправить сообщение</translation>
</message>
<message>
<source>Profile</source>
<translation>Профиль</translation>
</message>
</context>
</TS>
| gpl-3.0 |
active-citizen/shop.1c | www/local/libs/phpexcel/PHPExcel/Reader/Abstract.php | 6967 | <?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2014 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.8.0, 2014-03-02
*/
/**
* PHPExcel_Reader_Abstract
*
* @category PHPExcel
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
{
/**
* Read data only?
* Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
* or whether it should read both data and formatting
*
* @var boolean
*/
protected $_readDataOnly = FALSE;
/**
* Read charts that are defined in the workbook?
* Identifies whether the Reader should read the definitions for any charts that exist in the workbook;
*
* @var boolean
*/
protected $_includeCharts = FALSE;
/**
* Restrict which sheets should be loaded?
* This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded.
*
* @var array of string
*/
protected $_loadSheetsOnly = NULL;
/**
* PHPExcel_Reader_IReadFilter instance
*
* @var PHPExcel_Reader_IReadFilter
*/
protected $_readFilter = NULL;
protected $_fileHandle = NULL;
/**
* Read data only?
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
* If false (the default) it will read data and formatting.
*
* @return boolean
*/
public function getReadDataOnly() {
return $this->_readDataOnly;
}
/**
* Set read data only
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
* Set to false (the default) to advise the Reader to read both data and formatting for cells.
*
* @param boolean $pValue
*
* @return PHPExcel_Reader_IReader
*/
public function setReadDataOnly($pValue = FALSE) {
$this->_readDataOnly = $pValue;
return $this;
}
/**
* Read charts in workbook?
* If this is true, then the Reader will include any charts that exist in the workbook.
* Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
* If false (the default) it will ignore any charts defined in the workbook file.
*
* @return boolean
*/
public function getIncludeCharts() {
return $this->_includeCharts;
}
/**
* Set read charts in workbook
* Set to true, to advise the Reader to include any charts that exist in the workbook.
* Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
* Set to false (the default) to discard charts.
*
* @param boolean $pValue
*
* @return PHPExcel_Reader_IReader
*/
public function setIncludeCharts($pValue = FALSE) {
$this->_includeCharts = (boolean) $pValue;
return $this;
}
/**
* Get which sheets to load
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
* indicating that all worksheets in the workbook should be loaded.
*
* @return mixed
*/
public function getLoadSheetsOnly()
{
return $this->_loadSheetsOnly;
}
/**
* Set which sheets to load
*
* @param mixed $value
* This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
* If NULL, then it tells the Reader to read all worksheets in the workbook
*
* @return PHPExcel_Reader_IReader
*/
public function setLoadSheetsOnly($value = NULL)
{
$this->_loadSheetsOnly = is_array($value) ?
$value : array($value);
return $this;
}
/**
* Set all sheets to load
* Tells the Reader to load all worksheets from the workbook.
*
* @return PHPExcel_Reader_IReader
*/
public function setLoadAllSheets()
{
$this->_loadSheetsOnly = NULL;
return $this;
}
/**
* Read filter
*
* @return PHPExcel_Reader_IReadFilter
*/
public function getReadFilter() {
return $this->_readFilter;
}
/**
* Set read filter
*
* @param PHPExcel_Reader_IReadFilter $pValue
* @return PHPExcel_Reader_IReader
*/
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
$this->_readFilter = $pValue;
return $this;
}
/**
* Open file for reading
*
* @param string $pFilename
* @throws PHPExcel_Reader_Exception
* @return resource
*/
protected function _openFile($pFilename)
{
// Check if file exists
if (!file_exists($pFilename) || !is_readable($pFilename)) {
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
}
// Open file
$this->_fileHandle = fopen($pFilename, 'r');
if ($this->_fileHandle === FALSE) {
throw new PHPExcel_Reader_Exception("Could not open file " . $pFilename . " for reading.");
}
}
/**
* Can the current PHPExcel_Reader_IReader read the file?
*
* @param string $pFilename
* @return boolean
* @throws PHPExcel_Reader_Exception
*/
public function canRead($pFilename)
{
// Check if file exists
try {
$this->_openFile($pFilename);
} catch (Exception $e) {
return FALSE;
}
$readable = $this->_isValidFormat();
fclose ($this->_fileHandle);
return $readable;
}
}
| gpl-3.0 |
XasWorks/XasCode | Ruby/MQTT/lib/mqtt/base_handler.rb | 9127 |
require 'timeout'
require 'mqtt'
require 'colorize'
require 'xasin_logger'
module MQTT
class BaseHandler
include XasLogger::Mix
# Split a Topic into a Topic-Array
# @param topicName [String] The string topic which to split
# @return [Array<String>] A list of individual topic-branches
# @note This function is mainly used for background processing.
def self.get_topic_split(topicName)
return topicName.scan(/[^\/]+/);
end
# Match a topic string to a topic pattern
# @param receivedTopicString [String] The string (as
# returned by MQTT.get) to compare
# @param topicPattern [Array<String>] The Topic-Array (as
# returned by .get_topic_split) to compare against
# @return [nil, Array<String>] Nil if no match was found.
# An Array of matched wildcard topic branches (can be empty) when
# successfully matched
# @note (see .get_topic_split)
def self.getTopicMatch(receivedTopicString, topicPattern)
receivedTopicList = get_topic_split receivedTopicString;
outputTopicList = Array.new();
return nil unless receivedTopicList.length >= topicPattern.length;
topicPattern.each_index do |i|
if(topicPattern[i] == "+")
outputTopicList << receivedTopicList[i];
elsif(topicPattern[i] == "#")
outputTopicList.concat receivedTopicList[i..-1];
return outputTopicList;
elsif topicPattern[i] != receivedTopicList[i];
return nil;
end
end
return outputTopicList if topicPattern.length == receivedTopicList.length;
return nil;
end
# Call all existing callbacks whose topic-list matches `topic`
def call_interested(topic, data)
topicHasReceivers = false;
@callbackList.each do |h|
tMatch = BaseHandler.getTopicMatch(topic, h.topic_split);
if tMatch
begin
Timeout.timeout(10) {
h.offer(tMatch, data)
}
rescue Timeout::Error
x_loge("Timeout on callback #{h}");
rescue => e
x_logf("Uncaught error on #{h}");
x_logf(e.inspect);
end
topicHasReceivers = true;
end
end
@mqtt.unsubscribe(topic) unless topicHasReceivers;
end
private :call_interested
def queue_packet(data)
return if @destroying
@packetQueueMutex.synchronize {
@packetQueue << data;
if(@packetQueue.size == 999)
x_logf("Packet queue congested, dropping packets!");
end
if(@packetQueue.size > 1000)
@packetQueue.shift
end
@publisherThread.run() if @publisherThreadWaiting;
}
end
private :queue_packet
# @!group Custom subscription handling
# Unregister a subscription. Removes it from the callback list and
# unsubscribes from the topic if no other subscriptions for it are present.
# @param subObject [MQTT::Subscriptions::Subscription]
# The subscription-object to remove
# @return void
def unregister_subscription(subObject)
raise ArgumentError, "Object is not a subscription!" unless subObject.is_a? MQTT::Subscriptions::Subscription
return unless @callbackList.include? subObject;
queue_packet({type: :unsub, topic: subObject.topic});
@callbackList.delete(subObject);
end
# Register a custom subscription, and send a subscription message to the server.
# @param subObject [MQTT::Subscriptions::Subscription]
# An instance of a MQTT Subscription object
# @return void
def register_subscription(subObject)
raise ArgumentError, "Object is not a subscription!" unless subObject.is_a? MQTT::Subscriptions::Subscription
return if @callbackList.include? subObject;
@callbackList << subObject;
queue_packet({type: :sub, topic: subObject.topic, qos: subObject.qos});
end
# @!endgroup
def ensure_clean_start()
@mqttWasStartedClean = @mqtt.clean_session
if @mqttWasStartedClean
begin
@mqtt.connect();
@mqtt.disconnect();
rescue MQTT::Exception
sleep 1;
retry
rescue SocketError, SystemCallError
sleep 5
retry
end
@mqtt.clean_session=false;
end
end
private :ensure_clean_start
def ensure_clean_exit()
if(@mqttWasStartedClean)
x_logi("Logging out.")
begin
Timeout.timeout(3) {
begin
@mqtt.clean_session = true;
@mqtt.disconnect();
@mqtt.connect();
rescue MQTT::Exception, SocketError, SystemCallError
sleep 0.3
retry;
end
}
rescue Timeout::Error
x_loge("Timed out, aborting!");
else
x_logi("Done");
end
end
end
private :ensure_clean_exit
def attempt_packet_publish()
until @packetQueue.empty? do
h = nil;
@packetQueueMutex.synchronize {
h = @packetQueue[0];
}
Timeout.timeout(3) {
if(h[:type] == :sub)
@mqtt.subscribe(h[:topic] => h[:qos]);
elsif(h[:type] == :pub)
@mqtt.publish(h[:topic], h[:data], h[:retain], h[:qos]);
end
}
@packetQueueMutex.synchronize {
@packetQueue.shift();
}
end
end
def mqtt_push_thread
@push_error_count = 0;
loop do
@packetQueueMutex.synchronize {
@publisherThreadWaiting = true;
}
x_logd("Push thread stopping")
sleep 1
x_logd("Push thread active")
@packetQueueMutex.synchronize {
@publisherThreadWaiting = false;
}
break if @destroying
next unless @connected
begin
attempt_packet_publish();
rescue MQTT::Exception, SocketError, SystemCallError, Timeout::Error => e
x_loge("Push error!");
x_loge(e.inspect);
@push_error_count += 1;
if(@push_error_count >= 10)
@mqtt.disconnect();
end
sleep 0.5
else
@push_error_count = 0;
end
end
x_logd("Push thread exited!");
end
private :mqtt_push_thread
def mqtt_resub_thread
loop do
begin
return if @destroying
x_logw("Trying to reconnect...");
Timeout.timeout(4) {
@mqtt.connect()
}
x_logi("Connected!");
@conChangeMutex.synchronize {
@connected = true;
@reconnectCount = 0;
}
@packetQueueMutex.synchronize {
@publisherThread.run() if (@publisherThread && @publisherThreadWaiting)
}
x_logd("Sub thread reading...");
@mqtt.get do |topic, message|
call_interested(topic, message);
end
rescue MQTT::Exception, Timeout::Error, SocketError, SystemCallError
x_loge("Disconnected!") if @connected
@connected = false;
@reconnectCount += 1;
@conChangeMutex.unlock if @conChangeMutex.owned?
@mqtt.clean_session = false;
sleep [0.1, 0.5, 1, 1, 5, 5, 5, 10, 10, 10, 10][@reconnectCount] || 30;
end
end
x_logd("Sub thread exited");
end
private :mqtt_resub_thread
def destroy!()
return if @destroying
@destroying = true;
unless @packetQueue.empty?
x_logd "Finishing sending of MQTT messages ... "
@publisherThread.run() if @publisherThreadWaiting
begin
Timeout.timeout(4) {
until @packetQueue.empty? do
sleep 0.05;
end
}
rescue Timeout::Error
x_logw "Not all messages were published";
else
x_logd "Publish clean finished"
end
end
@publisherThread.run();
@publisherThread.join();
@listenerThread.kill();
@mqtt.disconnect() if @connected
ensure_clean_exit();
x_logi("Fully disconnected!");
end
# Initialize a new MQTT::SubHandler
# The handler immediately connects to the server, and begins receciving and sending.
# @param mqttClient [String, MQTT::Client] Either a URI to connect to, or a MQTT::Client
# The URI can be of the form "mqtts://Password@User:URL:port".
# The MQTT client instance can be fully configured, as specified by the MQTT Gem. It must *not* already be connected!
# @param jsonify [Boolean] Should Hashes and Arrays input into publish_to be converted to JSON?
# This can be useful to have one less .to_json call. Default is true.
# @example Starting the handler
# mqtt = MQTT::SubHandler.new('mqtt.eclipse.org');
# mqtt = MQTT::SubHandler.new(MQTT::Client.new("Your.Client.Opts"))
def initialize(mqttClient, logger: nil, **extra_opts)
@callbackList = Array.new();
if mqttClient.is_a? String
@mqtt = MQTT::Client.new(mqttClient);
@mqtt.clean_session = false unless extra_opts[:client_id].nil?
else
@mqtt = mqttClient;
end
init_x_log("MQTT #{@mqtt.host}", logger);
self.log_level = Logger::INFO;
@conChangeMutex = Mutex.new();
@connected = false;
@reconnectCount = 0;
@mqtt.client_id ||= extra_opts[:client_id] || MQTT::Client.generate_client_id("MQTT_Sub_", 8);
@packetQueue = Array.new();
@packetQueueMutex = Mutex.new();
@publisherThreadWaiting = false;
@subscribedTopics = Hash.new();
@trackerHash = Hash.new();
@listenerThread = Thread.new do
ensure_clean_start();
mqtt_resub_thread();
end
@listenerThread.abort_on_exception = true;
begin
Timeout.timeout(5) {
until(@connected)
sleep 0.1;
end
}
rescue Timeout::Error
x_loge("Broker did not connect!");
end
@publisherThread = Thread.new do
mqtt_push_thread();
end
@publisherThread.abort_on_exception = true;
at_exit {
destroy!()
}
end
end
end
| gpl-3.0 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/enumeration/MediaType.java | 1865 | /*
* Copyright (c) 2004-2016 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.enumeration;
import org.apache.commons.lang3.StringUtils;
/**
* Media type options
*
* @author Stuart
*/
public enum MediaType {
/**
* Movie media type
*/
MOVIE,
/**
* TV Show media type
*/
TV,
/**
* TV Season media type
*/
SEASON,
/**
* TV Episode media type
*/
EPISODE;
/**
* Convert a string into an Enum type
*
* @param mediaType String to convert to enum
* @return enum version of param
* @throws IllegalArgumentException If type is not recognised
*
*/
public static MediaType fromString(String mediaType) {
if (StringUtils.isNotBlank(mediaType)) {
try {
return MediaType.valueOf(mediaType.trim().toUpperCase());
} catch (IllegalArgumentException ex) {
throw new IllegalArgumentException("MediaType " + mediaType + " does not exist.", ex);
}
}
throw new IllegalArgumentException("MediaType must not be null");
}
}
| gpl-3.0 |
magarena/magarena | src/magic/cardBuilder/renderers/TypeLine.java | 4000 | package magic.cardBuilder.renderers;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import magic.awt.MagicFont;
import magic.cardBuilder.CardResource;
import magic.cardBuilder.ResourceManager;
import magic.model.IRenderableCard;
import magic.model.MagicType;
public class TypeLine {
private static final Font cardTypeFont = MagicFont.JaceBelerenBold.get().deriveFont(Font.PLAIN, 16);
private static final Font cardTypeFontSmall = MagicFont.JaceBelerenBold.get().deriveFont(Font.PLAIN, 15);
private static final Font cardTypeFontVerySmall = MagicFont.JaceBelerenBold.get().deriveFont(Font.PLAIN, 14);
private static final Font cardTypeFontSmallest = MagicFont.JaceBelerenBold.get().deriveFont(Font.PLAIN, 13);
private static int padding;
static void drawCardTypeLine(BufferedImage cardImage, IRenderableCard cardDef) {
String cardType = getTypeLine(cardDef);
if (!cardType.isEmpty()) {
Graphics2D g2d = cardImage.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
g2d.setColor(cardDef.isHidden() ? Color.WHITE : Color.BLACK);
g2d.setFont(getFontSize(cardType));
FontMetrics metrics = g2d.getFontMetrics();
int yPos;
if (cardDef.isToken()) {
yPos = cardDef.hasText() ? 359 : 434;
} else if (cardDef.isPlaneswalker() && OracleText.getPlaneswalkerAbilityCount(cardDef) == 4) {
yPos = 266;
} else {
yPos = 301;
}
g2d.drawString(cardType + ' ', 32, yPos + metrics.getAscent() + padding);
g2d.dispose();
}
}
private static Font getFontSize(CharSequence cardType) {
if (cardType.length() > 43) {
padding = 3;
return cardTypeFontSmallest;
}
if (cardType.length() > 39) {
padding = 2;
return cardTypeFontVerySmall;
}
if (cardType.length() > 36) {
padding = 2;
return cardTypeFontSmall;
}
padding = 1;
return cardTypeFont;
}
public static String getTypeLine(IRenderableCard cardDef) {
StringBuilder typeLine = new StringBuilder();
String subtype = cardDef.getSubTypeText();
MagicType.SUPERTYPES.stream().filter(cardDef::hasType).forEach(aSuperType -> typeLine.append(aSuperType).append(' '));
if (cardDef.isToken()) {
typeLine.append("Token ");
}
MagicType.TYPE_ORDER.stream().filter(cardDef::hasType).forEach(aType -> typeLine.append(aType).append(' '));
if (!subtype.isEmpty()) {
typeLine.append("— ");
typeLine.append(subtype.replaceAll(",", ""));
}
return typeLine.toString();
}
public static void drawRarity(BufferedImage cardImage, IRenderableCard cardDef) {
BufferedImage rarity = ResourceManager.getImage(CardResource.common);
if (cardDef.getRarityChar() == 'U') {
rarity = ResourceManager.getImage(CardResource.uncommon);
}
if (cardDef.getRarityChar() == 'R') {
rarity = ResourceManager.getImage(CardResource.rare);
}
if (cardDef.getRarityChar() == 'M') {
rarity = ResourceManager.getImage(CardResource.mythic);
}
Graphics2D g2d = cardImage.createGraphics();
int ypos = 297;
if (cardDef.isPlaneswalker() && OracleText.getPlaneswalkerAbilityCount(cardDef) > 3) {
ypos = 263;
}
if (cardDef.isToken()) {
ypos = cardDef.hasText() ? 356 : 431;
}
int xpos = 322;
g2d.drawImage(rarity, xpos, ypos, null);
}
}
| gpl-3.0 |
ezekielriva/social-network-test | public/js/SocialNet.js | 578 | define(['router'], function(router) {
var initialize = function() {
checkLogin(runApplication);
};
var checkLogin = function(callback) {
var authRequest = $.ajax('/account/authenticated');
authRequest.done(function() { return callback(true) });
authRequest.fail(function() { return callback(false) });
};
var runApplication = function(authenticated) {
if (!authenticated) {
window.location.hash = 'login';
} else {
window.location.hash = 'index';
}
Backbone.history.start();
};
return { initialize: initialize };
});
| gpl-3.0 |
gohdan/DFC | known_files/hashes/core/model/modx/processors/security/group/removeuser.php | 57 | ModX Revolution 2.5.0 = 43379a3e1a691f69fd15f0568fcd2a20
| gpl-3.0 |
chummer5a/chummer5a | Chummer/Forms/EditNotes.cs | 4982 | /* This file is part of Chummer5a.
*
* Chummer5a is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Chummer5a is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Chummer5a. If not, see <http://www.gnu.org/licenses/>.
*
* You can obtain the full source code for Chummer5a at
* https://github.com/chummer5a/chummer5a
*/
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Chummer
{
// We use TextBox because notes are often displayed as TreeNode tooltips, and because TreeNode tooltips
// only support plaintext and not any kind of formatting, frmNotes and Notes items in general have to use
// plaintext instead of RTF or HTML formatted text.
public partial class EditNotes : Form
{
// Set to DPI-based 640 in constructor, needs to be there because of DPI dependency
private static int _intWidth = int.MinValue;
// Set to DPI-based 360 in constructor, needs to be there because of DPI dependency
private static int _intHeight = int.MinValue;
private readonly bool _blnLoading;
private string _strNotes;
private Color _colNotes;
#region Control Events
public EditNotes(string strOldNotes) : this(strOldNotes, ColorManager.HasNotesColor)
{
}
public EditNotes(string strOldNotes, Color colNotes)
{
InitializeComponent();
this.UpdateLightDarkMode();
this.TranslateWinForm();
if (_intWidth <= 0 || _intHeight <= 0)
{
using (Graphics g = CreateGraphics())
{
if (_intWidth <= 0)
_intWidth = (int)(640 * g.DpiX / 96.0f);
if (_intHeight <= 0)
_intHeight = (int)(360 * g.DpiY / 96.0f);
}
}
_blnLoading = true;
Width = _intWidth;
Height = _intHeight;
_blnLoading = false;
txtNotes.Text = _strNotes = strOldNotes.NormalizeLineEndings();
btnColorSelect.Enabled = txtNotes.Text.Length > 0;
_colNotes = colNotes;
if (_colNotes.IsEmpty)
_colNotes = ColorManager.HasNotesColor;
UpdateColorRepresentation();
}
private void txtNotes_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.Escape:
Close();
break;
case Keys.Enter:
{
if (e.Control)
btnOK_Click(sender, e);
break;
}
}
}
private void EditNotes_Resize(object sender, EventArgs e)
{
if (_blnLoading)
return;
_intWidth = Width;
_intHeight = Height;
}
private void EditNotes_Shown(object sender, EventArgs e)
{
txtNotes.Focus();
txtNotes.SelectionLength = 0;
txtNotes.SelectionStart = txtNotes.TextLength;
}
private void btnOK_Click(object sender, EventArgs e)
{
_strNotes = txtNotes.Text;
DialogResult = DialogResult.OK;
}
private void btnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void btnColorSelect_Click(object sender, EventArgs e)
{
_colNotes = colorDialog1.Color; //Selected color is always how it is shown in light mode, use the stored one for it.
DialogResult resNewColor = colorDialog1.ShowDialog();
if (resNewColor == DialogResult.OK)
{
_colNotes = ColorManager.GenerateModeIndependentColor(colorDialog1.Color);
UpdateColorRepresentation();
}
}
private void txtNotes_TextChanged(object sender, EventArgs e)
{
btnColorSelect.Enabled = txtNotes.TextLength > 0;
}
#endregion Control Events
#region Properties
/// <summary>
/// Notes.
/// </summary>
public string Notes => _strNotes;
public Color NotesColor => _colNotes;
#endregion Properties
private void UpdateColorRepresentation()
{
txtNotes.ForeColor = ColorManager.GenerateCurrentModeColor(_colNotes);
}
}
}
| gpl-3.0 |
donatellosantoro/Llunatic | LunaticGUI/gui/src/it/unibas/lunatic/gui/action/ActionWindowDeps.java | 2066 | package it.unibas.lunatic.gui.action;
import it.unibas.lunatic.ContextAwareActionProxy;
import it.unibas.lunatic.IModel;
import it.unibas.lunatic.gui.IViewManager;
import it.unibas.lunatic.gui.R;
import it.unibas.lunatic.gui.model.LoadedScenario;
import java.awt.Component;
import java.awt.event.ActionEvent;
import javax.swing.Action;
import javax.swing.JButton;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.awt.ActionReferences;
import org.openide.awt.ActionRegistration;
import org.openide.util.ImageUtilities;
import org.openide.util.Lookup;
import org.openide.util.NbBundle.Messages;
import org.openide.util.actions.Presenter;
@ActionID(
category = "Window",
id = R.ActionId.SHOW_DEPS)
@ActionRegistration(
displayName = "#CTL_ActionShowDeps",
iconInMenu = false, lazy = false)
@ActionReferences({
@ActionReference(path = "Menu/Window" /*, position = 333 */), // @ActionReference(path = "Toolbars/Window" /*, position = 0*/)
})
@Messages("CTL_ActionShowDeps=Dependencies")
public final class ActionWindowDeps extends ContextAwareActionProxy<LoadedScenario> implements Presenter.Toolbar {
public ActionWindowDeps() {
putValue(Action.NAME, Bundle.CTL_ActionShowDeps());
putValue(Action.SHORT_DESCRIPTION, Bundle.CTL_ActionShowDeps());
putValue(Action.LARGE_ICON_KEY, ImageUtilities.loadImageIcon("it/unibas/lunatic/icons/dep-window.24.png", false));
}
@Override
protected void register() {
super.registerBean(R.Bean.LOADED_SCENARIO, LoadedScenario.class);
}
private IViewManager view = Lookup.getDefault().lookup(IViewManager.class);
@Override
public void actionPerformed(ActionEvent e) {
view.show(R.Window.DEPENDENCIES);
}
@Override
public Component getToolbarPresenter() {
JButton btn = new JButton(this);
btn.setText("");
return btn;
}
@Override
public void onChange(IModel o, LoadedScenario bean) {
super.defaultChange(o, bean);
}
}
| gpl-3.0 |
kryptohash/kryptohash-android | app/src/main/java/com/github/kryptohash/kryptohashj/wallet/BasicKeyChain.java | 23808 | /**
* Copyright 2013 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.kryptohash.kryptohashj.wallet;
import com.github.kryptohash.kryptohashj.core.BloomFilter;
//import com.github.kryptohash.kryptohashj.core.ECKey;
import com.github.kryptohash.kryptohashj.core.Ed25519Key;
import com.github.kryptohash.kryptohashj.crypto.*;
import com.github.kryptohash.kryptohashj.store.UnreadableWalletException;
import com.github.kryptohash.kryptohashj.utils.ListenerRegistration;
import com.github.kryptohash.kryptohashj.utils.Threading;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.protobuf.ByteString;
import org.spongycastle.crypto.params.KeyParameter;
import javax.annotation.Nullable;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Executor;
import java.util.concurrent.locks.ReentrantLock;
import static com.google.common.base.Preconditions.*;
/**
* A {@link KeyChain} that implements the simplest model possible: it can have keys imported into it, and just acts as
* a dumb bag of keys. It will, left to its own devices, always return the same key for usage by the wallet, although
* it will automatically add one to itself if it's empty or if encryption is requested.
*/
public class BasicKeyChain implements EncryptableKeyChain {
private final ReentrantLock lock = Threading.lock("BasicKeyChain");
// Maps used to let us quickly look up a key given data we find in transcations or the block chain.
private final LinkedHashMap<ByteString, Ed25519Key> hashToKeys;
private final LinkedHashMap<ByteString, Ed25519Key> pubkeyToKeys;
@Nullable private final KeyCrypter keyCrypter;
private final CopyOnWriteArrayList<ListenerRegistration<KeyChainEventListener>> listeners;
public BasicKeyChain() {
this(null);
}
public BasicKeyChain(@Nullable KeyCrypter crypter) {
this.keyCrypter = crypter;
hashToKeys = new LinkedHashMap<ByteString, Ed25519Key>();
pubkeyToKeys = new LinkedHashMap<ByteString, Ed25519Key>();
listeners = new CopyOnWriteArrayList<ListenerRegistration<KeyChainEventListener>>();
}
/** Returns the {@link KeyCrypter} in use or null if the key chain is not encrypted. */
@Override
@Nullable
public KeyCrypter getKeyCrypter() {
lock.lock();
try {
return keyCrypter;
} finally {
lock.unlock();
}
}
@Override
public Ed25519Key getKey(@Nullable KeyPurpose ignored) {
lock.lock();
try {
if (hashToKeys.isEmpty()) {
checkState(keyCrypter == null); // We will refuse to encrypt an empty key chain.
final Ed25519Key key = new Ed25519Key();
importKeyLocked(key);
queueOnKeysAdded(ImmutableList.of(key));
}
return hashToKeys.values().iterator().next();
} finally {
lock.unlock();
}
}
@Override
public List<Ed25519Key> getKeys(@Nullable KeyPurpose purpose, int numberOfKeys) {
checkArgument(numberOfKeys > 0);
lock.lock();
try {
if (hashToKeys.size() < numberOfKeys) {
checkState(keyCrypter == null);
List<Ed25519Key> keys = new ArrayList<Ed25519Key>();
for (int i = 0; i < numberOfKeys - hashToKeys.size(); i++) {
keys.add(new Ed25519Key());
}
ImmutableList<Ed25519Key> immutableKeys = ImmutableList.copyOf(keys);
importKeysLocked(immutableKeys);
queueOnKeysAdded(immutableKeys);
}
List<Ed25519Key> keysToReturn = new ArrayList<Ed25519Key>();
int count = 0;
while (hashToKeys.values().iterator().hasNext() && numberOfKeys != count) {
keysToReturn.add(hashToKeys.values().iterator().next());
count++;
}
return keysToReturn;
} finally {
lock.unlock();
}
}
/** Returns a copy of the list of keys that this chain is managing. */
public List<Ed25519Key> getKeys() {
lock.lock();
try {
return new ArrayList<Ed25519Key>(hashToKeys.values());
} finally {
lock.unlock();
}
}
public int importKeys(Ed25519Key... keys) {
return importKeys(ImmutableList.copyOf(keys));
}
public int importKeys(List<? extends Ed25519Key> keys) {
lock.lock();
try {
// Check that if we're encrypted, the keys are all encrypted, and if we're not, that none are.
// We are NOT checking that the actual password matches here because we don't have access to the password at
// this point: if you screw up and import keys with mismatched passwords, you lose! So make sure the
// password is checked first.
for (Ed25519Key key : keys) {
checkKeyEncryptionStateMatches(key);
}
List<Ed25519Key> actuallyAdded = new ArrayList<Ed25519Key>(keys.size());
for (final Ed25519Key key : keys) {
if (hasKey(key))
continue;
actuallyAdded.add(key);
importKeyLocked(key);
}
if (actuallyAdded.size() > 0)
queueOnKeysAdded(actuallyAdded);
return actuallyAdded.size();
} finally {
lock.unlock();
}
}
private void checkKeyEncryptionStateMatches(Ed25519Key key) {
if (keyCrypter == null && key.isEncrypted())
throw new KeyCrypterException("Key is encrypted but chain is not");
else if (keyCrypter != null && !key.isEncrypted())
throw new KeyCrypterException("Key is not encrypted but chain is");
else if (keyCrypter != null && key.getKeyCrypter() != null && !key.getKeyCrypter().equals(keyCrypter))
throw new KeyCrypterException("Key encrypted under different parameters to chain");
}
private void importKeyLocked(Ed25519Key key) {
pubkeyToKeys.put(ByteString.copyFrom(key.getPubKey()), key);
hashToKeys.put(ByteString.copyFrom(key.getPubKeyHash()), key);
}
private void importKeysLocked(List<Ed25519Key> keys) {
for (Ed25519Key key : keys) {
importKeyLocked(key);
}
}
/**
* Imports a key to the key chain. If key is present in the key chain, ignore it.
*/
public void importKey(Ed25519Key key) {
lock.lock();
try {
checkKeyEncryptionStateMatches(key);
if (hasKey(key)) return;
importKeyLocked(key);
queueOnKeysAdded(ImmutableList.of(key));
} finally {
lock.unlock();
}
}
public Ed25519Key findKeyFromPubHash(byte[] pubkeyHash) {
lock.lock();
try {
return hashToKeys.get(ByteString.copyFrom(pubkeyHash));
} finally {
lock.unlock();
}
}
public Ed25519Key findKeyFromPubKey(byte[] pubkey) {
lock.lock();
try {
return pubkeyToKeys.get(ByteString.copyFrom(pubkey));
} finally {
lock.unlock();
}
}
@Override
public boolean hasKey(Ed25519Key key) {
return findKeyFromPubKey(key.getPubKey()) != null;
}
@Override
public int numKeys() {
return pubkeyToKeys.size();
}
/**
* Removes the given key from the keychain. Be very careful with this - losing a private key <b>destroys the
* money associated with it</b>.
* @return Whether the key was removed or not.
*/
public boolean removeKey(Ed25519Key key) {
lock.lock();
try {
boolean a = hashToKeys.remove(ByteString.copyFrom(key.getPubKeyHash())) != null;
boolean b = pubkeyToKeys.remove(ByteString.copyFrom(key.getPubKey())) != null;
checkState(a == b); // Should be in both maps or neither.
return a;
} finally {
lock.unlock();
}
}
@Override
public long getEarliestKeyCreationTime() {
lock.lock();
try {
long time = Long.MAX_VALUE;
for (Ed25519Key key : hashToKeys.values())
time = Math.min(key.getCreationTimeSeconds(), time);
return time;
} finally {
lock.unlock();
}
}
public List<ListenerRegistration<KeyChainEventListener>> getListeners() {
return new ArrayList<ListenerRegistration<KeyChainEventListener>>(listeners);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Serialization support
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Map<Ed25519Key, Protos.Key.Builder> serializeToEditableProtobufs() {
Map<Ed25519Key, Protos.Key.Builder> result = new LinkedHashMap<Ed25519Key, Protos.Key.Builder>();
for (Ed25519Key ecKey : hashToKeys.values()) {
Protos.Key.Builder protoKey = serializeEncryptableItem(ecKey);
protoKey.setPublicKey(ByteString.copyFrom(ecKey.getPubKey()));
result.put(ecKey, protoKey);
}
return result;
}
@Override
public List<Protos.Key> serializeToProtobuf() {
Collection<Protos.Key.Builder> builders = serializeToEditableProtobufs().values();
List<Protos.Key> result = new ArrayList<Protos.Key>(builders.size());
for (Protos.Key.Builder builder : builders) result.add(builder.build());
return result;
}
/*package*/ static Protos.Key.Builder serializeEncryptableItem(EncryptableItem item) {
Protos.Key.Builder proto = Protos.Key.newBuilder();
proto.setCreationTimestamp(item.getCreationTimeSeconds() * 1000);
if (item.isEncrypted() && item.getEncryptedData() != null) {
// The encrypted data can be missing for an "encrypted" key in the case of a deterministic wallet for
// which the leaf keys chain to an encrypted parent and rederive their private keys on the fly. In that
// case the caller in DeterministicKeyChain will take care of setting the type.
EncryptedData data = item.getEncryptedData();
proto.getEncryptedDataBuilder()
.setEncryptedPrivateKey(ByteString.copyFrom(data.encryptedBytes))
.setInitialisationVector(ByteString.copyFrom(data.initialisationVector));
// We don't allow mixing of encryption types at the moment.
checkState(item.getEncryptionType() == Protos.Wallet.EncryptionType.ENCRYPTED_SCRYPT_AES);
proto.setType(Protos.Key.Type.ENCRYPTED_SCRYPT_AES);
} else {
final byte[] secret = item.getSecretBytes();
// The secret might be missing in the case of a watching wallet, or a key for which the private key
// is expected to be rederived on the fly from its parent.
if (secret != null)
proto.setSecretBytes(ByteString.copyFrom(secret));
proto.setType(Protos.Key.Type.ORIGINAL);
}
return proto;
}
/**
* Returns a new BasicKeyChain that contains all basic, ORIGINAL type keys extracted from the list. Unrecognised
* key types are ignored.
*/
public static BasicKeyChain fromProtobufUnencrypted(List<Protos.Key> keys) throws UnreadableWalletException {
BasicKeyChain chain = new BasicKeyChain();
chain.deserializeFromProtobuf(keys);
return chain;
}
/**
* Returns a new BasicKeyChain that contains all basic, ORIGINAL type keys and also any encrypted keys extracted
* from the list. Unrecognised key types are ignored.
* @throws com.github.kryptohash.kryptohashj.store.UnreadableWalletException.BadPassword if the password doesn't seem to match
* @throws com.github.kryptohash.kryptohashj.store.UnreadableWalletException if the data structures are corrupted/inconsistent
*/
public static BasicKeyChain fromProtobufEncrypted(List<Protos.Key> keys, KeyCrypter crypter) throws UnreadableWalletException {
BasicKeyChain chain = new BasicKeyChain(checkNotNull(crypter));
chain.deserializeFromProtobuf(keys);
return chain;
}
private void deserializeFromProtobuf(List<Protos.Key> keys) throws UnreadableWalletException {
lock.lock();
try {
checkState(hashToKeys.isEmpty(), "Tried to deserialize into a non-empty chain");
for (Protos.Key key : keys) {
if (key.getType() != Protos.Key.Type.ORIGINAL && key.getType() != Protos.Key.Type.ENCRYPTED_SCRYPT_AES)
continue;
boolean encrypted = key.getType() == Protos.Key.Type.ENCRYPTED_SCRYPT_AES;
byte[] priv = key.hasSecretBytes() ? key.getSecretBytes().toByteArray() : null;
if (!key.hasPublicKey())
throw new UnreadableWalletException("Public key missing");
byte[] pub = key.getPublicKey().toByteArray();
Ed25519Key ecKey;
if (encrypted) {
checkState(keyCrypter != null, "This wallet is encrypted but encrypt() was not called prior to deserialization");
if (!key.hasEncryptedData())
throw new UnreadableWalletException("Encrypted private key data missing");
Protos.EncryptedData proto = key.getEncryptedData();
EncryptedData e = new EncryptedData(proto.getInitialisationVector().toByteArray(),
proto.getEncryptedPrivateKey().toByteArray());
ecKey = Ed25519Key.fromEncrypted(e, keyCrypter, pub);
} else {
if (priv != null)
ecKey = Ed25519Key.fromPrivateAndPublic(priv, pub);
else
ecKey = Ed25519Key.fromPublicOnly(pub);
}
ecKey.setCreationTimeSeconds((key.getCreationTimestamp() + 500) / 1000);
importKeyLocked(ecKey);
}
} finally {
lock.unlock();
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Event listener support
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Override
public void addEventListener(KeyChainEventListener listener) {
addEventListener(listener, Threading.USER_THREAD);
}
@Override
public void addEventListener(KeyChainEventListener listener, Executor executor) {
listeners.add(new ListenerRegistration<KeyChainEventListener>(listener, executor));
}
@Override
public boolean removeEventListener(KeyChainEventListener listener) {
return ListenerRegistration.removeFromList(listener, listeners);
}
private void queueOnKeysAdded(final List<Ed25519Key> keys) {
checkState(lock.isHeldByCurrentThread());
for (final ListenerRegistration<KeyChainEventListener> registration : listeners) {
registration.executor.execute(new Runnable() {
@Override
public void run() {
registration.listener.onKeysAdded(keys);
}
});
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Encryption support
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Convenience wrapper around {@link #toEncrypted(com.github.kryptohash.kryptohashj.crypto.KeyCrypter,
* org.spongycastle.crypto.params.KeyParameter)} which uses the default Scrypt key derivation algorithm and
* parameters, derives a key from the given password and returns the created key.
*/
@Override
public BasicKeyChain toEncrypted(CharSequence password) {
checkNotNull(password);
checkArgument(password.length() > 0);
KeyCrypter scrypt = new KeyCrypterScrypt();
KeyParameter derivedKey = scrypt.deriveKey(password);
return toEncrypted(scrypt, derivedKey);
}
/**
* Encrypt the wallet using the KeyCrypter and the AES key. A good default KeyCrypter to use is
* {@link com.github.kryptohash.kryptohashj.crypto.KeyCrypterScrypt}.
*
* @param keyCrypter The KeyCrypter that specifies how to encrypt/ decrypt a key
* @param aesKey AES key to use (normally created using KeyCrypter#deriveKey and cached as it is time consuming
* to create from a password)
* @throws KeyCrypterException Thrown if the wallet encryption fails. If so, the wallet state is unchanged.
*/
@Override
public BasicKeyChain toEncrypted(KeyCrypter keyCrypter, KeyParameter aesKey) {
lock.lock();
try {
checkNotNull(keyCrypter);
checkState(this.keyCrypter == null, "Key chain is already encrypted");
BasicKeyChain encrypted = new BasicKeyChain(keyCrypter);
for (Ed25519Key key : hashToKeys.values()) {
Ed25519Key encryptedKey = key.encrypt(keyCrypter, aesKey);
// Check that the encrypted key can be successfully decrypted.
// This is done as it is a critical failure if the private key cannot be decrypted successfully
// (all bitcoin controlled by that private key is lost forever).
// For a correctly constructed keyCrypter the encryption should always be reversible so it is just
// being as cautious as possible.
if (!Ed25519Key.encryptionIsReversible(key, encryptedKey, keyCrypter, aesKey))
throw new KeyCrypterException("The key " + key.toString() + " cannot be successfully decrypted after encryption so aborting wallet encryption.");
encrypted.importKeyLocked(encryptedKey);
}
return encrypted;
} finally {
lock.unlock();
}
}
@Override
public BasicKeyChain toDecrypted(CharSequence password) {
checkNotNull(keyCrypter, "Wallet is already decrypted");
KeyParameter aesKey = keyCrypter.deriveKey(password);
return toDecrypted(aesKey);
}
@Override
public BasicKeyChain toDecrypted(KeyParameter aesKey) {
lock.lock();
try {
checkState(keyCrypter != null, "Wallet is already decrypted");
// Do an up-front check.
if (numKeys() > 0 && !checkAESKey(aesKey))
throw new KeyCrypterException("Password/key was incorrect.");
BasicKeyChain decrypted = new BasicKeyChain();
for (Ed25519Key key : hashToKeys.values()) {
decrypted.importKeyLocked(key.decrypt(aesKey));
}
return decrypted;
} finally {
lock.unlock();
}
}
/**
* Returns whether the given password is correct for this key chain.
* @throws IllegalStateException if the chain is not encrypted at all.
*/
@Override
public boolean checkPassword(CharSequence password) {
checkNotNull(password);
checkState(keyCrypter != null, "Key chain not encrypted");
return checkAESKey(keyCrypter.deriveKey(password));
}
/**
* Check whether the AES key can decrypt the first encrypted key in the wallet.
*
* @return true if AES key supplied can decrypt the first encrypted private key in the wallet, false otherwise.
*/
@Override
public boolean checkAESKey(KeyParameter aesKey) {
lock.lock();
try {
// If no keys then cannot decrypt.
if (hashToKeys.isEmpty()) return false;
checkState(keyCrypter != null, "Key chain is not encrypted");
// Find the first encrypted key in the wallet.
Ed25519Key first = null;
for (Ed25519Key key : hashToKeys.values()) {
if (key.isEncrypted()) {
first = key;
break;
}
}
checkState(first != null, "No encrypted keys in the wallet");
try {
Ed25519Key rebornKey = first.decrypt(aesKey);
return Arrays.equals(first.getPubKey(), rebornKey.getPubKey());
} catch (KeyCrypterException e) {
// The AES key supplied is incorrect.
return false;
}
} finally {
lock.unlock();
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Bloom filtering support
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@Override
public BloomFilter getFilter(int size, double falsePositiveRate, long tweak) {
lock.lock();
try {
BloomFilter filter = new BloomFilter(size, falsePositiveRate, tweak);
for (Ed25519Key key : hashToKeys.values())
filter.insert(key);
return filter;
} finally {
lock.unlock();
}
}
@Override
public int numBloomFilterEntries() {
return numKeys() * 2;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Key rotation support
//
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** Returns the first ECKey created after the given UNIX time, or null if there is none. */
@Nullable
public Ed25519Key findOldestKeyAfter(long timeSecs) {
lock.lock();
try {
Ed25519Key oldest = null;
for (Ed25519Key key : hashToKeys.values()) {
final long keyTime = key.getCreationTimeSeconds();
if (keyTime > timeSecs) {
if (oldest == null || oldest.getCreationTimeSeconds() > keyTime)
oldest = key;
}
}
return oldest;
} finally {
lock.unlock();
}
}
/** Returns a list of all ECKeys created after the given UNIX time. */
public List<Ed25519Key> findKeysBefore(long timeSecs) {
lock.lock();
try {
List<Ed25519Key> results = Lists.newLinkedList();
for (Ed25519Key key : hashToKeys.values()) {
final long keyTime = key.getCreationTimeSeconds();
if (keyTime < timeSecs) {
results.add(key);
}
}
return results;
} finally {
lock.unlock();
}
}
}
| gpl-3.0 |
muxiaobai/OOAD | task3/SSH/src/main/java/DaoImpl/BaseDaoImpl.java | 5444 | package DaoImpl;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import Dao.BaseDao;
/**
* BaseDaoImpl:基类实现类,implements BaseDao
*
* @author zhang
* @date 2016年5月21日 下午7:03:54
* @doing 基本的方法实现CRUD
* @param <T>Model泛型
*/
@SuppressWarnings({ "unchecked", "rawtypes" ,"unused"})
public class BaseDaoImpl<T> implements BaseDao<T> {
// DAO组件进行持久化操作底层依赖的SessionFactory组件
protected SessionFactory sessionFactory;
private Class clazz;
private String hql;
public BaseDaoImpl() {
// 获取子类对象
// System.out.println(this);
// 获取子类类信息
// System.out.println(this.getClass());
// 获取子类的直接父类,如果父类有参数类型可以同时获取到父类的参数类型
// System.out.println(this.getClass().getGenericSuperclass());
// 获取参数类型的参数,返回参数类型的数组
// System.out.println(((ParameterizedType)
// this.getClass().getGenericSuperclass()).getActualTypeArguments()[0]);
// 把参数类型转化为具体的Class类型
this.clazz = (Class) ((ParameterizedType) this.getClass().getGenericSuperclass()).getActualTypeArguments()[0];
this.hql = "from " + this.clazz.getName();
}
/**
* 依赖注入SessionFactory所需的setter方法
*
* @param sessionFactory
*/
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
/**
* 取得Session.
*
* @return CurrentSession
*/
public Session getSession() {
try {
return this.sessionFactory.getCurrentSession();
} catch (HibernateException e) {
return sessionFactory.openSession();
}
//return this.sessionFactory.getCurrentSession();
}
public void flush(){
this.getSession().flush();
}
public void clear(){
this.getSession().clear();
}
@Override
public Serializable save(T entity) {
// Transaction transaction=this.getSession().beginTransaction();
return this.getSession().save(entity);
// transaction.commit();
}
@Override
public void delete(Integer id) {
this.getSession().delete(id);
}
@Override
public void update(T entity) {
this.getSession().update(entity);
}
@Override
public T findById(Integer id) {
return (T) this.getSession().get(clazz, id);
}
@Override
public List<T> findAll() {
List<T> result = this.getSession().createQuery("FROM " + clazz.getName()).list();
return result;
}
/**
* 获取实体总数
* @param entityClazz
* @return long 该表中的数量
*/
@Override
public long findCount(Class<T> entityClazz) {
List<?> l = findByHql("select count(*) from " + entityClazz.getSimpleName());
// 返回查询得到的实体总数
if (l != null && l.size() == 1) {
return (Long) l.get(0);
}
return 0;
}
/**
* 根据HQL语句查询实体(不带参数)
*
* @param hql语句
* @return List集合包括要显示的数据
*/
@Override
public List<T> findByHql(String hql) {
return (List<T>) this.getSession().createQuery(hql).list();
}
/**
* 根据带占位符参数HQL语句查询实体(带参数的)
*
* @param hql
* @param params
* @return List集合包括要显示的数据
*/
@Override
public List<T> findByHql(String hql, Object... params) {
// 创建查询
Query query = this.getSession().createQuery(hql);
// 为包含占位符的HQL语句设置参数
for (int i = 0, len = params.length; i < len; i++) {
query.setParameter(i + "", params[i]);
}
return (List<T>) query.list();
}
/**
* 根据SQL语句查询实体(不带参数)
*
* @param sql语句
* @return List集合包括要显示的数据
*/
@Override
public List<T> findBySql(String sql) {
return (List<T>) this.getSession().createSQLQuery(sql).list();
}
/**
* 根据带占位符参数SQL语句查询实体(带参数的)
*
* @param sql
* @param params
* @return List集合包括要显示的数据
*/
@Override
public List<T> findBySql(String sql, Object... params) {
// 创建查询
Query query = this.getSession().createSQLQuery(sql);
// 为包含占位符的HQL语句设置参数
for (int i = 0, len = params.length; i < len; i++) {
query.setParameter(i + "", params[i]);
}
return (List<T>) query.list();
}
/**
* 根据HQL语句分页查询实体(不带参数)
* @param hql
* @param pageNo当前第几页数据
* @param pageSize每页显示多少条记录
* @return List集合包括要显示的数据
*/
public List<T> findByPage(String hql, int pageNo, int pageSize) {
return this.getSession().createQuery(hql).setFirstResult((pageNo - 1) * pageSize).setMaxResults(pageSize).list();
}
/**
* 根据带占位符参数HQL语句分页查询实体(带参数的)
* @param hql
* @param pageNo当前第几页数据
* @param pageSize每页显示多少条记录
* @return List集合包括要显示的数据
*/
@Override
public List<T> findByPage(String hql, int pageNo, int pageSize, Object... params) {
Query query = this.getSession().createQuery(hql);
// 为包含占位符的HQL语句设置参数
for (int i = 0, len = params.length; i < len; i++) {
query.setParameter(i + "", params[i]);
}
return query.setFirstResult((pageNo - 1) * pageSize).setMaxResults(pageSize).list();
}
}
| gpl-3.0 |
tjgillies/ThinkUp | webapp/_lib/controller/class.AccountConfigurationController.php | 4068 | <?php
/**
*
* ThinkUp/webapp/_lib/controller/class.AccountConfigurationController.php
*
* Copyright (c) 2009-2010 Gina Trapani
*
* LICENSE:
*
* This file is part of ThinkUp (http://thinkupapp.com).
*
* ThinkUp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any
* later version.
*
* ThinkUp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with ThinkUp. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* AccountConfiguration Controller
*
* @license http://www.gnu.org/licenses/gpl.html
* @copyright 2009-2010 Gina Trapani
* @author Gina Trapani <ginatrapani[at]gmail[dot]com>
*
*/
class AccountConfigurationController extends ThinkUpAuthController {
/**
* Constructor
* @param bool $session_started
* @return AccountConfigurationController
*/
public function __construct($session_started=false) {
parent::__construct($session_started);
$this->disableCaching();
$this->setViewTemplate('account.index.tpl');
$this->setPageTitle('Configure Your Account');
}
public function authControl() {
$webapp = Webapp::getInstance();
$owner_dao = DAOFactory::getDAO('OwnerDAO');
$owner = $owner_dao->getByEmail($this->getLoggedInUser());
$this->addToView('owner', $owner);
/* Begin plugin-specific configuration handling */
if (isset($_GET['p'])) {
// add config js to header
if($this->isAdmin()) {
$this->addHeaderJavaScript('assets/js/plugin_options.js');
}
$active_plugin = $_GET['p'];
$pobj = $webapp->getPluginObject($active_plugin);
$p = new $pobj;
$this->addToView('body', $p->renderConfiguration($owner));
$profiler = Profiler::getInstance();
$profiler->clearLog();
} else {
$pld = DAOFactory::getDAO('PluginDAO');
$config = Config::getInstance();
$installed_plugins = $pld->getInstalledPlugins($config->getValue("source_root_path"));
$this->addToView('installed_plugins', $installed_plugins);
}
/* End plugin-specific configuration handling */
if (isset($_POST['changepass']) && $_POST['changepass'] == 'Change password' && isset($_POST['oldpass'])
&& isset($_POST['pass1']) && isset($_POST['pass2'])) {
$origpass = $owner_dao->getPass($this->getLoggedInUser());
if (!$this->app_session->pwdCheck($_POST['oldpass'], $origpass)) {
$this->addErrorMessage("Old password does not match or empty.");
} elseif ($_POST['pass1'] != $_POST['pass2']) {
$this->addErrorMessage("New passwords did not match. Your password has not been changed.");
} elseif (strlen($_POST['pass1']) < 5) {
$this->addErrorMessage("New password must be at least 5 characters. ".
"Your password has not been changed." );
} else {
$cryptpass = $this->app_session->pwdcrypt($_POST['pass1']);
$owner_dao->updatePassword($this->getLoggedInUser(), $cryptpass);
$this->addSuccessMessage("Your password has been updated.");
}
}
if ($owner->is_admin) {
$instance_dao = DAOFactory::getDAO('InstanceDAO');
$owners = $owner_dao->getAllOwners();
foreach ($owners as $o) {
$instances = $instance_dao->getByOwner($o, true);
$o->setInstances($instances);
}
$this->addToView('owners', $owners);
}
return $this->generateView();
}
}
| gpl-3.0 |
HenryHu/Turpial | turpial/ui/qt/webview.py | 11411 | # -*- coding: utf-8 -*-
# Qt widget to show statusesin Turpial using a QWebView
import re
import os
from jinja2 import Template
from PyQt4.QtWebKit import QWebView
from PyQt4.QtWebKit import QWebPage
from PyQt4.QtWebKit import QWebSettings
from PyQt4.QtCore import Qt
from PyQt4.QtCore import pyqtSignal
from turpial.ui.lang import i18n
from libturpial.common import is_preview_service_supported
class StatusesWebView(QWebView):
link_clicked = pyqtSignal(str)
hashtag_clicked = pyqtSignal(str)
profile_clicked = pyqtSignal(str)
cmd_clicked = pyqtSignal(str)
EMPTY_PAGE = '<html><head></head><body></body></html>'
def __init__(self, base, column_id):
QWebView.__init__(self)
self.base = base
self.column_id = column_id
self.linkClicked.connect(self.__element_clicked)
page = self.page()
page.setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
page.settings().setAttribute(QWebSettings.DeveloperExtrasEnabled, True)
if not self.base.debug:
self.setContextMenuPolicy(Qt.NoContextMenu)
self.setPage(page)
self.setHtml(self.EMPTY_PAGE)
self.status_template = self.__load_template('status.html')
self.load_style()
self.show()
def __element_clicked(self, qurl):
try:
url = str(qurl.toString())
except UnicodeEncodeError:
return
if url.startswith('http'):
self.link_clicked.emit(url)
elif url.startswith('hashtag'):
hashtag = "#%s" % url.split(':')[2]
self.hashtag_clicked.emit(hashtag)
elif url.startswith('profile'):
self.profile_clicked.emit(url.split(':')[1])
elif url.startswith('cmd'):
self.cmd_clicked.emit(url.split('cmd:')[1])
def __load_template(self, name):
path = os.path.join(self.base.templates_path, name)
fd = open(path)
content = fd.read()
fd.close()
return Template(content)
def __load_stylesheet(self):
attrs = {
'mark_protected': os.path.join(self.base.images_path, 'mark-protected.png'),
'mark_favorited': os.path.join(self.base.images_path, 'mark-favorited2.png'),
'mark_repeated': os.path.join(self.base.images_path, 'mark-repeated2.png'),
'mark_reposted': os.path.join(self.base.images_path, 'mark-reposted.png'),
'mark_verified': os.path.join(self.base.images_path, 'mark-verified.png'),
'action_reply': os.path.join(self.base.images_path, 'action-reply.png'),
'action_reply_direct': os.path.join(self.base.images_path, 'action-reply-direct.png'),
'action_repeat': os.path.join(self.base.images_path, 'action-repeat.png'),
'action_quote': os.path.join(self.base.images_path, 'action-quote.png'),
'action_favorite': os.path.join(self.base.images_path, 'action-favorite.png'),
'action_reply_shadowed': os.path.join(self.base.images_path, 'action-reply-shadowed.png'),
'action_reply_direct_shadowed': os.path.join(self.base.images_path, 'action-reply-direct-shadowed.png'),
'action_repeat_shadowed': os.path.join(self.base.images_path, 'action-repeat-shadowed.png'),
'action_quote_shadowed': os.path.join(self.base.images_path, 'action-quote-shadowed.png'),
'action_favorite_shadowed': os.path.join(self.base.images_path, 'action-favorite-shadowed.png'),
'action_delete': os.path.join(self.base.images_path, 'action-delete.png'),
'action_delete_shadowed': os.path.join(self.base.images_path, 'action-delete-shadowed.png'),
'scrollbar_background_color': self.base.theme['scrollbar']['background_color'],
'scrollbar_border_color': self.base.theme['scrollbar']['border_color'],
'scrollbar_handler_color': self.base.theme['scrollbar']['handler_color'],
'status_background_color': self.base.theme['status']['background_color'],
'quote_background_color': self.base.theme['status']['quote_background_color'],
'status_border_color': self.base.theme['status']['border_color'],
'status_text_color': self.base.theme['status']['text_color'],
'username_text_color': self.base.theme['status']['username']['text_color'],
'username_hover_text_color': self.base.theme['status']['username']['hover_text_color'],
'entities_text_color': self.base.theme['entities']['text_color'],
'entities_hover_text_color': self.base.theme['entities']['hover_text_color'],
'footer_text_color': self.base.theme['footer']['text_color'],
'footer_hover_text_color': self.base.theme['footer']['hover_text_color'],
'conversation_background_color': self.base.theme['conversation']['background_color'],
'message_font_size': self.base.get_message_font_size(),
'footer_font_size': self.base.get_footer_font_size(),
'alert_font_size': self.base.get_alert_font_size(),
'username_font_size': self.base.get_username_font_size(),
}
stylesheet = self.__load_template('style.css')
return stylesheet.render(attrs)
def __render_status(self, status, with_conversation=True):
repeated_by = None
conversation_id = None
view_conversation = None
hide_conversation = None
message = status.text
message = message.replace('\n', '<br/>')
message = message.replace('\'', ''')
timestamp = self.base.humanize_timestamp(status.timestamp)
timestamp = timestamp.replace(' ', '')
quote_username = None
quote_message = None
media = []
if status.entities:
# Highlight URLs
for url in status.entities['urls']:
pretty_url = "<a href='%s' title='%s'>%s</a>" % (url.url, url.url, url.display_text)
message = message.replace(url.search_for, pretty_url)
# Removed inline preview for instagram
if is_preview_service_supported(url.url) and self.base.core.get_inline_preview():
if url.url.find('instagram') < 0:
media.append(url.url)
if status.is_quote_status and status.quoted_status:
quote_username = status.quoted_status.username
quote_message = status.quoted_status.text
# Highlight hashtags
sorted_hashtags = {}
for hashtag in status.entities['hashtags']:
pretty_hashtag = "<a href='hashtag:%s:%s'>%s</a>" % (hashtag.account_id,
hashtag.display_text[1:], hashtag.display_text)
pattern = r"%s\b" % hashtag.search_for
message = re.sub(pattern, pretty_hashtag, message)
# Highlight mentions
for mention in status.entities['mentions']:
pretty_mention = "<a href='profile:%s'>%s</a>" % (mention.url, mention.display_text)
message = message.replace(mention.search_for, pretty_mention)
if status.repeated_by:
repeated_by = "%s %s" % (i18n.get('retweeted_by'), status.repeated_by)
if status.in_reply_to_id and with_conversation:
conversation_id = "%s-conversation-%s" % (self.column_id, status.id_)
view_conversation = i18n.get('view_conversation')
hide_conversation = i18n.get('hide_conversation')
if self.base.core.get_show_user_avatars():
avatar = status.avatar
else:
avatar = "file://%s" % os.path.join(self.base.images_path, 'unknown.png')
attrs = {'status': status, 'message': message, 'repeated_by': repeated_by,
'timestamp': timestamp, 'view_conversation': view_conversation,
'reply': i18n.get('reply'), 'hide_conversation': hide_conversation,
'quote': i18n.get('quote'), 'retweet': i18n.get('retweet'),
'mark_as_favorite': i18n.get('mark_as_favorite'), 'delete': i18n.get('delete'),
'remove_from_favorites': i18n.get('remove_from_favorites'),
'conversation_id': conversation_id, 'in_progress': i18n.get('in_progress'),
'loading': i18n.get('loading'), 'avatar': avatar, 'media': media,
'quote_username': quote_username, 'quote_message': quote_message}
return self.status_template.render(attrs)
def update_statuses(self, statuses):
statuses_ = statuses[:]
content = ''
current_page = self.page().currentFrame().toHtml()
if current_page == self.EMPTY_PAGE or current_page == '':
for status in statuses_:
content += self.__render_status(status)
column = self.__load_template('column.html')
args = {'stylesheet': self.stylesheet, 'content': content,
'favorite_tooltip': i18n.get('mark_as_favorite'),
'unfavorite_tooltip': i18n.get('remove_from_favorites')}
html = column.render(args)
fd = open('/tmp/turpial-debug.html', 'w')
fd.write(html.encode('ascii', 'ignore'))
fd.close()
self.setHtml(html)
self.clear_new_marks()
else:
statuses_.reverse()
for status in statuses_:
content = self.__render_status(status)
self.append_status(content, status.id_)
self.execute_javascript('restoreScrollPosition()')
def clear(self):
self.setHtml(self.EMPTY_PAGE)
def execute_javascript(self, js_cmd):
self.page().mainFrame().evaluateJavaScript(js_cmd)
def update_conversation(self, status, status_root_id):
status_rendered = self.__render_status(status, with_conversation=False)
status_rendered = status_rendered.replace("\n", '')
status_rendered = status_rendered.replace('\'', '"')
conversation = """updateConversation('%s', '%s')""" % (status_root_id, status_rendered)
self.execute_javascript(conversation)
def view_conversation(self, status_root_id):
conversation = "viewConversation('%s')" % status_root_id
self.execute_javascript(conversation)
def clear_conversation(self, status_root_id):
conversation = "clearConversation('%s')" % status_root_id
self.execute_javascript(conversation)
def append_status(self, html, status_id):
html = html.replace("\n", '')
html = html.replace('\'', '"')
fd = open('/tmp/turpial-update-column.html', 'w')
fd.write(html.encode('ascii', 'ignore'))
fd.close()
cmd = """appendStatus('%s', '%s')""" % (html, status_id)
self.execute_javascript(cmd)
def sync_timestamps(self, statuses):
for status in statuses:
new_timestamp = self.base.humanize_timestamp(status.timestamp)
cmd = """updateTimestamp('%s', '%s')""" % (status.id_, new_timestamp)
self.execute_javascript(cmd)
def clear_new_marks(self):
self.execute_javascript("clearNewMarks()")
def load_style(self):
self.stylesheet = self.__load_stylesheet()
self.setStyleSheet("QWidget { background-color: %s}" % self.base.theme['status']['background_color'])
| gpl-3.0 |
CloudWise-OpenSource/SAPNetworkMonitor | server/src/main/java/com/cloudwise/sap/niping/dao/mapper/AccessCredentialsMapper.java | 849 | package com.cloudwise.sap.niping.dao.mapper;
import com.cloudwise.sap.niping.common.entity.AccessCredentials;
import org.skife.jdbi.v2.StatementContext;
import org.skife.jdbi.v2.tweak.ResultSetMapper;
import java.sql.ResultSet;
import java.sql.SQLException;
public class AccessCredentialsMapper implements ResultSetMapper<AccessCredentials> {
@Override
public AccessCredentials map(int index, ResultSet r, StatementContext ctx) throws SQLException {
AccessCredentials accessCredentials = AccessCredentials.builder()
.token(r.getString("TOKEN"))
.comment(r.getString("COMMENT"))
.expiryDate(r.getDate("EXPIRY_DATE")).build();
accessCredentials.set(r.getString("ACCOUNT_ID"), r.getDate("CREATION_TIME"), r.getDate("MODIFIED_TIME"));
return accessCredentials;
}
} | gpl-3.0 |
vitalisator/librenms | LibreNMS/Exceptions/HostIpExistsException.php | 923 | <?php
/**
* HostIpExistsException.php
*
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @link http://librenms.org
* @copyright 2016 Tony Murray
* @author Tony Murray <[email protected]>
*/
namespace LibreNMS\Exceptions;
class HostIpExistsException extends HostExistsException
{
}
| gpl-3.0 |
hitchhiker/prime | Prime/Prime.Core/Subscriptions/RenewingSubscriptionsListener.cs | 4069 | using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Timers;
using GalaSoft.MvvmLight.Messaging;
using LiteDB;
using Prime.Base;
namespace Prime.Core
{
public class RenewingSubscriptionsListener<T> : IDisposable where T : RenewableSubscribeMessageBase
{
private class SubscriptionEntry
{
public readonly T Message;
public DateTime UtcLastUpdated { get; private set; }
public SubscriptionEntry(T message)
{
UtcLastUpdated = DateTime.UtcNow;
Message = message;
}
public void Refresh()
{
UtcLastUpdated = DateTime.UtcNow;
}
}
private TimeSpan _expirationSpan = TimeSpan.MinValue;
private readonly Action<SubscriptionState, ObjectId, T> _stateChanged;
protected readonly IMessenger Messenger = DefaultMessenger.I.Instance;
private readonly Dictionary<ObjectId, SubscriptionEntry> _subs = new Dictionary<ObjectId, SubscriptionEntry>();
protected int TimerInterval { get; set; }
public bool IsStarted { get; protected set; }
protected readonly object RegistrationLock = new object();
protected readonly object StateLock = new object();
private readonly Timer _timer = new Timer();
public RenewingSubscriptionsListener(Action<SubscriptionState, ObjectId, T> stateChanged)
{
_stateChanged = stateChanged;
Messenger.RegisterAsync<T>(this, IncomingSubscription);
_timer = new Timer
{
Interval = 500,
AutoReset = false
};
_timer.Elapsed += _timer_Elapsed;
_timer.Start();
}
private void _timer_Elapsed(object sender, ElapsedEventArgs e)
{
new Task(delegate()
{
TrimSubscriptionState();
_timer.Start();
}).Start();
}
private void IncomingSubscription(T m)
{
if (_expirationSpan == TimeSpan.MinValue && m != null) //bit of a hack
_expirationSpan = m.ExpirationSpan;
lock (RegistrationLock)
{
if (m.Unsubscribe)
IncomingUnsubscribe(m);
else
IncomingSubscribe(m);
SendStateChange(m.SubscriberId, m);
}
}
private void IncomingSubscribe(T m)
{
if (_subs.ContainsKey(m.SubscriberId))
_subs[m.SubscriberId].Refresh();
else
_subs.Add(m.SubscriberId, new SubscriptionEntry(m));
}
private void IncomingUnsubscribe(T m)
{
if (_subs.ContainsKey(m.SubscriberId))
_subs.Remove(m.SubscriberId);
}
private void TrimSubscriptionState()
{
lock (RegistrationLock)
{
if (_subs.Count == 0 || _expirationSpan == TimeSpan.MinValue)
return;
var expired = _subs.Where(kv=> kv.Value.UtcLastUpdated.IsBeforeTheLast(_expirationSpan)).ToList();
_subs.RemoveAll(x => expired.Any(e=> e.Key == x.Key));
foreach (var k in expired)
SendStateChange(k.Key, k.Value.Message);
}
}
private void SendStateChange(ObjectId subscriberId, T message)
{
if (message == null)
return;
var state = _subs.ContainsKey(subscriberId) ? SubscriptionState.Subscribed : SubscriptionState.Unsubscribed;
new Task(() =>
{
_stateChanged.Invoke(state, subscriberId, message);
}).Start();
}
public void Dispose()
{
Messenger.Unregister(this);
_timer?.Stop();
_timer?.Dispose();
}
}
} | gpl-3.0 |
lcostantini/haycancha | db/migrate/20140822170745_add_attachment_avatar_to_teams.rb | 210 | class AddAttachmentAvatarToTeams < ActiveRecord::Migration
def self.up
change_table :teams do |t|
t.attachment :avatar
end
end
def self.down
remove_attachment :teams, :avatar
end
end
| gpl-3.0 |
kuiwang/my-dev | src/main/java/com/taobao/api/domain/SearchHotelObject.java | 4791 | package com.taobao.api.domain;
import java.util.List;
import com.taobao.api.TaobaoObject;
import com.taobao.api.internal.mapping.ApiField;
import com.taobao.api.internal.mapping.ApiListField;
/**
* 酒店搜索返回的酒店对象
*
* @author auto create
* @since 1.0, null
*/
public class SearchHotelObject extends TaobaoObject {
private static final long serialVersionUID = 5676792645334765282L;
/**
* 酒店地址
*/
@ApiField("address")
private String address;
/**
* 酒店距离搜索中心点的距离,单位:米。注意:在设置了搜索中心点的情况下,才会计算出有效的距离;如果没有设置搜索中心点,
* 则distance的值置为-1。
*/
@ApiField("distance")
private Long distance;
/**
* H5的detail页面的URL
*/
@ApiField("h5_detail_url")
private String h5DetailUrl;
/**
* 酒店detail页面的url
*/
@ApiField("hotel_detail_url")
private String hotelDetailUrl;
/**
* 纬度
*/
@ApiField("lat")
private String lat;
/**
* 星级/档次
*/
@ApiField("level")
private NameValuePair level;
/**
* 纬度
*/
@ApiField("lng")
private String lng;
/**
* 酒店名称
*/
@ApiField("name")
private String name;
/**
* 图片url,多张图片使用","隔开
*/
@ApiField("pic_urls")
private String picUrls;
/**
* 酒店价格,注意:单位为分。如果price的值为-1,则表示此酒店下无可售的报价。
*/
@ApiField("price")
private Long price;
/**
* 评论数
*/
@ApiField("rate_number")
private Long rateNumber;
/**
* 评分
*/
@ApiField("rate_score")
private String rateScore;
/**
* 销量
*/
@ApiField("sell")
private Long sell;
/**
* 服务设施
*/
@ApiListField("services")
@ApiField("name_value_pair")
private List<NameValuePair> services;
/**
* 标准酒店ID
*/
@ApiField("shid")
private Long shid;
/**
* 电话,包括三种类型: 1.固定电话,例如:0086-010-85322688 2.移动电话,例如:13869696363
* 3.400或800电话,例如:0086-4006123928
*/
@ApiField("tel")
private String tel;
public String getAddress() {
return this.address;
}
public Long getDistance() {
return this.distance;
}
public String getH5DetailUrl() {
return this.h5DetailUrl;
}
public String getHotelDetailUrl() {
return this.hotelDetailUrl;
}
public String getLat() {
return this.lat;
}
public NameValuePair getLevel() {
return this.level;
}
public String getLng() {
return this.lng;
}
public String getName() {
return this.name;
}
public String getPicUrls() {
return this.picUrls;
}
public Long getPrice() {
return this.price;
}
public Long getRateNumber() {
return this.rateNumber;
}
public String getRateScore() {
return this.rateScore;
}
public Long getSell() {
return this.sell;
}
public List<NameValuePair> getServices() {
return this.services;
}
public Long getShid() {
return this.shid;
}
public String getTel() {
return this.tel;
}
public void setAddress(String address) {
this.address = address;
}
public void setDistance(Long distance) {
this.distance = distance;
}
public void setH5DetailUrl(String h5DetailUrl) {
this.h5DetailUrl = h5DetailUrl;
}
public void setHotelDetailUrl(String hotelDetailUrl) {
this.hotelDetailUrl = hotelDetailUrl;
}
public void setLat(String lat) {
this.lat = lat;
}
public void setLevel(NameValuePair level) {
this.level = level;
}
public void setLng(String lng) {
this.lng = lng;
}
public void setName(String name) {
this.name = name;
}
public void setPicUrls(String picUrls) {
this.picUrls = picUrls;
}
public void setPrice(Long price) {
this.price = price;
}
public void setRateNumber(Long rateNumber) {
this.rateNumber = rateNumber;
}
public void setRateScore(String rateScore) {
this.rateScore = rateScore;
}
public void setSell(Long sell) {
this.sell = sell;
}
public void setServices(List<NameValuePair> services) {
this.services = services;
}
public void setShid(Long shid) {
this.shid = shid;
}
public void setTel(String tel) {
this.tel = tel;
}
}
| gpl-3.0 |
valentingrigorean/Bss | Bss.SharedCore/Utils/StringCipher.cs | 6756 | //
// StringCipher.cs
//
// Author:
// valentingrigorean <[email protected]>
//
// Copyright (c) 2016 valentingrigorean
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace Bss.Core.Utils
{
public static class StringCipher
{
// This constant is used to determine the keysize of the encryption algorithm in bits.
// We divide this by 8 within the code below to get the equivalent number of bytes.
private const int Keysize = 256;
// This constant determines the number of iterations for the password bytes generation function.
private const int DerivationIterations = 1000;
public static string Encrypt(string plainText, string passPhrase)
{
// Salt and IV is randomly generated each time, but is preprended to encrypted cipher text
// so that the same Salt and IV values can be used when decrypting.
var saltStringBytes = Generate256BitsOfRandomEntropy();
var ivStringBytes = Generate256BitsOfRandomEntropy();
var plainTextBytes = Encoding.UTF8.GetBytes(plainText);
using (var password = new Rfc2898DeriveBytes(passPhrase, saltStringBytes, DerivationIterations))
{
var keyBytes = password.GetBytes(Keysize / 8);
using (var symmetricKey = new RijndaelManaged())
{
symmetricKey.BlockSize = 256;
symmetricKey.Mode = CipherMode.CBC;
symmetricKey.Padding = PaddingMode.PKCS7;
using (var encryptor = symmetricKey.CreateEncryptor(keyBytes, ivStringBytes))
{
using (var memoryStream = new MemoryStream())
{
using (var cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write))
{
cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
cryptoStream.FlushFinalBlock();
// Create the final bytes as a concatenation of the random salt bytes, the random iv bytes and the cipher bytes.
var cipherTextBytes = saltStringBytes;
cipherTextBytes = cipherTextBytes.Concat(ivStringBytes).ToArray();
cipherTextBytes = cipherTextBytes.Concat(memoryStream.ToArray()).ToArray();
memoryStream.Close();
cryptoStream.Close();
return Convert.ToBase64String(cipherTextBytes);
}
}
}
}
}
}
public static string Decrypt(string cipherText, string passPhrase)
{
// Get the complete stream of bytes that represent:
// [32 bytes of Salt] + [32 bytes of IV] + [n bytes of CipherText]
var cipherTextBytesWithSaltAndIv = Convert.FromBase64String(cipherText);
// Get the saltbytes by extracting the first 32 bytes from the supplied cipherText bytes.
var saltStringBytes = cipherTextBytesWithSaltAndIv.Take(Keysize / 8).ToArray();
// Get the IV bytes by extracting the next 32 bytes from the supplied cipherText bytes.
var ivStringBytes = cipherTextBytesWithSaltAndIv.Skip(Keysize / 8).Take(Keysize / 8).ToArray();
// Get the actual cipher text bytes by removing the first 64 bytes from the cipherText string.
var cipherTextBytes =
cipherTextBytesWithSaltAndIv.Skip(Keysize / 8 * 2)
.Take(cipherTextBytesWithSaltAndIv.Length - Keysize / 8 * 2)
.ToArray();
using (var password = new Rfc2898DeriveBytes(passPhrase, saltStringBytes, DerivationIterations))
{
var keyBytes = password.GetBytes(Keysize / 8);
using (var symmetricKey = new RijndaelManaged())
{
symmetricKey.BlockSize = 256;
symmetricKey.Mode = CipherMode.CBC;
symmetricKey.Padding = PaddingMode.PKCS7;
using (var decryptor = symmetricKey.CreateDecryptor(keyBytes, ivStringBytes))
{
using (var memoryStream = new MemoryStream(cipherTextBytes))
{
using (var cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read))
{
var plainTextBytes = new byte[cipherTextBytes.Length];
var decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);
memoryStream.Close();
cryptoStream.Close();
return Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount);
}
}
}
}
}
}
private static byte[] Generate256BitsOfRandomEntropy()
{
var randomBytes = new byte[32]; // 32 Bytes will give us 256 bits.
using (var rngCsp = new RNGCryptoServiceProvider())
{
// Fill the array with cryptographically secure random bytes.
rngCsp.GetBytes(randomBytes);
}
return randomBytes;
}
}
} | gpl-3.0 |
ursfassler/rizzly | src/ast/pass/input/xml/parser/reference/UnlinkedAnchorParser.java | 1786 | /**
* This file is part of Rizzly.
*
* Rizzly is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Rizzly is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Rizzly. If not, see <http://www.gnu.org/licenses/>.
*/
package ast.pass.input.xml.parser.reference;
import ast.data.Ast;
import ast.data.reference.UnlinkedAnchor;
import ast.pass.input.xml.infrastructure.Parser;
import ast.pass.input.xml.infrastructure.XmlParser;
import ast.pass.input.xml.scanner.ExpectionParser;
import error.RizzlyError;
public class UnlinkedAnchorParser implements Parser {
private static final String Name = "UnlinkedAnchor";
private final ExpectionParser stream;
private final XmlParser parser;
private final RizzlyError error;
public UnlinkedAnchorParser(ExpectionParser stream, XmlParser parser, RizzlyError error) {
this.stream = stream;
this.parser = parser;
this.error = error;
}
@Override
public Parser parserFor(String name) {
return Name.equals(name) ? this : null;
}
@Override
public Parser parserFor(Class<? extends Ast> type) {
return type == UnlinkedAnchor.class ? this : null;
}
@Override
public UnlinkedAnchor parse() {
stream.elementStart(Name);
String link = stream.attribute("target");
stream.elementEnd();
return new UnlinkedAnchor(link);
}
}
| gpl-3.0 |
ac2cz/FoxTelem | lib/mysql-connector-java-8.0.13/src/main/core-impl/java/com/mysql/cj/AbstractQuery.java | 8441 | /*
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 2.0, as published by the
* Free Software Foundation.
*
* This program is also distributed with certain software (including but not
* limited to OpenSSL) that is licensed under separate terms, as designated in a
* particular file or component or in included license documentation. The
* authors of MySQL hereby grant you an additional permission to link the
* program and your derivative works with the separately licensed software that
* they have included with MySQL.
*
* Without limiting anything contained in the foregoing, this file, which is
* part of MySQL Connector/J, is also subject to the Universal FOSS Exception,
* version 1.0, a copy of which can be found at
* http://oss.oracle.com/licenses/universal-foss-exception.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
* for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package com.mysql.cj;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import com.mysql.cj.conf.PropertyKey;
import com.mysql.cj.conf.RuntimeProperty;
import com.mysql.cj.exceptions.CJException;
import com.mysql.cj.exceptions.CJTimeoutException;
import com.mysql.cj.exceptions.ExceptionFactory;
import com.mysql.cj.exceptions.OperationCancelledException;
import com.mysql.cj.log.ProfilerEventHandler;
import com.mysql.cj.protocol.Message;
import com.mysql.cj.protocol.ProtocolEntityFactory;
import com.mysql.cj.protocol.Resultset;
import com.mysql.cj.protocol.Resultset.Type;
//TODO should not be protocol-specific
public abstract class AbstractQuery implements Query {
/** Used to generate IDs when profiling. */
static int statementCounter = 1;
public NativeSession session = null;
/** Used to identify this statement when profiling. */
protected int statementId;
/** Should we profile? */
protected boolean profileSQL = false;
protected RuntimeProperty<Integer> maxAllowedPacket;
/** The character encoding to use (if available) */
protected String charEncoding = null;
/** Mutex to prevent race between returning query results and noticing that query has been timed-out or cancelled. */
protected Object cancelTimeoutMutex = new Object();
private CancelStatus cancelStatus = CancelStatus.NOT_CANCELED;
/** The timeout for a query */
protected int timeoutInMillis = 0;
/** Holds batched commands */
protected List<Object> batchedArgs;
protected boolean useCursorFetch = false;
/** The type of this result set (scroll sensitive or in-sensitive) */
protected Resultset.Type resultSetType = Type.FORWARD_ONLY;
/** The number of rows to fetch at a time (currently ignored) */
protected int fetchSize = 0;
/** If profiling, where should events go to? */
protected ProfilerEventHandler eventSink = null;
/** Currently executing a statement? */
protected final AtomicBoolean statementExecuting = new AtomicBoolean(false);
/** The catalog in use */
protected String currentCatalog = null;
/** Has clearWarnings() been called? */
protected boolean clearWarningsCalled = false;
public AbstractQuery(NativeSession sess) {
statementCounter++;
this.session = sess;
this.profileSQL = sess.getPropertySet().getBooleanProperty(PropertyKey.profileSQL).getValue();
this.maxAllowedPacket = sess.getPropertySet().getIntegerProperty(PropertyKey.maxAllowedPacket);
this.charEncoding = sess.getPropertySet().getStringProperty(PropertyKey.characterEncoding).getValue();
this.useCursorFetch = sess.getPropertySet().getBooleanProperty(PropertyKey.useCursorFetch).getValue();
}
@Override
public int getId() {
return this.statementId;
}
@Override
public void setCancelStatus(CancelStatus cs) {
this.cancelStatus = cs;
}
@Override
public void checkCancelTimeout() {
synchronized (this.cancelTimeoutMutex) {
if (this.cancelStatus != CancelStatus.NOT_CANCELED) {
CJException cause = this.cancelStatus == CancelStatus.CANCELED_BY_TIMEOUT ? new CJTimeoutException() : new OperationCancelledException();
resetCancelledState();
throw cause;
}
}
}
public void resetCancelledState() {
synchronized (this.cancelTimeoutMutex) {
this.cancelStatus = CancelStatus.NOT_CANCELED;
}
}
@Override
public <T extends Resultset, M extends Message> ProtocolEntityFactory<T, M> getResultSetFactory() {
// TODO Auto-generated method stub
return null;
}
@Override
public NativeSession getSession() {
return this.session;
}
@Override
public Object getCancelTimeoutMutex() {
return this.cancelTimeoutMutex;
}
public void closeQuery() {
this.session = null;
}
public void addBatch(Object batch) {
if (this.batchedArgs == null) {
this.batchedArgs = new ArrayList<>();
}
this.batchedArgs.add(batch);
}
public List<Object> getBatchedArgs() {
return this.batchedArgs == null ? null : Collections.unmodifiableList(this.batchedArgs);
}
@Override
public void clearBatchedArgs() {
if (this.batchedArgs != null) {
this.batchedArgs.clear();
}
}
@Override
public int getResultFetchSize() {
return this.fetchSize;
}
@Override
public void setResultFetchSize(int fetchSize) {
this.fetchSize = fetchSize;
}
public Resultset.Type getResultType() {
return this.resultSetType;
}
public void setResultType(Resultset.Type resultSetType) {
this.resultSetType = resultSetType;
}
public int getTimeoutInMillis() {
return this.timeoutInMillis;
}
public void setTimeoutInMillis(int timeoutInMillis) {
this.timeoutInMillis = timeoutInMillis;
}
public CancelQueryTask startQueryTimer(Query stmtToCancel, int timeout) {
if (this.session.getPropertySet().getBooleanProperty(PropertyKey.enableQueryTimeouts).getValue() && timeout != 0) {
CancelQueryTaskImpl timeoutTask = new CancelQueryTaskImpl(stmtToCancel);
this.session.getCancelTimer().schedule(timeoutTask, timeout);
return timeoutTask;
}
return null;
}
public void stopQueryTimer(CancelQueryTask timeoutTask, boolean rethrowCancelReason, boolean checkCancelTimeout) {
if (timeoutTask != null) {
timeoutTask.cancel();
if (rethrowCancelReason && timeoutTask.getCaughtWhileCancelling() != null) {
Throwable t = timeoutTask.getCaughtWhileCancelling();
throw ExceptionFactory.createException(t.getMessage(), t);
}
this.session.getCancelTimer().purge();
if (checkCancelTimeout) {
checkCancelTimeout();
}
}
}
public ProfilerEventHandler getEventSink() {
return this.eventSink;
}
public void setEventSink(ProfilerEventHandler eventSink) {
this.eventSink = eventSink;
}
public AtomicBoolean getStatementExecuting() {
return this.statementExecuting;
}
public String getCurrentCatalog() {
return this.currentCatalog;
}
public void setCurrentCatalog(String currentCatalog) {
this.currentCatalog = currentCatalog;
}
public boolean isClearWarningsCalled() {
return this.clearWarningsCalled;
}
public void setClearWarningsCalled(boolean clearWarningsCalled) {
this.clearWarningsCalled = clearWarningsCalled;
}
public void statementBegins() {
this.clearWarningsCalled = false;
this.statementExecuting.set(true);
}
}
| gpl-3.0 |
k0001/saywah | saywah/core/providers.py | 2721 | # -*- coding: utf8 -*-
# This file is part of Saywah.
# Copyright (C) 2009 Renzo Carbonara <[email protected]>
#
# Saywah is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Saywah is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Saywah. If not, see <http://www.gnu.org/licenses/>.
import logging
__all__ = 'Provider', 'ProviderError', 'ProviderRemoteError', 'ProviderManager',
log = logging.getLogger(__name__)
class ProviderError(Exception):
"""Base exception for provider errors"""
class ProviderRemoteError(ProviderError):
"""Raised when communication with a remote provider fails somehow."""
class Provider(object):
"""A (microblogging) service provider"""
# A pretty name for this provider
name = u''
# A short slug for this provider
slug = u''
@property
def features(self):
meth_names = ('send_message', 'get_new_messages')
return tuple(n for n in meth_names if not getattr(getattr(self, n), '_disabled', False))
# The following methods are to be overriden by provider implementations
def send_message(self, account, message):
"""
Sends a message from the given account.
``account`` should be an ``saywah.core.accounts.Account`` object,
``message`` a ``dict`` containing the message data.
Returns a ``sayawh.core.messages.Message`` object.
"""
raise NotImplementedError()
send_message._disabled = True
def get_new_messages(self, account):
"""
Get new messages for the given account.
Returns a list of ``sayawh.core.messages.Message`` objects in chronological order.
"""
raise NotImplementedError()
get_new_messages._disabled = True
class ProviderManager(object):
"""Manager for Provider objects"""
def __init__(self):
self._registry = {}
@property
def providers(self):
return self._registry.copy()
def register(self, provider):
if provider.slug in self._registry:
raise KeyError(u"Provider '%s' already registered" % provider.slug)
self._registry[provider.slug] = provider
def unregister(self, key):
del self._registry[provider.slug]
def unregister_all(self):
self._registry.clear()
| gpl-3.0 |
e-gob/Consola-de-aplicaciones | app/Usuario.php | 1296 | <?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Usuario extends Model
{
use SoftDeletes;
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'usuario';
/**
* The attributes that are hidden.
*
* @var array
*/
protected $hidden = ['updated_at', 'deleted_at'];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = ['deleted_at'];
/**
* Get All roles from Usuario.
*
* @var array
*/
public function roles()
{
return $this->belongsToMany(Rol::class, 'usuario_rol')
->withPivot('id', 'usuario_id', 'rol_id');
}
public function institucion_usuario()
{
return $this->hasMany(InstitucionUsuario::class);
}
public function instituciones(){
return $this->belongsTo(Institucion::class);
}
public function autoridad_representante()
{
return $this->hasMany(AutoridadRepresentante::class);
}
protected $fillable=['rut', 'dv', 'institucion_id', 'nombres', 'apellido_paterno', 'apellido_materno', 'cargo', 'email', 'username', 'telefono', 'celular'];
}
| gpl-3.0 |
ksarkar/CoveringArray | src/edu/asu/ca/kaushik/algorithms/derandomized/condexpintervariations/triebased/Trie.java | 6238 | /**
* Copyright (C) 2013-2016 Kaushik Sarkar <[email protected]>
*
* This file is part of CoveringArray project.
*
* CoveringArray is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* CoveringArray is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with CoveringArray. If not, see <http://www.gnu.org/licenses/>.
*/
package edu.asu.ca.kaushik.algorithms.derandomized.condexpintervariations.triebased;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class Trie {
private int count;
private int numChild;
private Trie[] children;
private int symb;
public Trie(int n) {
this.numChild = n;
this.children = new Trie[this.numChild];
this.count = 0;
}
public Trie(int n, int s) {
this(n);
this.symb = s;
}
public void setSymb(int s) {
this.symb = s;
}
public int getSymb() {
return this.symb;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public int getNumChild() {
return numChild;
}
public Trie[] getChildren() {
return children;
}
public List<int[]> getInstances(int t) {
List<int[]> instances = new ArrayList<int[]>();
int[] instance = new int[t];
this.traverse(instances, instance, t, t);
return instances;
}
private void traverse(List<int[]> instances, int[] instance, int t, int i) {
boolean noChildren = true;
for (int v = 0; v < this.numChild; v++) {
if (this.children[v] != null) {
instance[t-i] = v;
this.children[v].traverse(instances, instance, t, i-1);
noChildren = false;
}
}
if (noChildren) {
instances.add(Arrays.copyOf(instance, t));
}
}
/**
* @param prefix The prefix to be matched in the trie rooted at this node
* @return number of in
*/
public int getNumInstanceWPrefix(int[] prefix) {
if (prefix.length == 0) {
return this.count;
} else {
int index = prefix[0];
if (this.children[index] == null) {
return 0;
} else {
return this.children[index].getNumInstanceWPrefix(
Arrays.copyOfRange(prefix, 1, prefix.length));
}
}
}
/**
* Deletes the suffix denoted by string from the trie rooted at
* this node
* @param string the suffix to be deleted
* @return 1 - if a suffix is deleted
* 0 - if no suffix is deleted or the input is not valid
*/
public int deleteInstance(int[] string) {
int ret = 0;
if (string.length == 0) {
if (this.noChildren()) {
this.count = 0;
ret = 1;
}
} else {
int index = string[0];
if (this.children[index] != null) {
ret = this.children[index].deleteInstance(
Arrays.copyOfRange(string, 1, string.length));
this.count = this.count - ret;
if (this.children[index].count == 0) {
this.children[index] = null;
}
}
}
return ret;
}
public boolean containsInstance(int[] string) {
boolean ret = false;
if (string.length == 0) {
if (this.noChildren()) {
ret = true;
}
} else {
int index = string[0];
if (this.children[index] != null) {
ret = this.children[index].containsInstance(
Arrays.copyOfRange(string, 1, string.length));
}
}
return ret;
}
public boolean noChildren() {
for (int i = 0; i < this.numChild; i++) {
if (this.children[i] != null) {
return false;
}
}
return true;
}
public String toString() {
return "Trie Node [count = " + this.count + "; symb = " + this.symb + "]\n";
}
public String printPreOrder() {
String s = this.toString();
for (int i = 0; i < this.numChild; i++) {
if (this.children[i] != null) {
s = s + this.children[i].printPreOrder();
} else {
s = s + "null\n";
}
}
return s;
}
public static Trie buildTrie(int v, int t) {
Trie root = new Trie(v, -1);
root.setCount((int)Math.pow(v, t));
if (t > 0) {
for (int i = 0; i < v; i++) {
root.children[i] = buildTrie(v, t-1);
root.children[i].setSymb(i);
}
}
return root;
}
/**
* Makes deep copy of the trie rooted at original
* @param original the root of the original trie
* @return root of the copied trie
*/
public static Trie copyTrie(Trie original) {
Trie copy = null;
if (original != null) {
copy = new Trie(original.getNumChild(), original.getSymb());
copy.setCount(original.getCount());
int n = copy.getNumChild();
for (int i = 0; i < n; i++) {
copy.children[i] = copyTrie(original.children[i]);
}
}
return copy;
}
/**
* @param args
*/
public static void main(String[] args) {
Trie t = buildTrie(2,2);
Trie p = copyTrie(t);
List<int[]> instances = p.getInstances(2);
for (int[] ins : instances) {
System.out.println(Arrays.toString(ins));
}
int[] a1 = {0,0};
int[] a2 = {0,1};
int[] a3 = {1,1};
int[] a4 = {1,0};
System.out.println(t.printPreOrder());
t.deleteInstance(a1);
System.out.println(t.printPreOrder());
t.deleteInstance(a2);
System.out.println(t.printPreOrder());
System.out.println(p.printPreOrder());
p.deleteInstance(a3);
System.out.println(p.printPreOrder());
instances = p.getInstances(2);
for (int[] ins : instances) {
System.out.println(Arrays.toString(ins));
}
p.deleteInstance(a4);
System.out.println(p.printPreOrder());
p.deleteInstance(a4);
System.out.println(p.printPreOrder());
p.deleteInstance(new int[]{0});
System.out.println(p.printPreOrder());
p.deleteInstance(new int[]{1,0,1});
System.out.println(p.printPreOrder());
System.out.println(p.containsInstance(a1));
System.out.println(p.containsInstance(a3));
System.out.println(p.containsInstance(new int[]{1,0,1}));
System.out.println(p.containsInstance(new int[]{}));
instances = p.getInstances(2);
for (int[] ins : instances) {
System.out.println(Arrays.toString(ins));
}
}
}
| gpl-3.0 |
dbunibas/spicy | spicyGUI/spicygui/src/it/unibas/spicygui/widget/ConstantWidget.java | 3922 | /*
Copyright (C) 2007-2011 Database Group - Universita' della Basilicata
Giansalvatore Mecca - [email protected]
Salvatore Raunich - [email protected]
Marcello Buoncristiano - [email protected]
This file is part of ++Spicy - a Schema Mapping and Data Exchange Tool
++Spicy is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
++Spicy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ++Spicy. If not, see <http://www.gnu.org/licenses/>.
*/
package it.unibas.spicygui.widget;
import it.unibas.spicygui.Costanti;
import it.unibas.spicygui.widget.caratteristiche.CaratteristicheWidgetInterConst;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import javax.swing.border.LineBorder;
import org.jdesktop.beansbinding.AutoBinding;
import org.jdesktop.beansbinding.BeanProperty;
import org.jdesktop.beansbinding.Binding;
import org.jdesktop.beansbinding.Bindings;
import org.jdesktop.beansbinding.ELProperty;
import org.netbeans.api.visual.layout.LayoutFactory;
import org.netbeans.api.visual.widget.ImageWidget;
import org.netbeans.api.visual.widget.LabelWidget;
import org.netbeans.api.visual.widget.Scene;
import org.netbeans.api.visual.widget.Widget;
import org.openide.util.ImageUtilities;
public class ConstantWidget extends Widget {
private CaratteristicheWidgetInterConst caratteristicheWidget;
public ConstantWidget(Scene scene, Point point, CaratteristicheWidgetInterConst caratteristicheWidget) {
super(scene);
this.caratteristicheWidget = caratteristicheWidget;
creaWidget(scene, point);
}
private MyGradientLabelWidget creaHeaderWidget(Scene scene) {
float[] coloreEnd = new float[3];
Color.RGBtoHSB(208, 236, 255, coloreEnd);
Color colorEndVMD = Color.getHSBColor(coloreEnd[0], coloreEnd[1], coloreEnd[2]);
MyGradientLabelWidget gradientHeaderWidget = new MyGradientLabelWidget(scene, "Const", Color.WHITE, colorEndVMD);
gradientHeaderWidget.setLayout(LayoutFactory.createOverlayLayout());
gradientHeaderWidget.setPreferredSize(new Dimension(25, 25));
return gradientHeaderWidget;
}
private void creaWidget(Scene scene, Point point) {
this.setLayout(LayoutFactory.createHorizontalFlowLayout());
MyGradientLabelWidget gradientWidget = creaHeaderWidget(scene);
ImageWidget imageWidget = new ImageWidget(scene, ImageUtilities.loadImage(Costanti.ICONA_CONSTANT));
gradientWidget.addChild(imageWidget);
LabelWidget constantWidget = new LabelWidget(scene, "");
constantWidget.setVerticalAlignment(LabelWidget.VerticalAlignment.CENTER);
this.addChild(gradientWidget);
this.addChild(constantWidget);
this.setPreferredLocation(new Point(point.x - 1, point.y - 1));
settaBordoConstant();
Binding bindingConst = Bindings.createAutoBinding(AutoBinding.UpdateStrategy.READ, caratteristicheWidget, ELProperty.create("${costante}"), constantWidget, BeanProperty.create("label"));
bindingConst.bind();
this.setOpaque(true);
}
private void settaBordoConstant() {
float[] coloreBordo = new float[3];
Color.RGBtoHSB(186, 205, 240, coloreBordo);
Color colorBordo = Color.getHSBColor(coloreBordo[0], coloreBordo[1], coloreBordo[2]);
LineBorder lineBorder = new LineBorder(colorBordo, 1, true);
this.setBorder(lineBorder);
}
}
| gpl-3.0 |
Solerni-R1-1/CoreBundle | Repository/RoleRepository.php | 9099 | <?php
/*
* This file is part of the Claroline Connect package.
*
* (c) Claroline Consortium <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Claroline\CoreBundle\Repository;
use Doctrine\ORM\EntityRepository;
use Claroline\CoreBundle\Entity\Role;
use Claroline\CoreBundle\Entity\Workspace\AbstractWorkspace;
use Claroline\CoreBundle\Entity\User;
use Claroline\CoreBundle\Entity\Group;
use Claroline\CoreBundle\Entity\Tool\Tool;
class RoleRepository extends EntityRepository
{
/**
* Returns the roles associated to a workspace.
*
* @param AbstractWorkspace $workspace
*
* @return array[AbstractWorkspace]
*/
public function findByWorkspace(AbstractWorkspace $workspace)
{
$dql = "
SELECT r FROM Claroline\CoreBundle\Entity\Role r
JOIN r.workspace ws
WHERE ws.id = {$workspace->getId()}
";
$query = $this->_em->createQuery($dql);
return $query->getResult();
}
/**
* Returns the visitor role of a workspace.
*
* @param AbstractWorkspace $workspace
*
* @return Role
*/
public function findVisitorRole(AbstractWorkspace $workspace)
{
return $this->findBaseWorkspaceRole('VISITOR', $workspace);
}
/**
* Returns the collaborator role of a workspace.
*
* @param AbstractWorkspace $workspace
*
* @return Role
*/
public function findCollaboratorRole(AbstractWorkspace $workspace)
{
return $this->findBaseWorkspaceRole('COLLABORATOR', $workspace);
}
/**
* Returns the manager role of a workspace.
*
* @param AbstractWorkspace $workspace
*
* @return Role
*/
public function findManagerRole(AbstractWorkspace $workspace)
{
return $this->findBaseWorkspaceRole('MANAGER', $workspace);
}
/**
* Returns the platform roles of a user.
*
* @param User $user
*
* @return array[Role]
*/
public function findPlatformRoles(User $user)
{
$dql = "
SELECT r FROM Claroline\CoreBundle\Entity\Role r
JOIN r.users u
WHERE u.id = {$user->getId()} AND r.type != " . Role::WS_ROLE;
$query = $this->_em->createQuery($dql);
return $query->getResult();
}
/**
* Returns all platform roles.
*
* @return array[Role]
*/
public function findAllPlatformRoles()
{
$queryBuilder = $this
->createQueryBuilder('role')
->andWhere("role.type = :roleType")
->setParameter("roleType", Role::PLATFORM_ROLE);
$queryBuilder->andWhere($queryBuilder->expr()->not($queryBuilder->expr()->eq('role.name', '?1')))
->setParameter(1, 'ROLE_ANONYMOUS');
$query = $queryBuilder->getQuery();
return $query->getResult();
}
public function findByUserAndWorkspace(User $user, AbstractWorkspace $workspace)
{
$dql = "
SELECT r FROM Claroline\CoreBundle\Entity\Role r
JOIN r.users u
JOIN r.workspace w
WHERE u.id = :userId AND w.id = :workspaceId
";
$query = $this->_em->createQuery($dql);
$query->setParameter('userId', $user->getId());
$query->setParameter('workspaceId', $workspace->getId());
return $query->getResult();
}
public function findByGroupAndWorkspace(Group $group, AbstractWorkspace $workspace)
{
$dql = "
SELECT r FROM Claroline\CoreBundle\Entity\Role r
JOIN r.groups g
JOIN r.workspace w
WHERE g.id = :groupId AND w.id = :workspaceId
";
$query = $this->_em->createQuery($dql);
$query->setParameter('groupId', $group->getId());
$query->setParameter('workspaceId', $workspace->getId());
return $query->getResult();
}
/**
* Returns the roles of a user in a workspace.
*
* @param User $user The subject of the role
* @param AbstractWorkspace $workspace The workspace the role should be bound to
*
* @return null|Role
*/
public function findWorkspaceRolesForUser(User $user, AbstractWorkspace $workspace)
{
$dql = "
SELECT r FROM Claroline\CoreBundle\Entity\Role r
JOIN r.workspace ws
JOIN r.users user
WHERE ws.guid = '{$workspace->getGuid()}'
AND r.name != 'ROLE_ADMIN'
AND user.id = {$user->getId()}
";
$query = $this->_em->createQuery($dql);
return $query->getResult();
}
/**
* Returns the roles which have access to a workspace tool.
*
* @param \Claroline\CoreBundle\Entity\Workspace\AbstractWorkspace $workspace
* @param \Claroline\CoreBundle\Entity\Tool\Tool $tool
*/
public function findByWorkspaceAndTool(AbstractWorkspace $workspace, Tool $tool)
{
$dql = "
SELECT DISTINCT r FROM Claroline\CoreBundle\Entity\Role r
JOIN r.workspace ws
JOIN ws.orderedTools ot
JOIN ot.roles r_2
JOIN ot.tool tool
WHERE ws.guid = '{$workspace->getGuid()}'
AND tool.id = {$tool->getId()}
AND r.id = r_2.id
AND r.name != 'ROLE_ADMIN'
";
$query = $this->_em->createQuery($dql);
return $query->getResult();
}
public function findRolesByWorkspaceAndRoleNames(
AbstractWorkspace $workspace,
array $roles
)
{
$dql = "
SELECT r FROM Claroline\CoreBundle\Entity\Role r
JOIN r.workspace w
WHERE w = :workspace
AND r.name IN (:roles)
";
$query = $this->_em->createQuery($dql);
$query->setParameter('workspace', $workspace);
$query->setParameter('roles', $roles);
return $query->getResult();
}
/**
* @todo check and document this method
*/
public function findByWorkspaceCodeTag($workspaceCode)
{
$upperSearch = strtoupper($workspaceCode);
$dql = "
SELECT DISTINCT r FROM Claroline\CoreBundle\Entity\Role r
JOIN r.workspace ws
LEFT JOIN Claroline\CoreBundle\Entity\Workspace\RelWorkspaceTag rwt
WITH rwt.workspace = ws
LEFT JOIN Claroline\CoreBundle\Entity\Workspace\WorkspaceTag wt
WITH rwt.tag = wt AND wt.user IS NULL
LEFT JOIN Claroline\CoreBundle\Entity\Workspace\WorkspaceTagHierarchy wth
WITH wth.tag = wt AND wth.user IS NULL
LEFT JOIN wth.parent p
WHERE ws.displayable = true AND (UPPER(ws.code) LIKE :code
OR UPPER(wt.name) LIKE :code
OR UPPER(p.name) LIKE :code)
";
$query = $this->_em->createQuery($dql);
$query->setParameter('code', '%'.$upperSearch.'%');
return $query->getResult();
}
private function findBaseWorkspaceRole($roleType, AbstractWorkspace $workspace)
{
$dql = "
SELECT r FROM Claroline\CoreBundle\Entity\Role r
WHERE r.name = 'ROLE_WS_{$roleType}_{$workspace->getGuid()}'
";
$query = $this->_em->createQuery($dql);
return $query->getSingleResult();
}
public function searchByName($search)
{
$upperSearch = strtoupper(trim($search));
$dql = "
SELECT r
FROM Claroline\CoreBundle\Entity\Role r
WHERE UPPER(r.name) LIKE :search
";
$query = $this->_em->createQuery($dql);
$query->setParameter('search', "%{$upperSearch}%");
return $query->getResult();
}
public function findAll()
{
$dql = "
SELECT r, w
FROM Claroline\CoreBundle\Entity\Role r
LEFT JOIN r.workspace w
";
$query = $this->_em->createQuery($dql);
return $query->getResult();
}
public function findPlatformNonAdminRoles()
{
$queryBuilder = $this
->createQueryBuilder('role')
->andWhere("role.type = :roleType")
->setParameter("roleType", Role::PLATFORM_ROLE);
$queryBuilder->andWhere($queryBuilder->expr()->not($queryBuilder->expr()->eq('role.name', '?1')))
->setParameter(1, 'ROLE_ANONYMOUS');
$queryBuilder->andWhere($queryBuilder->expr()->not($queryBuilder->expr()->eq('role.name', '?2')))
->setParameter(2, 'ROLE_ADMIN');
$query = $queryBuilder->getQuery();
return $query->getResult();
}
public function findAllWhereWorkspaceIsDisplayable()
{
$dql = "
SELECT r, w
FROM Claroline\CoreBundle\Entity\Role r
LEFT JOIN r.workspace w
WHERE w.displayable = true
";
$query = $this->_em->createQuery($dql);
return $query->getResult();
}
}
| gpl-3.0 |
davivcgarcia/python-dcc-ufrj | Exercicios - Lista Paulo Roma/Lista 1/ex4.py | 1158 | #! /usr/bin/env python
# coding: utf-8
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Autor: Davi Vercillo C. Garcia
# Data: 24/01/2009
# Objetivo: Verificar se uma palavra é palíndroma.
#
def main():
palavra = raw_input("Insira uma palavra: ")
palavra = list(palavra)
palavra_ao_contrario = palavra + []
palavra_ao_contrario.reverse()
if palavra == palavra_ao_contrario:
print "É palíndromo !"
else:
print "Não é palíndromo !"
return 0
if __name__ == "__main__":
main()
| gpl-3.0 |
RoboCup-SSL/ssl-vision | src/shared/capture/capture_basler.cpp | 12302 | /*
* capture_basler.cpp
*
* Created on: Nov 21, 2016
* Author: root
*/
#include "capture_basler.h"
#include <vector>
#include <string>
#define MUTEX_LOCK mutex.lock()
#define MUTEX_UNLOCK mutex.unlock()
int BaslerInitManager::count = 0;
void BaslerInitManager::register_capture() {
if (count++ == 0) {
Pylon::PylonInitialize();
}
}
void BaslerInitManager::unregister_capture() {
if (--count == 0) {
Pylon::PylonTerminate();
}
}
CaptureBasler::CaptureBasler(VarList* _settings, QObject* parent) :
QObject(parent), CaptureInterface(_settings) {
is_capturing = false;
camera = nullptr;
ignore_capture_failure = false;
converter.OutputPixelFormat = Pylon::PixelType_RGB8packed;
//camera.PixelFormat.SetValue(Basler_GigECamera::PixelFormat_YUV422Packed, true);
last_buf = nullptr;
settings->addChild(vars = new VarList("Capture Settings"));
settings->removeFlags(VARTYPE_FLAG_HIDE_CHILDREN);
vars->removeFlags(VARTYPE_FLAG_HIDE_CHILDREN);
v_color_mode = new VarStringEnum("color mode",
Colors::colorFormatToString(COLOR_RGB8));
v_color_mode->addItem(Colors::colorFormatToString(COLOR_YUV422_UYVY));
v_color_mode->addItem(Colors::colorFormatToString(COLOR_RGB8));
vars->addChild(v_color_mode);
vars->addChild(v_camera_id = new VarInt("Camera ID", 0, 0, 3));
v_framerate = new VarDouble("Max Framerate",100.0,0.0,100.0);
vars->addChild(v_framerate);
v_balance_ratio_red = new VarInt("Balance Ratio Red", 64, 0, 255);
vars->addChild(v_balance_ratio_red);
v_balance_ratio_green = new VarInt("Balance Ratio Green", 64, 0, 255);
vars->addChild(v_balance_ratio_green);
v_balance_ratio_blue = new VarInt("Balance Ratio Blue", 64, 0, 255);
vars->addChild(v_balance_ratio_blue);
v_auto_gain = new VarBool("auto gain", false);
vars->addChild(v_auto_gain);
v_gain = new VarInt("gain", 300, 0, 542);
vars->addChild(v_gain);
v_gamma_enable = new VarBool("enable gamma correction", true);
vars->addChild(v_gamma_enable);
v_gamma = new VarDouble("gamma", 0.5, 0, 1.0);
vars->addChild(v_gamma);
v_black_level = new VarDouble("black level", 64, 0, 1000);
vars->addChild(v_black_level);
v_auto_exposure = new VarBool("auto exposure", false);
vars->addChild(v_auto_exposure);
v_manual_exposure = new VarDouble("manual exposure (μs)", 10000, 1000,
30000);
vars->addChild(v_manual_exposure);
current_id = 0;
mvc_connect(settings);
mvc_connect(vars);
}
CaptureBasler::~CaptureBasler() {
vars->deleteAllChildren();
}
bool CaptureBasler::_buildCamera() {
BaslerInitManager::register_capture();
Pylon::DeviceInfoList devices;
int amt = Pylon::CTlFactory::GetInstance().EnumerateDevices(devices);
current_id = v_camera_id->get();
printf("Current camera id: %d\n", current_id);
if (amt > current_id) {
Pylon::CDeviceInfo info = devices[current_id];
camera = new Pylon::CBaslerGigEInstantCamera(
Pylon::CTlFactory::GetInstance().CreateDevice(info));
printf("Opening camera %d...\n", current_id);
camera->Open();
camera->GammaSelector.SetValue(Basler_GigECamera::GammaSelector_User); //Necessary for interface to work
camera->AcquisitionFrameRateEnable.SetValue(true); //Turn on capped framerates
camera_frequency = camera->GevTimestampTickFrequency.GetValue();;
//let camera send timestamps and FrameCounts.
if (GenApi::IsWritable(camera->ChunkModeActive)) {
camera->ChunkModeActive.SetValue(true);
camera->ChunkSelector.SetValue(Basler_GigECamera::ChunkSelector_Timestamp);
camera->ChunkEnable.SetValue(true);
camera->ChunkSelector.SetValue(Basler_GigECamera::ChunkSelector_Framecounter);
camera->ChunkEnable.SetValue(true);
camera->GevTimestampControlReset.Execute(); //Reset the internal time stamp counter of the camera to 0
} else {
std::cout << "Failed, camera model does not support accurate timings!" << std::endl;
return false; //Camera does not support accurate timings
}
printf("Done!\n");
is_capturing = true;
return true;
}
return false;
}
bool CaptureBasler::startCapture() {
MUTEX_LOCK;
try {
if (camera == nullptr) {
if (!_buildCamera()) {
// Did not make a camera!
MUTEX_UNLOCK;
return false;
}
}
camera->StartGrabbing(Pylon::GrabStrategy_LatestImageOnly);
} catch (Pylon::GenericException& e) {
printf("Pylon exception: %s", e.what());
delete camera;
camera = nullptr;
current_id = -1;
MUTEX_UNLOCK;
return false;
} catch (...) {
printf("Uncaught exception at line 132\n");
MUTEX_UNLOCK;
throw;
}
MUTEX_UNLOCK;
return true;
}
bool CaptureBasler::_stopCapture() {
if (is_capturing) {
camera->StopGrabbing();
camera->Close();
is_capturing = false;
return true;
}
return false;
}
bool CaptureBasler::stopCapture() {
MUTEX_LOCK;
bool stopped;
try {
stopped = _stopCapture();
if (stopped) {
delete camera;
camera = nullptr;
BaslerInitManager::unregister_capture();
}
} catch (...) {
MUTEX_UNLOCK;
throw;
}
MUTEX_UNLOCK;
return stopped;
}
void CaptureBasler::releaseFrame() {
MUTEX_LOCK;
try {
if (last_buf) {
free(last_buf);
last_buf = nullptr;
}
} catch (...) {
MUTEX_UNLOCK;
throw;
}
MUTEX_UNLOCK;
}
RawImage CaptureBasler::getFrame() {
MUTEX_LOCK;
RawImage img;
img.setWidth(0);
img.setHeight(0);
img.setColorFormat(COLOR_RGB8);
try {
// Keep grabbing in case of partial grabs
int fail_count = 0;
while (fail_count < 10
&& (!grab_result || !grab_result->GrabSucceeded())) {
try {
camera->RetrieveResult(1000, grab_result,
Pylon::TimeoutHandling_ThrowException);
} catch (Pylon::TimeoutException& e) {
fprintf(stderr,
"Timeout expired in CaptureBasler::getFrame: %s\n",
e.what());
MUTEX_UNLOCK;
return img;
}
if (!grab_result) {
fail_count++;
continue;
}
if (!grab_result->GrabSucceeded()) {
fail_count++;
fprintf(stderr,
"Image grab failed in CaptureBasler::getFrame: %s\n",
grab_result->GetErrorDescription().c_str());
}
}
if (fail_count == 10) {
fprintf(stderr,
"Maximum retry count for image grabbing (%d) exceeded in capture_basler",
fail_count);
MUTEX_UNLOCK;
return img;
}
Pylon::CPylonImage capture;
// Convert to RGB8 format
converter.Convert(capture, grab_result);
img.setWidth(capture.GetWidth());
img.setHeight(capture.GetHeight());
unsigned char* buf = (unsigned char*) malloc(capture.GetImageSize());
memcpy(buf, capture.GetBuffer(), capture.GetImageSize());
img.setData(buf);
last_buf = buf;
if(grab_result->GetPayloadType() == Pylon::PayloadType_ChunkData &&
GenApi::IsReadable(grab_result->ChunkTimestamp)){
double period = 1e9 / camera_frequency;
uint64_t image_timestamp = period * grab_result->ChunkTimestamp.GetValue();
timeSync.update(image_timestamp);
double time = timeSync.sync(image_timestamp) / 1e9;
img.setTime(time);
} else {
timeval tv = {};
gettimeofday(&tv, nullptr);
double systemTime = (double) tv.tv_sec + (tv.tv_usec / 1000000.0);
img.setTime(systemTime);
}
// Original buffer is not needed anymore, it has been copied to img
grab_result.Release();
} catch (Pylon::GenericException& e) {
fprintf(stderr, "Exception while grabbing a frame: %s\n", e.what());
MUTEX_UNLOCK;
throw;
} catch (...) {
// Make sure the mutex is unlocked before propagating
printf("Uncaught exception!\n");
MUTEX_UNLOCK;
throw;
}
MUTEX_UNLOCK;
return img;
}
string CaptureBasler::getCaptureMethodName() const {
return "Basler";
}
bool CaptureBasler::copyAndConvertFrame(const RawImage & src,
RawImage & target) {
MUTEX_LOCK;
try {
target.ensure_allocation(COLOR_RGB8, src.getWidth(), src.getHeight());
target.setTime(src.getTime());
memcpy(target.getData(), src.getData(), src.getNumBytes());
} catch (...) {
MUTEX_UNLOCK;
throw;
}
MUTEX_UNLOCK;
return true;
}
void CaptureBasler::readAllParameterValues() {
MUTEX_LOCK;
try {
if (!camera)
return;
bool was_open = camera->IsOpen();
if (!was_open) {
camera->Open();
}
v_framerate->setDouble(camera->AcquisitionFrameRateAbs.GetValue());
camera->BalanceRatioSelector.SetValue(
Basler_GigECamera::BalanceRatioSelector_Red);
v_balance_ratio_red->setInt(camera->BalanceRatioRaw.GetValue());
camera->BalanceRatioSelector.SetValue(
Basler_GigECamera::BalanceRatioSelector_Green);
v_balance_ratio_green->setInt(camera->BalanceRatioRaw.GetValue());
camera->BalanceRatioSelector.SetValue(
Basler_GigECamera::BalanceRatioSelector_Blue);
v_balance_ratio_blue->setInt(camera->BalanceRatioRaw.GetValue());
v_auto_gain->setBool(camera->GainAuto.GetValue() == Basler_GigECamera::GainAuto_Continuous);
v_gain->setDouble(camera->GainRaw.GetValue());
v_gamma_enable->setBool(camera->GammaEnable.GetValue());
v_gamma->setDouble(camera->Gamma.GetValue());
v_auto_exposure->setBool(camera->ExposureAuto.GetValue() == Basler_GigECamera::ExposureAuto_Continuous);
v_manual_exposure->setDouble(camera->ExposureTimeAbs.GetValue());
} catch (const Pylon::GenericException& e) {
fprintf(stderr, "Exception reading parameter values: %s\n", e.what());
MUTEX_UNLOCK;
return;
} catch (...) {
MUTEX_UNLOCK;
throw;
}
MUTEX_UNLOCK;
}
void CaptureBasler::resetCamera(unsigned int new_id) {
bool restart = is_capturing;
if (restart) {
stopCapture();
}
current_id = new_id;
if (restart) {
startCapture();
}
}
void CaptureBasler::writeParameterValues(VarList* varList) {
if (varList != this->settings) {
return;
}
MUTEX_LOCK;
try {
if(current_id != v_camera_id->get()){
MUTEX_UNLOCK;
resetCamera(v_camera_id->get()); // locks itself
MUTEX_LOCK;
}
if (camera != nullptr) {
camera->Open();
camera->AcquisitionFrameRateAbs.SetValue(v_framerate->getDouble());
camera->BalanceRatioSelector.SetValue(
Basler_GigECamera::BalanceRatioSelector_Red);
camera->BalanceRatioRaw.SetValue(v_balance_ratio_red->get());
camera->BalanceRatioSelector.SetValue(
Basler_GigECamera::BalanceRatioSelector_Green);
camera->BalanceRatioRaw.SetValue(v_balance_ratio_green->get());
camera->BalanceRatioSelector.SetValue(
Basler_GigECamera::BalanceRatioSelector_Blue);
camera->BalanceRatioRaw.SetValue(v_balance_ratio_blue->get());
camera->BalanceWhiteAuto.SetValue(
Basler_GigECamera::BalanceWhiteAuto_Off);
if (v_auto_gain->getBool()) {
camera->GainAuto.SetValue(Basler_GigECamera::GainAuto_Continuous);
} else {
camera->GainAuto.SetValue(Basler_GigECamera::GainAuto_Off);
camera->GainRaw.SetValue(v_gain->getInt());
}
if (v_gamma_enable->getBool()) {
camera->GammaEnable.SetValue(true);
camera->Gamma.SetValue(v_gamma->getDouble());
} else {
camera->GammaEnable.SetValue(false);
}
if (v_auto_exposure->getBool()) {
camera->ExposureAuto.SetValue(
Basler_GigECamera::ExposureAuto_Continuous);
} else {
camera->ExposureAuto.SetValue(Basler_GigECamera::ExposureAuto_Off);
camera->ExposureTimeAbs.SetValue(v_manual_exposure->getDouble());
}
}
} catch (const Pylon::GenericException& e) {
MUTEX_UNLOCK;
fprintf(stderr, "Error writing parameter values: %s\n", e.what());
throw;
} catch (...) {
MUTEX_UNLOCK;
throw;
}
MUTEX_UNLOCK;
}
void CaptureBasler::mvc_connect(VarList * group) {
vector<VarType *> v = group->getChildren();
for (auto & i : v) {
connect(i,SIGNAL(wasEdited(VarType *)),group,SLOT(mvcEditCompleted()));
}
connect(group,SIGNAL(wasEdited(VarType *)),this,SLOT(changed(VarType *)));
}
void CaptureBasler::changed(VarType * group) {
if (group->getType() == VARTYPE_ID_LIST) {
writeParameterValues(dynamic_cast<VarList*>(group));
}
}
| gpl-3.0 |
geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtmultimedia/examples/multimediawidgets/videographicsitem/main.cpp | 2952 | /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "videoplayer.h"
#include <QApplication>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QDir>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QCoreApplication::setApplicationName("Player Example");
QCoreApplication::setOrganizationName("QtProject");
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
QCommandLineParser parser;
parser.setApplicationDescription("Qt MultiMedia Player QGraphicsView Example");
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("url", "The URL to open.");
parser.process(app);
VideoPlayer player;
if (!parser.positionalArguments().isEmpty() && player.isPlayerAvailable()) {
const QUrl url =
QUrl::fromUserInput(parser.positionalArguments().constFirst(),
QDir::currentPath(), QUrl::AssumeLocalFile);
player.load(url);
}
player.show();
return app.exec();
}
| gpl-3.0 |
Interfacelab/ilab-media-tools | lib/mcloud-aws/aws-sdk-php/src/Signature/SignatureProvider.php | 4566 | <?php
namespace MediaCloud\Vendor\Aws\Signature;
use MediaCloud\Vendor\Aws\Exception\UnresolvedSignatureException;
/**
* Signature providers.
*
* A signature provider is a function that accepts a version, service, and
* region and returns a {@see SignatureInterface} object on success or NULL if
* no signature can be created from the provided arguments.
*
* You can wrap your calls to a signature provider with the
* {@see SignatureProvider::resolve} function to ensure that a signature object
* is created. If a signature object is not created, then the resolve()
* function will throw a {@see MediaCloud\Vendor\Aws\Exception\UnresolvedSignatureException}.
*
* use MediaCloud\Vendor\Aws\Signature\SignatureProvider;
* $provider = SignatureProvider::defaultProvider();
* // Returns a SignatureInterface or NULL.
* $signer = $provider('v4', 's3', 'us-west-2');
* // Returns a SignatureInterface or throws.
* $signer = SignatureProvider::resolve($provider, 'no', 's3', 'foo');
*
* You can compose multiple providers into a single provider using
* {@see MediaCloud\Vendor\Aws\or_chain}. This function accepts providers as arguments and
* returns a new function that will invoke each provider until a non-null value
* is returned.
*
* $a = SignatureProvider::defaultProvider();
* $b = function ($version, $service, $region) {
* if ($version === 'foo') {
* return new MyFooSignature();
* }
* };
* $c = \MediaCloud\Vendor\Aws\or_chain($a, $b);
* $signer = $c('v4', 'abc', '123'); // $a handles this.
* $signer = $c('foo', 'abc', '123'); // $b handles this.
* $nullValue = $c('???', 'abc', '123'); // Neither can handle this.
*/
class SignatureProvider
{
private static $s3v4SignedServices = [
's3' => true,
's3control' => true,
];
/**
* Resolves and signature provider and ensures a non-null return value.
*
* @param callable $provider Provider function to invoke.
* @param string $version Signature version.
* @param string $service Service name.
* @param string $region Region name.
*
* @return SignatureInterface
* @throws UnresolvedSignatureException
*/
public static function resolve(callable $provider, $version, $service, $region)
{
$result = $provider($version, $service, $region);
if ($result instanceof SignatureInterface) {
return $result;
}
throw new UnresolvedSignatureException(
"Unable to resolve a signature for $version/$service/$region.\n"
. "Valid signature versions include v4 and anonymous."
);
}
/**
* Default SDK signature provider.
*
* @return callable
*/
public static function defaultProvider()
{
return self::memoize(self::version());
}
/**
* Creates a signature provider that caches previously created signature
* objects. The computed cache key is the concatenation of the version,
* service, and region.
*
* @param callable $provider Signature provider to wrap.
*
* @return callable
*/
public static function memoize(callable $provider)
{
$cache = [];
return function ($version, $service, $region) use (&$cache, $provider) {
$key = "($version)($service)($region)";
if (!isset($cache[$key])) {
$cache[$key] = $provider($version, $service, $region);
}
return $cache[$key];
};
}
/**
* Creates signature objects from known signature versions.
*
* This provider currently recognizes the following signature versions:
*
* - v4: Signature version 4.
* - anonymous: Does not sign requests.
*
* @return callable
*/
public static function version()
{
return function ($version, $service, $region) {
switch ($version) {
case 's3v4':
case 'v4':
return !empty(self::$s3v4SignedServices[$service])
? new S3SignatureV4($service, $region)
: new SignatureV4($service, $region);
case 'v4-unsigned-body':
return new SignatureV4($service, $region, ['unsigned-body' => 'true']);
case 'anonymous':
return new AnonymousSignature();
default:
return null;
}
};
}
}
| gpl-3.0 |
kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/bank/bank.py | 5527 | # This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from stdnum import iban
from sql import operators, Literal, Null
from sql.conditionals import Case
from trytond.model import ModelView, ModelSQL, fields
__all__ = ['Bank', 'BankAccount', 'BankAccountNumber', 'BankAccountParty']
class Bank(ModelSQL, ModelView):
'Bank'
__name__ = 'bank'
_rec_name = 'party'
party = fields.Many2One('party.party', 'Party', required=True,
ondelete='CASCADE')
bic = fields.Char('BIC', size=11, help='Bank/Business Identifier Code')
def get_rec_name(self, name):
return self.party.rec_name
class BankAccount(ModelSQL, ModelView):
'Bank Account'
__name__ = 'bank.account'
bank = fields.Many2One('bank', 'Bank', required=True)
owners = fields.Many2Many('bank.account-party.party', 'account', 'owner',
'Owners')
currency = fields.Many2One('currency.currency', 'Currency')
numbers = fields.One2Many('bank.account.number', 'account', 'Numbers',
required=True)
active = fields.Boolean('Active', select=True)
@staticmethod
def default_active():
return True
def get_rec_name(self, name):
return self.numbers[0].number
@classmethod
def search_rec_name(cls, name, clause):
return [('numbers',) + tuple(clause[1:])]
class BankAccountNumber(ModelSQL, ModelView):
'Bank Account Number'
__name__ = 'bank.account.number'
_rec_name = 'number'
account = fields.Many2One('bank.account', 'Account', required=True,
ondelete='CASCADE', select=True)
type = fields.Selection([
('iban', 'IBAN'),
('other', 'Other'),
], 'Type', required=True)
number = fields.Char('Number')
number_compact = fields.Char('Number Compact', readonly=True)
sequence = fields.Integer('Sequence')
@classmethod
def __setup__(cls):
super(BankAccountNumber, cls).__setup__()
cls._order.insert(0, ('account', 'ASC'))
cls._order.insert(1, ('sequence', 'ASC'))
cls._error_messages.update({
'invalid_iban': 'Invalid IBAN "%s".',
})
@staticmethod
def order_sequence(tables):
table, _ = tables[None]
return [Case((table.sequence == Null, 0), else_=1), table.sequence]
@classmethod
def domain_number(cls, domain, tables):
table, _ = tables[None]
name, operator, value = domain
Operator = fields.SQL_OPERATORS[operator]
result = None
for field in (cls.number, cls.number_compact):
column = field.sql_column(table)
expression = Operator(column, field._domain_value(operator, value))
if isinstance(expression, operators.In) and not expression.right:
expression = Literal(False)
elif (isinstance(expression, operators.NotIn)
and not expression.right):
expression = Literal(True)
expression = field._domain_add_null(
column, operator, value, expression)
if result:
result |= expression
else:
result = expression
return result
@property
def compact_iban(self):
return (iban.compact(self.number) if self.type == 'iban'
else self.number)
@classmethod
def create(cls, vlist):
vlist = [v.copy() for v in vlist]
for values in vlist:
if values.get('type') == 'iban' and 'number' in values:
values['number'] = iban.format(values['number'])
values['number_compact'] = iban.compact(values['number'])
return super(BankAccountNumber, cls).create(vlist)
@classmethod
def write(cls, *args):
actions = iter(args)
args = []
for numbers, values in zip(actions, actions):
values = values.copy()
if values.get('type') == 'iban' and 'number' in values:
values['number'] = iban.format(values['number'])
values['number_compact'] = iban.compact(values['number'])
args.extend((numbers, values))
super(BankAccountNumber, cls).write(*args)
to_write = []
for number in sum(args[::2], []):
if number.type == 'iban':
formated_number = iban.format(number.number)
compacted_number = iban.compact(number.number)
if ((formated_number != number.number)
or (compacted_number != number.number_compact)):
to_write.extend(([number], {
'number': formated_number,
'number_compact': compacted_number,
}))
if to_write:
cls.write(*to_write)
@fields.depends('type', 'number')
def pre_validate(self):
super(BankAccountNumber, self).pre_validate()
if (self.type == 'iban' and self.number
and not iban.is_valid(self.number)):
self.raise_user_error('invalid_iban', self.number)
class BankAccountParty(ModelSQL):
'Bank Account - Party'
__name__ = 'bank.account-party.party'
account = fields.Many2One('bank.account', 'Account',
ondelete='CASCADE', select=True, required=True)
owner = fields.Many2One('party.party', 'Owner', ondelete='CASCADE',
select=True, required=True)
| gpl-3.0 |
kamibu/finalengine | src/scene/lights/light.js | 158 | /*global
SceneNode : false
*/
/**
* @constructor
* @extends SceneNode
*/
function Light(){
SceneNode.call( this );
}
Light.extend( SceneNode );
| gpl-3.0 |
pesapower/ikiwi | iKiwi/Messages/EncryptionKey.cs | 2589 | using System;
using System.Text;
namespace iKiwi.Messages
{
/// <summary>
/// Encryption Key message.
/// </summary>
class EncryptionKey : AbstractMessage
{
#region Data Members
/// <summary>
/// The symmetric encryption key.
/// </summary>
private string m_strSymmetricEncryptionKey;
#endregion
#region Properties
public override string Parameters
{
get
{
return (string.Format("EK {0}",
this.m_strSymmetricEncryptionKey));
}
}
public override byte[] ParametersByte
{
get
{
return (
ASCIIEncoding.Unicode.GetBytes(this.Parameters)
);
}
}
#endregion
#region Ctor
/// <summary>
/// Create a EK-message.
/// </summary>
/// <param name="MessageID">The message ID.</param>
/// <param name="TTL">The time to live.</param>
/// <param name="Encryption">Indicates if the message is encrypted or not.</param>
/// <param name="Parameters">The list of the parameters with prefixes.</param>
public EncryptionKey(string MessageID, int TTL, bool Encryption, params string[] Parameters)
: base(Commands.EK, MessageID, TTL, Encryption)
{
if (Parameters.Length == 1)
{
Parameters[0] = Parameters[0].Remove(0, 3).Trim();
this.CreateEncryptionKey(Parameters);
}
}
/// <summary>
/// Create a EK-message.
/// </summary>
/// <param name="TTL">The time to live.</param>
/// <param name="Encryption">Indicates if the message is encrypted or not.</param>
/// <param name="Parameters">The list of the parameters without prefixes.</param>
public EncryptionKey(int TTL, bool Encryption, params string[] Parameters)
: base(Commands.EK, string.Empty, TTL, Encryption)
{
if (Parameters.Length == 1)
{
this.CreateEncryptionKey(Parameters);
}
}
#endregion
#region Private Methods
/// <summary>
/// Create a EK-message.
/// </summary>
/// <param name="Parameters">The list of the parameters without prefixes.</param>
private void CreateEncryptionKey(params string[] Parameters)
{
this.m_strSymmetricEncryptionKey = Parameters[0];
}
#endregion
#region Methods
public override void Process()
{
// save the symmetric encryption key
this.SenderPeer.SymmetricEncryptionKey = Utilities.Converterer.ConvertHexToByte(this.m_strSymmetricEncryptionKey);
if (Global.MessageEncryptionEnabled == true)
{
this.SenderPeer.SecureStream = true;
}
}
#endregion
}
}
| gpl-3.0 |
decoit/Visa-Topologie-Editor | backend/src/de/decoit/visa/topology/VLAN.java | 7122 | /*
* Copyright (C) 2013, DECOIT GmbH
*
* This file is part of VISA Topology-Editor.
*
* VISA Topology-Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* VISA Topology-Editor is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* VISA Topology-Editor. If not, see <http://www.gnu.org/licenses/>.
*/
package de.decoit.visa.topology;
import java.util.ArrayList;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.log4j.Logger;
import org.json.JSONException;
import org.json.JSONObject;
import de.decoit.visa.TEBackend;
import de.decoit.visa.interfaces.IJSON;
import de.decoit.visa.interfaces.IRDFObject;
import de.decoit.visa.interfaces.IRemovableComponent;
import de.decoit.visa.interfaces.ITopologyElement;
import de.decoit.visa.rdf.VISA;
import de.decoit.visa.rdf.VISABackup;
import de.decoit.visa.topology.NetworkComponent.Interface;
/**
* This class represents a VLAN in the topology. A VLAN must have a name and a
* color. The color will be used to show it on the topology editor grid. The
* name is used as a human readable identifier but it is not required be unique
* in a topology. An ID number is used for identification which is set or
* generated in the constructor and must be unique.
*
* @author Thomas Rix
*/
public class VLAN implements ITopologyElement, IRDFObject, IJSON, IRemovableComponent {
/**
* Type string used to build the local name for new components
*/
private static final String TYPE = "vlan";
private static Logger log = Logger.getLogger(VLAN.class.getName());
private static ColorChooser colorChooser = new ColorChooser();
private int id;
private String name;
private String color;
private String localName;
private ArrayList<Interface> interfaces;
/**
* This constructor will use the provided ID for the created VLAN,
* color will be chosen from colorChooser, name will be set to default
* value:
* name: "VLAN id"
* The ID will be checked to be unique, providing an already used ID will
* cause an InvalidArgumentException
*
* @param pID The ID which will be used for this VLAN
* @param pLocName
*/
VLAN(int pID, String pLocName) {
interfaces = new ArrayList<>();
id = pID;
StringBuilder sbName = new StringBuilder("VLAN ");
sbName.append(pID);
name = sbName.toString();
color = colorChooser.getNextColor();
// Check if the given local name is valid
if(pLocName != null && !pLocName.isEmpty()) {
localName = pLocName;
}
else {
StringBuilder sbLocalName = new StringBuilder(VLAN.TYPE);
sbLocalName.append("_");
sbLocalName.append(pID);
localName = sbLocalName.toString();
}
TEBackend.RDF_MANAGER.updateProperty(this, VISA.ID);
TEBackend.RDF_MANAGER.updateProperty(this, VISABackup.NAME);
TEBackend.RDF_MANAGER.updateProperty(this, VISABackup.VLAN_COLOR);
if(log.isTraceEnabled()) {
StringBuilder sb = new StringBuilder("VLAN created: ");
sb.append(localName);
log.trace(sb.toString());
}
}
/**
* Return the ID number of this VLAN
*
* @return The ID number
*/
public int getID() {
return id;
}
@Override
public String getRDFLocalName() {
return localName;
}
@Override
public String getIdentifier() {
return getRDFLocalName();
}
/**
* Set a new name for this VLAN
*
* @param pName New name, cannot be empty
* @throws IllegalArgumentException
*/
public final void setName(String pName) throws IllegalArgumentException {
// Check if the provided name is not empty
if(!pName.isEmpty()) {
name = pName;
TEBackend.RDF_MANAGER.updateProperty(this, VISABackup.NAME);
}
else {
throw new IllegalArgumentException("Empty name provided");
}
}
/**
* Return the current name of this VLAN
*
* @return The current name of this VLAN
*/
public final String getName() {
return name;
}
/**
* Set a new display color for this VLAN
*
* @param pColor New color, must be a hexadecimal RGB color string (#RRGGBB)
* @throws IllegalArgumentException
*/
public final void setColor(String pColor) throws IllegalArgumentException {
// Check if the provided string matches the required color format
if(pColor.matches("#[a-fA-F0-9]{6}")) {
color = pColor.toUpperCase();
TEBackend.RDF_MANAGER.updateProperty(this, VISABackup.VLAN_COLOR);
}
else {
throw new IllegalArgumentException("Malformed color string");
}
}
/**
* Return the current color of this VLAN
*
* @return The current color of this VLAN
*/
public final String getColor() {
return color;
}
@Override
public void removeFromTopology() {
if(interfaces.size() == 0) {
TEBackend.RDF_MANAGER.removeVLAN(this);
}
else {
throw new IllegalStateException("VLAN is still assigned to interfaces");
}
}
@Override
public JSONObject toJSON() throws JSONException {
JSONObject rv = new JSONObject();
rv.put("identifier", getIdentifier());
rv.put("name", StringEscapeUtils.escapeHtml4(name));
rv.put("color", color);
return rv;
}
/**
* Reset the color chooser to its initial state
*/
public static void resetColorChooser() {
colorChooser.reset();
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
result = prime * result + ((localName == null) ? 0 : localName.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if(this == obj) {
return true;
}
else if(obj instanceof VLAN) {
VLAN v = (VLAN) obj;
return (v.id == id && v.localName.equals(localName));
}
else {
return false;
}
}
/**
* This class contains predefined colors for VLANs which will be selected
* by a round-robin system. It is used if new VLANs without color
* information, for example if extracted from an RDF model, are created.
*
* @author Thomas Rix
*/
private static class ColorChooser {
private String[] colors = { "#CCCCFF", "#9999FF", "#6666FF", "#3333FF", "#FFB2B2", "#FF9999", "#FF6666", "#FF4D4D", "#00FF00", "#00CC00", "#00B200", "#009900" };
private int nextColor;
private int colorCount;
/**
* Construct a new color chooserF
*/
public ColorChooser() {
nextColor = 0;
colorCount = colors.length;
}
/**
* Return the next color and increment the next color counter by 1. If
* all colors were used the counter will be reset to 0 and all colors
* are used again.
*
* @return The next color string
*/
public String getNextColor() {
String rv = colors[nextColor++];
if(nextColor == colorCount) {
nextColor = 0;
}
return rv;
}
/**
* Reset the next color counter to 0
*/
public void reset() {
nextColor = 0;
}
}
}
| gpl-3.0 |
dmitry-vlasov/russell | src/rus/transform/rus_transform_unused_steps.cpp | 3170 | #include <atomic>
#include <rus_ast.hpp>
#include <rus/prover/unify/rus_prover_unify_index.hpp>
namespace mdl { namespace rus {
void reduce_unused_steps(Proof* proof, std::atomic<int>& counter) {
set<const Step*> used_steps;
traverseProof(proof->qed(), [&used_steps](Writable* n) {
if (Step* s = dynamic_cast<Step*>(n)) {
used_steps.insert(s);
}
});
if (used_steps.size() < proof->steps.size()) {
//int d = proof->steps.size() - used_steps.size();
//cout << "proof of theorem " << Lex::toStr(proof->theorem->id()) << " SHOULD BE reduced by " << d << " unused steps" << endl;
//cout << *proof->theorem << endl;
map<const Step*, Step*> steps_map;
vector<unique_ptr<Step>> new_steps;
for (auto& step : proof->steps) {
if (used_steps.count(step.get())) {
uint new_ind = new_steps.size();
Step* new_step = new Step(
new_ind, step->kind(), step->ass_id(), step->proof_, step->token
);
new_step->expr = std::move(step->expr);
new_step->sub = std::move(step->sub);
for (const auto& ref : step->refs) {
switch (ref->kind()) {
case Ref::HYP: new_step->refs.emplace_back(make_unique<Ref>(ref->hyp(), ref->token)); break;
case Ref::STEP: new_step->refs.emplace_back(make_unique<Ref>(steps_map.at(ref->step()), ref->token)); break;
}
}
steps_map[step.get()] = new_step;
new_steps.emplace_back(new_step);
}
}
int diff = proof->steps.size() - new_steps.size();
//if (diff != d) {
// throw Error("diff != d: " + to_string(diff) + " != " + to_string(d));
//}
if (diff > 0) {
Io::io().println("proof of theorem " + Lex::toStr(proof->theorem->id()) + " reduced by " + to_string(diff) + " unused steps\n");
counter.store(counter.load() + diff);
} else {
throw Error("diff must be > 0");
}
proof->steps = std::move(new_steps);
//proof->theorem->verify();
//cout << *proof->theorem << endl;
}
}
#ifdef PARALLEL
#define PARALLEL_UNUSED_STEPS
#endif
void reduce_unused_steps(const string& opts) {
map<string, string> parsed_opts = parse_options(opts);
uint theorem = parsed_opts.count("theorem") ? Lex::toInt(parsed_opts.at("theorem")) : -1;
//vector<Assertion*> assertions = Sys::mod().math.get<Assertion>().sortedValues(
// [](const Assertion* a1, const Assertion* a2) {
// return a1->token.preceeds(a2->token);
// }
//);
vector<Assertion*> assertions = Sys::mod().math.get<Assertion>().values();
std::atomic<int> counter(0);
vector<Proof*> proofs;
for (Assertion* a : assertions) {
if (Theorem* thm = dynamic_cast<Theorem*>(a)) {
if (theorem == -1 || thm->id() == theorem) {
if (Proof* proof = thm->proof.get()) {
proofs.push_back(proof);
}
}
}
}
#ifdef PARALLEL_UNUSED_STEPS
tbb::parallel_for (tbb::blocked_range<size_t>(0, proofs.size()),
[&proofs, &counter] (const tbb::blocked_range<size_t>& r) {
for (size_t i = r.begin(); i != r.end(); ++i) {
reduce_unused_steps(proofs[i], counter);
}
}
);
#else
for (auto proof : proofs) {
reduce_unused_steps(proof, counter);
}
#endif
verify();
if (counter.load() > 0) {
cout << "unused steps totally removed: " << counter.load() << endl;
}
}
}} // mdl::rus
| gpl-3.0 |
ProteinDF/ProteinDF | src/libpdftl/tl_dense_vector_impl_lapack.cc | 7680 | #include <algorithm>
#include <cassert>
#include <functional>
#include <numeric>
#include "TlUtils.h"
#include "lapack.h"
#include "tl_dense_vector_impl_lapack.h"
TlDenseVector_ImplLapack::TlDenseVector_ImplLapack(
const TlDenseVectorObject::index_type size)
: size_(size), vector_(NULL) {
this->initialize(true);
}
TlDenseVector_ImplLapack::TlDenseVector_ImplLapack(
const TlDenseVector_ImplLapack& rhs)
: size_(rhs.getSize()), vector_(NULL) {
this->initialize(false);
std::copy(rhs.vector_, rhs.vector_ + rhs.getSize(), this->vector_);
}
TlDenseVector_ImplLapack::TlDenseVector_ImplLapack(
const std::vector<double>& rhs)
: size_(rhs.size()), vector_(NULL) {
this->initialize(false);
std::copy(rhs.begin(), rhs.end(), this->vector_);
}
TlDenseVector_ImplLapack::TlDenseVector_ImplLapack(
const std::valarray<double>& rhs)
: size_(rhs.size()), vector_(NULL) {
this->initialize(false);
std::copy(&(rhs[0]), &(rhs[0]) + rhs.size(), this->vector_);
}
TlDenseVector_ImplLapack::~TlDenseVector_ImplLapack() {
delete[] this->vector_;
this->vector_ = NULL;
}
TlDenseVector_ImplLapack::operator std::vector<double>() const {
std::vector<double> answer(this->vector_, this->vector_ + this->getSize());
return answer;
}
// ---------------------------------------------------------------------------
// properties
// ---------------------------------------------------------------------------
TlDenseVectorObject::index_type TlDenseVector_ImplLapack::getSize() const {
return this->size_;
}
void TlDenseVector_ImplLapack::resize(
const TlDenseVectorObject::index_type newSize) {
assert(newSize > 0);
const TlDenseVector_ImplLapack oldVector(*this);
// destroy object
delete[] this->vector_;
this->vector_ = NULL;
// initialize
this->size_ = newSize;
this->initialize(true);
// copy old data
const TlDenseVectorObject::index_type maxSizeForCopy =
std::min(oldVector.getSize(), newSize);
#pragma omp parallel for
for (TlDenseVectorObject::index_type i = 0; i < maxSizeForCopy; ++i) {
this->set(i, oldVector.get(i));
}
}
double TlDenseVector_ImplLapack::get(
const TlDenseVectorObject::index_type i) const {
return this->vector_[i];
}
void TlDenseVector_ImplLapack::set(const TlDenseVectorObject::index_type i,
const double value) {
#pragma omp critical(TlDenseGeneralVector_ImplLapack__set)
{ this->vector_[i] = value; }
}
void TlDenseVector_ImplLapack::add(const TlDenseVectorObject::index_type i,
const double value) {
#pragma omp atomic
this->vector_[i] += value;
}
void TlDenseVector_ImplLapack::mul(const TlDenseVectorObject::index_type i,
const double value) {
#pragma omp atomic
this->vector_[i] *= value;
}
// ---------------------------------------------------------------------------
// operators
// ---------------------------------------------------------------------------
TlDenseVector_ImplLapack& TlDenseVector_ImplLapack::operator=(
const TlDenseVector_ImplLapack& rhs) {
if (this != &rhs) {
delete[] this->vector_;
this->vector_ = NULL;
this->size_ = rhs.getSize();
this->initialize(false);
std::copy(rhs.vector_, rhs.vector_ + rhs.getSize(), this->vector_);
}
return (*this);
}
TlDenseVector_ImplLapack& TlDenseVector_ImplLapack::operator+=(
const TlDenseVector_ImplLapack& rhs) {
const TlDenseVectorObject::size_type size = this->getSize();
#pragma omp parallel for
for (TlDenseVectorObject::size_type i = 0; i < size; ++i) {
this->vector_[i] += rhs.get(i);
}
return *this;
}
TlDenseVector_ImplLapack& TlDenseVector_ImplLapack::operator-=(
const TlDenseVector_ImplLapack& rhs) {
const TlDenseVectorObject::size_type size = this->getSize();
#pragma omp parallel for
for (TlDenseVectorObject::size_type i = 0; i < size; ++i) {
this->vector_[i] -= rhs.get(i);
}
return *this;
}
TlDenseVector_ImplLapack& TlDenseVector_ImplLapack::operator*=(
const double rhs) {
const TlDenseVectorObject::size_type size = this->getSize();
#pragma omp parallel for
for (TlDenseVectorObject::size_type i = 0; i < size; ++i) {
this->vector_[i] *= rhs;
}
return *this;
}
TlDenseVector_ImplLapack& TlDenseVector_ImplLapack::operator/=(
const double rhs) {
return this->operator*=(1.0 / rhs);
}
double TlDenseVector_ImplLapack::operator*(
const TlDenseVector_ImplLapack& rhs) const {
return this->dot(rhs);
}
// ---------------------------------------------------------------------------
// operations
// ---------------------------------------------------------------------------
double* TlDenseVector_ImplLapack::data() { return this->vector_; }
const double* TlDenseVector_ImplLapack::data() const { return this->vector_; }
double TlDenseVector_ImplLapack::sum() const {
return std::accumulate(this->vector_, this->vector_ + this->getSize(), 0.0);
}
void TlDenseVector_ImplLapack::sortByGreater() {
std::sort(this->vector_, this->vector_ + this->getSize(),
std::greater<double>());
}
double TlDenseVector_ImplLapack::dot(
const TlDenseVector_ImplLapack& rhs) const {
assert(this->getSize() == rhs.getSize());
const int N = this->getSize();
const int incX = 1;
const int incY = 1;
const double v = ddot_(&N, this->vector_, &incX, rhs.vector_, &incY);
return v;
}
TlDenseVector_ImplLapack& TlDenseVector_ImplLapack::dotInPlace(
const TlDenseVector_ImplLapack& rhs) {
assert(this->getSize() == rhs.getSize());
std::transform(rhs.vector_, rhs.vector_ + rhs.getSize(), this->vector_,
this->vector_, std::multiplies<double>());
return *this;
}
// ---------------------------------------------------------------------------
// protected
// ---------------------------------------------------------------------------
void TlDenseVector_ImplLapack::initialize(bool clearIfNeeded) {
const TlDenseVectorObject::size_type size = this->getSize();
if (size > 0) {
try {
this->vector_ = new double[size];
} catch (std::bad_alloc& ba) {
this->log_.critical(TlUtils::format(
"bad_alloc caught: %s: size=%ld", ba.what(), size));
} catch (...) {
this->log_.critical("unknown error.");
throw;
}
assert(this->vector_ != NULL);
if (clearIfNeeded) {
std::fill(this->vector_, this->vector_ + size, 0.0);
}
}
}
// ---------------------------------------------------------------------------
// others
// ---------------------------------------------------------------------------
TlDenseVector_ImplLapack operator+(const TlDenseVector_ImplLapack& rhs1,
const TlDenseVector_ImplLapack& rhs2) {
TlDenseVector_ImplLapack answer = rhs1;
answer += rhs2;
return answer;
}
TlDenseVector_ImplLapack operator-(const TlDenseVector_ImplLapack& rhs1,
const TlDenseVector_ImplLapack& rhs2) {
TlDenseVector_ImplLapack answer = rhs1;
answer -= rhs2;
return answer;
}
TlDenseVector_ImplLapack operator*(const TlDenseVector_ImplLapack& rhs1,
const double rhs2) {
TlDenseVector_ImplLapack answer = rhs1;
answer *= rhs2;
return answer;
}
TlDenseVector_ImplLapack operator*(const double rhs1,
const TlDenseVector_ImplLapack& rhs2) {
return (rhs2 * rhs1);
}
| gpl-3.0 |
proycon/foliatools | foliatools/conllu2folia.py | 7029 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
#---------------------------------------------------------------
# CONNL-U to FoLiA converter
# by Maarten van Gompel
# Centre for Language and Speech technology
# Radboud University Nijmegen
# proycon AT anaproy DOT nl
#
# Licensed under GPLv3
#
#----------------------------------------------------------------
"""CONNL-U to FoLiA converter"""
from __future__ import print_function, unicode_literals, division, absolute_import
import sys
import os
import argparse
import conllu
import traceback
import folia.main as folia
from foliatools import VERSION as TOOLVERSION
from foliatools.common import makencname, set_metadata
UPOS_SET = "https://raw.githubusercontent.com/proycon/folia/master/setdefinitions/universal-pos.foliaset.ttl"
UDEP_SET = "https://raw.githubusercontent.com/proycon/folia/master/setdefinitions/universal-dependencies.foliaset.ttl"
def main():
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--id',type=str,help="Document ID for the FoLiA document", action='store',default="",required=False)
parser.add_argument('--lemma-set',dest="lemmaset", type=str,help="URL of the set definition for lemmas", action='store',default="undefined",required=False)
parser.add_argument('--pos-set',dest="posset",type=str,help="URL of the set definition for *language-specific* part-of-speech and features (xpos and not the universal pos!)", action='store',default="undefined",required=False)
parser.add_argument('--dependency-set',dest="depset", type=str,help="Dependency set", action='store',default=UDEP_SET, required=False)
parser.add_argument('-o', '--outputdir',type=str,help="Output directory", action='store',default=".", required=False)
parser.add_argument('--outputfile',type=str,help="Output file", action='store', required=False)
parser.add_argument('files', nargs='+', help='CONLL-U input files')
args = parser.parse_args()
for file in args.files:
convert(file, **args.__dict__)
def convert(file, **args):
if args.get('id'):
doc_id = makencname(args['id'])
else:
doc_id = makencname(os.path.basename(file).replace(".conllu","").replace(".conllu",""))
doc = None
hascontent = False
with open(file,'r',encoding='utf-8') as f:
sentences = conllu.parse(f.read())
for i, tokenlist in enumerate(sentences):
if 'newdoc id' in tokenlist.metadata or i == 0:
if doc is not None and hascontent:
doc.save(os.path.join(args['outputdir'], doc_id + ".folia.xml"))
print("Wrote " + doc_id + ".folia.xml",file=sys.stderr)
if 'newdoc id' in tokenlist.metadata:
doc_id = tokenlist.metadata['newdoc id']
hascontent = False
processor = folia.Processor.create("conllu2folia", version=TOOLVERSION)
doc = folia.Document(id=doc_id, processor=processor)
textbody = folia.Text(doc, id=doc_id+'.text')
doc.append(textbody)
anchor = textbody
if 'newpar id' in tokenlist.metadata:
par_id = tokenlist.metadata['newpar id']
if par_id.isnumeric():
par_id = doc_id + ".p." + par_id
anchor = textbody.append(folia.Paragraph, id=par_id)
if 'sent_id' in tokenlist.metadata:
sent_id = tokenlist.metadata['sent_id']
if sent_id.isnumeric():
sent_id = doc_id + ".s." + sent_id
else:
sent_id = doc_id + '.s.' + str(i+1)
sentence = folia.Sentence(doc, id=sent_id)
if 'text' in tokenlist.metadata:
sentence.add(folia.TextContent, tokenlist.metadata['text'], cls="original")
elif 'text_en' in tokenlist.metadata:
sentence.add(folia.TextContent, tokenlist.metadata['text_en'], cls="text_en")
wordindex = {} #quick lookup index for this sentence
for token in tokenlist:
if token['misc'] and 'SpaceAfter' in token['misc'] and token['misc']['SpaceAfter'].lower() == 'no':
space = False
else:
space = True
word = sentence.add(folia.Word, token['form'], id=sent_id + ".w." + str(token['id']), space=space)
wordindex[token['id']] = word
if token['upostag']:
pos = word.add(folia.PosAnnotation, cls=token['upostag'], set=UPOS_SET)
if isinstance(token['feats'], dict):
for subset, cls in token['feats'].items():
pos.add(folia.Feature,subset=subset,cls=cls)
if token['xpostag']:
word.append(folia.PosAnnotation, cls=token['xpostag'], set=args.get('posset','undefined'))
if isinstance(token['feats'], dict) and not token['upostag']:
for subset, cls in token['feats'].items():
pos.add(folia.Feature,subset=subset,cls=cls)
if token['lemma']:
word.add(folia.LemmaAnnotation, cls=token['lemma'], set=args.get('lemmaset','undefined'))
hascontent = True
for token in tokenlist:
if token['head'] and token['deprel']:
try:
head = wordindex[token['head']]
except KeyError:
raise KeyError("Dependency Head for token " + str(token['id']) + " in sentence " + sentence.id + " points to token " + str(token['head']) +", which does no exist")
sentence.add(folia.Dependency(doc, set=args.get('depset',UDEP_SET), cls=token['deprel'], contents=[
folia.DependencyHead(doc, wordindex[token['head']]),
folia.DependencyDependent(doc, wordindex[token['id']])
]))
anchor.add(sentence)
if doc is not None and hascontent:
if 'outputfile' in args and args['outputfile']:
doc.save(args['outputfile'])
print("Wrote " + args['outputfile'],file=sys.stderr)
else:
doc.save(os.path.join(args['outputdir'], doc_id + ".folia.xml"))
print("Wrote " + doc_id + ".folia.xml",file=sys.stderr)
return doc
def flat_convert(filename, targetfilename, *args, **kwargs):
"""Wrapper function for use by FLAT's converter mechanism"""
try:
kwargs['outputfile'] = targetfilename
doc = convert(filename, **kwargs)
set_metadata(doc, **kwargs)
except Exception as e:
print(e,file=sys.stderr)
exc_type, exc_value, exc_traceback = sys.exc_info()
traceback.print_tb(exc_traceback, limit=50, file=sys.stderr)
return False, str(e)
return True
if __name__ == '__main__':
main()
| gpl-3.0 |
ThirtyDegreesRay/OpenHub | app/src/main/java/com/thirtydegreesray/openhub/mvp/contract/IReleasesContract.java | 653 | package com.thirtydegreesray.openhub.mvp.contract;
import com.thirtydegreesray.openhub.mvp.contract.base.IBaseContract;
import com.thirtydegreesray.openhub.mvp.model.Release;
import java.util.ArrayList;
/**
* Created by ThirtyDegreesRay on 2017/9/16 11:05:13
*/
public interface IReleasesContract {
interface View extends IBaseContract.View{
void showReleases(ArrayList<Release> releases);
void setCanLoadMore(boolean canLoadMore);
void showLoadError(String error);
}
interface Presenter extends IBaseContract.Presenter<IReleasesContract.View>{
void loadReleases(int page, boolean isReload);
}
}
| gpl-3.0 |
pritam176/UAQ | Sites/js/lib/bootstrap-select.js | 38941 | (function ($) {
'use strict';
$.expr[':'].icontains = function (obj, index, meta) {
return $(obj).text().toUpperCase().indexOf(meta[3].toUpperCase()) >= 0;
};
var Selectpicker = function (element, options, e) {
if (e) {
e.stopPropagation();
e.preventDefault();
}
this.$element = $(element);
this.$newElement = null;
this.$button = null;
this.$menu = null;
this.$lis = null;
this.options = options;
// If we have no title yet, try to pull it from the html title attribute (jQuery doesnt' pick it up as it's not a
// data-attribute)
if (this.options.title === null) {
this.options.title = this.$element.attr('title');
}
//Expose public methods
this.val = Selectpicker.prototype.val;
this.render = Selectpicker.prototype.render;
this.refresh = Selectpicker.prototype.refresh;
this.setStyle = Selectpicker.prototype.setStyle;
this.selectAll = Selectpicker.prototype.selectAll;
this.deselectAll = Selectpicker.prototype.deselectAll;
this.destroy = Selectpicker.prototype.remove;
this.remove = Selectpicker.prototype.remove;
this.show = Selectpicker.prototype.show;
this.hide = Selectpicker.prototype.hide;
this.init();
};
Selectpicker.VERSION = '1.6.1';
// part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both.
Selectpicker.DEFAULTS = {
noneSelectedText: 'Nothing selected',
noneResultsText: 'No results match',
countSelectedText: '{0} of {1} selected',
maxOptionsText: ['Limit reached ({n} {var} max)', 'Group limit reached ({n} {var} max)', ['items', 'item']],
multipleSeparator: ', ',
style: 'btn-default',
size: 'auto',
title: null,
selectedTextFormat: 'values',
width: false,
container: false,
hideDisabled: false,
showSubtext: false,
showIcon: true,
showContent: true,
dropupAuto: true,
header: false,
liveSearch: false,
actionsBox: false,
iconBase: 'glyphicon',
tickIcon: 'glyphicon-ok',
maxOptions: false,
mobile: false,
selectOnTab: false,
dropdownAlignRight: false
};
Selectpicker.prototype = {
constructor: Selectpicker,
init: function () {
var that = this,
id = this.$element.attr('id');
this.$element.hide();
this.multiple = this.$element.prop('multiple');
this.autofocus = this.$element.prop('autofocus');
this.$newElement = this.createView();
this.$element.after(this.$newElement);
this.$menu = this.$newElement.find('> .dropdown-menu');
this.$button = this.$newElement.find('> button');
this.$searchbox = this.$newElement.find('input');
if (this.options.dropdownAlignRight)
this.$menu.addClass('pull-right');
if (typeof id !== 'undefined') {
this.$button.attr('data-id', id);
$('label[for="' + id + '"]').click(function (e) {
e.preventDefault();
that.$button.focus();
});
}
this.checkDisabled();
this.clickListener();
if (this.options.liveSearch) this.liveSearchListener();
this.render();
this.liHeight();
this.setStyle();
this.setWidth();
if (this.options.container) this.selectPosition();
this.$menu.data('this', this);
this.$newElement.data('this', this);
if (this.options.mobile) this.mobile();
},
createDropdown: function () {
//If we are multiple, then add the show-tick class by default
var multiple = this.multiple ? ' show-tick' : '';
var inputGroup = this.$element.parent().hasClass('input-group') ? ' input-group-btn' : '';
var autofocus = this.autofocus ? ' autofocus' : '';
var header = this.options.header ? '<div class="popover-title"><button type="button" class="close" aria-hidden="true">×</button>' + this.options.header + '</div>' : '';
var searchbox = this.options.liveSearch ? '<div class="bootstrap-select-searchbox"><input type="text" class="input-block-level form-control skip-validation" autocomplete="off" /></div>' : '';
var actionsbox = this.options.actionsBox ? '<div class="bs-actionsbox">' +
'<div class="btn-group btn-block">' +
'<button class="actions-btn bs-select-all btn btn-sm btn-default">' +
'Select All' +
'</button>' +
'<button class="actions-btn bs-deselect-all btn btn-sm btn-default">' +
'Deselect All' +
'</button>' +
'</div>' +
'</div>' : '';
var drop =
'<div class="btn-group bootstrap-select' + multiple + inputGroup + '">' +
'<button type="button" class="btn dropdown-toggle selectpicker" data-toggle="dropdown"' + autofocus + '>' +
'<span class="filter-option pull-left"></span> ' +
'<div class="caret-border"><span class="caret"></span></div>' +
'</button>' +
'<div class="dropdown-menu open">' +
header +
searchbox +
actionsbox +
'<ul class="dropdown-menu inner selectpicker" role="menu">' +
'</ul>' +
'</div>' +
'</div>';
return $(drop);
},
createView: function () {
var $drop = this.createDropdown();
var $li = this.createLi();
$drop.find('ul').append($li);
return $drop;
},
reloadLi: function () {
//Remove all children.
this.destroyLi();
//Re build
var $li = this.createLi();
this.$menu.find('ul').append($li);
},
destroyLi: function () {
this.$menu.find('li').remove();
},
createLi: function () {
var that = this,
_liA = [],
_liHtml = '',
optID = 0;
this.$element.find('option').each(function () {
var $this = $(this);
//Get the class and text for the option
var optionClass = $this.attr('class') || '';
var inline = $this.attr('style') || '';
var text = $this.data('content') ? $this.data('content') : $this.html();
var subtext = typeof $this.data('subtext') !== 'undefined' ? '<small class="muted text-muted">' + $this.data('subtext') + '</small>' : '';
var icon = typeof $this.data('icon') !== 'undefined' ? '<i class="' + that.options.iconBase + ' ' + $this.data('icon') + '"></i> ' : '';
if (icon !== '' && ($this.is(':disabled') || $this.parent().is(':disabled'))) {
icon = '<span>' + icon + '</span>';
}
if (!$this.data('content')) {
//Prepend any icon and append any subtext to the main text.
text = icon + '<span class="text">' + text + subtext + '</span>';
}
if (that.options.hideDisabled && ($this.is(':disabled') || $this.parent().is(':disabled'))) {
_liA.push('<a style="min-height: 0; padding: 0"></a>');
} else if ($this.parent().is('optgroup') && $this.data('divider') !== true) {
if ($this.index() === 0) {
//Get the opt group label
var label = $this.parent().attr('label');
var labelSubtext = typeof $this.parent().data('subtext') !== 'undefined' ? '<small class="muted text-muted">' + $this.parent().data('subtext') + '</small>' : '';
var labelIcon = $this.parent().data('icon') ? '<i class="' + that.options.iconBase + ' ' + $this.parent().data('icon') + '"></i> ' : '';
label = labelIcon + '<span class="text">' + label + labelSubtext + '</span>';
optID += 1;
if ($this[0].index !== 0) {
_liA.push(
'<div class="div-contain"><div class="divider"></div></div>' +
'<dt>' + label + '</dt>' +
that.createA(text, 'opt ' + optionClass, inline, optID)
);
} else {
_liA.push(
'<dt>' + label + '</dt>' +
that.createA(text, 'opt ' + optionClass, inline, optID));
}
} else {
_liA.push(that.createA(text, 'opt ' + optionClass, inline, optID));
}
} else if ($this.data('divider') === true) {
_liA.push('<div class="div-contain"><div class="divider"></div></div>');
} else if ($(this).data('hidden') === true) {
_liA.push('<a></a>');
} else {
_liA.push(that.createA(text, optionClass, inline));
}
});
$.each(_liA, function (i, item) {
var hide = item === '<a></a>' ? 'class="hide is-hidden"' : '';
_liHtml += '<li rel="' + i + '"' + hide + '>' + item + '</li>';
});
//If we are not multiple, and we dont have a selected item, and we dont have a title, select the first element so something is set in the button
if (!this.multiple && this.$element.find('option:selected').length === 0 && !this.options.title) {
this.$element.find('option').eq(0).prop('selected', true).attr('selected', 'selected');
}
return $(_liHtml);
},
/**
*
* @param text
* @param classes
* @param inline
* @param [optgroup]
* @returns {string}
*/
createA: function (text, classes, inline, optgroup) {
return '<a tabindex="0" class="' + classes + '" style="' + inline + '"' +
(typeof optgroup !== 'undefined' ? 'data-optgroup="' + optgroup + '"' : '') + '>' +
text +
'<i class="' + this.options.iconBase + ' ' + this.options.tickIcon + ' icon-ok check-mark"></i>' +
'</a>';
},
/**
* @param [updateLi] defaults to true
*/
render: function (updateLi) {
var that = this;
//Update the LI to match the SELECT
if (updateLi !== false) {
this.$element.find('option').each(function (index) {
that.setDisabled(index, $(this).is(':disabled') || $(this).parent().is(':disabled'));
that.setSelected(index, $(this).is(':selected'));
});
}
this.tabIndex();
var selectedItems = this.$element.find('option:selected').map(function () {
var $this = $(this);
var icon = $this.data('icon') && that.options.showIcon ? '<i class="' + that.options.iconBase + ' ' + $this.data('icon') + '"></i> ' : '';
var subtext;
if (that.options.showSubtext && $this.attr('data-subtext') && !that.multiple) {
subtext = ' <small class="muted text-muted">' + $this.data('subtext') + '</small>';
} else {
subtext = '';
}
if ($this.data('content') && that.options.showContent) {
return $this.data('content');
} else if (typeof $this.attr('title') !== 'undefined') {
return $this.attr('title');
} else {
return icon + $this.html() + subtext;
}
}).toArray();
//Fixes issue in IE10 occurring when no default option is selected and at least one option is disabled
//Convert all the values into a comma delimited string
var title = !this.multiple ? selectedItems[0] : selectedItems.join(this.options.multipleSeparator);
//If this is multi select, and the selectText type is count, the show 1 of 2 selected etc..
if (this.multiple && this.options.selectedTextFormat.indexOf('count') > -1) {
var max = this.options.selectedTextFormat.split('>');
var notDisabled = this.options.hideDisabled ? ':not([disabled])' : '';
if ((max.length > 1 && selectedItems.length > max[1]) || (max.length == 1 && selectedItems.length >= 2)) {
title = this.options.countSelectedText.replace('{0}', selectedItems.length).replace('{1}', this.$element.find('option:not([data-divider="true"], [data-hidden="true"])' + notDisabled).length);
}
}
this.options.title = this.$element.attr('title');
if (this.options.selectedTextFormat == 'static') {
title = this.options.title;
}
//If we dont have a title, then use the default, or if nothing is set at all, use the not selected text
if (!title) {
title = typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText;
}
this.$button.attr('title', $.trim($("<div/>").html(title).text()).replace(/\s\s+/g, ' '));
this.$newElement.find('.filter-option').html(title);
},
/**
* @param [style]
* @param [status]
*/
setStyle: function (style, status) {
if (this.$element.attr('class')) {
this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|validate\[.*\]/gi, ''));
}
var buttonClass = style ? style : this.options.style;
if (status == 'add') {
this.$button.addClass(buttonClass);
} else if (status == 'remove') {
this.$button.removeClass(buttonClass);
} else {
this.$button.removeClass(this.options.style);
this.$button.addClass(buttonClass);
}
},
liHeight: function () {
if (this.options.size === false) return;
var $selectClone = this.$menu.parent().clone().find('> .dropdown-toggle').prop('autofocus', false).end().appendTo('body'),
$menuClone = $selectClone.addClass('open').find('> .dropdown-menu'),
liHeight = $menuClone.find('li > a').outerHeight(),
headerHeight = this.options.header ? $menuClone.find('.popover-title').outerHeight() : 0,
searchHeight = this.options.liveSearch ? $menuClone.find('.bootstrap-select-searchbox').outerHeight() : 0,
actionsHeight = this.options.actionsBox ? $menuClone.find('.bs-actionsbox').outerHeight() : 0;
$selectClone.remove();
this.$newElement
.data('liHeight', liHeight)
.data('headerHeight', headerHeight)
.data('searchHeight', searchHeight)
.data('actionsHeight', actionsHeight);
},
setSize: function () {
var that = this,
menu = this.$menu,
menuInner = menu.find('.inner'),
selectHeight = this.$newElement.outerHeight(),
liHeight = this.$newElement.data('liHeight'),
headerHeight = this.$newElement.data('headerHeight'),
searchHeight = this.$newElement.data('searchHeight'),
actionsHeight = this.$newElement.data('actionsHeight'),
divHeight = menu.find('li .divider').outerHeight(true),
menuPadding = parseInt(menu.css('padding-top')) +
parseInt(menu.css('padding-bottom')) +
parseInt(menu.css('border-top-width')) +
parseInt(menu.css('border-bottom-width')),
notDisabled = this.options.hideDisabled ? ':not(.disabled)' : '',
$window = $(window),
menuExtras = menuPadding + parseInt(menu.css('margin-top')) + parseInt(menu.css('margin-bottom')) + 2,
menuHeight,
selectOffsetTop,
selectOffsetBot,
posVert = function () {
//JQuery defines a scrollTop function, but in pure JS it's a property
//noinspection JSValidateTypes
selectOffsetTop = that.$newElement.offset().top - $window.scrollTop();
selectOffsetBot = $window.height() - selectOffsetTop - selectHeight;
};
posVert();
if (this.options.header) menu.css('padding-top', 0);
if (this.options.size == 'auto') {
var getSize = function () {
var minHeight,
lisVis = that.$lis.not('.hide');
posVert();
menuHeight = selectOffsetBot - menuExtras;
if (that.options.dropupAuto) {
that.$newElement.toggleClass('dropup', (selectOffsetTop > selectOffsetBot) && ((menuHeight - menuExtras) < menu.height()));
}
if (that.$newElement.hasClass('dropup')) {
menuHeight = selectOffsetTop - menuExtras;
}
if ((lisVis.length + lisVis.find('dt').length) > 3) {
minHeight = liHeight * 3 + menuExtras - 2;
} else {
minHeight = 0;
}
menu.css({'max-height': menuHeight + 'px', 'overflow': 'hidden', 'min-height': minHeight + headerHeight + searchHeight + actionsHeight + 'px'});
menuInner.css({'max-height': menuHeight - headerHeight - searchHeight - actionsHeight - menuPadding + 'px', 'overflow-y': 'auto', 'min-height': Math.max(minHeight - menuPadding, 0) + 'px'});
};
getSize();
this.$searchbox.off('input.getSize propertychange.getSize').on('input.getSize propertychange.getSize', getSize);
$(window).off('resize.getSize').on('resize.getSize', getSize);
$(window).off('scroll.getSize').on('scroll.getSize', getSize);
} else if (this.options.size && this.options.size != 'auto' && menu.find('li' + notDisabled).length > this.options.size) {
var optIndex = menu.find('li' + notDisabled + ' > *').not('.div-contain').slice(0, this.options.size).last().parent().index();
var divLength = menu.find('li').slice(0, optIndex + 1).find('.div-contain').length;
menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding;
if (that.options.dropupAuto) {
this.$newElement.toggleClass('dropup', (selectOffsetTop > selectOffsetBot) && (menuHeight < menu.height()));
}
menu.css({'max-height': menuHeight + headerHeight + searchHeight + actionsHeight + 'px', 'overflow': 'hidden'});
menuInner.css({'max-height': menuHeight - menuPadding + 'px', 'overflow-y': 'auto'});
}
},
setWidth: function () {
if (this.options.width == 'auto') {
this.$menu.css('min-width', '0');
// Get correct width if element hidden
var selectClone = this.$newElement.clone().appendTo('body');
var ulWidth = selectClone.find('> .dropdown-menu').css('width');
var btnWidth = selectClone.css('width', 'auto').find('> button').css('width');
selectClone.remove();
// Set width to whatever's larger, button title or longest option
this.$newElement.css('width', Math.max(parseInt(ulWidth), parseInt(btnWidth)) + 'px');
} else if (this.options.width == 'fit') {
// Remove inline min-width so width can be changed from 'auto'
this.$menu.css('min-width', '');
this.$newElement.css('width', '').addClass('fit-width');
} else if (this.options.width) {
// Remove inline min-width so width can be changed from 'auto'
this.$menu.css('min-width', '');
this.$newElement.css('width', this.options.width);
} else {
// Remove inline min-width/width so width can be changed
this.$menu.css('min-width', '');
this.$newElement.css('width', '');
}
// Remove fit-width class if width is changed programmatically
if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') {
this.$newElement.removeClass('fit-width');
}
},
selectPosition: function () {
var that = this,
drop = '<div />',
$drop = $(drop),
pos,
actualHeight,
getPlacement = function ($element) {
$drop.addClass($element.attr('class').replace(/form-control/gi, '')).toggleClass('dropup', $element.hasClass('dropup'));
pos = $element.offset();
actualHeight = $element.hasClass('dropup') ? 0 : $element[0].offsetHeight;
$drop.css({'top': pos.top + actualHeight, 'left': pos.left, 'width': $element[0].offsetWidth, 'position': 'absolute'});
};
this.$newElement.on('click', function () {
if (that.isDisabled()) {
return;
}
getPlacement($(this));
$drop.appendTo(that.options.container);
$drop.toggleClass('open', !$(this).hasClass('open'));
$drop.append(that.$menu);
});
$(window).resize(function () {
getPlacement(that.$newElement);
});
$(window).on('scroll', function () {
getPlacement(that.$newElement);
});
$('html').on('click', function (e) {
if ($(e.target).closest(that.$newElement).length < 1) {
$drop.removeClass('open');
}
});
},
setSelected: function (index, selected) {
if (this.$lis == null) this.$lis = this.$menu.find('li');
$(this.$lis[index]).toggleClass('selected', selected);
},
setDisabled: function (index, disabled) {
if (this.$lis == null) this.$lis = this.$menu.find('li');
if (disabled) {
$(this.$lis[index]).addClass('disabled').find('a').attr('href', '#').attr('tabindex', -1);
} else {
$(this.$lis[index]).removeClass('disabled').find('a').removeAttr('href').attr('tabindex', 0);
}
},
isDisabled: function () {
return this.$element.is(':disabled');
},
checkDisabled: function () {
var that = this;
if (this.isDisabled()) {
this.$button.addClass('disabled').attr('tabindex', -1);
} else {
if (this.$button.hasClass('disabled')) {
this.$button.removeClass('disabled');
}
if (this.$button.attr('tabindex') == -1) {
if (!this.$element.data('tabindex')) this.$button.removeAttr('tabindex');
}
}
this.$button.click(function () {
return !that.isDisabled();
});
},
tabIndex: function () {
if (this.$element.is('[tabindex]')) {
this.$element.data('tabindex', this.$element.attr('tabindex'));
this.$button.attr('tabindex', this.$element.data('tabindex'));
}
},
clickListener: function () {
var that = this;
this.$newElement.on('touchstart.dropdown', '.dropdown-menu', function (e) {
e.stopPropagation();
});
this.$newElement.on('click', function () {
that.setSize();
if (!that.options.liveSearch && !that.multiple) {
setTimeout(function () {
that.$menu.find('.selected a').focus();
}, 10);
}
});
this.$menu.on('click', 'li a', function (e) {
var clickedIndex = $(this).parent().index(),
prevValue = that.$element.val(),
prevIndex = that.$element.prop('selectedIndex');
//Dont close on multi choice menu
if (that.multiple) {
e.stopPropagation();
}
e.preventDefault();
//Dont run if we have been disabled
if (!that.isDisabled() && !$(this).parent().hasClass('disabled')) {
var $options = that.$element.find('option'),
$option = $options.eq(clickedIndex),
state = $option.prop('selected'),
$optgroup = $option.parent('optgroup'),
maxOptions = that.options.maxOptions,
maxOptionsGrp = $optgroup.data('maxOptions') || false;
//Deselect all others if not multi select box
if (!that.multiple) {
$options.prop('selected', false);
$option.prop('selected', true);
that.$menu.find('.selected').removeClass('selected');
that.setSelected(clickedIndex, true);
}
//Else toggle the one we have chosen if we are multi select.
else {
$option.prop('selected', !state);
that.setSelected(clickedIndex, !state);
$(this).blur();
if ((maxOptions !== false) || (maxOptionsGrp !== false)) {
var maxReached = maxOptions < $options.filter(':selected').length,
maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length,
maxOptionsArr = that.options.maxOptionsText,
maxTxt = maxOptionsArr[0].replace('{n}', maxOptions),
maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp),
$notify = $('<div class="notify"></div>');
if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) {
if (maxOptions && maxOptions == 1) {
$options.prop('selected', false);
$option.prop('selected', true);
that.$menu.find('.selected').removeClass('selected');
that.setSelected(clickedIndex, true);
} else if (maxOptionsGrp && maxOptionsGrp == 1) {
$optgroup.find('option:selected').prop('selected', false);
$option.prop('selected', true);
var optgroupID = $(this).data('optgroup');
that.$menu.find('.selected').has('a[data-optgroup="' + optgroupID + '"]').removeClass('selected');
that.setSelected(clickedIndex, true);
} else {
// If {var} is set in array, replace it
if (maxOptionsArr[2]) {
maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]);
maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]);
}
$option.prop('selected', false);
that.$menu.append($notify);
if (maxOptions && maxReached) {
$notify.append($('<div>' + maxTxt + '</div>'));
that.$element.trigger('maxReached.bs.select');
}
if (maxOptionsGrp && maxReachedGrp) {
$notify.append($('<div>' + maxTxtGrp + '</div>'));
that.$element.trigger('maxReachedGrp.bs.select');
}
setTimeout(function () {
that.setSelected(clickedIndex, false);
}, 10);
$notify.delay(750).fadeOut(300, function () {
$(this).remove();
});
}
}
}
}
if (!that.multiple) {
that.$button.focus();
} else if (that.options.liveSearch) {
that.$searchbox.focus();
}
// Trigger select 'change'
if ((prevValue != that.$element.val() && that.multiple) || (prevIndex != that.$element.prop('selectedIndex') && !that.multiple)) {
that.$element.change();
}
}
});
this.$menu.on('click', 'li.disabled a, li dt, li .div-contain, .popover-title, .popover-title :not(.close)', function (e) {
if (e.target == this) {
e.preventDefault();
e.stopPropagation();
if (!that.options.liveSearch) {
that.$button.focus();
} else {
that.$searchbox.focus();
}
}
});
this.$menu.on('click', '.popover-title .close', function () {
that.$button.focus();
});
this.$searchbox.on('click', function (e) {
e.stopPropagation();
});
this.$menu.on('click', '.actions-btn', function (e) {
if (that.options.liveSearch) {
that.$searchbox.focus();
} else {
that.$button.focus();
}
e.preventDefault();
e.stopPropagation();
if ($(this).is('.bs-select-all')) {
that.selectAll();
} else {
that.deselectAll();
}
that.$element.change();
});
this.$element.change(function () {
that.render(false);
});
},
liveSearchListener: function () {
var that = this,
no_results = $('<li class="no-results"></li>');
this.$newElement.on('click.dropdown.data-api', function () {
that.$menu.find('.active').removeClass('active');
if (!!that.$searchbox.val()) {
that.$searchbox.val('');
that.$lis.not('.is-hidden').removeClass('hide');
if (!!no_results.parent().length) no_results.remove();
}
if (!that.multiple) that.$menu.find('.selected').addClass('active');
setTimeout(function () {
that.$searchbox.focus();
}, 10);
});
this.$searchbox.on('input propertychange', function () {
if (that.$searchbox.val()) {
that.$lis.not('.is-hidden').removeClass('hide').find('a').not(':icontains(' + that.$searchbox.val() + ')').parent().addClass('hide');
if (!that.$menu.find('li').filter(':visible:not(.no-results)').length) {
if (!!no_results.parent().length) no_results.remove();
no_results.html(that.options.noneResultsText + ' "' + that.$searchbox.val() + '"').show();
that.$menu.find('li').last().after(no_results);
} else if (!!no_results.parent().length) {
no_results.remove();
}
} else {
that.$lis.not('.is-hidden').removeClass('hide');
if (!!no_results.parent().length) no_results.remove();
}
that.$menu.find('li.active').removeClass('active');
that.$menu.find('li').filter(':visible:not(.divider)').eq(0).addClass('active').find('a').focus();
$(this).focus();
});
this.$menu.on('mouseenter', 'a', function (e) {
that.$menu.find('.active').removeClass('active');
$(e.currentTarget).parent().not('.disabled').addClass('active');
});
this.$menu.on('mouseleave', 'a', function () {
that.$menu.find('.active').removeClass('active');
});
},
val: function (value) {
if (typeof value !== 'undefined') {
this.$element.val(value);
this.render();
return this.$element;
} else {
return this.$element.val();
}
},
selectAll: function () {
if (this.$lis == null) this.$lis = this.$menu.find('li');
this.$element.find('option:enabled').prop('selected', true);
$(this.$lis).not('.disabled').addClass('selected');
this.render(false);
},
deselectAll: function () {
if (this.$lis == null) this.$lis = this.$menu.find('li');
this.$element.find('option:enabled').prop('selected', false);
$(this.$lis).not('.disabled').removeClass('selected');
this.render(false);
},
keydown: function (e) {
var $this,
$items,
$parent,
index,
next,
first,
last,
prev,
nextPrev,
that,
prevIndex,
isActive,
keyCodeMap = {
32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', 54: '6', 55: '7', 56: '8', 57: '9', 59: ';',
65: 'a', 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h', 73: 'i', 74: 'j', 75: 'k', 76: 'l',
77: 'm', 78: 'n', 79: 'o', 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v', 87: 'w', 88: 'x',
89: 'y', 90: 'z', 96: '0', 97: '1', 98: '2', 99: '3', 100: '4', 101: '5', 102: '6', 103: '7', 104: '8', 105: '9'
};
$this = $(this);
$parent = $this.parent();
if ($this.is('input')) $parent = $this.parent().parent();
that = $parent.data('this');
if (that.options.liveSearch) $parent = $this.parent().parent();
if (that.options.container) $parent = that.$menu;
$items = $('[role=menu] li:not(.divider) a', $parent);
isActive = that.$menu.parent().hasClass('open');
if (!isActive && /([0-9]|[A-z])/.test(String.fromCharCode(e.keyCode))) {
if (!that.options.container) {
that.setSize();
that.$menu.parent().addClass('open');
isActive = true;
} else {
that.$newElement.trigger('click');
}
that.$searchbox.focus();
}
if (that.options.liveSearch) {
if (/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && that.$menu.find('.active').length === 0) {
e.preventDefault();
that.$menu.parent().removeClass('open');
that.$button.focus();
}
$items = $('[role=menu] li:not(.divider):visible', $parent);
if (!$this.val() && !/(38|40)/.test(e.keyCode.toString(10))) {
if ($items.filter('.active').length === 0) {
$items = that.$newElement.find('li').filter(':icontains(' + keyCodeMap[e.keyCode] + ')');
}
}
}
if (!$items.length) return;
if (/(38|40)/.test(e.keyCode.toString(10))) {
index = $items.index($items.filter(':focus'));
first = $items.parent(':not(.disabled):visible').first().index();
last = $items.parent(':not(.disabled):visible').last().index();
next = $items.eq(index).parent().nextAll(':not(.disabled):visible').eq(0).index();
prev = $items.eq(index).parent().prevAll(':not(.disabled):visible').eq(0).index();
nextPrev = $items.eq(next).parent().prevAll(':not(.disabled):visible').eq(0).index();
if (that.options.liveSearch) {
$items.each(function (i) {
if ($(this).is(':not(.disabled)')) {
$(this).data('index', i);
}
});
index = $items.index($items.filter('.active'));
first = $items.filter(':not(.disabled):visible').first().data('index');
last = $items.filter(':not(.disabled):visible').last().data('index');
next = $items.eq(index).nextAll(':not(.disabled):visible').eq(0).data('index');
prev = $items.eq(index).prevAll(':not(.disabled):visible').eq(0).data('index');
nextPrev = $items.eq(next).prevAll(':not(.disabled):visible').eq(0).data('index');
}
prevIndex = $this.data('prevIndex');
if (e.keyCode == 38) {
if (that.options.liveSearch) index -= 1;
if (index != nextPrev && index > prev) index = prev;
if (index < first) index = first;
if (index == prevIndex) index = last;
}
if (e.keyCode == 40) {
if (that.options.liveSearch) index += 1;
if (index == -1) index = 0;
if (index != nextPrev && index < next) index = next;
if (index > last) index = last;
if (index == prevIndex) index = first;
}
$this.data('prevIndex', index);
if (!that.options.liveSearch) {
$items.eq(index).focus();
} else {
e.preventDefault();
if (!$this.is('.dropdown-toggle')) {
$items.removeClass('active');
$items.eq(index).addClass('active').find('a').focus();
$this.focus();
}
}
} else if (!$this.is('input')) {
var keyIndex = [],
count,
prevKey;
$items.each(function () {
if ($(this).parent().is(':not(.disabled)')) {
if ($.trim($(this).text().toLowerCase()).substring(0, 1) == keyCodeMap[e.keyCode]) {
keyIndex.push($(this).parent().index());
}
}
});
count = $(document).data('keycount');
count++;
$(document).data('keycount', count);
prevKey = $.trim($(':focus').text().toLowerCase()).substring(0, 1);
if (prevKey != keyCodeMap[e.keyCode]) {
count = 1;
$(document).data('keycount', count);
} else if (count >= keyIndex.length) {
$(document).data('keycount', 0);
if (count > keyIndex.length) count = 1;
}
$items.eq(keyIndex[count - 1]).focus();
}
// Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu.
if ((/(13|32)/.test(e.keyCode.toString(10)) || (that.options.selectOnTab && /(^9$)/.test(e.keyCode.toString(10)))) && isActive) {
if (!/(32)/.test(e.keyCode.toString(10))) e.preventDefault();
if (!that.options.liveSearch) {
$(':focus').click();
} else if (!/(32)/.test(e.keyCode.toString(10))) {
that.$menu.find('.active a').click();
$this.focus();
}
$(document).data('keycount', 0);
}
if ((/(^9$|27)/.test(e.keyCode.toString(10)) && isActive && (that.multiple || that.options.liveSearch)) || (/(27)/.test(e.keyCode.toString(10)) && !isActive)) {
that.$menu.parent().removeClass('open');
that.$button.focus();
}
},
mobile: function () {
this.$element.addClass('mobile-device').appendTo(this.$newElement);
if (this.options.container) this.$menu.hide();
},
refresh: function () {
this.$lis = null;
this.reloadLi();
this.render();
this.setWidth();
this.setStyle();
this.checkDisabled();
this.liHeight();
},
update: function () {
this.reloadLi();
this.setWidth();
this.setStyle();
this.checkDisabled();
this.liHeight();
},
hide: function () {
this.$newElement.hide();
},
show: function () {
this.$newElement.show();
},
remove: function () {
this.$newElement.remove();
this.$element.remove();
}
};
// SELECTPICKER PLUGIN DEFINITION
// ==========================
function Plugin (option, event) {
// get the args of the outer function..
var args = arguments;
// The arguments of the function are explicitely re-defined from the argument list, because the shift causes them
// to get lost
//noinspection JSDuplicatedDeclaration
var option = args[0],
event = args[1];
[].shift.apply(args);
var value;
var chain = this.each(function () {
var $this = $(this);
if ($this.is('select')) {
var data = $this.data('selectpicker'),
options = typeof option == 'object' && option;
if (!data) {
var config = $.extend(Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, $this.data(), options);
$this.data('selectpicker', (data = new Selectpicker(this, config, event)));
} else if (options) {
for (var i in options) {
if (options.hasOwnProperty(i)) {
data.options[i] = options[i];
}
}
}
if (typeof option == 'string') {
if (data[option] instanceof Function) {
value = data[option].apply(data, args);
} else {
value = data.options[option];
}
}
}
});
if (typeof value !== 'undefined') {
//noinspection JSUnusedAssignment
return value;
} else {
return chain;
}
}
var old = $.fn.selectpicker;
$.fn.selectpicker = Plugin;
$.fn.selectpicker.Constructor = Selectpicker;
// SELECTPICKER NO CONFLICT
// ====================
$.fn.selectpicker.noConflict = function () {
$.fn.selectpicker = old;
return this;
};
$(document)
.data('keycount', 0)
.on('keydown', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role=menu], .bootstrap-select-searchbox input', Selectpicker.prototype.keydown)
.on('focusin.modal', '.bootstrap-select [data-toggle=dropdown], .bootstrap-select [role=menu], .bootstrap-select-searchbox input', function (e) {
e.stopPropagation();
});
})(jQuery);
| gpl-3.0 |
agnusfeec/tattCBIR | sistema.py | 9049 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 27 10:20:08 2016
@author: agnus
"""
def monta_lista_imagens(path = '.', ext='.png'):
import os
imagens = {}
for dirname, dirnames, filenames in os.walk(path):
# print path to all filenames with extension py.
for filename in filenames:
fname_path = os.path.join(dirname, filename)
fext = os.path.splitext(fname_path)[1]
if fext == ext:
#file_dat = [filename, dirname]
#imagens.append(file_dat)
imagens[filename]=dirname
else:
continue
return imagens
def grava_db_imagens(arquivo, imagens):
#arquivo = './tatt_c.db'
with open(arquivo, 'wb') as db_image_file:
for nome_img, caminho in imagens.items():
db_image_file.write(nome_img+ '\t' + caminho + '\n')
db_image_file.close()
def grava_config(arquivo = './example.cfg'):
import ConfigParser
config = ConfigParser.RawConfigParser()
# When adding sections or items, add them in the reverse order of
# how you want them to be displayed in the actual file.
# In addition, please note that using RawConfigParser's and the raw
# mode of ConfigParser's respective set functions, you can assign
# non-string values to keys internally, but will receive an error
# when attempting to write to a file or when you get it in non-raw
# mode. SafeConfigParser does not allow such assignments to take place.
config.add_section('Geral')
config.set('Geral', 'Image Database', 'Tatt-C')
config.set('Geral', 'Database Image Folder', '/media/sf_Projeto/dataset/tatt-c/')
config.set('Geral', 'Indexa image database', 'True')
config.set('Geral', 'Database filename', './tatt_c.db')
config.set('Geral', 'Image filename extension','.jpg')
config.set('Geral', 'Training File', 'train1')
config.set('Geral', 'Testing File', 'test1')
config.add_section('Folds')
config.set('Folds', 'Folds Folder', '/media/sf_Projeto/dataset/tatt-c_update_v1.4/5-fold/tattoo_identification/')
config.set('Folds', 'Quantidade subsets', '2')
config.set('Folds', 'Subset_1', 'gallery{1,2,3,4,5}.txt')
config.set('Folds', 'Subset_2', 'probes{1,2,3,4,5}.txt')
config.set('Folds', 'Ground_truth', 'ground_truth.txt')
config.add_section('SIFT')
config.set('SIFT','SIFT Folder', '/media/sf_Projeto/dataset/tatt-c_SIFT/')
# Writing our configuration file to 'example.cfg'
with open(arquivo, 'wb') as configfile:
config.write(configfile)
def le_config():
import ConfigParser
config = ConfigParser.RawConfigParser()
config.read('./example.cfg')
# getfloat() raises an exception if the value is not a float
# getint() and getboolean() also do this for their respective types
base = config.get('Geral', 'image database')
indexa = config.getboolean('Geral', 'indexa image database')
print base
if indexa:
print "indexa base"
arquivo = config.get('Geral','database filename')
caminho = config.get('Geral', 'database image folder')
extensao = config.get('Geral', 'image filename extension')
print arquivo, caminho, extensao
imagens = monta_lista_imagens(caminho, extensao)
grava_db_imagens(arquivo, imagens)
folds_folder = config.get('Folds','folds folder')
n_subsets = config.getint('Folds', 'quantidade subsets')
subsets=[]
for i in range(n_subsets):
sub = config.get('Folds', 'subset_'+str(i+1))
ps = sub.find("{")
pe = sub.find("}")
ped = sub[ps+1:pe]
indices = ped.split(',')
aux = []
for ind in indices:
aux.append(sub[:ps]+ind+'.txt') # incluir extensão variável
subsets.append(aux)
#print subsets
#n_folds = config.getint('Folds', 'quantidade folds')
n_folds =len(subsets[0])
folds = []
for i in range(n_folds):
aux = []
for j in range(n_subsets):
arquivo = subsets[j][i]
with open(folds_folder+arquivo, 'r') as imagefiles:
for nomef in imagefiles:
if nomef[-1] == '\n' : nomef = nomef[:-1]
aux.append(nomef)
folds.append(aux)
#print folds[0]
gt_filename = config.get('Folds', 'ground_truth')
gt_imagens = {}
with open(folds_folder+gt_filename, 'r') as gt_arq:
for nomef in gt_arq:
imgs = nomef.split('|')
if imgs[1][-1] == '\n' : imgs[1] = imgs[1][:-1]
#print imgs[0], imgs[1]
gt_imagens[imgs[0]] = imgs[1]
gt_arq.close()
sift_folder = config.get('SIFT', 'sift folder')
return folds, imagens, gt_imagens, sift_folder
#dbImage_folder ="/home/agnus/Documentos/leo/datasets/tatt-c/"
#imagens = monta_lista_imagens(dbImage_folder,".jpg")
#print imagens['gallery_011.jpg']
#print imagens['group10_img01.jpg']
#arquivo = './tatt_c.db'
#with open(arquivo, 'wb') as db_image_file:
# for nome_img, caminho in imagens.items():
# db_image_file.write(nome_img+ '\t' + caminho + '\n')
#db_image_file.close()
grava_config()
def sift(nomes_imagens, imagens, sift_folder):
import cv2
import os
#ds = []
#kp = []
t = len(nomes_imagens)
i=1
for filename in nomes_imagens:
fname = os.path.join(sift_folder, filename[:-3]+'sift')
if os.path.isfile(fname) == False :
print filename
#file_img = os.path.join(diretorio, filename)
diretorio = imagens[filename]
img = cv2.imread(os.path.join(diretorio, filename)) #file_img)
# Redimensiona imagem para aplicação do Fisher Vectors
#img = cv2.resize(img, (256,256))
aux = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = cv2.equalizeHist(aux)
sift = cv2.xfeatures2d.SIFT_create()
(kps, descs) = sift.detectAndCompute(gray, None)
#ds.append(descs)
#kp.append(kps)
arquivo = os.path.join(sift_folder, filename[:-3]+'sift')
with open(arquivo, 'wb') as sift_file:
for desc in descs:
sift_file.write(','.join(str(x) for x in desc)+'\n')
sift_file.close()
print (i*100)/t,
i=i+1
#return ds
def sift_match(ds1, ds2):
import cv2
bf = cv2.BFMatcher()
matches = bf.knnMatch(ds1,ds2, k=2)
# Apply ratio test
good = []
for m,n in matches:
if m.distance < 0.75*n.distance:
good.append([m])
qm = len(good)
(nr1,c) = ds1.shape
(nr2,c) = ds2.shape
nr = nr1
if nr2>nr:
nr = nr2
#rt = (100.0*qm/nr)
if qm > 0:
rt = 1.0/qm
else:
rt = 10^8
return rt
folds, imagens, gt_images, sift_folder = le_config()
n_folds = len(folds)
#%%
import numpy as np
import os
# Inicialmente gera se necessario o SIFT para as imagens de treinamento e teste
# pode ser otimizado, gerando para toda a base, caso se utilize toda a base
# o que pode ter um custo alto pois na base existem imagens para outros casos
# de uso.
for i in range(n_folds):
test = folds[i]
train = []
for j in range(n_folds):
if j!=i :
train = train + folds[j]
print 'Gerando sift do conjunto de treinamento'
#train_kp, train_ds = sift(train, imagens, sift_folder)
sift(train, imagens, sift_folder)
print 'Gerando sift do conjunto de teste'
#test_kp, test_ds = sift(test, imagens)
sift(test, imagens, sift_folder)
for i in range(n_folds):
test = folds[i]
train = []
for j in range(n_folds):
if j!=i :
train = train + folds[j]
n_test = len(test)
n_train = len(train)
dist = np.zeros((1, n_train), dtype=np.float)
nn = n_test * n_train
i = 0
print 'Gerando o match entre o treinamento e o conjunto de teste'
arquivo = './clist.txt'
with open(arquivo, 'w') as clist_file:
for file_test in test:
fname = os.path.join(sift_folder, file_test[:-3]+'sift')
ds1 = (np.loadtxt(open(fname,"r"),delimiter=",")).astype(np.uint8) #,skiprows=1)
j = 0
for file_train in train:
fname = os.path.join(sift_folder, file_train[:-3]+'sift')
ds2 = (np.loadtxt(open(fname,"r"),delimiter=",")).astype(np.uint8) #,skiprows=1)
#print ds1
#print ds2
rt = sift_match(ds1,ds2)
dist[0][j] = rt
j = j + 1
print (((i*n_train)+j)*100)/nn,
indice = (np.argsort(dist)).tolist()
k = 1
for id in indice[0]:
clist_file.write(file_test+'|'+ str(k) + '|' + train[id] + '|' + str(dist[0][id]) +'\n')
k = k + 1
i = i + 1
clist_file.close()
#%%
#for filename in test:
# print filename, imagens[filename]
| gpl-3.0 |
Lunat1q/Catchem-PoGo | Source/PoGo.PokeMobBot.Logic/Tasks/RecycleSpecificItemTask.cs | 2235 | #region using directives
using System;
using System.Threading;
using System.Threading.Tasks;
using PoGo.PokeMobBot.Logic.Event.Item;
using PoGo.PokeMobBot.Logic.Logging;
using PoGo.PokeMobBot.Logic.State;
using PoGo.PokeMobBot.Logic.Utils;
using POGOProtos.Inventory.Item;
#endregion
namespace PoGo.PokeMobBot.Logic.Tasks
{
public class RecycleSpecificItemTask
{
public static async Task Execute(ISession session, ItemId item, int amount, CancellationToken cancellationToken)
{
if (!await CheckBotStateTask.Execute(session, cancellationToken)) return;
try
{
var prevState = session.State;
session.State = BotState.Recycle;
cancellationToken.ThrowIfCancellationRequested();
await session.Inventory.RefreshCachedInventory();
var itemCount = await session.Inventory.GetItemAmountByType(item);
if (itemCount < amount)
amount = itemCount;
await RemoveItems(amount, item, cancellationToken, session);
await session.Inventory.RefreshCachedInventory();
session.State = prevState;
}
catch (OperationCanceledException)
{
//ignore
}
catch (Exception ex)
{
Logger.Write("[RECYCLE FAILURE] " + ex.Message);
}
}
private static async Task RemoveItems(int itemCount, ItemId item, CancellationToken cancellationToken, ISession session)
{
var itemsToRecycle = itemCount;
if (itemsToRecycle != 0)
{
cancellationToken.ThrowIfCancellationRequested();
session.EventDispatcher.Send(new ItemRecycledEvent { Id = item, Count = itemsToRecycle });
await session.Client.Inventory.RecycleItem(item, itemsToRecycle);
if (session.LogicSettings.Teleport)
await Task.Delay(session.LogicSettings.DelayRecycleItem, cancellationToken);
else
await DelayingUtils.Delay(session.LogicSettings.DelayRecycleItem, 500);
}
}
}
} | gpl-3.0 |
talbrecht/pism_pik06 | src/base/stressbalance/ssa/SSATestCase.cc | 17531 | // Copyright (C) 2009--2014 Ed Bueler, Constantine Khroulev, and David Maxwell
//
// This file is part of PISM.
//
// PISM is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
// Foundation; either version 3 of the License, or (at your option) any later
// version.
//
// PISM is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
// details.
//
// You should have received a copy of the GNU General Public License
// along with PISM; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "SSATestCase.hh"
#include "PIO.hh"
#include "SSAFD.hh"
#include "SSAFEM.hh"
#include "pism_options.hh"
//! Initialize the storage for the various coefficients used as input to the SSA
//! (ice elevation, thickness, etc.)
PetscErrorCode SSATestCase::buildSSACoefficients()
{
PetscErrorCode ierr;
const int WIDE_STENCIL = 2;
// ice surface elevation
ierr = surface.create(grid, "usurf", WITH_GHOSTS, WIDE_STENCIL); CHKERRQ(ierr);
ierr = surface.set_attrs("diagnostic", "ice upper surface elevation", "m",
"surface_altitude"); CHKERRQ(ierr);
ierr = vars.add(surface); CHKERRQ(ierr);
// land ice thickness
ierr = thickness.create(grid, "thk", WITH_GHOSTS, WIDE_STENCIL); CHKERRQ(ierr);
ierr = thickness.set_attrs("model_state", "land ice thickness", "m",
"land_ice_thickness"); CHKERRQ(ierr);
thickness.metadata().set_double("valid_min", 0.0);
ierr = vars.add(thickness); CHKERRQ(ierr);
// bedrock surface elevation
ierr = bed.create(grid, "topg", WITH_GHOSTS, WIDE_STENCIL); CHKERRQ(ierr);
ierr = bed.set_attrs("model_state", "bedrock surface elevation", "m",
"bedrock_altitude"); CHKERRQ(ierr);
ierr = vars.add(bed); CHKERRQ(ierr);
// yield stress for basal till (plastic or pseudo-plastic model)
ierr = tauc.create(grid, "tauc", WITH_GHOSTS, WIDE_STENCIL); CHKERRQ(ierr);
ierr = tauc.set_attrs("diagnostic",
"yield stress for basal till (plastic or pseudo-plastic model)", "Pa", "");
CHKERRQ(ierr);
ierr = vars.add(tauc); CHKERRQ(ierr);
// enthalpy
ierr = enthalpy.create(grid, "enthalpy", WITH_GHOSTS, WIDE_STENCIL); CHKERRQ(ierr);
ierr = enthalpy.set_attrs("model_state",
"ice enthalpy (includes sensible heat, latent heat, pressure)",
"J kg-1", ""); CHKERRQ(ierr);
ierr = vars.add(enthalpy); CHKERRQ(ierr);
// dirichlet boundary condition (FIXME: perhaps unused!)
ierr = vel_bc.create(grid, "_bc", WITH_GHOSTS,WIDE_STENCIL); CHKERRQ(ierr); // u_bc and v_bc
ierr = vel_bc.set_attrs("intent",
"X-component of the SSA velocity boundary conditions",
"m s-1", "", 0); CHKERRQ(ierr);
ierr = vel_bc.set_attrs("intent",
"Y-component of the SSA velocity boundary conditions",
"m s-1", "", 1); CHKERRQ(ierr);
ierr = vel_bc.set_glaciological_units("m year-1"); CHKERRQ(ierr);
vel_bc.metadata(0).set_double("valid_min", grid.convert(-1e6, "m/year", "m/second"));
vel_bc.metadata(0).set_double("valid_max", grid.convert( 1e6, "m/year", "m/second"));
vel_bc.metadata(0).set_double("_FillValue", config.get("fill_value", "m/year", "m/s"));
vel_bc.metadata(1).set_double("valid_min", grid.convert(-1e6, "m/year", "m/second"));
vel_bc.metadata(1).set_double("valid_max", grid.convert( 1e6, "m/year", "m/second"));
vel_bc.metadata(1).set_double("_FillValue", config.get("fill_value", "m/year", "m/s"));
vel_bc.write_in_glaciological_units = true;
ierr = vel_bc.set(config.get("fill_value", "m/year", "m/s")); CHKERRQ(ierr);
// grounded_dragging_floating integer mask
ierr = ice_mask.create(grid, "mask", WITH_GHOSTS, WIDE_STENCIL); CHKERRQ(ierr);
ierr = ice_mask.set_attrs("model_state",
"grounded_dragging_floating integer mask", "", ""); CHKERRQ(ierr);
std::vector<double> mask_values(4);
mask_values[0] = MASK_ICE_FREE_BEDROCK;
mask_values[1] = MASK_GROUNDED;
mask_values[2] = MASK_FLOATING;
mask_values[3] = MASK_ICE_FREE_OCEAN;
ice_mask.metadata().set_doubles("flag_values", mask_values);
ice_mask.metadata().set_string("flag_meanings",
"ice_free_bedrock grounded_ice floating_ice ice_free_ocean");
ierr = vars.add(ice_mask); CHKERRQ(ierr);
ierr = ice_mask.set(MASK_GROUNDED); CHKERRQ(ierr);
// Dirichlet B.C. mask
ierr = bc_mask.create(grid, "bc_mask", WITH_GHOSTS, WIDE_STENCIL); CHKERRQ(ierr);
ierr = bc_mask.set_attrs("model_state",
"grounded_dragging_floating integer mask", "", ""); CHKERRQ(ierr);
mask_values.resize(2);
mask_values[0] = 0;
mask_values[1] = 1;
bc_mask.metadata().set_doubles("flag_values", mask_values);
bc_mask.metadata().set_string("flag_meanings",
"no_data ssa_dirichlet_bc_location");
ierr = vars.add(bc_mask); CHKERRQ(ierr);
ierr = melange_back_pressure.create(grid, "melange_back_pressure_fraction",
WITH_GHOSTS, WIDE_STENCIL); CHKERRQ(ierr);
ierr = melange_back_pressure.set_attrs("boundary_condition",
"melange back pressure fraction", "", ""); CHKERRQ(ierr);
ierr = melange_back_pressure.set(0.0); CHKERRQ(ierr);
return 0;
}
SSATestCase::SSATestCase(MPI_Comm com, PISMConfig &c)
: config(c), grid(com, config), enthalpyconverter(0), ssa(0)
{
// empty
}
SSATestCase::~SSATestCase()
{
delete enthalpyconverter;
delete ssa;
}
//! Initialize the test case at the start of a run
PetscErrorCode SSATestCase::init(int Mx, int My, SSAFactory ssafactory)
{
PetscErrorCode ierr;
// Set options from command line.
ierr = config.scalar_from_option("ssa_eps", "epsilon_ssa"); CHKERRQ(ierr);
ierr = config.scalar_from_option("ssa_maxi", "max_iterations_ssafd"); CHKERRQ(ierr);
ierr = config.scalar_from_option("ssa_rtol", "ssafd_relative_convergence"); CHKERRQ(ierr);
// Subclass builds grid.
ierr = initializeGrid(Mx,My);
// Subclass builds ice flow law, basal resistance, etc.
ierr = initializeSSAModel(); CHKERRQ(ierr);
// We setup storage for the coefficients.
ierr = buildSSACoefficients(); CHKERRQ(ierr);
// Allocate the actual SSA solver.
ssa = ssafactory(grid, *enthalpyconverter, config);
ierr = ssa->init(vars); CHKERRQ(ierr); // vars was setup preivouisly with buildSSACoefficients
// Allow the subclass to setup the coefficients.
ierr = initializeSSACoefficients(); CHKERRQ(ierr);
return 0;
}
//! Solve the SSA
PetscErrorCode SSATestCase::run()
{
PetscErrorCode ierr;
// Solve (fast==true means "no update"):
ierr = verbPrintf(2,grid.com,"* Solving the SSA stress balance ...\n"); CHKERRQ(ierr);
bool fast = false;
ierr = ssa->update(fast, melange_back_pressure); CHKERRQ(ierr);
return 0;
}
//! Report on the generated solution
PetscErrorCode SSATestCase::report(std::string testname) {
PetscErrorCode ierr;
std::string ssa_stdout;
ierr = ssa->stdout_report(ssa_stdout); CHKERRQ(ierr);
ierr = verbPrintf(3,grid.com,ssa_stdout.c_str()); CHKERRQ(ierr);
double maxvecerr = 0.0, avvecerr = 0.0,
avuerr = 0.0, avverr = 0.0, maxuerr = 0.0, maxverr = 0.0;
double gmaxvecerr = 0.0, gavvecerr = 0.0, gavuerr = 0.0, gavverr = 0.0,
gmaxuerr = 0.0, gmaxverr = 0.0;
if (config.get_flag("do_pseudo_plastic_till") &&
config.get("pseudo_plastic_q") != 1.0) {
ierr = verbPrintf(1,grid.com,
"WARNING: numerical errors not valid for pseudo-plastic till\n"); CHKERRQ(ierr);
}
ierr = verbPrintf(1,grid.com,
"NUMERICAL ERRORS in velocity relative to exact solution:\n"); CHKERRQ(ierr);
IceModelVec2V *vel_ssa;
ierr = ssa->get_2D_advective_velocity(vel_ssa); CHKERRQ(ierr);
ierr = vel_ssa->begin_access(); CHKERRQ(ierr);
double exactvelmax = 0, gexactvelmax = 0;
for (int i=grid.xs; i<grid.xs+grid.xm; i++) {
for (int j=grid.ys; j<grid.ys+grid.ym; j++) {
double uexact, vexact;
double myx = grid.x[i], myy = grid.y[j];
exactSolution(i,j,myx,myy,&uexact,&vexact);
double exactnormsq=sqrt(uexact*uexact+vexact*vexact);
exactvelmax = PetscMax(exactnormsq,exactvelmax);
// compute maximum errors
const double uerr = PetscAbsReal((*vel_ssa)(i,j).u - uexact);
const double verr = PetscAbsReal((*vel_ssa)(i,j).v - vexact);
avuerr = avuerr + uerr;
avverr = avverr + verr;
maxuerr = PetscMax(maxuerr,uerr);
maxverr = PetscMax(maxverr,verr);
const double vecerr = sqrt(uerr * uerr + verr * verr);
maxvecerr = PetscMax(maxvecerr,vecerr);
avvecerr = avvecerr + vecerr;
}
}
ierr = vel_ssa->end_access(); CHKERRQ(ierr);
ierr = PISMGlobalMax(&exactvelmax, &gexactvelmax,grid.com); CHKERRQ(ierr);
ierr = PISMGlobalMax(&maxuerr, &gmaxuerr, grid.com); CHKERRQ(ierr);
ierr = PISMGlobalMax(&maxverr, &gmaxverr, grid.com); CHKERRQ(ierr);
ierr = PISMGlobalSum(&avuerr, &gavuerr, grid.com); CHKERRQ(ierr);
gavuerr = gavuerr/(grid.Mx*grid.My);
ierr = PISMGlobalSum(&avverr, &gavverr, grid.com); CHKERRQ(ierr);
gavverr = gavverr/(grid.Mx*grid.My);
ierr = PISMGlobalMax(&maxvecerr, &gmaxvecerr, grid.com); CHKERRQ(ierr);
ierr = PISMGlobalSum(&avvecerr, &gavvecerr, grid.com); CHKERRQ(ierr);
gavvecerr = gavvecerr/(grid.Mx*grid.My);
ierr = verbPrintf(1,grid.com,
"velocity : maxvector prcntavvec maxu maxv avu avv\n");
CHKERRQ(ierr);
ierr = verbPrintf(1,grid.com,
" %11.4f%13.5f%10.4f%10.4f%10.4f%10.4f\n",
grid.convert(gmaxvecerr, "m/second", "m/year"),
(gavvecerr/gexactvelmax)*100.0,
grid.convert(gmaxuerr, "m/second", "m/year"),
grid.convert(gmaxverr, "m/second", "m/year"),
grid.convert(gavuerr, "m/second", "m/year"),
grid.convert(gavverr, "m/second", "m/year")); CHKERRQ(ierr);
ierr = verbPrintf(1,grid.com, "NUM ERRORS DONE\n"); CHKERRQ(ierr);
ierr = report_netcdf(testname,
grid.convert(gmaxvecerr, "m/second", "m/year"),
(gavvecerr/gexactvelmax)*100.0,
grid.convert(gmaxuerr, "m/second", "m/year"),
grid.convert(gmaxverr, "m/second", "m/year"),
grid.convert(gavuerr, "m/second", "m/year"),
grid.convert(gavverr, "m/second", "m/year")); CHKERRQ(ierr);
return 0;
}
PetscErrorCode SSATestCase::report_netcdf(std::string testname,
double max_vector,
double rel_vector,
double max_u,
double max_v,
double avg_u,
double avg_v) {
PetscErrorCode ierr;
NCTimeseries err("N", "N", grid.get_unit_system());
unsigned int start;
std::string filename;
bool flag, append;
NCVariable global_attributes("PISM_GLOBAL", grid.get_unit_system());
ierr = PISMOptionsString("-report_file", "NetCDF error report file",
filename, flag); CHKERRQ(ierr);
if (flag == false)
return 0;
err.set_units("1");
ierr = verbPrintf(2, grid.com, "Also writing errors to '%s'...\n", filename.c_str());
CHKERRQ(ierr);
ierr = PISMOptionsIsSet("-append", "Append the NetCDF error report",
append); CHKERRQ(ierr);
global_attributes.set_string("source", std::string("PISM ") + PISM_Revision);
// Find the number of records in this file:
PIO nc(grid, "netcdf3"); // OK to use NetCDF3.
ierr = nc.open(filename, PISM_WRITE, append); CHKERRQ(ierr);
ierr = nc.inq_dimlen("N", start); CHKERRQ(ierr);
ierr = nc.write_global_attributes(global_attributes); CHKERRQ(ierr);
// Write the dimension variable:
ierr = nc.write_timeseries(err, (size_t)start, (double)(start + 1), PISM_INT); CHKERRQ(ierr);
// Always write grid parameters:
err.set_name("dx");
ierr = err.set_units("meters"); CHKERRQ(ierr);
ierr = nc.write_timeseries(err, (size_t)start, grid.dx); CHKERRQ(ierr);
err.set_name("dy");
ierr = nc.write_timeseries(err, (size_t)start, grid.dy); CHKERRQ(ierr);
// Always write the test name:
err.clear_all_strings(); err.clear_all_doubles(); err.set_units("1");
err.set_name("test");
ierr = nc.write_timeseries(err, (size_t)start, testname[0], PISM_BYTE); CHKERRQ(ierr);
err.clear_all_strings(); err.clear_all_doubles(); err.set_units("1");
err.set_name("max_velocity");
ierr = err.set_units("m/year"); CHKERRQ(ierr);
err.set_string("long_name", "maximum ice velocity magnitude error");
ierr = nc.write_timeseries(err, (size_t)start, max_vector); CHKERRQ(ierr);
err.clear_all_strings(); err.clear_all_doubles(); err.set_units("1");
err.set_name("relative_velocity");
ierr = err.set_units("percent"); CHKERRQ(ierr);
err.set_string("long_name", "relative ice velocity magnitude error");
ierr = nc.write_timeseries(err, (size_t)start, rel_vector); CHKERRQ(ierr);
err.clear_all_strings(); err.clear_all_doubles(); err.set_units("1");
err.set_name("maximum_u");
ierr = err.set_units("m/year"); CHKERRQ(ierr);
err.set_string("long_name", "maximum error in the X-component of the ice velocity");
ierr = nc.write_timeseries(err, (size_t)start, max_u); CHKERRQ(ierr);
err.clear_all_strings(); err.clear_all_doubles(); err.set_units("1");
err.set_name("maximum_v");
ierr = err.set_units("m/year"); CHKERRQ(ierr);
err.set_string("long_name", "maximum error in the Y-component of the ice velocity");
ierr = nc.write_timeseries(err, (size_t)start, max_v); CHKERRQ(ierr);
err.clear_all_strings(); err.clear_all_doubles(); err.set_units("1");
err.set_name("average_u");
ierr = err.set_units("m/year"); CHKERRQ(ierr);
err.set_string("long_name", "average error in the X-component of the ice velocity");
ierr = nc.write_timeseries(err, (size_t)start, avg_u); CHKERRQ(ierr);
err.clear_all_strings(); err.clear_all_doubles(); err.set_units("1");
err.set_name("average_v");
ierr = err.set_units("m/year"); CHKERRQ(ierr);
err.set_string("long_name", "average error in the Y-component of the ice velocity");
ierr = nc.write_timeseries(err, (size_t)start, avg_v); CHKERRQ(ierr);
ierr = nc.close(); CHKERRQ(ierr);
return 0;
}
PetscErrorCode SSATestCase::exactSolution(int /*i*/, int /*j*/,
double /*x*/, double /*y*/,
double *u, double *v )
{
*u=0; *v=0;
return 0;
}
//! Save the computation and data to a file.
PetscErrorCode SSATestCase::write(const std::string &filename)
{
PetscErrorCode ierr;
// Write results to an output file:
PIO pio(grid, grid.config.get_string("output_format"));
ierr = pio.open(filename, PISM_WRITE); CHKERRQ(ierr);
ierr = pio.def_time(config.get_string("time_dimension_name"),
grid.time->calendar(),
grid.time->CF_units_string()); CHKERRQ(ierr);
ierr = pio.append_time(config.get_string("time_dimension_name"), 0.0); CHKERRQ(ierr);
ierr = surface.write(pio); CHKERRQ(ierr);
ierr = thickness.write(pio); CHKERRQ(ierr);
ierr = bc_mask.write(pio); CHKERRQ(ierr);
ierr = tauc.write(pio); CHKERRQ(ierr);
ierr = bed.write(pio); CHKERRQ(ierr);
ierr = enthalpy.write(pio); CHKERRQ(ierr);
ierr = vel_bc.write(pio); CHKERRQ(ierr);
IceModelVec2V *vel_ssa;
ierr = ssa->get_2D_advective_velocity(vel_ssa); CHKERRQ(ierr);
ierr = vel_ssa->write(pio); CHKERRQ(ierr);
IceModelVec2V exact;
ierr = exact.create(grid, "_exact", WITHOUT_GHOSTS); CHKERRQ(ierr);
ierr = exact.set_attrs("diagnostic",
"X-component of the SSA exact solution",
"m s-1", "", 0); CHKERRQ(ierr);
ierr = exact.set_attrs("diagnostic",
"Y-component of the SSA exact solution",
"m s-1", "", 1); CHKERRQ(ierr);
ierr = exact.set_glaciological_units("m year-1"); CHKERRQ(ierr);
exact.write_in_glaciological_units = true;
ierr = exact.begin_access(); CHKERRQ(ierr);
for (int i=grid.xs; i<grid.xs+grid.xm; i++) {
for (int j=grid.ys; j<grid.ys+grid.ym; j++) {
double myx = grid.x[i], myy = grid.y[j];
exactSolution(i,j,myx,myy,&(exact(i,j).u),&(exact(i,j).v));
}
}
ierr = exact.end_access(); CHKERRQ(ierr);
ierr = exact.write(pio); CHKERRQ(ierr);
ierr = pio.close(); CHKERRQ(ierr);
return 0;
}
/*! Initialize a uniform, shallow (3 z-levels), doubly periodic grid with
half-widths (Lx,Ly) and Mx by My nodes for time-independent computations.*/
PetscErrorCode init_shallow_grid(IceGrid &grid, double Lx,
double Ly, int Mx, int My, Periodicity p)
{
PetscErrorCode ierr;
grid.Lx = Lx;
grid.Ly = Ly;
grid.periodicity = p;
grid.Mx = Mx; grid.My=My; grid.Mz = 3;
grid.compute_nprocs();
grid.compute_ownership_ranges();
ierr = grid.compute_vertical_levels(); CHKERRQ(ierr);
ierr = grid.compute_horizontal_spacing(); CHKERRQ(ierr);
ierr = grid.allocate(); CHKERRQ(ierr);
return 0;
}
| gpl-3.0 |
uhoreg/moodle | lib/yui/3.4.1pr1/build/selection/selection-debug.js | 36612 | /*
YUI 3.4.1pr1 (build 4097)
Copyright 2011 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('selection', function(Y) {
/**
* Wraps some common Selection/Range functionality into a simple object
* @class Selection
* @constructor
* @module editor
* @submodule selection
*/
//TODO This shouldn't be there, Y.Node doesn't normalize getting textnode content.
var textContent = 'textContent',
INNER_HTML = 'innerHTML',
FONT_FAMILY = 'fontFamily';
if (Y.UA.ie) {
textContent = 'nodeValue';
}
Y.Selection = function(domEvent) {
var sel, par, ieNode, nodes, rng, i;
if (Y.config.win.getSelection) {
sel = Y.config.win.getSelection();
} else if (Y.config.doc.selection) {
sel = Y.config.doc.selection.createRange();
}
this._selection = sel;
if (sel.pasteHTML) {
this.isCollapsed = (sel.compareEndPoints('StartToEnd', sel)) ? false : true;
if (this.isCollapsed) {
this.anchorNode = this.focusNode = Y.one(sel.parentElement());
if (domEvent) {
ieNode = Y.config.doc.elementFromPoint(domEvent.clientX, domEvent.clientY);
}
rng = sel.duplicate();
if (!ieNode) {
par = sel.parentElement();
nodes = par.childNodes;
for (i = 0; i < nodes.length; i++) {
//This causes IE to not allow a selection on a doubleclick
//rng.select(nodes[i]);
if (rng.inRange(sel)) {
if (!ieNode) {
ieNode = nodes[i];
}
}
}
}
this.ieNode = ieNode;
if (ieNode) {
if (ieNode.nodeType !== 3) {
if (ieNode.firstChild) {
ieNode = ieNode.firstChild;
}
if (ieNode && ieNode.tagName && ieNode.tagName.toLowerCase() === 'body') {
if (ieNode.firstChild) {
ieNode = ieNode.firstChild;
}
}
}
this.anchorNode = this.focusNode = Y.Selection.resolve(ieNode);
rng.moveToElementText(sel.parentElement());
var comp = sel.compareEndPoints('StartToStart', rng),
moved = 0;
if (comp) {
//We are not at the beginning of the selection.
//Setting the move to something large, may need to increase it later
moved = Math.abs(sel.move('character', -9999));
}
this.anchorOffset = this.focusOffset = moved;
this.anchorTextNode = this.focusTextNode = Y.one(ieNode);
}
} else {
//This helps IE deal with a selection and nodeChange events
if (sel.htmlText && sel.htmlText !== '') {
var n = Y.Node.create(sel.htmlText);
if (n && n.get('id')) {
var id = n.get('id');
this.anchorNode = this.focusNode = Y.one('#' + id);
} else if (n) {
n = n.get('childNodes');
this.anchorNode = this.focusNode = n.item(0);
}
}
}
//var self = this;
//debugger;
} else {
this.isCollapsed = sel.isCollapsed;
this.anchorNode = Y.Selection.resolve(sel.anchorNode);
this.focusNode = Y.Selection.resolve(sel.focusNode);
this.anchorOffset = sel.anchorOffset;
this.focusOffset = sel.focusOffset;
this.anchorTextNode = Y.one(sel.anchorNode);
this.focusTextNode = Y.one(sel.focusNode);
}
if (Y.Lang.isString(sel.text)) {
this.text = sel.text;
} else {
if (sel.toString) {
this.text = sel.toString();
} else {
this.text = '';
}
}
};
/**
* Utility method to remove dead font-family styles from an element.
* @static
* @method removeFontFamily
*/
Y.Selection.removeFontFamily = function(n) {
n.removeAttribute('face');
var s = n.getAttribute('style').toLowerCase();
if (s === '' || (s == 'font-family: ')) {
n.removeAttribute('style');
}
if (s.match(Y.Selection.REG_FONTFAMILY)) {
s = s.replace(Y.Selection.REG_FONTFAMILY, '');
n.setAttribute('style', s);
}
};
/**
* Performs a prefilter on all nodes in the editor. Looks for nodes with a style: fontFamily or font face
* It then creates a dynamic class assigns it and removed the property. This is so that we don't lose
* the fontFamily when selecting nodes.
* @static
* @method filter
*/
Y.Selection.filter = function(blocks) {
var startTime = (new Date()).getTime();
Y.log('Filtering nodes', 'info', 'selection');
var nodes = Y.all(Y.Selection.ALL),
baseNodes = Y.all('strong,em'),
doc = Y.config.doc, hrs,
classNames = {}, cssString = '',
ls;
var startTime1 = (new Date()).getTime();
nodes.each(function(n) {
var raw = Y.Node.getDOMNode(n);
if (raw.style[FONT_FAMILY]) {
classNames['.' + n._yuid] = raw.style[FONT_FAMILY];
n.addClass(n._yuid);
Y.Selection.removeFontFamily(raw);
}
/*
if (n.getStyle(FONT_FAMILY)) {
classNames['.' + n._yuid] = n.getStyle(FONT_FAMILY);
n.addClass(n._yuid);
n.removeAttribute('face');
n.setStyle(FONT_FAMILY, '');
if (n.getAttribute('style') === '') {
n.removeAttribute('style');
}
//This is for IE
if (n.getAttribute('style').toLowerCase() === 'font-family: ') {
n.removeAttribute('style');
}
}
*/
});
var endTime1 = (new Date()).getTime();
Y.log('Node Filter Timer: ' + (endTime1 - startTime1) + 'ms', 'info', 'selection');
Y.all('.hr').addClass('yui-skip').addClass('yui-non');
if (Y.UA.ie) {
hrs = doc.getElementsByTagName('hr');
Y.each(hrs, function(hr) {
var el = doc.createElement('div');
el.className = 'hr yui-non yui-skip';
el.setAttribute('readonly', true);
el.setAttribute('contenteditable', false); //Keep it from being Edited
if (hr.parentNode) {
hr.parentNode.replaceChild(el, hr);
}
//Had to move to inline style. writes for ie's < 8. They don't render el.setAttribute('style');
var s = el.style;
s.border = '1px solid #ccc';
s.lineHeight = '0';
s.height = '0';
s.fontSize = '0';
s.marginTop = '5px';
s.marginBottom = '5px';
s.marginLeft = '0px';
s.marginRight = '0px';
s.padding = '0';
});
}
Y.each(classNames, function(v, k) {
cssString += k + ' { font-family: ' + v.replace(/"/gi, '') + '; }';
});
Y.StyleSheet(cssString, 'editor');
//Not sure about this one?
baseNodes.each(function(n, k) {
var t = n.get('tagName').toLowerCase(),
newTag = 'i';
if (t === 'strong') {
newTag = 'b';
}
Y.Selection.prototype._swap(baseNodes.item(k), newTag);
});
//Filter out all the empty UL/OL's
ls = Y.all('ol,ul');
ls.each(function(v, k) {
var lis = v.all('li');
if (!lis.size()) {
v.remove();
}
});
if (blocks) {
Y.Selection.filterBlocks();
}
var endTime = (new Date()).getTime();
Y.log('Filter Timer: ' + (endTime - startTime) + 'ms', 'info', 'selection');
};
/**
* Method attempts to replace all "orphined" text nodes in the main body by wrapping them with a <p>. Called from filter.
* @static
* @method filterBlocks
*/
Y.Selection.filterBlocks = function() {
var startTime = (new Date()).getTime();
Y.log('RAW filter blocks', 'info', 'selection');
var childs = Y.config.doc.body.childNodes, i, node, wrapped = false, doit = true,
sel, single, br, divs, spans, c, s;
if (childs) {
for (i = 0; i < childs.length; i++) {
node = Y.one(childs[i]);
if (!node.test(Y.Selection.BLOCKS)) {
doit = true;
if (childs[i].nodeType == 3) {
c = childs[i][textContent].match(Y.Selection.REG_CHAR);
s = childs[i][textContent].match(Y.Selection.REG_NON);
if (c === null && s) {
doit = false;
}
}
if (doit) {
if (!wrapped) {
wrapped = [];
}
wrapped.push(childs[i]);
}
} else {
wrapped = Y.Selection._wrapBlock(wrapped);
}
}
wrapped = Y.Selection._wrapBlock(wrapped);
}
single = Y.all(Y.Selection.DEFAULT_BLOCK_TAG);
if (single.size() === 1) {
Y.log('Only One default block tag (' + Y.Selection.DEFAULT_BLOCK_TAG + '), focus it..', 'info', 'selection');
br = single.item(0).all('br');
if (br.size() === 1) {
if (!br.item(0).test('.yui-cursor')) {
br.item(0).remove();
}
var html = single.item(0).get('innerHTML');
if (html === '' || html === ' ') {
Y.log('Paragraph empty, focusing cursor', 'info', 'selection');
single.set('innerHTML', Y.Selection.CURSOR);
sel = new Y.Selection();
sel.focusCursor(true, true);
}
if (br.item(0).test('.yui-cursor') && Y.UA.ie) {
br.item(0).remove();
}
}
} else {
single.each(function(p) {
var html = p.get('innerHTML');
if (html === '') {
Y.log('Empty Paragraph Tag Found, Removing It', 'info', 'selection');
p.remove();
}
});
}
if (!Y.UA.ie) {
/*
divs = Y.all('div, p');
divs.each(function(d) {
if (d.hasClass('yui-non')) {
return;
}
var html = d.get('innerHTML');
if (html === '') {
Y.log('Empty DIV/P Tag Found, Removing It', 'info', 'selection');
d.remove();
} else {
Y.log('DIVS/PS Count: ' + d.get('childNodes').size(), 'info', 'selection');
if (d.get('childNodes').size() == 1) {
Y.log('This Div/P only has one Child Node', 'info', 'selection');
if (d.ancestor('p')) {
Y.log('This Div/P is a child of a paragraph, remove it..', 'info', 'selection');
d.replace(d.get('firstChild'));
}
}
}
});*/
/* Removed this, as it was causing Pasting to be funky in Safari
spans = Y.all('.Apple-style-span, .apple-style-span');
Y.log('Apple Spans found: ' + spans.size(), 'info', 'selection');
spans.each(function(s) {
s.setAttribute('style', '');
});
*/
}
var endTime = (new Date()).getTime();
Y.log('FilterBlocks Timer: ' + (endTime - startTime) + 'ms', 'info', 'selection');
};
/**
* Regular Expression used to find dead font-family styles
* @static
* @property REG_FONTFAMILY
*/
Y.Selection.REG_FONTFAMILY = /font-family: ;/;
/**
* Regular Expression to determine if a string has a character in it
* @static
* @property REG_CHAR
*/
Y.Selection.REG_CHAR = /[a-zA-Z-0-9_!@#\$%\^&*\(\)-=_+\[\]\\{}|;':",.\/<>\?]/gi;
/**
* Regular Expression to determine if a string has a non-character in it
* @static
* @property REG_NON
*/
Y.Selection.REG_NON = /[\s|\n|\t]/gi;
/**
* Regular Expression to remove all HTML from a string
* @static
* @property REG_NOHTML
*/
Y.Selection.REG_NOHTML = /<\S[^><]*>/g;
/**
* Wraps an array of elements in a Block level tag
* @static
* @private
* @method _wrapBlock
*/
Y.Selection._wrapBlock = function(wrapped) {
if (wrapped) {
var newChild = Y.Node.create('<' + Y.Selection.DEFAULT_BLOCK_TAG + '></' + Y.Selection.DEFAULT_BLOCK_TAG + '>'),
firstChild = Y.one(wrapped[0]), i;
for (i = 1; i < wrapped.length; i++) {
newChild.append(wrapped[i]);
}
firstChild.replace(newChild);
newChild.prepend(firstChild);
}
return false;
};
/**
* Undoes what filter does enough to return the HTML from the Editor, then re-applies the filter.
* @static
* @method unfilter
* @return {String} The filtered HTML
*/
Y.Selection.unfilter = function() {
var nodes = Y.all('body [class]'),
html = '', nons, ids,
body = Y.one('body');
Y.log('UnFiltering nodes', 'info', 'selection');
nodes.each(function(n) {
if (n.hasClass(n._yuid)) {
//One of ours
n.setStyle(FONT_FAMILY, n.getStyle(FONT_FAMILY));
n.removeClass(n._yuid);
if (n.getAttribute('class') === '') {
n.removeAttribute('class');
}
}
});
nons = Y.all('.yui-non');
nons.each(function(n) {
if (!n.hasClass('yui-skip') && n.get('innerHTML') === '') {
n.remove();
} else {
n.removeClass('yui-non').removeClass('yui-skip');
}
});
ids = Y.all('body [id]');
ids.each(function(n) {
if (n.get('id').indexOf('yui_3_') === 0) {
n.removeAttribute('id');
n.removeAttribute('_yuid');
}
});
if (body) {
html = body.get('innerHTML');
}
Y.all('.hr').addClass('yui-skip').addClass('yui-non');
/*
nodes.each(function(n) {
n.addClass(n._yuid);
n.setStyle(FONT_FAMILY, '');
if (n.getAttribute('style') === '') {
n.removeAttribute('style');
}
});
*/
return html;
};
/**
* Resolve a node from the selection object and return a Node instance
* @static
* @method resolve
* @param {HTMLElement} n The HTMLElement to resolve. Might be a TextNode, gives parentNode.
* @return {Node} The Resolved node
*/
Y.Selection.resolve = function(n) {
if (n && n.nodeType === 3) {
//Adding a try/catch here because in rare occasions IE will
//Throw a error accessing the parentNode of a stranded text node.
//In the case of Ctrl+Z (Undo)
try {
n = n.parentNode;
} catch (re) {
n = 'body';
}
}
return Y.one(n);
};
/**
* Returns the innerHTML of a node with all HTML tags removed.
* @static
* @method getText
* @param {Node} node The Node instance to remove the HTML from
* @return {String} The string of text
*/
Y.Selection.getText = function(node) {
var txt = node.get('innerHTML').replace(Y.Selection.REG_NOHTML, '');
//Clean out the cursor subs to see if the Node is empty
txt = txt.replace('<span><br></span>', '').replace('<br>', '');
return txt;
};
//Y.Selection.DEFAULT_BLOCK_TAG = 'div';
Y.Selection.DEFAULT_BLOCK_TAG = 'p';
/**
* The selector to use when looking for Nodes to cache the value of: [style],font[face]
* @static
* @property ALL
*/
Y.Selection.ALL = '[style],font[face]';
/**
* The selector to use when looking for block level items.
* @static
* @property BLOCKS
*/
Y.Selection.BLOCKS = 'p,div,ul,ol,table,style';
/**
* The temporary fontname applied to a selection to retrieve their values: yui-tmp
* @static
* @property TMP
*/
Y.Selection.TMP = 'yui-tmp';
/**
* The default tag to use when creating elements: span
* @static
* @property DEFAULT_TAG
*/
Y.Selection.DEFAULT_TAG = 'span';
/**
* The id of the outer cursor wrapper
* @static
* @property DEFAULT_TAG
*/
Y.Selection.CURID = 'yui-cursor';
/**
* The id used to wrap the inner space of the cursor position
* @static
* @property CUR_WRAPID
*/
Y.Selection.CUR_WRAPID = 'yui-cursor-wrapper';
/**
* The default HTML used to focus the cursor..
* @static
* @property CURSOR
*/
Y.Selection.CURSOR = '<span><br class="yui-cursor"></span>';
Y.Selection.hasCursor = function() {
var cur = Y.all('#' + Y.Selection.CUR_WRAPID);
Y.log('Has Cursor: ' + cur.size(), 'info', 'selection');
return cur.size();
};
/**
* Called from Editor keydown to remove the "extra" space before the cursor.
* @static
* @method cleanCursor
*/
Y.Selection.cleanCursor = function() {
//Y.log('Cleaning Cursor', 'info', 'Selection');
var cur, sel = 'br.yui-cursor';
cur = Y.all(sel);
if (cur.size()) {
cur.each(function(b) {
var c = b.get('parentNode.parentNode.childNodes'), html;
if (c.size()) {
b.remove();
} else {
html = Y.Selection.getText(c.item(0));
if (html !== '') {
b.remove();
}
}
});
}
/*
var cur = Y.all('#' + Y.Selection.CUR_WRAPID);
if (cur.size()) {
cur.each(function(c) {
var html = c.get('innerHTML');
if (html == ' ' || html == '<br>') {
if (c.previous() || c.next()) {
c.remove();
}
}
});
}
*/
};
Y.Selection.prototype = {
/**
* Range text value
* @property text
* @type String
*/
text: null,
/**
* Flag to show if the range is collapsed or not
* @property isCollapsed
* @type Boolean
*/
isCollapsed: null,
/**
* A Node instance of the parentNode of the anchorNode of the range
* @property anchorNode
* @type Node
*/
anchorNode: null,
/**
* The offset from the range object
* @property anchorOffset
* @type Number
*/
anchorOffset: null,
/**
* A Node instance of the actual textNode of the range.
* @property anchorTextNode
* @type Node
*/
anchorTextNode: null,
/**
* A Node instance of the parentNode of the focusNode of the range
* @property focusNode
* @type Node
*/
focusNode: null,
/**
* The offset from the range object
* @property focusOffset
* @type Number
*/
focusOffset: null,
/**
* A Node instance of the actual textNode of the range.
* @property focusTextNode
* @type Node
*/
focusTextNode: null,
/**
* The actual Selection/Range object
* @property _selection
* @private
*/
_selection: null,
/**
* Wrap an element, with another element
* @private
* @method _wrap
* @param {HTMLElement} n The node to wrap
* @param {String} tag The tag to use when creating the new element.
* @return {HTMLElement} The wrapped node
*/
_wrap: function(n, tag) {
var tmp = Y.Node.create('<' + tag + '></' + tag + '>');
tmp.set(INNER_HTML, n.get(INNER_HTML));
n.set(INNER_HTML, '');
n.append(tmp);
return Y.Node.getDOMNode(tmp);
},
/**
* Swap an element, with another element
* @private
* @method _swap
* @param {HTMLElement} n The node to swap
* @param {String} tag The tag to use when creating the new element.
* @return {HTMLElement} The new node
*/
_swap: function(n, tag) {
var tmp = Y.Node.create('<' + tag + '></' + tag + '>');
tmp.set(INNER_HTML, n.get(INNER_HTML));
n.replace(tmp, n);
return Y.Node.getDOMNode(tmp);
},
/**
* Get all the nodes in the current selection. This method will actually perform a filter first.
* Then it calls doc.execCommand('fontname', null, 'yui-tmp') to touch all nodes in the selection.
* The it compiles a list of all nodes affected by the execCommand and builds a NodeList to return.
* @method getSelected
* @return {NodeList} A NodeList of all items in the selection.
*/
getSelected: function() {
Y.Selection.filter();
Y.config.doc.execCommand('fontname', null, Y.Selection.TMP);
var nodes = Y.all(Y.Selection.ALL),
items = [];
nodes.each(function(n, k) {
if (n.getStyle(FONT_FAMILY) == Y.Selection.TMP) {
n.setStyle(FONT_FAMILY, '');
Y.Selection.removeFontFamily(n);
if (!n.test('body')) {
items.push(Y.Node.getDOMNode(nodes.item(k)));
}
}
});
return Y.all(items);
},
/**
* Insert HTML at the current cursor position and return a Node instance of the newly inserted element.
* @method insertContent
* @param {String} html The HTML to insert.
* @return {Node} The inserted Node.
*/
insertContent: function(html) {
return this.insertAtCursor(html, this.anchorTextNode, this.anchorOffset, true);
},
/**
* Insert HTML at the current cursor position, this method gives you control over the text node to insert into and the offset where to put it.
* @method insertAtCursor
* @param {String} html The HTML to insert.
* @param {Node} node The text node to break when inserting.
* @param {Number} offset The left offset of the text node to break and insert the new content.
* @param {Boolean} collapse Should the range be collapsed after insertion. default: false
* @return {Node} The inserted Node.
*/
insertAtCursor: function(html, node, offset, collapse) {
var cur = Y.Node.create('<' + Y.Selection.DEFAULT_TAG + ' class="yui-non"></' + Y.Selection.DEFAULT_TAG + '>'),
inHTML, txt, txt2, newNode, range = this.createRange(), b;
if (node && node.test('body')) {
b = Y.Node.create('<span></span>');
node.append(b);
node = b;
}
if (range.pasteHTML) {
if (offset === 0 && node && !node.previous() && node.get('nodeType') === 3) {
/*
* For some strange reason, range.pasteHTML fails if the node is a textNode and
* the offset is 0. (The cursor is at the beginning of the line)
* It will always insert the new content at position 1 instead of
* position 0. Here we test for that case and do it the hard way.
*/
node.insert(html, 'before');
if (range.moveToElementText) {
range.moveToElementText(Y.Node.getDOMNode(node.previous()));
}
//Move the cursor after the new node
range.collapse(false);
range.select();
return node.previous();
} else {
newNode = Y.Node.create(html);
try {
range.pasteHTML('<span id="rte-insert"></span>');
} catch (e) {}
inHTML = Y.one('#rte-insert');
if (inHTML) {
inHTML.set('id', '');
inHTML.replace(newNode);
if (range.moveToElementText) {
range.moveToElementText(Y.Node.getDOMNode(newNode));
}
range.collapse(false);
range.select();
return newNode;
} else {
Y.on('available', function() {
inHTML.set('id', '');
inHTML.replace(newNode);
if (range.moveToElementText) {
range.moveToElementText(Y.Node.getDOMNode(newNode));
}
range.collapse(false);
range.select();
}, '#rte-insert');
}
}
} else {
//TODO using Y.Node.create here throws warnings & strips first white space character
//txt = Y.one(Y.Node.create(inHTML.substr(0, offset)));
//txt2 = Y.one(Y.Node.create(inHTML.substr(offset)));
if (offset > 0) {
inHTML = node.get(textContent);
txt = Y.one(Y.config.doc.createTextNode(inHTML.substr(0, offset)));
txt2 = Y.one(Y.config.doc.createTextNode(inHTML.substr(offset)));
node.replace(txt, node);
newNode = Y.Node.create(html);
if (newNode.get('nodeType') === 11) {
b = Y.Node.create('<span></span>');
b.append(newNode);
newNode = b;
}
txt.insert(newNode, 'after');
//if (txt2 && txt2.get('length')) {
if (txt2) {
newNode.insert(cur, 'after');
cur.insert(txt2, 'after');
this.selectNode(cur, collapse);
}
} else {
if (node.get('nodeType') === 3) {
node = node.get('parentNode');
}
newNode = Y.Node.create(html);
html = node.get('innerHTML').replace(/\n/gi, '');
if (html === '' || html === '<br>') {
node.append(newNode);
} else {
if (newNode.get('parentNode')) {
node.insert(newNode, 'before');
} else {
Y.one('body').prepend(newNode);
}
}
if (node.get('firstChild').test('br')) {
node.get('firstChild').remove();
}
}
}
return newNode;
},
/**
* Get all elements inside a selection and wrap them with a new element and return a NodeList of all elements touched.
* @method wrapContent
* @param {String} tag The tag to wrap all selected items with.
* @return {NodeList} A NodeList of all items in the selection.
*/
wrapContent: function(tag) {
tag = (tag) ? tag : Y.Selection.DEFAULT_TAG;
if (!this.isCollapsed) {
Y.log('Wrapping selection with: ' + tag, 'info', 'selection');
var items = this.getSelected(),
changed = [], range, last, first, range2;
items.each(function(n, k) {
var t = n.get('tagName').toLowerCase();
if (t === 'font') {
changed.push(this._swap(items.item(k), tag));
} else {
changed.push(this._wrap(items.item(k), tag));
}
}, this);
range = this.createRange();
first = changed[0];
last = changed[changed.length - 1];
if (this._selection.removeAllRanges) {
range.setStart(changed[0], 0);
range.setEnd(last, last.childNodes.length);
this._selection.removeAllRanges();
this._selection.addRange(range);
} else {
if (range.moveToElementText) {
range.moveToElementText(Y.Node.getDOMNode(first));
range2 = this.createRange();
range2.moveToElementText(Y.Node.getDOMNode(last));
range.setEndPoint('EndToEnd', range2);
}
range.select();
}
changed = Y.all(changed);
Y.log('Returning NodeList with (' + changed.size() + ') item(s)' , 'info', 'selection');
return changed;
} else {
Y.log('Can not wrap a collapsed selection, use insertContent', 'error', 'selection');
return Y.all([]);
}
},
/**
* Find and replace a string inside a text node and replace it with HTML focusing the node after
* to allow you to continue to type.
* @method replace
* @param {String} se The string to search for.
* @param {String} re The string of HTML to replace it with.
* @return {Node} The node inserted.
*/
replace: function(se,re) {
Y.log('replacing (' + se + ') with (' + re + ')');
var range = this.createRange(), node, txt, index, newNode;
if (range.getBookmark) {
index = range.getBookmark();
txt = this.anchorNode.get('innerHTML').replace(se, re);
this.anchorNode.set('innerHTML', txt);
range.moveToBookmark(index);
newNode = Y.one(range.parentElement());
} else {
node = this.anchorTextNode;
txt = node.get(textContent);
index = txt.indexOf(se);
txt = txt.replace(se, '');
node.set(textContent, txt);
newNode = this.insertAtCursor(re, node, index, true);
}
return newNode;
},
/**
* Destroy the range.
* @method remove
* @chainable
* @return {Selection}
*/
remove: function() {
this._selection.removeAllRanges();
return this;
},
/**
* Wrapper for the different range creation methods.
* @method createRange
* @return {RangeObject}
*/
createRange: function() {
if (Y.config.doc.selection) {
return Y.config.doc.selection.createRange();
} else {
return Y.config.doc.createRange();
}
},
/**
* Select a Node (hilighting it).
* @method selectNode
* @param {Node} node The node to select
* @param {Boolean} collapse Should the range be collapsed after insertion. default: false
* @chainable
* @return {Selection}
*/
selectNode: function(node, collapse, end) {
if (!node) {
Y.log('Node passed to selectNode is null', 'error', 'selection');
return;
}
end = end || 0;
node = Y.Node.getDOMNode(node);
var range = this.createRange();
if (range.selectNode) {
range.selectNode(node);
this._selection.removeAllRanges();
this._selection.addRange(range);
if (collapse) {
try {
this._selection.collapse(node, end);
} catch (err) {
this._selection.collapse(node, 0);
}
}
} else {
if (node.nodeType === 3) {
node = node.parentNode;
}
try {
range.moveToElementText(node);
} catch(e) {}
if (collapse) {
range.collapse(((end) ? false : true));
}
range.select();
}
return this;
},
/**
* Put a placeholder in the DOM at the current cursor position.
* @method setCursor
* @return {Node}
*/
setCursor: function() {
this.removeCursor(false);
return this.insertContent(Y.Selection.CURSOR);
},
/**
* Get the placeholder in the DOM at the current cursor position.
* @method getCursor
* @return {Node}
*/
getCursor: function() {
return Y.all('#' + Y.Selection.CURID);
},
/**
* Remove the cursor placeholder from the DOM.
* @method removeCursor
* @param {Boolean} keep Setting this to true will keep the node, but remove the unique parts that make it the cursor.
* @return {Node}
*/
removeCursor: function(keep) {
var cur = this.getCursor();
if (cur) {
if (keep) {
cur.removeAttribute('id');
cur.set('innerHTML', '<br class="yui-cursor">');
} else {
cur.remove();
}
}
return cur;
},
/**
* Gets a stored cursor and focuses it for editing, must be called sometime after setCursor
* @method focusCursor
* @return {Node}
*/
focusCursor: function(collapse, end) {
if (collapse !== false) {
collapse = true;
}
if (end !== false) {
end = true;
}
var cur = this.removeCursor(true);
if (cur) {
cur.each(function(c) {
this.selectNode(c, collapse, end);
}, this);
}
},
/**
* Generic toString for logging.
* @method toString
* @return {String}
*/
toString: function() {
return 'Selection Object';
}
};
}, '3.4.1pr1' ,{skinnable:false, requires:['node']});
| gpl-3.0 |
forairan/WorldPainter | WorldPainter/WPGUI/src/main/java/org/pepsoft/worldpainter/PreferencesDialog.java | 78028 | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* PreferencesDialog.java
*
* Created on Apr 26, 2012, 3:18:17 PM
*/
package org.pepsoft.worldpainter;
import java.util.SortedMap;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import org.pepsoft.worldpainter.themes.TerrainListCellRenderer;
import java.io.IOException;
import java.util.List;
import java.util.Random;
import javax.swing.*;
import static org.pepsoft.worldpainter.Terrain.*;
import static org.pepsoft.minecraft.Constants.*;
import static org.pepsoft.worldpainter.Constants.*;
import org.pepsoft.worldpainter.TileRenderer.LightOrigin;
import org.pepsoft.worldpainter.themes.SimpleTheme;
/**
*
* @author pepijn
*/
public class PreferencesDialog extends javax.swing.JDialog {
/** Creates new form PreferencesDialog */
public PreferencesDialog(java.awt.Frame parent, ColourScheme colourScheme) {
super(parent, true);
this.colourScheme = colourScheme;
initComponents();
comboBoxSurfaceMaterial.setModel(new DefaultComboBoxModel(Terrain.PICK_LIST));
comboBoxSurfaceMaterial.setRenderer(new TerrainListCellRenderer(colourScheme));
if (! JAVA_7) {
comboBoxLookAndFeel.setModel(new DefaultComboBoxModel(new Object[] {"System", "Metal", "Nimbus", "Dark Metal"}));
}
List<AccelerationType> accelTypes = AccelerationType.getForThisOS();
radioButtonAccelDefault.setEnabled(accelTypes.contains(AccelerationType.DEFAULT));
radioButtonAccelDirect3D.setEnabled(accelTypes.contains(AccelerationType.DIRECT3D));
radioButtonAccelOpenGL.setEnabled(accelTypes.contains(AccelerationType.OPENGL));
radioButtonAccelQuartz.setEnabled(accelTypes.contains(AccelerationType.QUARTZ));
radioButtonAccelUnaccelerated.setEnabled(accelTypes.contains(AccelerationType.UNACCELERATED));
radioButtonAccelXRender.setEnabled(accelTypes.contains(AccelerationType.XRENDER));
loadSettings();
ActionMap actionMap = rootPane.getActionMap();
actionMap.put("cancel", new AbstractAction("cancel") {
@Override
public void actionPerformed(ActionEvent e) {
cancel();
}
private static final long serialVersionUID = 1L;
});
InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel");
rootPane.setDefaultButton(buttonOK);
pack();
setLocationRelativeTo(parent);
}
public void ok() {
saveSettings();
cancelled = false;
dispose();
}
public void cancel() {
dispose();
}
public boolean isCancelled() {
return cancelled;
}
private void loadSettings() {
Configuration config = Configuration.getInstance();
if (Main.privateContext == null) {
checkBoxPing.setSelected(false);
checkBoxPing.setEnabled(false);
pingNotSet = true;
} else if (config.getPingAllowed() != null) {
checkBoxPing.setSelected(config.getPingAllowed());
} else {
checkBoxPing.setSelected(false);
pingNotSet = true;
}
if ((Main.privateContext == null)
|| "true".equals(System.getProperty("org.pepsoft.worldpainter.devMode"))
|| "true".equals(System.getProperty("org.pepsoft.worldpainter.disableUpdateCheck"))) {
checkBoxCheckForUpdates.setSelected(false);
checkBoxCheckForUpdates.setEnabled(false);
} else {
checkBoxCheckForUpdates.setSelected(config.isCheckForUpdates());
}
if ("true".equals(System.getProperty("org.pepsoft.worldpainter.disableUndo"))) {
checkBoxUndo.setSelected(false);
checkBoxUndo.setEnabled(false);
spinnerUndoLevels.setEnabled(false);
} else {
checkBoxUndo.setSelected(config.isUndoEnabled());
spinnerUndoLevels.setValue(config.getUndoLevels());
}
checkBoxGrid.setSelected(config.isDefaultGridEnabled());
spinnerGrid.setValue(config.getDefaultGridSize());
checkBoxContours.setSelected(config.isDefaultContoursEnabled());
spinnerContours.setValue(config.getDefaultContourSeparation());
checkBoxViewDistance.setSelected(config.isDefaultViewDistanceEnabled());
checkBoxWalkingDistance.setSelected(config.isDefaultWalkingDistanceEnabled());
comboBoxLightDirection.setSelectedItem(config.getDefaultLightOrigin());
checkBoxCircular.setSelected(config.isDefaultCircularWorld());
spinnerBrushSize.setValue(config.getMaximumBrushSize());
spinnerWidth.setValue(config.getDefaultWidth() * 128);
spinnerHeight.setValue(config.getDefaultHeight() * 128);
comboBoxHeight.setSelectedItem(Integer.toString(config.getDefaultMaxHeight()));
if (config.isHilly()) {
radioButtonHilly.setSelected(true);
} else {
radioButtonFlat.setSelected(true);
spinnerRange.setEnabled(false);
spinnerScale.setEnabled(false);
}
spinnerRange.setValue((int) (config.getDefaultRange() + 0.5f));
spinnerScale.setValue((int) (config.getDefaultScale() * 100 + 0.5f));
spinnerGroundLevel.setValue(config.getLevel());
spinnerWaterLevel.setValue(config.getWaterLevel());
checkBoxLava.setSelected(config.isLava());
checkBoxBeaches.setSelected(config.isBeaches());
comboBoxSurfaceMaterial.setSelectedItem(config.getSurface());
spinnerWorldBackups.setValue(config.getWorldFileBackups());
checkBoxExtendedBlockIds.setSelected(config.isDefaultExtendedBlockIds());
// Export settings
checkBoxChestOfGoodies.setSelected(config.isDefaultCreateGoodiesChest());
comboBoxWorldType.setSelectedIndex(config.getDefaultGenerator().ordinal());
generatorOptions = config.getDefaultGeneratorOptions();
checkBoxStructures.setSelected(config.isDefaultMapFeatures());
comboBoxMode.setSelectedIndex(config.getDefaultGameType());
checkBoxCheats.setSelected(config.isDefaultAllowCheats());
previousExp = (int) Math.round(Math.log(config.getDefaultMaxHeight()) / Math.log(2.0));
comboBoxLookAndFeel.setSelectedIndex(config.getLookAndFeel() != null ? config.getLookAndFeel().ordinal() : 0);
switch (config.getAccelerationType()) {
case DEFAULT:
radioButtonAccelDefault.setSelected(true);
break;
case DIRECT3D:
radioButtonAccelDirect3D.setSelected(true);
break;
case OPENGL:
radioButtonAccelOpenGL.setSelected(true);
break;
case QUARTZ:
radioButtonAccelQuartz.setSelected(true);
break;
case UNACCELERATED:
radioButtonAccelUnaccelerated.setSelected(true);
break;
case XRENDER:
radioButtonAccelXRender.setSelected(true);
break;
}
switch (config.getOverlayType()) {
case OPTIMISE_ON_LOAD:
radioButtonOverlayOptimiseOnLoad.setSelected(true);
break;
case SCALE_ON_LOAD:
radioButtonOverlayScaleOnLoad.setSelected(true);
break;
case SCALE_ON_PAINT:
radioButtonOverlayScaleOnPaint.setSelected(true);
break;
}
setControlStates();
}
private void saveSettings() {
Configuration config = Configuration.getInstance();
if (! pingNotSet) {
config.setPingAllowed(checkBoxPing.isSelected());
}
if ((! "true".equals(System.getProperty("org.pepsoft.worldpainter.devMode")))
&& (! "true".equals(System.getProperty("org.pepsoft.worldpainter.disableUpdateCheck")))) {
config.setCheckForUpdates(checkBoxCheckForUpdates.isSelected());
}
if (! "true".equals(System.getProperty("org.pepsoft.worldpainter.disableUndo"))) {
config.setUndoEnabled(checkBoxUndo.isSelected());
config.setUndoLevels(((Number) spinnerUndoLevels.getValue()).intValue());
}
config.setDefaultGridEnabled(checkBoxGrid.isSelected());
config.setDefaultGridSize((Integer) spinnerGrid.getValue());
config.setDefaultContoursEnabled(checkBoxContours.isSelected());
config.setDefaultContourSeparation((Integer) spinnerContours.getValue());
config.setDefaultViewDistanceEnabled(checkBoxViewDistance.isSelected());
config.setDefaultWalkingDistanceEnabled(checkBoxWalkingDistance.isSelected());
config.setDefaultLightOrigin((LightOrigin) comboBoxLightDirection.getSelectedItem());
config.setDefaultWidth(((Integer) spinnerWidth.getValue()) / 128);
// Set defaultCircularWorld *before* defaultHeight, otherwise defaultHeight might not take
config.setDefaultCircularWorld(checkBoxCircular.isSelected());
config.setDefaultHeight(((Integer) spinnerHeight.getValue()) / 128);
config.setDefaultMaxHeight(Integer.parseInt((String) comboBoxHeight.getSelectedItem()));
config.setHilly(radioButtonHilly.isSelected());
config.setDefaultRange(((Number) spinnerRange.getValue()).floatValue());
config.setDefaultScale((Integer) spinnerScale.getValue() / 100.0);
config.setLevel((Integer) spinnerGroundLevel.getValue());
config.setWaterLevel((Integer) spinnerWaterLevel.getValue());
config.setLava(checkBoxLava.isSelected());
config.setBeaches(checkBoxBeaches.isSelected());
config.setSurface((Terrain) comboBoxSurfaceMaterial.getSelectedItem());
config.setWorldFileBackups((Integer) spinnerWorldBackups.getValue());
config.setMaximumBrushSize((Integer) spinnerBrushSize.getValue());
config.setDefaultExtendedBlockIds(checkBoxExtendedBlockIds.isSelected());
// Export settings
config.setDefaultCreateGoodiesChest(checkBoxChestOfGoodies.isSelected());
config.setDefaultGenerator(Generator.values()[comboBoxWorldType.getSelectedIndex()]);
config.setDefaultGeneratorOptions(generatorOptions);
config.setDefaultMapFeatures(checkBoxStructures.isSelected());
config.setDefaultGameType(comboBoxMode.getSelectedIndex());
config.setDefaultAllowCheats(checkBoxCheats.isSelected());
config.setLookAndFeel(Configuration.LookAndFeel.values()[comboBoxLookAndFeel.getSelectedIndex()]);
if (radioButtonAccelDefault.isSelected()) {
config.setAccelerationType(AccelerationType.DEFAULT);
} else if (radioButtonAccelDirect3D.isSelected()) {
config.setAccelerationType(AccelerationType.DIRECT3D);
} else if (radioButtonAccelOpenGL.isSelected()) {
config.setAccelerationType(AccelerationType.OPENGL);
} else if (radioButtonAccelQuartz.isSelected()) {
config.setAccelerationType(AccelerationType.QUARTZ);
} else if (radioButtonAccelUnaccelerated.isSelected()) {
config.setAccelerationType(AccelerationType.UNACCELERATED);
} else if (radioButtonAccelXRender.isSelected()) {
config.setAccelerationType(AccelerationType.XRENDER);
}
if (radioButtonOverlayOptimiseOnLoad.isSelected()) {
config.setOverlayType(Configuration.OverlayType.OPTIMISE_ON_LOAD);
} else if (radioButtonOverlayScaleOnLoad.isSelected()) {
config.setOverlayType(Configuration.OverlayType.SCALE_ON_LOAD);
} else if (radioButtonOverlayScaleOnPaint.isSelected()) {
config.setOverlayType(Configuration.OverlayType.SCALE_ON_PAINT);
}
try {
config.save();
} catch (IOException e) {
ErrorDialog errorDialog = new ErrorDialog(this);
errorDialog.setException(e);
errorDialog.setVisible(true);
}
}
private void setControlStates() {
spinnerUndoLevels.setEnabled(checkBoxUndo.isSelected());
boolean hilly = radioButtonHilly.isSelected();
spinnerRange.setEnabled(hilly);
spinnerScale.setEnabled(hilly);
spinnerHeight.setEnabled(! checkBoxCircular.isSelected());
buttonModePreset.setEnabled(comboBoxWorldType.getSelectedIndex() == 1);
}
private void editTerrainAndLayerSettings() {
Configuration config = Configuration.getInstance();
Dimension defaultSettings = config.getDefaultTerrainAndLayerSettings();
DimensionPropertiesDialog dialog = new DimensionPropertiesDialog(this, defaultSettings, colourScheme, true);
dialog.setVisible(true);
TileFactory tileFactory = defaultSettings.getTileFactory();
if ((tileFactory instanceof HeightMapTileFactory)
&& (((HeightMapTileFactory) tileFactory).getTheme() instanceof SimpleTheme)) {
HeightMapTileFactory heightMapTileFactory = (HeightMapTileFactory) tileFactory;
SimpleTheme theme = (SimpleTheme) ((HeightMapTileFactory) tileFactory).getTheme();
checkBoxBeaches.setSelected(theme.isBeaches());
int waterLevel = heightMapTileFactory.getWaterHeight();
spinnerWaterLevel.setValue(waterLevel);
defaultSettings.setBorderLevel(heightMapTileFactory.getWaterHeight());
SortedMap<Integer, Terrain> terrainRanges = theme.getTerrainRanges();
comboBoxSurfaceMaterial.setSelectedItem(terrainRanges.get(terrainRanges.headMap(waterLevel + 3).lastKey()));
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jRadioButton3 = new javax.swing.JRadioButton();
buttonGroup2 = new javax.swing.ButtonGroup();
buttonGroup3 = new javax.swing.ButtonGroup();
jTabbedPane1 = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
checkBoxPing = new javax.swing.JCheckBox();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
checkBoxCheckForUpdates = new javax.swing.JCheckBox();
jLabel6 = new javax.swing.JLabel();
jSeparator2 = new javax.swing.JSeparator();
checkBoxGrid = new javax.swing.JCheckBox();
jLabel7 = new javax.swing.JLabel();
spinnerGrid = new javax.swing.JSpinner();
jLabel8 = new javax.swing.JLabel();
checkBoxContours = new javax.swing.JCheckBox();
spinnerContours = new javax.swing.JSpinner();
checkBoxViewDistance = new javax.swing.JCheckBox();
checkBoxWalkingDistance = new javax.swing.JCheckBox();
jLabel9 = new javax.swing.JLabel();
jSeparator3 = new javax.swing.JSeparator();
jLabel10 = new javax.swing.JLabel();
spinnerWidth = new javax.swing.JSpinner();
jLabel11 = new javax.swing.JLabel();
spinnerHeight = new javax.swing.JSpinner();
jLabel12 = new javax.swing.JLabel();
comboBoxHeight = new javax.swing.JComboBox();
jLabel13 = new javax.swing.JLabel();
radioButtonHilly = new javax.swing.JRadioButton();
radioButtonFlat = new javax.swing.JRadioButton();
jLabel14 = new javax.swing.JLabel();
spinnerGroundLevel = new javax.swing.JSpinner();
jLabel15 = new javax.swing.JLabel();
spinnerWaterLevel = new javax.swing.JSpinner();
checkBoxLava = new javax.swing.JCheckBox();
checkBoxBeaches = new javax.swing.JCheckBox();
jLabel16 = new javax.swing.JLabel();
comboBoxSurfaceMaterial = new javax.swing.JComboBox();
labelTerrainAndLayerSettings = new javax.swing.JLabel();
jLabel19 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
buttonReset = new javax.swing.JButton();
jSeparator4 = new javax.swing.JSeparator();
jLabel20 = new javax.swing.JLabel();
spinnerWorldBackups = new javax.swing.JSpinner();
jLabel21 = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
comboBoxLightDirection = new javax.swing.JComboBox();
jLabel23 = new javax.swing.JLabel();
spinnerRange = new javax.swing.JSpinner();
jLabel24 = new javax.swing.JLabel();
spinnerScale = new javax.swing.JSpinner();
jLabel25 = new javax.swing.JLabel();
jLabel26 = new javax.swing.JLabel();
spinnerBrushSize = new javax.swing.JSpinner();
jLabel27 = new javax.swing.JLabel();
checkBoxCircular = new javax.swing.JCheckBox();
checkBoxExtendedBlockIds = new javax.swing.JCheckBox();
jLabel17 = new javax.swing.JLabel();
jSeparator5 = new javax.swing.JSeparator();
checkBoxChestOfGoodies = new javax.swing.JCheckBox();
jLabel28 = new javax.swing.JLabel();
comboBoxWorldType = new javax.swing.JComboBox();
buttonModePreset = new javax.swing.JButton();
checkBoxStructures = new javax.swing.JCheckBox();
jLabel29 = new javax.swing.JLabel();
comboBoxMode = new javax.swing.JComboBox();
checkBoxCheats = new javax.swing.JCheckBox();
jLabel30 = new javax.swing.JLabel();
comboBoxLookAndFeel = new javax.swing.JComboBox();
jLabel32 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
checkBoxUndo = new javax.swing.JCheckBox();
jLabel5 = new javax.swing.JLabel();
spinnerUndoLevels = new javax.swing.JSpinner();
jPanel3 = new javax.swing.JPanel();
jLabel31 = new javax.swing.JLabel();
radioButtonAccelDefault = new javax.swing.JRadioButton();
radioButtonAccelDirect3D = new javax.swing.JRadioButton();
radioButtonAccelOpenGL = new javax.swing.JRadioButton();
radioButtonAccelQuartz = new javax.swing.JRadioButton();
radioButtonAccelXRender = new javax.swing.JRadioButton();
radioButtonAccelUnaccelerated = new javax.swing.JRadioButton();
jLabel33 = new javax.swing.JLabel();
jLabel34 = new javax.swing.JLabel();
jLabel36 = new javax.swing.JLabel();
jLabel37 = new javax.swing.JLabel();
jLabel38 = new javax.swing.JLabel();
jLabel39 = new javax.swing.JLabel();
jLabel35 = new javax.swing.JLabel();
jPanel4 = new javax.swing.JPanel();
jLabel40 = new javax.swing.JLabel();
jLabel41 = new javax.swing.JLabel();
radioButtonOverlayScaleOnLoad = new javax.swing.JRadioButton();
radioButtonOverlayOptimiseOnLoad = new javax.swing.JRadioButton();
radioButtonOverlayScaleOnPaint = new javax.swing.JRadioButton();
jLabel42 = new javax.swing.JLabel();
jLabel43 = new javax.swing.JLabel();
jLabel44 = new javax.swing.JLabel();
buttonCancel = new javax.swing.JButton();
buttonOK = new javax.swing.JButton();
jRadioButton3.setText("jRadioButton3");
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Preferences");
jLabel1.setText("Configure your preferences and default settings on this screen:");
jLabel2.setFont(jLabel2.getFont().deriveFont((jLabel2.getFont().getStyle() | java.awt.Font.ITALIC)));
jLabel2.setText("General ");
checkBoxPing.setSelected(true);
checkBoxPing.setText("Send usage information to the developer");
checkBoxPing.addActionListener(this::checkBoxPingActionPerformed);
jLabel3.setFont(jLabel3.getFont().deriveFont((jLabel3.getFont().getStyle() | java.awt.Font.ITALIC)));
jLabel3.setText("Note that the information does not include personally identifiable ");
jLabel4.setFont(jLabel4.getFont().deriveFont((jLabel4.getFont().getStyle() | java.awt.Font.ITALIC)));
jLabel4.setText("information, and will never be sold or given to third parties. ");
checkBoxCheckForUpdates.setSelected(true);
checkBoxCheckForUpdates.setText("Check for updates on startup");
jLabel6.setFont(jLabel6.getFont().deriveFont((jLabel6.getFont().getStyle() | java.awt.Font.ITALIC)));
jLabel6.setText("Default view settings ");
checkBoxGrid.setText("Grid enabled");
jLabel7.setLabelFor(spinnerGrid);
jLabel7.setText("Grid size:");
spinnerGrid.setModel(new javax.swing.SpinnerNumberModel(128, 2, 999, 1));
jLabel8.setText("Separation:");
checkBoxContours.setSelected(true);
checkBoxContours.setText("Contour lines enabled");
spinnerContours.setModel(new javax.swing.SpinnerNumberModel(10, 2, 999, 1));
checkBoxViewDistance.setText("View distance enabled");
checkBoxWalkingDistance.setText("Walking distance enabled");
jLabel9.setFont(jLabel9.getFont().deriveFont((jLabel9.getFont().getStyle() | java.awt.Font.ITALIC)));
jLabel9.setText("Default world settings ");
jLabel10.setLabelFor(spinnerWidth);
jLabel10.setText("Dimensions:");
spinnerWidth.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(640), Integer.valueOf(128), null, Integer.valueOf(128)));
spinnerWidth.addChangeListener(this::spinnerWidthStateChanged);
jLabel11.setText("x");
spinnerHeight.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(640), Integer.valueOf(128), null, Integer.valueOf(128)));
spinnerHeight.addChangeListener(this::spinnerHeightStateChanged);
jLabel12.setLabelFor(comboBoxHeight);
jLabel12.setText("Height:");
comboBoxHeight.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "32", "64", "128", "256", "512", "1024", "2048" }));
comboBoxHeight.setSelectedIndex(3);
comboBoxHeight.addActionListener(this::comboBoxHeightActionPerformed);
jLabel13.setText("Topography:");
buttonGroup1.add(radioButtonHilly);
radioButtonHilly.setSelected(true);
radioButtonHilly.setText("Hilly");
radioButtonHilly.addActionListener(this::radioButtonHillyActionPerformed);
buttonGroup1.add(radioButtonFlat);
radioButtonFlat.setText("Flat");
radioButtonFlat.addActionListener(this::radioButtonFlatActionPerformed);
jLabel14.setLabelFor(spinnerGroundLevel);
jLabel14.setText("Level:");
spinnerGroundLevel.setModel(new javax.swing.SpinnerNumberModel(58, 1, 255, 1));
jLabel15.setText("Water level:");
spinnerWaterLevel.setModel(new javax.swing.SpinnerNumberModel(62, 0, 255, 1));
spinnerWaterLevel.addChangeListener(this::spinnerWaterLevelStateChanged);
checkBoxLava.setText("Lava instead of water");
checkBoxBeaches.setSelected(true);
checkBoxBeaches.setText("Beaches");
checkBoxBeaches.addActionListener(this::checkBoxBeachesActionPerformed);
jLabel16.setText("Surface material:");
comboBoxSurfaceMaterial.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
comboBoxSurfaceMaterial.addActionListener(this::comboBoxSurfaceMaterialActionPerformed);
labelTerrainAndLayerSettings.setForeground(java.awt.Color.blue);
labelTerrainAndLayerSettings.setText("<html><u>Configure default border, terrain and layer settings</u></html>");
labelTerrainAndLayerSettings.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
labelTerrainAndLayerSettings.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
labelTerrainAndLayerSettingsMouseClicked(evt);
}
});
jLabel19.setText("blocks");
jLabel18.setFont(jLabel18.getFont().deriveFont((jLabel18.getFont().getStyle() | java.awt.Font.ITALIC)));
jLabel18.setText("(Note that changes to these settings will only take effect for the next world you load or create.) ");
buttonReset.setText("Reset...");
buttonReset.addActionListener(this::buttonResetActionPerformed);
jSeparator4.setOrientation(javax.swing.SwingConstants.VERTICAL);
jLabel20.setText("No. of backups of .world files to keep:");
spinnerWorldBackups.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(3), Integer.valueOf(0), null, Integer.valueOf(1)));
jLabel21.setText(" ");
jLabel22.setText("Light direction:");
comboBoxLightDirection.setModel(new DefaultComboBoxModel(LightOrigin.values()));
jLabel23.setText("(height:");
spinnerRange.setModel(new javax.swing.SpinnerNumberModel(20, 1, 255, 1));
jLabel24.setText("scale:");
spinnerScale.setModel(new javax.swing.SpinnerNumberModel(100, 1, 999, 1));
jLabel25.setText("%)");
jLabel26.setText("Maximum brush size:");
spinnerBrushSize.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(300), Integer.valueOf(100), null, Integer.valueOf(10)));
jLabel27.setFont(jLabel27.getFont().deriveFont((jLabel27.getFont().getStyle() | java.awt.Font.ITALIC)));
jLabel27.setText("Warning: large brush sizes could slow your computer to a crawl! ");
checkBoxCircular.setText("Circular world");
checkBoxCircular.addActionListener(this::checkBoxCircularActionPerformed);
checkBoxExtendedBlockIds.setText("Extended block ID's");
jLabel17.setFont(jLabel17.getFont().deriveFont((jLabel17.getFont().getStyle() | java.awt.Font.ITALIC)));
jLabel17.setText("Default export settings");
checkBoxChestOfGoodies.setText("Include chest of goodies");
jLabel28.setText("World type:");
comboBoxWorldType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Default", "Superflat", "Large Biomes" }));
comboBoxWorldType.addActionListener(this::comboBoxWorldTypeActionPerformed);
buttonModePreset.setText("...");
buttonModePreset.addActionListener(this::buttonModePresetActionPerformed);
checkBoxStructures.setText("Structures");
jLabel29.setText("Mode:");
comboBoxMode.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Survival", "Creative", "Adventure" }));
comboBoxMode.addActionListener(this::comboBoxModeActionPerformed);
checkBoxCheats.setText("Allow Cheats");
jLabel30.setText("Visual theme:");
comboBoxLookAndFeel.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "System", "Metal", "Nimbus", "Dark Metal", "Dark Nimbus" }));
jLabel32.setText("<html><em>Effective after restart </em></html>");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel18))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator3)
.addComponent(jSeparator2)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(labelTerrainAndLayerSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonReset))
.addComponent(jSeparator1)
.addComponent(jSeparator5)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(checkBoxChestOfGoodies)
.addGap(18, 18, 18)
.addComponent(jLabel28)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboBoxWorldType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonModePreset)
.addGap(18, 18, 18)
.addComponent(checkBoxStructures)
.addGap(18, 18, 18)
.addComponent(jLabel29)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboBoxMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(checkBoxCheats))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerWidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jLabel19)
.addGap(18, 18, 18)
.addComponent(jLabel12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboBoxHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel13)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButtonHilly)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel23)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerRange, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel24)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(jLabel25)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(radioButtonFlat))
.addComponent(jLabel6)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerGrid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(checkBoxGrid))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(checkBoxContours)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerContours, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(checkBoxWalkingDistance)
.addComponent(checkBoxViewDistance))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel26)
.addGap(6, 6, 6)
.addComponent(spinnerBrushSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel21))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel22)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboBoxLightDirection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel27)))
.addComponent(jLabel9)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(checkBoxCircular)
.addGap(18, 18, 18)
.addComponent(jLabel14)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerGroundLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel15)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerWaterLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(checkBoxLava)
.addGap(18, 18, 18)
.addComponent(checkBoxBeaches))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel16)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboBoxSurfaceMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(checkBoxExtendedBlockIds))
.addComponent(jLabel2)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(checkBoxPing)
.addComponent(checkBoxCheckForUpdates)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(12, 12, 12)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jLabel3))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel20)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerWorldBackups, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel30)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(comboBoxLookAndFeel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addComponent(jLabel17))
.addContainerGap())))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel18)
.addGap(18, 18, 18)
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(checkBoxGrid)
.addComponent(checkBoxContours)
.addComponent(checkBoxViewDistance)
.addComponent(jLabel22)
.addComponent(comboBoxLightDirection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(spinnerGrid, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8)
.addComponent(spinnerContours, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(checkBoxWalkingDistance)
.addComponent(jLabel21)
.addComponent(jLabel26)
.addComponent(spinnerBrushSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel27)
.addGap(18, 18, 18)
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(spinnerWidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11)
.addComponent(spinnerHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel12)
.addComponent(comboBoxHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel13)
.addComponent(radioButtonHilly)
.addComponent(radioButtonFlat)
.addComponent(jLabel19)
.addComponent(jLabel23)
.addComponent(spinnerRange, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel24)
.addComponent(spinnerScale, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel25))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel14)
.addComponent(spinnerGroundLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel15)
.addComponent(spinnerWaterLevel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(checkBoxLava)
.addComponent(checkBoxBeaches)
.addComponent(checkBoxCircular))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel16)
.addComponent(comboBoxSurfaceMaterial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(checkBoxExtendedBlockIds))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(labelTerrainAndLayerSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonReset))
.addGap(18, 18, 18)
.addComponent(jLabel17)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(checkBoxChestOfGoodies)
.addComponent(jLabel28)
.addComponent(comboBoxWorldType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(buttonModePreset)
.addComponent(checkBoxStructures)
.addComponent(jLabel29)
.addComponent(comboBoxMode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(checkBoxCheats))
.addGap(18, 18, 18)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(checkBoxPing)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel4)
.addGap(18, 18, 18)
.addComponent(checkBoxCheckForUpdates))
.addComponent(jSeparator4))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel20)
.addComponent(spinnerWorldBackups, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel30)
.addComponent(comboBoxLookAndFeel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel32, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jTabbedPane1.addTab("General", jPanel1);
checkBoxUndo.setSelected(true);
checkBoxUndo.setText("Enable undo");
checkBoxUndo.addActionListener(this::checkBoxUndoActionPerformed);
jLabel5.setLabelFor(spinnerUndoLevels);
jLabel5.setText("Undo levels:");
spinnerUndoLevels.setModel(new javax.swing.SpinnerNumberModel(25, 1, 999, 1));
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Hardware Acceleration"));
jLabel31.setText("Select a method of hardware accelerated painting. Experiment with this to improve the general editor performance:");
buttonGroup2.add(radioButtonAccelDefault);
radioButtonAccelDefault.setText("Default");
buttonGroup2.add(radioButtonAccelDirect3D);
radioButtonAccelDirect3D.setText("Direct3D");
buttonGroup2.add(radioButtonAccelOpenGL);
radioButtonAccelOpenGL.setText("OpenGL");
buttonGroup2.add(radioButtonAccelQuartz);
radioButtonAccelQuartz.setText("Quartz");
buttonGroup2.add(radioButtonAccelXRender);
radioButtonAccelXRender.setText("XRender");
buttonGroup2.add(radioButtonAccelUnaccelerated);
radioButtonAccelUnaccelerated.setText("Unaccelerated");
jLabel33.setText("Disable all hardware acceleration");
jLabel34.setText("Uses the XRender X11 extension on Linux");
jLabel36.setText("<html><em>Effective after restart </em></html>");
jLabel37.setText("Uses the OpenGL rendering system ");
jLabel38.setText("Uses the Direct3D rendering system on Windows");
jLabel39.setText("Uses Java's default rendering settings");
jLabel35.setText("Uses Apple's Quartz rendering system on Mac OS X");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel31)
.addComponent(jLabel36, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(radioButtonAccelUnaccelerated)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel34)
.addComponent(jLabel33)
.addComponent(jLabel35)
.addComponent(jLabel37)
.addComponent(jLabel38)
.addComponent(jLabel39)))
.addComponent(radioButtonAccelDirect3D)
.addComponent(radioButtonAccelDefault)
.addComponent(radioButtonAccelXRender)
.addComponent(radioButtonAccelQuartz)
.addComponent(radioButtonAccelOpenGL))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel31)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel36, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(radioButtonAccelDefault)
.addComponent(jLabel39))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(radioButtonAccelDirect3D)
.addComponent(jLabel38))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(radioButtonAccelOpenGL)
.addComponent(jLabel37))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(radioButtonAccelQuartz)
.addComponent(jLabel35))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(radioButtonAccelXRender)
.addComponent(jLabel34))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(radioButtonAccelUnaccelerated)
.addComponent(jLabel33))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Overlay Scaling and Painting"));
jLabel40.setText("Select a method of overlay image scaling and painting. Experiment with this to improve overlay image performance:");
jLabel41.setText("<html><em>Effective after reload </em></html>");
buttonGroup3.add(radioButtonOverlayScaleOnLoad);
radioButtonOverlayScaleOnLoad.setText("Scale on load");
buttonGroup3.add(radioButtonOverlayOptimiseOnLoad);
radioButtonOverlayOptimiseOnLoad.setText("Optimise on load, scale on paint");
buttonGroup3.add(radioButtonOverlayScaleOnPaint);
radioButtonOverlayScaleOnPaint.setText("Scale on paint");
jLabel42.setText("Optimises the image when it is first loaded, but scales it when painting. Uses less memory.");
jLabel43.setText("Scales and optimises the image in memory when it is first loaded. Uses a lot of memory.");
jLabel44.setText("Does not optimise the image at all and scales it when painting. Uses least memory.");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel40)
.addComponent(jLabel41, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(radioButtonOverlayOptimiseOnLoad)
.addComponent(radioButtonOverlayScaleOnLoad)
.addComponent(radioButtonOverlayScaleOnPaint))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel44)
.addComponent(jLabel43)
.addComponent(jLabel42))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel40)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel41, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(radioButtonOverlayScaleOnLoad)
.addComponent(jLabel43))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(radioButtonOverlayOptimiseOnLoad)
.addComponent(jLabel42))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(radioButtonOverlayScaleOnPaint)
.addComponent(jLabel44))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(checkBoxUndo)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerUndoLevels, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(checkBoxUndo)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(spinnerUndoLevels, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jTabbedPane1.addTab("Performance", jPanel2);
buttonCancel.setText("Cancel");
buttonCancel.addActionListener(this::buttonCancelActionPerformed);
buttonOK.setText("OK");
buttonOK.addActionListener(this::buttonOKActionPerformed);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTabbedPane1)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(buttonOK)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(buttonCancel)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTabbedPane1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonCancel)
.addComponent(buttonOK))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void buttonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonCancelActionPerformed
cancel();
}//GEN-LAST:event_buttonCancelActionPerformed
private void buttonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOKActionPerformed
ok();
}//GEN-LAST:event_buttonOKActionPerformed
private void checkBoxUndoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxUndoActionPerformed
setControlStates();
}//GEN-LAST:event_checkBoxUndoActionPerformed
private void labelTerrainAndLayerSettingsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelTerrainAndLayerSettingsMouseClicked
editTerrainAndLayerSettings();
}//GEN-LAST:event_labelTerrainAndLayerSettingsMouseClicked
private void checkBoxPingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxPingActionPerformed
pingNotSet = false;
}//GEN-LAST:event_checkBoxPingActionPerformed
private void comboBoxHeightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBoxHeightActionPerformed
int maxHeight = Integer.parseInt((String) comboBoxHeight.getSelectedItem());
int exp = (int) (Math.log(maxHeight) / Math.log(2));
if (exp != previousExp) {
previousExp = exp;
int terrainLevel = (Integer) spinnerGroundLevel.getValue();
int waterLevel = (Integer) spinnerWaterLevel.getValue();
if (terrainLevel >= maxHeight) {
spinnerGroundLevel.setValue(maxHeight - 1);
}
if (waterLevel >= maxHeight) {
spinnerWaterLevel.setValue(maxHeight - 1);
}
((SpinnerNumberModel) spinnerGroundLevel.getModel()).setMaximum(maxHeight - 1);
((SpinnerNumberModel) spinnerWaterLevel.getModel()).setMaximum(maxHeight - 1);
int range = (Integer) spinnerRange.getValue();
if (range >= maxHeight) {
spinnerRange.setValue(maxHeight - 1);
}
((SpinnerNumberModel) spinnerRange.getModel()).setMaximum(maxHeight - 1);
setControlStates();
}
}//GEN-LAST:event_comboBoxHeightActionPerformed
private void spinnerWaterLevelStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerWaterLevelStateChanged
int waterLevel = ((Number) spinnerWaterLevel.getValue()).intValue();
Dimension defaults = Configuration.getInstance().getDefaultTerrainAndLayerSettings();
defaults.setBorderLevel(waterLevel);
TileFactory tileFactory = defaults.getTileFactory();
if (tileFactory instanceof HeightMapTileFactory) {
((HeightMapTileFactory) tileFactory).setWaterHeight(waterLevel);
}
}//GEN-LAST:event_spinnerWaterLevelStateChanged
private void checkBoxBeachesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxBeachesActionPerformed
TileFactory tileFactory = Configuration.getInstance().getDefaultTerrainAndLayerSettings().getTileFactory();
if (tileFactory instanceof HeightMapTileFactory) {
((HeightMapTileFactory) tileFactory).setBeaches(checkBoxBeaches.isSelected());
}
}//GEN-LAST:event_checkBoxBeachesActionPerformed
private void comboBoxSurfaceMaterialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBoxSurfaceMaterialActionPerformed
// Update the terrain ranges map to conform to the surface material
// setting
Configuration config = Configuration.getInstance();
Dimension defaultSettings = config.getDefaultTerrainAndLayerSettings();
TileFactory tileFactory = defaultSettings.getTileFactory();
if ((tileFactory instanceof HeightMapTileFactory)
&& (((HeightMapTileFactory) tileFactory).getTheme() instanceof SimpleTheme)) {
SortedMap<Integer, Terrain> defaultTerrainRanges = ((SimpleTheme) ((HeightMapTileFactory) tileFactory).getTheme()).getTerrainRanges();
// Find what is probably meant to be the surface material. With the
// default settings this should be -1, but if someone configured a
// default underwater material, try not to change that
int waterLevel = (Integer) spinnerWaterLevel.getValue();
int surfaceLevel = defaultTerrainRanges.headMap(waterLevel + 3).lastKey();
defaultTerrainRanges.put(surfaceLevel, (Terrain) comboBoxSurfaceMaterial.getSelectedItem());
}
}//GEN-LAST:event_comboBoxSurfaceMaterialActionPerformed
private void buttonResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonResetActionPerformed
if (JOptionPane.showConfirmDialog(this, "Are you sure you want to reset all default world settings,\nincluding the border, terrain and layer settings, to the defaults?", "Confirm Reset", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
spinnerWidth.setValue(640);
spinnerHeight.setValue(640);
comboBoxHeight.setSelectedIndex(3);
radioButtonHilly.setSelected(true);
spinnerGroundLevel.setValue(58);
spinnerWaterLevel.setValue(62);
checkBoxLava.setSelected(false);
checkBoxBeaches.setSelected(true);
comboBoxSurfaceMaterial.setSelectedItem(GRASS);
Configuration.getInstance().setDefaultTerrainAndLayerSettings(new Dimension(World2.DEFAULT_OCEAN_SEED, TileFactoryFactory.createNoiseTileFactory(new Random().nextLong(), GRASS, DEFAULT_MAX_HEIGHT_2, 58, 62, false, true, 20, 1.0), DIM_NORMAL, DEFAULT_MAX_HEIGHT_2));
}
}//GEN-LAST:event_buttonResetActionPerformed
private void spinnerWidthStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerWidthStateChanged
int value = (Integer) spinnerWidth.getValue();
value = Math.round(value / 128f) * 128;
if (value < 128) {
value = 128;
}
spinnerWidth.setValue(value);
}//GEN-LAST:event_spinnerWidthStateChanged
private void spinnerHeightStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_spinnerHeightStateChanged
int value = (Integer) spinnerHeight.getValue();
value = Math.round(value / 128f) * 128;
if (value < 128) {
value = 128;
}
spinnerHeight.setValue(value);
}//GEN-LAST:event_spinnerHeightStateChanged
private void radioButtonHillyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioButtonHillyActionPerformed
setControlStates();
}//GEN-LAST:event_radioButtonHillyActionPerformed
private void radioButtonFlatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_radioButtonFlatActionPerformed
setControlStates();
}//GEN-LAST:event_radioButtonFlatActionPerformed
private void checkBoxCircularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBoxCircularActionPerformed
setControlStates();
}//GEN-LAST:event_checkBoxCircularActionPerformed
private void buttonModePresetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonModePresetActionPerformed
String editedGeneratorOptions = JOptionPane.showInputDialog(this, "Edit the Superflat mode preset:", generatorOptions);
if (editedGeneratorOptions != null) {
generatorOptions = editedGeneratorOptions;
}
}//GEN-LAST:event_buttonModePresetActionPerformed
private void comboBoxWorldTypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBoxWorldTypeActionPerformed
setControlStates();
}//GEN-LAST:event_comboBoxWorldTypeActionPerformed
private void comboBoxModeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBoxModeActionPerformed
if (comboBoxMode.getSelectedIndex() > 0) {
checkBoxCheats.setSelected(true);
}
}//GEN-LAST:event_comboBoxModeActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton buttonCancel;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.ButtonGroup buttonGroup2;
private javax.swing.ButtonGroup buttonGroup3;
private javax.swing.JButton buttonModePreset;
private javax.swing.JButton buttonOK;
private javax.swing.JButton buttonReset;
private javax.swing.JCheckBox checkBoxBeaches;
private javax.swing.JCheckBox checkBoxCheats;
private javax.swing.JCheckBox checkBoxCheckForUpdates;
private javax.swing.JCheckBox checkBoxChestOfGoodies;
private javax.swing.JCheckBox checkBoxCircular;
private javax.swing.JCheckBox checkBoxContours;
private javax.swing.JCheckBox checkBoxExtendedBlockIds;
private javax.swing.JCheckBox checkBoxGrid;
private javax.swing.JCheckBox checkBoxLava;
private javax.swing.JCheckBox checkBoxPing;
private javax.swing.JCheckBox checkBoxStructures;
private javax.swing.JCheckBox checkBoxUndo;
private javax.swing.JCheckBox checkBoxViewDistance;
private javax.swing.JCheckBox checkBoxWalkingDistance;
private javax.swing.JComboBox comboBoxHeight;
private javax.swing.JComboBox comboBoxLightDirection;
private javax.swing.JComboBox comboBoxLookAndFeel;
private javax.swing.JComboBox comboBoxMode;
private javax.swing.JComboBox comboBoxSurfaceMaterial;
private javax.swing.JComboBox comboBoxWorldType;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel23;
private javax.swing.JLabel jLabel24;
private javax.swing.JLabel jLabel25;
private javax.swing.JLabel jLabel26;
private javax.swing.JLabel jLabel27;
private javax.swing.JLabel jLabel28;
private javax.swing.JLabel jLabel29;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel30;
private javax.swing.JLabel jLabel31;
private javax.swing.JLabel jLabel32;
private javax.swing.JLabel jLabel33;
private javax.swing.JLabel jLabel34;
private javax.swing.JLabel jLabel35;
private javax.swing.JLabel jLabel36;
private javax.swing.JLabel jLabel37;
private javax.swing.JLabel jLabel38;
private javax.swing.JLabel jLabel39;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel40;
private javax.swing.JLabel jLabel41;
private javax.swing.JLabel jLabel42;
private javax.swing.JLabel jLabel43;
private javax.swing.JLabel jLabel44;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JRadioButton jRadioButton3;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
private javax.swing.JSeparator jSeparator3;
private javax.swing.JSeparator jSeparator4;
private javax.swing.JSeparator jSeparator5;
private javax.swing.JTabbedPane jTabbedPane1;
private javax.swing.JLabel labelTerrainAndLayerSettings;
private javax.swing.JRadioButton radioButtonAccelDefault;
private javax.swing.JRadioButton radioButtonAccelDirect3D;
private javax.swing.JRadioButton radioButtonAccelOpenGL;
private javax.swing.JRadioButton radioButtonAccelQuartz;
private javax.swing.JRadioButton radioButtonAccelUnaccelerated;
private javax.swing.JRadioButton radioButtonAccelXRender;
private javax.swing.JRadioButton radioButtonFlat;
private javax.swing.JRadioButton radioButtonHilly;
private javax.swing.JRadioButton radioButtonOverlayOptimiseOnLoad;
private javax.swing.JRadioButton radioButtonOverlayScaleOnLoad;
private javax.swing.JRadioButton radioButtonOverlayScaleOnPaint;
private javax.swing.JSpinner spinnerBrushSize;
private javax.swing.JSpinner spinnerContours;
private javax.swing.JSpinner spinnerGrid;
private javax.swing.JSpinner spinnerGroundLevel;
private javax.swing.JSpinner spinnerHeight;
private javax.swing.JSpinner spinnerRange;
private javax.swing.JSpinner spinnerScale;
private javax.swing.JSpinner spinnerUndoLevels;
private javax.swing.JSpinner spinnerWaterLevel;
private javax.swing.JSpinner spinnerWidth;
private javax.swing.JSpinner spinnerWorldBackups;
// End of variables declaration//GEN-END:variables
private final ColourScheme colourScheme;
private boolean pingNotSet, cancelled = true;
private int previousExp;
private String generatorOptions;
private static final long serialVersionUID = 1L;
} | gpl-3.0 |
tcstewar/nengo_learning_examples | rl/find_best.py | 1066 | import nengo
import numpy as np
model = nengo.Network()
model.config[nengo.Ensemble].neuron_type=nengo.Direct()
with model:
x = nengo.Ensemble(100, 1, neuron_type=nengo.LIF())
y = nengo.Ensemble(100, 1, neuron_type=nengo.LIF())
nengo.Connection(x, y,
function=lambda x: 1-4*(x-0.5)**2)
scale_y = 20
dy = nengo.Ensemble(100, 1)
nengo.Connection(y, dy, synapse=0.001, transform=scale_y)
nengo.Connection(y, dy, synapse=0.02, transform=-scale_y)
scale_x = 5
dx = nengo.Ensemble(100, 1)
nengo.Connection(x, dx, synapse=0.01, transform=scale_x)
nengo.Connection(x, dx, synapse=0.02, transform=-scale_x)
prod = nengo.networks.Product(100, 1)
nengo.Connection(dx, prod.A)
nengo.Connection(dy, prod.B)
nengo.Connection(prod.output, x, synapse=0.01, transform=0.5)
#for ens in prod.all_ensembles:
# ens.neuron_type = nengo.Direct()
stim_x = nengo.Node(0)
nengo.Connection(stim_x, x)
nengo.Connection(x, x, synapse=0.01)
| gpl-3.0 |
Nessphoro/ParallelPowderToy | generated/ElementClasses.cpp | 6734 | #include "ElementClasses.h"
std::vector<Element> GetElements()
{
std::vector<Element> elements;
elements.push_back(Element_NONE());
elements.push_back(Element_DUST());
elements.push_back(Element_WATR());
elements.push_back(Element_OIL());
elements.push_back(Element_FIRE());
elements.push_back(Element_STNE());
elements.push_back(Element_LAVA());
elements.push_back(Element_GUNP());
elements.push_back(Element_NITR());
elements.push_back(Element_CLNE());
elements.push_back(Element_GAS());
elements.push_back(Element_PLEX());
elements.push_back(Element_GOO());
elements.push_back(Element_ICEI());
elements.push_back(Element_METL());
elements.push_back(Element_SPRK());
elements.push_back(Element_SNOW());
elements.push_back(Element_WOOD());
elements.push_back(Element_NEUT());
elements.push_back(Element_PLUT());
elements.push_back(Element_PLNT());
elements.push_back(Element_ACID());
elements.push_back(Element_VOID());
elements.push_back(Element_WTRV());
elements.push_back(Element_CNCT());
elements.push_back(Element_DSTW());
elements.push_back(Element_SALT());
elements.push_back(Element_SLTW());
elements.push_back(Element_DMND());
elements.push_back(Element_BMTL());
elements.push_back(Element_BRMT());
elements.push_back(Element_PHOT());
elements.push_back(Element_URAN());
elements.push_back(Element_WAX());
elements.push_back(Element_MWAX());
elements.push_back(Element_PSCN());
elements.push_back(Element_NSCN());
elements.push_back(Element_LNTG());
elements.push_back(Element_INSL());
elements.push_back(Element_BHOL());
elements.push_back(Element_WHOL());
elements.push_back(Element_RBDM());
elements.push_back(Element_LRBD());
elements.push_back(Element_NTCT());
elements.push_back(Element_SAND());
elements.push_back(Element_GLAS());
elements.push_back(Element_PTCT());
elements.push_back(Element_BGLA());
elements.push_back(Element_THDR());
elements.push_back(Element_PLSM());
elements.push_back(Element_ETRD());
elements.push_back(Element_NICE());
elements.push_back(Element_NBLE());
elements.push_back(Element_BTRY());
elements.push_back(Element_LCRY());
elements.push_back(Element_STKM());
elements.push_back(Element_SWCH());
elements.push_back(Element_SMKE());
elements.push_back(Element_DESL());
elements.push_back(Element_COAL());
elements.push_back(Element_LO2());
elements.push_back(Element_O2());
elements.push_back(Element_INWR());
elements.push_back(Element_YEST());
elements.push_back(Element_DYST());
elements.push_back(Element_THRM());
elements.push_back(Element_GLOW());
elements.push_back(Element_BRCK());
elements.push_back(Element_CFLM());
elements.push_back(Element_FIRW());
elements.push_back(Element_FUSE());
elements.push_back(Element_FSEP());
elements.push_back(Element_AMTR());
elements.push_back(Element_BCOL());
elements.push_back(Element_PCLN());
elements.push_back(Element_HSWC());
elements.push_back(Element_IRON());
elements.push_back(Element_MORT());
elements.push_back(Element_LIFE());
elements.push_back(Element_DLAY());
elements.push_back(Element_CO2());
elements.push_back(Element_DRIC());
elements.push_back(Element_CBNW());
elements.push_back(Element_STOR());
elements.push_back(Element_PVOD());
elements.push_back(Element_CONV());
elements.push_back(Element_CAUS());
elements.push_back(Element_LIGH());
elements.push_back(Element_TESC());
elements.push_back(Element_DEST());
elements.push_back(Element_SPNG());
elements.push_back(Element_RIME());
elements.push_back(Element_FOG());
elements.push_back(Element_BCLN());
elements.push_back(Element_LOVE());
elements.push_back(Element_DEUT());
elements.push_back(Element_WARP());
elements.push_back(Element_PUMP());
elements.push_back(Element_FWRK());
elements.push_back(Element_PIPE());
elements.push_back(Element_FRZZ());
elements.push_back(Element_FRZW());
elements.push_back(Element_GRAV());
elements.push_back(Element_BIZR());
elements.push_back(Element_BIZRG());
elements.push_back(Element_BIZRS());
elements.push_back(Element_INST());
elements.push_back(Element_ISOZ());
elements.push_back(Element_ISZS());
elements.push_back(Element_PRTI());
elements.push_back(Element_PRTO());
elements.push_back(Element_PSTE());
elements.push_back(Element_PSTS());
elements.push_back(Element_ANAR());
elements.push_back(Element_VINE());
elements.push_back(Element_INVIS());
elements.push_back(Element_116());
elements.push_back(Element_SPAWN2());
elements.push_back(Element_SPAWN());
elements.push_back(Element_SHLD1());
elements.push_back(Element_SHLD2());
elements.push_back(Element_SHLD3());
elements.push_back(Element_SHLD4());
elements.push_back(Element_LOLZ());
elements.push_back(Element_WIFI());
elements.push_back(Element_FILT());
elements.push_back(Element_ARAY());
elements.push_back(Element_BRAY());
elements.push_back(Element_STKM2());
elements.push_back(Element_BOMB());
elements.push_back(Element_C5());
elements.push_back(Element_SING());
elements.push_back(Element_QRTZ());
elements.push_back(Element_PQRT());
elements.push_back(Element_EMP());
elements.push_back(Element_BREC());
elements.push_back(Element_ELEC());
elements.push_back(Element_ACEL());
elements.push_back(Element_DCEL());
elements.push_back(Element_BANG());
elements.push_back(Element_IGNT());
elements.push_back(Element_BOYL());
elements.push_back(Element_GEL());
elements.push_back(Element_TRON());
elements.push_back(Element_TTAN());
elements.push_back(Element_EXOT());
elements.push_back(Element_146());
elements.push_back(Element_EMBR());
elements.push_back(Element_H2());
elements.push_back(Element_SOAP());
elements.push_back(Element_NBHL());
elements.push_back(Element_NWHL());
elements.push_back(Element_MERC());
elements.push_back(Element_PBCN());
elements.push_back(Element_GPMP());
elements.push_back(Element_CLST());
elements.push_back(Element_WIRE());
elements.push_back(Element_GBMB());
elements.push_back(Element_FIGH());
elements.push_back(Element_FRAY());
elements.push_back(Element_RPEL());
elements.push_back(Element_PPIP());
elements.push_back(Element_DTEC());
elements.push_back(Element_DMG());
elements.push_back(Element_TSNS());
elements.push_back(Element_VIBR());
elements.push_back(Element_BVBR());
elements.push_back(Element_CRAY());
elements.push_back(Element_PSTN());
elements.push_back(Element_FRME());
elements.push_back(Element_GOLD());
elements.push_back(Element_TUNG());
elements.push_back(Element_PSNS());
elements.push_back(Element_PROT());
elements.push_back(Element_VIRS());
elements.push_back(Element_VRSS());
elements.push_back(Element_VRSG());
elements.push_back(Element_GRVT());
elements.push_back(Element_DRAY());
return elements;
}
| gpl-3.0 |
Shnoulle/LS-AuthWPbyDB | third_party/phpass/test.php | 1994 | <?php
#
# This is a test program for the portable PHP password hashing framework.
#
# Written by Solar Designer and placed in the public domain.
# See PasswordHash.php for more information.
#
require 'PasswordHash.php';
header('Content-type: text/plain');
$ok = 0;
# Try to use stronger but system-specific hashes, with a possible fallback to
# the weaker portable hashes.
$t_hasher = new PasswordHash(8, FALSE);
$correct = 'test';
$hash = $t_hasher->HashPassword($correct);
print 'Hash: ' . $hash . "\n";
$check = $t_hasher->CheckPassword($correct, $hash);
if ($check) $ok++;
print "Check correct: '" . $check . "' (should be '1')\n";
$wrong = 'test12346';
$check = $t_hasher->CheckPassword($wrong, $hash);
if (!$check) $ok++;
print "Check wrong: '" . $check . "' (should be '0' or '')\n";
unset($t_hasher);
# Force the use of weaker portable hashes.
$t_hasher = new PasswordHash(8, TRUE);
$hash = $t_hasher->HashPassword($correct);
print 'Hash: ' . $hash . "\n";
$check = $t_hasher->CheckPassword($correct, $hash);
if ($check) $ok++;
print "Check correct: '" . $check . "' (should be '1')\n";
$check = $t_hasher->CheckPassword($wrong, $hash);
if (!$check) $ok++;
print "Check wrong: '" . $check . "' (should be '0' or '')\n";
# A correct portable hash for 'test12345'.
# Please note the use of single quotes to ensure that the dollar signs will
# be interpreted literally. Of course, a real application making use of the
# framework won't store password hashes within a PHP source file anyway.
# We only do this for testing.
$hash = '$P$Bxe0X/dG3qKryeO78TZxCoVlArO7x21';
print "<hr />";
print 'Hash: ' . $hash . "\n";
$check = $t_hasher->CheckPassword($correct, $hash);
if ($check) $ok++;
print "Check correct: '" . $check . "' (should be '1')\n";
$check = $t_hasher->CheckPassword($wrong, $hash);
if (!$check) $ok++;
print "Check wrong: '" . $check . "' (should be '0' or '')\n";
if ($ok == 6)
print "All tests have PASSED\n";
else
print "Some tests have FAILED\n";
?>
| gpl-3.0 |
EmreTufan/CakePHP | bookmarker/src/Model/Entity/Tag.php | 820 | <?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Tag Entity
*
* @property int $id
* @property string $title
* @property \Cake\I18n\FrozenTime $created
* @property \Cake\I18n\FrozenTime $modified
*
* @property \App\Model\Entity\Bookmark[] $bookmarks
*/
class Tag extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'title' => true,
'created' => true,
'modified' => true,
'bookmarks' => true
];
}
| gpl-3.0 |
McLeodMoores/xl4j | comjvm-win32/local-test/JvmCycleTest.cpp | 3445 | /*
* Copyright 2014-present by McLeod Moores Software Limited.
* See distribution for license.
*/
#include "stdafx.h"
#include "comjvm/local.h"
#include "comjvm/core.h"
#include "local/CScanExecutor.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace localtest {
TEST_CLASS (JvmCycleTest) {
private:
IJvmConnector *m_pConnector;
IJvm *m_pJvm;
public:
void Connect () {
m_pConnector = NULL;
m_pJvm = NULL;
Assert::AreEqual (S_OK, ComJvmCreateLocalConnector (&m_pConnector));
Assert::AreEqual (S_OK, m_pConnector->Lock ());
IJvmTemplate *pTemplate;
Assert::AreEqual (S_OK, ComJvmCreateTemplate (NULL, &pTemplate));
IClasspathEntries *entries;
pTemplate->get_Classpath (&entries);
TCHAR szCurrentDir[MAX_PATH];
GetCurrentDirectory (MAX_PATH, szCurrentDir);
LOGTRACE ("Current dir is %s", szCurrentDir);
AddEntries (entries);
Assert::AreEqual (S_OK, m_pConnector->CreateJvm (pTemplate, NULL, &m_pJvm));
pTemplate->Release ();
Assert::AreEqual (S_OK, m_pConnector->Unlock ());
}
void AddEntries (IClasspathEntries *entries) const {
TCHAR *base = TEXT ("..\\lib\\");
TCHAR szDir[MAX_PATH];
WIN32_FIND_DATA findData;
HANDLE hFind = INVALID_HANDLE_VALUE;
StringCchCopy (szDir, MAX_PATH, base);
StringCchCat (szDir, MAX_PATH, TEXT ("*.jar"));
// Find first file in directory
hFind = FindFirstFile (szDir, &findData);
if (INVALID_HANDLE_VALUE == hFind) {
_com_raise_error (ERROR_FILE_NOT_FOUND);
}
do {
if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
TCHAR szRelativePath[MAX_PATH];
StringCchCopy (szRelativePath, MAX_PATH, base);
StringCchCat (szRelativePath, MAX_PATH, findData.cFileName);
LOGTRACE ("Adding ClasspathEntry for %s", szRelativePath);
IClasspathEntry *pEntry;
HRESULT hr = ComJvmCreateClasspathEntry (szRelativePath, &pEntry);
if (FAILED (hr)) {
_com_raise_error (hr);
}
entries->Add (pEntry);
}
} while (FindNextFile (hFind, &findData) != 0);
}
void Disconnect () const {
if (m_pJvm) m_pJvm->Release ();
if (m_pConnector) m_pConnector->Release ();
}
void BasicScan () const {
IScan *pScan;
Assert::AreEqual (S_OK, m_pJvm->CreateScan (&pScan));
HRESULT hr;
IRecordInfo *pFunctionInfoRecordInfo = NULL;
if (FAILED (hr = ::GetRecordInfoFromGuids (ComJvmCore_LIBID, 1, 0, LOCALE_USER_DEFAULT, FUNCTIONINFO_IID, &pFunctionInfoRecordInfo))) {
_com_error err (hr);
LPCTSTR errMsg = err.ErrorMessage ();
LOGTRACE ("Failed to get RecordInfoFromGuids %s", errMsg);
Assert::Fail ();
}
SAFEARRAY *results;
SAFEARRAYBOUND bounds;
bounds.cElements = 100;
bounds.lLbound = 0;
results = SafeArrayCreateEx (VT_RECORD, 1, &bounds, pFunctionInfoRecordInfo);
hr = pScan->Scan (&results);
FUNCTIONINFO *pFunctionInfos;
long count;
SafeArrayGetUBound (results, 1, &count);
count++;
SafeArrayAccessData (results, reinterpret_cast<PVOID *>(&pFunctionInfos));
for (int i = 0; i < count; i++) {
LOGTRACE ("Record %d has fields\n\texportName=%s\n\t%s\n\t%s\n", i, pFunctionInfos[i].bsFunctionExportName, pFunctionInfos[i].bsFunctionSignature, pFunctionInfos[i].bsDescription);
}
SafeArrayUnaccessData (results);
Assert::AreNotEqual ((long)100, count);
SafeArrayDestroy (results);
pScan->Release ();
}
TEST_METHOD (CycleTest) {
Connect ();
BasicScan ();
Disconnect ();
Connect ();
BasicScan ();
Disconnect ();
}
};
} | gpl-3.0 |
firm1/zest-writer | src/test/java/com/zds/zw/TestMarkdown.java | 524 | package com.zds.zw;
import com.zds.zw.utils.ZMD;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class TestMarkdown {
ZMD zmd;
@Before
public void Setup() {
zmd = new ZMD();
}
@Test
public void test() {
String strBefore = "Bonjour `Set<Class<? extends Object>>`";
String strAfter = "<p>Bonjour <code>Set<Class<? extends Object>></code></p>";
assertEquals(zmd.toHtml(strBefore), strAfter);
}
}
| gpl-3.0 |
lubing521/MonaServer | MonaCore/sources/HTTP/HTTPPacket.cpp | 5712 | /*
Copyright 2014 Mona
mathieu.poux[a]gmail.com
jammetthomas[a]gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License received along this program for more
details (or else see http://www.gnu.org/licenses/).
This file is a part of Mona.
*/
#include "Mona/HTTP/HTTPPacket.h"
#include "Mona/Util.h"
using namespace std;
namespace Mona {
HTTPPacket::HTTPPacket(const string& rootPath) : accessControlRequestMethod(0), accessControlRequestHeaders(NULL),
filePath(rootPath), _data(NULL), _size(0),
content(NULL),
contentLength(0),
contentType(HTTP::CONTENT_ABSENT),
command(HTTP::COMMAND_UNKNOWN),
version(0),
connection(HTTP::CONNECTION_ABSENT),
ifModifiedSince(0) {
}
void HTTPPacket::parseHeader(Exception& ex,const char* key, const char* value) {
if (String::ICompare(key,"content-length")==0) {
contentLength = String::ToNumber(ex,contentLength, value);
} else if (String::ICompare(key,"content-type")==0) {
contentType = HTTP::ParseContentType(value, contentSubType);
} else if (String::ICompare(key,"connection")==0) {
connection = HTTP::ParseConnection(ex,value);
} else if (String::ICompare(key,"host")==0) {
serverAddress.assign(value);
} else if (String::ICompare(key,"origin")==0) {
origin.assign(value);
} else if (String::ICompare(key,"upgrade")==0) {
upgrade.assign(value);
} else if (String::ICompare(key,"sec-websocket-key")==0) {
secWebsocketKey.assign(value);
} else if (String::ICompare(key,"sec-webSocket-accept")==0) {
secWebsocketAccept.assign(value);
} else if (String::ICompare(key,"if-modified-since")==0) {
ifModifiedSince.update(ex,value,Date::HTTP_FORMAT);
} else if (String::ICompare(key,"access-control-request-headers")==0) {
accessControlRequestHeaders = value;
} else if (String::ICompare(key,"access-control-request-method")==0) {
String::ForEach forEach([this,&ex](UInt32 index,const char* value){
accessControlRequestMethod |= HTTP::ParseCommand(ex,value);
return true;
});
String::Split(value, ",", forEach, String::SPLIT_IGNORE_EMPTY | String::SPLIT_TRIM);
} else if (String::ICompare(key,"cookie")==0) {
String::ForEach forEach([this](UInt32 index,const char* data) {
const char* value = data;
// trim right
while (value && *value != '=' && !isblank(*value))
++value;
if (value) {
const char *endKey=value;
// trim left
do {
++value;
} while (value && (isblank(*value) || *value == '='));
SCOPED_STRINGIFY(data, endKey-data, cookies[data] = value);
}
return true;
});
String::Split(value, ";", forEach, String::SPLIT_IGNORE_EMPTY | String::SPLIT_TRIM);
}
}
UInt32 HTTPPacket::build(Exception& ex,UInt8* data,UInt32 size) {
if (_data)
return 0;
exception.set(Exception::NIL);
/// read data
ReadingStep step(CMD);
UInt8* current(data);
const UInt8* end(current+size-4); // 4 == /r/n/r/n
const char* signifiant(NULL);
const char* key(NULL);
// headers
for (; current <= end;++current) {
if (memcmp(current, EXPAND("\r\n")) == 0 || memcmp(current, EXPAND("\0\n")) == 0) {
if (!ex && signifiant) {
// KEY = VALUE
UInt8* endValue(current);
while (isblank(*--endValue));
*(endValue+1) = 0;
if (!key) { // version case!
String::ToNumber(signifiant+5, version);
} else {
headers[key] = signifiant;
parseHeader(ex,key,signifiant);
key = NULL;
}
}
step = LEFT;
current += 2;
signifiant = (const char*)current;
if (memcmp(current, EXPAND("\r\n")) == 0) {
current += 2;
content = current;
current += contentLength;
if (ex || current > (end+4))
break; // wait next
_data = data;
return _size = current - data;
}
++current; // here no continue, the "\r\n" check is not required again
}
if (ex)
continue; // try to go to "\r\n\r\n"
// http header, byte by byte
UInt8 byte = *current;
if ((step == LEFT || step == CMD || step == PATH) && (isspace(byte) || byte==0)) {
if (step == CMD) {
if(!signifiant) // Space before signifiant
ex.set(Exception::PROTOCOL,"Unexpected space before command");
// by default command == GET
if (!signifiant || (command = HTTP::ParseCommand(ex, signifiant)) == HTTP::COMMAND_UNKNOWN) {
exception.set(ex);
continue;
}
signifiant = NULL;
step = PATH;
} else if (step == PATH) {
// parse query
*current = 0;
size_t filePos = Util::UnpackUrl(signifiant, path,query);
filePath.append(path);
if (filePos != string::npos)
path.erase(filePos - 1);
else
filePath.append("/");
signifiant = NULL;
step = VERSION;
} else
++signifiant; // for trim begin of key or value
} else if (step != CMD && !key && (byte == ':' || byte == 0)) {
// KEY
key = signifiant;
step = LEFT;
UInt8* endValue(current);
while (isblank(*--endValue));
*(endValue+1) = 0;
signifiant = (const char*)current + 1;
} else if (step == CMD || step == PATH || step == VERSION) {
if (!signifiant)
signifiant = (const char*)current;
if (step == CMD && (current-data)>7) // not a HTTP valid packet, consumes all
exception.set(ex.set(Exception::PROTOCOL, "invalid HTTP packet"));
} else
step = RIGHT;
}
if (ex)
return current - data;
return 0; // wait next data
}
} // namespace Mona
| gpl-3.0 |
Graylog2/graylog2-server | graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/functions/hashing/Murmur3_128.java | 1143 | /*
* Copyright (C) 2020 Graylog, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*/
package org.graylog.plugins.pipelineprocessor.functions.hashing;
import com.google.common.hash.Hashing;
import java.nio.charset.StandardCharsets;
public class Murmur3_128 extends SingleArgStringFunction {
public static final String NAME = "murmur3_128";
@Override
protected String getDigest(String value) {
return Hashing.murmur3_128().hashString(value, StandardCharsets.UTF_8).toString();
}
@Override
protected String getName() {
return NAME;
}
}
| gpl-3.0 |
devonjones/PathfinderOpenReference | app/src/main/java/org/evilsoft/pathfinder/reference/preference/PathfinderPreferenceActivity.java | 1702 | /***
Copyright (c) 2008-2012 CommonsWare, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required
by applicable law or agreed to in writing, software distributed under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.
From _The Busy Coder's Guide to Android Development_
http://commonsware.com/Android
*/
package org.evilsoft.pathfinder.reference.preference;
import java.util.List;
import org.evilsoft.pathfinder.reference.R;
import android.os.Build;
import android.os.Bundle;
import android.widget.CheckBox;
import com.actionbarsherlock.app.SherlockPreferenceActivity;
public class PathfinderPreferenceActivity extends SherlockPreferenceActivity {
CheckBox prefCheckBox;
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// If the device is pre-Honeycomb, just add each of the sets of
// preferences to the single preference page in turn
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
addPreferencesFromResource(R.xml.source_filter);
}
}
@Override
public void onBuildHeaders(List<Header> target) {
// If the device is Honeycomb or higher, this method will be called,
// which will load the preference headers, which will in turn load the
// preferences
loadHeadersFromResource(R.xml.preference_headers, target);
}
}
| gpl-3.0 |
urashima9616/Leetcode_Python | leet_3.py | 1058 | import sys, os
class Solution():
def lengthOfLongestSubstring(self, s):
str_len = len(s)
if str_len==0:
return 0
pt_i = 0
pt_e = 0
alpha_beta={}
max_len=1
for pt_e in xrange(str_len):
print pt_e
if alpha_beta.has_key(s[pt_e]):
temp_len=pt_e-pt_i
if(max_len<temp_len):
max_len=temp_len
#Update dictionary
for pt_i in xrange(pt_i,alpha_beta[s[pt_e]]):
del alpha_beta[s[pt_i]]
#Update pt_i to alpha_beta[s[pt_e]]+1
pt_i=alpha_beta[s[pt_e]]+1
alpha_beta[s[pt_e]]=pt_e
continue
if pt_e==str_len-1:
temp_len=pt_e-pt_i+1
if(max_len<temp_len):
max_len=temp_len
return max_len
alpha_beta[s[pt_e]]=pt_e
return max_len
my_sol=Solution()
print my_sol.lengthOfLongestSubstring("dvdf")
print "hello world"
| gpl-3.0 |
Altaxo/Altaxo | Altaxo/Base/Main/Services/PropertyReflection/DisplayOrderAttribute.cs | 1599 | #region Copyright
/////////////////////////////////////////////////////////////////////////////
// Altaxo: a data processing and data plotting program
// Copyright (C) 2002-2011 Dr. Dirk Lellinger
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
/////////////////////////////////////////////////////////////////////////////
#endregion Copyright
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Altaxo.Main.Services.PropertyReflection
{
[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
public sealed class DisplayOrderAttribute : Attribute
{
private int _orderIndex;
public DisplayOrderAttribute(int orderIndex)
{
_orderIndex = orderIndex;
}
public int OrderIndex
{
get { return _orderIndex; }
}
}
}
| gpl-3.0 |
RevelSystems/Online-Ordering | skins/retail/views/header.js | 4113 | /*
* Revel Systems Online Ordering Application
*
* Copyright (C) 2014 by Revel Systems
*
* This file is part of Revel Systems Online Ordering open source application.
*
* Revel Systems Online Ordering open source application is free software: you
* can redistribute it and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* Revel Systems Online Ordering open source application is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Revel Systems Online Ordering Application.
* If not, see <http://www.gnu.org/licenses/>.
*/
define(["backbone", "factory"], function(Backbone) {
'use strict';
var HeaderMainView = App.Views.FactoryView.extend({
name: 'header',
mod: 'main',
bindings: {
'.shop': 'classes: {active: equal(menu_index, 0)}, attr: {tabindex: select(equal(menu_index, 0), -1, 0)}',
'.about': 'classes: {active: equal(menu_index, 1)}, attr: {tabindex: select(equal(menu_index, 1), -1, 0)}',
'.map': 'classes: {active: equal(menu_index, 2)}, attr: {tabindex: select(equal(menu_index, 2), -1, 0)}',
'.cart-box': 'classes: {link: ui_quantity}',
'.cart-qty': 'text: format("($1)", ui_quantity), toggle: ui_quantity',
'.promotions-link': 'toggle: promotions_available'
},
bindingSources: {
ui: function() {
return new Backbone.Model({
quantity: 0
});
}
},
initialize: function() {
this.listenTo(this.options.cart, 'add remove change', this.update, this);
App.Views.FactoryView.prototype.initialize.apply(this, arguments);
},
render: function() {
App.Views.FactoryView.prototype.render.apply(this, arguments);
var profilePanel = this.options.profilePanel,
view;
view = App.Views.GeneratorView.create(profilePanel.modelName, _.extend(profilePanel, {
el: this.$('.profile-panel-box')
}));
this.subViews.push(view);
view = App.Views.GeneratorView.create('SearchLine', {
mod: 'Main',
el: this.$('.search-box'),
model: this.options.searchLine
});
this.subViews.push(view);
loadSpinner(this.$('.img'));
this.update();
return this;
},
events: {
'click .shop': 'onMenu',
'click .about': 'onAbout',
'click .map': 'onMap',
'click .cart-box.link': 'onCart',
'click .promotions-link': 'onPromotions',
'click .hlink-root': 'onRootJump'
},
onEnterListeners: {
'.shop': 'onMenu',
'.about': 'onAbout',
'.map': 'onMap',
'.cart-box.link': 'onCart'
},
onMenu: function() {
this.model.trigger('onShop');
},
onAbout: function() {
this.model.trigger('onAbout');
},
onMap: function() {
this.model.trigger('onMap');
},
onCart: function() {
this.model.trigger('onCart');
},
update: function() {
this.setBinding('ui_quantity', this.options.cart.get_only_product_quantity());
},
onPromotions: function() {
this.model.trigger('onPromotions');
},
onRootJump: function() {
App.Routers.MainRouter.prototype.navigate('index', true);
}
});
return new (require('factory'))(function() {
App.Views.HeaderView = {};
App.Views.HeaderView.HeaderMainView = HeaderMainView;
});
}); | gpl-3.0 |
caglar/denetx | src/multiclass/dvec.cc | 2953 | /*
* dvec.cc
*
* Created on: Apr 26, 2011
* Author: caglar
*/
#include <cstdlib>
#include <cfloat>
#include <iostream>
#include <algorithm>
#include <functional>
#include <map>
#include <boost/multi_array.hpp>
#include "multiclass/dvec.h"
#include "float_cmp.h"
using std::copy;
using std::max_element;
using std::min_element;
using std::transform;
using std::plus;
bool
val_cmp(const DVec::value_type &i1, const DVec::value_type &i2);
void
copy_array_elements(DVec &dvec, const float *val, size_t array_size)
{
for (size_t i = 0; i < array_size; i++) {
dvec[i] = val[i];
}
}
void
copy_dvec_to_array(const DVec &dvec, float *val)
{
copy(dvec.begin(), dvec.end(), val);
}
template<typename T>
void
copy_dvec_to_stl_ds(const DVec &dvec, T &vec)
{
copy(dvec.begin(), dvec.end(), vec.begin());
}
template<typename T>
void
copy_stl_ds_to_dvec(DVec &dvec, const T &vec)
{
copy(vec.begin(), vec.end(), dvec.begin());
}
bool
val_cmp(const DVec::value_type& i1, const DVec::value_type& i2)
{
return i1 < i2;
}
size_t
max_index(const DVec& dvec)
{
size_t dvec_size = dvec.size();
size_t max_idx = 0;
if (dvec_size > 0) {
float max = dvec[0];
for (size_t i = 1; i < dvec_size; i++) {
if (definitelyGreaterThan(dvec[i], max)) {
max = dvec[i];
max_idx = i;
}
}
}
return max_idx;
}
float
max_val(const DVec& dvec)
{
return *max_element(dvec.begin(), dvec.end(), val_cmp);
}
size_t
min_index(const DVec& dvec)
{
size_t dvec_size = dvec.size();
size_t min_idx = 0;
if (dvec_size > 0) {
float min = dvec[0];
for (size_t i = 1; i < dvec_size; i++) {
if (definitelyLessThan(dvec[i], min)) {
min = dvec[i];
min_idx = i;
}
}
}
return min_idx;
}
float
min_val(const DVec& dvec)
{
return *min_element(dvec.begin(), dvec.end(), val_cmp);
}
void
add_to_val(int i, DVec& dVec, float val)
{
dVec[i] += val;
}
float
sum_of_vals(DVec& dvec)
{
float sum = 0.0;
for (auto i = 0; i < (dvec.size()); ++i) {
sum += dvec[i];
}
return sum;
}
void
scale_vals(DVec& dvec, float sval)
{
if (sval != 0.0) {
for (auto i = 0; i < dvec.size(); i++) {
dvec[i] = (dvec[i] / sval);
}
}else
perror("***Scaling value shouldn't be 0***\n");
}
int
get_num_non_zero(const DVec & dvec)
{
int noOfNonZero = 0;
for (auto i = 0; i < dvec.size(); i++) {
if (dvec[i] != 0.0) {
noOfNonZero++;
}
}
return noOfNonZero;
}
void
normalize(DVec& dvec)
{
if (!dvec.empty()) {
float sum = sum_of_vals(dvec);
if (sum != 0) {
scale_vals(dvec, sum);
}
}
}
void
sumDVecs(DVec first, DVec &second)
{
transform(first.begin(), first.end(), second.begin(), second.begin(), plus<double>());
}
| gpl-3.0 |
gcontini/android-cartridge | cartridge/src/main/java/com/googlecode/androidcartridge/metafacades/authentication/AuthenticationControllerFacadeLogicImpl.java | 2421 | // license-header java merge-point
//
// Generated by: MetafacadeLogicImpl.vsl in andromda-meta-cartridge.
package com.googlecode.androidcartridge.metafacades.authentication;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import org.andromda.metafacades.uml.AttributeFacade;
import org.andromda.utils.StringUtilsHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import com.googlecode.androidcartridge.AndroidProfile;
/**
*
* MetafacadeLogic implementation for
* org.andromda.cartridges.android.metafacades
* .authentication.AuthenticationControllerFacade.
*
* @see org.andromda.cartridges.android.metafacades.authentication.AuthenticationControllerFacade
*/
public class AuthenticationControllerFacadeLogicImpl extends
AuthenticationControllerFacadeLogic {
/**
*
*/
private static final long serialVersionUID = 503544415029435024L;
/**
* Public constructor for AuthenticationControllerFacadeLogicImpl
*
* @see org.andromda.cartridges.android.metafacades.authentication.AuthenticationControllerFacade
*/
public AuthenticationControllerFacadeLogicImpl(final Object metaObject,
final String context) {
super(metaObject, context);
}
@Override
protected String handleGetAccountDataClass() {
return StringUtilsHelper.upperCamelCaseName(getAccountType());
}
@Override
protected String handleGetAccountType() {
String accountType = (String) findTaggedValue(AndroidProfile.VALUE_ANDROID_ACCOUNT_TYPE);
if (StringUtils.isBlank(accountType)) {
accountType = getFullyQualifiedName();
}
return accountType;
}
@Override
protected boolean handleIsAccountDataFullySpecified() {
String[] requiredProps = new String[] { "hostName", "port",
"webappRoot", "ssl" };
Collection<String> allNames = new ArrayList<String>();
Collection<AttributeFacade> properties = getAllProperties();
for (AttributeFacade property : properties) {
allNames.add(property.getName());
}
return CollectionUtils.isSubCollection(allNames,
Arrays.asList(requiredProps));
}
@Override
protected boolean handleIsSystemAccount() {
String accountStorage = (String) findTaggedValue(AndroidProfile.VALUE_ANDROID_ACCOUNT_STORAGE);
boolean result = !("settings".equalsIgnoreCase(accountStorage));
System.out.println("account in settings [" + accountStorage + "]");
return result;
}
} | gpl-3.0 |
dmromanov/csvtotextile | tests/TestCase/Command/CsvToTextileTest.php | 2051 | <?php
namespace CsvToTextile\Test\TestCase\Command;
use CsvToTextile\Command\CsvToTextileCommand;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Tester\CommandTester;
/**
* Class CsvToTextileTest
*
* @package CsvToTextile\Test\TestCase\Command
*/
class CsvToTextileTest extends KernelTestCase
{
protected $tmpFile;
public function setUp()
{
register_shutdown_function(function () {
if (file_exists($this->tmpFile)) {
unlink($this->tmpFile);
}
});
$this->tmpFile = tempnam(null, 'csvtotextile');
$res = fopen($this->tmpFile, 'w');
fputcsv($res, [
1, 'foo', 'bar',
]);
fputcsv($res, [
2, 'foo', 'bar',
]);
fclose($res);
}
public function testExecWoArguments()
{
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Not enough arguments (missing: "input")');
$application = new Application(self::$kernel);
$application->add(new CsvToTextileCommand());
$command = $application->find('csvtotextile');
$commandTester = new CommandTester($command);
$commandTester->execute(array(
'command' => $command->getName(),
));
}
public function testSimpleTable()
{
$application = new Application(self::$kernel);
$application->add(new CsvToTextileCommand());
$command = $application->find('csvtotextile');
$commandTester = new CommandTester($command);
$commandTester->execute(array(
'command' => $command->getName(),
// pass arguments to the helper
'input' => $this->tmpFile,
));
$result = $commandTester->getDisplay();
$expected = <<<TEXTILE
| 1 | foo | bar |
| 2 | foo | bar |
TEXTILE;
$this->assertSame($expected, $result);
}
}
| gpl-3.0 |
lethalman/nixpaste | nixpaste.py | 6490 | #!/usr/bin/env python
import logging
import random
import urllib
from bottle import Bottle, run, request, response, static_file, template, TEMPLATE_PATH, BaseRequest
import fcntl
import base64
import hashlib
import os
import json
import re
from copy import copy
os.umask(0077)
nameRe = re.compile ("^[a-zA-Z0-9_-]+$")
configfile = file(os.getenv("NIXPASTE_CONFIG", "config.json"), "r")
config = json.load(configfile)
configfile.close()
# TypeError: Key has type <type 'unicode'> (not a string)
for k,v in config.items():
del config[k]
config[str(k)] = v
app = Bottle()
app.config.update (config)
TEMPLATE_PATH.insert(0, os.path.abspath (config["VIEWS"]))
def mergeConfig(**v):
c = copy(config)
c.update(v)
return c
class Storage:
def __init__ (self, config):
self.config = config
def hashname (self, num):
h = hashlib.pbkdf2_hmac('sha256', str(num), self.config["SALT"], 200000, self.config["LENGTH"])
return base64.urlsafe_b64encode(h)
def firstview (self, hashname):
return self.fullpath(hashname)+".firstview"
def markviewed (self, hashname):
try:
os.unlink (self.firstview (hashname))
except:
pass
def isfirstview (self, hashname):
try:
os.stat (self.firstview (hashname))
return True
except:
return False
def dirname (self, hashname):
return os.path.join (self.config["DIR"], hashname[0], hashname[1])
def fullpath (self, hashname):
return os.path.join (self.dirname (hashname), hashname)
def deletetoken (self, hashname):
h = hashlib.pbkdf2_hmac('sha256', hashname+"|delete", self.config["SALT"]+"|delete", 200000, self.config["LENGTH"])
return base64.urlsafe_b64encode(h)
def delete (self, hashname, token):
if self.deletetoken(hashname) == token:
f = file(os.path.join (self.config["DIR"], "db"), "r+b")
fcntl.lockf(f, fcntl.LOCK_EX)
try:
f.seek(0)
db = json.load (f)
filename = self.fullpath (hashname)
stat = os.stat(filename)
os.unlink(filename)
self.markviewed (hashname)
db["byte_size"] -= stat.st_size
db["file_count"] -= 1
if self.hashname (db["first"]) == hashname:
db["first"] += 1
f.seek (0)
f.truncate ()
json.dump (db, f)
f.flush()
return True
finally:
fcntl.lockf(f, fcntl.LOCK_UN)
f.close()
return False
def store (self, data):
try:
os.makedirs (self.config["DIR"], 0700)
except:
pass
try:
f = file(os.path.join (self.config["DIR"], "db"), "r+b")
except:
f = file(os.path.join (self.config["DIR"], "db"), "w+b")
fcntl.lockf(f, fcntl.LOCK_EX)
try:
f.seek(0)
db = json.load (f)
except Exception, e:
print e
db = { "byte_size": 0, "file_count": 0, "first": 0, "last": 0 }
try:
if len(data) > self.config["MAX_BYTES"]:
raise RuntimeError("Too large")
while db["byte_size"] + len(data) > self.config["MAX_BYTES"] or db["file_count"] + 1 > self.config["MAX_FILES"]:
if db["first"]:
evict = self.fullpath (self.hashname (db["first"]))
try:
db["byte_size"] -= os.path.getsize(evict)
os.unlink (evict)
except:
pass
db["file_count"] -= 1
db["first"] += 1
db["byte_size"] += len(data)
db["file_count"] += 1
db["last"] += 1
if not db["first"]:
db["first"] = db["last"]
hashname = self.hashname (db["last"])
dirname = self.dirname (hashname)
try:
os.makedirs (dirname, 0700)
except:
pass
paste = file(self.fullpath (hashname), "wb")
paste.write (data)
paste.close()
firstview = file(self.firstview (hashname), "wb")
firstview.close ()
f.seek (0)
f.truncate ()
json.dump (db, f)
f.flush()
return hashname
finally:
fcntl.lockf(f, fcntl.LOCK_UN)
f.close()
def get (self, hashname):
if not nameRe.match (hashname):
return None, None
try:
f = file(self.fullpath (hashname), "r")
data = f.read()
f.close()
if self.isfirstview (hashname):
return data, self.deletetoken (hashname)
else:
return data, None
except:
return None, None
@app.get("/")
def index():
return template ("index.tpl", **app.config)
@app.get("/favicon.ico")
def favicon():
return static_file ("favicon.ico", app.config["STATIC"])
@app.get("/about")
def index():
return template ("about.tpl", **app.config)
@app.post("/")
def paste():
isBrowser = False
text = request.forms.get(app.config["POST_FIELD"])
if not text:
text = request.forms.get("browser_text")
isBrowser = True
if not text:
response.status = 400
return 'No data\n'
try:
storage = Storage (app.config)
hashname = storage.store (text)
redirect = '{0}/{1}'.format(app.config["URL"], hashname)
if isBrowser:
response.status = 303
syntax = request.forms.get("syntax", "")
if nameRe.match (syntax):
redirect += "?"+syntax
response.set_header ('Location', redirect)
else:
storage.markviewed (hashname)
return redirect+"\n"
except Exception as ex:
logging.error(ex)
response.status = 400
return 'Bad request\n'.format(ex)
@app.get("/css/<res>")
def css(res):
return static_file(res, os.path.join(app.config["STATIC"], "css"))
@app.get("/js/<res>")
def js(res):
return static_file(res, os.path.join(app.config["STATIC"], "js"))
@app.get("/img/<res>")
def img(res):
return static_file(res, os.path.join(app.config["STATIC"], "img"))
@app.get("/raw/<hashname>")
def getRaw(hashname):
return getPaste (hashname, "raw")
@app.get("/del/<hashname>/<token>")
def delete(hashname, token):
storage = Storage(app.config)
if not storage.delete (hashname, token):
response.status = 404
return '{0} could not be deleted.'.format(hashname)
response.status = 303
response.set_header ('Location', app.config["URL"])
return '{0} has been deleted.'.format(hashname)
@app.get("/<hashname>")
def get(hashname):
return getPaste (hashname, request.query_string)
def getPaste (hashname, syntax):
storage = Storage(app.config)
text, deletetoken = storage.get (hashname)
storage.markviewed (hashname)
if not text:
response.status = 404
return '{0} not found.'.format(hashname)
if syntax == "raw":
response.content_type = 'text/plain; charset=UTF-8'
return text + '\n'
if not nameRe.match (syntax):
syntax = ""
response.content_type = 'text/html; charset=UTF-8'
return template ("index.tpl", **mergeConfig(pasteHash=hashname, pasteText=text, pasteSyntax=syntax, deleteToken=deletetoken))
if __name__ == '__main__':
app.run(host="0.0.0.0", port="8080")
| gpl-3.0 |
teamdeeson/warden | src/Deeson/WardenBundle/Event/SiteUpdateEvent.php | 570 | <?php
/**
* @file
* An event which fires when a site asks to be updated and after that
* update request has been verified.
*/
namespace Deeson\WardenBundle\Event;
use Deeson\WardenBundle\Document\SiteDocument;
class SiteUpdateEvent extends SiteEvent {
/**
* @var
*/
protected $data;
/**
* @param SiteDocument $site
* @param $data
*/
public function __construct(SiteDocument $site, $data) {
parent::__construct($site);
$this->data = $data;
}
/**
* @return
*/
public function getData() {
return $this->data;
}
}
| gpl-3.0 |
themiwi/freefoam-debian | src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.H | 11675 | /*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::surfaceFeatures
Description
Holds feature edges/points of surface.
Feature edges are stored in one list and sorted:
0 .. externalStart_-1 : region edges
externalStart_ .. internalStart_-1 : external edges
internalStart_ .. size-1 : internal edges
NOTE: angle is included angle, not feature angle and is in degrees.
The included angle is the smallest angle between two planes. For coplanar
faces it is 180, for straight angles it is 90. To pick up straight edges
only use included angle of 91 degrees
SourceFiles
surfaceFeatures.C
\*---------------------------------------------------------------------------*/
#ifndef surfaceFeatures_H
#define surfaceFeatures_H
#include <OpenFOAM/pointField.H>
#include <OpenFOAM/Map.H>
#include <OpenFOAM/HashSet.H>
#include <meshTools/pointIndexHit.H>
#include <OpenFOAM/edgeList.H>
#include <OpenFOAM/typeInfo.H>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class triSurface;
/*---------------------------------------------------------------------------*\
Class surfaceFeatures Declaration
\*---------------------------------------------------------------------------*/
class surfaceFeatures
{
public:
enum edgeStatus
{
NONE,
REGION,
EXTERNAL,
INTERNAL
};
private:
//- label and scalar; used in path walking
class labelScalar
{
public:
label n_;
scalar len_;
labelScalar(const label n, const scalar len)
:
n_(n),
len_(len)
{}
};
// Private data
//- Reference to surface
const triSurface& surf_;
//- Labels of points that are features
labelList featurePoints_;
//- Labels of edges that are features
labelList featureEdges_;
//- Start of external edges in featureEdges_
label externalStart_;
//- Start of internal edges in featureEdges_
label internalStart_;
// Private Member Functions
//- Return nearest point on edge (start..end). Also classify nearest:
// index=-1: nearest on mid of edge. index=0:nearest on edge.start()
// index=1: nearest on edge.end().
static pointIndexHit edgeNearest
(
const point& start,
const point& end,
const point& sample
);
//- Construct feature points where more than 2 feature edges meet
void calcFeatPoints(const List<edgeStatus>&);
//- Choose next unset feature edge.
label nextFeatEdge
(
const List<edgeStatus>& edgeStat,
const labelList& featVisited,
const label unsetVal,
const label prevEdgeI,
const label vertI
) const;
//- Walk connected feature edges. Marks edges in featVisited.
labelScalar walkSegment
(
const bool mark,
const List<edgeStatus>& edgeStat,
const label startEdgeI,
const label startPointI,
const label currentFeatI,
labelList& featVisited
);
public:
ClassName("surfaceFeatures");
// Constructors
//- Construct from surface
surfaceFeatures(const triSurface&);
//- Construct from components
surfaceFeatures
(
const triSurface&,
const labelList& featurePoints,
const labelList& featureEdges,
const label externalStart,
const label internalStart
);
//- Construct from surface, angle and min cumulative length and/or
// number of elements
surfaceFeatures
(
const triSurface&,
const scalar includedAngle,
const scalar minLen = 0,
const label minElems = 0
);
//- Construct from dictionary
surfaceFeatures(const triSurface&, const dictionary& dict);
//- Construct from file
surfaceFeatures(const triSurface&, const fileName& fName);
//- Construct as copy
surfaceFeatures(const surfaceFeatures&);
// Member Functions
// Access
inline const triSurface& surface() const
{
return surf_;
}
//- Return feature point list
inline const labelList& featurePoints() const
{
return featurePoints_;
}
//- Return feature edge list
inline const labelList& featureEdges() const
{
return featureEdges_;
}
//- start of external edges
inline label externalStart() const
{
return externalStart_;
}
//- start of internal edges
inline label internalStart() const
{
return internalStart_;
}
//- Return number of region edges
inline label nRegionEdges() const
{
return externalStart_;
}
//- Return number of external edges
inline label nExternalEdges() const
{
return internalStart_ - externalStart_;
}
//- Return number of internal edges
inline label nInternalEdges() const
{
return featureEdges_.size() - internalStart_;
}
//- Helper function: select a subset of featureEdges_
labelList selectFeatureEdges
(
const bool regionEdges,
const bool externalEdges,
const bool internalEdges
) const;
// Edit
//- Find feature edges using provided included angle
void findFeatures(const scalar includedAngle);
//- Delete small sets of edges. Edges are stringed up and any
// string of length < minLen (or nElems < minElems) is deleted.
void trimFeatures(const scalar minLen, const label minElems);
//- From member feature edges to status per edge.
List<edgeStatus> toStatus() const;
//- Set from status per edge
void setFromStatus(const List<edgeStatus>&);
// Find
//- Find nearest sample for selected surface points (usually the
// set of featurePoints). Return map from index in
// samples to surface point. Do not include points that are further
// than maxDist away (separate maxDist for every sample)
Map<label> nearestSamples
(
const labelList& selectedPoints,
const pointField& samples,
const scalarField& maxDist
) const;
//- Find nearest sample for regularly sampled points along the
// selected (surface) edges. Return map from sample to edge.
// maxDist is distance below which gets snapped.
// Edge gets sampled at points sampleDist[sampleI] apart.
// (with a maximum of 10 samples per edge)
Map<label> nearestSamples
(
const labelList& selectedEdges,
const pointField& samples,
const scalarField& sampleDist,
const scalarField& maxDist,
const scalar minSampleDist = 0.1
) const;
//- Like nearestSamples but now gets nearest point on
// sample-edge instead of nearest sample-point itself.
// Return map from sample edge to feature edge.
Map<pointIndexHit> nearestEdges
(
const labelList& selectedEdges,
const edgeList& sampleEdges,
const labelList& selectedSampleEdges,
const pointField& samplePoints,
const scalarField& sampleDist,
const scalarField& maxDist,
const scalar minSampleDist = 0.1
) const;
//- Find nearest surface edge (out of selectedEdges) for
// each sample point.
// Sets:
// - edgeLabel : label of surface edge.
// - edgePoint : exact position of nearest point on edge.
// - edgeEndPoint : -1, 0, 1 depending on whether edgePoint is
// on inside/start/end of edge
void nearestSurfEdge
(
const labelList& selectedEdges,
const pointField& samples,
const vector& searchSpan, // search span
labelList& edgeLabel,
labelList& edgeEndPoint,
pointField& edgePoint
) const;
//- Find nearest surface edge (out of selectedEdges) for each
// sample edge.
// Sets:
// - edgeLabel : label of surface edge.
// - pointOnEdge : exact position of nearest point on edge.
// - pointOnFeature : exact position on sample edge.
void nearestSurfEdge
(
const labelList& selectedEdges,
const edgeList& sampleEdges,
const labelList& selectedSampleEdges,
const pointField& samplePoints,
const vector& searchSpan, // search span
labelList& edgeLabel, // label of surface edge or -1
pointField& pointOnEdge, // point on above edge
pointField& pointOnFeature // point on sample edge
) const;
// Write
//- Write as dictionary
void writeDict(Ostream&) const;
//- Write as dictionary to file
void write(const fileName& fName) const;
//- Write to separate OBJ files (region, external, internal edges,
// feature points) for visualization
void writeObj(const fileName& prefix) const;
// Member Operators
void operator=(const surfaceFeatures&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************ vim: set sw=4 sts=4 et: ************************ //
| gpl-3.0 |
fraunhoferfokus/fokus-upnp | upnp-utils/src/main/java/de/fraunhofer/fokus/upnp/util/Base64Helper.java | 6608 | /**
*
* Copyright (C) 2004-2008 FhG Fokus
*
* This file is part of the FhG Fokus UPnP stack - an open source UPnP implementation
* with some additional features
*
* You can redistribute the FhG Fokus UPnP stack and/or modify it
* under the terms of the GNU General Public License Version 3 as published by
* the Free Software Foundation.
*
* For a license to use the FhG Fokus UPnP stack software under conditions
* other than those described here, or to purchase support for this
* software, please contact Fraunhofer FOKUS by e-mail at the following
* addresses:
* [email protected]
*
* The FhG Fokus UPnP stack is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>
* or write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package de.fraunhofer.fokus.upnp.util;
import java.io.ByteArrayOutputStream;
import java.math.BigInteger;
/**
*
* @author Alexander Koenig
*/
public class Base64Helper
{
/** Converts a base64 encoded string to a byte array */
public static byte[] base64ToByteArray(String data)
{
if (data == null)
{
return null;
}
// length of string must be divisible by 4
if (data.length() % 4 != 0)
{
return null;
}
ByteArrayOutputStream result = new ByteArrayOutputStream();
int offset = 0;
while (offset < data.length())
{
byte[] fragment = base64ToBytes(data.substring(offset, offset + 4));
result.write(fragment, 0, fragment.length);
offset += 4;
}
return result.toByteArray();
}
/** Converts a BigInteger, e.g. a RSA modulus, to a Base64 encoded string */
public static String bigIntegerToBase64(BigInteger value)
{
byte[] data = value.toByteArray();
String result = "";
// add leading zero if necessary
if ((data[0] & 0x80) != 0)
{
result = "0";
}
for (int i = 0; i < data.length; i++)
{
result += (char)data[i];
}
return stringToBase64(result);
}
/** Converts a byte array to a Base64 encoded string */
public static String byteArrayToBase64(byte[] data)
{
String result = "";
byte[] dataFragment = new byte[3];
// ceil(data.length/3)
for (int i = 0; i < (data.length + 2) / 3; i++)
{
int fragmentLength = Math.min(3, data.length - i * 3);
// copy current data to fragment
for (int j = 0; j < fragmentLength; j++)
{
dataFragment[j] = data[i * 3 + j];
}
result += bytesToBase64(dataFragment, fragmentLength);
}
return result;
}
/** Converts a string to a Base64 encoded string */
public static String stringToBase64(String data)
{
String result = "";
byte[] dataFragment = new byte[3];
// ceil(data.length/3)
for (int i = 0; i < (data.length() + 2) / 3; i++)
{
int fragmentLength = Math.min(3, data.length() - i * 3);
// copy current data to fragment
for (int j = 0; j < fragmentLength; j++)
{
dataFragment[j] = (byte)data.charAt(i * 3 + j);
}
result += bytesToBase64(dataFragment, fragmentLength);
}
return result;
}
/** Converts a maximum of three bytes to 4 Base64 characters */
private static String bytesToBase64(byte[] bytes, int length)
{
String result = "";
if (length == 3)
{
result += bitsToBase64((byte)((bytes[0] & 0xFC) >> 2));
result += bitsToBase64((byte)((bytes[0] & 0x03) << 4 | (bytes[1] & 0xF0) >> 4));
result += bitsToBase64((byte)((bytes[1] & 0x0F) << 2 | (bytes[2] & 0xC0) >> 6));
result += bitsToBase64((byte)(bytes[2] & 0x3F));
}
if (length == 2)
{
result += bitsToBase64((byte)((bytes[0] & 0xFC) >> 2));
result += bitsToBase64((byte)((bytes[0] & 0x03) << 4 | (bytes[1] & 0xF0) >> 4));
result += bitsToBase64((byte)((bytes[1] & 0x0F) << 2));
result += '=';
}
if (length == 1)
{
result += bitsToBase64((byte)((bytes[0] & 0xFC) >> 2));
result += bitsToBase64((byte)((bytes[0] & 0x03) << 4));
result += '=';
result += '=';
}
return result;
}
/** Converts a base64 encoded string of four chars to the corresponding bytes */
private static byte[] base64ToBytes(String value)
{
// catch wrong size
if (value.length() != 4)
{
return null;
}
// process padding
int paddingOffset = value.indexOf("=");
// no padding
if (paddingOffset == -1)
{
byte[] result = new byte[3];
result[0] = (byte)(base64ToBits(value.charAt(0)) << 2 | base64ToBits(value.charAt(1)) >> 4);
result[1] = (byte)(base64ToBits(value.charAt(1)) << 4 | base64ToBits(value.charAt(2)) >> 2);
result[2] = (byte)(base64ToBits(value.charAt(2)) << 6 | base64ToBits(value.charAt(3)));
return result;
}
// 1 padded byte
if (paddingOffset == 3)
{
byte[] result = new byte[2];
result[0] = (byte)(base64ToBits(value.charAt(0)) << 2 | base64ToBits(value.charAt(1)) >> 4);
result[1] = (byte)(base64ToBits(value.charAt(1)) << 4 | base64ToBits(value.charAt(2)) >> 2);
return result;
}
// 2 padded bytes
if (paddingOffset == 2)
{
byte[] result = new byte[1];
result[0] = (byte)(base64ToBits(value.charAt(0)) << 2 | base64ToBits(value.charAt(1)) >> 4);
return result;
}
// error
return null;
}
/** Converts a 6-bit value to the corresponding Base64 char */
private static char bitsToBase64(byte data)
{
if (data >= 0 && data < 26)
{
return (char)(data + 'A');
}
if (data >= 26 && data < 52)
{
return (char)(data - 26 + 'a');
}
if (data >= 52 && data < 62)
{
return (char)(data - 52 + '0');
}
if (data == 62)
{
return '+';
}
if (data == 63)
{
return '/';
}
return (char)0;
}
/** Converts a Base64 char to to corresponding 6-bit value */
private static byte base64ToBits(char data)
{
if (data >= 'A' && data <= 'Z')
{
return (byte)(data - 'A');
}
if (data >= 'a' && data <= 'z')
{
return (byte)(data - 'a' + 26);
}
if (data >= '0' && data <= '9')
{
return (byte)(data - '0' + 52);
}
if (data == '+')
{
return (byte)62;
}
return (byte)63;
}
}
| gpl-3.0 |
fzimmermann89/pyload | module/plugins/accounts/Http.py | 410 | # -*- coding: utf-8 -*-
from module.plugins.internal.Account import Account
class Http(Account):
__name__ = "Http"
__type__ = "account"
__version__ = "0.05"
__status__ = "testing"
__description__ = """Http dummy account plugin"""
__license__ = "GPLv3"
__authors__ = [("zoidberg", "[email protected]")]
info_threshold = 1000000
login_timeout = 1000000
| gpl-3.0 |
hiddentao/mist | customProtocols.js | 1257 | const electron = require('electron');
const protocol = electron.protocol;
const path = require('path');
protocol.registerHttpProtocol('mist', function(request, callback) {
// callback({mimeType: 'text/html', data: new Buffer('<h5>Response</h5>')});
console.log((request.url.indexOf('mist://interface') !== -1) ? global.interfaceAppUrl + request.url.replace('mist://interface','') : '');
var call = {
url: (request.url.indexOf('mist://interface') !== -1) ? global.interfaceAppUrl + request.url.replace('mist://interface','') : '',//'http://localhost:3050/' + request.url.replace('mist://',''),
method: request.method,
referrer: request.referrer
};
console.log(call);
// console.log(call);
callback(call);
}, function (error) {
if (error)
console.error('Failed to register protocol')
});
// protocol.registerProtocol('eth', function(request) {
// var url = request.url.substr(7)
// return new protocol.RequestStringJob({data: 'Hello'});
// });
// protocol.registerProtocol('bzz', function(request) {
// var url = request.url.substr(7)
// return new protocol.RequestStringJob({data: 'Hello'});
// });
// protocol.registerStandardSchemes(['mist','eth', 'bzz']); //'eth', 'bzz' | gpl-3.0 |
nferruzzi/giudice-server | ui/info.py | 124151 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'info.ui'
#
# Created by: PyQt5 UI code generator 5.6
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(425, 410)
self.verticalLayout_2 = QtWidgets.QVBoxLayout(Dialog)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.groupBox_2 = QtWidgets.QGroupBox(Dialog)
self.groupBox_2.setObjectName("groupBox_2")
self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox_2)
self.verticalLayout.setObjectName("verticalLayout")
self.textEdit_2 = QtWidgets.QTextEdit(self.groupBox_2)
self.textEdit_2.setObjectName("textEdit_2")
self.verticalLayout.addWidget(self.textEdit_2)
self.verticalLayout_2.addWidget(self.groupBox_2)
self.groupBox = QtWidgets.QGroupBox(Dialog)
self.groupBox.setObjectName("groupBox")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.groupBox)
self.horizontalLayout.setObjectName("horizontalLayout")
self.textEdit = QtWidgets.QTextEdit(self.groupBox)
self.textEdit.setEnabled(True)
self.textEdit.setAcceptDrops(False)
self.textEdit.setObjectName("textEdit")
self.horizontalLayout.addWidget(self.textEdit)
self.verticalLayout_2.addWidget(self.groupBox)
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.verticalLayout_2.addWidget(self.buttonBox)
self.retranslateUi(Dialog)
self.buttonBox.accepted.connect(Dialog.accept)
self.buttonBox.rejected.connect(Dialog.reject)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Licenza"))
self.groupBox_2.setTitle(_translate("Dialog", "Credits"))
self.textEdit_2.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'.SF NS Text\'; font-size:13pt; font-weight:400; font-style:normal;\">\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Giudice Copyright (C) 2016/2017 Nicola Ferruzzi </p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><a href=\"mailto:[email protected]\"><span style=\" text-decoration: underline; color:#0000ff;\">[email protected]</span></a></p>\n"
"<p align=\"center\" style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">sviluppato per</p>\n"
"<p align=\"center\" style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">RC Radiocomunicazioni</p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><a href=\"http://www.rcradiocom.it\"><span style=\" text-decoration: underline; color:#0000ff;\">http://www.rcradiocom.it</span></a></p>\n"
"<p align=\"center\" style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; text-decoration: underline; color:#0000ff;\"><br /></p>\n"
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><img src=\":/img/logo_rc_esteso.png\" /></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-weight:600;\">Distribuito su licenza GPLv3.</span></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><a href=\"http://github.com/nferruzzi/giudice-server\"><span style=\" text-decoration: underline; color:#0000ff;\">http://github.com/nferruzzi/giudice-server</span></a></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><a href=\"http://github.com/nferruzzi/giudice-client\"><span style=\" text-decoration: underline; color:#0000ff;\">http://github.com/nferruzzi/giudice-client</span></a></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Dipendenze: Qt5 - LGPL e PyQt5 - GPL </p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">This program is free software: you can redistribute it and/or modify</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">it under the terms of the GNU General Public License as published by</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the Free Software Foundation, either version 3 of the License, or</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">(at your option) any later version.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">This program is distributed in the hope that it will be useful,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">but WITHOUT ANY WARRANTY; without even the implied warranty of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">GNU General Public License for more details.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
self.groupBox.setTitle(_translate("Dialog", "Licenza GPLv3"))
self.textEdit.setHtml(_translate("Dialog", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'.SF NS Text\'; font-size:13pt; font-weight:400; font-style:normal;\">\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">GNU GENERAL PUBLIC LICENSE</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> Version 3, 29 June 2007</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Everyone is permitted to copy and distribute verbatim copies</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">of this license document, but changing it is not allowed.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> Preamble</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The GNU General Public License is a free, copyleft license for</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">software and other kinds of works.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The licenses for most software and other practical works are designed</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">to take away your freedom to share and change the works. By contrast,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the GNU General Public License is intended to guarantee your freedom to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">share and change all versions of a program--to make sure it remains free</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">software for all its users. We, the Free Software Foundation, use the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">GNU General Public License for most of our software; it applies also to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">any other work released this way by its authors. You can apply it to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">your programs, too.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">When we speak of free software, we are referring to freedom, not</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">price. Our General Public Licenses are designed to make sure that you</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">have the freedom to distribute copies of free software (and charge for</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">them if you wish), that you receive source code or can get it if you</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">want it, that you can change the software or use pieces of it in new</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">free programs, and that you know you can do these things.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">To protect your rights, we need to prevent others from denying you</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">these rights or asking you to surrender the rights. Therefore, you have</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">certain responsibilities if you distribute copies of the software, or if</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">you modify it: responsibilities to respect the freedom of others.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">For example, if you distribute copies of such a program, whether</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">gratis or for a fee, you must pass on to the recipients the same</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">freedoms that you received. You must make sure that they, too, receive</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">or can get the source code. And you must show them these terms so they</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">know their rights.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Developers that use the GNU GPL protect your rights with two steps:</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">(1) assert copyright on the software, and (2) offer you this License</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">giving you legal permission to copy, distribute and/or modify it.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">For the developers\' and authors\' protection, the GPL clearly explains</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">that there is no warranty for this free software. For both users\' and</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">authors\' sake, the GPL requires that modified versions be marked as</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">changed, so that their problems will not be attributed erroneously to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">authors of previous versions.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Some devices are designed to deny users access to install or run</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">modified versions of the software inside them, although the manufacturer</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">can do so. This is fundamentally incompatible with the aim of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">protecting users\' freedom to change the software. The systematic</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">pattern of such abuse occurs in the area of products for individuals to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">use, which is precisely where it is most unacceptable. Therefore, we</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">have designed this version of the GPL to prohibit the practice for those</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">products. If such problems arise substantially in other domains, we</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">stand ready to extend this provision to those domains in future versions</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">of the GPL, as needed to protect the freedom of users.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Finally, every program is threatened constantly by software patents.</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">States should not allow patents to restrict development and use of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">software on general-purpose computers, but in those that do, we wish to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">avoid the special danger that patents applied to a free program could</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">make it effectively proprietary. To prevent this, the GPL assures that</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">patents cannot be used to render the program non-free.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The precise terms and conditions for copying, distribution and</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">modification follow.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> TERMS AND CONDITIONS</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">0. Definitions.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"This License" refers to version 3 of the GNU General Public License.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"Copyright" also means copyright-like laws that apply to other kinds of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">works, such as semiconductor masks.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"The Program" refers to any copyrightable work licensed under this</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">License. Each licensee is addressed as "you". "Licensees" and</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"recipients" may be individuals or organizations.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">To "modify" a work means to copy from or adapt all or part of the work</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">in a fashion requiring copyright permission, other than the making of an</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">exact copy. The resulting work is called a "modified version" of the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">earlier work or a work "based on" the earlier work.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">A "covered work" means either the unmodified Program or a work based</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">on the Program.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">To "propagate" a work means to do anything with it that, without</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">permission, would make you directly or secondarily liable for</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">infringement under applicable copyright law, except executing it on a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">computer or modifying a private copy. Propagation includes copying,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">distribution (with or without modification), making available to the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">public, and in some countries other activities as well.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">To "convey" a work means any kind of propagation that enables other</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">parties to make or receive copies. Mere interaction with a user through</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">a computer network, with no transfer of a copy, is not conveying.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">An interactive user interface displays "Appropriate Legal Notices"</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">to the extent that it includes a convenient and prominently visible</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">feature that (1) displays an appropriate copyright notice, and (2)</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">tells the user that there is no warranty for the work (except to the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">extent that warranties are provided), that licensees may convey the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">work under this License, and how to view a copy of this License. If</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the interface presents a list of user commands or options, such as a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">menu, a prominent item in the list meets this criterion.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">1. Source Code.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The "source code" for a work means the preferred form of the work</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">for making modifications to it. "Object code" means any non-source</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">form of a work.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">A "Standard Interface" means an interface that either is an official</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">standard defined by a recognized standards body, or, in the case of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">interfaces specified for a particular programming language, one that</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">is widely used among developers working in that language.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The "System Libraries" of an executable work include anything, other</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">than the work as a whole, that (a) is included in the normal form of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">packaging a Major Component, but which is not part of that Major</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Component, and (b) serves only to enable use of the work with that</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Major Component, or to implement a Standard Interface for which an</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">implementation is available to the public in source code form. A</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"Major Component", in this context, means a major essential component</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">(kernel, window system, and so on) of the specific operating system</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">(if any) on which the executable work runs, or a compiler used to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">produce the work, or an object code interpreter used to run it.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The "Corresponding Source" for a work in object code form means all</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the source code needed to generate, install, and (for an executable</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">work) run the object code and to modify the work, including scripts to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">control those activities. However, it does not include the work\'s</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">System Libraries, or general-purpose tools or generally available free</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">programs which are used unmodified in performing those activities but</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">which are not part of the work. For example, Corresponding Source</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">includes interface definition files associated with source files for</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the work, and the source code for shared libraries and dynamically</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">linked subprograms that the work is specifically designed to require,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">such as by intimate data communication or control flow between those</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">subprograms and other parts of the work.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The Corresponding Source need not include anything that users</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">can regenerate automatically from other parts of the Corresponding</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Source.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The Corresponding Source for a work in source code form is that</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">same work.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">2. Basic Permissions.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">All rights granted under this License are granted for the term of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">copyright on the Program, and are irrevocable provided the stated</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">conditions are met. This License explicitly affirms your unlimited</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">permission to run the unmodified Program. The output from running a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">covered work is covered by this License only if the output, given its</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">content, constitutes a covered work. This License acknowledges your</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">rights of fair use or other equivalent, as provided by copyright law.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">You may make, run and propagate covered works that you do not</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">convey, without conditions so long as your license otherwise remains</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">in force. You may convey covered works to others for the sole purpose</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">of having them make modifications exclusively for you, or provide you</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">with facilities for running those works, provided that you comply with</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the terms of this License in conveying all material for which you do</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">not control copyright. Those thus making or running the covered works</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">for you must do so exclusively on your behalf, under your direction</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">and control, on terms that prohibit them from making any copies of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">your copyrighted material outside their relationship with you.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Conveying under any other circumstances is permitted solely under</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the conditions stated below. Sublicensing is not allowed; section 10</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">makes it unnecessary.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">3. Protecting Users\' Legal Rights From Anti-Circumvention Law.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">No covered work shall be deemed part of an effective technological</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">measure under any applicable law fulfilling obligations under article</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">11 of the WIPO copyright treaty adopted on 20 December 1996, or</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">similar laws prohibiting or restricting circumvention of such</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">measures.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">When you convey a covered work, you waive any legal power to forbid</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">circumvention of technological measures to the extent such circumvention</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">is effected by exercising rights under this License with respect to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the covered work, and you disclaim any intention to limit operation or</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">modification of the work as a means of enforcing, against the work\'s</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">users, your or third parties\' legal rights to forbid circumvention of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">technological measures.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">4. Conveying Verbatim Copies.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">You may convey verbatim copies of the Program\'s source code as you</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">receive it, in any medium, provided that you conspicuously and</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">appropriately publish on each copy an appropriate copyright notice;</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">keep intact all notices stating that this License and any</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">non-permissive terms added in accord with section 7 apply to the code;</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">keep intact all notices of the absence of any warranty; and give all</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">recipients a copy of this License along with the Program.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">You may charge any price or no price for each copy that you convey,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">and you may offer support or warranty protection for a fee.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">5. Conveying Modified Source Versions.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">You may convey a work based on the Program, or the modifications to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">produce it from the Program, in the form of source code under the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">terms of section 4, provided that you also meet all of these conditions:</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">a) The work must carry prominent notices stating that you modified</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">it, and giving a relevant date.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">b) The work must carry prominent notices stating that it is</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">released under this License and any conditions added under section</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">7. This requirement modifies the requirement in section 4 to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"keep intact all notices".</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">c) You must license the entire work, as a whole, under this</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">License to anyone who comes into possession of a copy. This</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">License will therefore apply, along with any applicable section 7</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">additional terms, to the whole of the work, and all its parts,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">regardless of how they are packaged. This License gives no</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">permission to license the work in any other way, but it does not</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">invalidate such permission if you have separately received it.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">d) If the work has interactive user interfaces, each must display</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Appropriate Legal Notices; however, if the Program has interactive</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">interfaces that do not display Appropriate Legal Notices, your</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">work need not make them do so.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">A compilation of a covered work with other separate and independent</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">works, which are not by their nature extensions of the covered work,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">and which are not combined with it such as to form a larger program,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">in or on a volume of a storage or distribution medium, is called an</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"aggregate" if the compilation and its resulting copyright are not</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">used to limit the access or legal rights of the compilation\'s users</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">beyond what the individual works permit. Inclusion of a covered work</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">in an aggregate does not cause this License to apply to the other</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">parts of the aggregate.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">6. Conveying Non-Source Forms.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">You may convey a covered work in object code form under the terms</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">of sections 4 and 5, provided that you also convey the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">machine-readable Corresponding Source under the terms of this License,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">in one of these ways:</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">a) Convey the object code in, or embodied in, a physical product</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">(including a physical distribution medium), accompanied by the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Corresponding Source fixed on a durable physical medium</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">customarily used for software interchange.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">b) Convey the object code in, or embodied in, a physical product</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">(including a physical distribution medium), accompanied by a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">written offer, valid for at least three years and valid for as</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">long as you offer spare parts or customer support for that product</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">model, to give anyone who possesses the object code either (1) a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">copy of the Corresponding Source for all the software in the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">product that is covered by this License, on a durable physical</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">medium customarily used for software interchange, for a price no</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">more than your reasonable cost of physically performing this</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">conveying of source, or (2) access to copy the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Corresponding Source from a network server at no charge.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">c) Convey individual copies of the object code with a copy of the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">written offer to provide the Corresponding Source. This</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">alternative is allowed only occasionally and noncommercially, and</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">only if you received the object code with such an offer, in accord</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">with subsection 6b.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">d) Convey the object code by offering access from a designated</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">place (gratis or for a charge), and offer equivalent access to the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Corresponding Source in the same way through the same place at no</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">further charge. You need not require recipients to copy the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Corresponding Source along with the object code. If the place to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">copy the object code is a network server, the Corresponding Source</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">may be on a different server (operated by you or a third party)</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">that supports equivalent copying facilities, provided you maintain</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">clear directions next to the object code saying where to find the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Corresponding Source. Regardless of what server hosts the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Corresponding Source, you remain obligated to ensure that it is</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">available for as long as needed to satisfy these requirements.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">e) Convey the object code using peer-to-peer transmission, provided</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">you inform other peers where the object code and Corresponding</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Source of the work are being offered to the general public at no</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">charge under subsection 6d.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">A separable portion of the object code, whose source code is excluded</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">from the Corresponding Source as a System Library, need not be</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">included in conveying the object code work.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">A "User Product" is either (1) a "consumer product", which means any</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">tangible personal property which is normally used for personal, family,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">or household purposes, or (2) anything designed or sold for incorporation</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">into a dwelling. In determining whether a product is a consumer product,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">doubtful cases shall be resolved in favor of coverage. For a particular</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">product received by a particular user, "normally used" refers to a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">typical or common use of that class of product, regardless of the status</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">of the particular user or of the way in which the particular user</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">actually uses, or expects or is expected to use, the product. A product</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">is a consumer product regardless of whether the product has substantial</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">commercial, industrial or non-consumer uses, unless such uses represent</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the only significant mode of use of the product.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"Installation Information" for a User Product means any methods,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">procedures, authorization keys, or other information required to install</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">and execute modified versions of a covered work in that User Product from</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">a modified version of its Corresponding Source. The information must</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">suffice to ensure that the continued functioning of the modified object</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">code is in no case prevented or interfered with solely because</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">modification has been made.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">If you convey an object code work under this section in, or with, or</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">specifically for use in, a User Product, and the conveying occurs as</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">part of a transaction in which the right of possession and use of the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">User Product is transferred to the recipient in perpetuity or for a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">fixed term (regardless of how the transaction is characterized), the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Corresponding Source conveyed under this section must be accompanied</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">by the Installation Information. But this requirement does not apply</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">if neither you nor any third party retains the ability to install</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">modified object code on the User Product (for example, the work has</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">been installed in ROM).</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The requirement to provide Installation Information does not include a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">requirement to continue to provide support service, warranty, or updates</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">for a work that has been modified or installed by the recipient, or for</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the User Product in which it has been modified or installed. Access to a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">network may be denied when the modification itself materially and</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">adversely affects the operation of the network or violates the rules and</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">protocols for communication across the network.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Corresponding Source conveyed, and Installation Information provided,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">in accord with this section must be in a format that is publicly</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">documented (and with an implementation available to the public in</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">source code form), and must require no special password or key for</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">unpacking, reading or copying.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">7. Additional Terms.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"Additional permissions" are terms that supplement the terms of this</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">License by making exceptions from one or more of its conditions.</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Additional permissions that are applicable to the entire Program shall</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">be treated as though they were included in this License, to the extent</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">that they are valid under applicable law. If additional permissions</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">apply only to part of the Program, that part may be used separately</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">under those permissions, but the entire Program remains governed by</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">this License without regard to the additional permissions.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">When you convey a copy of a covered work, you may at your option</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">remove any additional permissions from that copy, or from any part of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">it. (Additional permissions may be written to require their own</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">removal in certain cases when you modify the work.) You may place</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">additional permissions on material, added by you to a covered work,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">for which you have or can give appropriate copyright permission.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Notwithstanding any other provision of this License, for material you</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">add to a covered work, you may (if authorized by the copyright holders of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">that material) supplement the terms of this License with terms:</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">a) Disclaiming warranty or limiting liability differently from the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">terms of sections 15 and 16 of this License; or</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">b) Requiring preservation of specified reasonable legal notices or</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">author attributions in that material or in the Appropriate Legal</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Notices displayed by works containing it; or</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">c) Prohibiting misrepresentation of the origin of that material, or</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">requiring that modified versions of such material be marked in</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">reasonable ways as different from the original version; or</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">d) Limiting the use for publicity purposes of names of licensors or</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">authors of the material; or</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">e) Declining to grant rights under trademark law for use of some</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">trade names, trademarks, or service marks; or</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">f) Requiring indemnification of licensors and authors of that</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">material by anyone who conveys the material (or modified versions of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">it) with contractual assumptions of liability to the recipient, for</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">any liability that these contractual assumptions directly impose on</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">those licensors and authors.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">All other non-permissive additional terms are considered "further</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">restrictions" within the meaning of section 10. If the Program as you</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">received it, or any part of it, contains a notice stating that it is</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">governed by this License along with a term that is a further</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">restriction, you may remove that term. If a license document contains</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">a further restriction but permits relicensing or conveying under this</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">License, you may add to a covered work material governed by the terms</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">of that license document, provided that the further restriction does</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">not survive such relicensing or conveying.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">If you add terms to a covered work in accord with this section, you</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">must place, in the relevant source files, a statement of the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">additional terms that apply to those files, or a notice indicating</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">where to find the applicable terms.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Additional terms, permissive or non-permissive, may be stated in the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">form of a separately written license, or stated as exceptions;</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the above requirements apply either way.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">8. Termination.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">You may not propagate or modify a covered work except as expressly</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">provided under this License. Any attempt otherwise to propagate or</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">modify it is void, and will automatically terminate your rights under</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">this License (including any patent licenses granted under the third</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">paragraph of section 11).</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">However, if you cease all violation of this License, then your</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">license from a particular copyright holder is reinstated (a)</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">provisionally, unless and until the copyright holder explicitly and</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">finally terminates your license, and (b) permanently, if the copyright</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">holder fails to notify you of the violation by some reasonable means</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">prior to 60 days after the cessation.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Moreover, your license from a particular copyright holder is</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">reinstated permanently if the copyright holder notifies you of the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">violation by some reasonable means, this is the first time you have</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">received notice of violation of this License (for any work) from that</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">copyright holder, and you cure the violation prior to 30 days after</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">your receipt of the notice.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Termination of your rights under this section does not terminate the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">licenses of parties who have received copies or rights from you under</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">this License. If your rights have been terminated and not permanently</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">reinstated, you do not qualify to receive new licenses for the same</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">material under section 10.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">9. Acceptance Not Required for Having Copies.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">You are not required to accept this License in order to receive or</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">run a copy of the Program. Ancillary propagation of a covered work</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">occurring solely as a consequence of using peer-to-peer transmission</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">to receive a copy likewise does not require acceptance. However,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">nothing other than this License grants you permission to propagate or</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">modify any covered work. These actions infringe copyright if you do</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">not accept this License. Therefore, by modifying or propagating a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">covered work, you indicate your acceptance of this License to do so.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">10. Automatic Licensing of Downstream Recipients.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Each time you convey a covered work, the recipient automatically</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">receives a license from the original licensors, to run, modify and</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">propagate that work, subject to this License. You are not responsible</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">for enforcing compliance by third parties with this License.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">An "entity transaction" is a transaction transferring control of an</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">organization, or substantially all assets of one, or subdividing an</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">organization, or merging organizations. If propagation of a covered</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">work results from an entity transaction, each party to that</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">transaction who receives a copy of the work also receives whatever</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">licenses to the work the party\'s predecessor in interest had or could</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">give under the previous paragraph, plus a right to possession of the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Corresponding Source of the work from the predecessor in interest, if</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the predecessor has it or can get it with reasonable efforts.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">You may not impose any further restrictions on the exercise of the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">rights granted or affirmed under this License. For example, you may</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">not impose a license fee, royalty, or other charge for exercise of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">rights granted under this License, and you may not initiate litigation</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">(including a cross-claim or counterclaim in a lawsuit) alleging that</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">any patent claim is infringed by making, using, selling, offering for</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">sale, or importing the Program or any portion of it.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">11. Patents.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">A "contributor" is a copyright holder who authorizes use under this</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">License of the Program or a work on which the Program is based. The</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">work thus licensed is called the contributor\'s "contributor version".</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">A contributor\'s "essential patent claims" are all patent claims</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">owned or controlled by the contributor, whether already acquired or</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">hereafter acquired, that would be infringed by some manner, permitted</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">by this License, of making, using, or selling its contributor version,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">but do not include claims that would be infringed only as a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">consequence of further modification of the contributor version. For</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">purposes of this definition, "control" includes the right to grant</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">patent sublicenses in a manner consistent with the requirements of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">this License.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Each contributor grants you a non-exclusive, worldwide, royalty-free</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">patent license under the contributor\'s essential patent claims, to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">make, use, sell, offer for sale, import and otherwise run, modify and</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">propagate the contents of its contributor version.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">In the following three paragraphs, a "patent license" is any express</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">agreement or commitment, however denominated, not to enforce a patent</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">(such as an express permission to practice a patent or covenant not to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">sue for patent infringement). To "grant" such a patent license to a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">party means to make such an agreement or commitment not to enforce a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">patent against the party.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">If you convey a covered work, knowingly relying on a patent license,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">and the Corresponding Source of the work is not available for anyone</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">to copy, free of charge and under the terms of this License, through a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">publicly available network server or other readily accessible means,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">then you must either (1) cause the Corresponding Source to be so</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">available, or (2) arrange to deprive yourself of the benefit of the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">patent license for this particular work, or (3) arrange, in a manner</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">consistent with the requirements of this License, to extend the patent</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">license to downstream recipients. "Knowingly relying" means you have</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">actual knowledge that, but for the patent license, your conveying the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">covered work in a country, or your recipient\'s use of the covered work</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">in a country, would infringe one or more identifiable patents in that</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">country that you have reason to believe are valid.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">If, pursuant to or in connection with a single transaction or</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">arrangement, you convey, or propagate by procuring conveyance of, a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">covered work, and grant a patent license to some of the parties</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">receiving the covered work authorizing them to use, propagate, modify</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">or convey a specific copy of the covered work, then the patent license</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">you grant is automatically extended to all recipients of the covered</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">work and works based on it.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">A patent license is "discriminatory" if it does not include within</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the scope of its coverage, prohibits the exercise of, or is</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">conditioned on the non-exercise of one or more of the rights that are</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">specifically granted under this License. You may not convey a covered</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">work if you are a party to an arrangement with a third party that is</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">in the business of distributing software, under which you make payment</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">to the third party based on the extent of your activity of conveying</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the work, and under which the third party grants, to any of the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">parties who would receive the covered work from you, a discriminatory</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">patent license (a) in connection with copies of the covered work</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">conveyed by you (or copies made from those copies), or (b) primarily</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">for and in connection with specific products or compilations that</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">contain the covered work, unless you entered into that arrangement,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">or that patent license was granted, prior to 28 March 2007.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Nothing in this License shall be construed as excluding or limiting</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">any implied license or other defenses to infringement that may</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">otherwise be available to you under applicable patent law.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">12. No Surrender of Others\' Freedom.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">If conditions are imposed on you (whether by court order, agreement or</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">otherwise) that contradict the conditions of this License, they do not</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">excuse you from the conditions of this License. If you cannot convey a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">covered work so as to satisfy simultaneously your obligations under this</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">License and any other pertinent obligations, then as a consequence you may</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">not convey it at all. For example, if you agree to terms that obligate you</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">to collect a royalty for further conveying from those to whom you convey</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the Program, the only way you could satisfy both those terms and this</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">License would be to refrain entirely from conveying the Program.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">13. Use with the GNU Affero General Public License.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Notwithstanding any other provision of this License, you have</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">permission to link or combine any covered work with a work licensed</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">under version 3 of the GNU Affero General Public License into a single</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">combined work, and to convey the resulting work. The terms of this</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">License will continue to apply to the part which is the covered work,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">but the special requirements of the GNU Affero General Public License,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">section 13, concerning interaction through a network will apply to the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">combination as such.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">14. Revised Versions of this License.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">The Free Software Foundation may publish revised and/or new versions of</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">the GNU General Public License from time to time. Such new versions will</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">be similar in spirit to the present version, but may differ in detail to</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">address new problems or concerns.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Each version is given a distinguishing version number. If the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Program specifies that a certain numbered version of the GNU General</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Public License "or any later version" applies to it, you have the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">option of following the terms and conditions either of that numbered</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">version or of any later version published by the Free Software</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Foundation. If the Program does not specify a version number of the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">GNU General Public License, you may choose any version ever published</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">by the Free Software Foundation.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">If the Program specifies that a proxy can decide which future</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">versions of the GNU General Public License can be used, that proxy\'s</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">public statement of acceptance of a version permanently authorizes you</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">to choose that version for the Program.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Later license versions may give you additional or different</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">permissions. However, no additional obligations are imposed on any</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">author or copyright holder as a result of your choosing to follow a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">later version.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">15. Disclaimer of Warranty.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">16. Limitation of Liability.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">SUCH DAMAGES.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">17. Interpretation of Sections 15 and 16.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">If the disclaimer of warranty and limitation of liability provided</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">above cannot be given local legal effect according to their terms,</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">reviewing courts shall apply local law that most closely approximates</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">an absolute waiver of all civil liability in connection with the</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Program, unless a warranty or assumption of liability accompanies a</p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">copy of the Program in return for a fee.</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> END OF TERMS AND CONDITIONS</p>\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
| gpl-3.0 |
vilbeyli/DX11Renderer | Source/Renderer/Source/RenderCommands.cpp | 6485 | // VQEngine | DirectX11 Renderer
// Copyright(C) 2018 - Volkan Ilbeyli
//
// This program is free software : you can redistribute it and / or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.If not, see <http://www.gnu.org/licenses/>.
//
// Contact: [email protected]
#include "RenderCommands.h"
#include "Renderer.h"
// store XSSetShaderResources function pointers in array and index through ShaderType enum
//static void(__cdecl ID3D11DeviceContext:: *SetShaderConstants[6])
//(UINT StartSlot, UINT NumBuffers, ID3D11Buffer *const *ppConstantBuffers) =
//{
// &ID3D11DeviceContext::VSSetConstantBuffers,
// &ID3D11DeviceContext::GSSetConstantBuffers,
// &ID3D11DeviceContext::DSSetConstantBuffers,
// &ID3D11DeviceContext::HSSetConstantBuffers,
// &ID3D11DeviceContext::PSSetConstantBuffers,
// &ID3D11DeviceContext::CSSetConstantBuffers,
//};
#ifdef _WIN64
#define CALLING_CONVENTION __cdecl
#else // _WIN32
#define CALLING_CONVENTION __stdcall
#endif
static void(CALLING_CONVENTION ID3D11DeviceContext:: *SetShaderResources[EShaderStage::COUNT])
(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView *const *ppShaderResourceViews) =
{
&ID3D11DeviceContext::VSSetShaderResources,
&ID3D11DeviceContext::GSSetShaderResources,
&ID3D11DeviceContext::DSSetShaderResources,
&ID3D11DeviceContext::HSSetShaderResources,
&ID3D11DeviceContext::PSSetShaderResources,
&ID3D11DeviceContext::CSSetShaderResources,
};
#if 0 // experimental (there's code duplication that can use some template programming)
template<class T>
void SetResource(SetTextureCommand& cmd, Renderer* pRenderer, ID3D11DeviceContext* pContext)
{
constexpr UINT NUM_RESOURCE_VIEWS = 1;
if (cmd.numTextures == 1)
{
const TextureID textureID = cmd.textureIDs[0];
assert(textureID >= 0);
const bool bUseArray = pRenderer->mTextures[textureID]._uavArray.size() != 0;
ID3D11UnorderedAccessView** ppUAVs = !bUseArray
? &pRenderer->mTextures[textureID]._uav
: &pRenderer->mTextures[textureID]._uavArray[slice];
pContext->CSSetUnorderedAccessViews(binding.textureSlot, NUM_UAVs, ppUAVs, nullptr);
}
else
{
std::vector< ID3D11UnorderedAccessView* > pUAVs = [&]()
{
std::vector< ID3D11UnorderedAccessView* > pUAVs(numTextures);
for (unsigned i = 0; i < numTextures; ++i)
{
const TextureID textureID = textureIDs[i];
assert(textureID >= 0);
pUAVs[i] = pRenderer->mTextures[textureID]._uav;
}
return pUAVs;
}();
pContext->CSSetUnorderedAccessViews(binding.textureSlot, NUM_UAVs, pUAVs.data(), nullptr);
}
}
#endif
void SetTextureCommand::SetResource(Renderer * pRenderer)
{
auto* pContext = pRenderer->m_deviceContext;
auto* pDevice = pRenderer->m_device;
if (bUnorderedAccess)
{
constexpr UINT NUM_UAVs = 1;
// UAV
//
if (numTextures == 1)
{
const TextureID textureID = textureIDs[0];
assert(textureID >= 0);
const bool bUseArray = pRenderer->mTextures[textureID]._uavArray.size() != 0;
ID3D11UnorderedAccessView** ppUAVs = !bUseArray
? &pRenderer->mTextures[textureID]._uav
: &pRenderer->mTextures[textureID]._uavArray[slice];
pContext->CSSetUnorderedAccessViews(binding.textureSlot, NUM_UAVs, ppUAVs, nullptr);
}
// UAV ARRAY
//
else
{
assert(false);
std::vector< ID3D11UnorderedAccessView* > pUAVs = [&]()
{
std::vector< ID3D11UnorderedAccessView* > pUAVs(numTextures);
for (unsigned i = 0; i < numTextures; ++i)
{
const TextureID textureID = textureIDs[i];
assert(textureID >= 0);
pUAVs[i] = pRenderer->mTextures[textureID]._uav;
}
return pUAVs;
}();
pContext->CSSetUnorderedAccessViews(binding.textureSlot, NUM_UAVs, pUAVs.data(), nullptr);
}
}
else
{
constexpr UINT NUM_SRVs = 1;
// SRV
//
if (numTextures == 1)
{
const TextureID textureID = textureIDs[0];
assert(textureID >= 0);
const bool bUseArray = pRenderer->mTextures[textureID]._srvArray.size() != 0;
ID3D11ShaderResourceView** ppSRVs = !bUseArray
? &pRenderer->mTextures[textureID]._srv
: &pRenderer->mTextures[textureID]._srvArray[slice];
(pContext->*SetShaderResources[binding.shaderStage])(binding.textureSlot, NUM_SRVs, ppSRVs);
}
// SRV ARRAY
//
else
{
assert(false);
std::vector< ID3D11ShaderResourceView* > pSRVs = [&]()
{
std::vector< ID3D11ShaderResourceView* > pSRVs(numTextures);
for (unsigned i = 0; i < numTextures; ++i)
{
const TextureID textureID = textureIDs[i];
assert(textureID >= 0);
pSRVs[i] = pRenderer->mTextures[textureID]._srv;
}
return pSRVs;
}();
(pContext->*SetShaderResources[binding.shaderStage])(binding.textureSlot, numTextures, pSRVs.data());
}
}
}
static void(CALLING_CONVENTION ID3D11DeviceContext:: *SetSampler[EShaderStage::COUNT])
(UINT StartSlot, UINT NumViews, ID3D11SamplerState* const *ppShaderResourceViews) =
{
&ID3D11DeviceContext::VSSetSamplers,
&ID3D11DeviceContext::GSSetSamplers,
&ID3D11DeviceContext::DSSetSamplers,
&ID3D11DeviceContext::HSSetSamplers,
&ID3D11DeviceContext::PSSetSamplers,
&ID3D11DeviceContext::CSSetSamplers,
};
void SetSamplerCommand::SetResource(Renderer * pRenderer)
{
assert(samplerID >= 0);
(pRenderer->m_deviceContext->*SetSampler[binding.shaderStage])(binding.samplerSlot, 1, &pRenderer->mSamplers[samplerID]._samplerState);
}
ClearCommand ClearCommand::Depth(float depthClearValue)
{
const bool bDoClearColor = false;
const bool bDoClearDepth = true;
const bool bDoClearStencil = false;
return ClearCommand (
bDoClearColor, bDoClearDepth, bDoClearStencil,
{ 0, 0, 0, 0 }, depthClearValue, 0
);
}
ClearCommand ClearCommand::Color(const std::array<float, 4>& clearColorValues)
{
const bool bDoClearColor = true;
const bool bDoClearDepth = false;
const bool bDoClearStencil = false;
return ClearCommand(
bDoClearColor, bDoClearDepth, bDoClearStencil,
clearColorValues, 0, 0
);
}
ClearCommand ClearCommand::Color(float r, float g, float b, float a)
{
return ClearCommand::Color({ r,g,b,a });
}
| gpl-3.0 |
pierre-rouanet/poppy-testbench | benchmarks/communication_robustness.py | 4251 | """
We are trying to measure:
* the timeout/communication error frequency
"""
import time
import numpy
import argparse
from matplotlib import pylab
from contextlib import closing
from progressbar import ProgressBar
from pypot.dynamixel.error import BaseErrorHandler
from pypot.dynamixel.controller import _PosSpeedLoadDxlController
from pypot.primitive.utils import Sinus
from pypot.primitive import LoopPrimitive
class CountErrorHandler(BaseErrorHandler):
def __init__(self):
BaseErrorHandler.__init__(self)
self.error_timestamp = []
def handle_timeout(self, error):
self.error_timestamp.append(time.time())
def handle_communication_error(self, error):
self.error_timestamp.append(time.time())
class SpyPosSpeedController(_PosSpeedLoadDxlController):
def setup(self):
_PosSpeedLoadDxlController.setup(self)
self.t = []
def update(self):
_PosSpeedLoadDxlController.update(self)
self.t.append(time.time())
class RecordPrimitive(LoopPrimitive):
def __init__(self, robot, m):
LoopPrimitive.__init__(self, robot, 50.)
self.m = m
def setup(self):
self.pres_pos, self.goal_pos = [], []
def update(self):
self.pres_pos.append(self.m.present_position)
self.goal_pos.append(self.m.goal_position)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--protocol', type=int, required=True, choices=(1, 2))
parser.add_argument('--duration', type=int, default=15 * 60)
args = parser.parse_args()
if args.protocol == 1:
from poppy_ergo import PoppyErgo as ErgoCls
else:
from poppy_ergo_jr import PoppyErgoJr as ErgoCls
with closing(ErgoCls(sync=False)) as ergo:
base_controller = ergo._controllers[0]
old_controller = base_controller.controllers[0]
new_controller = SpyPosSpeedController(old_controller.io,
old_controller.motors, 50.)
del base_controller.controllers[0]
base_controller.controllers.insert(0, new_controller)
dxl_io = base_controller.io
dxl_io._error_handler = CountErrorHandler()
ergo.start_sync()
for m in ergo.motors:
m.compliant = False
m.torque_limit = 100
ergo.goto_position({m.name: 0.0 for m in ergo.motors}, 2, wait=True)
for m in ergo.motors:
m.moving_speed = 0
s1 = Sinus(ergo, 50.0, ergo.motors, freq=0.2, amp=10)
s2 = Sinus(ergo, 50.0, ergo.motors[:1], freq=1, amp=30)
rec = RecordPrimitive(ergo, ergo.motors[0])
gold_t = numpy.linspace(0, args.duration, 1000)
gold = (10 * numpy.sin(2 * 3.14 * 0.2 * gold_t) +
30 * numpy.sin(2 * 3.14 * 1. * gold_t)) / 2.
s1.start()
s2.start()
rec.start()
t0 = time.time()
print('Start testing')
progress = ProgressBar(maxval=args.duration)
for i in range(args.duration):
time.sleep(1)
progress.update(i)
progress.finish()
s1.stop()
s2.stop()
rec.stop()
for m in ergo.motors:
m.compliant = True
error_count = len(dxl_io._error_handler.error_timestamp)
print('Com. problem {} within {}s: freq={}Hz'.format(
error_count, args.duration,
float(error_count) / args.duration))
t = (numpy.array(dxl_io._error_handler.error_timestamp) - t0)
dt = numpy.diff(new_controller.t) * 1000
pylab.figure()
pylab.plot(numpy.linspace(0, args.duration, len(rec.pres_pos)), rec.pres_pos)
pylab.plot(numpy.linspace(0, args.duration, len(rec.goal_pos)), rec.goal_pos)
pylab.plot(gold_t, gold)
pylab.xlim(0, args.duration)
pylab.title('Applied motions')
pylab.legend(('Present position', 'Goal position', 'Expected Traj'))
pylab.figure()
pylab.hist(dt)
pylab.title('Pos/Speed/Load update Frequency')
pylab.xlabel('dt between two syncs (ms)')
pylab.figure()
pylab.hist(t)
pylab.xlim(0, args.duration)
pylab.title('Communication Error Frequency')
pylab.xlabel('time (s)')
pylab.ylabel('# errors')
pylab.show()
| gpl-3.0 |
kelvinm1/TableSchemaExporter | TableSchemaExporter/Properties/AssemblyInfo.cs | 1465 | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TableSchemaExporter")]
[assembly: AssemblyDescription("SQL Server table schema export application")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TableSchemaExporter")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5b9c8a2a-8db6-46f0-9db9-5fdb0c8fa800")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.010615.01")]
[assembly: AssemblyFileVersion("1.0.010615.01")]
| gpl-3.0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.