コード例 #1
0
        public void Save(XmlDocument doc)
        {
            Config.SafeNodeSelect(doc, "/Settings/History/MaxSize", MaxSize.ToString());
            Config.SafeNodeSelect(doc, "/Settings/History/SaveOnExit", SaveOnExit.ToString());

            XmlNode n = Config.SafeNodeSelect(doc, "/Settings/History/Files");

            n.RemoveAll(); //delete all history
            if (SaveOnExit)
            {
                foreach (TextRepresentationEntry tre in history)
                {
                    XmlElement e = doc.CreateElement("File");
                    e.InnerText = tre.FullName;

                    if (tre.ArchiveFile != String.Empty)
                    {
                        XmlAttribute attrib = doc.CreateAttribute("archive");
                        attrib.Value = tre.ArchiveFile;
                        e.Attributes.Append(attrib);
                    }

                    n.AppendChild(e);
                }
            }
        }
コード例 #2
0
        public void AddValidation(ClientModelValidationContext context)
        {
            CustomAttributes.MergeAttribute(context.Attributes, "data-val", "true");
            var errorMessage = FormatErrorMessage(context.ModelMetadata.GetDisplayName());

            CustomAttributes.MergeAttribute(context.Attributes, "data-val-minsize", MinSize.ToString());
            CustomAttributes.MergeAttribute(context.Attributes, "data-val-maxsize", MaxSize.ToString());
            CustomAttributes.MergeAttribute(context.Attributes, "data-val-maxfilesize", MaxFileSize.ToString());
            CustomAttributes.MergeAttribute(context.Attributes, "data-val-canbenull", CanBeNull.ToString());
            CustomAttributes.MergeAttribute(context.Attributes, "data-val-photovalidation", errorMessage);
            //todo: client side part not implemented
        }
コード例 #3
0
        public IDictionary <string, string> GetArguments()
        {
            var arguments = new Dictionary <string, string>();

            arguments["max-size"]      = MaxSize.ToString();
            arguments["player-sort"]   = PlayerSort;
            arguments["initial-state"] = InitialState;
            arguments["fixed-pixels"]  = string.Join(string.Empty, FixedPixels.Select(p =>
                                                                                      CLIObject.ToString(p, "X", "Y")).ToArray()
                                                     );

            return(arguments);
        }
コード例 #4
0
 /// <summary>
 /// returns the string representation of the statistics.
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     lock (this)
     {
         System.Text.StringBuilder ret = new System.Text.StringBuilder();
         ret.Append("Stats[Sch:" + ClassName + ", Cnt:" + Count.ToString() + ", ");
         ret.Append("Hi:" + HiCount.ToString() + ", ");
         ret.Append("MxS:" + MaxSize.ToString() + ", ");
         ret.Append("MxC:" + MaxCount.ToString() + ", ");
         ret.Append("Hit:" + HitCount.ToString() + ", ");
         ret.Append("Miss:" + MissCount.ToString() + "]");
         return(ret.ToString());
     }
 }
コード例 #5
0
        public string ListCalculateData(int index)
        {
            string[] list = new string[8];

            list[0] = AdversaryX.ToString();
            list[1] = AdversaryY.ToString();
            list[2] = InitialSpeed.ToString();
            list[3] = AltilleryX.ToString();
            list[4] = AltilleryY.ToString();
            list[5] = ProjectileAngle.ToString();
            list[6] = FlightDuration.ToString();
            list[7] = MaxSize.ToString();

            return(list[index]);
        }
コード例 #6
0
        public void Save(XmlTextWriter writer)
        {
            writer.WriteElementString("maxSize", MaxSize.ToString());
            writer.WriteElementString("playerSort", PlayerSort);
            writer.WriteElementString("initialState", InitialState);

            if (FixedPixels.Count > 0)
            {
                writer.WriteStartElement("fixedPixels");

                foreach (var point in FixedPixels)
                {
                    writer.WriteStartElement("pixel");
                    writer.WriteElementString("x", point.X.ToString());
                    writer.WriteElementString("y", point.Y.ToString());
                    writer.WriteEndElement();
                }

                writer.WriteEndElement();
            }
        }
