Example #1
0
 public void AssemblyNameWithDots()
 {
     ClassName name = new ClassName("Some.Qualified.Name, Some.Assembly.With.Dots");
     Assert.AreEqual("Some.Qualified.Name", name.FullyQualifiedName);
     Assert.AreEqual("Some.Qualified", name.PackageName);
     Assert.AreEqual("Name", name.Name);
 }
Example #2
0
        public override int GetHashCode()
        {
            //Recommended approach in effective java book and java and android docs
            int result = 17;

            result = result * 31 + ClassName.GetHashCode();
            result = result * 31 + FunctionName.GetHashCode();
            result = result * 31 + FunctionType.GetHashCode();
            return(result);
        }
Example #3
0
 public ActionResult Edit([Bind(Include = "ID,Name")] ClassName className)
 {
     if (ModelState.IsValid)
     {
         db.Entry(className).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(className));
 }
Example #4
0
 public void Update(ClassName blog)
 {
     using (var db = new ClassContext())
     {
         //修改博客实体状态
         db.Entry(blog).State = EntityState.Modified;
         //保存状态
         db.SaveChanges();
     }
 }
Example #5
0
        public override int GetHashCode()
        {
            var hashCode = 1022390368;

            hashCode = hashCode * -1521134295 + Id.GetHashCode();
            hashCode = hashCode * -1521134295 + DisplayName.GetHashCode();
            hashCode = hashCode * -1521134295 + EntityType.GetHashCode();
            hashCode = hashCode * -1521134295 + ClassName.GetHashCode();
            return(hashCode);
        }
Example #6
0
    // Start is called before the first frame update
    void Start()
    {
        nextChangeColorClick = color.clickCount;
        StartCoroutine(ChangeColor());

        json = File.ReadAllText("Assets/Names.json");
        ClassName name = JsonUtility.FromJson <ClassName>(json);

        objectName = name.Name[Random.Range(0, name.Name.Length)];
    }
        protected override Condition CreateCondition()
        {
            var dataGridDetailsPresenter = ClassName.Is("DataGridDetailsPresenter") & Parent(DataItem);

            return(Custom
                   & IsKeyboardFocusable
                   & LocalizedControlType.NotNullOrEmpty
                   & ~dataGridDetailsPresenter
                   & ~ElementGroups.WPFDataGridCell);
        }
Example #8
0
        //删除
        static void Delete()
        {
            BloBussinessLayer bbl = new BloBussinessLayer();

            Console.WriteLine("请输入id");
            int       id = int.Parse(Console.ReadLine());
            ClassName CN = bbl.Query(id);

            bbl.Delete(CN);
        }
