Inheritance: MonoBehaviour
Esempio n. 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="rgParam"></param>
 public static void Usage(Param[] rgParam)
 {
     int cLen = 0;
     for (int i = 0; i < rgParam.Length; ++i)
     {
         if (!String.IsNullOrEmpty(rgParam[i].LongName))
         {
             int cch = rgParam[i].LongName.Length;
             if (cLen < cch)
                 cLen = cch;
         }
     }
     cLen += 4;
     for (int i = 0; i < rgParam.Length; ++i)
     {
         string sShort;
         if (String.IsNullOrEmpty(rgParam[i].ShortName))
             sShort = "  ";
         else
             sShort = String.Format("-{0}", rgParam[i].ShortName);
         string sLong;
         if (String.IsNullOrEmpty(rgParam[i].LongName))
             sLong = "    ";
         else
             sLong = String.Format("(--{0})", rgParam[i].LongName);
         while (sLong.Length < cLen)
             sLong = sLong + " ";
         string sLine = String.Format("  {0} {1} = {2}",
             sShort, sLong, rgParam[i].Description);
         Console.WriteLine(sLine);
     }
 }
Esempio n. 2
0
        public Info[] Expected(Specification problem)
        {
            Function function = problem.Function.Invoke;
            Gradient gradient = problem.Gradient.Invoke;

            Param param = new Param()
            {
                m = m,
                epsilon = epsilon,
                past = past,
                delta = delta,
                max_iterations = max_iterations,
                linesearch = (int)linesearch,
                max_linesearch = max_linesearch,
                min_step = min_step,
                max_step = max_step,
                ftol = ftol,
                wolfe = wolfe,
                gtol = gtol,
                xtol = xtol,
                orthantwise_c = orthantwise_c,
                orthantwise_start = orthantwise_start,
                orthantwise_end = orthantwise_end
            };

            NativeCode = Wrapper.Libbfgs((double[])problem.Start.Clone(), function, gradient, param);

            // Convergence and success have the same
            // enumeration value in the original code
            if (NativeCode == "LBFGS_CONVERGENCE")
                NativeCode = "LBFGS_SUCCESS";

            return Wrapper.list.ToArray();
        }
Esempio n. 3
0
        private static void GenerateMethod()
        {
            Method method = new Method();
            method.Name = "MyNewProc";
            method.MethodType = MethodTypeEnum.Void;
            Param newParam = new Param();
            TypeReferenceExpression newTypeReferenceExpression = new TypeReferenceExpression();
            newTypeReferenceExpression.Name = CodeRush.Language.GetSimpleTypeName("System.Int32");
            newParam.MemberTypeReference = newTypeReferenceExpression;
            newParam.Name = "MyKillerParameter";

            method.Parameters.Add(newParam);

            MethodCall statement = new MethodCall();
            statement.Name = "Start";
            //UnaryIncrement newUnaryIncrement = new UnaryIncrement();
            //ElementReferenceExpression elementReferenceExpression = new ElementReferenceExpression(newParam.Name);
            //newUnaryIncrement.Expression = elementReferenceExpression;
            //statement.AddDetailNode(newUnaryIncrement);
            //int MyKillerParameter = 0;
            //MyKillerParameter++;

            method.AddNode(statement);
            string newCode = CodeRush.Language.GenerateElement(method);
            TextDocument activeTextDocument = CodeRush.Documents.ActiveTextDocument;
            if (activeTextDocument == null)
                return;

            activeTextDocument.InsertText(activeTextDocument.ActiveView.Caret.SourcePoint, newCode);
        }
Esempio n. 4
0
        public virtual object Clone()
        {
            Param param = new Param();
            
            param.m_identifier = m_identifier;
            param.m_name = m_name;
            param.m_type = m_type;
            param.m_lazy = m_lazy;

            if(m_value != null)
            {
                if(m_value is IUimlElement)
                {
                    param.m_value = ((IUimlElement)m_value).Clone();
                }
                else
                {
                    param.m_value = m_value;
                }
            }
            if(m_subprop != null)
            {
                param.m_subprop = m_subprop;
            }

            param.PartTree = m_partTree;

            return param;

        }        
        public void CreateSuggorateModel()
        {
            // configure model (do once at app startup)
            var model = RuntimeTypeModel.Default;
            model.Add(typeof(Param), false).SetSurrogate(typeof(ParamSurrogate));
            model.Add(typeof (FloatData), false).Add("Ranges", "AdjustValue", "Values");
            //TODO: other types here

            // test data
            var param = new Param
            {
                Item = new FloatData
                {
                    AdjustValue = 123.45F,
                    Ranges = new float[] { 1.0F, 2.4F },
                    Values = new float[] { 7.21F, 19.2F }
                }
            };
            // note the fallowing is the same as Serializer.DeepClone, since
            // model === RuntimeTypeModel.Default
            var clone = (Param) model.DeepClone(param);
            Assert.AreNotSame(clone, param, "Different instance");
            Assert.IsInstanceOfType(typeof(FloatData), clone.Item, "Data type");
            var data = (FloatData) clone.Item;
            Assert.AreEqual(123.45F, data.AdjustValue);
            Assert.AreEqual(2, data.Ranges.Length);
            Assert.AreEqual(1.0F, data.Ranges[0]);
            Assert.AreEqual(2.4F, data.Ranges[1]);
            Assert.AreEqual(2, data.Values.Length);
            Assert.AreEqual(7.21F, data.Values[0]);
            Assert.AreEqual(19.2F, data.Values[1]);

        }
Esempio n. 6
0
        /// <summary>
        /// Returns the contiguous acres associated with the user. This method does NOT
        /// populate the contiguous acres' wells property.
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public List<ContiguousAcres> GetContiguousAcres(int userId, bool includeNonOwned)
        {
            Param[] nonOwnedCAParams = new Param[] {};
            string[] nonOwnedCAParamNames = null;
            if (includeNonOwned) {
                var caIds = new PropertyDalc().GetAssociatedCAIds(userId);
                if (caIds.Count() == 0) {
                    // No associations exist; don't even try to retrieve them.
                    includeNonOwned = false;
                } else {
                    nonOwnedCAParams = ParameterizeInClause("caId", out nonOwnedCAParamNames, caIds.ToArray());
                }
            }

            return ExecuteDataTable(@"
            select
            ca.OBJECTID,
            ca.caID,
            ca.area as area_m2,
            ca.admin_area as area_acres,
            ca.description,
            ca.approved,
            ca.actingId
            from HP_CONTIGUOUS_ACRES" + dbTableSuffix + @" ca
            where
            (ca.actingId = @id" + (includeNonOwned
                        ? " or ca.caId in (" + string.Join(", ", nonOwnedCAParamNames) + "))"
                        : ")") + @"
            and isnull(ca.Deletion, '') <> 'True';",
                        new Param[] { new Param("@id", userId) }.Concat(nonOwnedCAParams).ToArray()
                ).AsEnumerable().Select(row => GetCAFromDataRow(row)).ToList();
        }