コード例 #7
0
        protected override Task RunTestAsync(
            ImplicitPin implicitPin,
            DisposableDirectory directory,
            Func <Context, IContentSession, Task> funcAsync)
        {
            if (directory is not null)
            {
                return(Task.CompletedTask);
            }

            _tests.MaxSize = MaxSize.ToString();

            _tests.ConfigureWithOneMaster(d =>
            {
                d.UseFullEvictionSort = true;
            });

            return(_tests.RunTestAsync(1, (testContext) =>
            {
                return funcAsync(testContext, testContext.Sessions[0]);
            }, implicitPin));
        }
コード例 #8
0
        /// <summary>
        /// Set the MongoDB logger options based on the key/value application configuration properties.
        /// </summary>
        /// <param name="configuration">Represents a set of key/value application configuration properties. See <see cref="IConfiguration"/>.</param>
        public override void ReadFromConfiguration(IConfiguration configuration)
        {
            var mongoConfiguration = configuration?.GetSection("XLogger:MongoDB");

            if (mongoConfiguration == null)
            {
                throw new System.Exception("Could not load the adapter configuration properties. Make sure the application settings have the XLogger:MongoDB section.");
            }

            var logLevel = mongoConfiguration[nameof(LogLevel)];

            if (!string.IsNullOrEmpty(logLevel))
            {
                LogLevel = (LogLevel)int.Parse(logLevel);
            }
            OnDemand = bool.Parse(mongoConfiguration[nameof(OnDemand)] ?? OnDemand.ToString());

            DatabaseUrl    = mongoConfiguration[nameof(DatabaseUrl)] ?? DatabaseUrl;
            CollectionName = mongoConfiguration[nameof(CollectionName)] ?? CollectionName;
            Capped         = bool.Parse(mongoConfiguration[nameof(Capped)] ?? Capped.ToString());
            MaxSize        = long.Parse(mongoConfiguration[nameof(MaxSize)] ?? MaxSize.ToString());
            MaxDocuments   = long.Parse(mongoConfiguration[nameof(MaxDocuments)] ?? MaxDocuments.ToString());
        }