Example #9
0
        /// <summary>
        /// Compares this <see cref="Entity"/> to another <see cref="Entity"/>. First "classname" attributes are compared, then "targetname".
        /// Attributes are compared alphabetically. Targetnames are only compared if classnames match.
        /// </summary>
        /// <param name="other"><see cref="Entity"/> to compare to.</param>
        /// <returns>Less than zero if this entity is first, 0 if they occur at the same time, greater than zero otherwise.</returns>
        public int CompareTo(Entity other)
        {
            if (other == null)
            {
                return(1);
            }
            int comparison = ClassName.CompareTo(other.ClassName);

            return(comparison != 0 ? comparison : Name.CompareTo(other.Name));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="modelNamespace"></param>
        /// <param name="outputDirectory"></param>
        /// <param name="generateCustomFields">eg, TSA fields</param>
        public void GenerateModelsCode(string modelNamespace, string outputDirectory, bool generateCustomFields, bool generateUDC = false)
        {
            #region validate input

            if (modelNamespace == null || modelNamespace.Trim().Length == 0)
            {
                throw new PepperiException("Invalid argument. The model namespace can not be empty.");
            }

            bool directoryExists = Directory.Exists(outputDirectory);
            if (directoryExists == false)
            {
                throw new PepperiException("The directory " + outputDirectory == null ? "null" : outputDirectory + "does not exist.");
            }

            #endregion

            #region Generate Code

            Dictionary <string, string> fileName_To_ClassCode = new Dictionary <string, string>();


            foreach (eModelClassName ClassName in Enum.GetValues(typeof(eModelClassName)))
            {
                IEnumerable <Field_MetaData> Fields_MetaData = GetFieldsMetadataByClassName(ClassName);
                List <string> HardCodedFields   = ModelClassNameToHardCodedFields[ClassName];
                string        ClassNameAsString = ClassName.ToString();
                string        ClassCode         = GenerateClassCode(modelNamespace, ClassNameAsString, Fields_MetaData, HardCodedFields, generateCustomFields);
                string        FileName          = ClassNameAsString + ".cs";
                fileName_To_ClassCode.Add(FileName, ClassCode);
            }

            #region User Defined Collections

            if (generateUDC)
            {
                var userDefinedCollectionsCode = GenerateCodeForUserDefinedCollections(modelNamespace);
                fileName_To_ClassCode.Add("UserDefinedCollections.cs", userDefinedCollectionsCode);
            }

            #endregion


            #endregion

            #region Save Files

            foreach (string fileName in fileName_To_ClassCode.Keys)
            {
                string classCode = fileName_To_ClassCode[fileName];
                SaveFile(outputDirectory, classCode, fileName);
            }

            #endregion
        }
Example #11
0
        public ExportEntry(IMEPackage file, Stream stream)
        {
            FileRef          = file;
            OriginalDataSize = 0;
            HeaderOffset     = (uint)stream.Position;
            switch (file.Game)
            {
            case MEGame.ME1:
            case MEGame.ME2:
            {
                long start = stream.Position;
                stream.Seek(40, SeekOrigin.Current);
                int count = stream.ReadInt32();
                stream.Seek(4 + count * 12, SeekOrigin.Current);
                count = stream.ReadInt32();
                stream.Seek(16, SeekOrigin.Current);
                stream.Seek(4 + count * 4, SeekOrigin.Current);
                long end = stream.Position;
                stream.Seek(start, SeekOrigin.Begin);

                //read header
                _header = stream.ReadToBuffer((int)(end - start));
                break;
            }

            case MEGame.ME3:
            case MEGame.UDK:
            {
                stream.Seek(44, SeekOrigin.Current);
                int count = stream.ReadInt32();
                stream.Seek(-48, SeekOrigin.Current);

                int expInfoSize = 68 + (count * 4);
                _header = stream.ReadToBuffer(expInfoSize);
                break;
            }

            default:
                throw new ArgumentOutOfRangeException();
            }
            OriginalDataSize = DataSize;
            long headerEnd = stream.Position;

            stream.Seek(DataOffset, SeekOrigin.Begin);
            _data = stream.ReadToBuffer(DataSize);
            stream.Seek(headerEnd, SeekOrigin.Begin);
            if (file.Game == MEGame.ME1 && ClassName.Contains("Property") || file.Game != MEGame.ME1 && HasStack)
            {
                ReadsFromConfig = _data.Length > 25 && (_data[25] & 64) != 0;
            }
            else
            {
                ReadsFromConfig = false;
            }
        }
Example #12
0
        private static Condition CreateUnfocusableControlsBasedOnExplorerCondition()
        {
            var IsDirectUIFramework = StringProperties.Framework.Is("DirectUI");

            // Based on Win10 Explorer behavior, these exclusions are made.
            return((Button & ClassName.Is("UIExpandoButton") & IsDirectUIFramework)
                   | (SplitButton & ~IsKeyboardFocusable & SecondChild & Parent(Group) & (SiblingCount() == 2) & SiblingsOfSameType)
                   | (Edit & Patterns.ValueReadOnly)
                   | (Edit & ClassName.Is("UIProperty") & IsDirectUIFramework)
                   | (Button & Parent(SplitButton) & IsDirectUIFramework & AutomationID.Is("Dropdown")));
        }
Example #13
0
 /// <summary>
 /// Initializes a new instance of the <b>DialogComponentBase</b> class with default settings.
 /// </summary>
 public DialogComponentBase()
 {
     if (BaseName.EndsWith("Component"))
     {
         BaseName = ClassName.Remove(ClassName.IndexOf("Component"));
     }
     if (BaseName.EndsWith("Control"))
     {
         BaseName = ClassName.Remove(ClassName.IndexOf("Control"));
     }
 }
Example #14
0
        /// <summary>
        /// Returns a list of indexes of rows containing the supplied text <code>text</code>
        /// at column <code>colIdx</code>.
        /// </summary>
        /// <param name="colIdx"> Index of column from 0, that should contain the text </param>
        /// <param name="text"> Text to search for </param>
        /// <returns>The a list of row indexes containing the text.</returns>
        public virtual IList <long?> GetRowIndexesForCellText(long colIdx, string text)
        {
            string cellPath;

            if (ClassName.Equals("qx.ui.treevirtual.TreeVirtual"))
            {
                // Hierarchy:
                // * TreeVirtual div (content element)
                //   * composite div
                //     * scroller div (tree column)
                //       * composite div (for header)
                //       * clipper div
                //         * pane div
                //           * anonymous div
                //             * row div
                //               * div.qooxdoo-table-cell
                //     * scroller (other columns)
                //       * clipper div
                //         * pane div
                //           * anonymous div
                //             * row div
                //               * div.qooxdoo-table-cell
                //
                // TODO: handle meta columns: this code assumes [1, -1] for metaColumnCounts
                //System.out.println(this.getPropertyValueAsJson("metaColumnCounts"));
                if (colIdx == 0)
                {
                    cellPath = "./div[1]/div[1]/div[2]//div[contains(@class, 'qooxdoo-table-cell')]";
                }
                else
                {
                    cellPath = "./div[1]/div[2]/div[2]//div[contains(@class, 'qooxdoo-table-cell') and position() = " +
                               colIdx + "]";
                }
            }
            else
            {
                cellPath = ".//div[contains(@class, 'qooxdoo-table-cell') and position() = " + (colIdx + 1) + "]";
            }

            IList <IWebElement> els     = FindElements(OpenQA.Selenium.By.XPath(cellPath));
            IList <long?>       rowIdxs = new List <long?>();

            for (int rowIdx = 0; rowIdx < els.Count; rowIdx++)
            {
                string s = els[rowIdx].Text.Trim();
                if (text.Equals(s))
                {
                    rowIdxs.Add((long)rowIdx);
                }
            }

            return(rowIdxs);
        }
Example #15
0
        //增加--交互
        static void createClassName()
        {
            Console.WriteLine("请输入一个班级名称");
            string    name = Console.ReadLine();
            ClassName CN   = new ClassName();

            CN.Name = name;
            StuBussinessLayer bbl = new StuBussinessLayer();

            bbl.Add(CN);
        }
Example #16
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (AssemblyName != null ? AssemblyName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (NameSpace != null ? NameSpace.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ClassName != null ? ClassName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MethodName != null ? MethodName.GetHashCode() : 0);
         return(hashCode);
     }
 }