Esempio n. 7
0
        public static ParamInfo GetParamByID(int paramid)
        {
            Param pra = new Param();

            if (!enableCaching)
                return pra.GetParamByID(paramid);

            string key = "param_" + paramid;

            ParamInfo data = (ParamInfo)HttpRuntime.Cache[key];

            // Check if the data exists in the data cache
            if (data == null)
            {
                // If the data is not in the cache then fetch the data from the business logic tier
                data = pra.GetParamByID(paramid);

                // Create a AggregateCacheDependency object from the factory
                AggregateCacheDependency cd = DependencyFacade.GetDeviceDependency();

                // Store the output in the data cache, and Add the necessary AggregateCacheDependency object
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(ParamTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return data;

        }
Esempio n. 8
0
 internal void AddParameter(string name, string sval)
 {
     Param p = new Param();
     p.ParamName = name;
     p.ParamValue = sval;
     Parameters.Add(p);
 }
Esempio n. 9
0
 public Tv(string nameTv, bool stateTv, Channels channelCur, byte volumeCur, byte brightCur)
     : base(nameTv, stateTv)
 {
     channel = channelCur;
     volume = new Param(volumeCur, 1, 5);
     bright = new Param(brightCur, 1, 5);
 }
Esempio n. 10
0
        public Info[] Expected(Specification problem)
        {
            Function function = problem.Function.Invoke;
            Gradient gradient = problem.Gradient.Invoke;

            Param param = new Param()
            {
                m = m,
                epsilon = epsilon,
                past = past,
                delta = delta,
                max_iterations = max_iterations,
                linesearch = (int)linesearch,
                max_linesearch = max_linesearch,
                min_step = min_step,
                max_step = max_step,
                ftol = ftol,
                wolfe = wolfe,
                gtol = gtol,
                xtol = xtol,
                orthantwise_c = orthantwise_c,
                orthantwise_start = orthantwise_start,
                orthantwise_end = orthantwise_end
            };

            NativeCode = Wrapper.Libbfgs((double[])problem.Start.Clone(), function, gradient, param);

            return Wrapper.list.ToArray();
        }
Esempio n. 11
0
        public static ObservableCollection<Param> FieldToCollection(string strXml)
        {
            string XmlTemplete = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "\r\n" +
                            "<Paras>" + "\r\n" +
                            "{0}" +
                                     "</Paras>";
            XmlTemplete = string.Format(XmlTemplete, strXml);
            Byte[] b = System.Text.UTF8Encoding.UTF8.GetBytes(XmlTemplete);
            XElement xele = XElement.Load(System.Xml.XmlReader.Create(new MemoryStream(b)));

            var Param = from item in xele.Descendants("Para")
                        select item;
            ObservableCollection<Param> List = new ObservableCollection<Param>();
            foreach (var vv in Param)
            {
                Param r = new Param();
                r.FieldID = vv.Attribute("Value").Value.CvtString().Replace("{", "").Replace("}", "");
                try
                {
                    r.FieldName = vv.Attribute("ValueName").Value.CvtString();
                }
                catch
                {
                    r.FieldName = string.Empty;
                }
                r.Description = vv.Attribute("Description").Value.CvtString();
                r.TableName = vv.Attribute("TableName").Value.CvtString();
                r.ParamID = vv.Attribute("Name").Value.CvtString();
                r.ParamName = vv.Attribute("Description").Value.CvtString();
                List.Add(r);
            }
            return List;
        }
Esempio n. 12
0
 /// <summary>
 /// This static method parses the command line, storing the parameter values, and
 /// returning the index of the first non-option command line argument.
 /// </summary>
 /// <param name="args"></param>
 /// <param name="rgParam"></param>
 /// <param name="index"></param>
 /// <returns></returns>
 public static bool Parse(string[] args, ref Param[] rgParam, out int index)
 {
     index = args.Length;
     try
     {
         for (int i = 0; i < args.Length; ++i)
         {
             if (args[i].StartsWith("-"))
             {
                 bool fOk;
                 if (args[i].StartsWith("--"))
                     fOk = CheckLongParamNames(args, rgParam, ref i);
                 else
                     fOk = CheckShortParamNames(args, rgParam, ref i);
                 if (!fOk)
                     throw new Exception(String.Format("Invalid option found in {0}", args[i]));
             }
             else
             {
                 index = i;
                 return true;
             }
         }
         index = args.Length;
         return true;
     }
     catch (Exception ex)
     {
         s_sError = ex.Message;
         return false;
     }
 }
Esempio n. 13
0
		public void MyMethod(Param stateIdentifier)
		{
			GetSate(stateIdentifier);
			counter++;
			var sessionId = OperationContext.Current.SessionId;
			Trace.WriteLine(string.Format("Counter = {0}, SessionId = {1}", counter, sessionId));
			SaveState(stateIdentifier);
		}
Esempio n. 14
0
        private static void AddParam(Param p)
        {
            if (_params.Count > 0)
                _allParams.Append(", ");
            _allParams.Append(p.Name);

            _params.Add(p.Name.ToLower(), p);
        }
Esempio n. 15
0
        public static Param[] DecryptParams(string Parameters)
        {
            Parameters = "*" + Parameters;      // musim pridat '*'
            Param[] retParams = null;
            const char ParamStart = '*';
            const char ParamSeparator = '&';
            const char ParamEqual = '=';
            int i = Parameters.IndexOf(ParamStart);
            //int i = 0;
            int j = i;
            int k;

            if (i >= 0)
            {
                while ((i < Parameters.Length) || (i == -1))
                {
                    j = Parameters.IndexOf(ParamEqual, i);
                    if (j > i)
                    {
                        if (retParams == null)
                        {
                            retParams = new Param[1];
                            retParams[0] = new Param();
                        }
                        else
                        {
                            Param[] rettempParams = new Param[retParams.Length + 1];
                            retParams.CopyTo(rettempParams, 0);
                            rettempParams[rettempParams.Length - 1] = new Param();
                            retParams = new Param[rettempParams.Length];
                            rettempParams.CopyTo(retParams, 0);
                        }
                        k = Parameters.IndexOf(ParamSeparator, j);
                        retParams[retParams.Length - 1].Name = Parameters.Substring(i + 1, j - i - 1);

                        if (k == j)
                        {
                            retParams[retParams.Length - 1].Value = "";
                        } 
                        else if (k > j)
                        {
                            retParams[retParams.Length - 1].Value = Parameters.Substring(j + 1, k - j - 1);
                        } 
                        else
                        {
                            retParams[retParams.Length - 1].Value = Parameters.Substring(j + 1, Parameters.Length - j - 1);
                        }
                        if (k > 0)
                            i = Parameters.IndexOf(ParamSeparator, k);
                        else
                            i = Parameters.Length;
                    }
                    else
                        i = -1;
                }
            }
            return retParams;
        }
 public SerialCommunicationForm(Sync syn, PLCState plcS, Queue<Orientamento> list)
 {
     this.microToPLC = list;
     this.syncPolling = new Sync();
     this.ComPort = new SerialPort();
     this.param = Param.getInstance();
     this.plcState = plcS;
     init();
 }
Esempio n. 17
0
        public static Param[] decryptParam(String Parameters)
        {
            Param[] retParams = null;
            int i = Parameters.IndexOf(ParamStart);
            int j = i;
            int k;
            
            if (i >= 0)
            {
                //look at the number of = and ;

                while ((i < Parameters.Length) || (i == -1))
                {
                    j = Parameters.IndexOf(ParamEqual, i);
                    if (j > i)
                    {
                        //first param!
                        if (retParams == null)
                        {
                            retParams = new Param[1];
                            retParams[0] = new Param();
                        }
                        else
                        {
                            Param[] rettempParams = new Param[retParams.Length + 1];
                            retParams.CopyTo(rettempParams, 0);
                            rettempParams[rettempParams.Length - 1] = new Param();
                            retParams = new Param[rettempParams.Length];
                            rettempParams.CopyTo(retParams, 0);
                        }
                        k = Parameters.IndexOf(ParamSeparator, j);
                        retParams[retParams.Length - 1].Name = Parameters.Substring(i + 1, j - i - 1);
                        //case'est la fin et il n'y a rien
                        if (k == j)
                        {
                            retParams[retParams.Length - 1].Value = "";
                        } // cas normal
                        else if (k > j)
                        {
                            retParams[retParams.Length - 1].Value = Parameters.Substring(j + 1, k - j - 1);
                        } //c'est la fin
                        else
                        {
                            retParams[retParams.Length - 1].Value = Parameters.Substring(j + 1, Parameters.Length - j - 1);
                        }
                        if (k > 0)
                            i = Parameters.IndexOf(ParamSeparator, k);
                        else
                            i = Parameters.Length;
                    }
                    else
                        i = -1;
                }
            }
            return retParams;
        }
Esempio n. 18
0
 /// <summary>
 /// Serializes the Payload object into a valid JSON string if no arguments are supplied, otherwise converts the arguments into a JSON string
 /// WARNING! defaults to isPublic=TRUE!
 /// </summary>
 /// <param name="param"></param>
 /// <param name="query"></param>
 /// <param name="type"></param>
 /// <param name="isPublic"></param>
 /// <param name="filter"></param>
 /// <param name="apikey"></param>
 /// <returns></returns>
 public string PackagePayload(Param param, string query =null, string type=null, bool isPublic=true, string filter=null, string apikey=null)
 {
     this.param = param;
     this.query = query;
     this.type = type;
     this.isPublic = isPublic;
     this.filter = filter;
     this.apikey = apikey;
     return JsonConvert.SerializeObject(this, jsonsettings);
 }
 void _value_ValueChanged(Param.Parameter sender)
 {
     if (Param == null) return;
     if (Param.Value == null)
     {
         lblProjection.Text = "";
         return;
     }
     lblProjection.Text = Param.Value.ToProj4String();
 }
        private void calculateAngle(Param.State state)
        {
            State st = new State();
            switch (state)
            {
                case Param.State.ORIZZONTALE:
                    {
                        st.StandardPosition = param.StandardPositionOrizzontale;
                        st.Angle = 0;
                        plc.addLast(st);
                        plc.setTextln("ORIZZONTALE");
                        break;
                    }
                case Param.State.ORIZZONTALECAPOVOLTO:
                    {
                        st.StandardPosition = param.StandardPositionOrizzontaleCapovolto;
                        st.Angle = 0;
                        plc.addLast(st);
                        plc.setTextln("ORIZZONTALECAPOVOLTO");
                        break;
                    }
                case Param.State.VERTICALEORIZZONTALE90:
                    {
                        st.StandardPosition = param.StandardPositionVerticaleOrizzontale90;
                        st.Angle = 0;
                        plc.addLast(st);
                        plc.setTextln("VERTICALEORIZZONTALE90");
                        break;
                    }
                case Param.State.VERTICALEORIZZONTALE270:
                    {
                        st.StandardPosition = param.StandardPositionVerticaleOrizzontale270;
                        st.Angle = 0;
                        plc.addLast(st);
                        plc.setTextln("VERTICALEORIZZONTALE270");
                        break;
                    }
                case Param.State.VERTICALEALTO:
                    {
                        st.Angle = param.AngleVerticaleAlto;
                        plc.addLast(st);
                        plc.setTextln("VERTICALEALTO");
                        break;
                    }
                case Param.State.VERTICALEBASSO:
                    {
                        st.Angle = param.AngleVerticaleBasso;
                        plc.addLast(st);
                        plc.setTextln("VERTICALEBASSO");
                        break;
                    }

            }
        }
 public object SaveBetter()
 {
     dynamic entity = new Param
          {
              InstructionName = "Use RavenDB"
          };
      entity.Age = 15;
      entity.Name = "John";
      entity.First = false;
      entity.Strange = new[,] {{1, 23}, {43, 31}, {123, -21}};
      Session.Store(entity);
      return null;
 }
Esempio n. 22
0
            static void callMenu(ConsoleKeyInfo key, Param param)
            {
                Console.Clear();

                    Console.WriteLine("1." + PhoneBook.Numbers[numberIndex] +
                        "\nEsc - back to main menu");

                if (key.Key == ConsoleKey.Escape)
                {
                    menu = mainMenu;
                    menu(new ConsoleKeyInfo(), null);
                }
            }
        public void A()
        {
            var target = new Target();
            var p = new Param();
            var p2 = new OtherParam();
            object x = new Param();

            target.M(p);
            target.M(p2);
            target.M(x);
            target.M(p, p2);
            target.M(x, x);
        }
Esempio n. 24
0
 private static Method BuildForKarachi()
 {
     var param = new Param
                     {
                         Fajr = 18,
                         Isha = 18,
                         Magrib = 0,
                         IsMagribInMinutes = true,
                         Midnight = MidnightMethods.Standard
                     };
     var m = new Method { Name = "University of Islamic Sciences, Karachi", Params = param };
     return m;
 }
Esempio n. 25
0
 private static Method BuildForMakkah()
 {
     var param = new Param
                     {
                         Fajr = 18.5,
                         Isha = 90,
                         IsIshaInMinutes = true,
                         Magrib = 0,
                         IsMagribInMinutes = true,
                         Midnight = MidnightMethods.Standard
                     };
     var m = new Method { Name = "Umm Al-Qura University, Makkah", Params = param };
     return m;
 }
Esempio n. 26
0
 public static void Remove(Param param)
 {
     ListParam.Remove(param);
     //if (ListParam != null)
     //{
     //    for (int i = 0; i < ListParam.Count();i++)
     //    {
     //        if (ListParam[i].FieldName == param.FieldName)
     //        {
     //            ListParam.RemoveAt(i);
     //        }
     //    }
     //}
 }
Esempio n. 27
0
 public Initparams()
 {
     //if(paramsString != String.Empty) {
         char[] seperator = { ';' };
         paramsSplit = paramsString.Split(seperator);
         List<string> paramList = paramsSplit.ToList<string>();
         foreach(string i in paramList){
             char[] seperatorI = {'='};
             string[] j = i.Split(seperatorI);
             Param p = new Param(j[0], j[1]);
             Params.Add(p);
         }
     //}
 }
Esempio n. 28
0
        public Dungeon(int width, int height, int floors, int chestCount, int roomsNumber, bool allowLockedDoors)
        {
            param = new Param();
            param.maxMapWidth = width;
            param.maxMapHeight = height;
            param.floors = floors;
            param.chestCount = chestCount;
            param.roomsCount = roomsNumber;
            param.allowLockedDoors = allowLockedDoors;

            print(Heading.Info, "Init new dungeon. Parameters:\n Width: {0}\n Height: {1}\n Floors: {2}\n Chests: {3}\n Rooms: {4}\n Locked doors: {5}\n",
                new object[] {
                    width, height, floors, chestCount, roomsNumber, allowLockedDoors ? "true" : "false"
                });
        }
Esempio n. 29
0
    static void Main()
    {
        Test	test = new Test();

        Param	param = new Param(234, "Hello");

        Console.WriteLine("---- before ----");
        param.output();

        //	内部で参照を保持
        test.keep(param);
        //	保持した参照に対して書き換えを行う
        test.rewrite();

        Console.WriteLine("---- after ----");
        //	元のインスタンスの内容が書き換わっていることを確認
        param.output();
    }
Esempio n. 30
0
    /// <summary>
    /// Loads the specified node uid.
    /// </summary>
    /// <param name="NodeUid">The node uid.</param>
    /// <param name="ControlUid">The control uid.</param>
    void IPropertyPage.Load(string NodeUid, string ControlUid)
    {
        ControlSettings settings = new ControlSettings();

        DynamicNode dNode = PageDocument.Current.DynamicNodes.LoadByUID(NodeUid);

        if (dNode != null)
        {
            settings = dNode.GetSettings(NodeUid);
        }

        // Bind Meta Types
        // Bind Meta classes
        // MetaDataContext.Current = CatalogContext.MetaDataContext;
        MetaClass catalogEntry = MetaClass.Load(CatalogContext.MetaDataContext, "CatalogEntry");

        MetaClassList.Items.Clear();
        if (catalogEntry != null)
        {
            MetaClassCollection metaClasses = catalogEntry.ChildClasses;
            foreach (MetaClass metaClass in metaClasses)
            {
                MetaClassList.Items.Add(new ListItem(metaClass.FriendlyName, metaClass.Name));
            }
            MetaClassList.DataBind();
        }

        // Bind templates
        DisplayTemplate.Items.Clear();
        DisplayTemplate.Items.Add(new ListItem("(use default)", ""));
        TemplateDto templates = DictionaryManager.GetTemplateDto();

        if (templates.main_Templates.Count > 0)
        {
            DataView view = templates.main_Templates.DefaultView;
            view.RowFilter = "TemplateType = 'search'";

            foreach (DataRowView row in view)
            {
                DisplayTemplate.Items.Add(new ListItem(row["FriendlyName"].ToString(), row["Name"].ToString()));
            }

            DisplayTemplate.DataBind();
        }

        // Bind Types
        EntryTypeList.Items.Clear();
        EntryTypeList.Items.Add(new ListItem(EntryType.Product, EntryType.Product));
        EntryTypeList.Items.Add(new ListItem(EntryType.Package, EntryType.Package));
        EntryTypeList.Items.Add(new ListItem(EntryType.Bundle, EntryType.Bundle));
        EntryTypeList.Items.Add(new ListItem(EntryType.DynamicPackage, EntryType.DynamicPackage));
        EntryTypeList.Items.Add(new ListItem(EntryType.Variation, EntryType.Variation));
        EntryTypeList.DataBind();

        // Bind catalogs
        CatalogList.Items.Clear();
        CatalogDto catalogs = CatalogContext.Current.GetCatalogDto(CMSContext.Current.SiteId);

        if (catalogs.Catalog.Count > 0)
        {
            foreach (CatalogDto.CatalogRow row in catalogs.Catalog)
            {
                if (row.IsActive && row.StartDate <= FrameworkContext.Current.CurrentDateTime && row.EndDate >= FrameworkContext.Current.CurrentDateTime)
                {
                    CatalogList.Items.Add(new ListItem(row.Name, row.Name));
                }
            }

            CatalogList.DataBind();
        }


        if (settings != null && settings.Params != null)
        {
            Param prm = settings.Params;

            CommonHelper.LoadTextBox(settings, "NodeCode", NodeCode);
            CommonHelper.LoadTextBox(settings, "RecordsPerPage", NumberOfRecords);

            CommonHelper.LoadTextBox(settings, "FTSPhrase", FTSPhrase);
            CommonHelper.LoadTextBox(settings, "AdvancedFTSPhrase", AdvancedFTSPhrase);
            CommonHelper.LoadTextBox(settings, "MetaSQLClause", MetaSQLClause);
            CommonHelper.LoadTextBox(settings, "SQLClause", SQLClause);

            if ((prm["DisplayTemplate"] != null) && (prm["DisplayTemplate"] is string))
            {
                CommonHelper.SelectListItem(DisplayTemplate, prm["DisplayTemplate"].ToString());
            }

            CommonHelper.SelectList(settings, "Catalogs", CatalogList);
            CommonHelper.SelectList(settings, "EntryClasses", MetaClassList);
            CommonHelper.SelectList(settings, "EntryTypes", EntryTypeList);

            // Orderby
            if ((prm["OrderBy"] != null) && (prm["OrderBy"] is string))
            {
                string orderBy = prm["OrderBy"].ToString();
                bool   isDesc  = orderBy.Contains("DESC");

                string listOrderBy = orderBy.Replace(" DESC", "");
                listOrderBy = listOrderBy.Replace(" ASC", "");

                CommonHelper.SelectListItem(OrderByList, listOrderBy);

                if (!String.IsNullOrEmpty(OrderByList.SelectedValue))
                {
                    if (OrderByList.SelectedValue == "custom")
                    {
                        OrderBy.Text = orderBy;
                    }
                    else
                    {
                        OrderDesc.Checked = isDesc;
                    }
                }
            }
        }
    }
Esempio n. 31
0
        /// <summary>
        /// 保存按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            if (curSubModule == null)
            {
                return;
            }
            //获取检测设备
            var detectEquList = (from r in curSubModule.Params where r.Name == RfidConfigParam.DetectEqu select r).ToList();

            if (detectEquList.Count > 0)
            {
                var detectEqu = this.UsePassCarType.SelectedItem as ComboBoxItem;
                detectEquList.First().Value = detectEqu.Content.ToString();
            }
            //获取连接方式
            var list = (from r in curSubModule.Params where r.Name == RfidConfigParam.LinkType select r).ToList();

            if (list.Count > 0)
            {
                var detectEqu      = this.ConType.SelectedItem as ComboBoxItem;
                list.First().Value = detectEqu.Content.ToString();
            }
            //获取串口
            var comportList = (from r in curSubModule.Params where r.Name == RfidConfigParam.Comport select r).ToList();

            if (comportList.Count > 0)
            {
                var port = this.Comport.SelectedItem as ComboBoxItem;
                comportList.First().Value = port.Content.ToString();
            }
            //获取IP
            var ipList = (from r in curSubModule.Params where r.Name == RfidConfigParam.Ip select r).ToList();

            if (ipList.Count > 0)
            {
                ipList.First().Value = this.Ip.Text.Trim();
            }
            //获取端口
            var portList = (from r in curSubModule.Params where r.Name == RfidConfigParam.Port select r).ToList();

            if (portList.Count > 0)
            {
                if (!CommonMethod.CommonMethod.IsDataTransformSuccess(portList.First().Type, this.Port.Text.Trim()))
                {
                    MessageBox.Show(string.Format(CommonParam.Info_Input_Msg_Exption, CommonParam.Port_TextBox_Name));
                    this.Port.Focus();
                    return;
                }
                portList.First().Value = this.Port.Text.Trim();
            }
            //获取波特率
            var baudrateList = (from r in curSubModule.Params where r.Name == RfidConfigParam.Baudrate select r).ToList();

            if (baudrateList.Count > 0)
            {
                var baudrate = this.Baudrate.SelectedItem as ComboBoxItem;
                baudrateList.First().Value = baudrate.Content.ToString();
            }
            //获取寻卡时间
            var IntervalList = (from r in curSubModule.Params where r.Name == RfidConfigParam.Interval select r).ToList();

            if (IntervalList.Count > 0)
            {
                if (!CommonMethod.CommonMethod.IsDataTransformSuccess(IntervalList.First().Type, this.IntervalTextBox.Text.Trim()))
                {
                    MessageBox.Show(string.Format(CommonParam.Info_Input_Msg_Exption, IntervalList.First().Lab));
                    this.IntervalTextBox.Focus();
                    return;
                }
                IntervalList.First().Value = this.IntervalTextBox.Text.Trim();
            }
            //获取是否在用
            var isUseList = (from r in curSubModule.Params where r.Name == RfidConfigParam.IsUse select r).ToList();

            if (isUseList.Count > 0)
            {
                isUseList.First().Value = (bool)this.yesCheckBox.IsChecked ? "是" : "否";
            }
            //获取设备驱动名称
            var dllList = (from r in curSubModule.Params where r.Name == RfidConfigParam.EquDriverName select r).ToList();

            if (dllList.Count > 0)
            {
                dllList.First().Value = this.EquDll.Text.Trim();
            }
            //获取设备配置
            IList <EquConfigModel> models = this.equConfigDataGrid.ItemsSource as IList <EquConfigModel>;

            curSubModule.GridRow.RowList.Clear();
            foreach (var item in models)
            {
                if (!CommonMethod.CommonMethod.IsDataTransformSuccess("int", item.Port))
                {
                    MessageBox.Show("第" + (models.IndexOf(item) + 1) + "个天线配置信息中" + string.Format(CommonParam.Info_Input_Msg_Exption, CommonParam.Port_TextBox_Name));
                    this.equConfigDataGrid.SelectedIndex = models.IndexOf(item);
                    return;
                }

                Row row = new Row()
                {
                    Params = new List <Param>()
                };
                Param equName = new Param()
                {
                    Name  = RfidConfigParam.Row_AntennaName,
                    Value = item.EquName
                };
                Param Port = new Param()
                {
                    Name  = RfidConfigParam.Row_Port,
                    Value = item.Port
                };
                Param IsUse = new Param()
                {
                    Name  = RfidConfigParam.Row_IsUse,
                    Value = item.IsUse ? "1" : "0"
                };
                row.Params.Add(equName);
                row.Params.Add(IsUse);
                row.Params.Add(Port);
                curSubModule.GridRow.RowList.Add(row);
            }
            if (XmlHelper.WriteXmlFile <configlist>(curConfigFileName, curConfig))
            {
                MessageBox.Show("保存成功");
                // ConfigReader.ReLoadConfig();
            }
        }
Esempio n. 32
0
 // === コード(その他) ====================================
 public void SetCamera(Param cameraPara)
 {
     param = cameraPara;
 }
Esempio n. 33
0
 /// <summary>
 /// Initializes a new instance of the LogicalAndExpression class.
 /// </summary>
 /// <param name="proxy">Proxy object for the expression.</param>
 /// <param name="leftHandSide">The left hand side of the expression.</param>
 /// <param name="rightHandSide">The right hand side of the expression.</param>
 internal LogicalAndExpression(CodeUnitProxy proxy, Expression leftHandSide, Expression rightHandSide)
     : base(proxy, LogicalExpressionType.LogicalAnd, leftHandSide, rightHandSide)
 {
     Param.Ignore(proxy, leftHandSide, rightHandSide);
 }
Esempio n. 34
0
        public void TestBetweenInts()
        {
            var configuredMethod = GetConfiguredMethod <IAwesomeInterface>(a => a.ParameteredMethod(Param.IsAny <string>(), Param.IsBetween(-1000, 1000)));

            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod(null, -1001)));
            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("0", 1001)));

            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("a", 1000)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("b", 900)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("c", 2)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("dicks", 1)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("eellers", 0)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("f", -900)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("g", -1000)));

            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("h", 1050)));
            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("æabc", 10000)));
            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("hest", int.MaxValue)));
            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("lol", int.MinValue)));
            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("omfg", -102032)));
            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("trololol", 343423)));
        }
