示例#1
0
        private static void SaveUIOptions()
        {
            XmlItem xi = Root.FindItem("UIOptions");

            xi.SetProp("DisableHotkeys", Converter.ToString(DisableHotkeys));
            xi.SetProp("DisableBacklight", Converter.ToString(DisableBacklight));
        }
示例#2
0
        private static void SaveCompilerSettings()
        {
            XmlItem xi = Root.FindItem("CompilerSettings");

            xi.SetProp("Placeholder", CompilerSettings.Placeholder);
            xi.SetProp("ExceptionBehaviour", Converter.ToString(CompilerSettings.ExceptionBehaviour));
        }
示例#3
0
        /// <summary>
        /// Saves the form state to the configuration file.
        /// </summary>
        /// <param name="form">The form to save.</param>
        public static void SaveFormState(Form form)
        {
            XmlItem xi = FDoc.Root.FindItem("Forms").FindItem(form.Name);

            xi.SetProp("Maximized", form.WindowState == FormWindowState.Maximized ? "1" : "0");
            xi.SetProp("Left", form.Location.X.ToString());
            xi.SetProp("Top", form.Location.Y.ToString());
            xi.SetProp("Width", form.Size.Width.ToString());
            xi.SetProp("Height", form.Size.Height.ToString());
        }
示例#4
0
 public void Save(XmlItem rootItem)
 {
     foreach (BlobItem item in list)
     {
         XmlItem xi = rootItem.Add();
         xi.Name = "item";
         xi.SetProp("Stream", Converter.ToXml(item.Stream));
         if (!String.IsNullOrEmpty(item.Source))
         {
             xi.SetProp("Source", Converter.ToXml(item.Source));
         }
         if (TempFile != null)
         {
             item.Dispose();
         }
     }
 }
示例#5
0
 public void Save(XmlItem rootItem)
 {
     foreach (BlobItem item in FList)
     {
         XmlItem xi = rootItem.Add();
         xi.Name = "item";
         xi.SetProp("Stream", Converter.ToXml(item.Stream));
     }
 }
示例#6
0
 /// <summary>
 /// Writes a string property.
 /// </summary>
 /// <param name="name">Property name.</param>
 /// <param name="value">Property value.</param>
 public void WriteStr(string name, string value)
 {
     curRoot.SetProp(PropName(name), value);
     //FText.Append(PropName(name));
     //FText.Append("=\"");
     //FText.Append(Converter.ToXml(value));
     //FText.Append("\" ");
 }
示例#7
0
        /// <summary>
        /// Replaces the specified locale string with the new value.
        /// </summary>
        /// <param name="id">Comma-separated path to the existing locale string.</param>
        /// <param name="value">The new string.</param>
        /// <remarks>
        /// Use this method if you want to replace some existing locale value with the new one.
        /// </remarks>
        /// <example>
        /// <code>
        /// Res.Set("Messages,SaveChanges", "My text that will appear when you close the designer");
        /// </code>
        /// </example>
        public static void Set(string id, string value)
        {
            string[] categories = id.Split(new char[] { ',' });
            XmlItem  xi         = FLocale.Root;

            foreach (string category in categories)
            {
                xi = xi.FindItem(category);
            }

            xi.SetProp("Text", value);
        }
示例#8
0
        public static void CreateFunctionsTree(Report report, ObjectInfo rootItem, XmlItem rootNode)
        {
            foreach (ObjectInfo item in rootItem.Items)
            {
                string     text = String.Empty;
                string     desc = String.Empty;
                MethodInfo func = item.Function;
                if (func != null)
                {
                    text = func.Name;
                    // if this is an overridden function, show its parameters
                    if (rootItem.Name == text)
                    {
                        text = report.CodeHelper.GetMethodSignature(func, false);
                    }
                    desc = GetFunctionDescription(report, func);
                }
                else
                {
                    // it's a category
                    text = Res.TryGet(item.Text);
                }
                XmlItem node = rootNode.Add();
                node.SetProp("Name", text);
                if (!String.IsNullOrEmpty(desc))
                {
                    node.SetProp("Description", desc);
                }

                if (item.Items.Count > 0)
                {
                    node.Name = "Functions";
                    CreateFunctionsTree(report, item, node);
                }
                else
                {
                    node.Name = "Function";
                }
            }
        }