コード例 #9
0
ファイル: ParticleEffect.cs プロジェクト: JSandusky/UrShell
        public override void Save()
        {
            XmlDocument doc  = new XmlDocument();
            XmlElement  root = doc.CreateElement("particleemitter");

            doc.AppendChild(root);

            root.AppendChild(doc.CreateElement("material").SimpleTag("name", Material));
            root.AppendChild(doc.CreateElement("numparticles").SimpleTag("value", NumParticles.ToString()));
            root.AppendChild(doc.CreateElement("updateinvisible").SimpleTag("enable", UpdateInvisible ? "true" : "false"));
            root.AppendChild(doc.CreateElement("relative").SimpleTag("enable", Relative ? "true" : "false"));
            root.AppendChild(doc.CreateElement("scaled").SimpleTag("enable", Scaled ? "true" : "false"));
            root.AppendChild(doc.CreateElement("sorted").SimpleTag("enable", Sorted ? "true" : "false"));
            root.AppendChild(doc.CreateElement("animlodbias").SimpleTag("value", AnimLodBias.ToString()));
            root.AppendChild(doc.CreateElement("emittertype").ValueTag(Type.ToString().ToLower()));
            if (EmitterSize != null)
            {
                root.AppendChild(doc.CreateElement("emittersize").ValueTag(EmitterSize.ToString()));
            }
            root.AppendChild(doc.CreateElement("emitterradius").ValueTag(EmitterRadius.ToString()));

            XmlElement dir = doc.CreateElement("direction");

            dir.SetAttribute("min", DirectionMin.ToString());
            dir.SetAttribute("max", DirectionMax.ToString());
            root.AppendChild(dir);

            root.AppendChild(doc.CreateElement("constantforce").ValueTag(ConstantForce.ToString()));
            root.AppendChild(doc.CreateElement("dampingforce").ValueTag(DampingForce.ToString()));
            root.AppendChild(doc.CreateElement("activetime").ValueTag(ActiveTime.ToString()));
            root.AppendChild(doc.CreateElement("inactivetime").ValueTag(InActiveTime.ToString()));
            root.AppendChild(Interval.ToElement(doc.CreateElement("interval")));
            root.AppendChild(EmissionRate.ToElement(doc.CreateElement("emissionrate")));

            XmlElement psize = doc.CreateElement("particlesize");

            psize.SetAttribute("min", MinSize.ToString());
            psize.SetAttribute("max", MaxSize.ToString());
            root.AppendChild(psize);

            root.AppendChild(TimeToLive.ToElement(doc.CreateElement("timetolive")));
            root.AppendChild(Velocity.ToElement(doc.CreateElement("velocity")));
            root.AppendChild(Rotation.ToElement(doc.CreateElement("rotation")));
            root.AppendChild(RotationSpeed.ToElement(doc.CreateElement("rotationspeed")));
            //SIZE DELTA
            XmlElement sized = doc.CreateElement("sizedelta");

            sized.SetAttribute("add", SizeDelta.X.ToString());
            sized.SetAttribute("mul", SizeDelta.Y.ToString());
            root.AppendChild(sized);

            foreach (ParticleColorFade f in ColorFade)
            {
                XmlElement e = doc.CreateElement("colorfade");
                e.SetAttribute("color", f.Color.ToString());
                e.SetAttribute("time", f.Time.ToString());
                root.AppendChild(e);
            }
            foreach (ParticleTexAnim a in TextureAnim)
            {
                XmlElement e = doc.CreateElement("texanim");
                e.SetAttribute("uv", a.Animation.ToString());
                e.SetAttribute("time", a.Time.ToString());
                root.AppendChild(e);
            }

            XmlWriterSettings xws = new XmlWriterSettings {
                OmitXmlDeclaration = true, Indent = true
            };

            using (XmlWriter xw = XmlWriter.Create(System.IO.Path.ChangeExtension(Name, "xml"), xws))
                doc.Save(xw);
        }