Esempio n. 35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AddSettingsPagesEventArgs"/> class.
 /// </summary>
 /// <param name="settingsPath">
 /// The path to the settings file.
 /// </param>
 internal AddSettingsPagesEventArgs(string settingsPath)
 {
     Param.AssertValidString(settingsPath, "settingsPath");
     this.settingsPath = settingsPath;
 }
Esempio n. 36
0
 /// <summary>
 /// Initializes a new instance of the OutToken class.
 /// </summary>
 /// <param name="document">The parent document.</param>
 internal OutToken(CsDocument document)
     : base(document, "out", TokenType.Out)
 {
     Param.AssertNotNull(document, "document");
 }
Esempio n. 37
0
 /// <summary>
 /// Initializes a new instance of the Namespace class.
 /// </summary>
 /// <param name="proxy">Proxy object for the namespace.</param>
 /// <param name="type">The element type.</param>
 /// <param name="name">The name of this element.</param>
 /// <param name="attributes">The list of attributes attached to this element.</param>
 /// <param name="unsafeCode">Indicates whether the element resides within a block of unsafe code.</param>
 internal Namespace(CodeUnitProxy proxy, ElementType type, string name, ICollection <Attribute> attributes, bool unsafeCode)
     : base(proxy, type, name, attributes, unsafeCode)
 {
     Param.Ignore(proxy, type, name, attributes, unsafeCode);
 }