示例#9
0
        private void SaveMenuTree(XmlItem xi, List <ExportsTreeNode> nodes)
        {
            xi.Items.Clear();

            foreach (ExportsTreeNode node in nodes)
            {
                XmlItem newItem = new XmlItem();
                newItem.Name = node.Name;
                if (node.ExportType != null)
                {
                    newItem.SetProp("ExportType", node.ExportType.FullName);
                }
                if (node.ImageIndex != -1)
                {
                    newItem.SetProp("Icon", node.ImageIndex.ToString());
                }
                newItem.SetProp("Enabled", node.Enabled.ToString());
                xi.Items.Add(newItem);
                if (node.Nodes.Count != 0)
                {
                    SaveMenuTree(newItem, node.Nodes);
                }
            }
        }
示例#10
0
        private ItemState ReadItem(XmlItem item)
        {
            FastString builder;

            if (Config.IsStringOptimization)
            {
                builder = new FastStringWithPool(stringPool);
            }
            else
            {
                builder = new FastString();
            }
            ReadState state   = ReadState.FindLeft;
            int       comment = 0;
            int       i       = 0;
            //string tempAttrName = null;
            //int lc = -1;
            int c = -1;

            // find <
            c = readNextSymbol();
            while (c != -1)
            {
                if (c == '<')
                {
                    break;
                }
                c = readNextSymbol();
            }

            //while not end
            while (state != ReadState.Done && c != -1)
            {
                // find name or comment;
                c = readNextSymbol();
                i = 0;
                while (c != -1)
                {
                    if (i <= comment)
                    {
                        switch (comment)
                        {
                        case 0: if (c == '!')
                            {
                                comment++;
                            }
                            break;

                        case 1: if (c == '-')
                            {
                                comment++;
                            }
                            break;

                        case 2: if (c == '-')
                            {
                                state = ReadState.FindComment;
                            }
                            break;

                        default: comment = -1; break;
                        }
                        if (state == ReadState.FindComment)
                        {
                            break;
                        }
                    }
                    i++;
                    switch (c)
                    {
                    case '>': state = ReadState.Done; break;      //Found name

                    case ' ': state = ReadState.FindRight; break; //Found name

                    case '<': RaiseException(); break;

                    default: builder.Append((char)c); break;
                    }
                    if (state != ReadState.FindLeft)
                    {
                        break;
                    }
                    c = readNextSymbol();
                }
                switch (state)
                {
                case ReadState.FindComment:
                    comment = 0;
                    while (c != -1)
                    {
                        c = readNextSymbol();
                        if (comment > 1)
                        {
                            if (c == '>')
                            {
                                state = ReadState.FindLeft;
                                break;
                            }
                        }
                        else
                        {
                            if (c == '-')
                            {
                                comment++;
                            }
                            else
                            {
                                comment = 0;
                            }
                        }
                    }
                    comment        = 0;
                    builder.Length = 0;
                    while (c != -1)
                    {
                        if (c == '<')
                        {
                            break;
                        }
                        c = readNextSymbol();
                    }
                    break;

                case ReadState.Done:
                    string result = builder.ToString();
                    if (result[0] == '/')
                    {
                        item.Name = result.Substring(1);
                        return(ItemState.End);
                    }
                    if (result[result.Length - 1] == '/')
                    {
                        item.Name = result.Substring(0, result.Length - 1);
                        return(ItemState.Complete);
                    }
                    item.Name = result;
                    return(ItemState.Begin);

                case ReadState.FindRight:
                    if (builder[0] == '/')
                    {
                        builder.Remove(0, 1);
                        item.Name = builder.ToString();
                        return(ItemState.End);
                    }
                    item.Name      = builder.ToString();
                    builder.Length = 0;
                    while (c != -1 && c != '>')
                    {
                        c = readNextSymbol();
                        while (c != -1)
                        {
                            if (c == ' ')
                            {
                                builder.Length = 0;
                                c = readNextSymbol();
                                continue;
                            }
                            if (c == '=' || c == '>')
                            {
                                break;
                            }
                            builder.Append((char)c);
                            c = readNextSymbol();
                        }
                        if (c == '>')
                        {
                            if (builder.Length > 0 && builder[builder.Length - 1] == '/')
                            {
                                return(ItemState.Complete);
                            }
                            return(ItemState.Begin);
                        }
                        c = readNextSymbol();
                        if (c != '"')
                        {
                            continue;
                        }
                        string attrName = builder.ToString();
                        builder.Length = 0;
                        while (c != -1)
                        {
                            c = readNextSymbol();
                            if (c == '"')
                            {
                                break;
                            }
                            builder.Append((char)c);
                        }
                        item.SetProp(attrName, Converter.FromXml(builder.ToString()));
                        builder.Length = 0;
                    }
                    break;
                }
            }


            //just for errors
            return(ItemState.Begin);
        }
示例#11
0
        private static void SaveUIStyle()
        {
            XmlItem xi = Root.FindItem("UIStyle");

            xi.SetProp("Style", Converter.ToString(UIStyle));
        }