コード例 #10
0
        public static void Init()
        {
            if (Initialized)
            {
                return;
            }

            if (!parseConfig())
            {
                throw new HttpResponseException(System.Net.HttpStatusCode.InternalServerError);
            }
            FreeSpace = MaxSize;

            NameServerAddress = Environment.GetEnvironmentVariable("NAMING_ADDRESS");

            Console.WriteLine("Name Server address is " + NameServerAddress);

            try {
                Port = File.OpenText("Port").ReadLine();
            }
            catch {
                Console.WriteLine("Port file wasn't found");
                return;
            }

            string id = "";

            Random rng = new Random();

            if (File.Exists("IDAtNameServer"))
            {
                Console.WriteLine("from file id");
                StreamReader reader = new StreamReader(File.Open("IDAtNameServer", FileMode.Open));
                id = reader.ReadLine();
                reader.Close();

                long size = 0;
                if (Directory.Exists(storageRoot + id + '/'))
                {
                    size = DirSize(new DirectoryInfo(storageRoot + id + '/'));
                }
                FreeSpace -= size;

                var response = Api.Get(NameServerAddress, String.Format("/storageConn?id={0}&port={1}&free_space={2}", id, Port, FreeSpace.ToString()));

                if (response == 200)
                {
                    StoragePath = storageRoot + id + '/';
                    StorageID   = id;
                    Initialized = true;
                }
                else if (response == 409)
                {
                    id       = rng.Next().ToString();
                    response = Api.Get(NameServerAddress, String.Format("/storageReg?id={0}&port={1}&free_space={2}", id, Port, MaxSize.ToString()));

                    for (int i = 0; i < 20 && response == 409; i++)
                    {
                        id       = rng.Next().ToString();
                        response = Api.Get(NameServerAddress, String.Format("/storageReg?id={0}&port={1}&free_space={2}", id, Port, MaxSize.ToString()));
                    }


                    if (response == 200)
                    {
                        var writer = new StreamWriter(File.Open("IDAtNameServer", FileMode.Create));
                        writer.WriteLine(id);
                        writer.Flush();
                        writer.BaseStream.Close();
                        writer.Close();
                        StoragePath = storageRoot + id + '/';
                        StorageID   = id;
                        Initialized = true;
                    }
                    else
                    {
                        throw new HttpResponseException(System.Net.HttpStatusCode.InternalServerError);
                    }
                }
            }
            else
            {
                id = rng.Next().ToString();

                var response = Api.Get(NameServerAddress, String.Format("/storageReg?id={0}&port={1}&free_space={2}", id, Port, MaxSize.ToString()));

                for (int i = 0; i < 20 && response == 409; i++)
                {
                    id       = rng.Next().ToString();
                    response = Api.Get(NameServerAddress, String.Format("/storageReg?id={0}&port={1}&free_space={2}", id, Port, MaxSize.ToString()));
                }

                if (response == 500)
                {
                    Console.WriteLine("Storage with this IP:PORT already registered");
                    throw new HttpResponseException(System.Net.HttpStatusCode.InternalServerError);
                }

                if (response == 200)
                {
                    var writer = new StreamWriter(File.Open("IDAtNameServer", FileMode.Create));
                    writer.WriteLine(id);
                    writer.Flush();
                    writer.Close();
                    StoragePath = storageRoot + id + '/';
                    StorageID   = id;
                    Initialized = true;
                }
                else
                {
                    throw new HttpResponseException(System.Net.HttpStatusCode.InternalServerError);
                }
            }
            CreateDirectoryRecursively(StoragePath);
        }