Esempio n. 38
0
 /// <summary>
 /// Provides the end analysis result to the user.
 /// </summary>
 /// <param name="violationsResult">The violations.</param>
 protected virtual void ProvideEndAnalysisResult(List <ViolationInfo> violationsResult)
 {
     Param.Ignore(violationsResult);
 }
Esempio n. 39
0
        static private async Task <ParamRail> LoadParamRail()
        {
            FileStream fileToRead  = null;
            ParamRail  myParamRail = new ParamRail();

            try
            {
                //fileToRead = new FileStream(strDefaultDir + "\\" + strFileProgram, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                fileToRead = new FileStream(await GetFilePath(strFileProgram), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                long fileLength = fileToRead.Length;

                byte[] buf = new byte[fileLength];
                //string mySetupString = "";

                // Reads the data.
                fileToRead.Read(buf, 0, (int)fileLength);
                //await str.ReadAsync(buf,  )
                // convert the read into a string

                List <Param> Params  = Param.decryptParam(new String(Encoding.UTF8.GetChars(buf)));
                byte         mSignal = byte.MaxValue;
                byte         mSwitch = byte.MaxValue;
                byte         mTrains = byte.MaxValue;
                if (Params == null)
                {
                    return(myParamRail);
                }
                if (Params.Count == 0)
                {
                    return(myParamRail);
                }

                mSignal = Param.CheckConvertByte(Params, paramNumberSignal);
                if ((mSignal <= 0) || (mSignal > LegoTrain.Signal.NUMBER_SIGNAL_MAX))
                {
                    mSignal = LegoTrain.Signal.NUMBER_SIGNAL_MAX;
                }
                mSwitch = Param.CheckConvertByte(Params, paramNumberSwitch);
                if ((mSwitch <= 0) || (mSwitch > LegoTrain.Switch.NUMBER_SWITCH_MAX))
                {
                    mSwitch = LegoTrain.Switch.NUMBER_SWITCH_MAX;
                }
                mTrains = Param.CheckConvertByte(Params, paramNumberTrain);
                if ((mTrains <= 0) || (mTrains > ParamTrain.NUMBER_TRAIN_MAX))
                {
                    mTrains = ParamTrain.NUMBER_TRAIN_MAX;
                }

                myParamRail.Serial      = Param.CheckConvertBool(Params, paramSerial);
                myParamRail.WebServer   = Param.CheckConvertBool(Params, paramWeb);
                myParamRail.SecurityKey = Param.CheckConvertString(Params, paramSecurity);
                myParamRail.MinDuration = Param.CheckConvertUInt16(Params, paramSwitchMinDur);
                myParamRail.MaxDuration = Param.CheckConvertUInt16(Params, paramSwitchMaxDur);
                myParamRail.MinAngle    = Param.CheckConvertUInt16(Params, paramSwitchMinAng);
                myParamRail.MaxAngle    = Param.CheckConvertUInt16(Params, paramSwitchMaxAng);
                myParamRail.ServoAngle  = Param.CheckConvertUInt16(Params, paramSwitchAngle);

                //now load the params for the trains
                if (mTrains != 255)
                {
                    myParamRail.NumberOfTrains = mTrains;
                    myParamRail.Trains         = new ParamTrain[mTrains];
                    for (byte a = 1; a <= mTrains; a++)
                    {
                        myParamRail.Trains[a - 1] = new ParamTrain();
                        byte mChannel = Param.CheckConvertByte(Params, paramParamChannel + a.ToString());
                        if (mChannel > 4)
                        {
                            mChannel = 4;
                        }
                        byte mRedBlue = Param.CheckConvertByte(Params, paramRedBlue + a.ToString());
                        if (mRedBlue > 1)
                        {
                            mRedBlue = 0;
                        }
                        byte mSpeed = Param.CheckConvertByte(Params, paramTrainSpeed + a.ToString());
                        if (mSpeed > 7)
                        {
                            mSpeed = 0;
                        }
                        myParamRail.Trains[a - 1].TrainName = Param.CheckConvertString(Params, paramTrainName + a.ToString());

                        myParamRail.Trains[a - 1].Channel = mChannel;
                        myParamRail.Trains[a - 1].RedBlue = (ParamTrainRedBlue)mRedBlue;
                        myParamRail.Trains[a - 1].Speed   = mSpeed;
                    }
                }

                if (mSignal != 255)
                {
                    myParamRail.NumberOfSignals = mSignal;
                    myParamRail.Signals         = new ParamSignal[mSignal];
                    for (byte a = 1; a <= mSignal; a++)
                    {
                        myParamRail.Signals[a - 1] = new ParamSignal();
                        string mName = Param.CheckConvertString(Params, paramNameSignal + a.ToString());
                        if (mName == "")
                        {
                            mName = "Signal " + a.ToString();
                        }
                        myParamRail.Signals[a - 1].Name = mName;
                        myParamRail.Signals[a - 1].Left = Param.CheckConvertInt32(Params, paramSignalleft + a.ToString());
                        myParamRail.Signals[a - 1].Top  = Param.CheckConvertInt32(Params, paramSignaltop + a.ToString());
                    }
                }
                if (mSwitch != 255)
                {
                    myParamRail.NumberOfSwitchs = mSwitch;
                    myParamRail.Switchs         = new ParamSwitchs[mSwitch];
                    for (byte a = 1; a <= mSwitch; a++)
                    {
                        myParamRail.Switchs[a - 1] = new ParamSwitchs();
                        string mName = Param.CheckConvertString(Params, paramNameSwitch + a.ToString());
                        if (mName == "")
                        {
                            mName = "Switch " + a.ToString();
                        }
                        myParamRail.Switchs[a - 1].Name = mName;
                        myParamRail.Switchs[a - 1].Left = Param.CheckConvertInt32(Params, paramleft + a.ToString());
                        myParamRail.Switchs[a - 1].Top  = Param.CheckConvertInt32(Params, paramtop + a.ToString());
                    }
                }
            }
            catch (Exception e)
            {
                if (fileToRead != null)
                {
                    fileToRead.Dispose();
                }
            }
            return(myParamRail);
        }
