content
stringlengths
23
1.05M
using System; namespace NSW.EliteDangerous.INARA { internal class TestSystemClock : ISystemClock { public DateTime Now => new DateTime(2019, 9, 2, 17, 0, 0, DateTimeKind.Utc); } }
// <auto-generated /> // Built from: hl7.fhir.r4b.core version: 4.1.0 // Option: "NAMESPACE" = "fhirCsR4" using fhirCsR4.Models; namespace fhirCsR4.ValueSets { /// <summary> /// This example value set defines a set of codes that can be used to indicate species of animal patients. /// </summary> public static class AnimalSpeciesCodes { /// <summary> /// /// </summary> public static readonly Coding Goat = new Coding { Code = "125097000", Display = "goat", System = "http://snomed.info/sct" }; /// <summary> /// /// </summary> public static readonly Coding Sheep = new Coding { Code = "125099002", Display = "sheep", System = "http://snomed.info/sct" }; /// <summary> /// /// </summary> public static readonly Coding Mule = new Coding { Code = "132950000", Display = "mule", System = "http://snomed.info/sct" }; /// <summary> /// /// </summary> public static readonly Coding Goose = new Coding { Code = "15778005", Display = "goose", System = "http://snomed.info/sct" }; /// <summary> /// /// </summary> public static readonly Coding Cow = new Coding { Code = "34618005", Display = "cow", System = "http://snomed.info/sct" }; /// <summary> /// /// </summary> public static readonly Coding Horse = new Coding { Code = "388445009", Display = "horse", System = "http://snomed.info/sct" }; /// <summary> /// /// </summary> public static readonly Coding Duck = new Coding { Code = "396620009", Display = "duck", System = "http://snomed.info/sct" }; /// <summary> /// /// </summary> public static readonly Coding Turkey = new Coding { Code = "425134008", Display = "turkey", System = "http://snomed.info/sct" }; /// <summary> /// /// </summary> public static readonly Coding Chicken = new Coding { Code = "47290002", Display = "chicken", System = "http://snomed.info/sct" }; /// <summary> /// /// </summary> public static readonly Coding Donkey = new Coding { Code = "85626006", Display = "donkey", System = "http://snomed.info/sct" }; /// <summary> /// Literal for code: Goat /// </summary> public const string LiteralGoat = "125097000"; /// <summary> /// Literal for code: Sheep /// </summary> public const string LiteralSheep = "125099002"; /// <summary> /// Literal for code: Mule /// </summary> public const string LiteralMule = "132950000"; /// <summary> /// Literal for code: Goose /// </summary> public const string LiteralGoose = "15778005"; /// <summary> /// Literal for code: Cow /// </summary> public const string LiteralCow = "34618005"; /// <summary> /// Literal for code: Horse /// </summary> public const string LiteralHorse = "388445009"; /// <summary> /// Literal for code: Duck /// </summary> public const string LiteralDuck = "396620009"; /// <summary> /// Literal for code: Turkey /// </summary> public const string LiteralTurkey = "425134008"; /// <summary> /// Literal for code: Chicken /// </summary> public const string LiteralChicken = "47290002"; /// <summary> /// Literal for code: Donkey /// </summary> public const string LiteralDonkey = "85626006"; }; }
using System; using Memoria.Prime.Collections; public static partial class FF9BattleDB { public static readonly TwoWayDictionary<Int32, String> GEO = new TwoWayDictionary<Int32, String>(true) { {240, "GEO_ACC_F0_BBT"}, {238, "GEO_ACC_F0_BBX"}, {227, "GEO_ACC_F0_BIN"}, {437, "GEO_ACC_F0_BLK"}, {226, "GEO_ACC_F0_BLL"}, {411, "GEO_ACC_F0_BON"}, {232, "GEO_ACC_F0_BOT"}, {16, "GEO_ACC_F0_BTN"}, {262, "GEO_ACC_F0_CBH"}, {395, "GEO_ACC_F0_CER"}, {365, "GEO_ACC_F0_CRS"}, {241, "GEO_ACC_F0_CSK"}, {234, "GEO_ACC_F0_CUP"}, {433, "GEO_ACC_F0_DAG"}, {35, "GEO_ACC_F0_DBR"}, {31, "GEO_ACC_F0_DGR"}, {622, "GEO_ACC_F0_DLB"}, {414, "GEO_ACC_F0_DLF"}, {536, "GEO_ACC_F0_EGG"}, {596, "GEO_ACC_F0_ELE"}, {242, "GEO_ACC_F0_ELV"}, {637, "GEO_ACC_F0_EYE"}, {3, "GEO_ACC_F0_FEL"}, {279, "GEO_ACC_F0_FIS"}, {6, "GEO_ACC_F0_FLR"}, {590, "GEO_ACC_F0_FS1"}, {589, "GEO_ACC_F0_FS2"}, {588, "GEO_ACC_F0_FS3"}, {406, "GEO_ACC_F0_GAB"}, {537, "GEO_ACC_F0_GAS"}, {638, "GEO_ACC_F0_GNT"}, {294, "GEO_ACC_F0_GRG"}, {223, "GEO_ACC_F0_GRS"}, {275, "GEO_ACC_F0_HDB"}, {434, "GEO_ACC_F0_HKG"}, {257, "GEO_ACC_F0_HOD"}, {641, "GEO_ACC_F0_HSK"}, {15, "GEO_ACC_F0_IFE"}, {636, "GEO_ACC_F0_IRF"}, {586, "GEO_ACC_F0_ISB"}, {276, "GEO_ACC_F0_ISI"}, {538, "GEO_ACC_F0_KGG"}, {439, "GEO_ACC_F0_KOM"}, {435, "GEO_ACC_F0_KOR"}, {438, "GEO_ACC_F0_KOS"}, {22, "GEO_ACC_F0_LDD"}, {408, "GEO_ACC_F0_LEV"}, {628, "GEO_ACC_F0_LG1"}, {627, "GEO_ACC_F0_LG2"}, {407, "GEO_ACC_F0_LIF"}, {377, "GEO_ACC_F0_LNW"}, {258, "GEO_ACC_F0_LTT"}, {409, "GEO_ACC_F0_MAK"}, {228, "GEO_ACC_F0_MAP"}, {134, "GEO_ACC_F0_MGP"}, {133, "GEO_ACC_F0_MGR"}, {415, "GEO_ACC_F0_NEP"}, {233, "GEO_ACC_F0_OPB"}, {487, "GEO_ACC_F0_ORD"}, {642, "GEO_ACC_F0_RBN"}, {224, "GEO_ACC_F0_ROP"}, {239, "GEO_ACC_F0_SSH"}, {555, "GEO_ACC_F0_STQ"}, {235, "GEO_ACC_F0_SUP"}, {243, "GEO_ACC_F0_SWD"}, {75, "GEO_ACC_F0_TBX"}, {609, "GEO_ACC_F0_TKE"}, {222, "GEO_ACC_F0_TKT"}, {625, "GEO_ACC_F0_TNB"}, {225, "GEO_ACC_F0_TNT"}, {436, "GEO_ACC_F0_TRK"}, {23, "GEO_ACC_F0_TSM"}, {277, "GEO_ACC_F0_TUR"}, {231, "GEO_ACC_F0_V01"}, {230, "GEO_ACC_F0_V02"}, {229, "GEO_ACC_F0_V03"}, {200, "GEO_ACC_F0_V10"}, {488, "GEO_ACC_F0_V11"}, {508, "GEO_ACC_F0_WEA"}, {489, "GEO_ACC_F0_WRE"}, {626, "GEO_ACC_F0_WT0"}, {632, "GEO_ACC_F0_WT1"}, {631, "GEO_ACC_F0_WT2"}, {630, "GEO_ACC_F0_WT3"}, {523, "GEO_ACC_F0_YIB"}, {640, "GEO_ACC_F0_YRI"}, {490, "GEO_ACC_F0_ZBR"}, {577, "GEO_ACC_F1_BLL"}, {393, "GEO_ACC_F1_BTN"}, {306, "GEO_ACC_F1_GRG"}, {525, "GEO_ACC_F1_HDB"}, {633, "GEO_ACC_F1_HKG"}, {587, "GEO_ACC_F1_ISB"}, {396, "GEO_ACC_F1_LTT"}, {679, "GEO_ACC_F1_MGP"}, {236, "GEO_ACC_F1_SUP"}, {681, "GEO_ACC_F1_SWD"}, {91, "GEO_ACC_F1_TBX"}, {397, "GEO_ACC_F1_TKT"}, {578, "GEO_ACC_F2_BLL"}, {394, "GEO_ACC_F2_BTN"}, {634, "GEO_ACC_F2_HKG"}, {680, "GEO_ACC_F2_LTT"}, {237, "GEO_ACC_F2_SUP"}, {701, "GEO_ACC_F2_TBX"}, {579, "GEO_ACC_F3_BLL"}, {635, "GEO_ACC_F3_HKG"}, {702, "GEO_ACC_F3_TBX"}, {5414, "GEO_MAIN_B0_000"}, {285, "GEO_MAIN_B0_001"}, {281, "GEO_MAIN_B0_002"}, {283, "GEO_MAIN_B0_003"}, {288, "GEO_MAIN_B0_004"}, {287, "GEO_MAIN_B0_005"}, {5415, "GEO_MAIN_B0_006"}, {286, "GEO_MAIN_B0_007"}, {289, "GEO_MAIN_B0_008"}, {284, "GEO_MAIN_B0_009"}, {291, "GEO_MAIN_B0_010"}, {290, "GEO_MAIN_B0_011"}, {444, "GEO_MAIN_B0_012"}, {39, "GEO_MAIN_B0_013"}, {45, "GEO_MAIN_B0_014"}, {42, "GEO_MAIN_B0_015"}, {608, "GEO_MAIN_B0_016"}, {358, "GEO_MAIN_B0_017"}, {655, "GEO_MAIN_B0_018"}, {581, "GEO_MAIN_B0_022"}, {580, "GEO_MAIN_B0_023"}, {583, "GEO_MAIN_B0_024"}, {602, "GEO_MAIN_B0_025"}, {582, "GEO_MAIN_B0_026"}, {601, "GEO_MAIN_B0_027"}, {584, "GEO_MAIN_B0_028"}, {606, "GEO_MAIN_B0_029"}, {607, "GEO_MAIN_B0_030"}, {645, "GEO_MAIN_B0_031"}, {644, "GEO_MAIN_B0_032"}, {585, "GEO_MAIN_B0_033"}, {648, "GEO_MAIN_B0_034"}, {29, "GEO_MAIN_B2_001"}, {568, "GEO_MAIN_B2_002"}, {513, "GEO_MAIN_B2_003"}, {30, "GEO_MAIN_B2_005"}, {554, "GEO_MAIN_B2_007"}, {293, "GEO_MAIN_B2_009"}, {565, "GEO_MAIN_B2_011"}, {448, "GEO_MAIN_B2_012"}, {510, "GEO_MAIN_B2_014"}, {449, "GEO_MAIN_B2_016"}, {280, "GEO_MAIN_B2_017"}, {263, "GEO_MAIN_B2_018"}, {292, "GEO_MAIN_B2_019"}, {562, "GEO_MAIN_B2_020"}, {561, "GEO_MAIN_B2_021"}, {560, "GEO_MAIN_B2_022"}, {695, "GEO_MAIN_B2_023"}, {696, "GEO_MAIN_B2_024"}, {650, "GEO_MAIN_B2_026"}, {511, "GEO_MAIN_B2_027"}, {563, "GEO_MAIN_B2_028"}, {649, "GEO_MAIN_B2_CAM"}, {652, "GEO_MAIN_B4_002"}, {651, "GEO_MAIN_B4_003"}, {653, "GEO_MAIN_B4_004"}, {654, "GEO_MAIN_B4_005"}, {656, "GEO_MAIN_B4_006"}, {657, "GEO_MAIN_B4_007"}, {443, "GEO_MAIN_F0_EIK"}, {192, "GEO_MAIN_F0_FRJ"}, {185, "GEO_MAIN_F0_GRN"}, {273, "GEO_MAIN_F0_KUI"}, {509, "GEO_MAIN_F0_SLM"}, {526, "GEO_MAIN_F0_STD"}, {5489, "GEO_MAIN_F0_STN"}, {8, "GEO_MAIN_F0_VIV"}, {532, "GEO_MAIN_F0_ZDD"}, {98, "GEO_MAIN_F0_ZDN"}, {76, "GEO_MAIN_F1_GRN"}, {658, "GEO_MAIN_F1_STN"}, {203, "GEO_MAIN_F1_ZDN"}, {432, "GEO_MAIN_F2_ZDN"}, {202, "GEO_MAIN_F3_GRN"}, {668, "GEO_MAIN_F3_ZDN"}, {205, "GEO_MAIN_F4_GRN"}, {669, "GEO_MAIN_F4_ZDN"}, {419, "GEO_MAIN_F5_GRN"}, {670, "GEO_MAIN_F5_ZDN"}, {662, "GEO_MAIN_F7_VIV"}, {666, "GEO_MAIN_F8_GRN"}, {381, "GEO_MAIN_F9_GRN"}, {7, "GEO_MON_B3_000"}, {152, "GEO_MON_B3_001"}, {151, "GEO_MON_B3_002"}, {58, "GEO_MON_B3_003"}, {9, "GEO_MON_B3_004"}, {155, "GEO_MON_B3_005"}, {154, "GEO_MON_B3_006"}, {153, "GEO_MON_B3_007"}, {157, "GEO_MON_B3_008"}, {156, "GEO_MON_B3_009"}, {159, "GEO_MON_B3_010"}, {5458, "GEO_MON_B3_011"}, {158, "GEO_MON_B3_012"}, {59, "GEO_MON_B3_013"}, {60, "GEO_MON_B3_014"}, {162, "GEO_MON_B3_015"}, {161, "GEO_MON_B3_016"}, {160, "GEO_MON_B3_017"}, {163, "GEO_MON_B3_018"}, {5459, "GEO_MON_B3_019"}, {28, "GEO_MON_B3_020"}, {5460, "GEO_MON_B3_021"}, {135, "GEO_MON_B3_022"}, {105, "GEO_MON_B3_023"}, {139, "GEO_MON_B3_024"}, {138, "GEO_MON_B3_025"}, {137, "GEO_MON_B3_026"}, {136, "GEO_MON_B3_027"}, {141, "GEO_MON_B3_028"}, {140, "GEO_MON_B3_029"}, {145, "GEO_MON_B3_030"}, {144, "GEO_MON_B3_031"}, {143, "GEO_MON_B3_032"}, {142, "GEO_MON_B3_033"}, {149, "GEO_MON_B3_034"}, {148, "GEO_MON_B3_035"}, {147, "GEO_MON_B3_036"}, {146, "GEO_MON_B3_037"}, {57, "GEO_MON_B3_038"}, {150, "GEO_MON_B3_039"}, {86, "GEO_MON_B3_040"}, {85, "GEO_MON_B3_041"}, {84, "GEO_MON_B3_042"}, {46, "GEO_MON_B3_043"}, {90, "GEO_MON_B3_044"}, {89, "GEO_MON_B3_045"}, {88, "GEO_MON_B3_046"}, {87, "GEO_MON_B3_047"}, {93, "GEO_MON_B3_048"}, {92, "GEO_MON_B3_049"}, {96, "GEO_MON_B3_050"}, {47, "GEO_MON_B3_051"}, {95, "GEO_MON_B3_052"}, {94, "GEO_MON_B3_053"}, {184, "GEO_MON_B3_054"}, {261, "GEO_MON_B3_055"}, {97, "GEO_MON_B3_056"}, {221, "GEO_MON_B3_057"}, {266, "GEO_MON_B3_058"}, {265, "GEO_MON_B3_059"}, {79, "GEO_MON_B3_060"}, {244, "GEO_MON_B3_061"}, {78, "GEO_MON_B3_062"}, {77, "GEO_MON_B3_063"}, {82, "GEO_MON_B3_064"}, {323, "GEO_MON_B3_065"}, {81, "GEO_MON_B3_066"}, {80, "GEO_MON_B3_067"}, {324, "GEO_MON_B3_068"}, {325, "GEO_MON_B3_069"}, {328, "GEO_MON_B3_070"}, {327, "GEO_MON_B3_071"}, {83, "GEO_MON_B3_072"}, {326, "GEO_MON_B3_073"}, {329, "GEO_MON_B3_074"}, {332, "GEO_MON_B3_075"}, {331, "GEO_MON_B3_076"}, {330, "GEO_MON_B3_077"}, {334, "GEO_MON_B3_078"}, {333, "GEO_MON_B3_079"}, {335, "GEO_MON_B3_080"}, {337, "GEO_MON_B3_081"}, {164, "GEO_MON_B3_082"}, {336, "GEO_MON_B3_083"}, {339, "GEO_MON_B3_084"}, {338, "GEO_MON_B3_085"}, {165, "GEO_MON_B3_086"}, {340, "GEO_MON_B3_087"}, {341, "GEO_MON_B3_088"}, {166, "GEO_MON_B3_092"}, {342, "GEO_MON_B3_093"}, {343, "GEO_MON_B3_094"}, {379, "GEO_MON_B3_102"}, {344, "GEO_MON_B3_103"}, {301, "GEO_MON_B3_105"}, {359, "GEO_MON_B3_106"}, {428, "GEO_MON_B3_107"}, {345, "GEO_MON_B3_108"}, {5461, "GEO_MON_F0_EFM"}, {347, "GEO_MON_F2_EFM"}, {450, "GEO_MON_B3_111"}, {346, "GEO_MON_B3_112"}, {125, "GEO_MON_B3_113"}, {349, "GEO_MON_B3_114"}, {278, "GEO_MON_B3_115"}, {593, "GEO_MON_B3_116"}, {348, "GEO_MON_B3_117"}, {350, "GEO_MON_B3_118"}, {302, "GEO_MON_B3_119"}, {300, "GEO_MON_B3_120"}, {352, "GEO_MON_B3_121"}, {410, "GEO_MON_B3_122"}, {362, "GEO_MON_B3_123"}, {363, "GEO_MON_B3_124"}, {5, "GEO_MON_B3_125"}, {353, "GEO_MON_B3_126"}, {556, "GEO_MON_B3_127"}, {512, "GEO_MON_B3_128"}, {354, "GEO_MON_B3_130"}, {371, "GEO_MON_B3_131"}, {364, "GEO_MON_B3_132"}, {36, "GEO_MON_B3_136"}, {416, "GEO_MON_B3_137"}, {545, "GEO_MON_B3_138"}, {351, "GEO_MON_B3_140"}, {38, "GEO_MON_B3_141"}, {378, "GEO_MON_B3_142"}, {370, "GEO_MON_B3_143"}, {567, "GEO_MON_B3_144"}, {566, "GEO_MON_B3_145"}, {576, "GEO_MON_B3_146"}, {0, "GEO_MON_B3_147"}, {298, "GEO_MON_B3_148"}, {557, "GEO_MON_B3_149"}, {558, "GEO_MON_B3_151"}, {299, "GEO_MON_B3_152"}, {592, "GEO_MON_B3_154"}, {427, "GEO_MON_B3_155"}, {399, "GEO_MON_B3_156"}, {398, "GEO_MON_B3_157"}, {400, "GEO_MON_B3_158"}, {405, "GEO_MON_B3_159"}, {402, "GEO_MON_B3_160"}, {548, "GEO_MON_B3_161"}, {401, "GEO_MON_B3_162"}, {553, "GEO_MON_B3_163"}, {404, "GEO_MON_B3_164"}, {403, "GEO_MON_B3_165"}, {355, "GEO_MON_B3_166"}, {369, "GEO_MON_B3_167"}, {569, "GEO_MON_B3_168"}, {671, "GEO_MON_B3_169"}, {571, "GEO_MON_B3_170"}, {296, "GEO_MON_B3_171"}, {295, "GEO_MON_B3_172"}, {570, "GEO_MON_B3_173"}, {297, "GEO_MON_B3_174"}, {572, "GEO_MON_B3_175"}, {610, "GEO_MON_B3_176"}, {591, "GEO_MON_B3_177"}, {304, "GEO_MON_B3_178"}, {303, "GEO_MON_B3_179"}, {305, "GEO_MON_B3_180"}, {445, "GEO_MON_B3_181"}, {573, "GEO_MON_B3_182"}, {429, "GEO_MON_B3_183"}, {430, "GEO_MON_B3_184"}, {446, "GEO_MON_B3_185"}, // Garland {1, "GEO_MON_B3_186"}, {356, "GEO_MON_B3_187"}, {357, "GEO_MON_B3_188"}, {546, "GEO_MON_B3_189"}, {451, "GEO_MON_B3_190"}, {620, "GEO_MON_B3_191"}, {619, "GEO_MON_B3_192"}, {618, "GEO_MON_B3_193"}, {621, "GEO_MON_B3_194"}, {639, "GEO_MON_B3_195"}, {14, "GEO_MON_B3_196"}, {663, "GEO_MON_B3_197"}, {664, "GEO_MON_B3_198"}, {672, "GEO_MON_B3_199"}, {673, "GEO_MON_B3_200"}, {697, "GEO_MON_B3_201"}, {698, "GEO_MON_B3_202"}, {699, "GEO_MON_B3_203"}, {700, "GEO_MON_B3_204"}, {676, "GEO_MON_B3_205"}, {252, "GEO_MON_F0_AMD"}, {617, "GEO_MON_F0_AMS"}, {246, "GEO_MON_F0_BAN"}, {245, "GEO_MON_F0_BFF"}, {616, "GEO_MON_F0_CDR"}, {442, "GEO_MON_F0_CLB"}, {533, "GEO_MON_F0_DAH"}, {271, "GEO_MON_F0_DDD"}, {528, "GEO_MON_F0_DRA"}, {529, "GEO_MON_F0_EEE"}, {33, "GEO_MON_F0_EFM"}, {530, "GEO_MON_F0_FFF"}, {247, "GEO_MON_F0_FFG"}, {254, "GEO_MON_F0_GRI"}, {575, "GEO_MON_F0_HHP"}, {255, "GEO_MON_F0_KAT"}, {574, "GEO_MON_F0_MKM"}, {256, "GEO_MON_F0_MOS"}, {248, "GEO_MON_F0_MUU"}, {534, "GEO_MON_F0_RAM"}, {4, "GEO_MON_F0_SDR"}, {249, "GEO_MON_F0_TBL"}, {250, "GEO_MON_F0_TOM"}, {535, "GEO_MON_F0_WWW"}, {2, "GEO_MON_F0_ZZZ"}, {524, "GEO_MON_F1_EFM"}, {251, "GEO_MON_F1_TOM"}, {201, "GEO_MON_F2_EFM"}, {24, "GEO_NPC_F0_APF"}, {111, "GEO_NPC_F0_APM"}, {173, "GEO_NPC_F0_BAR"}, {112, "GEO_NPC_F0_BBA"}, {5468, "GEO_NPC_F0_BMG"}, {113, "GEO_NPC_F0_BND"}, {114, "GEO_NPC_F0_BRI"}, {206, "GEO_NPC_F0_BUC"}, {216, "GEO_NPC_F0_BUF"}, {115, "GEO_NPC_F0_CAT"}, {63, "GEO_NPC_F0_CCB"}, {260, "GEO_NPC_F0_CHC"}, {542, "GEO_NPC_F0_CHD"}, {623, "GEO_NPC_F0_CHE"}, {259, "GEO_NPC_F0_CHO"}, {272, "GEO_NPC_F0_CLD"}, {447, "GEO_NPC_F0_CLM"}, {5474, "GEO_NPC_F0_COK"}, {194, "GEO_NPC_F0_CSA"}, {208, "GEO_NPC_F0_CSM"}, {217, "GEO_NPC_F0_CSO"}, {49, "GEO_NPC_F0_DAC"}, {55, "GEO_NPC_F0_DAF"}, {50, "GEO_NPC_F0_DAL"}, {64, "GEO_NPC_F0_DAW"}, {420, "GEO_NPC_F0_DOC"}, {421, "GEO_NPC_F0_DOF"}, {193, "GEO_NPC_F0_DOG"}, {268, "GEO_NPC_F0_DOK"}, {422, "GEO_NPC_F0_DOM"}, {269, "GEO_NPC_F0_FLS"}, {174, "GEO_NPC_F0_FRC"}, {175, "GEO_NPC_F0_FRF"}, {176, "GEO_NPC_F0_FRM"}, {209, "GEO_NPC_F0_FUK"}, {177, "GEO_NPC_F0_G16"}, {56, "GEO_NPC_F0_G17"}, {5476, "GEO_NPC_F0_G18"}, {417, "GEO_NPC_F0_G19"}, {213, "GEO_NPC_F0_G20"}, {195, "GEO_NPC_F0_GUD"}, {116, "GEO_NPC_F0_HEK"}, {412, "GEO_NPC_F0_HTH"}, {51, "GEO_NPC_F0_HUF"}, {5478, "GEO_NPC_F0_HUM"}, {117, "GEO_NPC_F0_JJY"}, {52, "GEO_NPC_F0_KAC"}, {220, "GEO_NPC_F0_MOG"}, {431, "GEO_NPC_F0_NAN"}, {118, "GEO_NPC_F0_OFF"}, {65, "GEO_NPC_F0_ORC"}, {187, "GEO_NPC_F0_OSC"}, {66, "GEO_NPC_F0_RAS"}, {119, "GEO_NPC_F0_RMF"}, {120, "GEO_NPC_F0_RMM"}, {121, "GEO_NPC_F0_RTC"}, {210, "GEO_NPC_F0_STR"}, {178, "GEO_NPC_F0_TAD"}, {32, "GEO_NPC_F0_TBY"}, {122, "GEO_NPC_F0_TCK"}, {5492, "GEO_NPC_F0_TGR"}, {123, "GEO_NPC_F0_TMF"}, {124, "GEO_NPC_F0_TMM"}, {67, "GEO_NPC_F0_TRF"}, {126, "GEO_NPC_F0_WRK"}, {646, "GEO_NPC_F1_APF"}, {559, "GEO_NPC_F1_APM"}, {68, "GEO_NPC_F1_BAR"}, {10, "GEO_NPC_F1_BBA"}, {53, "GEO_NPC_F1_BMG"}, {127, "GEO_NPC_F1_BND"}, {128, "GEO_NPC_F1_BRI"}, {624, "GEO_NPC_F1_CAT"}, {69, "GEO_NPC_F1_CCB"}, {100, "GEO_NPC_F1_CHO"}, {70, "GEO_NPC_F1_CSA"}, {188, "GEO_NPC_F1_CSM"}, {71, "GEO_NPC_F1_CSO"}, {180, "GEO_NPC_F1_DAC"}, {604, "GEO_NPC_F1_DAF"}, {179, "GEO_NPC_F1_DAL"}, {549, "GEO_NPC_F1_DOC"}, {550, "GEO_NPC_F1_DOF"}, {611, "GEO_NPC_F1_DOG"}, {564, "GEO_NPC_F1_DOK"}, {551, "GEO_NPC_F1_DOM"}, {423, "GEO_NPC_F1_FRM"}, {543, "GEO_NPC_F1_G17"}, {612, "GEO_NPC_F1_G20"}, {598, "GEO_NPC_F1_GUD"}, {547, "GEO_NPC_F1_HTH"}, {99, "GEO_NPC_F1_HUF"}, {110, "GEO_NPC_F1_HUM"}, {647, "GEO_NPC_F1_JJY"}, {677, "GEO_NPC_F1_KAC"}, {129, "GEO_NPC_F1_MOG"}, {20, "GEO_NPC_F1_OFF"}, {544, "GEO_NPC_F1_OSC"}, {181, "GEO_NPC_F1_RAS"}, {424, "GEO_NPC_F1_TBY"}, {11, "GEO_NPC_F1_TCK"}, {418, "GEO_NPC_F1_TGR"}, {19, "GEO_NPC_F1_TMF"}, {18, "GEO_NPC_F1_TMM"}, {103, "GEO_NPC_F1_WRK"}, {253, "GEO_NPC_F2_APF"}, {17, "GEO_NPC_F2_APM"}, {12, "GEO_NPC_F2_BBA"}, {54, "GEO_NPC_F2_BMG"}, {130, "GEO_NPC_F2_BND"}, {613, "GEO_NPC_F2_CHO"}, {211, "GEO_NPC_F2_CSA"}, {189, "GEO_NPC_F2_CSM"}, {218, "GEO_NPC_F2_CSO"}, {643, "GEO_NPC_F2_DAC"}, {603, "GEO_NPC_F2_DAL"}, {552, "GEO_NPC_F2_DOM"}, {25, "GEO_NPC_F2_G17"}, {26, "GEO_NPC_F2_G20"}, {104, "GEO_NPC_F2_HTH"}, {72, "GEO_NPC_F2_HUF"}, {108, "GEO_NPC_F2_HUM"}, {376, "GEO_NPC_F2_JJY"}, {678, "GEO_NPC_F2_KAC"}, {196, "GEO_NPC_F2_MOG"}, {21, "GEO_NPC_F2_OSC"}, {27, "GEO_NPC_F2_TBY"}, {40, "GEO_NPC_F2_TGR"}, {101, "GEO_NPC_F3_APM"}, {13, "GEO_NPC_F3_BBA"}, {131, "GEO_NPC_F3_BND"}, {614, "GEO_NPC_F3_CHO"}, {73, "GEO_NPC_F3_CSA"}, {197, "GEO_NPC_F3_CSM"}, {219, "GEO_NPC_F3_CSO"}, {597, "GEO_NPC_F3_HUF"}, {599, "GEO_NPC_F3_JJY"}, {212, "GEO_NPC_F3_MOG"}, {34, "GEO_NPC_F3_TBY"}, {61, "GEO_NPC_F3_TGR"}, {183, "GEO_NPC_F4_APM"}, {132, "GEO_NPC_F4_BND"}, {615, "GEO_NPC_F4_CHO"}, {74, "GEO_NPC_F4_CSA"}, {282, "GEO_NPC_F4_CSM"}, {182, "GEO_NPC_F4_CSO"}, {102, "GEO_NPC_F4_JJY"}, {198, "GEO_NPC_F4_MOG"}, {674, "GEO_NPC_F5_CSA"}, {360, "GEO_NPC_F5_CSM"}, {199, "GEO_NPC_F5_MOG"}, {675, "GEO_NPC_F6_CSA"}, {361, "GEO_NPC_F6_CSM"}, {600, "GEO_NPC_F7_CSM"}, {5464, "GEO_SUB_F0_BAK"}, {5467, "GEO_SUB_F0_BLN"}, {106, "GEO_SUB_F0_BRN"}, {204, "GEO_SUB_F0_BTX"}, {169, "GEO_SUB_F0_BW1"}, {168, "GEO_SUB_F0_BW2"}, {167, "GEO_SUB_F0_BW3"}, {170, "GEO_SUB_F0_CDW"}, {270, "GEO_SUB_F0_CID"}, {107, "GEO_SUB_F0_CNA"}, {380, "GEO_SUB_F0_FLT"}, {382, "GEO_SUB_F0_GRL"}, {267, "GEO_SUB_F0_KJA"}, {531, "GEO_SUB_F0_KJG"}, {215, "GEO_SUB_F0_KUT"}, {214, "GEO_SUB_F0_KUW"}, {665, "GEO_SUB_F0_MOM"}, {109, "GEO_SUB_F0_MRC"}, {62, "GEO_SUB_F0_NTA"}, {540, "GEO_SUB_F0_NTB"}, {539, "GEO_SUB_F0_NTC"}, {541, "GEO_SUB_F0_NTD"}, {48, "GEO_SUB_F0_RBY"}, {368, "GEO_SUB_F0_SBW"}, {5488, "GEO_SUB_F0_SSB"}, {171, "GEO_SUB_F0_TOT"}, {5500, "GEO_SUB_F0_ZNR"}, {172, "GEO_SUB_F0_ZON"}, {5501, "GEO_SUB_F1_BAK"}, {190, "GEO_SUB_F1_BLN"}, {207, "GEO_SUB_F1_BW3"}, {425, "GEO_SUB_F1_CID"}, {5505, "GEO_SUB_F1_SSB"}, {274, "GEO_SUB_F1_ZON"}, {186, "GEO_SUB_F2_BAK"}, {191, "GEO_SUB_F2_CID"}, {5509, "GEO_SUB_F2_SSB"}, {667, "GEO_SUB_F3_KJA"}, {5511, "GEO_SUB_F3_SSB"}, {426, "GEO_SUB_F4_SSB"}, {659, "GEO_SUB_F7_BLN"}, {661, "GEO_SUB_F7_CNA"}, {660, "GEO_SUB_F7_MRC"}, {310, "GEO_SUB_W0_001"}, {309, "GEO_SUB_W0_002"}, {308, "GEO_SUB_W0_003"}, {375, "GEO_SUB_W0_004"}, {374, "GEO_SUB_W0_005"}, {373, "GEO_SUB_W0_006"}, {372, "GEO_SUB_W0_007"}, {321, "GEO_SUB_W0_008"}, {320, "GEO_SUB_W0_009"}, {317, "GEO_SUB_W0_010"}, {307, "GEO_SUB_W0_011"}, {41, "GEO_SUB_W0_012"}, {316, "GEO_SUB_W0_013"}, {319, "GEO_SUB_W0_015"}, {318, "GEO_SUB_W0_016"}, {315, "GEO_SUB_W0_018"}, {314, "GEO_SUB_W0_019"}, {313, "GEO_SUB_W0_021"}, {312, "GEO_SUB_W0_022"}, {311, "GEO_SUB_W0_023"}, {452, "GEO_SUB_W0_025"}, {37, "GEO_WEP_B1_011"}, {476, "GEO_WEP_B1_012"}, {475, "GEO_WEP_B1_013"}, {501, "GEO_WEP_B1_014"}, {477, "GEO_WEP_B1_015"}, {441, "GEO_WEP_B1_016"}, {527, "GEO_WEP_B1_017"}, {522, "GEO_WEP_B1_018"}, {521, "GEO_WEP_B1_019"}, {517, "GEO_WEP_B1_020"}, {516, "GEO_WEP_B1_021"}, {515, "GEO_WEP_B1_022"}, {514, "GEO_WEP_B1_023"}, {520, "GEO_WEP_B1_024"}, {519, "GEO_WEP_B1_025"}, {518, "GEO_WEP_B1_026"}, {366, "GEO_WEP_B1_027"}, {385, "GEO_WEP_B1_028"}, {384, "GEO_WEP_B1_029"}, {389, "GEO_WEP_B1_030"}, {388, "GEO_WEP_B1_031"}, {387, "GEO_WEP_B1_032"}, {386, "GEO_WEP_B1_033"}, {392, "GEO_WEP_B1_034"}, {391, "GEO_WEP_B1_035"}, {629, "GEO_WEP_B1_036"}, {390, "GEO_WEP_B1_037"}, {367, "GEO_WEP_B1_038"}, {595, "GEO_WEP_B1_039"}, {383, "GEO_WEP_B1_040"}, {594, "GEO_WEP_B1_041"}, {465, "GEO_WEP_B1_042"}, {496, "GEO_WEP_B1_043"}, {468, "GEO_WEP_B1_044"}, {497, "GEO_WEP_B1_045"}, {467, "GEO_WEP_B1_046"}, {466, "GEO_WEP_B1_047"}, {470, "GEO_WEP_B1_048"}, {469, "GEO_WEP_B1_049"}, {605, "GEO_WEP_B1_050"}, {413, "GEO_WEP_B1_051"}, {471, "GEO_WEP_B1_052"}, {498, "GEO_WEP_B1_053"}, {500, "GEO_WEP_B1_054"}, {472, "GEO_WEP_B1_055"}, {440, "GEO_WEP_B1_056"}, {499, "GEO_WEP_B1_057"}, {474, "GEO_WEP_B1_058"}, {473, "GEO_WEP_B1_059"}, {456, "GEO_WEP_B1_060"}, {455, "GEO_WEP_B1_061"}, {454, "GEO_WEP_B1_062"}, {453, "GEO_WEP_B1_063"}, {460, "GEO_WEP_B1_064"}, {459, "GEO_WEP_B1_065"}, {458, "GEO_WEP_B1_066"}, {457, "GEO_WEP_B1_067"}, {461, "GEO_WEP_B1_068"}, {491, "GEO_WEP_B1_069"}, {493, "GEO_WEP_B1_070"}, {492, "GEO_WEP_B1_071"}, {463, "GEO_WEP_B1_072"}, {462, "GEO_WEP_B1_073"}, {464, "GEO_WEP_B1_074"}, {44, "GEO_WEP_B1_075"}, {494, "GEO_WEP_B1_076"}, {43, "GEO_WEP_B1_077"}, {264, "GEO_WEP_B1_078"}, {495, "GEO_WEP_B1_079"}, {322, "GEO_WEP_B1_080"}, {478, "GEO_WEP_B1_081"}, {503, "GEO_WEP_B1_082"}, {502, "GEO_WEP_B1_083"}, {504, "GEO_WEP_B1_084"}, {481, "GEO_WEP_B1_085"}, {480, "GEO_WEP_B1_086"}, {479, "GEO_WEP_B1_087"}, {483, "GEO_WEP_B1_088"}, {482, "GEO_WEP_B1_089"}, {484, "GEO_WEP_B1_090"}, {507, "GEO_WEP_B1_091"}, {506, "GEO_WEP_B1_092"}, {505, "GEO_WEP_B1_093"}, {486, "GEO_WEP_B1_094"}, {485, "GEO_WEP_B1_095"} }; }
namespace Manatee.Wpf.Forms.ViewModel { public interface IFieldValidationRule<in T> { string Validate(T value); } }
using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Text; using System.Data.Common; //using Microsoft.Extensions.Logging.Abstractions; namespace inercya.EntityLite { public static class ConfigurationLite { static ConfigurationLite() { Profiler = new NullProfilerLite(); #if NET452 || NET35 LoggerFactory = new NLogFactory(); #elif NETSTANDARD2_0 LoggerFactory = new Microsoft.Extensions.Logging.Abstractions.NullLoggerFactory(); #endif DbProviderFactories = new inercya.EntityLite.DefaultDbProviderFactories(); DbProviderFactories.Register("System.Data.SqlClient", System.Data.SqlClient.SqlClientFactory.Instance); } public static IProfilerLite Profiler { get; set; } public static IDbProviderFactories DbProviderFactories { get; set; } public static ILoggerFactory LoggerFactory { get; set; } } }
using System; using System.Collections.Generic; namespace LinqFromScratch { public static class SampleData { public static readonly Employee[] EmployeeList = new[] { new Employee(){EmployeeId = 1, DepartmentId = 1, Name = "Eddie Van Halen"}, new Employee(){EmployeeId = 2, DepartmentId = 2, Name = "Alex Van Halen"}, new Employee(){EmployeeId = 7, DepartmentId = 4, Name = "Wolfgang Van Halen"}, new Employee(){EmployeeId = 3, DepartmentId = 3, Name = "David Lee Roth"}, new Employee(){EmployeeId = 4, DepartmentId = 4, Name = "Michael Anthony"}, new Employee(){EmployeeId = 5, DepartmentId = 3, Name = "Sammy Hagar"}, new Employee(){EmployeeId = 6, DepartmentId = 3, Name = "Gary Cherone"}, }; public static readonly Department[] DepartmentList = new[] { new Department() { DepartmentId = 1, ParentId = null, Name = "Dept. of redefining the very meaning of rock guitar" }, new Department() { DepartmentId = 2, ParentId = null, Name = "Dept. of fractal-complexity percussion" }, new Department() { DepartmentId = 3, ParentId = 1, Name = "Dept. of frontmanology" }, new Department() { DepartmentId = 4, ParentId = 2, Name = "Dept. of deep rumblings" }, }; public static readonly IEnumerable<int> IntList = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; public static readonly Tuple<int, int, int, int>[] SortableData = new[] { new Tuple<int,int,int,int>(3, 3, 3, 3), new Tuple<int,int,int,int>(2, 3, 3, 3), new Tuple<int,int,int,int>(1, 3, 3, 3), new Tuple<int,int,int,int>(3, 2, 3, 3), new Tuple<int,int,int,int>(3, 1, 3, 3), new Tuple<int,int,int,int>(3, 3, 2, 3), new Tuple<int,int,int,int>(3, 3, 1, 3), new Tuple<int,int,int,int>(3, 3, 3, 2), new Tuple<int,int,int,int>(3, 3, 3, 1), }; } }
using System; using DataApi.Network.Messages; using NetworkCommsDotNet; namespace DataApi.Network.Wrapper { public class NetworkManager : INetworkManager { private readonly NetworkConfiguration _networkConfiguration; public NetworkManager(NetworkConfiguration networkConfiguration) { _networkConfiguration = networkConfiguration; } public void SendMessage<T>(T message) where T : INetworkMessage { try { NetworkComms.SendObject(message.GetType().Name, _networkConfiguration.Address, _networkConfiguration.Port, message); } catch (CommsException e) { Console.WriteLine("Network Exception: " + e.Message); } } public void AddMessageHandler<T>(NetworkComms.PacketHandlerCallBackDelegate<T> callback) { try { NetworkComms.AppendGlobalIncomingPacketHandler(typeof(T).Name, callback); } catch (CommsException e) { Console.WriteLine("Network Exception : " + e.Message); } } } }
using FatecMauaJobNewsletter.Domains.Contexts; using FatecMauaJobNewsletter.Domains.Models; using FatecMauaJobNewsletter.Repositories.Interfaces; using System.Linq; namespace FatecMauaJobNewsletter.Repositories { public class UserRepository : Repository<User>, IUserRepository { public UserRepository(DBContext context) : base(context) { } public User FindByLoginAndPassword(string login, byte[] password) { return Query() .Where(x => x.Login.Equals(login) && x.Password.Equals(password)) .FirstOrDefault(); } public User FindByLogin(string login) { return Query() .Where(x => x.Login.Equals(login)) .FirstOrDefault(); } } }
using System; using System.Collections.Generic; namespace ServiceStack.OrmLite { public interface IDynamicRow { Type Type { get; } } public interface IDynamicRow<T> : IDynamicRow { T Fields { get; } } public struct DictionaryRow : IDynamicRow<Dictionary<string,object>> { public Type Type { get; } public Dictionary<string, object> Fields { get; } public DictionaryRow(Type type, Dictionary<string, object> fields) { Type = type; Fields = fields; } } public struct ObjectRow : IDynamicRow<object> { public Type Type { get; } public object Fields { get; } public ObjectRow(Type type, object fields) { Type = type; Fields = fields; } } public static class DynamicRowUtils { internal static object ToFilterType<T>(this object row) => ToFilterType(row, typeof(T)); internal static object ToFilterType(this object row, Type type) => row == null ? null : type.IsInstanceOfType(row) ? row : row switch { Dictionary<string, object> obj => new DictionaryRow(type, obj), _ => new ObjectRow(type, row), }; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace HKH.Exchange.Test { public class Student { public string Name { get; set; } public string ClassName { get; set; } public DateTime Birthday { get; set; } public string Name2 { get; set; } public double Total { get; set; } } public class Grade { public string ClassId { get; set; } public string StudentId { get; set; } public int Net { get; set; } public int Java { get; set; } public int Html { get; set; } //for test public string Name { get; set; } public string Brand { get; set; } public string Spec { get; set; } public string UnitName { get; set; } public int Quantity { get; set; } public double Price { get; set; } } }
// <copyright file="GroupBuilderSupport.cs" company="Fubar Development Junker"> // Copyright (c) 2016 Fubar Development Junker. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // </copyright> using System; using BeanIO.Internal.Config; using BeanIO.Internal.Config.Annotation; namespace BeanIO.Builder { /// <summary> /// Support for segment configuration builders. /// </summary> /// <typeparam name="T">The class derived from <see cref="GroupBuilderSupport{T,TConfig}"/>.</typeparam> /// <typeparam name="TConfig">The configuration class derived from <see cref="GroupConfig"/>.</typeparam> public abstract class GroupBuilderSupport<T, TConfig> : PropertyBuilderSupport<T, TConfig> where T : GroupBuilderSupport<T, TConfig> where TConfig : GroupConfig { /// <summary> /// Adds a group to this component. /// </summary> /// <param name="group">the group to add</param> /// <returns>The value of <see cref="PropertyBuilderSupport{T,TConfig}.Me"/></returns> public T AddGroup(GroupBuilder group) { Config.Add(group.Build()); return Me; } /// <summary> /// Adds a group to this component by using the group annotation for the given type. /// </summary> /// <param name="group">The type that has group annotations</param> /// <returns>The value of <see cref="PropertyBuilderSupport{T,TConfig}.Me"/></returns> public T AddGroup(Type group) { var gc = AnnotationParser.CreateGroupConfig(group); if (gc == null) throw new BeanIOConfigurationException($"Group annotation not detected on class '{group}'"); Config.Add(gc); return Me; } /// <summary> /// Adds a record to this component. /// </summary> /// <param name="record">the record to add</param> /// <returns>The value of <see cref="PropertyBuilderSupport{T,TConfig}.Me"/></returns> public T AddRecord(RecordBuilder record) { Config.Add(record.Build()); return Me; } /// <summary> /// Adds a group to this component by using the record annotation for the given type. /// </summary> /// <param name="record">The type that has record annotations</param> /// <returns>The value of <see cref="PropertyBuilderSupport{T,TConfig}.Me"/></returns> public T AddRecord(Type record) { var gc = AnnotationParser.CreateRecordConfig(record); if (gc == null) throw new BeanIOConfigurationException($"Record annotation not detected on class '{record}'"); Config.Add(gc); return Me; } } }
using System; namespace Inflow.Modules.Wallets.Application.Wallets.DTO; internal class TransferDto { public string Type { get; set; } public Guid TransferId { get; set; } public Guid WalletId { get; set; } public decimal Amount { get; set; } public string Currency { get; set; } public string Name { get; set; } public DateTime CreatedAt { get; set; } }
using System.Runtime.InteropServices; using System.IO; using System; using Reign.Core; namespace Reign.Video { // Header version 2 [StructLayout(LayoutKind.Sequential)] struct PVRHeader { public uint HeaderLength; public uint Height; public uint Width; public uint NumMipmaps; public uint Flags; public uint DataLength; public uint BPP; public uint BitmaskRed; public uint BitmaskGreen; public uint BitmaskBlue; public uint BitmaskAlpha; public uint PVRTag; public uint NumSurfs; } // Header version 3 /*[StructLayout(LayoutKind.Sequential)] struct PVRHeader { public uint Version; public uint Flags; public ulong PixelFormat; public uint ColorSpace; public uint ChannelType; public uint Height; public uint Width; public uint Depth; public uint NumSurfaces; public uint NumFaces; public uint MIPMapCount; public uint MetaDataSize; }*/ public class ImagePVR : Image { #region Properties public const uint PVR_TEXTURE_FLAG_TYPE_MASK = 0xffu; // version 2 private const uint FOURCC_2BPP_RGB = uint.MaxValue; private const uint FOURCC_2BPP_RGBA = 24; private const uint FOURCC_4BPP_RGB = uint.MaxValue-1; private const uint FOURCC_4BPP_RGBA = 25; // version 3 /*private const uint FOURCC_2BPP_RGB = 0; private const uint FOURCC_2BPP_RGBA = 1; private const uint FOURCC_4BPP_RGB = 2; private const uint FOURCC_4BPP_RGBA = 3;*/ private const uint GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00u; private const uint GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 0x8C01u; private const uint GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02u; private const uint GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03u; public uint FormatGL {get; private set;} #endregion #region Constructors public ImagePVR(string filename, bool flip, Loader.LoadedCallbackMethod loadedCallback) { new StreamLoader(filename, delegate(object sender, bool succeeded) { if (succeeded) { init(((StreamLoader)sender).LoadedStream, flip, loadedCallback); } else { FailedToLoad = true; if (loadedCallback != null) loadedCallback(this, false); } }); } public ImagePVR(Stream stream, bool flip, Loader.LoadedCallbackMethod loadedCallback) { init(stream, flip, loadedCallback); } protected override void init(Stream stream, bool flip, Loader.LoadedCallbackMethod loadedCallback) { try { ImageType = ImageTypes.PVR; // Load Header var header = new PVRHeader(); var reader = new BinaryReader(stream); // Read header version 2 header.HeaderLength = reader.ReadUInt32(); header.Height = reader.ReadUInt32(); header.Width = reader.ReadUInt32(); header.NumMipmaps = reader.ReadUInt32(); header.Flags = reader.ReadUInt32(); header.DataLength = reader.ReadUInt32(); header.BPP = reader.ReadUInt32(); header.BitmaskRed = reader.ReadUInt32(); header.BitmaskGreen = reader.ReadUInt32(); header.BitmaskBlue = reader.ReadUInt32(); header.BitmaskAlpha = reader.ReadUInt32(); header.PVRTag = reader.ReadUInt32(); header.NumSurfs = reader.ReadUInt32(); // Read header version 3 /*header.Version = reader.ReadUInt32(); header.Flags = reader.ReadUInt32(); header.PixelFormat = reader.ReadUInt64(); header.ColorSpace = reader.ReadUInt32(); header.ChannelType = reader.ReadUInt32(); header.Height = reader.ReadUInt32(); header.Width = reader.ReadUInt32(); header.Depth = reader.ReadUInt32(); header.NumSurfaces = reader.ReadUInt32(); header.NumFaces = reader.ReadUInt32(); header.MIPMapCount = reader.ReadUInt32(); header.MetaDataSize = reader.ReadUInt32(); while (stream.Position <= stream.Length) { if (stream.Position + sizeof(int) > stream.Length) Debug.ThrowError("ImagePVR", "No data ID"); if (reader.ReadInt32() == Streams.MakeFourCC('P', 'V', 'R', (char)3)) break; } var key = reader.ReadUInt32(); var dSize = reader.ReadUInt32();*/ // Get Caps Compressed = true; // Get pixel format Size = new Size2((int)header.Width, (int)header.Height); int blockSize = 0, bpp = 0, blockWidth = 0, blockHeight = 0, blockDev = 1; //switch (header.PixelFormat)// version 3 switch (header.Flags & PVR_TEXTURE_FLAG_TYPE_MASK) { case FOURCC_2BPP_RGB: FormatGL = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG; blockSize = 8*4; blockWidth = 8; blockHeight = 4; bpp = 2; blockDev = 2; ImageFormat = ImageFormats.PVR_RGB_2; SurfaceFormat = SurfaceFormats.PVR_RGB_2; break; case FOURCC_2BPP_RGBA: FormatGL = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; blockSize = 8*4; blockWidth = 8; blockHeight = 4; bpp = 2; blockDev = 2; ImageFormat = ImageFormats.PVR_RGBA_2; SurfaceFormat = SurfaceFormats.PVR_RGBA_2; break; case FOURCC_4BPP_RGB: FormatGL = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; blockSize = 4*4; blockWidth = 4; blockHeight = 4; bpp = 4; ImageFormat = ImageFormats.PVR_RGB_4; SurfaceFormat = SurfaceFormats.PVR_RGB_4; break; case FOURCC_4BPP_RGBA: FormatGL = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; blockSize = 4*4; blockWidth = 4; blockHeight = 4; bpp = 4; ImageFormat = ImageFormats.PVR_RGBA_4; SurfaceFormat = SurfaceFormats.PVR_RGBA_4; break; default: Debug.ThrowError("ImagePVR", "Unsuported PVR Format"); break; } // Create Mipmaps header.NumMipmaps++; //Mipmaps = new Mipmap[header.MIPMapCount == 0 ? 1 : header.MIPMapCount];// version 3 Mipmaps = new Mipmap[header.NumMipmaps == 0 ? 1 : header.NumMipmaps]; var size = Size; for (int i = 0; i < Mipmaps.Length; ++i) { int width = (size.Width/blockWidth), height = (size.Height/blockHeight); if (width < 2) width = 2; if (height < 2) height = 2; int dataSize = (width * height) * ((blockSize * bpp) / 8); var data = new byte[dataSize]; stream.Read(data, 0, dataSize); Mipmaps[i] = new Mipmap(data, size.Width, size.Height, blockDev, 4); size /= 2; } } catch (Exception e) { FailedToLoad = true; Loader.AddLoadableException(e); if (loadedCallback != null) loadedCallback(this, false); return; } Loaded = true; if (loadedCallback != null) loadedCallback(this, true); } #endregion } }
// Copyright (c) Xenko contributors (https://xenko.com) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) // Distributed under the MIT license. See the LICENSE.md file in the project root for more information. using Xenko.Core; using Xenko.Core.Annotations; using Xenko.Shaders; namespace Xenko.Rendering.Materials { /// <summary> /// Shadows the hair using traditional shadow mapping. /// The hair will be treated as an opaque surface. /// </summary> /// <userdoc> /// Shadows the hair using traditional shadow mapping. /// The hair will be treated as an opaque surface. /// </userdoc> [DataContract("MaterialHairShadowingFunctionShadowing")] [Display("Shadowing")] public class MaterialHairShadowingFunctionShadowing : IMaterialHairShadowingFunction { public ShaderSource Generate(MaterialGeneratorContext context) { return new ShaderClassSource("MaterialHairShadowingFunctionShadowing"); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; return obj is MaterialHairShadowingFunctionShadowing; } public override int GetHashCode() { return typeof(MaterialHairShadowingFunctionShadowing).GetHashCode(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using Thinktecture.IdentityModel.Hawk.Core.Helpers; using Thinktecture.IdentityModel.Hawk.Core.MessageContracts; using Thinktecture.IdentityModel.Hawk.Core.Extensions; using Thinktecture.IdentityModel.Hawk.Etw; using System.Runtime.Caching; namespace Thinktecture.IdentityModel.Hawk.Core { /// <summary> /// Hawk authentication options. /// </summary> public class Options { public Options() { this.ClockSkewSeconds = 60; this.EnableServerAuthorization = true; this.DetermineHostDetailsCallback = DefaultBehavior.DetermineHostDetails; this.DetermineNonceReplayCallback = DefaultBehavior.GetLastUsedId; this.StoreNonceCallback = DefaultBehavior.StoreNonce; } /// <summary> /// Local time offset in milliseconds. /// </summary> public int LocalTimeOffsetMillis { get; set; } /// <summary> /// Skew allowed between the client and the server clocks in seconds. Default is 60 seconds. /// </summary> public int ClockSkewSeconds { get; set; } /// <summary> /// If true, the Server-Authorization header is sent in the response. Default is true. /// </summary> public bool EnableServerAuthorization { get; set; } /// <summary> /// Func delegate that returns Credential for the given user identifier. /// </summary> public Func<string, Credential> CredentialsCallback { get; set; } /// <summary> /// Func delegate that returns the normalized form of the response message to be used /// as application specific data ('ext' field) in the Server-Authorization response header. /// </summary> public Func<IResponseMessage, string> NormalizationCallback { get; set; } /// <summary> /// Func delegate that returns true if the specified normalized form of the request /// message matches the normalized form of the specified request message. /// </summary> public Func<IRequestMessage, string, bool> VerificationCallback { get; set; } /// <summary> /// Func delegate that returns true, if the response body must be hashed and included /// in the MAC ('mac' field) sent in the Server-Authorization response header. /// </summary> public Func<IRequestMessage, bool> ResponsePayloadHashabilityCallback { get; set; } /// <summary> /// Func delegate that returns the host name and port number. /// </summary> public Func<IRequestMessage, Tuple<string, string>> DetermineHostDetailsCallback { get; set; } /// <summary> /// Action delegate that stores the nonce from the request for a specific period to /// detect replay of old requests, against the identifier. /// </summary> public Action<string, string, int> StoreNonceCallback { get; set; } /// <summary> /// Func delegate that returns the identifier used with an earlier request, /// if a nonce was replayed. Returns null, if nonce is fresh. /// By default, the nonce values from the requests are stored in the memory in-proc. /// If you use multiple servers or processes for load balancing and if the replay /// request goes to a server that did not service the request before, nonce will not /// be rejected. In such cases, store the nonce as part of StoreNonceCallback into a /// store common to all instances and check the nonce as part of this callback. /// </summary> public Func<string, string> DetermineNonceReplayCallback { get; set; } public class DefaultBehavior { static readonly object cacheLock = new object(); internal static Tuple<string, string> DetermineHostDetails(IRequestMessage request) { string host = request.Headers.FirstOrDefault("X-Forwarded-Host"); HawkEventSource.Log.Debug("X-Forwarded-Host=" + (host ?? String.Empty)); if (String.IsNullOrWhiteSpace(host)) host = request.Host; HawkEventSource.Log.Debug("Host=" + (host ?? String.Empty)); if (String.IsNullOrWhiteSpace(host)) host = request.Uri.Host; string hostName = String.Empty; string port = String.Empty; string pattern = @"^(?:(?:\r\n)?\s)*((?:[^:]+)|(?:\[[^\]]+\]))(?::(\d+))?(?:(?:\r\n)?\s)*$"; var match = Regex.Match(host, pattern); if (match.Success && match.Groups.Count == 3) { hostName = match.Groups[1].Value; if (!String.IsNullOrWhiteSpace(hostName)) { port = match.Groups[2].Value; } } if (String.IsNullOrWhiteSpace(port)) { port = request.Headers.FirstOrDefault("X-Forwarded-Port"); HawkEventSource.Log.Debug("X-Forwarded-Port=" + (port ?? String.Empty)); } if (String.IsNullOrWhiteSpace(port)) { string scheme = request.Headers.FirstOrDefault("X-Forwarded-Proto"); HawkEventSource.Log.Debug("X-Forwarded-Proto=" + (scheme ?? String.Empty)); if (String.IsNullOrWhiteSpace(scheme)) { scheme = request.Scheme; } port = "https".Equals(scheme, StringComparison.OrdinalIgnoreCase) ? "443" : "80"; HawkEventSource.Log.Debug("Port chosen based on HTTP scheme: " + port); } return new Tuple<string, string>(hostName, port); } internal static void StoreNonce(string nonce, string id, int lifeSeconds) { var evictionPolicy = new CacheItemPolicy() { AbsoluteExpiration = new DateTimeOffset(DateTime.Now.AddSeconds(lifeSeconds)) }; lock (cacheLock) { MemoryCache.Default.Set(nonce, id, evictionPolicy); } } internal static string GetLastUsedId(string nonce) { return MemoryCache.Default.Get(nonce) as string; } } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using ExcelDna.Integration; namespace Uploader { // 1. ExcelMethods contains the single function registered with Excel, // and the two macros that will trigger the upload public static class ExcelMethods { // UploadCreate is the worksheet function // It reads the caller, which we need to track for the UploadSelection option, // gathers all the arguments and then starts the RTD tracking with a call to ExcelAsyncUtil.Observe. // // There can be many more arguments // We might experiment with AllowReference=true for the arguments // That could improve performance a lot // But there are concerns: // * Does Upload get called whenever the contents of the reference change? // * We need care when we read it (at the Upload-time) public static object UploadCreate(object arg1, object arg2, object arg3) { var caller = XlCall.Excel(XlCall.xlfCaller) as ExcelReference; // Might be null if called in unusual context, e.g. Application.Run var topicFunctionName = nameof(UploadCreate); var topicArguments = new object[] { caller, arg1, arg2, arg3 }; // Adding the caller here is important since we need to track it for the RTD topic too return ExcelAsyncUtil.Observe(topicFunctionName, topicArguments, () => UploadManager.CreateItem(topicArguments)); } // These two methods just do the upload. // It's easy for testing to use the "Menuxxx", but normally these would be called from a Ribbon callback. [ExcelCommand(MenuName = "Uploader", MenuText = "Upload All")] public static void UploadAll() { UploadManager.UploadAll(); } // It's easy for testing to use the "Menuxxx", but normally these would be called from a Ribbon callback. // But from a Ribbon callback we can't call the C API, which we want to here to get the Selection as an ExcelReference // So from a Ribbon callback we would need the QueueAsMacro [ExcelCommand(MenuName = "Uploader", MenuText = "Upload Selection")] public static void UploadSelection() { // From a menu we don't need the QueueAsMacro, but from a ribbon button we do ExcelAsyncUtil.QueueAsMacro(() => { var selection = XlCall.Excel(XlCall.xlfSelection) as ExcelReference; if (selection != null) UploadManager.UploadSelection(selection); else Console.Beep(); // Like when it's some chart element }); } [ExcelCommand(MenuName = "Uploader", MenuText = "Upload Worksheet")] public static void UploadWorksheet() { // From a menu we don't need the QueueAsMacro, but from a ribbon button we do ExcelAsyncUtil.QueueAsMacro(() => { var selection = XlCall.Excel(XlCall.xlfSelection) as ExcelReference; // Expand selection reference to include the whole sheet selection = new ExcelReference(0, ExcelDnaUtil.ExcelLimits.MaxRows, 0, ExcelDnaUtil.ExcelLimits.MaxColumns, selection.SheetId); if (selection != null) UploadManager.UploadSelection(selection); else Console.Beep(); // Like when it's some chart element }); } [ExcelCommand(MenuName = "Uploader", MenuText = "Upload Workbook")] public static void UploadWorkbook() { // From a menu we don't need the QueueAsMacro, but from a ribbon button we do ExcelAsyncUtil.QueueAsMacro(() => { UploadManager.UploadActiveWorkbook(); }); } } // 2. UploadStatus represents the state of an individual item // We expect it to only change through the steps, else might need some synchronization enum UploadStatus { Waiting, InProgress, CompletedSuccess, CompletedError } // 3. UploadItem encapsulates the upload job // Through the IExcelObservable mechanism, it will "stream" its status back to the cell, // as that changes when upload starts, and completes. // The IDisposable directly on this class is a small hack - see the comment at "Subscribe" class UploadItem : IExcelObservable, IDisposable { public ExcelReference Caller { get; } public object[] Arguments { get; } public UploadStatus Status { get; private set; } // This method will always be called on the main thread public UploadItem(ExcelReference caller, object[] arguments) { Caller = caller; Arguments = arguments; Status = UploadStatus.Waiting; } // This method is safe to call from any thread // But means that the Status field can change at any time public void SetStatus(UploadStatus newStatus) { Debug.Assert((int)newStatus >= (int)Status, "UpdoadItem.Status should not regress"); Status = newStatus; ReportState(); } // We're implementing against the simpler requirements of the IExcelObservable, // where we can assume that Subscribe will be called at most once, // and so we can also implement IDisposable directly here. // A more complicated implementation for this (list of IObservers, separate IDisposable object) // could be like normal IObservable implementations, hence easier to understand. IExcelObserver _observer; IDisposable IExcelObservable.Subscribe(IExcelObserver observer) { Debug.Assert(_observer == null); _observer = observer; ReportState(); // Reporting immediately in the Subscribe means we never return #N/A from into the cell return this; } // This method will always be called on the main thread void IDisposable.Dispose() { UploadManager.NotifyDispose(this); } // OnNext is safe to call from any thread // (I'm not sure if _observer could really be null in this example... but I put the guard in anyway) void ReportState() { // Whatever we return here will be the result value in the cell // I'm showing Caller as a quick diagnostic check _observer?.OnNext($"Upload Item at {Caller} - Status: {Status}"); } } // 4. UploadManager keeps track of all the items, and manages the transition to start uploading items on demand static class UploadManager { public static List<UploadItem> UploadItems = new List<UploadItem>(); // We require the first element in arguments to be the caller // That simplified the UploadCreate function wrapper, but makes us do a little extra juggling here public static IExcelObservable CreateItem(object[] topicArguments) { var caller = topicArguments[0] as ExcelReference; var functionArguments = topicArguments.Skip(1).ToArray(); var item = new UploadItem(caller, functionArguments); UploadItems.Add(item); Debug.Print($"CreateItem: {item.Caller}, Arguments: {topicArguments.Length - 1}"); return item; } static readonly Random random = new Random(2103); public static void UploadAll() { // Get all the items currently "Waiting", update their status and send for processing var waiting = UploadItems.Where(item => item.Status == UploadStatus.Waiting).ToList(); foreach (var item in waiting) item.SetStatus(UploadStatus.InProgress); PerformUploads(waiting); } public static void UploadSelection(ExcelReference selection) { if (selection == null) return; // Get all the items currently "Waiting", update their status and send for processing var waiting = UploadItems.Where(item => item.Status == UploadStatus.Waiting && IsInsideSelection(item.Caller)).ToList(); foreach (var item in waiting) item.SetStatus(UploadStatus.InProgress); PerformUploads(waiting); // We just check the top left of the caller bool IsInsideSelection(ExcelReference reference) { if (reference == null) return false; if (reference.SheetId != selection.SheetId) return false; return reference.RowFirst >= selection.RowFirst && reference.RowFirst <= selection.RowLast && reference.ColumnFirst >= selection.ColumnFirst && reference.ColumnFirst <= selection.ColumnLast; } } public static void UploadActiveWorkbook() { // Get the SheetIds of all sheets in the active workbbok object[,] names = XlCall.Excel(XlCall.xlfGetWorkbook, 1) as object[,]; HashSet<IntPtr> sheetIds = new HashSet<IntPtr>(); for (int i = 0; i < names.GetLength(1); i++) { var sheetName = names[0, i]; var sheet = XlCall.Excel(XlCall.xlSheetId, sheetName) as ExcelReference; sheetIds.Add(sheet.SheetId); } // Get all the items currently "Waiting", update their status and send for processing var waiting = UploadItems.Where(item => item.Status == UploadStatus.Waiting && IsInsideSelection(item.Caller)).ToList(); foreach (var item in waiting) item.SetStatus(UploadStatus.InProgress); PerformUploads(waiting); // We just check the top left of the caller bool IsInsideSelection(ExcelReference reference) { if (reference == null) return false; return sheetIds.Contains(reference.SheetId); } } internal static void NotifyDispose(UploadItem uploadItem) { UploadItems.Remove(uploadItem); Debug.Print($"RemoveItem: {uploadItem.Caller} - Status: {uploadItem.Status}"); } // 5. This part is where the UploadManager ships off the items for doing the real upload. // The handler then needs to transition the UploadItem.Status to a CompletedXXXX state // The UploadItem.SetStatus can be called from any thread, and will then update through to the sheet. // For the example I just put in a random delay and result // The real implementation might process items all at once, or in batches too, not a task for every item. static void PerformUploads(List<UploadItem> items) { foreach (var item in items) { Task.Run(async () => { // Random delay and result await Task.Delay(random.Next(10000)); if (random.Next(3) == 1) item.SetStatus(UploadStatus.CompletedError); else item.SetStatus(UploadStatus.CompletedSuccess); }); } } } }
namespace FATX.FileSystem { public enum Platform { Xbox, X360 } }
using FbonizziMonoGame.StringsLocalization.Abstractions; using System.Globalization; namespace Rellow.Assets { public class GameStringsLoader { public const string YellowColorKey = "ColorsYellowKey"; public const string RedColorKey = "ColorsRedKey"; public const string GreenColorKey = "ColorsGreen"; public const string BlueColorKey = "ColorsBlue"; public const string OrangeColorKey = "ColorsOrange"; public const string GrayColorKey = "ColorsGray"; public const string WhiteColorKey = "ColorsWhite"; public const string VioletColorKey = "ColorsViolet"; public const string LightBlueColorKey = "ColorsLightBlue"; public const string SecondaryLanguageYellowColorKey = "SecondaryLanguageColorsYellowKey"; public const string SecondaryLanguageRedColorKey = "SecondaryLanguageColorsRedKey"; public const string SecondaryLanguageGreenColorKey = "SecondaryLanguageColorsGreen"; public const string SecondaryLanguageBlueColorKey = "SecondaryLanguageColorsBlue"; public const string SecondaryLanguageOrangeColorKey = "SecondaryLanguageColorsOrange"; public const string SecondaryLanguageGrayColorKey = "SecondaryLanguageColorsGray"; public const string SecondaryLanguageWhiteColorKey = "SecondaryLanguageColorsWhite"; public const string SecondaryLanguageVioletColorKey = "SecondaryLanguageColorsViolet"; public const string SecondaryLanguageLightBlueColorKey = "SecondaryLanguageColorsLightBlue"; public const string PlayStringKey = "Play"; public const string AboutStringKey = "About"; public const string PlayAgainStringKey = "PlayAgain"; public const string ExitStringKey = "Exit"; public const string ScoreStringKey = "Score"; public const string GlobalRankStringKey = "GlobalRank"; public const string GlobalRankLoadingStringKey = "GlobalRankLoadingStringKey"; public const string GlobalRankCurrentlyUnavailableKey = "GlobalRankCurrentlyUnavailableKey"; public GameStringsLoader(ILocalizedStringsRepository localizedStringsRepository, CultureInfo cultureInfo) { if (cultureInfo.TwoLetterISOLanguageName == "it") { localizedStringsRepository.AddString(YellowColorKey, "Giallo"); localizedStringsRepository.AddString(RedColorKey, "Rosso"); localizedStringsRepository.AddString(GreenColorKey, "Verde"); localizedStringsRepository.AddString(BlueColorKey, "Blu"); localizedStringsRepository.AddString(OrangeColorKey, "Arancione"); localizedStringsRepository.AddString(GrayColorKey, "Grigio"); localizedStringsRepository.AddString(WhiteColorKey, "Bianco"); localizedStringsRepository.AddString(VioletColorKey, "Viola"); localizedStringsRepository.AddString(LightBlueColorKey, "Azzurro"); localizedStringsRepository.AddString(SecondaryLanguageYellowColorKey, "Yellow"); localizedStringsRepository.AddString(SecondaryLanguageRedColorKey, "Red"); localizedStringsRepository.AddString(SecondaryLanguageGreenColorKey, "Green"); localizedStringsRepository.AddString(SecondaryLanguageBlueColorKey, "Blue"); localizedStringsRepository.AddString(SecondaryLanguageOrangeColorKey, "Orange"); localizedStringsRepository.AddString(SecondaryLanguageGrayColorKey, "Gray"); localizedStringsRepository.AddString(SecondaryLanguageWhiteColorKey, "White"); localizedStringsRepository.AddString(SecondaryLanguageVioletColorKey, "Violet"); localizedStringsRepository.AddString(SecondaryLanguageLightBlueColorKey, "Light blue"); localizedStringsRepository.AddString(PlayStringKey, "Gioca"); localizedStringsRepository.AddString(AboutStringKey, "About"); localizedStringsRepository.AddString(PlayAgainStringKey, "Gioca ancora"); localizedStringsRepository.AddString(ExitStringKey, "Esci"); localizedStringsRepository.AddString(ScoreStringKey, "Punti"); localizedStringsRepository.AddString(GlobalRankStringKey, "Pos. globale"); localizedStringsRepository.AddString(GlobalRankLoadingStringKey, "Caricamento classifica..."); localizedStringsRepository.AddString(GlobalRankCurrentlyUnavailableKey, "Classifica non disponibile"); } else { localizedStringsRepository.AddString(YellowColorKey, "Yellow"); localizedStringsRepository.AddString(RedColorKey, "Red"); localizedStringsRepository.AddString(GreenColorKey, "Green"); localizedStringsRepository.AddString(BlueColorKey, "Blue"); localizedStringsRepository.AddString(OrangeColorKey, "Orange"); localizedStringsRepository.AddString(GrayColorKey, "Gray"); localizedStringsRepository.AddString(WhiteColorKey, "White"); localizedStringsRepository.AddString(VioletColorKey, "Violet"); localizedStringsRepository.AddString(LightBlueColorKey, "Light blue"); localizedStringsRepository.AddString(SecondaryLanguageYellowColorKey, "Yellow"); localizedStringsRepository.AddString(SecondaryLanguageRedColorKey, "Red"); localizedStringsRepository.AddString(SecondaryLanguageGreenColorKey, "Green"); localizedStringsRepository.AddString(SecondaryLanguageBlueColorKey, "Blue"); localizedStringsRepository.AddString(SecondaryLanguageOrangeColorKey, "Orange"); localizedStringsRepository.AddString(SecondaryLanguageGrayColorKey, "Gray"); localizedStringsRepository.AddString(SecondaryLanguageWhiteColorKey, "White"); localizedStringsRepository.AddString(SecondaryLanguageVioletColorKey, "Violet"); localizedStringsRepository.AddString(SecondaryLanguageLightBlueColorKey, "Light blue"); localizedStringsRepository.AddString(PlayStringKey, "Play"); localizedStringsRepository.AddString(AboutStringKey, "About"); localizedStringsRepository.AddString(PlayAgainStringKey, "Play again"); localizedStringsRepository.AddString(ExitStringKey, "Exit"); localizedStringsRepository.AddString(ScoreStringKey, "Score"); localizedStringsRepository.AddString(GlobalRankStringKey, "Global rank"); localizedStringsRepository.AddString(GlobalRankLoadingStringKey, "Loading leaderboard..."); localizedStringsRepository.AddString(GlobalRankCurrentlyUnavailableKey, "Leaderboard not available"); } } } }
using Ardalis.Specification; using Microsoft.eShopWeb.ApplicationCore.Entities.OrderAggregate; namespace Microsoft.eShopWeb.ApplicationCore.Specifications { public class CustomerOrdersWithReturnSpecification : Specification<Order> { public CustomerOrdersWithReturnSpecification(int orderId) { Query .Where(o => o.Id == orderId) .Include(o => o.OrderReturn); } } }
using CssUI.Rendering; using System.Runtime.InteropServices; namespace CssUI.CSS { [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct Vertex2i { #region Properties /// <summary> /// X axis position of the vertex /// </summary> public int X; /// <summary> /// Y axis position of the vertex /// </summary> public int Y; /// <summary> /// Color of the vertex /// </summary> public ReadOnlyColor Color; #endregion public Vertex2i(int X, int Y, ReadOnlyColor Color) { this.X = X; this.Y = Y; this.Color = Color; } } }
namespace Gibe.Umbraco.Blog.Models { public class BlogSectionsBase : IBlogSections { } }
using System; namespace MakeFunctionJson { internal class ConsoleLogger : ILogger { public void LogError(string message) { Console.Error.WriteLine(message); } public void LogErrorFromException(Exception e) { Console.Error.WriteLine(e); } public void LogWarningFromException(Exception e) { Console.WriteLine(e); } public void LogWarning(string message) { Console.WriteLine(message); } } }
using MinorShift._Library; using System; using System.Collections.Generic; //using System.Drawing; //using System.Drawing.Imaging; using System.Linq; using System.Runtime.InteropServices; using System.Text; using UnityEngine; using uEmuera.Drawing; //using System.Threading.Tasks; namespace MinorShift.Emuera.Content { internal sealed class GraphicsImage : AbstractImage { //public Bitmap Bitmap; //public IntPtr GDIhDC { get; protected set; } //protected Graphics g; //protected IntPtr hBitmap; //protected IntPtr hDefaultImg; public GraphicsImage(int id) { ID = id; //g = null; //Bitmap = null; //created = false; //locked = false; } public readonly int ID; //Size size; //Brush brush = null; //Pen pen = null; //Font font = null; //Bitmap b; //Graphics g; ////bool created; ////bool locked; //public void LockGraphics() //{ // //if (locked) // // return; // //g = Graphics.FromImage(b); // //locked = true; //} //public void UnlockGraphics() //{ // //if (!locked) // // return; // //g.Dispose(); // //g = null; // //locked = false; //} #region Bitmap書き込み・作成 /// <summary> /// GCREATE(int ID, int width, int height) /// Graphicsの基礎となるBitmapを作成する。エラーチェックは呼び出し元でのみ行う /// </summary> public void GCreate(int x, int y, bool useGDI) { this.GDispose(); is_created = true; width = x; height = y; } internal void GCreateFromF(Bitmap bmp, bool useGDI) { //if(useGDI) // throw new NotImplementedException(); //this.GDispose(); //Bitmap = new Bitmap(bmp.Width, bmp.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb); //size = new Size(bmp.Width, bmp.Height); //g = Graphics.FromImage(Bitmap); //g.DrawImage(bmp, 0, 0, bmp.Width, bmp.Height); this.GDispose(); is_created = true; width = bmp.Width; height = bmp.Height; } /// <summary> /// GCLEAR(int ID, int cARGB) /// エラーチェックは呼び出し元でのみ行う /// </summary> public void GClear(uEmuera.Drawing.Color c) { // if (g == null) // throw new NullReferenceException(); // g.Clear(c); } /// <summary> /// GDRAWTEXTGDRAWTEXT int ID, str text, int x, int y /// エラーチェックは呼び出し元でのみ行う /// </summary> //public void GDrawString(string text, int x, int y) //{ // if (g == null) // throw new NullReferenceException(); // Font usingFont = font; // if (usingFont == null) // usingFont = Config.Font; // if (brush != null) // { // g.DrawString(text, usingFont, brush, x, y); // } // else // { // using (SolidBrush b = new SolidBrush(Config.ForeColor)) // g.DrawString(text, usingFont, b, x, y); // } //} /// <summary> /// GDRAWTEXTGDRAWTEXT int ID, str text, int x, int y, int width, int height /// エラーチェックは呼び出し元でのみ行う /// </summary> //public void GDrawString(string text, int x, int y, int width, int height) //{ // if (g == null) // throw new NullReferenceException(); // Font usingFont = font; // if (usingFont == null) // usingFont = Config.Font; // if (brush != null) // { // g.DrawString(text, usingFont, brush, new RectangleF(x,y,width,height)); // } // else // { // using (SolidBrush b = new SolidBrush(Config.ForeColor)) // g.DrawString(text, usingFont, b, new RectangleF(x, y, width, height)); // } //} /// <summary> /// GDRAWRECTANGLE(int ID, int x, int y, int width, int height) /// エラーチェックは呼び出し元でのみ行う /// </summary> //public void GDrawRectangle(Rectangle rect) //{ // if (g == null) // throw new NullReferenceException(); // if (pen != null) // { // g.DrawRectangle(pen, rect); // } // else // { // using (Pen p = new Pen(Config.ForeColor)) // g.DrawRectangle(p, rect); // } //} /// <summary> /// GFILLRECTANGLE(int ID, int x, int y, int width, int height) /// エラーチェックは呼び出し元でのみ行う /// </summary> public void GFillRectangle(Rectangle rect) { // if (g == null) // throw new NullReferenceException(); // if (brush != null) // { // g.FillRectangle(brush, rect); // } // else // { // using (SolidBrush b = new SolidBrush(Config.BackColor)) // g.FillRectangle(b, rect); // } } /// <summary> /// GDRAWCIMG(int ID, str imgName, int destX, int destY, int destWidth, int destHeight) /// エラーチェックは呼び出し元でのみ行う /// </summary> public void GDrawCImg(ASprite img, Rectangle destRect) { //if (g == null) // throw new NullReferenceException(); //img.GraphicsDraw(g, destRect); } /// <summary> /// GDRAWCIMG(int ID, str imgName, int destX, int destY, int destWidth, int destHeight, float[][] cm) /// エラーチェックは呼び出し元でのみ行う /// </summary> public void GDrawCImg(ASprite img, Rectangle destRect, float[][] cm) { //if (g == null) // throw new NullReferenceException(); //ImageAttributes imageAttributes = new ImageAttributes(); //ColorMatrix colorMatrix = new ColorMatrix(cm); //imageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap); //img.GraphicsDraw(g, destRect, imageAttributes); } /// <summary> /// GDRAWG(int ID, int srcID, int destX, int destY, int destWidth, int destHeight, int srcX, int srcY, int srcWidth, int srcHeight) /// エラーチェックは呼び出し元でのみ行う /// </summary> public void GDrawG(GraphicsImage srcGra, Rectangle destRect, Rectangle srcRect) { // if (g == null) // throw new NullReferenceException(); // Bitmap src = srcGra.GetBitmap(); // g.DrawImage(src, destRect, srcRect, GraphicsUnit.Pixel); } /// <summary> /// GDRAWG(int ID, int srcID, int destX, int destY, int destWidth, int destHeight, int srcX, int srcY, int srcWidth, int srcHeight, float[][] cm) /// エラーチェックは呼び出し元でのみ行う /// </summary> public void GDrawG(GraphicsImage srcGra, Rectangle destRect, Rectangle srcRect, float[][] cm) { // if (g == null) // throw new NullReferenceException(); // Bitmap src = srcGra.GetBitmap(); // ImageAttributes imageAttributes = new ImageAttributes(); // ColorMatrix colorMatrix = new ColorMatrix(cm); // imageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default,ColorAdjustType.Bitmap); // //g.DrawImage(img.Bitmap, destRect, srcRect, GraphicsUnit.Pixel, imageAttributes);なんでこのパターンないのさ // g.DrawImage(src, destRect, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, GraphicsUnit.Pixel, imageAttributes); } /// <summary> /// GDRAWGWITHMASK(int ID, int srcID, int maskID, int destX, int destY) /// エラーチェックは呼び出し元でのみ行う /// </summary> public void GDrawGWithMask(GraphicsImage srcGra, GraphicsImage maskGra, Point destPoint) { // if (g == null) // throw new NullReferenceException(); // Bitmap destImg = this.GetBitmap(); // byte[] srcBytes = BytesFromBitmap(srcGra.GetBitmap()); // byte[] srcMaskBytes = BytesFromBitmap(maskGra.GetBitmap()); // Rectangle destRect = new Rectangle(destPoint.X, destPoint.Y, srcGra.Width, srcGra.Height); // System.Drawing.Imaging.BitmapData bmpData = // destImg.LockBits(new Rectangle(0,0, destImg.Width,destImg.Height), // System.Drawing.Imaging.ImageLockMode.ReadWrite, // PixelFormat.Format32bppArgb); // try // { // IntPtr ptr = bmpData.Scan0; // byte[] pixels = new byte[bmpData.Stride * destImg.Height]; // System.Runtime.InteropServices.Marshal.Copy(ptr, pixels, 0, pixels.Length); // for (int y = 0; y < srcGra.Height; y++) // { // int destIndex = ((destPoint.Y + y) * destImg.Width + destPoint.X) * 4; // int srcIndex = ((0 + y) * srcGra.Width + 0) * 4; // for (int x = 0; x < srcGra.Width; x++) // { // if (srcMaskBytes[srcIndex] == 255)//完全不透明 // { // pixels[destIndex++] = srcBytes[srcIndex++]; // pixels[destIndex++] = srcBytes[srcIndex++]; // pixels[destIndex++] = srcBytes[srcIndex++]; // pixels[destIndex++] = srcBytes[srcIndex++]; // } // else if (srcMaskBytes[srcIndex] == 0)//完全透明 // { // destIndex += 4; // srcIndex += 4; // } // else//半透明 alpha/255ではなく(alpha+1)/256で計算しているがたぶん誤差 // { // int mask = srcMaskBytes[srcIndex]; mask++; // pixels[destIndex] = (byte)((srcBytes[srcIndex] * mask + pixels[destIndex] * (256 - mask)) >> 8); srcIndex++; destIndex++; // pixels[destIndex] = (byte)((srcBytes[srcIndex] * mask + pixels[destIndex] * (256 - mask)) >> 8); srcIndex++; destIndex++; // pixels[destIndex] = (byte)((srcBytes[srcIndex] * mask + pixels[destIndex] * (256 - mask)) >> 8); srcIndex++; destIndex++; // pixels[destIndex] = (byte)((srcBytes[srcIndex] * mask + pixels[destIndex] * (256 - mask)) >> 8); srcIndex++; destIndex++; // } // } // } // // Bitmapへコピー // System.Runtime.InteropServices.Marshal.Copy(pixels, 0, ptr, pixels.Length); // } // finally // { // destImg.UnlockBits(bmpData); // } } public void GSetFont(uEmuera.Drawing.Font r) { // if (font != null) // font.Dispose(); // font = r; } public void GSetBrush(Brush r) { // if (brush != null) // brush.Dispose(); // brush = r; } public void GSetPen(Pen r) { // if (pen != null) // pen.Dispose(); // pen = r; } //private static byte[] BytesFromBitmap(Bitmap bmp) //{ // BitmapData bmpData = bmp.LockBits( // new Rectangle(0, 0, bmp.Width, bmp.Height), // ImageLockMode.ReadOnly, // 書き込むときはReadAndWriteで // PixelFormat.Format32bppArgb // ); // if (bmpData.Stride < 0) // throw new Exception();//変な形式のが送られてくることはありえないはずだが一応 // byte[] pixels = new byte[bmpData.Stride * bmp.Height]; // try // { // IntPtr ptr = bmpData.Scan0; // System.Runtime.InteropServices.Marshal.Copy(ptr, pixels, 0, pixels.Length); // } // finally // { // bmp.UnlockBits(bmpData); // } // return pixels; //} /// <summary> /// GTOARRAY int ID, var array /// エラーチェックは呼び出し元でのみ行う /// <returns></returns> //public bool GBitmapToInt64Array(Int64[,] array, int xstart, int ystart) //{ // if (g == null || Bitmap == null) // throw new NullReferenceException(); // int w = Bitmap.Width; // int h = Bitmap.Height; // if (xstart + w > array.GetLength(0) || ystart + h > array.GetLength(1)) // return false; // Rectangle rect = new Rectangle(0, 0, w, h); // System.Drawing.Imaging.BitmapData bmpData = // Bitmap.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly, // PixelFormat.Format32bppArgb); // IntPtr ptr = bmpData.Scan0; // byte[] rgbValues = new byte[w * h * 4]; // Marshal.Copy(ptr, rgbValues, 0, rgbValues.Length); // Bitmap.UnlockBits(bmpData); // int i = 0; // for (int y = 0; y < h; y++) // { // for (int x = 0; x < w; x++) // { // array[x + xstart, y + ystart] = // rgbValues[i++] + //B // (((Int64)rgbValues[i++]) << 8) + //G // (((Int64)rgbValues[i++]) << 16) + //R // (((Int64)rgbValues[i++]) << 24); //A // } // } // return true; //} /// <summary> /// GFROMARRAY int ID, var array /// エラーチェックは呼び出し元でのみ行う /// <returns></returns> //public bool GByteArrayToBitmap(Int64[,] array, int xstart, int ystart) //{ // if (g == null || Bitmap == null) // throw new NullReferenceException(); // int w = Bitmap.Width; // int h = Bitmap.Height; // if (xstart + w > array.GetLength(0) || ystart + h > array.GetLength(1)) // return false; // byte[] rgbValues = new byte[w * h * 4]; // int i = 0; // for (int y = 0; y < h; y++) // { // for (int x = 0; x < w; x++) // { // Int64 c = array[x + xstart, y + ystart]; // rgbValues[i++] = (byte)(c & 0xFF);//B // rgbValues[i++] = (byte)((c >> 8) & 0xFF);//G // rgbValues[i++] = (byte)((c >> 16) & 0xFF);//R // rgbValues[i++] = (byte)((c >> 24) & 0xFF);//A // } // } // Rectangle rect = new Rectangle(0, 0, w, h); // System.Drawing.Imaging.BitmapData bmpData = // Bitmap.LockBits(rect, System.Drawing.Imaging.ImageLockMode.WriteOnly, // PixelFormat.Format32bppArgb); // IntPtr ptr = bmpData.Scan0; // Marshal.Copy(rgbValues, 0, ptr, rgbValues.Length); // Bitmap.UnlockBits(bmpData); // return true; //} #endregion #region Bitmap読み込み・削除 /// <summary> /// 未作成ならエラー /// </summary> //public Bitmap GetBitmap() //{ // if (Bitmap == null) // throw new NullReferenceException(); // //UnlockGraphics(); // return Bitmap; //} /// <summary> /// GSETCOLOR(int ID, int cARGB, int x, int y) /// エラーチェックは呼び出し元でのみ行う /// </summary> public void GSetColor(uEmuera.Drawing.Color c, int x, int y) { if (Bitmap == null) throw new NullReferenceException(); // //UnlockGraphics(); // Bitmap.SetPixel(x, y, c); } /// <summary> /// GGETCOLOR(int ID, int x, int y) /// エラーチェックは呼び出し元でのみ行う。特に画像範囲内であるかどうかチェックすること /// </summary> public uEmuera.Drawing.Color GGetColor(int x, int y) { if (Bitmap == null) throw new NullReferenceException(); //UnlockGraphics(); return Bitmap.GetPixel(x, y); } /// <summary> /// GDISPOSE(int ID) /// </summary> public void GDispose() { // size = new Size(0, 0); // if (Bitmap == null) // return; // if (gdi) // { // GDI.SelectObject(GDIhDC, hDefaultImg); // GDI.DeleteObject(hBitmap); // g.ReleaseHdc(GDIhDC); // } // if (g != null) // g.Dispose(); // if (Bitmap != null) // Bitmap.Dispose(); // if (brush != null) // brush.Dispose(); // if (pen != null) // pen.Dispose(); // if (font != null) // font.Dispose(); // g = null; // Bitmap = null; // brush = null; // pen = null; // font = null; is_created = false; width = 0; height = 0; } public override void Dispose() { // this.GDispose(); //if(render_texture != null) //{ // UnityEngine.Object.Destroy(render_texture); //} this.GDispose(); } ~GraphicsImage() { Dispose(); } #endregion //#region 状態判定(Bitmap読み書きを伴わない) //public override bool IsCreated { get { return g != null; } } public override bool IsCreated { get { return is_created; } } bool is_created = false; /// <summary> /// int GWIDTH(int ID) /// </summary> public int Width { get { return width; } } int width = 0; /// <summary> /// int GHEIGHT(int ID) /// </summary> public int Height { get { return height; } } int height = 0; //#endregion } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace VC { public static class Defines { public static string[] EmailsDefault = new string[] { "eebyrne@gmail.com" }; public static readonly string RootDirectory = @"C:\Network\"; public static readonly string RootLocalDirectory = @"C:\Temp\"; public static readonly string LogsRootDirectory = RootDirectory + @"Logs\"; public static readonly string LogsRootLocalDirectory = RootLocalDirectory + @"Logs\"; } }
namespace FakeItEasy.Tests.Core { using FakeItEasy.Core; using FakeItEasy.Tests.TestHelpers; using FluentAssertions; using Xunit; public class FakeCreationExceptionTests : ExceptionContractTests<FakeCreationException> { [Fact] [UsingCulture("en-US")] public void DefaultConstructor_should_set_correct_error_message() { // Arrange var exception = new FakeCreationException(); // Act // Assert exception.Message.Should().Be("Unable to create fake object."); } protected override FakeCreationException CreateException() { return new FakeCreationException(); } } }
//--------------------------------------------------------------------- // <copyright file="NamedValueToQueryValueUpdater.cs" company="Microsoft"> // Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information. // </copyright> //--------------------------------------------------------------------- namespace Microsoft.Test.Taupo.Query { using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using Microsoft.Test.Taupo.Common; using Microsoft.Test.Taupo.Contracts; using Microsoft.Test.Taupo.Query.Contracts; /// <summary> /// Internal helpers for setting values on QueryValues from NamedValues /// </summary> [ImplementationName(typeof(INamedValueToQueryValueUpdater), "Default")] public class NamedValueToQueryValueUpdater : INamedValueToQueryValueUpdater { private List<string> unusedNamedValuePaths = new List<string>(); /// <summary> /// Sets the given values on the given structural value instance /// </summary> /// <param name="queryValue">The instance to set the values on</param> /// <param name="namedValues">The values to set</param> public void UpdateValues(QueryValue queryValue, IEnumerable<NamedValue> namedValues) { ExceptionUtilities.CheckArgumentNotNull(queryValue, "queryValue"); ExceptionUtilities.CheckArgumentNotNull(namedValues, "namedValues"); this.unusedNamedValuePaths = new List<string>(namedValues.Select(s => s.Name).ToArray()); var queryStructuralValue = queryValue as QueryStructuralValue; if (queryStructuralValue != null) { this.UpdateValues(queryStructuralValue, namedValues, null); } else { var queryCollectionValue = queryValue as QueryCollectionValue; ExceptionUtilities.CheckObjectNotNull(queryCollectionValue, "Can only update QueryValues of Collection or Structural type not '{0}'", queryValue.Type); this.UpdateValues(queryCollectionValue, namedValues); } var errorStringBuilder = new StringBuilder(); foreach (NamedValue unusedNamedValue in namedValues.Where(nv => this.unusedNamedValuePaths.Contains(nv.Name))) { errorStringBuilder.AppendLine(string.Format(CultureInfo.InvariantCulture, "{0}={1}", unusedNamedValue.Name, Convert.ToString(unusedNamedValue.Value, CultureInfo.InvariantCulture))); } if (errorStringBuilder.Length > 0) { throw new TaupoInfrastructureException("All properties have not been set:\r\n" + errorStringBuilder.ToString()); } } internal void UpdateValues(QueryCollectionValue queryCollectionValue, IEnumerable<NamedValue> namedValues) { ExceptionUtilities.CheckArgumentNotNull(queryCollectionValue, "queryCollectionValue"); ExceptionUtilities.CheckArgumentNotNull(namedValues, "namedValues"); var primitiveElementDataType = queryCollectionValue.Type.ElementType as QueryClrPrimitiveType; if (primitiveElementDataType != null) { this.UpdateRootScalarBag(queryCollectionValue, namedValues, primitiveElementDataType); } else { var complexElementDataType = queryCollectionValue.Type.ElementType as QueryComplexType; ExceptionUtilities.CheckObjectNotNull(complexElementDataType, "Expected QueryComplex Type, actual query type {0}", queryCollectionValue.Type); this.UpdateRootComplexBag(queryCollectionValue, namedValues, complexElementDataType); } } internal void UpdateValues(QueryStructuralValue instance, IEnumerable<NamedValue> namedValues, string propertyPath) { foreach (QueryProperty property in instance.Type.Properties) { string childPropertyPath = property.Name; if (propertyPath != null) { childPropertyPath = propertyPath + "." + property.Name; } // Skip if its an EntityType, this only handles structural types var queryEntityType = property.PropertyType as QueryEntityType; if (queryEntityType != null) { continue; } var collectionType = property.PropertyType as QueryCollectionType; var scalarType = property.PropertyType as QueryScalarType; var complexDataType = property.PropertyType as QueryComplexType; QueryEntityType collectionQueryElementType = null; if (collectionType != null) { collectionQueryElementType = collectionType.ElementType as QueryEntityType; } // Skip if its a collection of QueryEntityType if (collectionQueryElementType != null) { continue; } if (scalarType != null) { NamedValue primitivePropertyNamedValue = namedValues.SingleOrDefault(nv => nv.Name == childPropertyPath); if (primitivePropertyNamedValue != null) { instance.SetPrimitiveValue(property.Name, primitivePropertyNamedValue.Value); this.unusedNamedValuePaths.Remove(childPropertyPath); } } else if (collectionType != null) { List<NamedValue> bagNamedValues = namedValues.Where(nv => nv.Name.StartsWith(childPropertyPath + ".", StringComparison.Ordinal)).ToList(); if (bagNamedValues.Any()) { this.UpdateBagProperty(instance, property, collectionType.ElementType, childPropertyPath, bagNamedValues); } else { this.UpdateBagPropertyWithNullOrEmpty(instance, property, childPropertyPath, namedValues); } } else if (complexDataType != null) { // NOTE: we cannot assert that it is complex/primitive/bag, because there may be new query types added in other assemblies that we know nothing about here QueryStructuralValue complexTypeValue = instance.GetStructuralValue(property.Name); List<NamedValue> complexInstanceNamedValues = namedValues.Where(nv => nv.Name.StartsWith(childPropertyPath + ".", StringComparison.Ordinal)).ToList(); if (complexInstanceNamedValues.Any()) { if (complexTypeValue.IsNull) { complexTypeValue = complexDataType.CreateNewInstance(); } this.UpdateValues(complexTypeValue, complexInstanceNamedValues, childPropertyPath); instance.SetValue(property.Name, complexTypeValue); } else { // Check for null case List<NamedValue> exactMatches = namedValues.Where(nv => nv.Name == childPropertyPath).ToList(); ExceptionUtilities.Assert(exactMatches.Count < 2, "Should only find at most one property path {0} when looking for null value", childPropertyPath); if (exactMatches.Count == 1) { ExceptionUtilities.Assert( exactMatches[0].Value == null, "Named value at path '{0}' was unexpectedly non-null. Value was '{1}'", childPropertyPath, exactMatches[0].Value); instance.SetValue(property.Name, complexDataType.NullValue); this.unusedNamedValuePaths.Remove(childPropertyPath); } } } } } private void UpdateBagProperty(QueryStructuralValue instance, QueryProperty memberProperty, QueryType elementType, string propertyPath, IEnumerable<NamedValue> namedValues) { var scalarElementDataType = elementType as QueryScalarType; var complexTypeElementDataType = elementType as QueryComplexType; if (scalarElementDataType != null) { this.UpdateScalarBag(instance, memberProperty, propertyPath, namedValues, scalarElementDataType); } else { ExceptionUtilities.CheckObjectNotNull(complexTypeElementDataType, "PropertyPath '{0}' is an invalid type '{1}'", propertyPath, memberProperty.PropertyType); this.UpdateComplexBag(instance, memberProperty, propertyPath, namedValues, complexTypeElementDataType); } } private void UpdateComplexBag(QueryStructuralValue instance, QueryProperty memberProperty, string propertyPath, IEnumerable<NamedValue> namedValues, QueryComplexType complexTypeElementDataType) { int i = 0; var complexCollection = new List<QueryValue>(); List<NamedValue> complexInstanceNamedValues = namedValues.Where(pp => pp.Name.StartsWith(propertyPath + "." + i + ".", StringComparison.Ordinal)).ToList(); while (complexInstanceNamedValues.Any()) { QueryStructuralValue complexValue = complexTypeElementDataType.CreateNewInstance(); this.UpdateValues(complexValue, complexInstanceNamedValues, propertyPath + "." + i); complexCollection.Add(complexValue); i++; complexInstanceNamedValues = namedValues.Where(pp => pp.Name.StartsWith(propertyPath + "." + i + ".", StringComparison.Ordinal)).ToList(); } if (complexCollection.Any()) { this.SetCollectionProperty(instance, memberProperty, complexCollection); } } private void UpdateRootComplexBag(QueryCollectionValue queryCollectionValue, IEnumerable<NamedValue> namedValues, QueryComplexType complexTypeElementDataType) { int i = 0; var complexCollection = new List<QueryValue>(); List<NamedValue> complexInstanceNamedValues = namedValues.Where(pp => pp.Name.StartsWith(i + ".", StringComparison.Ordinal)).ToList(); while (complexInstanceNamedValues.Any()) { QueryStructuralValue complexValue = complexTypeElementDataType.CreateNewInstance(); this.UpdateValues(complexValue, complexInstanceNamedValues, i.ToString(CultureInfo.InvariantCulture)); complexCollection.Add(complexValue); i++; complexInstanceNamedValues = namedValues.Where(pp => pp.Name.StartsWith(i + ".", StringComparison.Ordinal)).ToList(); } if (complexCollection.Any()) { this.SetCollectionValue(queryCollectionValue, complexCollection); } } private void SetCollectionValue(QueryCollectionValue queryCollectionValue, List<QueryValue> collectionElements) { queryCollectionValue.Elements.Clear(); foreach (QueryValue queryValue in collectionElements) { queryCollectionValue.Elements.Add(queryValue); } } private void SetCollectionProperty(QueryStructuralValue instance, QueryProperty memberProperty, List<QueryValue> collectionElements) { QueryCollectionValue queryCollectionValue = instance.GetCollectionValue(memberProperty.Name); queryCollectionValue.Elements.Clear(); foreach (QueryValue queryValue in collectionElements) { queryCollectionValue.Elements.Add(queryValue); } instance.SetValue(memberProperty.Name, queryCollectionValue); } private void UpdateScalarBag(QueryStructuralValue instance, QueryProperty memberProperty, string propertyPath, IEnumerable<NamedValue> namedValues, QueryScalarType scalarElementDataType) { int i = 0; var scalarCollection = new List<QueryValue>(); List<NamedValue> scalarItemNamedValues = namedValues.Where(pp => pp.Name == propertyPath + "." + i).ToList(); while (scalarItemNamedValues.Any()) { ExceptionUtilities.Assert(scalarItemNamedValues.Count() < 2, "Should not get more than one value for a scalar Bag item for path '{0}'", propertyPath + "." + i); var value = scalarItemNamedValues.Single(); scalarCollection.Add(scalarElementDataType.CreateValue(value.Value)); this.unusedNamedValuePaths.Remove(value.Name); i++; scalarItemNamedValues = namedValues.Where(pp => pp.Name == propertyPath + "." + i).ToList(); } if (scalarCollection.Any()) { this.SetCollectionProperty(instance, memberProperty, scalarCollection); } } private void UpdateRootScalarBag(QueryCollectionValue instance, IEnumerable<NamedValue> namedValues, QueryScalarType scalarElementDataType) { int i = 0; var scalarCollection = new List<QueryValue>(); List<NamedValue> scalarItemNamedValues = namedValues.Where(pp => pp.Name == i.ToString(CultureInfo.InvariantCulture)).ToList(); while (scalarItemNamedValues.Any()) { ExceptionUtilities.Assert(scalarItemNamedValues.Count() < 2, "Should not get more than one value for a scalar Bag item for path '{0}'", i.ToString(CultureInfo.InvariantCulture)); var value = scalarItemNamedValues.Single(); scalarCollection.Add(scalarElementDataType.CreateValue(value.Value)); this.unusedNamedValuePaths.Remove(value.Name); i++; scalarItemNamedValues = namedValues.Where(pp => pp.Name == i.ToString(CultureInfo.InvariantCulture)).ToList(); } if (scalarCollection.Any()) { this.SetCollectionValue(instance, scalarCollection); } } private void UpdateBagPropertyWithNullOrEmpty(QueryStructuralValue instance, QueryProperty memberProperty, string propertyPath, IEnumerable<NamedValue> namedValues) { List<NamedValue> exactMatches = namedValues.Where(nv => nv.Name == propertyPath).ToList(); if (!exactMatches.Any()) { return; } ExceptionUtilities.Assert(exactMatches.Count == 1, "Should only find at most one property path {0} when looking for null or empty value", propertyPath); NamedValue expectedBagValue = exactMatches.Single(); var bagType = memberProperty.PropertyType as QueryCollectionType; if (expectedBagValue.Value == null) { instance.SetValue(memberProperty.Name, bagType.NullValue); this.unusedNamedValuePaths.Remove(expectedBagValue.Name); } else if (expectedBagValue.Value == EmptyData.Value) { QueryCollectionValue value = bagType.CreateCollectionWithValues(new QueryValue[] { }); instance.SetValue(memberProperty.Name, value); this.unusedNamedValuePaths.Remove(expectedBagValue.Name); } } } }
// This file is part of SharpNEAT; Copyright Colin D. Green. // See LICENSE.txt for details. using SharpNeat.EvolutionAlgorithm; using ZedGraph; using static SharpNeat.Windows.App.Forms.ZedGraphUtils; namespace SharpNeat.Windows.App.Forms.TimeSeries; public class FitnessTimeSeriesForm : StatsGraphForm { const int __HistoryLength = 1_000; readonly RollingPointPairList _bestPpl; readonly RollingPointPairList _meanPpl; #region Constructor public FitnessTimeSeriesForm() : base("Fitness (Best and Mean)", "Generation", "Fitness", null) { _bestPpl = new RollingPointPairList(__HistoryLength); LineItem lineItem = _graphPane.AddCurve("Best", _bestPpl, Color.FromArgb(0xff, 0x1d, 0x26), SymbolType.None); ApplyLineStyle(lineItem); _meanPpl = new RollingPointPairList(__HistoryLength); lineItem = _graphPane.AddCurve("Mean", _meanPpl, Color.FromArgb(0xed, 0x9c, 0x96), SymbolType.None); ApplyLineStyle(lineItem); } #endregion #region Public Methods /// <summary> /// Update the time series data. /// </summary> /// <param name="eaStats">Evolution algorithm statistics object.</param> /// <param name="popStats">Population statistics object.</param> public override void UpdateData( EvolutionAlgorithmStatistics eaStats, PopulationStatistics popStats) { _bestPpl.Add(eaStats.Generation, popStats.BestFitness.PrimaryFitness); _meanPpl.Add(eaStats.Generation, popStats.MeanFitness); RefreshGraph(); } /// <summary> /// Clear the time series data. /// </summary> public override void Clear() { _bestPpl.Clear(); _meanPpl.Clear(); RefreshGraph(); } #endregion }
namespace SharpVectors.Dom { /// <summary> /// Represents a processing instruction, which XML defines to keep processor-specific /// information in the text of the document. /// </summary> /// <seealso href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113"> /// Document Object Model (DOM) Level 2 Core Specification</seealso> public interface IProcessingInstruction : INode { /// <summary> /// Gets the target of the processing instruction. /// </summary> /// <value>The target of the processing instruction.</value> /// <remarks> /// The target of this processing instruction. XML defines this as being /// the first token following the markup that begins the processing /// instruction. /// </remarks> string Target { get; } /// <summary> /// Gets or sets the content of the processing instruction, excluding the target. /// </summary> /// <value>The content of the processing instruction, excluding the target.</value> /// <remarks> /// </remarks> string Data { get; set; } } }
namespace In.ProjectEKA.HipServiceTest.Consent.Builder { using Bogus; using Common.Builder; using HipService.Common.Model; using HipService.Consent.Model; public class TestBuilder { private static Faker faker = new Faker(); internal static Faker Faker() => faker ??= new Faker(); internal static Notification Notification( ConsentStatus consentStatus = ConsentStatus.GRANTED) { return new Notification(ConsentArtefact().Generate().Build(), faker.Random.Hash(), faker.Random.Hash(), consentStatus); } internal static Notification RevokedNotification(string patientId) { var consentArtefactBuilder = ConsentArtefact().Generate(); consentArtefactBuilder.Patient = new PatientReference(patientId); return new Notification(consentArtefactBuilder.Build(), faker.Random.Hash(), faker.Random.Hash(), ConsentStatus.REVOKED); } private static Faker<ConsentArtefactBuilder> ConsentArtefact() { return new Faker<ConsentArtefactBuilder>() .RuleFor(c => c.ConsentManager, () => new OrganizationReference("123")); } internal static Consent Consent() { return new Consent(faker.Random.Hash(), ConsentArtefact().Generate().Build(), faker.Random.Hash(), ConsentStatus.GRANTED, faker.Random.Hash() ); } } }
using System.Collections; namespace Patterns.CSharp.Patterns.Composite { public class ConcreteComponentComposite : AbstractComponent { private ArrayList nodes = new ArrayList(); public ConcreteComponentComposite(string name) : base(name) { } public override void Operation() { PatternUseCase.Output += name + "\r\n\r\n"; foreach (AbstractComponent component in nodes) { component.Operation(); } } public override void Add(AbstractComponent component) { nodes.Add(component); } public override void Remove(AbstractComponent component) { nodes.Remove(component); } public override AbstractComponent GetChild(int index) { return nodes[index] as AbstractComponent; } } }
using System; namespace BoardGamesNook.Model { public class GameResult { public int Id { get; set; } public DateTimeOffset CreatedDate { get; set; } public DateTimeOffset ModifiedDate { get; set; } public Guid CreatedGamerId { get; set; } public Guid GamerId { get; set; } public int BoardGameId { get; set; } public Gamer Gamer { get; set; } public BoardGame BoardGame { get; set; } public float? Points { get; set; } public int? Place { get; set; } public int PlayersNumber { get; set; } public int? GameTableId { get; set; } public GameTable GameTable { get; set; } public bool Active { get; set; } } }
using UnityEngine; using System.Collections; public class ColorButtons : MonoBehaviour { public TurnManager manager; public Color color; public int type; public bool randomizer = false; void Start() { if (randomizer == false) { switch (type) { case 0: color = GetComponent<SpriteRenderer>().color = Color.blue; break; case 1: color = GetComponent<SpriteRenderer>().color = Color.white; break; case 2: color = GetComponent<SpriteRenderer>().color = Color.cyan; break; case 3: color = GetComponent<SpriteRenderer>().color = Color.green; break; case 4: color = GetComponent<SpriteRenderer>().color = Color.magenta; break; case 5: color = GetComponent<SpriteRenderer>().color = Color.red; break; case 6: color = GetComponent<SpriteRenderer>().color = Color.yellow; break; case 7: color = GetComponent<SpriteRenderer>().color = new Color(1, 0.4f, 0, 1); break; case 8: color = GetComponent<SpriteRenderer>().color = new Color(0.2f, 0.133f, 0.0117f, 1); break; } } } void OnMouseDown () { if (manager.t >= 2) return; if (randomizer == false) { if (manager.player == 0) { manager.color0 = color; manager.firstColor = type; } if (manager.player == 1) manager.color1 = color; Destroy(this.gameObject); } else { int rand = Random.Range(0, 9); if(manager.player==1) while (rand == manager.firstColor) { rand = Random.Range(0, 9); } Color color0=Color.white; foreach(ColorButtons btn in FindObjectsOfType<ColorButtons>()) { if (rand == btn.type) { color0 = btn.color; Destroy(btn.gameObject); } } if (manager.player == 0) { manager.color0 = color0; manager.firstColor = rand; } else manager.color1 = color0; } manager.t++; manager.player=1-manager.player; } }
using DotCommon.Extensions; using Xunit; namespace DotCommon.Test.Extensions { public class TypeExtensionsTest { [Fact] public void GetAssembly_Test() { var assembly = typeof(TypeExtensionsTest).GetAssembly(); Assert.Equal("DotCommon.Test", assembly.GetName().Name); } [Fact] public void GetMethod_Test() { var methodInfo = typeof(TypeExtensionsTest).GetMethod("Method1", 1, 0); Assert.Equal("Method1",methodInfo.Name); } public string Method1(int id) { return $"{id}-Name"; } } }
 // IGameState.cs // Copyright (c) 2014+ by Michael Penner. All rights reserved. namespace ARuncibleCargo.Framework { /// <summary></summary> public interface IGameState : Eamon.Framework.IGameState { #region Properties /// <summary></summary> long DreamCounter { get; set; } /// <summary></summary> long SwarmyCounter { get; set; } /// <summary></summary> long CargoOpenCounter { get; set; } /// <summary></summary> long CargoInRoom { get; set; } /// <summary></summary> long GiveAmazonMoney { get; set; } /// <summary></summary> bool[] PookaMet { get; set; } /// <summary></summary> bool AmazonMet { get; set; } /// <summary></summary> bool BillAndAmazonMeet { get; set; } /// <summary></summary> bool PrinceMet { get; set; } /// <summary></summary> bool AmazonLilWarning { get; set; } /// <summary></summary> bool BillLilWarning { get; set; } /// <summary></summary> bool FireEscaped { get; set; } /// <summary></summary> bool CampEntered { get; set; } /// <summary></summary> bool PaperRead { get; set; } /// <summary></summary> bool Explosive { get; set; } #endregion #region Methods /// <summary></summary> /// <param name="index"></param> /// <returns></returns> bool GetPookaMet(long index); /// <summary></summary> /// <param name="index"></param> /// <param name="value"></param> void SetPookaMet(long index, bool value); #endregion } }
using System; using System.Diagnostics.CodeAnalysis; using System.IO; namespace Arnible.Xunit { [ExcludeFromCodeCoverage] public sealed class DeafLogger : ISimpleLoggerForTests { public bool IsLoggerEnabled => false; public void EnableLogging(bool value) { // intentionally empty } public void SaveLogsToFile(bool value) { // intentionally empty } public ISimpleLogger Write(in ReadOnlySpan<char> message) { return this; } public ISimpleLogger Write(MemoryStream message) { return this; } public void Dispose() { // intentionally empty } } }
using ScottPlot.Drawing; using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.Linq; using System.Runtime.InteropServices; using System.Text; namespace ScottPlot.Plottable { /// <summary> /// A colorbar translates numeric intensity values to colors. /// The Colorbar plot type displays a Colorbar along an edge of the plot. /// </summary> public class Colorbar : IPlottable { public Renderable.Edge Edge = Renderable.Edge.Right; private Colormap Colormap; private Bitmap BmpScale; private readonly List<string> TickLabels = new List<string>(); private readonly List<double> TickFractions = new List<double>(); public bool IsVisible { get; set; } = true; public int XAxisIndex { get => 0; set { } } public int YAxisIndex { get => 0; set { } } public int Width = 20; public Colorbar(Colormap colormap = null) { UpdateColormap(colormap ?? Colormap.Viridis); } /// <summary> /// Clear all tick marks and labels /// </summary> public void ClearTicks() { TickFractions.Clear(); TickLabels.Clear(); } /// <summary> /// Add a tick mark and label /// </summary> /// <param name="fraction">from 0 (darkest) to 1 (brightest)</param> /// <param name="label">string displayed beside the tick</param> public void AddTick(double fraction, string label) { TickFractions.Add(fraction); TickLabels.Add(label); } /// <summary> /// Add tick marks and labels /// </summary> /// <param name="fractions">from 0 (darkest) to 1 (brightest)</param> /// <param name="labels">strings displayed beside the ticks</param> public void AddTicks(double[] fractions, string[] labels) { if (fractions.Length != labels.Length) throw new ArgumentException("fractions and labels must have the same length"); for (int i = 0; i < fractions.Length; i++) { TickFractions.Add(fractions[i]); TickLabels.Add(labels[i]); } } /// <summary> /// Define a tick marks and labels /// </summary> /// <param name="fractions">from 0 (darkest) to 1 (brightest)</param> /// <param name="labels">strings displayed beside the ticks</param> public void SetTicks(double[] fractions, string[] labels) { ClearTicks(); AddTicks(fractions, labels); } public LegendItem[] GetLegendItems() => null; public AxisLimits GetAxisLimits() => new AxisLimits(double.NaN, double.NaN, double.NaN, double.NaN); public void ValidateData(bool deep = false) { if (TickLabels.Count != TickFractions.Count) throw new InvalidOperationException("Tick labels and positions must have the same length"); } /// <summary> /// Re-Render the colorbar using a new colormap /// </summary> public void UpdateColormap(Colormap newColormap) { Colormap = newColormap; UpdateBitmap(); } private void UpdateBitmap() { BmpScale?.Dispose(); BmpScale = GetBitmap(); } /// <summary> /// Return a Bitmap of just the color portion of the colorbar. /// The width is defined by the Width field /// The height will be 256 /// </summary> /// <returns></returns> public Bitmap GetBitmap() => Colormap.Colorbar(Colormap, Width, 256, true); /// <summary> /// Return a Bitmap of just the color portion of the colorbar /// </summary> /// <param name="width">width of the Bitmap</param> /// <param name="height">height of the Bitmap</param> /// <param name="vertical">if true, colormap will be vertically oriented (tall and skinny)</param> /// <returns></returns> public Bitmap GetBitmap(int width, int height, bool vertical = true) => Colormap.Colorbar(Colormap, width, height, vertical); public void Render(PlotDimensions dims, Bitmap bmp, bool lowQuality = false) { if (BmpScale is null) UpdateBitmap(); RectangleF colorbarRect = RenderColorbar(dims, bmp); RenderTicks(dims, bmp, lowQuality, colorbarRect); } private RectangleF RenderColorbar(PlotDimensions dims, Bitmap bmp) { float scaleLeftPad = 10; PointF location = new PointF(dims.DataOffsetX + dims.DataWidth + scaleLeftPad, dims.DataOffsetY); SizeF size = new SizeF(Width, dims.DataHeight); RectangleF rect = new RectangleF(location, size); using (Graphics gfx = GDI.Graphics(bmp, dims, lowQuality: true, clipToDataArea: false)) using (var pen = GDI.Pen(Color.Black)) { gfx.DrawImage(BmpScale, location.X, location.Y, size.Width, size.Height + 1); gfx.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); } return rect; } private void RenderTicks(PlotDimensions dims, Bitmap bmp, bool lowQuality, RectangleF colorbarRect) { float tickLengh = 4; float tickLabelPadding = 2; float tickLeftPx = colorbarRect.Right; float tickRightPx = tickLeftPx + tickLengh; float tickLabelPx = tickRightPx + tickLabelPadding; using (Graphics gfx = GDI.Graphics(bmp, dims, lowQuality, false)) using (var pen = GDI.Pen(Color.Black)) using (var brush = GDI.Brush(Color.Black)) using (var font = GDI.Font(null, 12)) using (var sf = new StringFormat() { LineAlignment = StringAlignment.Center }) { for (int i = 0; i < TickLabels.Count; i++) { float y = colorbarRect.Top + (float)((1 - TickFractions[i]) * colorbarRect.Height); gfx.DrawLine(pen, tickLeftPx, y, tickRightPx, y); gfx.DrawString(TickLabels[i], font, brush, tickLabelPx, y, sf); } } } } }
using System.Threading.Tasks; namespace Staticsoft.Jobs.Abstractions { public interface Job { Task Run(); Schedule Schedule { get; } } }
/* ' /====================================================\ '| Developed Tony N. Hyde (www.k2host.co.uk) | '| Projected Started: 2019-06-01 | '| Use: General | ' \====================================================/ */ using System; using K2host.Data.Interfaces; using K2host.Erp.Interfaces.Users; namespace K2host.Erp.Interfaces.Slips { /// <summary> /// A user class helper can be created from this interface for use of any ERP Engine. /// </summary> public interface IErpSlipQuote : IDataObject { /// <summary> /// The resource parent company Id. /// </summary> long CompanyId { get; set; } /// <summary> /// The resource parent department Id. /// </summary> long DepartmentId { get; set; } /// <summary> /// The id of the user as an account manager. /// </summary> long AccountManagerId { get; set; } /// <summary> /// This indicates the quote is open or closed. /// </summary> bool Open { get; set; } /// <summary> /// This indicates when this quote should be dealt with. /// </summary> DateTime? Due { get; set; } /// <summary> /// This is the vat applied at the time of the quote. /// </summary> decimal AppliedVat { get; set; } } }
using Assets.UnityFoundation.Code.TimeUtils; using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class DiceSideChecker : MonoBehaviour { public event Action<DiceSideSO> OnDiceSideChecked; private List<Dice> evaluateDices = new List<Dice>(); private void OnTriggerStay(Collider other) { Debug.Log("erwre"); if(!TryGetComponent(out DiceSideHolder side)) return; var diceVelocity = side.diceOwner.GetComponent<Rigidbody>().velocity; if(diceVelocity.magnitude == 0) Debug.Log(side.DiceSide.value); } }
namespace Mvb.FakeContacts.ModelBinders.Errors { public class ModelBindersErrorArgs { public ModelBindersErrorArgs(string message, int errorcode = -1) { this.Message = message; this.ErrorCode = errorcode; } public int ErrorCode { get; } public string Message { get; } } }
/* Problem: https://www.hackerrank.com/challenges/simple-array-sum/problem C# Language Version: 6.0 .Net Framework Version: 4.7 Tool Version : Visual Studio Community 2017 Thoughts : 1. Store all the input numbers in an array. Let there be n elements in the array. 2. Initialize a number s which represents sum of all the number in the array. Initialize s to 0. 3. Iterate through all the elements in the array in a loop 3.1 Let the current number being iterated be c. 3.2 Increment s by c. 4. Print s. Time Complexity: O(n) //A loop is required which iterates through n elements to create their sum. Space Complexity: O(n) //Space complexity doesn't matches optimal O(1) solution as in C# you have to read the entire console line at a time (size n), because it does not have a way to iteratively read in space delimited input. If there had been a Scanner like class which exists in Java then it would have been possible to accomplish the same algorithm in O(1) space complexity. */ using System; using System.Linq; class Solution { static void Main(String[] args) { //no need of the element count as I use LINQ to create the sum instead of iterating the array explicitly in my code. Console.ReadLine(); var ar_temp = Console.ReadLine().Split(' '); var ar = Array.ConvertAll(ar_temp, Int32.Parse); Console.WriteLine(ar.Sum()); //LINQ's sum method has O(n) time complexity. } }
using System; using System.Collections.Generic; using System.Text; namespace RES_QRCode.Models { public class ResponseMessageModel { string responseMessage; bool responseStatus; public bool ResponseStatus { get => responseStatus; set => responseStatus = value; } public string ResponseMessage { get => responseMessage; set => responseMessage = value; } } }
using Domain.Services; using System; using System.Security.Cryptography; namespace Application.Common.ApplicationServices.SecurePasswordSaltGenerator { public class SecurePasswordSaltGeneratorService : ISecureRandomStringGeneratorService { public string GenerateSecureRandomString() { var cryptoRng = new RNGCryptoServiceProvider(); var salt = new byte[64]; cryptoRng.GetBytes(salt); return Convert.ToBase64String(salt); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; /// <summary> /// Summary description for Node_Response /// </summary> public class Node_Response { public Node_Response() { } public string response_type = ""; public string message_text = ""; public string[] quick_replys = null; public string[] quick_replys_payload = null; public string law_text = ""; public string message_origin = ""; public string message_origin_source = ""; public string message_explenation = ""; public string danger_level = ""; public string financial_danger_level = ""; public string question_number = ""; public string node_id = ""; public string html_tree = ""; public string law_raw_text = ""; public string relevant_verdicts = ""; public string relevant_extentions = ""; public string relevant_danger_links = ""; }
using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace CinemaConstructor.Database.Entities { public class Cinema { [Key] public long Id { get; set; } public string Name { get; set; } public string Address { get; set; } public string Phone { get; set; } public Company Company { get; set; } public List<Hall> Halls { get; set; } } }
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input.Touch; namespace Catalyst3D.XNA.Engine.EntityClasses.Input { public class InputAction { public Buttons Button; public Keys Key; public string Name; public bool IsPressed; public float PressTime; public float PressPower; public GestureType GestureType; public InputAction(string name, Buttons btn, Keys key) { Name = name; Button = btn; Key = key; } public InputAction(string name, GestureType type) { Name = name; GestureType = type; } } }
using System; using System.Collections.Generic; using System.Xml; namespace GenieLamp.Core.Metamodel { class Schemas : MetaObjectNamedCollection<ISchema, Schema>, ISchemas { public Schemas(Model model) : base(model) { } public void Update() { foreach(Entity ent in Model.Entities) { Schema schema = this.GetByName(ent.Schema, false); if (schema == null) { schema = new Schema(Model, ent.Schema); this.Add(schema.Name, schema); } schema.Update(); } } } }
// Copyright 2013 Zynga 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. #if PLATFORM_MONODROID using System; using System.Collections.Generic; using flash.events; using Android.Media; using Android.App; using Android.Content.Res; using Java.IO; namespace flash.media { partial class Sound { private static int SIZE = 10; private static Queue<ZMediaPlayer> playerQueue = new Queue<ZMediaPlayer>(SIZE); private ZMediaPlayer player; private SoundChannel channel = new SoundChannel (); private void internalLoad(String url) { player = new ZMediaPlayer (url, channel); try { if ( playerQueue.Count == SIZE ) { ZMediaPlayer oldPlayer = playerQueue.Dequeue(); oldPlayer.Release(); } player.Initialize(); playerQueue.Enqueue( player ); } catch (Exception e) { Console.WriteLine ("Exception occur loading sounds. " + e.Message); this.dispatchEvent (new IOErrorEvent (IOErrorEvent.IO_ERROR)); player.Release (); player = null; return; } this.dispatchEvent(new Event(Event.COMPLETE)); } private SoundChannel internalPlay(double startTime=0, int loops=0, SoundTransform sndTransform=null) { if (player == null) { Console.WriteLine ("MediaPlayer is null"); return null; } loops = Math.Max (0, loops); player.SetLoopsCount (loops); if (startTime > 0) Console.WriteLine ("Warning: Sounds StartTime is not supported"); try { // if the player is stopped, we need to initialize it again if (!player.isInitialize ()) player.Initialize (); } catch (Exception e){ Console.WriteLine ("Exception occur initializing sounds. " + e.Message); this.dispatchEvent (new IOErrorEvent (IOErrorEvent.IO_ERROR)); player.Release (); player = null; return null; } player.Start (); return channel; } public static void AsyncDispatchEvents() { } public class ZMediaPlayer : MediaPlayer, MediaPlayer.IOnCompletionListener { private String url; private SoundChannel channel; private int count; private int loopsCount; private bool isInit; public ZMediaPlayer(String url, SoundChannel channel) { this.url = url; this.channel = channel; this.channel.Player = this; this.count = 0; this.loopsCount = 0; this.isInit = false; this.SetOnCompletionListener( this ); } public override void Stop () { base.Stop (); this.isInit = false; } public void Initialize() { Reset (); try { AssetFileDescriptor afd = Application.Context.Assets.OpenFd (url); SetDataSource (afd.FileDescriptor, afd.StartOffset, afd.Length); } #pragma warning disable 0168 catch(Java.IO.FileNotFoundException ex) #pragma warning restore 0168 { File fSnd = new File(url); FileInputStream fileIS = new FileInputStream(fSnd); SetDataSource(fileIS.FD, 0, fSnd.Length()); } SetVolume (100, 100); Prepare (); this.isInit = true; } public void SetLoopsCount(int loopsCount) { this.loopsCount = loopsCount; } public bool isInitialize() { return this.isInit; } public void OnCompletion (MediaPlayer mp) { if (count < loopsCount) { count++; mp.SeekTo (0); mp.Start (); } else if (count >= loopsCount) { channel.dispatchEvent (new Event (Event.SOUND_COMPLETE)); } } } } } #endif
using Csla.Server; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Csla.Server.Hosts { /// <summary> /// Data portal to be invoked by the brokered /// data portal proxy/host implementation. /// </summary> public class BrokeredPortal { /// <summary> /// Create and initialize a business object. /// </summary> /// <param name="objectTypeName">Type of business object to create.</param> /// <param name="criteriaData">Criteria object describing business object.</param> /// <param name="contextData"> /// Server.DataPortalContext object passed to the server. /// </param> public async Task<byte[]> Create(string objectTypeName, byte[] criteriaData, byte[] contextData) { DataPortalResult result; try { var objectType = Csla.Reflection.MethodCaller.GetType(objectTypeName); var criteria = Csla.Serialization.Mobile.MobileFormatter.Deserialize(criteriaData); var context = (DataPortalContext)Csla.Serialization.Mobile.MobileFormatter.Deserialize(contextData); var portal = new Csla.Server.DataPortal(); result = await portal.Create(objectType, criteria, context, false); } catch (Exception ex) { result = new DataPortalResult(null, ex, null); } var response = GetDataPortalResult(result); var resultData = Csla.Serialization.Mobile.MobileFormatter.Serialize(response); return resultData; } /// <summary> /// Get an existing business object. /// </summary> /// <param name="objectTypeName">Type of business object to retrieve.</param> /// <param name="criteriaData">Criteria object describing business object.</param> /// <param name="contextData"> /// Server.DataPortalContext object passed to the server. /// </param> public async Task<byte[]> Fetch(string objectTypeName, byte[] criteriaData, byte[] contextData) { DataPortalResult result; try { var objectType = Csla.Reflection.MethodCaller.GetType(objectTypeName); var criteria = Csla.Serialization.Mobile.MobileFormatter.Deserialize(criteriaData); var context = (DataPortalContext)Csla.Serialization.Mobile.MobileFormatter.Deserialize(contextData); var portal = new Csla.Server.DataPortal(); result = await portal.Fetch(objectType, criteria, context, false); } catch (Exception ex) { result = new DataPortalResult(null, ex, null); } var response = GetDataPortalResult(result); var resultData = Csla.Serialization.Mobile.MobileFormatter.Serialize(response); return resultData; } /// <summary> /// Update a business object. /// </summary> /// <param name="objectData">Business object to update.</param> /// <param name="contextData"> /// Server.DataPortalContext object passed to the server. /// </param> public async Task<byte[]> Update(byte[] objectData, byte[] contextData) { DataPortalResult result; try { var obj = Csla.Serialization.Mobile.MobileFormatter.Deserialize(objectData); var context = (DataPortalContext)Csla.Serialization.Mobile.MobileFormatter.Deserialize(contextData); var portal = new Csla.Server.DataPortal(); result = await portal.Update(obj, context, false); } catch (Exception ex) { result = new DataPortalResult(null, ex, null); } var response = GetDataPortalResult(result); var resultData = Csla.Serialization.Mobile.MobileFormatter.Serialize(response); return resultData; } /// <summary> /// Delete a business object. /// </summary> /// <param name="objectTypeName">Type of business object to create.</param> /// <param name="criteriaData">Criteria object describing business object.</param> /// <param name="contextData"> /// Server.DataPortalContext object passed to the server. /// </param> public async Task<byte[]> Delete(string objectTypeName, byte[] criteriaData, byte[] contextData) { DataPortalResult result; try { var objectType = Csla.Reflection.MethodCaller.GetType(objectTypeName); var criteria = Csla.Serialization.Mobile.MobileFormatter.Deserialize(criteriaData); var context = (DataPortalContext)Csla.Serialization.Mobile.MobileFormatter.Deserialize(contextData); var portal = new Csla.Server.DataPortal(); result = await portal.Delete(objectType, criteria, context, false); } catch (Exception ex) { result = new DataPortalResult(null, ex, null); } var response = GetDataPortalResult(result); var resultData = Csla.Serialization.Mobile.MobileFormatter.Serialize(response); return resultData; } private Csla.Server.Hosts.HttpChannel.HttpResponse GetDataPortalResult(DataPortalResult dataportalResult) { var result = new Csla.Server.Hosts.HttpChannel.HttpResponse(); if (dataportalResult.Error != null) result.ErrorData = new HttpChannel.HttpErrorInfo(dataportalResult.Error); if (dataportalResult.GlobalContext != null) result.GlobalContext = Csla.Serialization.Mobile.MobileFormatter.Serialize(dataportalResult.GlobalContext); if (dataportalResult.ReturnObject != null) result.ObjectData = Csla.Serialization.Mobile.MobileFormatter.Serialize(dataportalResult.ReturnObject); return result; } } }
using System; using System.Collections.Generic; namespace AScore_DLL.Managers { /// <summary> /// Represents an individual spectrum. Default IComparable sorts by Mz, ascending /// </summary> public class ExperimentalSpectraEntry : IComparable<ExperimentalSpectraEntry> { /// <summary> /// Gets the m/z in this ExperimentalSpectraEntry /// </summary> public double Mz { get; } /// <summary> /// Gets the intensity in this ExperimentalSpectraEntry /// </summary> public double Intensity { get; } /// <summary> /// Initializes a new instance of ExperimentalSpectraEntry /// </summary> /// <param name="mz">m/z of this ExperimentalSpectraEntry</param> /// <param name="intensity">intensity of this ExperimentalSpectraEntry</param> public ExperimentalSpectraEntry(double mz, double intensity) { Mz = mz; Intensity = intensity; } public override string ToString() { return Mz + ", " + Intensity; } public class FindValue1InTolerance : IComparer<ExperimentalSpectraEntry> { private readonly double mTolerance; public FindValue1InTolerance(double tolerance) { mTolerance = tolerance; } public int Compare(ExperimentalSpectraEntry x, ExperimentalSpectraEntry y) { if (Math.Abs(x.Mz - y.Mz) <= mTolerance) return 0; return x.Mz.CompareTo(y.Mz); } } /// <summary> /// Sorts the ExperimentalSpectraEntry by Intensity in descending order /// </summary> public class SortIntensityDescend : IComparer<ExperimentalSpectraEntry> { public int Compare(ExperimentalSpectraEntry x, ExperimentalSpectraEntry y) { return -1 * x.Intensity.CompareTo(y.Intensity); } } /// <summary> /// Default comparable; sorts only by mass /// </summary> /// <param name="other"></param> /// <returns></returns> public int CompareTo(ExperimentalSpectraEntry other) { //if (ReferenceEquals(this, other)) return 0; if (other == null) return 1; //var mzComparison = Mz.CompareTo(other.Mz); //if (mzComparison != 0) return mzComparison; //return Intensity.CompareTo(other.Intensity); // We really only care about the m/z return Mz.CompareTo(other.Mz); } } }
using AutoMapper; using goldfish.WebUI.Models; using goldfish.WebUI.ViewModels; namespace goldfish.WebUI { public class AutoMapperConfig { public static void Register(IMapperConfigurationExpression cfg) { //site service cfg.CreateMap<SiteService, VMSiteService>(); cfg.CreateMap<VMSiteService, SiteService>(); //site project cfg.CreateMap<SiteProject, VMSiteProject>(); cfg.CreateMap<VMSiteProject, SiteProject>(); //site project security item cfg.CreateMap<SiteProjectSecurityItem, VMSiteProjectSecurityItem>(); cfg.CreateMap<VMSiteProjectSecurityItem, SiteProjectSecurityItem>(); } } }
using System; using System.IO; using System.Text.Encodings.Web; using System.Threading.Tasks; using Fluid; using Fluid.Accessors; using Fluid.Values; using Microsoft.AspNetCore.Mvc.Localization; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.Options; using OrchardCore.DisplayManagement.Implementation; using OrchardCore.DisplayManagement.Layout; using OrchardCore.DisplayManagement.Liquid.Filters; using OrchardCore.DisplayManagement.Liquid.Internal; using OrchardCore.DisplayManagement.Liquid.Tags; using OrchardCore.DisplayManagement.Shapes; using OrchardCore.DisplayManagement.Zones; using OrchardCore.Liquid; namespace OrchardCore.DisplayManagement.Liquid { public class LiquidViewTemplate : BaseFluidTemplate<LiquidViewTemplate> { public static readonly string ViewsFolder = "Views"; public static readonly string ViewExtension = ".liquid"; public static readonly MemoryCache Cache = new MemoryCache(new MemoryCacheOptions()); static LiquidViewTemplate() { FluidValue.TypeMappings.Add(typeof(Shape), o => new ObjectValue(o)); FluidValue.TypeMappings.Add(typeof(ZoneHolding), o => new ObjectValue(o)); TemplateContext.GlobalMemberAccessStrategy.Register<Shape>("*", new ShapeAccessor()); TemplateContext.GlobalMemberAccessStrategy.Register<ZoneHolding>("*", new ShapeAccessor()); Factory.RegisterTag<RenderBodyTag>("render_body"); Factory.RegisterTag<RenderSectionTag>("render_section"); Factory.RegisterTag<RenderTitleSegmentsTag>("page_title"); Factory.RegisterTag<DisplayTag>("display"); Factory.RegisterTag<HelperTag>("helper"); Factory.RegisterTag<NamedHelperTag>("shape"); Factory.RegisterTag<NamedHelperTag>("link"); Factory.RegisterTag<NamedHelperTag>("meta"); Factory.RegisterTag<NamedHelperTag>("resources"); Factory.RegisterTag<NamedHelperTag>("script"); Factory.RegisterTag<NamedHelperTag>("style"); Factory.RegisterBlock<HelperBlock>("block"); Factory.RegisterBlock<NamedHelperBlock>("a"); Factory.RegisterBlock<NamedHelperBlock>("zone"); NamedHelperTag.RegisterDefaultArgument("shape", "type"); NamedHelperBlock.RegisterDefaultArgument("zone", "name"); TemplateContext.GlobalFilters.WithLiquidViewFilters(); } internal static async Task RenderAsync(RazorPage<dynamic> page) { var services = page.Context.RequestServices; var path = Path.ChangeExtension(page.ViewContext.ExecutingFilePath, ViewExtension); var fileProviderAccessor = services.GetRequiredService<ILiquidViewFileProviderAccessor>(); var template = Parse(path, fileProviderAccessor.FileProvider, Cache); var context = new TemplateContext(); context.Contextualize(page, (object)page.Model); var options = services.GetRequiredService<IOptions<LiquidOptions>>().Value; await template.RenderAsync(options, services, page.Output, HtmlEncoder.Default, context); } public static LiquidViewTemplate Parse(string path, IFileProvider fileProvider, IMemoryCache cache) { return cache.GetOrCreate(path, entry => { entry.Priority = CacheItemPriority.NeverRemove; var fileInfo = fileProvider.GetFileInfo(path); entry.ExpirationTokens.Add(fileProvider.Watch(path)); using (var stream = fileInfo.CreateReadStream()) { using (var sr = new StreamReader(stream)) { if (TryParse(sr.ReadToEnd(), out var template, out var errors)) { return template; } else { throw new Exception(String.Join(System.Environment.NewLine, errors)); } } } }); } } internal class ShapeAccessor : DelegateAccessor { public ShapeAccessor() : base(_getter) { } private static Func<object, string, object> _getter => (o, n) => { if (o is Shape shape) { if (shape.Properties.TryGetValue(n, out object result)) { return result; } foreach (var item in shape.Items) { // Resolve Model.Content.MyNamedPart if (item is IShape itemShape && itemShape.Metadata.Name == n) { return item; } } } return null; }; } public static class LiquidViewTemplateExtensions { public static async Task RenderAsync(this LiquidViewTemplate template, LiquidOptions options, IServiceProvider services, TextWriter writer, TextEncoder encoder, TemplateContext context) { foreach (var registration in options.FilterRegistrations) { context.Filters.AddAsyncFilter(registration.Key, (input, arguments, ctx) => { var type = registration.Value; var filter = services.GetRequiredService(registration.Value) as ILiquidFilter; return filter.ProcessAsync(input, arguments, ctx); }); } await template.RenderAsync(writer, encoder, context); } } public static class TemplateContextExtensions { public static void Contextualize(this TemplateContext context, RazorPage page, object model) { var services = page.Context.RequestServices; var displayHelper = services.GetRequiredService<IDisplayHelperFactory>().CreateHelper(page.ViewContext); context.Contextualize(new DisplayContext() { ServiceProvider = page.Context.RequestServices, DisplayAsync = displayHelper, ViewContext = page.ViewContext, Value = model }); } public static async void Contextualize(this TemplateContext context, DisplayContext displayContext) { var services = displayContext.ServiceProvider; context.AmbientValues.Add("Services", services); var displayHelperFactory = services.GetRequiredService<IDisplayHelperFactory>(); context.AmbientValues.Add("DisplayHelperFactory", displayHelperFactory); context.AmbientValues.Add("DisplayHelper", displayContext.DisplayAsync); context.AmbientValues.Add("ViewContext", displayContext.ViewContext); var urlHelperFactory = services.GetRequiredService<IUrlHelperFactory>(); var urlHelper = urlHelperFactory.GetUrlHelper(displayContext.ViewContext); context.AmbientValues.Add("UrlHelper", urlHelper); var shapeFactory = services.GetRequiredService<IShapeFactory>(); context.AmbientValues.Add("ShapeFactory", shapeFactory); var localizer = services.GetRequiredService<IViewLocalizer>(); if (localizer is IViewContextAware contextable) { contextable.Contextualize(displayContext.ViewContext); } context.AmbientValues.Add("ViewLocalizer", localizer); var layoutAccessor = services.GetRequiredService<ILayoutAccessor>(); context.AmbientValues.Add("LayoutAccessor", layoutAccessor); var layout = await layoutAccessor.GetLayoutAsync(); context.AmbientValues.Add("ThemeLayout", layout); // TODO: Extract the request culture foreach (var handler in services.GetServices<ILiquidTemplateEventHandler>()) { await handler.RenderingAsync(context); } var model = displayContext.Value; if (model != null) { context.MemberAccessStrategy.Register(model.GetType()); context.LocalScope.SetValue("Model", model); } } } }
using System.Collections.Generic; using System.Threading.Tasks; namespace GoNorth.Data.Exporting { /// <summary> /// Interface for Database Access for Object Export Snippet Snapshots /// </summary> public interface IObjectExportSnippetSnapshotDbAccess { /// <summary> /// Returns the export snippet snapshots for an object /// </summary> /// <param name="objectId">Object Id</param> /// <returns>Export Snippet Snapshots</returns> Task<List<ObjectExportSnippet>> GetExportSnippetSnapshots(string objectId); /// <summary> /// Creates an export snippet snapshot /// </summary> /// <param name="exportSnippet">Export snippet snapshot to create</param> /// <returns>Task</returns> Task CreateExportSnippetSnapshot(ObjectExportSnippet exportSnippet); /// <summary> /// Deletes all export snippet snapshots of an object /// </summary> /// <param name="objectId">Id of the object to delete the snippet snapshots for</param> /// <returns>Task</returns> Task DeleteExportSnippetSnapshotsByObjectId(string objectId); } }
using DataBaseBackupManager.Interfaces; using DataBaseBackupManager.Models; namespace DataBaseBackupManager.Repository { public class LocalFileWriterFactory : IWriterStrategyFactory { /// <summary> /// Instantiate a new writer. /// </summary> /// <param name="table">The table to be written.</param> /// <returns>A new Writer Strategy.</returns> IWriterStrategy IWriterStrategyFactory.GetWriterStrategy(Table table) { IWriterStrategy writerStrategy = new LocalFileWritterStrategy(table); return writerStrategy; } } }
using backend_asp_dotnet.Dtos; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace backend_asp_dotnet.Services { public interface INoteRepo { public Guid CreateNewNote(string token, string title, string note); public bool UpdateNote(string token, Guid id, string title, string note); public bool DeleteNote(string token, Guid id); public NoteProjection GetNoteById(string token, Guid id); } }
using System.Threading.Tasks; namespace Abp.BackgroundJobs { public abstract class AsyncBackgroundJob<TArgs> : BackgroundJobBase<TArgs>, IAsyncBackgroundJob<TArgs> { public abstract Task ExecuteAsync(TArgs args); } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using Microsoft.WindowsAzure; using Microsoft.WindowsAzure.StorageClient; //NOTE: This class uses a now deprecated storage client api. Look for the latest API for new apps. namespace SoulService { public class BlobStorage { public void PutBlob(byte[] bytes, string blobName, string contentType) { var blob = mContainer.GetBlobReference(blobName); blob.UploadByteArray(bytes); blob.Properties.ContentType = contentType; blob.SetProperties(); } public IEnumerable<string> ListBlobs() { var myReturn = new List<string>(); foreach (var item in mContainer.ListBlobs()) { myReturn.Add(item.Uri.AbsoluteUri); } return myReturn; } public void Clear() { foreach (var item in mContainer.ListBlobs()) { var cloudBlob = mContainer.GetBlobReference(item.Uri.ToString()); cloudBlob.DeleteIfExists(); } } private CloudBlobContainer mContainer; public BlobStorage(string connectionStringName, string containerName) { // Retrieve storage account from connection-string CloudStorageAccount storageAccount = CloudStorageAccount.Parse( CloudConfigurationManager.GetSetting(connectionStringName)); // Create the blob client CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient(); // Retrieve a reference to a container // Container name must use lower case mContainer = blobClient.GetContainerReference(containerName); //// Create the container if it doesn't already exist mContainer.CreateIfNotExist(); ////// Enable public access to blob var permissions = mContainer.GetPermissions(); if (permissions.PublicAccess == BlobContainerPublicAccessType.Off) { permissions.PublicAccess = BlobContainerPublicAccessType.Blob; mContainer.SetPermissions(permissions); } } } }
namespace TeamLegend.Services.Contracts { using Models; using System.Threading.Tasks; using System.Collections.Generic; public interface ITeamsService { Task<Team> CreateAsync(Team team); Task<Team> GetByIdAsync(string id); Task<List<Team>> GetAllAsync(); Task<List<Team>> GetAllWithoutLeagueAsync(); Task<bool> DeleteAsync(Team team); Task<Team> SetStadiumAsync(Team team, Stadium stadium); Task<Team> AddNewPlayersAsync(Team team, List<Player> playersToAdd); Task<Team> AddManagerAsync(Team team, Manager manager); Task<Team> IncreasePlayersAppearancesAsync(Team team); } }
using Dapper.Contrib.Extensions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SuperNAT.Model { [Table("map")] public class Map : BaseModel, IModel { [Key] public int id { get; set; } public string name { get; set; } public string local { get; set; } = "localhost"; public int? local_port { get; set; } = 80; public string remote { get; set; } public int? remote_port { get; set; } = 80; public string protocol { get; set; } = "http"; public string certfile { get; set; } public string certpwd { get; set; } public bool is_ssl { get; set; } = false; public int? ssl_type { get; set; } /// <summary> /// 1:反向代理 2:正向代理 /// </summary> public int proxy_type { get; set; } public int? client_id { get; set; } public bool is_disabled { get; set; } = false; [Write(false)] public string client_name { get; set; } [Write(false)] public bool is_online { get; set; } [Write(false)] public string is_online_str => is_online ? "在线" : "离线"; [Write(false)] public string user_id { get; set; } [Write(false)] public string user_name { get; set; } [Write(false)] public bool is_admin { get; set; } = false; [Write(false)] public int ChangeType { get; set; } [Write(false)] public string local_endpoint => $"{local}{(local_port == 80 ? "" : $":{local_port}")}"; [Write(false)] public string remote_endpoint => $"{remote}{(remote_port == 80 ? "" : $":{remote_port}")}"; [Write(false)] public string server_config { get; set; } } }
using SerieFlix.Domain.Contracts.RepositoryServices; using SerieFlix.Domain.Entities; using SerieFlix.Repositories.Repository; using SerieFlix.Repository.Context; using SerieFlix.Tests.MockData; using SerieFlix.Tests.MockData.Repository; using System.Linq; using Xunit; namespace SerieFlix.Tests.Units.Repositories { public class SerieRepositoryTests { #region [Properties] protected readonly SerieFlixContext _serieFlixDbContext; protected readonly IRepository<Serie> _serieRepository; #endregion #region [Constructors] public SerieRepositoryTests() { this._serieFlixDbContext = DbContextMock.GetContext(); this._serieRepository = new RepositoryBase<Serie>(this._serieFlixDbContext); } #endregion #region [Consultas] [Fact(DisplayName = "Consultar por Id, deve retornar uma único registro.")] [Trait("Cetegory", "Consultar")] public async void Consultar_porId_RetornaUnicoRegistro() { //Arrange //Act var serie = await this._serieRepository.Consultar(1); //Assert Assert.NotNull(serie); } [Fact(DisplayName = "Consultar todos objetos, deve retornar 20 registros.")] [Trait("Cetegory", "Consultar")] public async void Consultar_TodosObjetos_DeveRetornar20Registros() { //Arrange //Act var series = await this._serieRepository.Consultar(); //Assert Assert.True(series.Count > 0); } #endregion #region [Adicionar] [Theory(DisplayName = "Adicionar nova série.")] [Trait("Cetegory", "Adicionar")] [ClassData(typeof(SerieObjetoValidoMock))] public async void Adicionar_Test(Serie serie) { //Arrange //Act await this._serieRepository.Adicionar(serie); var registroSalvo = (await this._serieRepository.Consultar()).Last(); //Assert Assert.Equal(serie.Id, registroSalvo.Id); } #endregion #region [Editar] [Fact(DisplayName = "Editar série.")] [Trait("Cetegory", "Editar")] public async void Editar_Test() { //Arrange var serie = (await this._serieRepository.Consultar()).Last(); string descricao = "Descricao de série alterado"; serie.Descricao = descricao; //Act await this._serieRepository.Atualizar(serie); var registroSalvo = await this._serieRepository.Consultar(serie.Id); //Assert Assert.Equal(registroSalvo.Descricao, descricao); } #endregion #region [Excluir] [Fact(DisplayName = "Excluir série.")] [Trait("Cetegory", "Excluir")] public async void Excluir_Test() { //Arrange var serie = (await this._serieRepository.Consultar()).Last(); //Act await this._serieRepository.Excluir(serie.Id); var registroRemovido = await this._serieRepository.Consultar(serie.Id); //Assert Assert.Null(registroRemovido); } [Fact(DisplayName = "Excluir série que não existe.")] [Trait("Cetegory", "Excluir")] public async void Excluir_SerieInexistente_DeveRetornarFalse() { //Arrange var serie = (await this._serieRepository.Consultar()).Last(); //Act var retorno = await this._serieRepository.Excluir(serie.Id+1); //Assert Assert.False(retorno); } #endregion } }
using System; using System.Configuration; using System.Threading.Tasks; using Mandrill.Models; using Mandrill.Requests.Templates; using NUnit.Framework; namespace Mandrill.Tests.IntegrationTests.Templates { [TestFixture] public class TemplateInfoTests : IntegrationTestBase { [Test] public async Task Should_Get_Template_Info() { // Setup string apiKey = ConfigurationManager.AppSettings["APIKey"]; string templateName = Guid.NewGuid().ToString(); const string code = "Foobar"; // Exercise var api = new MandrillApi(apiKey); await api.AddTemplate(new AddTemplateRequest(templateName) { FromName = "test@test.invalid", Code = code, Text = code, Publish = true }); TemplateInfo result = await api.TemplateInfo(new TemplateInfoRequest(templateName)); // Verify Assert.AreEqual(templateName, result.Name); Assert.AreEqual(code, result.Code); // Cleanup await api.DeleteTemplate(new DeleteTemplateRequest(templateName)); } } }
using Autodesk.DesignScript.Runtime; namespace Camber.Civil.Styles { [IsVisibleInDynamoLibrary(false)] public enum StyleCollections { CodeSetStyles, GradingCriteriaSets, QuantityTakeoffCriterias } }
using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using BlockChyp.Client; using BlockChyp.Entities; using FsCheck; using FsCheck.Xunit; using Xunit; using Xunit.Abstractions; namespace BlockChypTest.Client { public class CryptoTest { private readonly ITestOutputHelper output; public CryptoTest(ITestOutputHelper output) { this.output = output; // Register Arbitrary instances Arb.Register<CryptoArbitrary>(); } [Fact] public void CryptoTest_GenerateAuthHeaders() { var creds = new ApiCredentials( "SGLATIFZD7PIMLAQJ2744MOEGI", "FI2SWNNJHJVO6DBZEF26YEHHMY", "c3a8214c318dd470b0107d6c111f086b60ad695aaeb598bf7d1032eee95339a0"); var result = Crypto.GenerateAuthHeaders(creds); foreach (KeyValuePair<string, string> header in result) { output.WriteLine($"{header.Key}: {header.Value}"); } Assert.Equal(3, result.Count); Assert.NotNull(result["Nonce"]); Assert.NotNull(result["Timestamp"]); Assert.NotNull(result["Authorization"]); } /// <summary> /// Test that the <c>Crypto.Encrypt</c> and <c>Crypto.Decrypt</c> methods round-trip. /// </summary> [Property(MaxTest = 10000)] public bool prop_EncryptDecrypt_RoundTrip(NonNull<string> plaintext, AesKey aesKey) { string ciphertext = Crypto.Encrypt(plaintext.Get, aesKey.Get); string roundTripPlaintext = Crypto.Decrypt(ciphertext, aesKey.Get); return plaintext.Get == roundTripPlaintext; } /// <summary> /// Property: A nonce, <c>GenerateNonce(len)</c>, should be of length, <c>len</c> /// </summary> [Property(MaxTest = 10000)] public bool prop_NonceLength_Correct(NonceLength nonceLength) { int hexEncodedNonceLength = nonceLength.Get * 2; // 2 hex chars == 1 byte return Crypto.GenerateNonce(nonceLength.Get).Length == hexEncodedNonceLength; } /// <summary> /// Property: A nonce, <c>GenerateNonce(len)</c>, should only contain base-16 characters. /// i.e. The nonce should be a hexadecimal-encoded <c>string</c>. /// </summary> [Property(MaxTest = 10000)] public bool prop_Nonce_IsHexEncoded(NonceLength nonceLength) { string nonce = Crypto.GenerateNonce(nonceLength.Get); return Regex.IsMatch(nonce, @"\A\b[0-9a-fA-F]+\b\Z"); } /// <summary> /// Property: <c>ba.SequenceEqual(FromHex(ToHex(ba)))</c> /// </summary> [Property(MaxTest = 10000)] public bool prop_ToHexFromHex_RoundTrip(byte[] ba) { return ba.SequenceEqual(Crypto.FromHex(Crypto.ToHex(ba))); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; using System.Diagnostics; namespace System.Text.Json.Serialization.Metadata { /// <summary> /// Provides JSON serialization-related metadata about a type. /// </summary> /// <typeparam name="T">The generic definition of the type.</typeparam> [EditorBrowsable(EditorBrowsableState.Never)] public abstract class JsonTypeInfo<T> : JsonTypeInfo { internal JsonTypeInfo(Type type, JsonSerializerOptions options, ConverterStrategy converterStrategy) : base(type, options, converterStrategy) { } internal JsonTypeInfo() { Debug.Assert(false, "This constructor should not be called."); } } }
using Common.Crafting; namespace StasisTorpedo { partial class StasisTorpedo: PoolCraftableObject { public static new TechType TechType { get; private set; } = 0; protected override TechInfo getTechInfo() => new ( new (TechType.ComputerChip), new (TechType.Magnetite, 2), new (TechType.Titanium) ); protected override void initPrefabPool() => addPrefabToPool(TechType.GasTorpedo); public override void patch() { TechType = register("Stasis torpedo", "Generates a localized stasis field. Load this to a vehicle torpedo bay."); addToGroup(TechGroup.VehicleUpgrades, TechCategory.VehicleUpgrades, TechType.GasTorpedo); #if GAME_SN addCraftingNodeTo(CraftTree.Type.SeamothUpgrades, "Torpedoes"); setAllTechTypesForUnlock(TechType.StasisRifle, TechType.GasTorpedo); #elif GAME_BZ addCraftingNodeTo(CraftTree.Type.SeamothUpgrades, "ExosuitModules", TechType.GasTorpedo); addCraftingNodeTo(CraftTree.Type.Fabricator, "Upgrades/ExosuitUpgrades", TechType.GasTorpedo); setTechTypeForUnlock(TechType.GasTorpedo); #endif } } }
using System; using System.Collections.Generic; using System.Linq; using EVATransfer.Framework; using UnityEngine; namespace EVATransfer { public class TransferGroup { private bool onBoard; private Vessel vesselA, vesselB; protected TransferableResource resource; protected string name; private string shortName; protected double vesselACurrent, vesselBCurrent; protected double vesselAMax, vesselBMax; protected double transferScale; protected double transferAmount; protected double transferStartAmount; private DictionaryValueList<string, List<Part>> vesselAParts = new DictionaryValueList<string, List<Part>>(); private DictionaryValueList<string, List<Part>> vesselBParts = new DictionaryValueList<string, List<Part>>(); public TransferGroup(TransferableResource r) { resource = r; name = resource.Name; shortName = resource.ShortName; } public TransferGroup() { } public TransferableResource Resource { get { return resource; } } public double TransferScale { get { return transferScale; } } public bool OnBoard { get { return onBoard; } } #region Public methods called by the transfer window public void updateVessels(Vessel a, Vessel b) { vesselA = a; vesselB = b; if (vesselA == null || vesselB == null) onBoard = false; if (vesselA.Parts.Any(p => p.Resources.Contains(name)) && vesselB.Parts.Any(p => p.Resources.Contains(name))) onBoard = true; else onBoard = false; } public void drawResourceGroup(float y, bool transfering, bool behind) { drawIcon(new Rect(-2, y, 36, 36)); drawTransferAmount(new Rect(115, y + 3, 80, 20), transfering); drawSlider(new Rect(32, y + 22, 246, 30), transfering, behind); drawValues(new Rect(40, y + 20, 100, 20)); } public bool drawCloseGroup(float x, float y, bool transfering, bool behind) { return drawCloseButton(new Rect(x, y, 18, 18), transfering, behind); } public void transferResources(float time, float speed) { transferStep(time, speed); } public void toggleTransfer() { toggleResourceSetup(); } public void updateValues(bool values, bool parts, int mode, bool ignoreInactive) { if (parts) updatePartList(mode, ignoreInactive); if (values) updateResources(); } public void finishTransfer() { resetTransferValues(); } #endregion #region Updating part lists and resource amounts private void updateResources() { resetValues(); if (vesselAParts.Contains(name)) { int l = vesselAParts[name].Count; for (int i = 0; i < l; i++) { Part p = vesselAParts[name][i]; if (p == null) continue; checkPartAmount(p, true); } } if (vesselBParts.Contains(name)) { int l = vesselBParts[name].Count; for (int i = 0; i < l; i++) { Part p = vesselBParts[name][i]; if (p == null) continue; checkPartAmount(p, false); } } } private void updatePartList(int fillMode, bool ignoreInactive) { if (vesselA == null || vesselB == null) return; vesselAParts = new DictionaryValueList<string, List<Part>>(); vesselBParts = new DictionaryValueList<string, List<Part>>(); List<Part> sourceList = new List<Part>(); for (int i = vesselA.Parts.Count - 1; i >= 0; i--) { Part p = vesselA.Parts[i]; if (p == null || p.State == PartStates.DEAD) continue; if (!checkPartForResources(p, ignoreInactive)) continue; sourceList.Add(p); } sortParts(sourceList, fillMode); if (!vesselAParts.Contains(name)) vesselAParts.Add(name, sourceList); List<Part> targetList = new List<Part>(); for (int i = vesselB.Parts.Count - 1; i >= 0; i--) { Part p = vesselB.Parts[i]; if (p == null || p.State == PartStates.DEAD) continue; if (!checkPartForResources(p, ignoreInactive)) continue; targetList.Add(p); } sortParts(targetList, fillMode); if (!vesselBParts.Contains(name)) vesselBParts.Add(name, targetList); } protected virtual bool checkPartForResources(Part p, bool ignore) { if (!p.Resources.Contains(name)) return false; if (ignore && !p.Resources[name].flowState) return false; if (p.Resources[name].maxAmount < 0.6) return false; return true; } protected virtual void resetValues() { vesselACurrent = 0; vesselAMax = 0; vesselBCurrent = 0; vesselBMax = 0; } protected virtual void resetTransferValues() { transferScale = 0; transferAmount = 0; transferStartAmount = 0; } protected virtual void checkPartAmount(Part p, bool a) { if (!p.Resources.Contains(name)) return; PartResource pr = p.Resources[name]; if (a) { vesselACurrent += pr.amount; vesselAMax += pr.maxAmount; } else { vesselBCurrent += pr.amount; vesselBMax += pr.maxAmount; } } private void sortParts(List<Part> list, int i) { switch (i) { case 0: { list.Sort((a, b) => a.Resources[name].maxAmount.CompareTo(b.Resources[name].maxAmount)); break; } case 1: { list.Sort((a, b) => a.Resources[name].maxAmount.CompareTo(b.Resources[name].maxAmount)); list.Reverse(); break; } default: { break; } } } #endregion #region Resource Transfer Methods protected virtual void toggleResourceSetup() { if (transferScale > 1) { transferAmount = (transferScale / 100) * vesselACurrent; if (transferAmount > (vesselBMax - vesselBCurrent)) transferAmount = vesselBMax - vesselBCurrent; } else if (transferScale < -1) { transferAmount = ((transferScale * -1) / 100) * vesselBCurrent; if (transferAmount > (vesselAMax - vesselACurrent)) transferAmount = vesselAMax - vesselACurrent; } else transferAmount = 0; transferStartAmount = transferAmount; } private void transferStep(float time, float speed) { if (vesselA == null || vesselB == null) return; if (!vesselAParts.Contains(name) || !vesselBParts.Contains(name)) return; if (transferScale <= 0.1 && transferScale >= -0.1) return; if (transferAmount <= 0.001) return; float timeSlice = time / (speed * (float)(Math.Abs(transferScale) / 100)); if (transferScale < -0.1) { if (vesselBCurrent <= 0.001) return; transferFromTo(vesselBParts[name], vesselAParts[name], timeSlice); } else { if (vesselACurrent <= 0.001) return; transferFromTo(vesselAParts[name], vesselBParts[name], timeSlice); } } protected virtual void transferFromTo(List<Part> fromParts, List<Part> toParts, float time) { double resourceSubtract = transferStartAmount * time; double partSubtract = resourceSubtract; int l = fromParts.Count; for (int i = 0; i < l; i++) { Part p = fromParts[i]; if (p == null) continue; PartResource r = p.Resources[name]; if (r == null) continue; if (r.maxAmount > 0.1) { if (r.amount > 0.001) { if (partSubtract > r.amount) { transferAmount -= r.amount; partSubtract -= r.amount; r.amount -= r.amount; } else { r.amount -= partSubtract; transferAmount -= partSubtract; partSubtract = 0; } } } if (partSubtract <= 0) break; } double partAdd = resourceSubtract; l = toParts.Count; for (int i = 0; i < l; i++) { Part p = toParts[i]; if (p == null) continue; PartResource r = p.Resources[name]; if (r == null) continue; if (r.maxAmount > 0.1) { if (r.amount < r.maxAmount - 0.001) { if (partAdd > r.maxAmount - r.amount) { partAdd -= (r.maxAmount - r.amount); r.amount += (r.maxAmount - r.amount); } else { r.amount += partAdd; partAdd = 0; } } } if (partAdd <= 0) break; } } #endregion #region GUI Drawing Methods protected virtual void drawIcon(Rect r) { Color old = GUI.color; if (resource.Primary) { GUI.color = resource.IconColor; GUI.DrawTexture(r, resource.Icon); GUI.color = old; } else { r.x = 4; r.y += 2; r.width = 100; r.height = 18; GUI.Label(r, shortName, EVATransfer_Startup.labelLeft); } } protected virtual void drawTransferAmount(Rect r, bool t) { string label = ""; if (transferScale > 1) { double amount = 0; if (t) amount = transferAmount; else { amount = (transferScale / 100) * vesselACurrent; if (amount > vesselACurrent) amount = vesselACurrent; double limit = vesselBMax - vesselBCurrent; if (amount > limit) amount = limit; } label = getDisplayString(amount) + " >"; } else if (transferScale < -1) { double amount = 0; if (t) amount = transferAmount; else { amount = -1 * (transferScale / 100) * vesselBCurrent; if (amount > vesselBCurrent) amount = vesselBCurrent; double limit = vesselAMax - vesselACurrent; if (amount > limit) amount = limit; } label = "< " + getDisplayString(amount); } else return; GUI.Label(r, label); } protected virtual void drawSlider(Rect r, bool t, bool b) { if (b) GUI.Label(r, "", EVATransfer_Startup.slider); else if (t) { float slider = 0; if (transferStartAmount > 0) slider = transferScale == 0 ? 0 : (float)(transferScale * (transferAmount / transferStartAmount)); GUI.HorizontalSlider(r, slider, -100, 100); } else { transferScale = GUI.HorizontalSlider(r, (float)transferScale, -100, 100); transferScale = Math.Round(transferScale / 5) * 5; } drawSliderLabel(r); } private void drawSliderLabel(Rect r) { r.x = 38; r.y += 5; r.width = 18; r.height = 10; GUI.Label(r, "|", EVATransfer_Startup.labelSlider); r.x += 61; GUI.Label(r, "|", EVATransfer_Startup.labelSlider); r.x += 54; GUI.Label(r, "|", EVATransfer_Startup.labelSlider); r.x += 56; GUI.Label(r, "|", EVATransfer_Startup.labelSlider); r.x += 58; GUI.Label(r, "|", EVATransfer_Startup.labelSlider); r.x = 33; r.y += 8; r.width = 30; GUI.Label(r, "100%", EVATransfer_Startup.labelSlider); r.x += 63; GUI.Label(r, "50%", EVATransfer_Startup.labelSlider); r.x += 56; GUI.Label(r, "0%", EVATransfer_Startup.labelSlider); r.x += 54; GUI.Label(r, "50%", EVATransfer_Startup.labelSlider); r.x += 56; GUI.Label(r, "100%", EVATransfer_Startup.labelSlider); } protected virtual void drawValues(Rect r) { GUI.Label(r, getDisplayString(vesselACurrent) + " / " + getDisplayString(vesselAMax)); r.x += 135; GUI.Label(r, getDisplayString(vesselBCurrent) + " / " + getDisplayString(vesselBMax)); } protected virtual bool drawCloseButton(Rect r, bool t, bool b) { if (b) GUI.Label(r, "X", EVATransfer_Startup.closeButton); else { if (GUI.Button(r, "X", EVATransfer_Startup.closeButton)) { if (!t) return true; } } return false; } protected string getDisplayString(double value) { string s = ""; if (value <= 0) s = "0"; else if (value > 0 && value < 100) s = value.ToString("F2"); else if (value >= 100 && value < 1000) s = value.ToString("F1"); else if (value >= 1000 && value < 10000) s = (value /= 1000).ToString("F1") + "k"; else s = (value /= 1000).ToString("F0") + "k"; return s; } #endregion } }
using System; using DxLibDLL; namespace Amaoto { /// <summary> /// ログクラス。 /// </summary> public class Logger { /// <summary> /// ログを追加する。 /// </summary> /// <param name="str">内容。</param> /// <returns>このクラスのインスタンス。</returns> public Logger Add(string str) { DX.ErrorLogAdd(str + Environment.NewLine); return this; } /// <summary> /// ログを追加する。 /// </summary> /// <param name="strArray">内容。</param> /// <returns>このクラスのインスタンス。</returns> public Logger Add(string[] strArray) { Array.ForEach(strArray, s => DX.ErrorLogAdd(s + Environment.NewLine)); return this; } /// <summary> /// ログのインデントを増やす。 /// </summary> /// <returns>このクラスのインスタンス。</returns> public Logger Indent() { DX.ErrorLogTabAdd(); return this; } /// <summary> /// ログのインデントを減らす。 /// </summary> /// <returns>このクラスのインスタンス。</returns> public Logger UnIndent() { DX.ErrorLogTabSub(); return this; } } }
using System.Data; using System.Data.SqlClient; using Dapper; using DevChatter.DevStreams.Core.Model; using DevChatter.DevStreams.Core.Services; using DevChatter.DevStreams.Core.Settings; using Microsoft.Extensions.Options; namespace DevChatter.DevStreams.Infra.Dapper.Services { public class ChannelPermissionsService : IChannelPermissionsService { private readonly DatabaseSettings _dbSettings; public ChannelPermissionsService(IOptions<DatabaseSettings> databaseSettings) { _dbSettings = databaseSettings.Value; } public bool CanAccessChannel(string userId, int channelId) { using (var conn = new SqlConnection(_dbSettings.DefaultConnection)) { const string sql = "WHERE ChannelId = @channelId and UserId = @userId"; return conn.RecordCount<ChannelPermission>(sql, new { userId, channelId }) > 0; } } } }
using System; using System.Globalization; using System.Windows.Data; using System.Windows.Media; namespace ImageBoardBrowser.Converters { public class StringToBrushConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var source = value as string; if (source == null) { return null; } var seed = source.GetHashCode(); //return new SolidColorBrush(new Color { A = 30 }.GetRandom(0.8, 1, seed)); return new Color { A = 60 }.GetRandom(0.8, 1, seed); } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }
// // The MIT License(MIT) // // Copyright(c) 2015 Christopher McLendon (http://www.bitunify.com) // // 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. // // <Description> // Base class for communicating with Hitachi HD44780U compatible LCD displays. This display // uses an 8-bit or 4-bit data interface with 3 additional control lines (RS, RW and E). // </Description> // using System; using Bit.Windows.Devices.I2c.Expansion; namespace Bit.Windows.Devices.I2c.LCD { public class HD44780UI2c : HD44780U { /// <summary> /// MPU pin assiggments /// </summary> private byte pin_Rs; // register select private byte pin_Rw; // read-write private byte pin_En; // enable /// <summary> /// Other feature pins /// </summary> private byte pin_Bl; // backlight /// <summary> /// Data pin mappings /// </summary> private byte[] dataPinMap; /// <summary> /// I2c Bus Address /// </summary> private byte i2caddr; /// <summary> /// PCF8574 8-bit I/O expander /// </summary> private PCF8574 pcf; public HD44780UI2c(byte i2caddr, DATAMODE dataMode, DISPLAYDEF displayMode, byte Rs = 0, byte Rw = 1, byte En = 2, byte Bl = 3, byte D4 = 4, byte D5 = 5, byte D6 = 6, byte D7 = 7) : base(DATAMODE.MODE_4BIT, displayMode) { this.i2caddr = i2caddr; // set mask for data pins (4-bit data mode) dataPinMap = new byte[4]; dataPinMap[0] = (byte)(1 << D4); dataPinMap[1] = (byte)(1 << D5); dataPinMap[2] = (byte)(1 << D6); dataPinMap[3] = (byte)(1 << D7); // set mask for the MPU interface pins and features this.pin_Rs = (byte)(1 << Rs); this.pin_Rw = (byte)(1 << Rw); this.pin_En = (byte)(1 << En); this.pin_Bl = (byte)(1 << Bl); } private void pulse(byte data) { byte mask = (byte)(data | pin_En); if (EnableBacklight == true) mask |= pin_Bl; pcf.Write(mask); pcf.Write((byte)(mask & ~pin_En)); } public override void Initialize() { // initialize our simplified PCF8574 controller pcf = new PCF8574(); pcf.Initialize(i2caddr); base.Initialize(); } protected override void SendCommand(Command cmd) { byte[] message; byte data = cmd.Data; // configure MPU mask byte mpuMask = (byte) (((cmd.Rs == true) ? pin_Rs : 0) | ((cmd.Rw == true) ? pin_Rw : 0)); if (dataBusInitialized == true) { message = new byte[] { 0x0, 0x0 }; // low nibble for (int i = 0; i < 4; i++) { if ((data & 0x1) == 1) { message[1] |= dataPinMap[i]; } data = (byte)(data >> 1); } // high nibble for (int i = 0; i < 4; i++) { if ((data & 0x1) == 1) { message[0] |= dataPinMap[i]; } data = (byte)(data >> 1); } } else { // still writing 4-bits (high nibble only) message = new byte[] { 0x0 }; data = (byte)(data >> 4); for (int i = 0; i < 4; i++) { if ((data & 0x1) == 1) { message[0] |= dataPinMap[i]; } data = (byte)(data >> 1); } } foreach (byte b in message) { byte register = (byte)(b | mpuMask); pulse(register); } } protected override byte Read() { byte register = 0x0; pcf.Read(ref register); return register; } protected override void FeatureStateChanged(FEATURE mask) { if ((mask & FEATURE.BACKLIGHT) == FEATURE.BACKLIGHT) { if (EnableBacklight == true) pcf.Write(pin_Bl); } } } }
using RTData.Geometry; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RTData.Radiotherapy.ROIs { /// <summary> /// Represents a single slice of the ROI which may contain multiple polygons /// </summary> public class RegionOfInterestSlice { public List<PlanarPolygon> Polygons { get; set; } public BinaryMask BinaryMask { get; set; } public double ZCoord { get; set; } public RegionOfInterestSlice() { Polygons = new List<PlanarPolygon>(); BinaryMask = new BinaryMask(); } public void AddPolygon(PlanarPolygon polygon) { Polygons.Add(polygon); } public void ComputeBinaryMask() { if (Polygons.Count > 1) { } for (int i = 0; i < Polygons.Count; i++) { BinaryMask.AddPolygon(Polygons[i]); } } public bool ContainsPoint(double x, double y) { return BinaryMask.ContainsPoint(x, y); } } }
using System; using System.Threading.Tasks; using Amazon.SQS; using LambdaSharp; using LambdaSharp.SimpleQueueService; namespace LogBuster.ReadAndFailFunction { public class Message { //--- Properties --- public int Counter; } public sealed class Function : ALambdaQueueFunction<Message> { //--- Fields --- private string _queueUrl; private IAmazonSQS _sqsClient; //--- Constructors --- public Function() : base(new LambdaSharp.Serialization.LambdaSystemTextJsonSerializer()) { } //--- Methods --- public override async Task InitializeAsync(LambdaConfig config) { // read configuration settings _queueUrl = config.ReadSqsQueueUrl("Queue"); // initialize clients _sqsClient = new AmazonSQSClient(); } public override async Task ProcessMessageAsync(Message message) { await Task.WhenAll( _sqsClient.SendMessageAsync(_queueUrl, LambdaSerializer.Serialize(new Message { Counter = message.Counter + 1 })), _sqsClient.SendMessageAsync(_queueUrl, LambdaSerializer.Serialize(new Message { Counter = message.Counter + 2 })) ); throw new Exception("oops!"); } } }
// // Copyright (c) 2002-2016 Mirko Matytschak // (www.netdataobjects.de) // // Author: Mirko Matytschak // // 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.Collections.Generic; using System.Text; namespace Generator { class Merge { static string commentPrefix; public static string CommentPrefix { get { return commentPrefix; } set { commentPrefix = value; } } static bool ignoreSpaces; public static bool IgnoreSpaces { get { return ignoreSpaces; } set { ignoreSpaces = value; } } public static bool MergeFiles( string fileNameA, Stream fileStreamB, string mergedFileName ) { List<string> oldLines = ExtractLines( fileNameA ); List<string> newLines = ExtractLines( fileStreamB ); return MergeLines( oldLines, newLines, mergedFileName ); } public static bool MergeFiles( string fileNameA, string fileNameB, string mergedFileName ) { List<string> oldLines = ExtractLines( fileNameA ); List<string> newLines = ExtractLines( fileNameB ); return MergeLines( oldLines, newLines, mergedFileName ); } private static bool MergeLines( List<string> oldLines, List<string> newLines, string mergedFileName ) { Diff.Item[] items = Diff.DiffText( oldLines, newLines, true, ignoreSpaces, false ); StreamWriter sw = new StreamWriter( mergedFileName ); bool hasConflicts = Merge.Write( items, sw, oldLines, newLines ); sw.Close(); return hasConflicts; } private static List<string> ExtractLines( string fileName ) { List<string> lines = new List<string>(100); using ( StreamReader sr = new StreamReader( fileName ) ) { string line; while ( ( line = sr.ReadLine() ) != null ) lines.Add( line ); sr.Close(); } return lines; } private static List<string> ExtractLines( Stream fileStream ) { List<string> lines = new List<string>(100); // The stream remains open in this case, since it is passed in from the outside. StreamReader sr = new StreamReader( fileStream ); string line; while ( (line = sr.ReadLine()) != null ) lines.Add( line ); return lines; } static bool Write( Diff.Item[] items, StreamWriter sw, List<string> oldLines, List<string> newLines ) { bool hasConflicts = false; int nextToWrite = 0; foreach ( Diff.Item item in items ) { if ( item.InsertedB == 0 ) // ignore the deletion and write the old data continue; for ( int i = nextToWrite; i < item.StartA; i++ ) sw.WriteLine( oldLines[i] ); nextToWrite = item.StartA; if ( item.DeletedA > 0 ) // conflict { hasConflicts = true; sw.WriteLine( commentPrefix + " !!!! ClassGenerator merge conflict !!!! Your code follows: -->" ); for ( int i = item.StartA; i < item.StartA + item.DeletedA; i++ ) sw.WriteLine( oldLines[i] ); nextToWrite = item.StartA + item.DeletedA; sw.WriteLine( commentPrefix + " !!!! The ClassGenerator's code follows: -->" ); for ( int i = item.StartB; i < item.StartB + item.InsertedB; i++ ) sw.WriteLine( newLines[i] ); sw.WriteLine( commentPrefix + " !!!! End of merge conflict -->" ); } else { for ( int i = item.StartB; i < item.StartB + item.InsertedB; i++ ) sw.WriteLine( newLines[i] ); } } if ( nextToWrite < oldLines.Count - 1 ) { for ( int i = nextToWrite; i < oldLines.Count; i++ ) sw.WriteLine( oldLines[i] ); } return hasConflicts; } } }
using System; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.SignalR; namespace Server { [Route("[controller]")] [ApiController] [Authorize] public class MessageController : ControllerBase { private readonly IHubContext<MessageHub, IMessageHubClient> hubContext; private readonly IConnectionStore connectionStore; public MessageController(IHubContext<MessageHub, IMessageHubClient> hubContext, IConnectionStore connectionStore) { this.hubContext = hubContext; this.connectionStore = connectionStore; } [HttpPost("send")] public async Task<IActionResult> Send(SendMessageRequest request, CancellationToken cancellationToken) { var connectionId = this.connectionStore.GetConnection(Guid.Parse(request.UserId)); await hubContext.Clients.AllExcept(connectionId).SendMessage(new Message { Content = request.Message, UserName = request.UserName }); return Ok(); } } public class SendMessageRequest { public string Message { get; set; } public string UserName { get; set; } public string UserId { get; set; } } }
using Araumi.Server.Protocol.Attributes; using Araumi.Server.EntityComponentSystem.Core; namespace Araumi.Server.EntityComponentSystem.Components.Battle.Effect.Unit { [TypeUid(636364931473899150L)] public class UnitTargetingConfigComponent : Component { public float TargetingPeriod { get; set; } public float WorkDistance { get; set; } public UnitTargetingConfigComponent(float targetingPeriod, float workingDistance) { TargetingPeriod = targetingPeriod; WorkDistance = workingDistance; } } }
using Gov.Lclb.Cllb.Interfaces.Models; namespace Gov.Lclb.Cllb.Public.Models { /// <summary> /// ViewModel transforms. /// </summary> public static class IndigenousNationExtensions { /// <summary> /// Convert a given voteQuestion to a ViewModel /// </summary> public static ViewModels.IndigenousNation ToViewModel(this MicrosoftDynamicsCRMadoxioLocalgovindigenousnation item) { ViewModels.IndigenousNation result = null; if (item != null) { result = new ViewModels.IndigenousNation { Id = item.AdoxioLocalgovindigenousnationid, Name = item.AdoxioName }; } return result; } } }
using System; namespace SmartSql.Test.DTO { public class UserVW { public UserVW() { } public UserVW(long id) { Id = id; } public UserVW(long id, string name) { Id = id; UserName = name; } public UserVW(long id, string name, UserStatusVW status) { Id = id; UserName = name; Status = status; } public virtual long Id { get; set; } public virtual string UserName { get; set; } public virtual UserStatusVW Status { get; set; } public long CustomerId { get; set; } public string CustomerName { get; set; } } public enum UserStatusVW : Int16 { Ok = 1 } }
using System; using GameFramework.DataTable; using UnityEngine; [Serializable] public class MagicWaterData : EntityData { public MagicWaterData (int entityId, int typeId) : base (entityId, typeId) { IDataTable<DRMagicWater> dtMagicWater = GameEntry.DataTable.GetDataTable<DRMagicWater> (); DRMagicWater drMagicWater = dtMagicWater.GetDataRow (TypeId); if (drMagicWater == null) { return; } Delay = drMagicWater.Delay; AddHPPercent = drMagicWater.AddHPPercent; AddHP = drMagicWater.AddHP; AddAtk = drMagicWater.AddAtk; AddGold = drMagicWater.AddGold; CreateCloneHeroTypeID = drMagicWater.CreateCloneHeroTypeID; Position = drMagicWater.Position; ParticleTypeID = drMagicWater.ParticleTypeID; } /// <summary> /// 产生效果的间隔 /// </summary> public float Delay { get; private set; } /// <summary> /// 增加血量百分比 /// </summary> public float AddHPPercent { get; private set; } /// <summary> /// 增加血量绝对值 /// </summary> public int AddHP { get; private set; } /// <summary> /// 增加攻击 /// </summary> public int AddAtk { get; private set; } /// <summary> /// 增加金币 /// </summary> public int AddGold { get; private set; } /// <summary> /// 创建克隆英雄的ID /// </summary> /// <returns></returns> public int CreateCloneHeroTypeID { get; private set; } /// <summary> /// 粒子特效ID /// </summary> /// <returns></returns> public int ParticleTypeID { get; private set; } }
namespace Multiformats.Codec.Tests; using System.Text; using Xunit; /// <summary> /// Class MulticodecPackedTests. /// </summary> public class MulticodecPackedTests { /// <summary> /// Defines the test method CanGetStringValuOfCode. /// </summary> /// <param name="code">The code.</param> /// <param name="expected">The expected.</param> [Theory] [InlineData(MulticodecCode.Unknown, "<Unknown Multicodec>")] [InlineData(MulticodecCode.GitRaw, "git-raw")] [InlineData(MulticodecCode.MerkleDAGProtobuf, "dag-pb")] [InlineData(MulticodecCode.MerkleDAGCBOR, "dag-cbor")] [InlineData(MulticodecCode.Raw, "raw")] [InlineData(MulticodecCode.EthereumBlock, "eth-block")] [InlineData(MulticodecCode.EthereumTransaction, "eth-tx")] [InlineData(MulticodecCode.BitcoinBlock, "bitcoin-block")] [InlineData(MulticodecCode.BitcoinTransaction, "bitcoin-tx")] [InlineData(MulticodecCode.ZcashBlock, "zcash-block")] [InlineData(MulticodecCode.ZcashTransaction, "zcash-tx")] public void CanGetStringValuOfCode(MulticodecCode code, string expected) { Assert.Equal(code.GetString(), expected); } /// <summary> /// Defines the test method CanGetCorrectEnumFromNumber. /// </summary> /// <param name="n">The n.</param> /// <param name="expected">The expected.</param> [Theory] [InlineData(0UL, MulticodecCode.Unknown)] [InlineData(0x78UL, MulticodecCode.GitRaw)] [InlineData(0x70UL, MulticodecCode.MerkleDAGProtobuf)] [InlineData(0x71UL, MulticodecCode.MerkleDAGCBOR)] [InlineData(0x55UL, MulticodecCode.Raw)] [InlineData(0x90UL, MulticodecCode.EthereumBlock)] [InlineData(0x93UL, MulticodecCode.EthereumTransaction)] [InlineData(0xb0UL, MulticodecCode.BitcoinBlock)] [InlineData(0xb1UL, MulticodecCode.BitcoinTransaction)] [InlineData(0xc0UL, MulticodecCode.ZcashBlock)] [InlineData(0xc1UL, MulticodecCode.ZcashTransaction)] public void CanGetCorrectEnumFromNumber(ulong n, MulticodecCode expected) { Assert.Equal((MulticodecCode)n, expected); } /// <summary> /// Defines the test method RoundTrip. /// </summary> /// <param name="code">The code.</param> [Theory] [InlineData(MulticodecCode.GitRaw)] [InlineData(MulticodecCode.MerkleDAGProtobuf)] [InlineData(MulticodecCode.MerkleDAGCBOR)] [InlineData(MulticodecCode.Raw)] [InlineData(MulticodecCode.EthereumBlock)] [InlineData(MulticodecCode.EthereumTransaction)] [InlineData(MulticodecCode.BitcoinBlock)] [InlineData(MulticodecCode.BitcoinTransaction)] [InlineData(MulticodecCode.ZcashBlock)] [InlineData(MulticodecCode.ZcashTransaction)] public void RoundTrip(MulticodecCode code) { byte[]? data = Encoding.UTF8.GetBytes("Hello World"); byte[]? mcdata = MulticodecPacked.AddPrefix(code, data); byte[]? outdata = MulticodecPacked.SplitPrefix(mcdata, out MulticodecCode outc); Assert.Equal(outc, code); Assert.Equal(MulticodecPacked.GetCode(mcdata), code); Assert.Equal(outdata, data); } /// <summary> /// Defines the test method GivenInvalidCode_ReturnsUnknown. /// </summary> /// <param name="data">The data.</param> [Theory] [InlineData(null)] [InlineData(new byte[] { })] [InlineData(new byte[] { 255, 255 })] public void GivenInvalidCode_ReturnsUnknown(byte[] data) { MulticodecCode c = MulticodecPacked.GetCode(data); Assert.Equal(MulticodecCode.Unknown, c); } }
namespace GVFS.FunctionalTests { public static class Categories { public const string FullSuiteOnly = "FullSuiteOnly"; public const string FastFetch = "FastFetch"; public const string GitCommands = "GitCommands"; } }
// Copyright 2020, Google Inc. All rights reserved. // // 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. using Google.Apis.Util; namespace FirebaseAdmin.Auth.Multitenancy { /// <summary> /// Represents a tenant in a multi-tenant application.. /// /// <para>Multitenancy support requires Google Cloud Identity Platform (GCIP). To learn more /// about GCIP, including pricing and features, see the /// <a href="https://cloud.google.com/identity-platform">GCIP documentation</a>.</para> /// /// <para>Before multitenancy can be used in a Google Cloud Identity Platform project, tenants /// must be allowed on that project via the Cloud Console UI.</para> /// /// <para>A tenant configuration provides information such as the display name, tenant /// identifier and email authentication configuration. For OIDC/SAML provider configuration /// management, TenantAwareFirebaseAuth instances should be used instead of a Tenant to /// retrieve the list of configured IdPs on a tenant. When configuring these providers, note /// that tenants will inherit whitelisted domains and authenticated redirect URIs of their /// parent project.</para> /// /// <para>All other settings of a tenant will also be inherited. These will need to be managed /// from the Cloud Console UI.</para> /// </summary> public sealed class Tenant { private readonly TenantArgs args; internal Tenant(TenantArgs args) { this.args = args.ThrowIfNull(nameof(args)); } /// <summary> /// Gets the tenant identifier. /// </summary> public string TenantId => this.ExtractResourceId(this.args.Name); /// <summary> /// Gets the tenant display name. /// </summary> public string DisplayName => args.DisplayName; /// <summary> /// Gets a value indicating whether the email sign-in provider is enabled. /// </summary> public bool PasswordSignUpAllowed => args.PasswordSignUpAllowed ?? false; /// <summary> /// Gets a value indicating whether the email link sign-in is enabled. /// </summary> public bool EmailLinkSignInEnabled => args.EmailLinkSignInEnabled ?? false; private string ExtractResourceId(string resourceName) { var segments = resourceName.Split('/'); return segments[segments.Length - 1]; } } }
namespace ISSApp { public class User { public User() { } public User(string firstName, string lastName, string code, UserType userType) { FirstName = firstName; LastName = lastName; Code = code; Type = userType; } public string FirstName { get; set; } public string LastName { get; set; } public string Code { get; set; } public UserType Type { get; set; } } }
using BookLibraryApi.Models.Entities.Interfaces; namespace BookLibraryApi.Models.Entities { public sealed class VolumeExemplar : IEntity { public int Id { get; set; } public int VolumeId { get; set; } public Volume Volume { get; set; } public decimal? Price { get; set; } public int? YearOfPurchase { get; set; } public string InventoryNumber { get; set; } public bool? IsInPlace { get; set; } } }
using System; using System.IO; namespace Xe.Tools.Items { public class ItemModule : IInfoLastEdit { public string FileName { get; private set; } public ItemModule(string filename) { FileName = filename; } public DateTime? GetInfoLastEdit() { if (!File.Exists(FileName)) return null; return File.GetLastWriteTimeUtc(FileName); } public DateTime? GetInfoLastEditRecursive() { return GetInfoLastEdit(); } } }
using UnityEngine; using System.Collections; /// <summary> /// 子弹行为 /// </summary> public class ShotScript : MonoBehaviour { #region 1 - 变量 /// <summary> /// 造成伤害 /// </summary> public int damage = 1; /// <summary> /// 子弹归属 , true-敌人的子弹, false-玩家的子弹 /// </summary> public bool isEnemyShot = false; #endregion // Use this for initialization void Start() { // 2 - 为避免任何泄漏,只给予有限的生存时间.[20秒] Destroy(gameObject, 20); } }
using System; using System.Windows.Forms; namespace Captura.Webcam { class DummyForm : Form { public DummyForm() { Opacity = 0; ShowInTaskbar = false; } protected override void WndProc(ref Message M) { const int msgLeftButtonDown = 513; if (M.Msg == msgLeftButtonDown) { OnClick(EventArgs.Empty); } base.WndProc(ref M); } } }
using UnityEngine; using System.Collections; using UnityEditor; //[CustomEditor(typeof(VoxelMesh))] public class VoxelEditor : Editor { [MenuItem("Window/VoxelEditor")] public static void ShowWindow() { EditorWindow.GetWindow(typeof(VoxelEditor)); } public VoxelMesh voxel; //public SerializedObject s_voxel; //public SerializedProperty op,model; public int test = 0; // Use this for initialization void Start() { } public void OnEnable() { Debug.Log("VoxelEditor.OnEnable"); //voxel = (VoxelMesh)target; //s_voxel = new SerializedObject(voxel); //op = s_voxel.FindProperty("op"); //model = s_voxel.FindProperty("model"); voxel.Init(); SceneView.onSceneGUIDelegate = EditorUpdate; } public void OnDisable() { SceneView.onSceneGUIDelegate = null; Debug.Log("VoxelEditor.OnDisable"); voxel.OnDisable(); } // Update is called once per frame void Update() { } public override void OnInspectorGUI() { GUILayout.BeginHorizontal(); if (GUILayout.Button("清空")){ Debug.Log("clear"); voxel.clear(); } GUILayout.EndHorizontal(); //DrawDefaultInspector(); //SceneView.RepaintAll(); } void EditorUpdate(SceneView sceneView) { voxel.EditorUpdate(sceneView.camera); SceneView.RepaintAll(); } }
using NsauT.Shared.Enums; using NsauT.Web.BLL.Services.Period.DTO; using System.Collections.Generic; namespace NsauT.Web.BLL.Services.Period { public static class PeriodValidator { public static List<(string Key, string Message)> Validate(PeriodDto period) { var errors = new List<(string, string)>(); string errorMessage; if (!IsValidPeriodOption(period, out errorMessage)) { var pair = (nameof(period.Option), errorMessage); errors.Add(pair); } if (!period.IsLecture && string.IsNullOrWhiteSpace(period.Subgroup)) { errorMessage = "Пара не лекция, но подгруппа не указана"; var pair = (nameof(period.Subgroup), errorMessage); errors.Add(pair); } return errors; } private static bool IsValidPeriodOption(PeriodDto period, out string errorMessage) { if (period.Option == PeriodOption.None && !string.IsNullOrEmpty(period.OptionCabinet)) { errorMessage = "Пара без доп. условия, но указан доп. кабинет"; return false; } if (period.Option == PeriodOption.None && period.OptionDate != null) { errorMessage = "Пара без доп. условия, но указана доп. дата"; return false; } if (period.Option == PeriodOption.Once && period.OptionDate == null) { errorMessage = "Пара единожды, но доп. дата не указана"; return false; } if (period.Option == PeriodOption.OnceDifferentCabinet && string.IsNullOrWhiteSpace(period.OptionCabinet)) { errorMessage = "Пара однажды в другом кабинете, но доп. кабинет не указан"; return false; } if (period.Option == PeriodOption.OnceDifferentCabinet && period.OptionDate == null) { errorMessage = "Пара однажды в другом кабинете, но доп. дата не указана"; return false; } if (period.Option == PeriodOption.Since && period.OptionDate == null) { errorMessage = "Пара начинается с определенной даты, но доп. дата не указана"; return false; } if (period.Option == PeriodOption.Until && period.OptionDate == null) { errorMessage = "Пара идет до определенной даты, но доп. дата не указана"; return false; } errorMessage = string.Empty; return true; } } }
using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; namespace MacomberMap.UI.DgvFilterPopup { /// <summary> /// Represents the method that will handle an event related to a column filter. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="ColumnFilterEventArgs"/> instance containing the event data.</param> public delegate void ColumnFilterEventHandler(object sender, ColumnFilterEventArgs e); /// <summary> /// Provides data for a column filter event. /// </summary> [System.ComponentModel.ToolboxItem(false)] public class ColumnFilterEventArgs : EventArgs { #region PRIVATE FIELDS private DataGridViewColumn mColumn; private DgvBaseColumnFilter mColumnFilter; private bool mHandled; #endregion #region PROPERTIES /// <summary> /// Gets the DataGridView column involved in the event. /// </summary> public DataGridViewColumn Column { get { return mColumn; }} /// <summary> /// Gets or sets the column filter instance. /// </summary> /// <value>A column filter instance.</value> public DgvBaseColumnFilter ColumnFilter { get { return mColumnFilter; } set { mColumnFilter = value; } } /// <summary> /// Gets or sets a value indicating whether this <see cref="ColumnFilterEventArgs"/> is handled. /// </summary> /// <value><c>true</c> if handled; otherwise, <c>false</c>.</value> public bool Handled { get { return mHandled; } set { mHandled = value; } } #endregion /// <summary> /// Initializes a new instance of the <see cref="ColumnFilterEventArgs"/> class. /// </summary> /// <param name="Column">The DstaGridView column.</param> /// <param name="ColumnFilter">The column filter instance.</param> public ColumnFilterEventArgs(DataGridViewColumn Column, DgvBaseColumnFilter ColumnFilter) { this.mColumn = Column; this.mColumnFilter = ColumnFilter; this.mHandled = Handled; } } }
/** 1 2 3 4 5 6 7 8 * 45678901234567890123456789012345678901234567890123456789012345678901234567890 * * Common.Dialogs <Font>: Common library providing WPF dialogs, v.0.0.1 * Johnathan Graham McKnight <akoimeexx@gmail.com> * * * Copyright (c) 2016, Johnathan Graham McKnight * 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. Neither the name of the copyright holder 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 HOLDER 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. */ namespace Common.Dialogs { using System; using Microsoft.Win32; using System.Collections.ObjectModel; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Interop; using System.Windows.Media; using Common.Extensions; public partial class FontDialog : CommonDialog { #region CommonDialog implementation public override void Reset() { throw new NotImplementedException(); } protected override bool RunDialog(IntPtr hwndOwner) { bool result = false; try { HwndSource hSrc = HwndSource.FromHwnd(hwndOwner); w.Owner = (Window)hSrc.RootVisual; w.ShowDialog(); } catch (Exception e) { MessageBox.Show(e.Message); } finally { result = (bool)w.DialogResult; } return result; } #endregion CommonDialog implementation } public partial class FontDialog { #region Datatypes private struct FontStyling { public string Name { get; set; } public FontWeight Weight { get; set; } public FontStyle Style { get; set; } } #endregion Datatypes } public partial class FontDialog { #region Properties public FontFamily FontFamily { get { return this.tPreview.FontFamily; } set { this.tPreview.FontFamily = value; }} public FontStyle FontStyle { get { return this.tPreview.FontStyle; } set { this.tPreview.FontStyle = value; }} public FontWeight FontWeight { get { return this.tPreview.FontWeight; } set { this.tPreview.FontWeight = value; }} public double FontSize { get { return this.tPreview.FontSize; } set { this.tPreview.FontSize = value; }} #endregion Properties } public partial class FontDialog { #region Components private static Thickness ButtonThickness = new Thickness(1); private static Thickness BoxThickness = new Thickness(1); private static Thickness LabelMargin = new Thickness(10, 10, 10, 0); private static Thickness ListMargin = new Thickness(10, 41, 10, 10); private const int LabelHeight = 26; private const int ButtonWidth = 96; private const int ButtonHeight = 28; private Window w = new Window() { AllowDrop = false, Height = 360, MinHeight = 300, MinWidth = 400, Name ="FontDialog", ResizeMode = ResizeMode.CanResizeWithGrip, ShowInTaskbar = false, Title = "Pick a Font", Topmost = true, Width = 480, Icon = Resources_Common.FontDialog_Icon.ToImageSource(), WindowStartupLocation = WindowStartupLocation.CenterOwner, WindowState = WindowState.Normal, WindowStyle = WindowStyle.ToolWindow }; private Label lbFamily = new Label() { Content = "_Family:", Name = "FamilyLabel", Height = LabelHeight, Margin = LabelMargin, Padding = BoxThickness, VerticalAlignment = VerticalAlignment.Top }; private Label lbStyle = new Label() { Content = "_Style:", Name = "StyleLabel", Height = LabelHeight, Margin = LabelMargin, Padding = BoxThickness, VerticalAlignment = VerticalAlignment.Top }; private Label lbSize = new Label() { Content = "Si_ze:", Name = "SizeLabel", Height = LabelHeight, Margin = LabelMargin, Padding = BoxThickness, VerticalAlignment = VerticalAlignment.Top }; private Label lbPreview = new Label() { Content = "_Preview:", Name = "PreviewLabel", Height = LabelHeight, Margin = LabelMargin, Padding = BoxThickness, VerticalAlignment = VerticalAlignment.Top }; private ListBox lFamily = new ListBox() { ItemsSource = new ObservableCollection<FontFamily>( Fonts.SystemFontFamilies ), Name = "FontFamilyList", AllowDrop = false, Margin = ListMargin, Padding = BoxThickness }; private ListBox lStyle = new ListBox() { DisplayMemberPath="Name", ItemsSource = new FontStyling[] { new FontStyling() { Name="Normal", Style=FontStyles.Normal, Weight=FontWeights.Normal }, new FontStyling() { Name="Bold", Style=FontStyles.Normal, Weight=FontWeights.Bold }, new FontStyling() { Name="Italic", Style=FontStyles.Italic, Weight=FontWeights.Normal }, new FontStyling() { Name="Bold Italic", Style=FontStyles.Italic, Weight=FontWeights.Bold } }, Name = "FontStyleList", AllowDrop = false, Margin = ListMargin, Padding = BoxThickness }; private ListBox lSize = new ListBox() { ItemsSource = new double[] { 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 32, 36, 40, 48, 56, 64, 72 }, Name = "FontSizeList", AllowDrop = false, Margin = new Thickness(10, 69, 10, 10), Padding = BoxThickness }; private TextBox tSize = new TextBox() { AllowDrop = false, Height = 23, HorizontalContentAlignment = HorizontalAlignment.Center, Margin = new Thickness(10, 41, 10, 0), Name = "FontSizeText", Padding = BoxThickness, TextWrapping = TextWrapping.NoWrap, VerticalAlignment = VerticalAlignment.Top, VerticalContentAlignment = VerticalAlignment.Center }; private TextBox tPreview = new TextBox() { AllowDrop = false, HorizontalContentAlignment = HorizontalAlignment.Left, Margin = new Thickness(10, 36, 10, 10), MinHeight = 23, Name = "PreviewText", Padding = BoxThickness, Text = "Grumpy wizards make toxic brew for the evil Queen and Jack.", TextWrapping = TextWrapping.NoWrap, VerticalContentAlignment = VerticalAlignment.Center }; private Button bOk = new Button() { Content = "_OK", IsDefault = true, Margin = new Thickness(0, 0, 47, 10), Name = "OkButton", AllowDrop = false, Height = ButtonHeight, HorizontalAlignment = HorizontalAlignment.Right, Padding = ButtonThickness, VerticalAlignment = VerticalAlignment.Bottom, Width = ButtonWidth }; private Button bCancel = new Button() { Content = "_Cancel", IsCancel = true, Margin = new Thickness(0, 0, 10, 10), Name = "CancelButton", AllowDrop = false, Height = ButtonHeight, HorizontalAlignment = HorizontalAlignment.Right, Padding = ButtonThickness, VerticalAlignment = VerticalAlignment.Bottom, Width = ButtonWidth }; private Grid gLayout = new Grid() { Margin = new Thickness(10) }; private RowDefinition rdTop = new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }; private RowDefinition rdMiddle = new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }; private RowDefinition rdBottom = new RowDefinition() { Height = new GridLength(48, GridUnitType.Pixel) }; private ColumnDefinition cdLeft = new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }; private ColumnDefinition cdMiddle = new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }; private ColumnDefinition cdRight = new ColumnDefinition() { Width = new GridLength(72, GridUnitType.Pixel) }; #endregion Components } public partial class FontDialog { #region Methods private void bOk_Click(object o, RoutedEventArgs e) { this.w.DialogResult = true; } #endregion Methods } public partial class FontDialog { #region Constructors & Destructor public FontDialog() { // Gridlines this.gLayout.RowDefinitions.Add(rdTop); this.gLayout.RowDefinitions.Add(rdMiddle); this.gLayout.RowDefinitions.Add(rdBottom); this.gLayout.ColumnDefinitions.Add(cdLeft); this.gLayout.ColumnDefinitions.Add(cdMiddle); this.gLayout.ColumnDefinitions.Add(cdRight); // Labels this.gLayout.Children.Add(lbFamily); Grid.SetColumn(lbFamily, 0); this.gLayout.Children.Add(lbStyle); Grid.SetColumn(lbStyle, 1); this.gLayout.Children.Add(lbSize); Grid.SetColumn(lbSize, 2); this.gLayout.Children.Add(lbPreview); Grid.SetRow(lbPreview, 1); Grid.SetColumnSpan(lbPreview, 3); // Font Settings Selectors this.gLayout.Children.Add(lFamily); Grid.SetColumn(lFamily, 0); this.gLayout.Children.Add(lStyle); Grid.SetColumn(lStyle, 1); this.gLayout.Children.Add(tSize); Grid.SetColumn(tSize, 2); this.gLayout.Children.Add(lSize); Grid.SetColumn(lSize, 2); lSize.SetValue( ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled ); this.gLayout.Children.Add(tPreview); Grid.SetRow(tPreview, 1); Grid.SetColumnSpan(tPreview, 3); // Text Preview Binding Binding fFamily = new Binding() { Source = tPreview, Path = new PropertyPath("FontFamily"), Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; Binding fStyle = new Binding() { Source = lStyle, Path = new PropertyPath("SelectedItem.Style"), Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; Binding fWeight = new Binding() { Source = lStyle, Path = new PropertyPath("SelectedItem.Weight"), Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; Binding fSize = new Binding() { Source = tPreview, Path = new PropertyPath("FontSize"), Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding( lFamily, ListBox.SelectedItemProperty, fFamily ); BindingOperations.SetBinding( tPreview, TextBox.FontStyleProperty, fStyle ); BindingOperations.SetBinding( tPreview, TextBox.FontWeightProperty, fWeight ); BindingOperations.SetBinding( tSize, TextBox.TextProperty, fSize ); BindingOperations.SetBinding( lSize, ListBox.SelectedItemProperty, fSize ); // Completion Buttons this.gLayout.Children.Add(bOk); Grid.SetRow(bOk, 2); Grid.SetColumn(bOk, 1); bOk.Click += bOk_Click; this.gLayout.Children.Add(bCancel); Grid.SetRow(bCancel, 2); Grid.SetColumn(bCancel, 1); Grid.SetColumnSpan(bCancel, 2); w.Content = gLayout; lFamily.ScrollIntoView(lFamily.SelectedItem); lStyle.ScrollIntoView(lStyle.SelectedItem); lSize.ScrollIntoView(lSize.SelectedItem); } #endregion Constructors & Destructor } }
using Content.Server.Atmos.Components; using Content.Server.Clothing.Components; using Content.Shared.Alert; using Content.Shared.Clothing; using Content.Shared.Inventory.Events; namespace Content.Server.Clothing { public sealed class MagbootsSystem : SharedMagbootsSystem { [Dependency] private readonly AlertsSystem _alertsSystem = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent<MagbootsComponent, GotEquippedEvent>(OnGotEquipped); SubscribeLocalEvent<MagbootsComponent, GotUnequippedEvent>(OnGotUnequipped); } public void UpdateMagbootEffects(EntityUid parent, EntityUid uid, bool state, MagbootsComponent? component) { if (!Resolve(uid, ref component)) return; state = state && component.On; if (TryComp(parent, out MovedByPressureComponent? movedByPressure)) { movedByPressure.Enabled = !state; } if (state) { _alertsSystem.ShowAlert(parent, AlertType.Magboots); } else { _alertsSystem.ClearAlert(parent, AlertType.Magboots); } } private void OnGotUnequipped(EntityUid uid, MagbootsComponent component, GotUnequippedEvent args) { if (args.Slot == "shoes") { UpdateMagbootEffects(args.Equipee, uid, false, component); } } private void OnGotEquipped(EntityUid uid, MagbootsComponent component, GotEquippedEvent args) { if (args.Slot == "shoes") { UpdateMagbootEffects(args.Equipee, uid, true, component); } } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; namespace FredericRP.EventManagement { [CreateAssetMenu(menuName = "FredericRP/Integer Game Event")] public class IntGameEvent : GameEvent { public int parameter; public override void Raise() { EventHandler.TriggerEvent<int>(this, parameter); } } }
using System.Security.Principal; namespace SFA.DAS.MA.Shared.UI.Configuration { public class UserContext : IUserContext { public string HashedAccountId { get; set; } public IPrincipal User { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; // 06/02/2014 by aldentea : namespaceをAldentea.Wpf.Document.Xmlに移動. // 01/04/2012 by aldentea : プロジェクトを移動.それに伴い,namespaceをSPP.mutus.DataからDocumentに変更. namespace Aldentea.Wpf.Document { namespace Xml { // 10/05/2011 by aldentea : 属性名が変更になった場合には対応していません. #region AttributeChangedCacheクラス public class AttributeChangedCache : Legacy.IOperationCache { /// <summary> /// 追加された属性名を取得します. /// </summary> private XName AttributeName { get; set; } /// <summary> /// 属性の以前の値を取得します. /// 新規に追加された場合は,この値はnullです. /// </summary> private string PreviousValue { get; set; } /// <summary> /// 属性の現在の値(変更後の値)を取得します. /// 属性が削除された場合は,この値はnullです. /// </summary> private string CurrentValue { get; set; } /// <summary> /// 追加された要素の親要素を取得します. /// </summary> private XElement Parent { get; set; } static XElement currentParent = null; static string currentOldValue = null; public static void SetOldValue(XAttribute attribute) { currentParent = attribute.Parent; currentOldValue = attribute.Value; } // 10/5/2011 by aldentea #region *コンストラクタ(AttributeChangedCache) public AttributeChangedCache(XAttribute newAttribute) { this.AttributeName = newAttribute.Name; this.PreviousValue = currentOldValue; if (newAttribute.Parent == null) { // 削除された場合. this.CurrentValue = null; this.Parent = currentParent; } else { this.CurrentValue = newAttribute.Value; this.Parent = newAttribute.Parent; } // キャッシュをクリアする. currentParent = null; currentOldValue = null; } #endregion #region IOperationCache実装 public void Do() { Parent.SetAttributeValue(AttributeName, CurrentValue); } public void Reverse() { Parent.SetAttributeValue(AttributeName, PreviousValue); } #endregion } #endregion } }
using System; using System.Threading.Tasks; using Xamarin.Forms; using Dwares.Dwarf; using Dwares.Dwarf.Toolkit; namespace Beylen.ViewModels { public class SettingsSection : PropertyNotifier { //static ClassRef @class = new ClassRef(typeof(SettingsSection)); public SettingsSection() { //Debug.EnableTracing(@class); } public string Icon { get; set; } //public string IconSource { get; set; } public string Title { get; set; } //public string Value { get; set; } string _value; public string Value { get => _value; set => SetProperty(ref _value, value); } public Func<Page, SettingsSection, Task> Action { get; set; } } }
using System; using System.Collections.Generic; using System.Text; namespace AppLauncher.Models { public class Config { public WindowInfo MainWindowInfo { get; set; } public int AppListListBoxSelectedIndex { get; set; } public bool MainWindowTopmost { get; set; } public bool MinimizeMainWindowAfterOpening { get; set; } = false; public bool ShowOpenErrorMessage { get; set; } = true; } }
using System.Collections.Generic; using Microsoft.AspNetCore.Identity; namespace Snoffleware.LLBLGen.Identity.Core.Models { public class ApplicationUser : IdentityUser { public ApplicationUser() { } //set some defaults so that things work out of the box //you should change these for your application public string AuthenticatorKey { get; set; } public string LoginProvider { get; set; } = "Snoffleware.LLBLGen.Identity.LoginProvider"; public string LoginProviderDisplayName { get; set; } = "Snoffleware LLBLGen Identity Login Provider"; public string LoginProviderKey { get; set; } = "Snoffleware.LLBLGen.Identity.LoginProviderKey"; public string LoginRecoveryTokenKey { get; set; } = "Snoffleware.LLBLGen.Identity.LoginRecoveryTokenKey"; public string AuthenticatorKeyTokenName { get; set; } = "Snoffleware.LLBLGen.Identity.AuthenticatorKeyToken"; //inherited members //public string Id { get; set; } //public string UserName { get; set; } //public string NormalizedUserName { get; set; } //public string Email { get; set; } //public string NormalizedEmail { get; set; } //public bool EmailConfirmed { get; set; } //public string PasswordHash { get; set; } //public string SecurityStamp { get; set; } //public string ConcurrencyStamp { get; set; } //public string PhoneNumber { get; set; } //public bool PhoneNumberConfirmed { get; set; } //public bool TwoFactorEnabled { get; set; } //public DateTimeOffset? LockoutEnd { get; set; } //public bool LockoutEnabled { get; set; } //public Int32 AccessFailedCount { get; set; } //new members public string ProfileImage { get; set; } } }
/******************************************************** * Project Name : VAdvantage * Class Name : AcctSchemaDefaultCopy. * Purpose : Add or Copy Acct Schema Default Accounts * Class Used : ProcessEngine.SvrProcess * Chronological Development * Deepak 23-Nov-2009 ******************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using VAdvantage.Process; using VAdvantage.Classes; using VAdvantage.Model; using VAdvantage.DataBase; using VAdvantage.SqlExec; using System.Data; using System.Data.SqlClient; using VAdvantage.Logging; using VAdvantage.Utility; using VAdvantage.ProcessEngine;namespace VAdvantage.Process { public class AcctSchemaDefaultCopy : ProcessEngine.SvrProcess { /** Acct Schema */ private int _C_AcctSchema_ID = 0; /** Copy & Overwrite */ private Boolean _CopyOverwriteAcct = false; /// <summary> /// Prepare - e.g., get Parameters. /// </summary> protected override void Prepare() { ProcessInfoParameter[] para = GetParameter(); for (int i = 0; i < para.Length; i++) { String name = para[i].GetParameterName(); if (para[i].GetParameter() == null) { ; } else if (name.Equals("C_AcctSchema_ID")) { _C_AcctSchema_ID = para[i].GetParameterAsInt(); } else if (name.Equals("CopyOverwriteAcct")) { _CopyOverwriteAcct = "Y".Equals(para[i].GetParameter()); } else { log.Log(Level.SEVERE, "Unknown Parameter: " + name); } } } // prepare /// <summary> /// Process /// </summary> /// <returns></returns> protected override String DoIt() { log.Info("C_AcctSchema_ID=" + _C_AcctSchema_ID + ", CopyOverwriteAcct=" + _CopyOverwriteAcct); if (_C_AcctSchema_ID == 0) { throw new Exception("C_AcctSchema_ID=0"); } MAcctSchema a = MAcctSchema.Get(GetCtx(), _C_AcctSchema_ID); if (a.Get_ID() == 0) { throw new Exception("Not Found - C_AcctSchema_ID=" + _C_AcctSchema_ID); } MAcctSchemaDefault acct = MAcctSchemaDefault.Get (GetCtx(), _C_AcctSchema_ID); if (acct == null || acct.Get_ID() == 0) { throw new Exception("Default Not Found - C_AcctSchema_ID=" + _C_AcctSchema_ID); } String sql = null; int updated = 0; int created = 0; int updatedTotal = 0; int createdTotal = 0; // Update existing Product Category if (_CopyOverwriteAcct) { sql = "UPDATE M_Product_Category_Acct pa " + "SET P_Revenue_Acct=" + acct.GetP_Revenue_Acct() + ", P_Expense_Acct=" + acct.GetP_Expense_Acct() + ", P_CostAdjustment_Acct=" + acct.GetP_CostAdjustment_Acct() + ", P_InventoryClearing_Acct=" + acct.GetP_InventoryClearing_Acct() + ", P_Asset_Acct=" + acct.GetP_Asset_Acct() + ", P_COGS_Acct=" + acct.GetP_COGS_Acct() + ", P_PurchasePriceVariance_Acct=" + acct.GetP_PurchasePriceVariance_Acct() + ", P_InvoicePriceVariance_Acct=" + acct.GetP_InvoicePriceVariance_Acct() + ", P_TradeDiscountRec_Acct=" + acct.GetP_TradeDiscountRec_Acct() + ", P_TradeDiscountGrant_Acct=" + acct.GetP_TradeDiscountGrant_Acct() // Added **************** Lokesh Chauhan **************** + ", P_Resource_Absorption_Acct = " + acct.GetP_Resource_Absorption_Acct() + ", P_MaterialOverhd_Acct = " + acct.GetP_MaterialOverhd_Acct() // **************** + ", Updated=SysDate, UpdatedBy=0 " + "WHERE pa.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND EXISTS (SELECT * FROM M_Product_Category p " + "WHERE p.M_Product_Category_ID=pa.M_Product_Category_ID)"; //updated = DataBase.executeUpdate(sql, Get_Trx()); updated = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null, Utility.Util.GetValueOfDecimal(updated), "@Updated@ @M_Product_Category_ID@"); updatedTotal += updated; } // Insert new Product Category sql = "INSERT INTO M_Product_Category_Acct " + "(M_Product_Category_ID, C_AcctSchema_ID," + " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," + " P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct," + " P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct," + " P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct " // Added **************** Lokesh Chauhan **************** + " ,P_Resource_Absorption_Acct, P_MaterialOverhd_Acct " // **************** + " ) " + "SELECT p.M_Product_Category_ID, acct.C_AcctSchema_ID," + " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," + " acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct," + " acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct," + " acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct " // Added **************** Lokesh Chauhan **************** + " ,acct.P_Resource_Absorption_Acct, acct.P_MaterialOverhd_Acct " // Added **************** + " FROM M_Product_Category p" + " INNER JOIN C_AcctSchema_Default acct ON (p.AD_Client_ID=acct.AD_Client_ID) " + "WHERE acct.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND NOT EXISTS (SELECT * FROM M_Product_Category_Acct pa " + "WHERE pa.M_Product_Category_ID=p.M_Product_Category_ID" + " AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; created = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(created), "@Created@ @M_Product_Category_ID@"); createdTotal += created; if (!_CopyOverwriteAcct) // Insert new Products { sql = "INSERT INTO M_Product_Acct " + "(M_Product_ID, C_AcctSchema_ID," + " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," + " P_Revenue_Acct, P_Expense_Acct, P_CostAdjustment_Acct, P_InventoryClearing_Acct, P_Asset_Acct, P_CoGs_Acct," + " P_PurchasePriceVariance_Acct, P_InvoicePriceVariance_Acct," + " P_TradeDiscountRec_Acct, P_TradeDiscountGrant_Acct,P_Resource_Absorption_Acct, P_MaterialOverhd_Acct) " + "SELECT p.M_Product_ID, acct.C_AcctSchema_ID," + " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," + " acct.P_Revenue_Acct, acct.P_Expense_Acct, acct.P_CostAdjustment_Acct, acct.P_InventoryClearing_Acct, acct.P_Asset_Acct, acct.P_CoGs_Acct," + " acct.P_PurchasePriceVariance_Acct, acct.P_InvoicePriceVariance_Acct," + " acct.P_TradeDiscountRec_Acct, acct.P_TradeDiscountGrant_Acct, acct.P_Resource_Absorption_Acct, acct.P_MaterialOverhd_Acct " + "FROM M_Product p" + " INNER JOIN M_Product_Category_Acct acct ON (acct.M_Product_Category_ID=p.M_Product_Category_ID)" + "WHERE acct.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND p.M_Product_Category_ID=acct.M_Product_Category_ID" + " AND NOT EXISTS (SELECT * FROM M_Product_Acct pa " + "WHERE pa.M_Product_ID=p.M_Product_ID" + " AND pa.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; created = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null, Utility.Util.GetValueOfDecimal(created), "@Created@ @M_Product_ID@"); createdTotal += created; } // Update Business Partner Group if (_CopyOverwriteAcct) { sql = "UPDATE C_BP_Group_Acct a " + "SET C_Receivable_Acct=" + acct.GetC_Receivable_Acct() + ", C_Receivable_Services_Acct=" + acct.GetC_Receivable_Services_Acct() + ", C_Prepayment_Acct=" + acct.GetC_Prepayment_Acct() + ", V_Liability_Acct=" + acct.GetV_Liability_Acct() + ", V_Liability_Services_Acct=" + acct.GetV_Liability_Services_Acct() + ", V_Prepayment_Acct=" + acct.GetV_Prepayment_Acct() + ", PayDiscount_Exp_Acct=" + acct.GetPayDiscount_Exp_Acct() + ", PayDiscount_Rev_Acct=" + acct.GetPayDiscount_Rev_Acct() + ", WriteOff_Acct=" + acct.GetWriteOff_Acct() + ", NotInvoicedReceipts_Acct=" + acct.GetNotInvoicedReceipts_Acct() + ", UnEarnedRevenue_Acct=" + acct.GetUnEarnedRevenue_Acct() + ", NotInvoicedRevenue_Acct=" + acct.GetNotInvoicedRevenue_Acct() + ", NotInvoicedReceivables_Acct=" + acct.GetNotInvoicedReceivables_Acct() + ", Updated=SysDate, UpdatedBy=0 " + "WHERE a.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND EXISTS (SELECT * FROM C_BP_Group_Acct x " + "WHERE x.C_BP_Group_ID=a.C_BP_Group_ID)"; updated = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(updated), "@Updated@ @C_BP_Group_ID@"); updatedTotal += updated; } // Insert Business Partner Group sql = "INSERT INTO C_BP_Group_Acct " + "(C_BP_Group_ID, C_AcctSchema_ID," + " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," + " C_Receivable_Acct, C_Receivable_Services_Acct, C_PrePayment_Acct," + " V_Liability_Acct, V_Liability_Services_Acct, V_PrePayment_Acct," + " PayDiscount_Exp_Acct, PayDiscount_Rev_Acct, WriteOff_Acct," + " NotInvoicedReceipts_Acct, UnEarnedRevenue_Acct," + " NotInvoicedRevenue_Acct, NotInvoicedReceivables_Acct) " + "SELECT x.C_BP_Group_ID, acct.C_AcctSchema_ID," + " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," + " acct.C_Receivable_Acct, acct.C_Receivable_Services_Acct, acct.C_PrePayment_Acct," + " acct.V_Liability_Acct, acct.V_Liability_Services_Acct, acct.V_PrePayment_Acct," + " acct.PayDiscount_Exp_Acct, acct.PayDiscount_Rev_Acct, acct.WriteOff_Acct," + " acct.NotInvoicedReceipts_Acct, acct.UnEarnedRevenue_Acct," + " acct.NotInvoicedRevenue_Acct, acct.NotInvoicedReceivables_Acct " + "FROM C_BP_Group x" + " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " + "WHERE acct.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND NOT EXISTS (SELECT * FROM C_BP_Group_Acct a " + "WHERE a.C_BP_Group_ID=x.C_BP_Group_ID" + " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; created = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null, Utility.Util.GetValueOfDecimal(created), "@Created@ @C_BP_Group_ID@"); createdTotal += created; // Update Business Partner - Employee if (_CopyOverwriteAcct) { sql = "UPDATE C_BP_Employee_Acct a " + "SET E_Expense_Acct=" + acct.GetE_Expense_Acct() + ", E_Prepayment_Acct=" + acct.GetE_Prepayment_Acct() + ", Updated=SysDate, UpdatedBy=0 " + "WHERE a.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND EXISTS (SELECT * FROM C_BP_Employee_Acct x " + "WHERE x.C_BPartner_ID=a.C_BPartner_ID)"; updated = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null, Utility.Util.GetValueOfDecimal(updated), "@Updated@ @C_BPartner_ID@ @IsEmployee@"); updatedTotal += updated; } // Insert new Business Partner - Employee sql = "INSERT INTO C_BP_Employee_Acct " + "(C_BPartner_ID, C_AcctSchema_ID," + " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," + " E_Expense_Acct, E_Prepayment_Acct) " + "SELECT x.C_BPartner_ID, acct.C_AcctSchema_ID," + " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," + " acct.E_Expense_Acct, acct.E_Prepayment_Acct " + "FROM C_BPartner x" + " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " + "WHERE acct.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND NOT EXISTS (SELECT * FROM C_BP_Employee_Acct a " + "WHERE a.C_BPartner_ID=x.C_BPartner_ID" + " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; created = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(created), "@Created@ @C_BPartner_ID@ @IsEmployee@"); createdTotal += created; // if (!_CopyOverwriteAcct) { sql = "INSERT INTO C_BP_Customer_Acct " + "(C_BPartner_ID, C_AcctSchema_ID," + " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," + " C_Receivable_Acct, C_Receivable_Services_Acct, C_PrePayment_Acct) " + "SELECT p.C_BPartner_ID, acct.C_AcctSchema_ID," + " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," + " acct.C_Receivable_Acct, acct.C_Receivable_Services_Acct, acct.C_PrePayment_Acct " + "FROM C_BPartner p" + " INNER JOIN C_BP_Group_Acct acct ON (acct.C_BP_Group_ID=p.C_BP_Group_ID)" + "WHERE acct.C_AcctSchema_ID=" + _C_AcctSchema_ID // # + " AND p.C_BP_Group_ID=acct.C_BP_Group_ID" + " AND NOT EXISTS (SELECT * FROM C_BP_Customer_Acct ca " + "WHERE ca.C_BPartner_ID=p.C_BPartner_ID" + " AND ca.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; created = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(created), "@Created@ @C_BPartner_ID@ @IsCustomer@"); createdTotal += created; // sql = "INSERT INTO C_BP_Vendor_Acct " + "(C_BPartner_ID, C_AcctSchema_ID," + " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," + " V_Liability_Acct, V_Liability_Services_Acct, V_PrePayment_Acct) " + "SELECT p.C_BPartner_ID, acct.C_AcctSchema_ID," + " p.AD_Client_ID, p.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," + " acct.V_Liability_Acct, acct.V_Liability_Services_Acct, acct.V_PrePayment_Acct " + "FROM C_BPartner p" + " INNER JOIN C_BP_Group_Acct acct ON (acct.C_BP_Group_ID=p.C_BP_Group_ID)" + "WHERE acct.C_AcctSchema_ID=" + _C_AcctSchema_ID // # + " AND p.C_BP_Group_ID=acct.C_BP_Group_ID" + " AND NOT EXISTS (SELECT * FROM C_BP_Vendor_Acct va " + "WHERE va.C_BPartner_ID=p.C_BPartner_ID AND va.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; created = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(created), "@Created@ @C_BPartner_ID@ @IsVendor@"); createdTotal += created; } // Update Warehouse if (_CopyOverwriteAcct) { sql = "UPDATE M_Warehouse_Acct a " + "SET W_Inventory_Acct=" + acct.GetW_Inventory_Acct() + ", W_Differences_Acct=" + acct.GetW_Differences_Acct() + ", W_Revaluation_Acct=" + acct.GetW_Revaluation_Acct() + ", W_InvActualAdjust_Acct=" + acct.GetW_InvActualAdjust_Acct() + ", Updated=SysDate, UpdatedBy=0 " + "WHERE a.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND EXISTS (SELECT * FROM M_Warehouse_Acct x " + "WHERE x.M_Warehouse_ID=a.M_Warehouse_ID)"; updated = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(updated), "@Updated@ @M_Warehouse_ID@"); updatedTotal += updated; } // Insert new Warehouse sql = "INSERT INTO M_Warehouse_Acct " + "(M_Warehouse_ID, C_AcctSchema_ID," + " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," + " W_Inventory_Acct, W_Differences_Acct, W_Revaluation_Acct, W_InvActualAdjust_Acct) " + "SELECT x.M_Warehouse_ID, acct.C_AcctSchema_ID," + " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," + " acct.W_Inventory_Acct, acct.W_Differences_Acct, acct.W_Revaluation_Acct, acct.W_InvActualAdjust_Acct " + "FROM M_Warehouse x" + " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " + "WHERE acct.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND NOT EXISTS (SELECT * FROM M_Warehouse_Acct a " + "WHERE a.M_Warehouse_ID=x.M_Warehouse_ID" + " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; created = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null, Utility.Util.GetValueOfDecimal(created), "@Created@ @M_Warehouse_ID@"); createdTotal += created; // Update Project if (_CopyOverwriteAcct) { sql = "UPDATE C_Project_Acct a " + "SET PJ_Asset_Acct=" + acct.GetPJ_Asset_Acct() + ", PJ_WIP_Acct=" + acct.GetPJ_Asset_Acct() + ", Updated=SysDate, UpdatedBy=0 " + "WHERE a.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND EXISTS (SELECT * FROM C_Project_Acct x " + "WHERE x.C_Project_ID=a.C_Project_ID)"; updated = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(updated), "@Updated@ @C_Project_ID@"); updatedTotal += updated; } // Insert new Projects sql = "INSERT INTO C_Project_Acct " + "(C_Project_ID, C_AcctSchema_ID," + " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," + " PJ_Asset_Acct, PJ_WIP_Acct) " + "SELECT x.C_Project_ID, acct.C_AcctSchema_ID," + " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," + " acct.PJ_Asset_Acct, acct.PJ_WIP_Acct " + "FROM C_Project x" + " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " + "WHERE acct.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND NOT EXISTS (SELECT * FROM C_Project_Acct a " + "WHERE a.C_Project_ID=x.C_Project_ID" + " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; created = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null, Utility.Util.GetValueOfDecimal(created), "@Created@ @C_Project_ID@"); createdTotal += created; // Update Tax if (_CopyOverwriteAcct) { sql = "UPDATE C_Tax_Acct a " + "SET T_Due_Acct=" + acct.GetT_Due_Acct() + ", T_Liability_Acct=" + acct.GetT_Liability_Acct() + ", T_Credit_Acct=" + acct.GetT_Credit_Acct() + ", T_Receivables_Acct=" + acct.GetT_Receivables_Acct() + ", T_Expense_Acct=" + acct.GetT_Expense_Acct() + ", Updated=SysDate, UpdatedBy=0 " + "WHERE a.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND EXISTS (SELECT * FROM C_Tax_Acct x " + "WHERE x.C_Tax_ID=a.C_Tax_ID)"; updated = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(updated), "@Updated@ @C_Tax_ID@"); updatedTotal += updated; } // Insert new Tax sql = "INSERT INTO C_Tax_Acct " + "(C_Tax_ID, C_AcctSchema_ID," + " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," + " T_Due_Acct, T_Liability_Acct, T_Credit_Acct, T_Receivables_Acct, T_Expense_Acct) " + "SELECT x.C_Tax_ID, acct.C_AcctSchema_ID," + " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," + " acct.T_Due_Acct, acct.T_Liability_Acct, acct.T_Credit_Acct, acct.T_Receivables_Acct, acct.T_Expense_Acct " + "FROM C_Tax x" + " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " + "WHERE acct.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND NOT EXISTS (SELECT * FROM C_Tax_Acct a " + "WHERE a.C_Tax_ID=x.C_Tax_ID" + " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; created = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(created), "@Created@ @C_Tax_ID@"); createdTotal += created; // Update BankAccount if (_CopyOverwriteAcct) { sql = "UPDATE C_BankAccount_Acct a " + "SET B_InTransit_Acct=" + acct.GetB_InTransit_Acct() + ", B_Asset_Acct=" + acct.GetB_Asset_Acct() + ", B_Expense_Acct=" + acct.GetB_Expense_Acct() + ", B_InterestRev_Acct=" + acct.GetB_InterestRev_Acct() + ", B_InterestExp_Acct=" + acct.GetB_InterestExp_Acct() + ", B_Unidentified_Acct=" + acct.GetB_Unidentified_Acct() + ", B_UnallocatedCash_Acct=" + acct.GetB_UnallocatedCash_Acct() + ", B_PaymentSelect_Acct=" + acct.GetB_PaymentSelect_Acct() + ", B_SettlementGain_Acct=" + acct.GetB_SettlementGain_Acct() + ", B_SettlementLoss_Acct=" + acct.GetB_SettlementLoss_Acct() + ", B_RevaluationGain_Acct=" + acct.GetB_RevaluationGain_Acct() + ", B_RevaluationLoss_Acct=" + acct.GetB_RevaluationLoss_Acct() + ", Updated=SysDate, UpdatedBy=0 " + "WHERE a.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND EXISTS (SELECT * FROM C_BankAccount_Acct x " + "WHERE x.C_BankAccount_ID=a.C_BankAccount_ID)"; updated = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(updated), "@Updated@ @C_BankAccount_ID@"); updatedTotal += updated; } // Insert new BankAccount sql = "INSERT INTO C_BankAccount_Acct " + "(C_BankAccount_ID, C_AcctSchema_ID," + " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," + " B_InTransit_Acct, B_Asset_Acct, B_Expense_Acct, B_InterestRev_Acct, B_InterestExp_Acct," + " B_Unidentified_Acct, B_UnallocatedCash_Acct, B_PaymentSelect_Acct," + " B_SettlementGain_Acct, B_SettlementLoss_Acct," + " B_RevaluationGain_Acct, B_RevaluationLoss_Acct) " + "SELECT x.C_BankAccount_ID, acct.C_AcctSchema_ID," + " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," + " acct.B_InTransit_Acct, acct.B_Asset_Acct, acct.B_Expense_Acct, acct.B_InterestRev_Acct, acct.B_InterestExp_Acct," + " acct.B_Unidentified_Acct, acct.B_UnallocatedCash_Acct, acct.B_PaymentSelect_Acct," + " acct.B_SettlementGain_Acct, acct.B_SettlementLoss_Acct," + " acct.B_RevaluationGain_Acct, acct.B_RevaluationLoss_Acct " + "FROM C_BankAccount x" + " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " + "WHERE acct.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND NOT EXISTS (SELECT * FROM C_BankAccount_Acct a " + "WHERE a.C_BankAccount_ID=x.C_BankAccount_ID" + " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; created = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(created), "@Created@ @C_BankAccount_ID@"); createdTotal += created; // Update Withholding if (_CopyOverwriteAcct) { sql = "UPDATE C_Withholding_Acct a " + "SET Withholding_Acct=" + acct.GetWithholding_Acct() + ", Updated=SysDate, UpdatedBy=0 " + "WHERE a.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND EXISTS (SELECT * FROM C_Withholding_Acct x " + "WHERE x.C_Withholding_ID=a.C_Withholding_ID)"; updated = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(updated), "@Updated@ @C_Withholding_ID@"); updatedTotal += updated; } // Insert new Withholding sql = "INSERT INTO C_Withholding_Acct " + "(C_Withholding_ID, C_AcctSchema_ID," + " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," + " Withholding_Acct) " + "SELECT x.C_Withholding_ID, acct.C_AcctSchema_ID," + " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," + " acct.Withholding_Acct " + "FROM C_Withholding x" + " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " + "WHERE acct.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND NOT EXISTS (SELECT * FROM C_Withholding_Acct a " + "WHERE a.C_Withholding_ID=x.C_Withholding_ID" + " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; created = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(created), "@Created@ @C_Withholding_ID@"); createdTotal += created; // Update Charge if (_CopyOverwriteAcct) { sql = "UPDATE C_Charge_Acct a " + "SET Ch_Expense_Acct=" + acct.GetCh_Expense_Acct() + ", Ch_Revenue_Acct=" + acct.GetCh_Revenue_Acct() + ", Updated=SysDate, UpdatedBy=0 " + "WHERE a.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND EXISTS (SELECT * FROM C_Charge_Acct x " + "WHERE x.C_Charge_ID=a.C_Charge_ID)"; updated = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(updated), "@Updated@ @C_Charge_ID@"); updatedTotal += updated; } // Insert new Charge sql = "INSERT INTO C_Charge_Acct " + "(C_Charge_ID, C_AcctSchema_ID," + " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," + " Ch_Expense_Acct, Ch_Revenue_Acct) " + "SELECT x.C_Charge_ID, acct.C_AcctSchema_ID," + " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," + " acct.Ch_Expense_Acct, acct.Ch_Revenue_Acct " + "FROM C_Charge x" + " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " + "WHERE acct.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND NOT EXISTS (SELECT * FROM C_Charge_Acct a " + "WHERE a.C_Charge_ID=x.C_Charge_ID" + " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; created = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(created), "@Created@ @C_Charge_ID@"); createdTotal += created; // Update Cashbook if (_CopyOverwriteAcct) { sql = "UPDATE C_Cashbook_Acct a " + "SET CB_Asset_Acct=" + acct.GetCB_Asset_Acct() + ", CB_Differences_Acct=" + acct.GetCB_Differences_Acct() + ", CB_CashTransfer_Acct=" + acct.GetCB_CashTransfer_Acct() + ", CB_Expense_Acct=" + acct.GetCB_Expense_Acct() + ", CB_Receipt_Acct=" + acct.GetCB_Receipt_Acct() + ", Updated=SysDate, UpdatedBy=0 " + "WHERE a.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND EXISTS (SELECT * FROM C_Cashbook_Acct x " + "WHERE x.C_Cashbook_ID=a.C_Cashbook_ID)"; updated = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null, Utility.Util.GetValueOfDecimal(updated), "@Updated@ @C_Cashbook_ID@"); updatedTotal += updated; } // Insert new Cashbook sql = "INSERT INTO C_Cashbook_Acct " + "(C_Cashbook_ID, C_AcctSchema_ID," + " AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated, UpdatedBy," + " CB_Asset_Acct, CB_Differences_Acct, CB_CashTransfer_Acct," + " CB_Expense_Acct, CB_Receipt_Acct) " + "SELECT x.C_Cashbook_ID, acct.C_AcctSchema_ID," + " x.AD_Client_ID, x.AD_Org_ID, 'Y', SysDate, 0, SysDate, 0," + " acct.CB_Asset_Acct, acct.CB_Differences_Acct, acct.CB_CashTransfer_Acct," + " acct.CB_Expense_Acct, acct.CB_Receipt_Acct " + "FROM C_Cashbook x" + " INNER JOIN C_AcctSchema_Default acct ON (x.AD_Client_ID=acct.AD_Client_ID) " + "WHERE acct.C_AcctSchema_ID=" + _C_AcctSchema_ID + " AND NOT EXISTS (SELECT * FROM C_Cashbook_Acct a " + "WHERE a.C_Cashbook_ID=x.C_Cashbook_ID" + " AND a.C_AcctSchema_ID=acct.C_AcctSchema_ID)"; created = DataBase.DB.ExecuteQuery(sql,null, Get_Trx()); AddLog(0, null,Utility.Util.GetValueOfDecimal(created), "@Created@ @C_Cashbook_ID@"); createdTotal += created; return "@Created@=" + createdTotal + ", @Updated@=" + updatedTotal; } // doIt } // AcctSchemaDefaultCopy }
/*************************************************************************** * Listener.cs * ------------------- * begin : May 1, 2002 * copyright : (C) The RunUO Software Team * email : info@runuo.com * * $Id: Listener.cs 826 2012-02-08 03:32:56Z asayre $ * ***************************************************************************/ /*************************************************************************** * * 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. * ***************************************************************************/ using System; using System.Collections; using System.Collections.Generic; using System.Net; using System.Net.NetworkInformation; using System.Net.Sockets; using System.Threading; using Server; namespace Server.Network { public class Listener : IDisposable { private Socket m_Listener; private Queue<Socket> m_Accepted; private object m_AcceptedSyncRoot; #if NewAsyncSockets private SocketAsyncEventArgs m_EventArgs; #else private AsyncCallback m_OnAccept; #endif private static Socket[] m_EmptySockets = new Socket[0]; private static IPEndPoint[] m_EndPoints; public static IPEndPoint[] EndPoints { get { return m_EndPoints; } set { m_EndPoints = value; } } public Listener(IPEndPoint ipep) { m_Accepted = new Queue<Socket>(); m_AcceptedSyncRoot = ((ICollection)m_Accepted).SyncRoot; m_Listener = Bind(ipep); if (m_Listener == null) return; DisplayListener(); #if NewAsyncSockets m_EventArgs = new SocketAsyncEventArgs(); m_EventArgs.Completed += new EventHandler<SocketAsyncEventArgs>( Accept_Completion ); Accept_Start(); #else m_OnAccept = new AsyncCallback(OnAccept); try { IAsyncResult res = m_Listener.BeginAccept(m_OnAccept, m_Listener); } catch (SocketException ex) { NetState.TraceException(ex); } catch (ObjectDisposedException) { } #endif } private Socket Bind(IPEndPoint ipep) { Socket s = new Socket(ipep.AddressFamily, SocketType.Stream, ProtocolType.Tcp); try { s.LingerState.Enabled = false; #if !MONO s.ExclusiveAddressUse = false; #endif s.Bind(ipep); //Plume : Net 4 //s.Listen(8); s.Listen(100); return s; } catch (Exception e) { if (e is SocketException) { SocketException se = (SocketException)e; if (se.ErrorCode == 10048) { // WSAEADDRINUSE Console.WriteLine("Listener Failed: {0}:{1} (In Use)", ipep.Address, ipep.Port); } else if (se.ErrorCode == 10049) { // WSAEADDRNOTAVAIL Console.WriteLine("Listener Failed: {0}:{1} (Unavailable)", ipep.Address, ipep.Port); } else { Console.WriteLine("Listener Exception:"); Console.WriteLine(e); } } return null; } } private void DisplayListener() { IPEndPoint ipep = m_Listener.LocalEndPoint as IPEndPoint; if (ipep == null) return; if (ipep.Address.Equals(IPAddress.Any) || ipep.Address.Equals(IPAddress.IPv6Any)) { NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface adapter in adapters) { IPInterfaceProperties properties = adapter.GetIPProperties(); foreach (IPAddressInformation unicast in properties.UnicastAddresses) { if (ipep.AddressFamily == unicast.Address.AddressFamily) Console.WriteLine("Listening: {0}:{1}", unicast.Address, ipep.Port); } } /* try { Console.WriteLine( "Listening: {0}:{1}", IPAddress.Loopback, ipep.Port ); IPHostEntry iphe = Dns.GetHostEntry( Dns.GetHostName() ); IPAddress[] ip = iphe.AddressList; for ( int i = 0; i < ip.Length; ++i ) Console.WriteLine( "Listening: {0}:{1}", ip[i], ipep.Port ); } catch { } */ } else { Console.WriteLine("Listening: {0}:{1}", ipep.Address, ipep.Port); } } #if NewAsyncSockets private void Accept_Start() { bool result = false; do { try { result = !m_Listener.AcceptAsync( m_EventArgs ); } catch ( SocketException ex ) { NetState.TraceException( ex ); break; } catch ( ObjectDisposedException ) { break; } if ( result ) Accept_Process( m_EventArgs ); } while ( result ); } private void Accept_Completion( object sender, SocketAsyncEventArgs e ) { Accept_Process( e ); Accept_Start(); } private void Accept_Process( SocketAsyncEventArgs e ) { if ( e.SocketError == SocketError.Success && VerifySocket( e.AcceptSocket ) ) { Enqueue( e.AcceptSocket ); } else { Release( e.AcceptSocket ); } e.AcceptSocket = null; } #else private void OnAccept(IAsyncResult asyncResult) { Socket listener = (Socket)asyncResult.AsyncState; Socket accepted = null; try { accepted = listener.EndAccept(asyncResult); } catch (SocketException ex) { NetState.TraceException(ex); } catch (ObjectDisposedException) { return; } if (accepted != null) { if (VerifySocket(accepted)) { Enqueue(accepted); } else { Release(accepted); } } try { listener.BeginAccept(m_OnAccept, listener); } catch (SocketException ex) { NetState.TraceException(ex); } catch (ObjectDisposedException) { } } #endif private bool VerifySocket(Socket socket) { try { SocketConnectEventArgs args = new SocketConnectEventArgs(socket); EventSink.InvokeSocketConnect(args); return args.AllowConnection; } catch (Exception ex) { NetState.TraceException(ex); return false; } } private void Enqueue(Socket socket) { lock (m_AcceptedSyncRoot) { m_Accepted.Enqueue(socket); } Core.Set(); } private void Release(Socket socket) { try { socket.Shutdown(SocketShutdown.Both); } catch (SocketException ex) { NetState.TraceException(ex); } try { socket.Close(); } catch (SocketException ex) { NetState.TraceException(ex); } } public Socket[] Slice() { Socket[] array; lock (m_AcceptedSyncRoot) { if (m_Accepted.Count == 0) return m_EmptySockets; array = m_Accepted.ToArray(); m_Accepted.Clear(); } return array; } public void Dispose() { Socket socket = Interlocked.Exchange<Socket>(ref m_Listener, null); if (socket != null) { socket.Close(); } } } }
using System; using System.Collections.Generic; namespace UwCore.Services.Navigation { public interface IAdvancedNavigationService { void Navigate(Type viewModelType, Dictionary<string, object> parameter = null, string context = null); } }