private void Start() { MagicNumbers magicNumbers = FindObjectOfType <MagicNumbers>(); guessText.text = $"Game Over! Твоё число - {magicNumbers.guess}"; numberOfTriesText.text = $"Количество затраченых попыток - {magicNumbers.count}"; }
public static SectionHeaderBlock Parse(BaseBlock baseBlock, Action <Exception> ActionOnException) { Contract.Requires <ArgumentNullException>(baseBlock != null, "BaseBlock cannot be null"); Contract.Requires <ArgumentNullException>(baseBlock.Body != null, "BaseBlock.Body cannot be null"); Contract.Requires <ArgumentException>(baseBlock.BlockType == BaseBlock.Types.SectionHeader, "Invalid packet type"); long positionInStream = baseBlock.PositionInStream; using (Stream stream = new MemoryStream(baseBlock.Body)) { using (BinaryReader binaryReader = new BinaryReader(stream)) { uint tempMagicNumber = binaryReader.ReadUInt32().ReverseByteOrder(baseBlock.ReverseByteOrder); if (!Enum.IsDefined(typeof(MagicNumbers), tempMagicNumber)) { throw new ArgumentException(string.Format("[SectionHeaderBlock.Parse] Unrecognized pcapNG magic number: {0}", tempMagicNumber.ToString("x"))); } MagicNumbers magicNumber = (MagicNumbers)tempMagicNumber; ushort majorVersion = binaryReader.ReadUInt16().ReverseByteOrder(baseBlock.ReverseByteOrder); ushort minorVersion = binaryReader.ReadUInt16().ReverseByteOrder(baseBlock.ReverseByteOrder); long sectionLength = binaryReader.ReadInt64().ReverseByteOrder(baseBlock.ReverseByteOrder); SectionHeaderOption options = SectionHeaderOption.Parse(binaryReader, baseBlock.ReverseByteOrder, ActionOnException); SectionHeaderBlock headerBlock = new SectionHeaderBlock(magicNumber, majorVersion, minorVersion, sectionLength, options, positionInStream); return(headerBlock); } } }
void Start() { magicNumbers = FindObjectOfType <MagicNumbers>(); int number = magicNumbers.guess; numberText.text = number.ToString(); Destroy(magicNumbers.gameObject); }
public SectionHeader(MagicNumbers magicNumber = MagicNumbers.microsecondIdentical, UInt16 majorVersion = 2, UInt16 minorVersion = 4, int thiszone = 0, uint sigfigs = 0, uint snaplen = 65535, LinkTypes linkType = LinkTypes.Ethernet) { this.MagicNumber = magicNumber; this.MajorVersion = majorVersion; this.MinorVersion = minorVersion; this.TimezoneOffset = thiszone; this.SignificantFigures = sigfigs; this.MaximumCaptureLength = snaplen; this.LinkType = linkType; }
/// <summary> /// The Section Header Block is mandatory. It identifies the beginning of a section of the capture dump file. The Section Header Block /// does not contain data but it rather identifies a list of blocks (interfaces, packets) that are logically correlated. /// </summary> public SectionHeaderBlock(MagicNumbers MagicNumber, UInt16 MajorVersion, UInt16 MinorVersion, Int64 SectionLength, SectionHeaderOption Options, long PositionInStream = 0) { Contract.Requires <ArgumentNullException>(Options != null, "Options cannot be null"); this.MagicNumber = MagicNumber; this.MajorVersion = MajorVersion; this.MinorVersion = MinorVersion; this.SectionLength = SectionLength; this.options = Options; this.PositionInStream = PositionInStream; }
public float warDiscoveryRiskMultiplier = .3f; // Wars are very impactful. Their effects invite investigation into their cause. // Needs a starting grossEmpireProduct public void Awake() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } allocationPercentage = (100 / allocationIterationAmount); numberOfAllocationSegments = (100 / allocationIterationAmount); }
private void Awake() { // Ссылки слетают при переходе на след. сцену if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); return; } }
public static SectionHeader Parse(BinaryReader binaryReader) { ////Contract.Requires<ArgumentNullException>(binaryReader != null, "binaryReader cannot be null"); bool reverseByteOrder = false; long positionInStream = binaryReader.BaseStream.Position; uint tempMagicNumber = binaryReader.ReadUInt32(); if (!Enum.IsDefined(typeof(MagicNumbers), tempMagicNumber)) { throw new ArgumentException(string.Format("[SectionHeader.Parse] Unrecognized pcap magic number: {0}", tempMagicNumber.ToString("x"))); } MagicNumbers magicNumber = (MagicNumbers)tempMagicNumber; if (magicNumber == MagicNumbers.nanosecondIdentical || magicNumber == MagicNumbers.microsecondIdentical) { reverseByteOrder = false; } else { reverseByteOrder = true; } ushort major = binaryReader.ReadUInt16().ReverseByteOrder(reverseByteOrder); ushort minor = binaryReader.ReadUInt16().ReverseByteOrder(reverseByteOrder); int thiszone = binaryReader.ReadInt32().ReverseByteOrder(reverseByteOrder); uint sigfigs = binaryReader.ReadUInt32().ReverseByteOrder(reverseByteOrder); uint snaplen = binaryReader.ReadUInt32().ReverseByteOrder(reverseByteOrder); uint linktype = binaryReader.ReadUInt32().ReverseByteOrder(reverseByteOrder); if (!Enum.IsDefined(typeof(LinkTypes), (ushort)linktype)) { throw new ArgumentException(string.Format("[SectionHeader.Parse] Invalid LinkTypes: {0}, block begin on position {1} ", linktype, positionInStream)); } LinkTypes LinkType = (LinkTypes)linktype; SectionHeader header = new SectionHeader(magicNumber, major, minor, thiszone, sigfigs, snaplen, LinkType); return(header); }
void Start() { MN = FindObjectOfType <MagicNumbers>(); finalText.text = MN.actionsText.text; }
//*Funtions //function for inseting into database row public string[] MakeDBLine() { string[] TheLine = new string[18]; TheLine[0] = ("'" + ViD + "'"); TheLine[1] = Vtype.ToString(); TheLine[2] = ("'" + BornAt.TimeOfDay.ToString() + "'"); TheLine[3] = ("'" + BornLink.StartNode.ToString() + ":" + BornLink.EndNode.ToString() + "'"); if (Routename.Equals("NULL")) { TheLine[4] = "NULL"; } else { TheLine[4] = ("'" + Routename + "'"); } if (Origin != 511) { TheLine[5] = Origin.ToString(); } else { TheLine[5] = "NULL"; } if (Destination != 511) { TheLine[6] = Destination.ToString(); } else { TheLine[6] = "NULL"; } TheLine[7] = Tag.ToString(); TheLine[8] = BornStage.ToString(); TheLine[9] = BornScenario.ToString(); int ObsoleteINT = Convert.ToInt32(Obsolete); TheLine[10] = ("'" + ObsoleteINT.ToString() + "'"); if (MagicNumbers.Equals("[511,511]")) { TheLine[11] = "NULL"; } else { TheLine[11] = ("'" + MagicNumbers + "'"); } TheLine[12] = "NULL"; TheLine[13] = "NULL"; if (NextLink != "NULL") { TheLine[14] = ("'" + NextLink + "'"); } else { TheLine[14] = "NULL"; } if (NextNextLink != "NULL") { TheLine[15] = ("'" + NextNextLink + "'"); } else { TheLine[15] = "NULL"; } TheLine[16] = "NULL6"; //NextTurn TheLine[17] = "NULL6"; //NextNextTurn return(TheLine); }
static void Main(string[] args) { string text = File.ReadAllText(args[0]); SyntaxTree tree = CSharpSyntaxTree.ParseText(text); SingleReturnMethodAnalyzer analyzer = new SingleReturnMethodAnalyzer(tree); AnalyzeResult result = analyzer.analyze(); // BooleanParameterAnalyzer booleanParameterAnalyzer = new BooleanParameterAnalyzer(tree); // AnalyzeResult result2 = booleanParameterAnalyzer.analyze(); OneLineBranchStatement oneLineBranchStatement = new OneLineBranchStatement(tree); AnalyzeResult resultOneLineBranchStatement = oneLineBranchStatement.analyze(); FunctionArgCounter functionArgCounter = new FunctionArgCounter(tree); AnalyzeResult resultfunctionArgCounter = functionArgCounter.analyze(); NestedLoops nestedLoops = new NestedLoops(tree); AnalyzeResult nestedLoopResult = nestedLoops.analyze(); CommentPercentage comment = new CommentPercentage(tree); AnalyzeResult resultcomment = comment.analyze(); StaticNotVoid staticNotVoid = new StaticNotVoid(tree); AnalyzeResult resultstaticNotVoid = staticNotVoid.analyze(); TryCatchFucntionCall tryCatchFucntionCall = new TryCatchFucntionCall(tree); AnalyzeResult resulttryCatchFucntionCall = tryCatchFucntionCall.analyze(); SingleAssertPerTest singleAssertPerTest = new SingleAssertPerTest(tree); AnalyzeResult singleAssertAnalyzeResult = singleAssertPerTest.analyze(); MagicNumbers magicNumbersAnalyzer = new MagicNumbers(tree); AnalyzeResult magicAnalyzeResult = magicNumbersAnalyzer.analyze(); LongClasses longClasses = new LongClasses(tree); AnalyzeResult longClassesResult = longClasses.analyze(); var analyzers = new List <BaseAnalyzer>() { new SingleReturnMethodAnalyzer(tree), // new BooleanParameterAnalyzer(tree), new OneLineBranchStatement(tree), new FunctionArgCounter(tree), new NestedLoops(tree), new CommentPercentage(tree), new StaticNotVoid(tree), new TryCatchFucntionCall(tree), new SingleAssertPerTest(tree), new MagicNumbers(tree), new LongClasses(tree), new EmptyCatch(tree), new NestedConditions(tree), new LongLine(tree), new LongMethods(tree), new LineCount(tree), new StaticOneParameter(tree), new StaticState(tree), new RefOutParameters(tree), new FuncContainAnd(tree) }; var diagnoseResponse = CodeDiagnosticResponse.fromAnalyzers( analyzers ); Console.WriteLine(diagnoseResponse); EmptyCatch emptyCatch = new EmptyCatch(tree); AnalyzeResult resultemptyCatch = emptyCatch.analyze(); NestedConditions nestedConditions = new NestedConditions(tree); AnalyzeResult resultNested = nestedConditions.analyze(); LongLine longLine = new LongLine(tree); AnalyzeResult resultlongLine = longLine.analyze(); LongMethods longMethods = new LongMethods(tree); AnalyzeResult resultLongMethods = longMethods.analyze(); LineCount lineCount = new LineCount(tree); AnalyzeResult lineCountResult = lineCount.analyze(); StaticOneParameter staticOneParameter = new StaticOneParameter(tree); AnalyzeResult staticOneParatemerResult = staticOneParameter.analyze(); StaticState staticState = new StaticState(tree); AnalyzeResult staticStateStaticResult = staticState.analyze(); RefOutParameters refOutParameters = new RefOutParameters(tree); AnalyzeResult refOutParametersResult = refOutParameters.analyze(); FuncContainAnd funcContainAnd = new FuncContainAnd(tree); AnalyzeResult funcContainAndResult = funcContainAnd.analyze(); }
/// <summary> /// The Section Header Block is mandatory. It identifies the beginning of a section of the capture dump file. The Section Header Block /// does not contain data but it rather identifies a list of blocks (interfaces, packets) that are logically correlated. /// </summary> public SectionHeaderBlock(MagicNumbers MagicNumber, UInt16 MajorVersion, UInt16 MinorVersion, Int64 SectionLength, SectionHeaderOption Options, long PositionInStream = 0) { Contract.Requires<ArgumentNullException>(Options != null, "Options cannot be null"); this.MagicNumber = MagicNumber; this.MajorVersion = MajorVersion; this.MinorVersion = MinorVersion; this.SectionLength = SectionLength; this.options = Options; this.PositionInStream = PositionInStream; }
public SectionHeader(MagicNumbers magicNumber = MagicNumbers.microsecondIdentical, UInt16 majorVersion = 2, UInt16 minorVersion = 4, int thiszone =0 , uint sigfigs = 0, uint snaplen = 65535, LinkTypes linkType = LinkTypes.Ethernet) { this.MagicNumber = magicNumber; this.MajorVersion = majorVersion; this.MinorVersion = minorVersion; this.TimezoneOffset = thiszone; this.SignificantFigures = sigfigs; this.MaximumCaptureLength = snaplen; this.LinkType = linkType; }