Пример #1
0
 public Inspection(List <string> assemblies, string typeToRetrieveFullName, string typeNamespace, string typeName)
 {
     _typeNamespace          = typeNamespace;
     _typeName               = typeName;
     _assemblies             = assemblies;
     _typeToRetrieveFullName = TypeNameHelper.RemoveSystemNamespaces(typeToRetrieveFullName);
 }
Пример #2
0
        public void BroadCastData(object target, Stream outgoingData)
        {
            //configure once the vs version
            string vsVersion = VisualStudioVersionHelper.FindCurrentVisualStudioVersion();

            RavenWrapper.VisualStudioVersion = vsVersion;
            Log.VisualStudioVersion          = vsVersion;

            try
            {
                Type   targetType         = GetInterfaceTypeIfIsIterator(target);
                string targetTypeFullName = TypeNameHelper.GetDisplayName(targetType, fullName: true);
                string targetTypeName     = TypeNameHelper.GetDisplayName(targetType, fullName: false);
                //I'm lazy I know...
                Regex pattern1 = new Regex("[<]");
                Regex pattern2 = new Regex("[>]");
                Regex pattern3 = new Regex("[,]");
                Regex pattern4 = new Regex("[`]");
                Regex pattern5 = new Regex("[ ]");

                string fileName = pattern1.Replace(targetTypeFullName, "(");
                fileName = pattern2.Replace(fileName, ")");

                string typeName = pattern1.Replace(targetTypeName, string.Empty);
                typeName = pattern2.Replace(typeName, string.Empty);
                typeName = pattern3.Replace(typeName, string.Empty);
                typeName = pattern4.Replace(typeName, string.Empty);
                typeName = pattern5.Replace(typeName, string.Empty);

                fileName = TypeNameHelper.RemoveSystemNamespaces(fileName);

                Message message = new Message
                {
                    FileName              = string.Format(FileNameFormat, fileName),
                    TypeName              = typeName.Trim(),
                    TypeFullName          = targetTypeFullName,
                    TypeNamespace         = targetType.Namespace,
                    AssemblyQualifiedName = targetType.AssemblyQualifiedName,
                    AssemblyName          = targetType.Assembly.GetName().Name
                };

                BinaryFormatter binaryFormatter = new BinaryFormatter();
                binaryFormatter.Serialize(outgoingData, message);

                Log.Write("BroadCastData to LINQBridgeVsTruck");
                SerializationOption serializationOption = CommonRegistryConfigurations.GetSerializationOption(vsVersion);
                Truck truck = new Truck("LINQBridgeVsTruck", serializationOption);
                truck.LoadCargo(target);
                bool res = truck.DeliverTo(typeName);
                Log.Write("Data Succesfully Shipped to Grapple");
            }
            catch (Exception exception)
            {
                Log.Write(exception, "Error in BroadCastData");
                RavenWrapper.Instance.Capture(exception, message: "Error broadcasting the data to linqpad");
                throw;
            }
        }
Пример #3
0
 internal Inspection(Message message)
 {
     _truckId                = message.TruckId;
     _typeNamespace          = message.TypeNamespace;
     _typeName               = message.TypeName;
     _assemblies             = message.ReferencedAssemblies;
     _typeToRetrieveFullName = TypeNameHelper.RemoveSystemNamespaces(message.TypeFullName);
     //if the type is anonymous or it's a nested class then use the generic object
     _typeName          = _typeToRetrieveFullName.Contains("AnonymousType") || _typeToRetrieveFullName.Contains("+") ? "object" : _typeToRetrieveFullName;
     _serializationType = message.SerializationOption;
 }
Пример #4
0
        public static void BroadCastData(object target, Stream outgoingData)
        {
            Log.Configure("LINQBridgeVs", "DynamicCore");

            try
            {
                var targetType         = GetInterfaceTypeIfIsIterator(target);
                var targetTypeFullName = TypeNameHelper.GetDisplayName(targetType, true);
                var targetTypeName     = TypeNameHelper.GetDisplayName(targetType, false);
                //I'm lazy I know it...
                var pattern1 = new Regex("[<]");
                var pattern2 = new Regex("[>]");
                var pattern3 = new Regex("[,]");
                var pattern4 = new Regex("[`]");
                var pattern5 = new Regex("[ ]");

                var fileName = pattern1.Replace(targetTypeFullName, "(");
                fileName = pattern2.Replace(fileName, ")");

                var typeName = pattern1.Replace(targetTypeName, string.Empty);
                typeName = pattern2.Replace(typeName, string.Empty);
                typeName = pattern3.Replace(typeName, string.Empty);
                typeName = pattern4.Replace(typeName, string.Empty);
                typeName = pattern5.Replace(typeName, string.Empty);

                fileName = TypeNameHelper.RemoveSystemNamespaces(fileName);

                var message = new Message
                {
                    FileName     = string.Format(FileNameFormat, fileName),
                    TypeName     = typeName.Trim(),
                    TypeFullName = targetTypeFullName,
                    //TypeLocation = GetAssemblyLocation(vsVersion, targetType.Name),
                    TypeNamespace         = targetType.Namespace,
                    AssemblyQualifiedName = targetType.AssemblyQualifiedName
                };

                var binaryFormatter = new BinaryFormatter();
                binaryFormatter.Serialize(outgoingData, message);

                Log.Write("BroadCastData to LINQBridgeVsTruck");

                var truck = new Truck("LINQBridgeVsTruck");
                truck.LoadCargo(target);
                var res = truck.DeliverTo(typeName);
                Log.Write("Data Succesfully Shipped to Grapple");
            }
            catch (Exception e)
            {
                Log.Write(e, "Error in BroadCastData");
            }
        }