コード例 #11
0
        public override void RenderControlToScript(StringBuilder script, bool useApplyTo)
        {
            if (DidRenderScript)
            {
                return;
            }


            script.Append("new Ext.TabPanel(");

            script.Append("{");



            if (useApplyTo)
            {
                if (UnMinify)
                {
                    script.Append("\n ");
                }
                script.Append("applyTo:'" + this.ClientID + "'");
            }
            else
            {
                if (UnMinify)
                {
                    script.Append("\n ");
                }
                script.Append("contentEl:'" + this.ClientID + "'");
            }

            if (UnMinify)
            {
                script.Append("\n ");
            }
            script.Append(",id:'tp" + this.ClientID + "'");

            if (Title.Length > 0)
            {
                if (UnMinify)
                {
                    script.Append("\n ");
                }
                script.Append(",title:'" + this.Title + "'");
            }

            if (Region.Length > 0)
            {
                if (UnMinify)
                {
                    script.Append("\n ");
                }
                script.Append(",region:'" + this.Region + "'");
            }


            if ((AutoHeight) && (FixedPixelHeight == 0))
            {
                if (UnMinify)
                {
                    script.Append("\n ");
                }
                script.Append(",autoHeight:true");
            }

            if (FixedPixelHeight > 0)
            {
                if (UnMinify)
                {
                    script.Append("\n ");
                }
                script.Append(",height:'" + FixedPixelHeight.ToString() + "'");
            }

            if ((AutoWidth) && (FixedPixelWidth == 0))
            {
                if (UnMinify)
                {
                    script.Append("\n ");
                }
                script.Append(",autoWidth:true");
            }

            if (FixedPixelWidth > 0)
            {
                if (UnMinify)
                {
                    script.Append("\n ");
                }
                script.Append(",width: " + FixedPixelHeight.ToString());
            }

            if (!Header)
            {
                //if (UnMinify) script.Append("\n ");
                //script.Append(", header:false  ");
            }

            if (Plain)
            {
                if (UnMinify)
                {
                    script.Append("\n ");
                }
                script.Append(",plain:true");
            }

            if (enableTabScroll)
            {
                if (UnMinify)
                {
                    script.Append("\n ");
                }
                script.Append(",enableTabScroll:true");
            }


            if (Frame)
            {
                if (UnMinify)
                {
                    script.Append("\n ");
                }
                script.Append(",frame:true");
            }



            if (!DeferredRender)
            {
                if (UnMinify)
                {
                    script.Append("\n ");
                }
                script.Append(",deferredRender:false");
            }

            if (Split)
            {
                if (UnMinify)
                {
                    script.Append("\n ");
                }
                script.Append(", split: true ");

                if (MinSize > 0)
                {
                    if (UnMinify)
                    {
                        script.Append("\n ");
                    }
                    script.Append(", minSize: " + MinSize.ToString());
                }

                if (MaxSize > 0)
                {
                    if (UnMinify)
                    {
                        script.Append("\n ");
                    }
                    script.Append(", maxSize: " + MaxSize.ToString());
                }
            }

            SelectTab(script);

            if (UnMinify)
            {
                script.Append("\n ");
            }
            script.Append(",items:[");

            AddTabs(script);

            if (UnMinify)
            {
                script.Append("\n ");
            }
            script.Append("]");

            if (UnMinify)
            {
                script.Append("\n ");
            }
            script.Append("}");


            if (UnMinify)
            {
                script.Append("\n ");
            }
            script.Append(")");


            DidRenderScript = true;
        }