Example #17
0
 public ClassDeclarationListener(
     string parentFileName,
     string packageFqn,
     AccessFlags modifier,
     ClassName outerClass = null)
 {
     this.parentFileName = parentFileName;
     this.packageFqn     = packageFqn;
     this.modifier       = modifier;
     this.outerClass     = outerClass;
 }
Example #18
0
        private void  InsertAClass(Object sender, EventArgs e)
        {
            addingNewClass        = true;
            MergeCheckBox.Checked = false;
            PicesClass newSelectedClass = new PicesClass("", selectedClass);

            selectedClass = newSelectedClass;
            EnableAllFields();
            PopulateClassMaintenancePanel(selectedClass);
            ClassName.Focus();
        } /* InsertAClass */
        private void DoClient(TcpClient socket)
        {
            //ClassName classNameXml = new ClassName("XmlText", "XmlText", 33, "XmlText", 11);
            ClassName classNameJson = new ClassName("JsonText", "JsonText", 33, "JsonText", 11);



            using (NetworkStream stream = socket.GetStream())

                using (StreamReader sr = new StreamReader(stream))
                    using (StreamWriter toServer = new StreamWriter(stream))
                    {
                        ////Kode til plain
                        //string strFromClient = fromClient.ReadLine();
                        //Console.WriteLine($"From Client text : {strFromClient}");

                        ////output fra server.
                        //toClient.WriteLine(strFromClient.ToUpper());


                        //// Kode til xml hvor server siden deserialiserer xml til almindelig texk i server consol.
                        //XmlSerializer serializer = new XmlSerializer(typeof(ClassName));

                        //ClassName classCopy = (ClassName)serializer.Deserialize(sr);
                        //Console.WriteLine($"From Client as ClassName object : {classCopy}");


                        ////Kode til xml hvor server serialiserer til xml og clienten deserialiserer til normal text i consol.
                        //XmlSerializer serializer = new XmlSerializer(typeof(ClassName));

                        //StringWriter sw = new StringWriter();
                        //serializer.Serialize(sw, classNameXml);
                        //Console.WriteLine($"XML size {sw.ToString().Length}\n{sw} ");

                        //serializer.Serialize(toServer, classNameXml);
                        //sw.Flush();

                        ////Kode til Json med Server som inkludere clienten Json serialiserings view og Json deserialiseret på server siden.

                        //string strFromClient = sr.ReadLine();
                        //Console.WriteLine($"From Client text : {strFromClient}");

                        //ClassName clasName = JsonConvert.DeserializeObject<ClassName>(strFromClient);
                        //Console.WriteLine($"From Client as clasName obj : {clasName}");

                        ////Json med serialisering til json format på server siden.

                        string jsonStr = JsonConvert.SerializeObject(classNameJson);
                        Console.WriteLine($"Client json string: {jsonStr} and size:: {jsonStr.Length}");

                        toServer.WriteLine(jsonStr);
                        toServer.Flush();
                    }
        }
