Exemplo n.º 1
0
 /// <summary>
 /// Deserializes xml markup from file into an DrawingSectionListSection object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output DrawingSectionListSection object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out DrawingSectionListSection obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(DrawingSectionListSection);
     try {
         obj = LoadFromFile(fileName);
         return(true);
     }
     catch (System.Exception ex) {
         exception = ex;
         return(false);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Deserializes workflow markup into an DrawingSectionListSection object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output DrawingSectionListSection object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out DrawingSectionListSection obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(DrawingSectionListSection);
     try {
         obj = Deserialize(xml);
         return(true);
     }
     catch (System.Exception ex) {
         exception = ex;
         return(false);
     }
 }
Exemplo n.º 3
0
 public static bool LoadFromFile(string fileName, out DrawingSectionListSection obj)
 {
     System.Exception exception = null;
     return(LoadFromFile(fileName, out obj, out exception));
 }
Exemplo n.º 4
0
 public static bool Deserialize(string xml, out DrawingSectionListSection obj)
 {
     System.Exception exception = null;
     return(Deserialize(xml, out obj, out exception));
 }
        private void ExtractSymbol(string targetFolder, IDrawingService drawSvc, IDrawingSource ds, ObjCommon.DrawingSectionListSection sect, ObjCommon.DrawingSectionResourceListSectionResource res)
        {
            using (var rs = drawSvc.GetSectionResource(ds.ResourceID, res.Href))
            {
                using (Image img = Image.FromStream(rs))
                {
                    string targetId = targetFolder + sect.Title + "." + ResourceTypes.SymbolDefinition.ToString();
                    string dataName = sect.Title + "." + GetImageFormat(img.RawFormat);

                    var symDef      = Utility.CreateSimpleSymbol(_conn, sect.Title, "Image symbol definition extracted from a Symbol Library by Maestro"); //NOXLATE
                    var imgGraphics = symDef.CreateImageGraphics();
                    symDef.AddGraphics(imgGraphics);

                    imgGraphics.Item = symDef.CreateImageReference(string.Empty, Utility.FdoStringifiyLiteral(dataName)); //Empty resource id = self reference

                    imgGraphics.SizeScalable  = "True";                                                                   //NOXLATE
                    imgGraphics.ResizeControl = Utility.FdoStringifiyLiteral("ResizeNone");                               //NOXLATE
                    imgGraphics.Angle         = "0.0";                                                                    //NOXLATE
                    imgGraphics.PositionX     = "0.0";                                                                    //NOXLATE
                    imgGraphics.PositionY     = "4.0";                                                                    //NOXLATE

                    imgGraphics.SizeX = PxToMillimeters(img.Width).ToString(CultureInfo.InvariantCulture);
                    imgGraphics.SizeY = PxToMillimeters(img.Height).ToString(CultureInfo.InvariantCulture);

                    symDef.PointUsage       = symDef.CreatePointUsage();
                    symDef.PointUsage.Angle = "%ROTATION_ANGLE%"; //NOXLATE

                    var rotParam = symDef.CreateParameter();
                    rotParam.DataType     = "String";                 //NOXLATE
                    rotParam.Identifier   = "ROTATION_ANGLE";         //NOXLATE
                    rotParam.DisplayName  = "Angle to rotate symbol"; //NOXLATE
                    rotParam.DefaultValue = "0.0";                    //NOXLATE

                    symDef.ParameterDefinition.AddParameter(rotParam);

                    _conn.ResourceService.SaveResourceAs(symDef, targetId);
                    using (var ms = new MemoryStream())
                    {
                        img.Save(ms, ImageFormat.Png);
                        ms.Position = 0L; //Rewind
                        _conn.ResourceService.SetResourceData(targetId, dataName, ObjCommon.ResourceDataType.File, ms);
                    }

                    Trace.TraceInformation("Extracted symbol: " + targetId);
                }
            }
        }
 public static bool LoadFromFile(string fileName, out DrawingSectionListSection obj) {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an DrawingSectionListSection object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output DrawingSectionListSection object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out DrawingSectionListSection obj, out System.Exception exception) {
     exception = null;
     obj = default(DrawingSectionListSection);
     try {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string xml, out DrawingSectionListSection obj) {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an DrawingSectionListSection object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output DrawingSectionListSection object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out DrawingSectionListSection obj, out System.Exception exception) {
     exception = null;
     obj = default(DrawingSectionListSection);
     try {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }