/// <summary> /// Initializes a new instance of the <see cref="SCInfo"/> class. /// </summary> /// <param name="SCFile">The sc file used to load this instance.</param> internal SCInfo(SCFile SCFile) { this.SCFile = SCFile; this.Exports = new Exports(); this.Temporary = new Temporary(); }
public static Type GetReference(string name, IEnumerable <Type> hintTypes = null) { Match match = TypeDetector.Match(name.Trim()); Type type = new Temporary(match.Groups[2].Value.Trim(':')); //if (match.Groups[3].Success) // for (int i = 0; i < match.Groups[3].Captures.Count; i++) // type.Templates.Add(GetReference(match.Groups[3].Captures[i].Value)); if (match.Groups[4].Success) { for (int i = 0; i < Regex.Replace(match.Groups[4].Value, @"\s*", "").Length; i++) { type = new Pointer(type); } } if (match.Groups[5].Success) { type = new Reference(type); } //if (name.EndsWith("...")) // type.Name += "..."; return(type); }
public void TestMethod1() { Temporary temp = new Temporary(); Assert.AreEqual(temp.Name, "HELLO WORLD!!!"); temp.Name = "ABC"; Assert.AreEqual(temp.Name, "ABC"); }
private static bool TryCompileCall(FunctionCallSyntax call, CompiledMethod method, BasicBlockBuilder builder, IDiagnosticSink diagnostics, INameResolver nameResolver, out Temporary value) { value = default; // Get the callee var matchingMethods = nameResolver.ResolveMethod(call.Function.Name); if (matchingMethods.Count == 0) { diagnostics.Add(DiagnosticCode.MethodNotFound, call.Function.Position, call.Function.Name); return(false); } else if (matchingMethods.Count > 1) { // TODO: Test this case throw new NotImplementedException("Multiple matching methods"); } var declaration = matchingMethods[0]; // Assert that there is the right number of parameters if (call.Parameters.Count != declaration.ParameterTypes.Count) { diagnostics.Add(DiagnosticCode.ParameterCountMismatch, call.Position, actual: call.Parameters.Count.ToString(), expected: declaration.ParameterTypes.Count.ToString()); return(false); } // Evaluate the parameters, verifying their types var parameterIndices = new int[declaration.ParameterTypes.Count]; for (var i = 0; i < parameterIndices.Length; i++) { var paramIndex = TryCompileExpression(call.Parameters[i], declaration.ParameterTypes[i], method, builder, nameResolver, diagnostics); // If the compilation of the expression failed for some reason, the diagnostic is already logged if (paramIndex == -1) { return(false); } parameterIndices[i] = paramIndex; } // Emit a call operation var callType = declaration is ImportedMethodDeclaration ? MethodCallType.Imported : MethodCallType.Native; var callInfoIndex = method.AddCallInfo(declaration.BodyIndex, parameterIndices, declaration.FullName, callType); var resultIndex = method.AddLocal(declaration.ReturnType, LocalFlags.None); builder.AppendInstruction(Opcode.Call, callInfoIndex, 0, resultIndex); value = Temporary.FromLocal(declaration.ReturnType, resultIndex); return(true); }
/// <summary> /// Sends data using this UDP interface. /// </summary> public void Send(IPEndPoint To, Temporary<Data> Data) { AddressFamily af = To.AddressFamily; if (af == AddressFamily.InterNetwork) { this._Send(this._IP4Socket, To, Data); } if (af == AddressFamily.InterNetworkV6 && this._IP6Socket != null) { this._Send(this._IP6Socket, To, Data); } }
/// <summary> /// Initializes this <see cref="CustomCSVOutputAdapter"/>. /// </summary> public override void Initialize() { base.Initialize(); Dictionary <string, string> settings = Settings; string setting, PythonExecutableLocation, PythonFileName; string Temporary; // Load optional parameters if (settings.TryGetValue("FileName", out setting)) { m_fileName = setting; } if (settings.TryGetValue("PythonExecutableLocation", out PythonExecutableLocation)) { PythonExecutable = @PythonExecutableLocation; } if (settings.TryGetValue("PythonFileLocation", out PythonFileName)) { PythonFileToCall = PythonFileName; } if (settings.TryGetValue("PythonGraphScriptLocation", out PythonFileName)) { PythonGraphScriptLocation = PythonFileName; } if (settings.TryGetValue("TriggerValue", out Temporary)) { //If the TriggerValue is not given b the user, it is null and will throw an exception when converitng to double. ThresholdTriggerValue = (Temporary.Equals("") || Temporary == null) ? 0 : Convert.ToDouble(Temporary); } if (settings.TryGetValue("ChangingParameter1Value", out Temporary)) { //If the TriggerValue is not given b the user, it is null and will throw an exception when converitng to double. ChangingParameter1 = (Temporary.Equals("") || Temporary == null) ? 0 : Convert.ToDouble(Temporary); } if (settings.TryGetValue("ChangingParameter2Value", out Temporary)) { //If the TriggerValue is not given b the user, it is null and will throw an exception when converitng to double. ChangingParameter2 = (Temporary.Equals("") || Temporary == null) ? 0 : Convert.ToDouble(Temporary); } SetPythonProcessInfo(); //FileName=E:\testing_csv_trial43b.csv; InputMeasurementKeys=069c5e29-f78a-46f6-9dff-c92cb4f69371; RequeueOnException=False; PythonExecutableLocation=C:\Python27\python.exe; PythonFileLocation=E:\\Sample.py; TriggerValue=400000; ChangingParameter1Value=100; ChangingParameter2Value=200;PythonGraphScriptLocation=E:\\PyQtGraph.py }
public void GenerateFile() { var outputFileName = Temporary.GetTempFilePath(); var options = new GenerateOptions { Subject = GenerateSubject.File, Project = "TESTDB.json", Output = outputFileName, }; Handle(options); Output.WriteLine(File.ReadAllText(outputFileName)); }
public void AddAllTables() { var fileName = Temporary.GetTempFilePath(); CreateProjectFile(fileName); var options = new AddOptions { Project = fileName, Subject = AddSubject.AllTables, }; Handle(options); Output.WriteLine(File.ReadAllText(fileName)); }
static void Main() { Employee[] E = new Employee[4]; //Array of Employee E[0] = new Employee(); E[1] = new FullTime(); E[2] = new PartTime(); E[3] = new Temporary(); foreach (Employee e in E) { e.print(); } Console.Read(); }
public void AddFactory() { var fileName = Temporary.GetTempFilePath(); CreateProjectFile(fileName); var options = new AddOptions { Name = "double-random", Project = fileName, Subject = AddSubject.Factory, }; Handle(options); Output.WriteLine(File.ReadAllText(fileName)); }
public void AddTable() { var fileName = Temporary.GetTempFilePath(); CreateProjectFile(fileName); var options = new AddOptions { Name = "SQLTYPE_TABLE_1", Project = fileName, Subject = AddSubject.Table, }; Handle(options); Output.WriteLine(File.ReadAllText(fileName)); }
public void AddColumnPrescriptions() { var fileName = Temporary.GetTempFilePath(); var project = CreateProject(); ValueFactoryManager.Initialize(); var i = 0; foreach (var tableDescription in project.Descriptor.TableDescriptions) { var tablePrescription = new TablePrescription(tableDescription); foreach (var columnDescription in tableDescription.ColumnDescriptions) { if (columnDescription.Identity != null || !columnDescription.IsWritable()) { continue; } var type = columnDescription.UserType switch { "sql_variant" => typeof(int), _ => SqlTypeUtility.GetDataType(columnDescription.UserType, columnDescription.MaxLength), }; var factory = ValueFactoryManager.ValueFactoryInfos.FilterByType(type).FirstOrDefault(); Assert.NotNull(factory); var configuration = factory.Configurator.CreateConfiguration(); var valueFactoryPrescription = new ValueFactoryPrescription(factory.Name + i++, factory.Name, configuration); project.Prescriptor.AddValueFactory(valueFactoryPrescription); var columnPrescription = new ColumnPrescription(columnDescription, valueFactoryPrescription, null); tablePrescription.AddColumn(columnPrescription); } project.Prescriptor.AddTable(tablePrescription); } ProjectManager.SaveToFile(project, fileName); Output.WriteLine(File.ReadAllText(fileName)); var project2 = ProjectManager.LoadFromFile(fileName); IoAssert.AsExpected(project2); }
/// <summary> /// Allocates a temporary render target. /// </summary> /// <param name="format">The texture format.</param> /// <param name="width">The width in pixels.</param> /// <param name="height">The height in pixels.</param> /// <param name="flags">The texture usage flags.</param> /// <param name="msaa">The texture multisampling level.</param> /// <returns>Created texture.</returns> public static RenderTarget GetTemporary(PixelFormat format, int width, int height, TextureFlags flags = TextureFlags.ShaderResource | TextureFlags.RenderTarget, MSAALevel msaa = MSAALevel.None) { // Try reuse for (int i = 0; i < _tmpRenderTargets.Count; i++) { if (_tmpRenderTargets[i].TryReuse(format, width, height, flags, msaa)) { return(_tmpRenderTargets[i].OnUse()); } } // Allocate new var target = new Temporary(format, width, height, flags, msaa); _tmpRenderTargets.Add(target); return(target.OnUse()); }
public void SaveProject() { var project = CreateProject(); var path = Temporary.GetTempFilePath(); try { ProjectManager.SaveToFile(project, path); Output.WriteLine(File.ReadAllText(path)); } finally { if (File.Exists(path)) { File.Delete(path); } } }
public string AcquireTemporary(Tree.Node node) { int size = node.Dimension.Size(); /* This code would reuse temporaries which are no * longer needed, however this doesn't work for * function arguments which were assumed to be * evaluated in order (C doesn't guarantee this) */ /*for (int i = 0; i < d_tempstorage.Count; ++i) * { * var tmp = d_tempstorage[i]; * * if (tmp.Node != null) * { * continue; * } * * if (tmp.Size < size) * { * continue; * } * * tmp.Node = node; * * d_tempactive[node] = i; * d_tempstack.Peek().Add(tmp); * * return String.Format("tmp{0}", i); * }*/ var tmpstack = d_tempstack.Peek(); var idx = tmpstack.Count; var newtmp = new Temporary { Node = node, Size = size, Name = String.Format("tmp{0}", idx), }; tmpstack.Add(newtmp); return(newtmp.Name); }
public void LoadProject() { var project1 = CreateProject(); var path1 = Temporary.GetTempFilePath(); ProjectManager.SaveToFile(project1, path1); var project2 = ProjectManager.LoadFromFile(path1); IoAssert.AsExpected(project2); var path2 = Temporary.GetTempFilePath(); ProjectManager.SaveToFile(project2, path2); var str1 = File.ReadAllText(path1); var str2 = File.ReadAllText(path2); Assert.Equal(str1, str2); }
public void AddAllValueFactories() { var fileName = Temporary.GetTempFilePath(); var project = CreateProject(); ValueFactoryManager.Initialize(); foreach (var factory in ValueFactoryManager.ValueFactoryInfos) { var configuration = factory.Configurator.CreateConfiguration(); var valueFactoryPrescription = new ValueFactoryPrescription("default-" + factory.Name, factory.Name, configuration); project.Prescriptor.AddValueFactory(valueFactoryPrescription); } ProjectManager.SaveToFile(project, fileName); Output.WriteLine(File.ReadAllText(fileName)); var project2 = ProjectManager.LoadFromFile(fileName); IoAssert.AsExpected(project2); }
public Temporary Declare(WriteTemporaryExpression node) { Temporary temp; for (var i = TemporariesCount - 1; i >= 0; --i) { temp = Temporaries[i]; if (temp.Node == node) return temp; } //Did not find it, so need to declare it if (Temporaries == null) Temporaries = new Temporary[5]; if (TemporariesCount >= Temporaries.Length) Array.Resize(ref Temporaries, TemporariesCount * 2); temp = Temporaries[TemporariesCount]; if (temp == null) Temporaries[TemporariesCount] = temp = new Temporary(); else temp.Node = null; //This is to signal the node it should recalculate ++TemporariesCount; return temp; }
public OperatorTest() { _temp = new Temporary("OperatorTest"); _operator = new NativeOperator(); _operator.Reset(); }
public TemporaryExpression(Temporary temporary) : this(temporary, instruction : null) { }
public TemporaryExpression(Temporary temporary, Instruction instruction) : base(instruction) { Temporary = temporary; }
private static bool InternalTryCompileExpression( ExpressionSyntax syntax, CompiledMethod method, BasicBlockBuilder builder, INameResolver nameResolver, IDiagnosticSink diagnostics, out Temporary value) { value = default; if (syntax is IntegerLiteralSyntax integer) { // Decide the type for the literal // TODO: There is for now only support for int32 and uint32, and only because the smallest int32 should be // TODO: representable. This logic should be updated once multiple integer types officially exist. if (integer.Value > uint.MaxValue) { diagnostics.Add(DiagnosticCode.IntegerConstantOutOfBounds, syntax.Position, integer.Value.ToString(), SimpleType.Int32.TypeName); return(false); } else if (integer.Value > int.MaxValue) { // TODO: This does not work for anything else than int32 minimum value = Temporary.FromConstant(SimpleType.UInt32, ConstantValue.SignedInteger((long)integer.Value)); return(true); } else { value = Temporary.FromConstant(SimpleType.Int32, ConstantValue.SignedInteger((long)integer.Value)); return(true); } } else if (syntax is BooleanLiteralSyntax boolean) { value = Temporary.FromConstant(SimpleType.Bool, ConstantValue.Bool(boolean.Value)); return(true); } else if (syntax is IdentifierSyntax named) { if (!nameResolver.TryResolveVariable(named.Name, out var valueNumber)) { diagnostics.Add(DiagnosticCode.VariableNotFound, named.Position, named.Name); return(false); } value = Temporary.FromLocal(method.Values[valueNumber].Type, (ushort)valueNumber); return(true); } else if (syntax is UnaryExpressionSyntax unary) { if (!InternalTryCompileExpression(unary.InnerExpression, method, builder, nameResolver, diagnostics, out var inner)) { return(false); } return(TryCompileUnary(unary, inner, method, builder, diagnostics, out value)); } else if (syntax is BinaryExpressionSyntax binary) { if (!InternalTryCompileExpression(binary.Left, method, builder, nameResolver, diagnostics, out var left) || !InternalTryCompileExpression(binary.Right, method, builder, nameResolver, diagnostics, out var right)) { return(false); } return(TryCompileBinary(binary, left, right, method, builder, diagnostics, out value)); } else if (syntax is FunctionCallSyntax call) { return(TryCompileCall(call, method, builder, diagnostics, nameResolver, out value)); } else { throw new NotImplementedException(); } }
public Kalkulator() { display = new Display(); temporary = null; memory = Double.NaN; }
public StoreTemporaryStatement(Temporary temporary, Expression value, Instruction instruction) : base(instruction) { Temporary = temporary; Value = value; }
public StoreTemporaryStatement(Temporary temporary, Expression value) : this(temporary, value, instruction : null) { }
public void NewProjectTest() => CreateProjectFile(Temporary.GetTempFilePath(".json"));
public void Press(char inPressedDigit) { if (Char.IsDigit(inPressedDigit)) { display.AddSignIfSpace(inPressedDigit); } if (Char.ToString(inPressedDigit) == ",") { display.AddCommaIfNotExist(); } else if (unaryOperations.Contains(inPressedDigit)) { double result = ExecuteUnary(display.GetAsDouble(), inPressedDigit); display.SetDisplay(result); } else if (binaryOperations.Contains(inPressedDigit)) { if (temporary == null) { temporary = new Temporary(display.GetAsDouble(), inPressedDigit); } else if (display.LastWasBinaryOrEqual) { temporary.Operation = inPressedDigit; } else { temporary.Value = ExecuteBinary(temporary.Value, display.GetAsDouble(), temporary.Operation); temporary.Operation = inPressedDigit; } display.LastWasBinaryOrEqual = true; display.TrimZeroes(); } else if (Char.ToString(inPressedDigit) == "O") { display = new Display(); temporary = null; } else if (Char.ToString(inPressedDigit) == "=") { if (display.LastWasBinaryOrEqual == true && temporary != null) { double result = ExecuteBinary(temporary.Value, temporary.Value, temporary.Operation); display.SetDisplay(result); temporary = null; } else if (temporary == null) { display.TrimZeroes(); } else { double result = ExecuteBinary(temporary.Value, display.GetAsDouble(), temporary.Operation); display.SetDisplay(result); temporary = null; } display.LastWasBinaryOrEqual = true; } else if (Char.ToString(inPressedDigit) == "P") { memory = display.GetAsDouble(); display.TrimZeroes(); } else if (Char.ToString(inPressedDigit) == "G") { display.SetDisplay(memory); display.LastWasBinaryOrEqual = false; display.TrimZeroes(); } else if (Char.ToString(inPressedDigit) == "C") { display = new Display(); } }
public override void AfterSummon(GameObject summoned) { Temporary.AddHierarchically(summoned, SUMMON_DURATION); base.AfterSummon(summoned); }
/// <summary> /// Sends data using the given socket. /// </summary> private void _Send(Socket Socket, IPEndPoint To, Temporary<Data> Data) { byte[] buffer; int offset, size; _Bufferize(Data, out buffer, out offset, out size); Socket.BeginSendTo(buffer, offset, size, SocketFlags.None, To, delegate(IAsyncResult ar) { Socket socket = (ar.AsyncState as Socket); socket.EndSend(ar); if (!this._Receiving) { this._Receiving = true; this._Bind(((IPEndPoint)socket.LocalEndPoint).Port); } }, Socket); }
private void _Receive(IPEndPoint From, Temporary<Data> Data) { Data data = Data; int size = (int)data.Size; UDPHubSettings settings = this._Settings; // Find the peer that sent this message UDPPeer peer; if (this._Peers.TryGetValue(From, out peer)) { bool remove; using (Disposable<InStream> str = data.Read()) { peer._Receive(settings, this, Packet.Read(str, size), out remove); } if (remove) { this._Disconnect(peer); this._Peers.Remove(From); } } // See if this packet is a connection request, or a response to one if (size >= 5) { using (Disposable<InStream> dstr = data.Read()) { InStream str = dstr; PacketFlags flags = (PacketFlags)str.ReadByte(); if (flags == PacketFlags.ConnectionRequest && size == 5) { // Connection requested int seq = str.ReadInt(); if (_ShouldAccept(From)) { int ack = settings.Random.Integer(); this._Connect(peer = UDPPeer._InitializeServer(settings, From, seq, ack)); if (this.Accepted != null) { this.Accepted(peer); } BufferOutStream bos = new BufferOutStream(settings.SendBuffer, 0); bos.WriteByte((byte)PacketFlags.ConnectionAccept); bos.WriteInt(seq); bos.WriteInt(ack); this._UDP.Send(From, DUIP.Data.FromBuffer(bos.Buffer, 0, bos.Position)); } else { BufferOutStream bos = new BufferOutStream(settings.SendBuffer, 0); bos.WriteByte((byte)PacketFlags.ConnectionRefuse); bos.WriteInt(seq); this._UDP.Send(From, DUIP.Data.FromBuffer(bos.Buffer, 0, bos.Position)); } } _ConnectionRequest cr; if (flags == PacketFlags.ConnectionAccept && size == 9 && this._ConnectionRequests.TryGetValue(From, out cr)) { // Connection accepted by client int ack = str.ReadInt(); int seq = str.ReadInt(); if (ack == cr.AcknowledgementNumber) { this._Connect(peer = UDPPeer._InitializeClient(settings, From, seq, ack, cr.Time)); cr.Query.Complete(peer); this._ConnectionRequests.Remove(From); } } if (flags == PacketFlags.ConnectionRefuse && size == 5 && this._ConnectionRequests.TryGetValue(From, out cr)) { // Connection explicitly refused by peer int ack = str.ReadInt(); if (ack == cr.AcknowledgementNumber) { cr.Query.Cancel(); this._ConnectionRequests.Remove(From); } } } } }
/// <summary> /// 手动清除所有临时文件 /// </summary> public static void ClearTemporaryFile() => Temporary.Prepend(TemporaryDirectoryField).ForEach(x => x?.Delete());
private void Start() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) Screen.set_sleepTimeout(-1); isInitialized = false; isApplicationQuit = false; isReset = false; showingTableLoadError = false; Startup(); InitCollideLayers(); if ((int)Screen.get_orientation() == 0 || (int)Screen.get_orientation() == 1 || (int)Screen.get_orientation() == 3 || (int)Screen.get_orientation() == 3 || (int)Screen.get_orientation() == 4) { Screen.set_orientation(1); } else { Screen.set_orientation(2); } Utility.Initialize(); Temporary.Initialize(); Protocol.Initialize(); HomeSelfCharacter.CTRL = true; appVer = NetworkNative.getNativeVersionFromName(); GameObject val = this.get_gameObject(); val.AddComponent <GoWrapManager>(); val.AddComponent <FCMManager>(); val.AddComponent <DefaultTimeUpdater>(); val.AddComponent <ResourceManager>(); MonoBehaviourSingleton <ResourceManager> .I.onAsyncLoadQuery = onAsyncLoadQuery; val.AddComponent <InstantiateManager>(); DataTableManager dataTableManager = new GameObject("DataTableManager").AddComponent <DataTableManager>(); dataTableManager.get_transform().set_parent(base._transform); dataTableManager.onError += OnTableDownloadError; ResourceManager.enableLoadDirect = false; CreateDefaultCamera(); val.AddComponent <ScreenOrientationManager>(); MonoBehaviourSingleton <ScreenOrientationManager> .I.OnScreenRotate += OnScreenRotate; UpdateResolution(MonoBehaviourSingleton <ScreenOrientationManager> .I.isPortrait); Utility.CreateGameObjectAndComponent("AudioListenerManager", MonoBehaviourSingleton <AppMain> .I._transform, -1); Utility.CreateGameObjectAndComponent("SoundManager", base._transform, -1); Utility.CreateGameObjectAndComponent("AudioObjectPool", base._transform, -1); Utility.CreateGameObjectAndComponent("EffectManager", base._transform, -1); val.AddComponent <NetworkManager>(); val.AddComponent <ProtocolManager>(); val.AddComponent <AccountManager>(); val.AddComponent <TimeManager>(); val.AddComponent <GoGameTimeManager>(); Utility.CreateGameObjectAndComponent("NativeReceiver", base._transform, -1); Utility.CreateGameObjectAndComponent("ShopReceiver", base._transform, -1); Utility.CreateGameObjectAndComponent("ChatManager", base._transform, -1); Utility.CreateGameObjectAndComponent("NativeShare", base._transform, -1); val.AddComponent <CoopApp>(); val.AddComponent <BootProcess>(); }