Example #20
0
        public override int GetHashCode()
        {
            int lHashCode = ClassName.GetHashCode();

            foreach (IOidField loidField in Fields)
            {
                lHashCode += loidField.Value.GetHashCode();
            }

            return(base.GetHashCode());
        }
Example #21
0
        protected override bool ParseSelectorToken(IItemFactory itemFactory, ITextProvider text, ITokenStream stream)
        {
            var name = itemFactory.CreateSpecific<ClassName>(this, text, stream);
            if (name.Parse(itemFactory, text, stream))
            {
                Name = name;
                Children.Add(name);
            }

            return Children.Count > 0;
        }
Example #22
0
        /// <summary>
        ///     This is not used, but is intended to be completed and solve the problem regarding
        ///     the recorder using multiple class names in the By.ClassName selector.
        /// </summary>
        public void ResolveMultipleClassNames()
        {
            string[] classNames = ClassName.Split(new[] { ' ' });
            if (Id == "null" && Name == "null")
            {
                if (classNames.Length > 0)
                {
//                    MessageBox.Show("The clicked element has more than one class name ascribed to it. You must select one to use!", "Selector Selector", new MessageBoxButtons())
                }
            }
        }
Example #23
0
        private EmitSyntax EmitFactoryCode(
            EmitSyntax emit,
            PlannedClass contextPlannedClass,
            Type type,
            bool nullAllowed)
        {
            if (type == typeof(void))
            {
            }
            else if (type == typeof(int))
            {
                emit = emit.Ldc_I4_0();
            }
            else if (type.IsValueType)
            {
                var resultType = emit.Types.Import(type);
                var resultLoc  = emit.Locals.Generate("result");

                emit = emit
                       .Local(resultLoc, resultType)
                       .Ldloca(resultLoc.GetRef())
                       .Initobj(resultType)
                       .Ldloc(resultLoc.GetRef())
                ;
            }
            else if (nullAllowed)
            {
                emit.Ldnull();
            }
            else if (!type.IsAbstract && !type.IsInterface)
            {
                emit = emit.Newobj(
                    emit.Types.Import(type));
            }
            else if (contextPlannedClass != null && contextPlannedClass.Implements(type))
            {
                emit = emit.Ldarg(0);
            }
            else if (plan.Exists(e => e.Implements(type)))
            {
                var otherEntry = plan.Find(e => e.Implements(type));
                emit = emit.Newobj(
                    emit.Types.Class_(
                        ClassName.Parse(
                            otherEntry.ClassName)));
            }
            else
            {
                throw new InvalidOperationException(
                          "Internal error: non-planned abstract result type");
            }

            return(emit);
        }
