Example #1
0
        // Token: 0x06000880 RID: 2176 RVA: 0x0003E0E0 File Offset: 0x0003C2E0
        public static Dictionary <string, object> GetVolumeCustomProperties(int volumeId, ICollection <string> properties)
        {
            Volume volume = VolumeDAL.GetVolume(volumeId);
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            if (properties == null || properties.Count == 0)
            {
                properties = volume.CustomProperties.Keys;
            }
            MacroParser macroParser = new MacroParser(new Action <string, int>(BusinessLayerOrionEvent.WriteEvent))
            {
                ObjectType    = "Volume",
                ActiveObject  = volume.ID.ToString(),
                NetObjectID   = volume.ID.ToString(),
                NetObjectName = volume.FullName,
                NodeID        = volume.NodeID,
                NodeName      = NodeDAL.GetNode(volume.NodeID).Name
            };

            using (macroParser.MyDBConnection = DatabaseFunctions.CreateConnection())
            {
                foreach (string text in properties)
                {
                    string key = text.Trim();
                    if (volume.CustomProperties.ContainsKey(key))
                    {
                        object obj = volume.CustomProperties[key];
                        if (obj != null && obj.ToString().Contains("${"))
                        {
                            dictionary[key] = macroParser.ParseMacros(obj.ToString(), false);
                        }
                        else
                        {
                            dictionary[key] = obj;
                        }
                    }
                }
            }
            return(dictionary);
        }
Example #2
0
        public static Dictionary <string, object> GetVolumeCustomProperties(
            int volumeId,
            ICollection <string> properties)
        {
            Volume volume = VolumeDAL.GetVolume(volumeId);
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            if (properties == null || properties.Count == 0)
            {
                properties = volume.get_CustomProperties().Keys;
            }
            MacroParser macroParser1 = new MacroParser(new Action <string, int>(BusinessLayerOrionEvent.WriteEvent));

            macroParser1.set_ObjectType("Volume");
            macroParser1.set_ActiveObject(volume.get_ID().ToString());
            macroParser1.set_NetObjectID(volume.get_ID().ToString());
            macroParser1.set_NetObjectName(volume.get_FullName());
            macroParser1.set_NodeID(volume.get_NodeID());
            macroParser1.set_NodeName(NodeDAL.GetNode(volume.get_NodeID()).get_Name());
            MacroParser   macroParser2 = macroParser1;
            SqlConnection connection;

            macroParser2.set_MyDBConnection(connection = DatabaseFunctions.CreateConnection());
            using (connection)
            {
                foreach (string property in (IEnumerable <string>)properties)
                {
                    string key = property.Trim();
                    if (volume.get_CustomProperties().ContainsKey(key))
                    {
                        object customProperty = volume.get_CustomProperties()[key];
                        dictionary[key] = customProperty == null || !customProperty.ToString().Contains("${") ? customProperty : (object)macroParser2.ParseMacros(customProperty.ToString(), false);
                    }
                }
            }
            return(dictionary);
        }