Esempio n. 40
0
        public void TestBetweenStrings()
        {
            Assert.Inconclusive(); //This test, while being valid needs to be addressed better. String Comparisation is subject to all sorts of localization matters.
            var configuredMethod = GetConfiguredMethod <IAwesomeInterface>(a => a.ParameteredMethod(Param.IsBetween("a", "g"), Param.IsAny <int>()));

            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("9", 0)));
            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("0", 1)));

            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("a", 3)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("b", 4)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("c", 2)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("dicks", 1)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("eellers", 0)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("f", 0)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("g", 0)));

            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("h", 0)));
            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("æabc", 0)));
            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("hest", 0)));
            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("lol", 0)));
            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("omfg", 0)));
            Assert.IsFalse(configuredMethod.IsMatch(a => a.ParameteredMethod("trololol", 0)));
        }
Esempio n. 41
0
 /// <summary>
 /// Creates a new <see cref="CodeFile"/> instance with the given values.
 /// </summary>
 /// <param name="path">
 /// The path to the code file.
 /// </param>
 /// <param name="project">
 /// The project that contains this file.
 /// </param>
 /// <param name="parser">
 /// The parser that created this file object.
 /// </param>
 /// <param name="context">
 /// Optional context information.
 /// </param>
 /// <returns>
 /// Returns the newly created <see cref="CodeFile"/>.
 /// </returns>
 protected virtual CodeFile CreateCodeFile(string path, CodeProject project, SourceParser parser, object context)
 {
     Param.Ignore(path, project, parser, context);
     return(new CodeFile(path, project, parser));
 }