コード例 #12
0
ファイル: Number.cs プロジェクト: yuva2achieve/WebGrid
        /// <summary>
        /// Validates this instance.
        /// </summary>
        /// <returns></returns>
        public override bool Validate(RowCell cell)
        {
            if (DenyValidate())
            {
                return(true);
            }

            if (!Equals(cell.Value, cell.DataSourceValue) && cell.Value is long)
            {
                return(true);
            }
            if (!cell.GotPostBackData && (cell.Value != null && cell.Value is long == false))
            {
                cell.PostBackValue = cell.Value.ToString();
            }

            bool res = base.Validate(cell);

            if (res)
            {
                if (!string.IsNullOrEmpty(cell.PostBackValue))
                {
                    long result;
                    if (!long.TryParse(Regex.Replace(cell.PostBackValue, @"\s", string.Empty), NumberStyles.Any | NumberStyles.AllowTrailingWhite |
                                       NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingWhite |
                                       NumberStyles.AllowTrailingWhite, Grid.Culture, out result))
                    {
                        if (string.IsNullOrEmpty(SystemMessage) == false)
                        {
                            Grid.SystemMessage.Add(SystemMessage, SystemMessageStyle,
                                                   cell.Row.GetColumnInitKeys(ColumnId));
                        }
                        else if (Grid.DisplayView == DisplayView.Grid && SystemMessageStyle != SystemMessageStyle.WebGrid)
                        {
                            Grid.SystemMessage.Add(String.Format(Grid.GetSystemMessage("SystemMessage_Grid_Int")),
                                                   SystemMessageStyle, cell.Row.GetColumnInitKeys(ColumnId));
                        }
                        else
                        {
                            Grid.SystemMessage.Add(
                                String.Format(
                                    string.Format("{0}({1})", Grid.GetSystemMessage("SystemMessage_Int"), cell.Value),
                                    Title),
                                SystemMessageStyle, cell.Row.GetColumnInitKeys(ColumnId));
                        }
                        res = false;
                    }
                    else
                    {
                        cell.Value = result;
                    }
                }
                else
                {
                    cell.Value = null;
                }
            }
            else
            {
                return(false);
            }

            if (Value(cell) != null)
            {
                if (MaxSize != 0 && Value(cell) > MaxSize)
                {
                    if (!String.IsNullOrEmpty(SystemMessage))
                    {
                        Grid.SystemMessage.Add(SystemMessage, SystemMessageStyle,
                                               cell.Row.GetColumnInitKeys(ColumnId));
                    }
                    else if (Grid.DisplayView == DisplayView.Grid && SystemMessageStyle != SystemMessageStyle.WebGrid)
                    {
                        Grid.SystemMessage.Add(
                            string.Format("Maximum allowed value is {0}.", MaxSize.ToString(Format, Grid.Culture)),
                            SystemMessageStyle,
                            cell.Row.GetColumnInitKeys(ColumnId));
                    }
                    else
                    {
                        Grid.SystemMessage.Add(
                            string.Format("Maximum allowed value for '{0}' is {1}.", Title,
                                          MaxSize.ToString(Format, Grid.Culture)),
                            SystemMessageStyle, cell.Row.GetColumnInitKeys(ColumnId));
                    }
                    return(false);
                }

                if (MinSize != 0 && Value(cell) < MinSize)
                {
                    if (!String.IsNullOrEmpty(SystemMessage))
                    {
                        Grid.SystemMessage.Add(SystemMessage, SystemMessageStyle,
                                               cell.Row.GetColumnInitKeys(ColumnId));
                    }
                    else if (Grid.DisplayView == DisplayView.Grid && SystemMessageStyle != SystemMessageStyle.WebGrid)
                    {
                        Grid.SystemMessage.Add(
                            string.Format("Minimum allowed value is {0}.", MinSize.ToString(Format, Grid.Culture)),
                            SystemMessageStyle,
                            cell.Row.GetColumnInitKeys(ColumnId));
                    }
                    else
                    {
                        Grid.SystemMessage.Add(
                            string.Format("Minimum allowed value for '{0}' is {1}.", Title,
                                          MinSize.ToString(Format, Grid.Culture)),
                            SystemMessageStyle, cell.Row.GetColumnInitKeys(ColumnId));
                    }
                    return(false);
                }
            }
            return(res);
        }