Example #24
0
        public override int GetHashCode()
        {
            var hashcode = 37;

#pragma warning disable RECS0025 // Non-readonly field referenced in 'GetHashCode()'
            hashcode += Name == null ? 0 : Name.GetHashCode();
            hashcode += ClassName == null ? 0 : ClassName.GetHashCode();
            hashcode += Params == null ? 0 : Params.GetHashCode();
#pragma warning restore RECS0025 // Non-readonly field referenced in 'GetHashCode()'
            return(hashcode);
        }
Example #25
0
    /// <summary>
    /// Get a preset class based on the currently existing ClassName values, returns a Shotty class if the given enum value isn't found
    /// </summary>
    /// <param name="className">The desired preset to retrieve</param>
    /// <returns></returns>
    public static PlayerClass GetPreset(ClassName className)
    {
        switch (className)
        {
        case ClassName.Shotty:
            return(new PlayerClass(ClassName.Shotty, Gun.Shotgun, 100, 6, 36, 6.0f));

        default:
            return(new PlayerClass(ClassName.Shotty, Gun.Shotgun, 100, 6, 36, 6.0f));
        }
    }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (ClassName != null ? ClassName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MethodName != null ? MethodName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FileName != null ? FileName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ LineNumber;
         return(hashCode);
     }
 }
Example #27
0
        public ActionResult Create([Bind(Include = "ID,Name")] ClassName className)
        {
            if (ModelState.IsValid)
            {
                db.ClassName.Add(className);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(className));
        }
Example #28
0
 public bool Equals(ClassName other)
 {
     if (other == null)
     {
         return(false);
     }
     else
     {
         //Do your equality test here.
     }
 }
        private void AddAnalyzerClassName(ImmutableArray <DiagnosticAnalyzer> .Builder builder)
        {
            var analyzer = new ClassName();

            if (!AnalyzerIds.Contains(analyzer.SupportedDiagnostics.Single().Id))
            {
                return;
            }
            analyzer.Convention = Parameters[analyzer.SupportedDiagnostics.Single().Id].Single()["format"];
            builder.Add(analyzer);
        }