Esempio n. 42
0
        /// <summary>
        /// Initializes a new instance of the UpdateSolutionListener class.
        /// </summary>
        /// <param name="serviceProvider">The system service provider.</param>
        internal UpdateSolutionListener(IServiceProvider serviceProvider)
        {
            Param.AssertNotNull(serviceProvider, "serviceProvider");

            this.serviceProvider = serviceProvider;
        }
Esempio n. 43
0
        /// <summary>
        /// Method is not implemented.
        /// </summary>
        /// <param name="cancelUpdate">The parameter is not used.</param>
        /// <returns>Returns E_NOTIMPL.</returns>
        public int UpdateSolution_Begin(ref int cancelUpdate)
        {
            Param.Ignore(cancelUpdate);

            return(VSConstants.E_NOTIMPL);
        }
Esempio n. 44
0
        /// <summary>
        /// Method is not implemented.
        /// </summary>
        /// <param name="succeeded">The parameter is not used.</param>
        /// <param name="modified">The parameter is not used.</param>
        /// <param name="cancelCommand">The parameter is not used.</param>
        /// <returns>Returns E_NOTIMPL.</returns>
        public int UpdateSolution_Done(int succeeded, int modified, int cancelCommand)
        {
            Param.Ignore(succeeded, modified, cancelCommand);

            return(VSConstants.E_NOTIMPL);
        }
Esempio n. 45
0
 /// <summary>
 /// Determines whether the two items are equal.
 /// </summary>
 /// <param name="item1">The first item.</param>
 /// <param name="item2">The second item.</param>
 /// <returns>Returns true if the items are equal.</returns>
 public static bool operator ==(QueryOrderByOrdering item1, QueryOrderByOrdering item2)
 {
     Param.Ignore(item1, item2);
     return(item1.Expression == item2.Expression && item1.Direction == item2.Direction);
 }
Esempio n. 46
0
    //関数: private WriteMessage()
    //  説明:
    //      メッセージの描画処理を行います
    //      コンポーネント"Text"内のメンバー変数"Text"に文字列を格納します
    private void WriteMessage()
    {
        bool textBoxSwitch = false;

        string centerText      = "";
        string textBoxText     = "";
        string topText         = "";
        string bottomText      = "";
        string topLeftText     = "";
        string bottomRightText = "";

        //各メッセージを処理
        for (int i = 0; i < messageList.Count; i++)
        {
            string text = "";

            ParamPrivate paramPrivate = messageList[i].paramPrivate;
            Param        param        = messageList[i].param;

            //メッセージ内容代入
            if (paramPrivate.activated)
            {
                if (messageList[i].paramPrivate.isPlaying)
                {
                    int transparencyInt = (int)paramPrivate.transparency;
                    text += "<color=#" + param.color + "{a}" + ">";
                    text += paramPrivate.text;
                    text += "</color>\n";
                    text  = text.Replace("{a}", transparencyInt.ToString("X2"));

                    if (paramPrivate.messageType == MESSAGE_TYPE.BOX)
                    {
                        textBoxSwitch = true;
                    }
                }
            }

            //各描画位置へメッセージを代入
            switch (paramPrivate.messageType)
            {
            case MESSAGE_TYPE.CENTER:
                centerText += text;
                break;

            case MESSAGE_TYPE.BOX:
                textBoxText += text;
                break;

            case MESSAGE_TYPE.TOP:
                topText += text;
                break;

            case MESSAGE_TYPE.BOTTOM:
                bottomText += text;
                break;

            case MESSAGE_TYPE.TOP_LEFT:
                topLeftText += text;
                break;

            case MESSAGE_TYPE.BOTTOM_RIGHT:
                bottomRightText += text;
                break;
            }
        }

        //テキストボックス表示,非表示設定
        if (textBoxSwitch ^ textBoxObj.activeSelf)
        {
            textBoxObj.SetActive(textBoxSwitch);
        }

        //コンポーネント"Text"に文字列を格納
        centerTextText.text      = centerText;
        textBoxTextText.text     = textBoxText;
        topTextText.text         = topText;
        bottomTextText.text      = bottomText;
        topLeftTextText.text     = topLeftText;
        bottomRightTextText.text = bottomRightText;
    }
