コード例 #1
0
		public void DeclareVariable(string variableName, VariableOperations variableOperation)
		{
			using (GetLock())
			{
#if _LOGGING
				Log(string.Format("conn{0}.DeclareVariable(\"{1}\", VariableOperations.{2});\r\n", _instanceId, variableName, variableOperation));
#endif
				var contract = LoadData();
				contract.VariableOperations[variableName] = variableOperation;
				SaveData(contract);
				OnDataChanged();
			}
		}
コード例 #2
0
 public static void DeclareVariable(string variableName, VariableOperations variableOperation)
 {
     try
     {
         if (_impl != null)
         {
             _impl.DeclareVariable(variableName, variableOperation);
         }
     }
     catch (Exception ex)
     {
         File.AppendAllText("SmartDev.MultiCurrencyTester.Connect.log", ex.Message + "\r\n" + ex.StackTrace);
     }
 }
コード例 #3
0
 public static void DeclareVariable(string variableName, VariableOperations variableOperation)
 {
     try
     {
         if (_impl != null)
         {
             _impl.DeclareVariable(variableName, variableOperation);
         }
     }
     catch (Exception ex)
     {
         File.AppendAllText("SmartDev.MultiCurrencyTester.Connect.log", ex.Message + "\r\n" + ex.StackTrace);
     }
 }
コード例 #4
0
        public String variable(String name, VariableOperations Kind, String Value = "")
        {
            String Val   = Kind.ToString();
            String query = this.coords + "/CU?&cmd=variable&parm={\"name\":\"" + name + "\",\"what\":\"" + Val + "\"";

            if ((Kind == VariableOperations.set) && (Value == String.Empty))
            {
                return(String.Empty);
            }
            if (Value != String.Empty)
            {
                query += ",\"value\":" + Value;
            }
            query += "}";
            for (UInt32 count = 0; count < this.retry; count++)
            {
                String Ans = GetHtmlAnswer(query);
                if (Ans != String.Empty)
                {
                    return(Ans);
                }
            }
            return(String.Empty);
        }
コード例 #5
0
        /* private static void DebugAstPrint(Node tree, int depth = 0)
         * {
         *  var top = tree as Operation;
         *  if (top != null)
         *  {
         *      if (depth != 0) Interpreter.Write("(");
         *      DebugAstPrint(top.left, depth + 1);
         *
         *      Interpreter.Write(" " + top.op.symbol + " ");
         *
         *      DebugAstPrint(top.right, depth + 1);
         *      if (depth != 0) Interpreter.Write(")");
         *
         *      return;
         *  }
         *
         *  var tvar = tree as Variable;
         *  if (tvar != null) Interpreter.Write(tvar.value);
         * } */

        public static Node OptimizeExpression(Node expression)
        {
            var eop = expression as Operation;

            if (eop != null)
            {
                var left  = OptimizeExpression(eop.left);
                var right = OptimizeExpression(eop.right);

                var var_l = left as Variable;
                var var_r = right as Variable;

                if (var_l != null && var_r != null)
                {
                    if (var_l.type != "variable" && var_r.type != "variable")
                    {
                        switch (eop.op.symbol)
                        {
                        case "+": return(VariableOperations.sum(var_l, var_r));

                        case "-": return(VariableOperations.sub(var_l, var_r));

                        case "*": return(VariableOperations.mul(var_l, var_r));

                        case "/": return(VariableOperations.div(var_l, var_r));

                        case "%": return(VariableOperations.res(var_l, var_r));
                        }
                    }
                }

                return(new Operation(eop.op, left, right));
            }

            return(expression);
        }
コード例 #6
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     AutomationAccount = new AutomationAccountOperations(this);
     Operations        = new Operations(this);
     Statistics        = new StatisticsOperations(this);
     Usages            = new UsagesOperations(this);
     Keys                                   = new KeysOperations(this);
     Certificate                            = new CertificateOperations(this);
     Connection                             = new ConnectionOperations(this);
     ConnectionType                         = new ConnectionTypeOperations(this);
     Credential                             = new CredentialOperations(this);
     DscConfiguration                       = new DscConfigurationOperations(this);
     HybridRunbookWorkerGroup               = new HybridRunbookWorkerGroupOperations(this);
     JobSchedule                            = new JobScheduleOperations(this);
     LinkedWorkspace                        = new LinkedWorkspaceOperations(this);
     Activity                               = new ActivityOperations(this);
     Module                                 = new ModuleOperations(this);
     ObjectDataTypes                        = new ObjectDataTypesOperations(this);
     Fields                                 = new FieldsOperations(this);
     Schedule                               = new ScheduleOperations(this);
     Variable                               = new VariableOperations(this);
     Webhook                                = new WebhookOperations(this);
     Watcher                                = new WatcherOperations(this);
     SoftwareUpdateConfigurations           = new SoftwareUpdateConfigurationsOperations(this);
     SoftwareUpdateConfigurationRuns        = new SoftwareUpdateConfigurationRunsOperations(this);
     SoftwareUpdateConfigurationMachineRuns = new SoftwareUpdateConfigurationMachineRunsOperations(this);
     SourceControl                          = new SourceControlOperations(this);
     SourceControlSyncJob                   = new SourceControlSyncJobOperations(this);
     SourceControlSyncJobStreams            = new SourceControlSyncJobStreamsOperations(this);
     Job       = new JobOperations(this);
     JobStream = new JobStreamOperations(this);
     AgentRegistrationInformation = new AgentRegistrationInformationOperations(this);
     DscNode                          = new DscNodeOperations(this);
     NodeReports                      = new NodeReportsOperations(this);
     DscCompilationJob                = new DscCompilationJobOperations(this);
     DscCompilationJobStream          = new DscCompilationJobStreamOperations(this);
     DscNodeConfiguration             = new DscNodeConfigurationOperations(this);
     NodeCountInformation             = new NodeCountInformationOperations(this);
     RunbookDraft                     = new RunbookDraftOperations(this);
     Runbook                          = new RunbookOperations(this);
     TestJobStreams                   = new TestJobStreamsOperations(this);
     TestJob                          = new TestJobOperations(this);
     Python2Package                   = new Python2PackageOperations(this);
     BaseUri                          = new System.Uri("https://management.azure.com");
     AcceptLanguage                   = "en-US";
     LongRunningOperationRetryTimeout = 30;
     GenerateClientRequestId          = true;
     SerializationSettings            = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     SerializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
     DeserializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
 }
コード例 #7
0
		/// <summary>
		///     Visits an element of type <see cref="VariableExpression" />.
		/// </summary>
		/// <param name="expression">The <see cref="VariableExpression" /> instance that should be visited.</param>
		protected internal override void VisitVariableExpression(VariableExpression expression)
		{
			if (expression.Variable != _variable)
				return;

			if (_writeContext > 0)
				_operations |= VariableOperations.Write;
			else
				_operations |= VariableOperations.Read;
		}
コード例 #8
0
 public void DeclareVariable(string variableName, VariableOperations variableOperation)
 {
     using (GetLock())
     {
     #if _LOGGING
         Log(string.Format("conn{0}.DeclareVariable(\"{1}\", VariableOperations.{2});\r\n", _instanceId, variableName, variableOperation));
     #endif
         var contract = LoadData();
         contract.VariableOperations[variableName] = variableOperation;
         SaveData(contract);
         OnDataChanged();
     }
 }