Example #30
0
        //增加--交互

        static void CreateClass()
        {
            Console.WriteLine("请输入一个班级名称");
            string    name      = Console.ReadLine();
            ClassName classname = new ClassName();

            classname.Name = name;

            ClassBusiness cb = new ClassBusiness();

            cb.Add(classname);
        }
        public MethodNode(CoolParser.MethodFeatureContext context, Node s) : base(s.Childs)
        {
            Symbols = new Dictionary <string, ClassNode>();
            Params  = new Dictionary <string, AttributeNode>();
            //Variables = new Dictionary<string, AttributeNode>();

            CoolParser.ClassdefContext p = (CoolParser.ClassdefContext)context.Parent;
            var classname = p.t.Text;
            var type      = "Object";

            if (context.TYPE().GetText() != null)
            {
                type = context.TYPE().GetText();
            }

            var name = context.ID().GetText();

            Name = name;
            SetType(SymbolTable.Classes[type]);
            //Method c;
            if (SymbolTable.Classes.ContainsKey(type) && !(SymbolTable.Classes[classname].Methods.ContainsKey(name)))// if you know my type and not myself
            {
                //c = new Method(name, SymbolTable.Classes[type])
                {
                    Expression = context.expresion();// this shouln't be on the ctor
                    Self       = context;
                }
                SymbolTable.Classes[classname].Methods.Add(Name, this);//let me introduce myself
                var formals = context.formal();
                //foreach (var item in formals)// add the parameters of the method
                //{
                //    //SymbolTable.Classes[classname].Methods[name].Params.Add(item.id.Text, new FormalNode(item.id.Text, SymbolTable.Classes[item.t.Text]));
                //}
                foreach (var item in Childs)
                {
                    try{ SymbolTable.Classes[classname].Methods[name].Params.Add(((FormalNode)item).ID, new AttributeNode(((FormalNode)item).ID, ((FormalNode)item).GetType())); }catch (System.Exception) {}
                }
            }
            this.context = context;
            var d = (CoolParser.ClassdefContext)context.Parent;

            this.ClassName = d.TYPE(0).GetText();// + ".";
            //this.Childs = s.Childs;
            this.Name = context.ID().GetText();
            if (ClassName.ToLower() == "main")
            {
                ClassName = "";
            }
            foreach (var item in Params)
            {
                Symbols.Add(item.Key, item.Value.GetType());// maybe here we could make a dict of atributes but i think this will be harder after in other places and since i only need the class :)
            }
        }
Example #32
0
        private void SetAClassnameNFileList(FileInfo fi)
        {
            ClassName cl = new ClassName(fi);

            foreach (string fl in cl.FullNames)
            {
                if (this.AClassnameNFileList.ContainsKey(fl) == false)
                {
                    this.AClassnameNFileList.Add(fl, cl.FileInfo);
                }
            }
        }
Example #33
0
 public static Resource.Name Resource(ClassName playerClass)
 {
     switch(playerClass)
     {
         case ClassName.WIZARD:
         case ClassName.WARLOCK:
         case ClassName.CLERIC:
             return global::Resource.Name.Mana;
         case ClassName.MONK:
         case ClassName.VANGUARD:
         case ClassName.BERZERKER:
             return global::Resource.Name.Focus;
         case ClassName.SHADOW:
         case ClassName.RANGER:
         case ClassName.DUELIST:
         default:
             return global::Resource.Name.Energy;
     }
 }
Example #34
0
 public Ref<Types> Class_(ClassName className)
 {
     TypeReference resultTypeRef = ClassNameToTypeReference(className);
     return ValueToRef(resultTypeRef);
 }
Example #35
0
 public Ref<Types> RequiredModifier(Ref<Types> elementType, ClassName className)
 {
     var elementRefType = RefToValue(elementType);
     var modifierType = ClassNameToTypeReference(className);
     var type = new RequiredModifierType(modifierType, elementRefType);
     return ValueToRef(type);
 }
Example #36
0
 public TypeSpec TypeSpec(ClassName className)
 {
     return new TypeSpec { Type = Class_(className) };
 }
Example #37
0
 public Ref<Types> Value(ClassName className)
 {
     var typeRef = ClassNameToTypeReference(className);
     typeRef.IsValueType = true;
     return ValueToRef(typeRef);
 }
Example #38
0
        private TypeReference ClassNameToTypeReference(ClassName className)
        {
            TypeReference resultTypeRef = null;
            TypeReference innerType = null;

            /*
            if (className.Scope == null)
            {
                string fullName = className.Name;
                var definition = container.GetType(fullName);
                if (definition != null)
                {
                    return definition;
                }
            }
            */

            foreach (var name1 in className.SlashedName.Parts.Reverse())
            {
                var typeRef = new TypeReference(name1.Namespace, name1.Name, container, null);

                if (innerType == null)
                {
                    resultTypeRef = typeRef;
                }
                else
                {
                    innerType.DeclaringType = typeRef;
                }

                innerType = typeRef;
            }

            if (className.Scope != null)
            {
                resultTypeRef.Scope = (IMetadataScope)className.Scope.Value;
            }
            else
            {
                resultTypeRef.Scope = container;
            }

            return container.Import(resultTypeRef);
        }