Esempio n. 47
0
        public static Param[] decryptParam(String Parameters)
        {
            Param[] retParams = null;
            int     i         = Parameters.IndexOf(ParamStart);
            int     j         = i;
            int     k;

            if (i >= 0)
            {
                //look at the number of = and ;

                while ((i < Parameters.Length) || (i == -1))
                {
                    j = Parameters.IndexOf(ParamEqual, i);
                    if (j > i)
                    {
                        //first param!
                        if (retParams == null)
                        {
                            retParams    = new Param[1];
                            retParams[0] = new Param();
                        }
                        else
                        {
                            Param[] rettempParams = new Param[retParams.Length + 1];
                            retParams.CopyTo(rettempParams, 0);
                            rettempParams[rettempParams.Length - 1] = new Param();
                            retParams = new Param[rettempParams.Length];
                            rettempParams.CopyTo(retParams, 0);
                        }
                        k = Parameters.IndexOf(ParamSeparator, j);
                        retParams[retParams.Length - 1].Name = Parameters.Substring(i + 1, j - i - 1);
                        //case'est la fin et il n'y a rien
                        if (k == j)
                        {
                            retParams[retParams.Length - 1].Value = "";
                        } // cas normal
                        else if (k > j)
                        {
                            retParams[retParams.Length - 1].Value = Parameters.Substring(j + 1, k - j - 1);
                        } //c'est la fin
                        else
                        {
                            retParams[retParams.Length - 1].Value = Parameters.Substring(j + 1, Parameters.Length - j - 1);
                        }
                        if (k > 0)
                        {
                            i = Parameters.IndexOf(ParamSeparator, k);
                        }
                        else
                        {
                            i = Parameters.Length;
                        }
                    }
                    else
                    {
                        i = -1;
                    }
                }
            }
            return(retParams);
        }
Esempio n. 48
0
        /// <summary>
        /// Method is not implemented.
        /// </summary>
        /// <param name="hierarchy">The parameter is not used.</param>
        /// <returns>Returns E_NOTIMPL.</returns>
        public int OnActiveProjectCfgChange(IVsHierarchy hierarchy)
        {
            Param.Ignore(hierarchy);

            return(VSConstants.E_NOTIMPL);
        }
Esempio n. 49
0
 /// <summary>
 /// Initializes a new instance of the ParameterList class.
 /// </summary>
 /// <param name="proxy">The proxy class.</param>
 internal ParameterList(CodeUnitProxy proxy)
     : base(proxy, CodeUnitType.ParameterList)
 {
     Param.AssertNotNull(proxy, "proxy");
 }
Esempio n. 50
0
 /// <summary>
 /// Initializes a new instance of the DereferenceExpression class.
 /// </summary>
 /// <param name="proxy">Proxy object for the expression.</param>
 /// <param name="value">The value the operator is being applied to.</param>
 internal DereferenceExpression(CodeUnitProxy proxy, Expression value)
     : base(proxy, UnsafeAccessExpressionType.Dereference, value)
 {
     Param.Ignore(proxy, value);
 }
Esempio n. 51
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //日志
        StringBuilder sbLog = new StringBuilder();

        try
        {
            Param pm = GetReuest(sbLog);
            if (pm.Msg == "")
            {
                string                UseCpyNo = string.Empty;
                BaseDataManage        Manage   = new BaseDataManage();
                string                sqlWhere = string.Format(" LoginName='{0}'  ", pm.LoginName);
                List <User_Employees> empList  = Manage.CallMethod("User_Employees", "GetList", null, new object[] { sqlWhere }) as List <User_Employees>;
                if (empList != null && empList.Count > 0)
                {
                    User_Employees m_UserEmployees = empList[0];
                    UseCpyNo = m_UserEmployees.CpyNo;
                    User_Company m_UserCompany = null;
                    sqlWhere = string.Format(" UninAllName='{0}' and UninCode='{1}'", pm.CompanyName, m_UserEmployees.CpyNo);
                    List <User_Company> comList = Manage.CallMethod("User_Company", "GetList", null, new object[] { sqlWhere }) as List <User_Company>;
                    if (comList != null && comList.Count > 0)
                    {
                        m_UserCompany = comList[0];
                        UseCpyNo      = m_UserCompany.UninCode;
                    }
                }
                sqlWhere = string.Format(" TripNum='{0}' and UseCpyNo='{1}' ", pm.TripNo, UseCpyNo);
                List <Tb_TripDistribution> TripList = Manage.CallMethod("Tb_TripDistribution", "GetList", null, new object[] { sqlWhere }) as List <Tb_TripDistribution>;
                if (TripList != null && TripList.Count > 0)
                {
                    List <string> sqlList = new List <string>();
                    if (pm.OpType == "create")
                    {
                        //创建成功
                        sqlList.Add(string.Format(" update Tb_TripDistribution set TripStatus=9,TicketNum='{0}' where TripNum='{1}' and id='{2}' ", pm.TicketNo, pm.TripNo, TripList[0].id.ToString()));
                    }
                    else if (pm.OpType == "void")
                    {
                        //作废成功
                        sqlList.Add(string.Format(" update Tb_TripDistribution set TripStatus=6 where TripNum='{0}' and id='{1}' ", pm.TripNo, TripList[0].id.ToString()));
                    }
                    if (sqlList.Count > 0)
                    {
                        string err = "";
                        if (Manage.ExecuteSqlTran(sqlList, out err))
                        {
                            sbLog.Append("时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss") + " 公司编号:" + UseCpyNo + "  行程单号:" + pm.TripNo + "同步成功!\r\n\r\n");
                        }
                        else
                        {
                            sbLog.Append("时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss") + " 公司编号:" + UseCpyNo + " 行程单号:" + pm.TripNo + "同步失败!\r\n\r\n");
                        }
                    }
                }
                else
                {
                    sbLog.Append("时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss") + " 公司编号:" + UseCpyNo + " 行程单号:" + pm.TripNo + " 不存在!\r\n\r\n");
                }
            }
            else
            {
                sbLog.Append("时间:" + System.DateTime.Now.ToString("yyy-MM-dd HH:mm:ss") + " " + pm.Msg + "\r\n\r\n");
            }
        }
        catch (Exception ex)
        {
            sbLog.Append("异常:" + ex.Message);
        }
        finally
        {
            PnrAnalysis.LogText.LogWrite(sbLog.ToString(), "TongBuTrip");
        }
    }
Esempio n. 52
0
        /// <summary>
        /// Walks the element declaration and gathers the element modifiers.
        /// </summary>
        /// <param name="allowedModifiers">The modifiers which are allowed for the current element type.</param>
        private void GatherDeclarationModifiers(IEnumerable <string> allowedModifiers)
        {
            Param.Ignore(allowedModifiers);

            this.modifiers.Value = new Dictionary <TokenType, Token>();
            Token accessModifierSeen = null;

            this.accessModifier.Value = this.DefaultAccessModifierType;

            for (Token token = this.FirstDeclarationToken; token != null; token = token.FindNextSiblingToken())
            {
                if (token.TokenType == TokenType.Public)
                {
                    // A public access modifier can only be specified if there have been no other access modifiers.
                    if (accessModifierSeen != null)
                    {
                        throw new SyntaxException(this.Document, token.LineNumber);
                    }

                    this.accessModifier.Value = AccessModifierType.Public;
                    accessModifierSeen        = token;
                    this.modifiers.Value.Add(TokenType.Public, token);
                }
                else if (token.TokenType == TokenType.Private)
                {
                    // A private access modifier can only be specified if there have been no other access modifiers.
                    if (accessModifierSeen != null)
                    {
                        throw new SyntaxException(this.Document, token.LineNumber);
                    }

                    this.accessModifier.Value = AccessModifierType.Private;
                    accessModifierSeen        = token;
                    this.modifiers.Value.Add(TokenType.Private, token);
                }
                else if (token.TokenType == TokenType.Internal)
                {
                    // The access is internal unless we have already seen a protected access
                    // modifier, in which case it is protected internal.
                    if (accessModifierSeen == null)
                    {
                        this.accessModifier.Value = AccessModifierType.Internal;
                    }
                    else if (accessModifierSeen.TokenType == TokenType.Protected)
                    {
                        this.accessModifier.Value = AccessModifierType.ProtectedInternal;
                    }
                    else
                    {
                        throw new SyntaxException(this.Document, token.LineNumber);
                    }

                    accessModifierSeen = token;
                    this.modifiers.Value.Add(TokenType.Internal, token);
                }
                else if (token.TokenType == TokenType.Protected)
                {
                    // The access is protected unless we have already seen an internal access
                    // modifier, in which case it is protected internal.
                    if (accessModifierSeen == null)
                    {
                        this.accessModifier.Value = AccessModifierType.Protected;
                    }
                    else if (accessModifierSeen.TokenType == TokenType.Internal)
                    {
                        this.accessModifier.Value = AccessModifierType.ProtectedInternal;
                    }
                    else
                    {
                        throw new SyntaxException(this.Document, token.LineNumber);
                    }

                    accessModifierSeen = token;
                    this.modifiers.Value.Add(TokenType.Protected, token);
                }
                else
                {
                    if (!GetOtherElementModifier(allowedModifiers, this.modifiers.Value, token))
                    {
                        break;
                    }
                }
            }
        }