コード例 #13
0
        /*
         * <propertyDescription name="Microsoft.SDKSample.DirectoryLevel" formatID="{581CF603-2925-4acf-BB5A-3D3EB39EACD3}" propID="3">
         *  <description>Number of directory levels to this item.</description>
         *  <searchInfo inInvertedIndex="false" isColumn="false,
         *  <typeInfo canStackBy="false" type="Int32"/>
         *  <labelInfo label="Directory Level"/>
         * </propertyDescription>
         */
        internal XmlElement GetXmlPropertyDescription(XmlDocument doc)
        {
            var desc = doc.CreateElement("propertyDescription");

            desc.SetAttribute("name", CanonicalName);
            desc.SetAttribute("formatID", FormatId.ToString("B").ToUpper());
            desc.SetAttribute("propID", PropertyId.ToString());

            var search = doc.CreateElement("searchInfo");

            search.SetAttribute("inInvertedIndex", InInvertedIndex.ToString());
            if (IsColumn)
            {
                search.SetAttribute("isColumn", IsColumn.ToString());
                search.SetAttribute("isColumnSparse", IsColumnSparse.ToString());
                search.SetAttribute("columnIndexType", ColumnIndexType.ToString());
            }
            if (MaxSize != 512)
            {
                search.SetAttribute("maxSize", MaxSize.ToString());
            }
            if (Mnemonics != null && Mnemonics.Length > 0)
            {
                search.SetAttribute("mnemonics", Mnemonics);
            }
            desc.AppendChild(search);

            var label = doc.CreateElement("labelInfo");

            label.SetAttribute("label", DisplayName);
            label.SetAttribute("sortDescription", SortDescription.ToString());
            if (EditInvitation != null && EditInvitation.Length > 0)
            {
                label.SetAttribute("invitationText", EditInvitation);
            }
            if (HideLabel)
            {
                label.SetAttribute("hideLabel", HideLabel.ToString());
            }
            desc.AppendChild(label);

            var type = doc.CreateElement("typeInfo");

            type.SetAttribute("type", Type.ToString());
            if (GroupingRange != PropertyGroupingRange.Discrete)
            {
                type.SetAttribute("groupingRange", GroupingRange.ToString());
            }
            if (IsInnate)
            {
                type.SetAttribute("isInnate", IsInnate.ToString());
            }
            if (IsInnate && CanBePurged)
            {
                type.SetAttribute("canBePurged", CanBePurged.ToString());
            }
            //if (MultipleValues)
            type.SetAttribute("multipleValues", MultipleValues.ToString());
            if (IsGroup)
            {
                type.SetAttribute("isGroup", IsGroup.ToString());
            }
            if (AggregationType != PropertyAggregationType.Default)
            {
                type.SetAttribute("aggregationType", AggregationType.ToString());
            }
            if (IsTreeProperty)
            {
                type.SetAttribute("isTreeProperty", IsTreeProperty.ToString());
            }
            if (IsViewable)
            {
                type.SetAttribute("isViewable", IsViewable.ToString());
            }
            if (SearchRawValue)
            {
                type.SetAttribute("searchRawValue", SearchRawValue.ToString());
            }
            if (ConditionType != PropertyConditionType.String)
            {
                type.SetAttribute("conditionType", ConditionType.ToString());
            }
            if (ConditionOperation != ConditionOperationConfigured.Equal)
            {
                type.SetAttribute("defaultOperation", ConditionOperation.ToString());
            }
            desc.AppendChild(type);

            var display = doc.CreateElement("displayInfo");

            display.SetAttribute("displayType", DisplayType.ToString());
            if (DisplayType == PropertyDisplayType.String && StringFormat != StringFormat.General)
            {
                var format = doc.CreateElement("stringFormat");
                format.SetAttribute("formatAs", StringFormat.ToString());
                display.AppendChild(format);
            }
            if (DisplayType == PropertyDisplayType.Boolean && BooleanFormat != BooleanFormat.YesNo)
            {
                var format = doc.CreateElement("booleanFormat");
                format.SetAttribute("formatAs", BooleanFormat.ToString());
                display.AppendChild(format);
            }
            if (DisplayType == PropertyDisplayType.Number && NumberFormat != NumberFormat.General)
            {
                var format = doc.CreateElement("numberFormat");
                format.SetAttribute("formatAs", NumberFormat.ToString());
                display.AppendChild(format);
            }
            if (DisplayType == PropertyDisplayType.DateTime && DateTimeFormat != DateTimeFormat.General)
            {
                var format = doc.CreateElement("dateTimeFormat");
                format.SetAttribute("formatAs", DateTimeFormat.ToString());
                display.AppendChild(format);
            }



            if (DefaultColumnWidth != 20)
            {
                display.SetAttribute("defaultColumnWidth", DefaultColumnWidth.ToString());
            }
            if (Alignment != PropertyAlignmentType.Left)
            {
                display.SetAttribute("alignment", Alignment.ToString());
            }
            //if (RelativeDescriptionType != RelativeDescriptionType.General)
            //  display.SetAttribute("relativeDescriptionType", RelativeDescriptionType.ToString());
            if (DefaultSortDirection != SortDirection.Ascending)
            {
                display.SetAttribute("defaultSortDirection", DefaultSortDirection.ToString());
            }
            if (EditControl != EditControl.Default)
            {
                var edit = doc.CreateElement("editControl");
                edit.SetAttribute("control", EditControl.ToString());
                display.AppendChild(edit);
            }
            desc.AppendChild(display);

            return(desc);
        }