Esempio n. 53
0
    public Param GetReuest(StringBuilder sbLog)
    {
        Param pm = new Param();
        NameValueCollection NC = HttpContext.Current.Request.Form;

        sbLog.Append("\r\n\r\n行程单同步数据参数:\r\n");
        string Val = "";

        foreach (string key in NC.Keys)
        {
            Val = HttpUtility.UrlDecode(NC[key]);
            sbLog.Append(key + "=" + Val + "\r\n");
            switch (key)
            {
            case "OpType":
            {
                pm.OpType = Val;
                if (string.IsNullOrEmpty(pm.OpType.Trim()))
                {
                    pm.Msg = "操作类型不能为空!";
                }
                break;
            }

            case "LoginName":
            {
                pm.LoginName = Val;
                if (string.IsNullOrEmpty(pm.LoginName.Trim()))
                {
                    pm.Msg = "登录账号不能为空!";
                }
                break;
            }

            case "CompanyName":
            {
                pm.CompanyName = Val;
                if (string.IsNullOrEmpty(pm.CompanyName.Trim()))
                {
                    pm.Msg = "公司名称不能为空!";
                }
                break;
            }

            case "TicketNo":
            {
                pm.TicketNo = Val;
                if (string.IsNullOrEmpty(pm.TicketNo.Trim()))
                {
                    pm.Msg = "票号不能为空!";
                }
                break;
            }

            case "TripNo":
            {
                pm.TripNo = Val;
                if (string.IsNullOrEmpty(pm.TripNo.Trim()))
                {
                    pm.Msg = "行程单号不能为空!";
                }
                break;
            }

            case "Pnr":
            {
                pm.Pnr = Val;
                break;
            }

            case "Office":
            {
                pm.Office = Val;
                break;
            }

            default:
                break;
            }
        }
        return(pm);
    }
Esempio n. 54
0
 public Fan(string nameDev, bool stateDev, byte speedFan)
     : base(nameDev, stateDev)
 {
     Speed = new Param(speedFan, 1, 5);
 }
Esempio n. 55
0
        public void TestBetweenDateTimeExacts()
        {
            var configuredMethod = GetConfiguredMethod <IAwesomeInterface>(a => a.DatedMethod(100, Param.IsBetween(DateTime.Now.AddHours(-2), DateTime.Now)));

            Thread.Sleep(2000);
            Assert.IsFalse(configuredMethod.IsMatch(a => a.DatedMethod(100, DateTime.Now)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.DatedMethod(100, DateTime.Now.AddSeconds(-100))));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.DatedMethod(100, DateTime.Now.AddSeconds(-1000))));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.DatedMethod(100, DateTime.Now.AddHours(-1))));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.DatedMethod(100, DateTime.Now.AddHours(-2).AddSeconds(-1))));
            Assert.IsFalse(configuredMethod.IsMatch(a => a.DatedMethod(100, DateTime.Now.AddHours(-2).AddSeconds(-4))));
        }
Esempio n. 56
0
 public abstract void Apply(Param param);
 public ExcelIntegrator(Param param)
 {
     this.param = param;
 }
Esempio n. 58
0
        /// <summary>
        /// Called when a violation is found.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void CoreViolationEncountered(object sender, ViolationEventArgs e)
        {
            Param.AssertNotNull(e, "e");
            Param.Ignore(sender);

            // Make sure this is running on the main thread.
            if (InvisibleForm.Instance.InvokeRequired)
            {
                EventHandler <ViolationEventArgs> violationDelegate = this.CoreViolationEncountered;
                InvisibleForm.Instance.Invoke(violationDelegate, sender, e);
            }
            else
            {
                // Check the violation only occured in the file we were analysing (or we were analysing a solution/project/folder)
                var sourceCodePath   = e.SourceCode.Path;
                var documentFullName = this.analysisFilePath;

                if ((this.analysisType == AnalysisType.File && sourceCodePath.Equals(documentFullName, StringComparison.OrdinalIgnoreCase)) ||
                    this.analysisType == AnalysisType.Folder || this.analysisType == AnalysisType.Project || this.analysisType == AnalysisType.Solution ||
                    this.analysisType == AnalysisType.Item)
                {
                    if (!e.Warning)
                    {
                        ++this.violationCount;
                    }

                    // Check the count. At some point we don't allow any more violations so we cancel the analyze run.
                    if (e.SourceCode.Project.MaxViolationCount > 0 && this.violationCount == e.SourceCode.Project.MaxViolationCount)
                    {
                        this.Cancel();
                    }

                    var element       = e.Element;
                    var violationInfo = new ViolationInfo();

                    violationInfo.Severity = e.SourceCode.Project.ViolationsAsErrors ? TaskErrorCategory.Error : TaskErrorCategory.Warning;

                    var trimmedNamespace = e.Violation.Rule.Namespace.SubstringAfter("StyleCop.", StringComparison.Ordinal);
                    trimmedNamespace = trimmedNamespace.SubstringBeforeLast("Rules", StringComparison.Ordinal);

                    violationInfo.Description = string.Concat(e.Violation.Rule.CheckId, " : ", trimmedNamespace, " : ", e.Message);
                    violationInfo.LineNumber  = e.LineNumber;

                    violationInfo.ColumnNumber = e.Location != null ? e.Location.Value.StartPoint.IndexOnLine : 1;

                    violationInfo.Rule = e.Violation.Rule;

                    if (element != null)
                    {
                        violationInfo.File = element.Document.SourceCode.Path;
                    }
                    else
                    {
                        string file = string.Empty;
                        if (e.SourceCode != null)
                        {
                            file = e.SourceCode.Path;
                        }

                        violationInfo.File = file;
                    }

                    this.violations.Add(violationInfo);
                }
            }
        }
Esempio n. 59
0
        public void TestIsAny()
        {
            var methodCachePolicy = new CachePolicy();
            var configuredMethod  = GetConfiguredMethod <IAwesomeInterface>(a => a.ParameteredMethod(Param.IsAny <string>(), Param.IsAny <int>()));

            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("", 0)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod(string.Empty, 123)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("asdfasdf", -1000)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("435wasg", int.MaxValue)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("q435owiderfglæhw354t", int.MinValue)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("sdfhgert", 4654543)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("asdfzxbsergt", 593487348)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("asdfzxbsergt", -45345423)));
            Assert.IsTrue(configuredMethod.IsMatch(a => a.ParameteredMethod("asdf3", 989899)));
        }
Esempio n. 60
-1
		private void AddElementToDataGridView(Param element)
		{
			var row = new DataGridViewRow();
			
			// пустая сточка означет разделитель между 
			// отдельными интерфейсами
			if(element.ParamName == string.Empty)
			{
				dataGridView1.Rows.Add(row);
				return;	
			}
			
			// добавляем первую ячейку
			var cell1 = new DataGridViewTextBoxCell() 
			{
			    Value = element.ParamName + ":"
			};
			cell1.Style.Font = new Font(dataGridView1.Font, FontStyle.Bold);
			row.Cells.Add(cell1);
			
			// добавляем вторую ячейку
			var cell2 = new DataGridViewTextBoxCell() 
			{
			    Value = element.ParamValue
			};
			row.Cells.Add(cell2);

			// добавляем строчку в dataGridView
			dataGridView1.Rows.Add(row);
		}