Inheritance: SBMLResolver
 public PgConnectionFactory() {
   Dapper.DefaultTypeMap.MatchNamesWithUnderscores = true;
   SimpleCRUD.SetDialect(SimpleCRUD.Dialect.PostgreSQL);
   var resolver = new CustomResolver();
   SimpleCRUD.SetTableNameResolver(resolver);
   SimpleCRUD.SetColumnNameResolver(resolver);
 }
Example #2
0
        public Server()
        {
            _instance = this;

            // 자동으로 생성된 리졸버를 등록해줌
            CustomResolver.Register(GeneratedResolver.Instance);
        }
Example #3
0
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var obj = new JObject();

            CustomResolver.WriteFields(value, obj, serializer);
            obj.WriteTo(writer);
        }
Example #4
0
        public void Resolves_WithCustom()
        {
            var resolver = new CustomResolver();
            var type     = typeof(Foo);
            var props    = resolver.Resolve(type).Select(x => x.PropertyInfo).ToArray();

            Assert.Equal(type.GetProperties().Skip(2).ToArray(), props);
        }
Example #5
0
        public AssemblyInfo(CustomResolver resolver, string url, byte[] assembly, byte[] pdb)
        {
            this.id = Interlocked.Increment(ref next_id);

            try
            {
                Url = url;
                ReaderParameters rp = new ReaderParameters(/*ReadingMode.Immediate*/);
                rp.AssemblyResolver = resolver;
                // set ReadSymbols = true unconditionally in case there
                // is an embedded pdb then handle ArgumentException
                // and assume that if pdb == null that is the cause
                rp.ReadSymbols          = true;
                rp.SymbolReaderProvider = new PdbReaderProvider();
                if (pdb != null)
                {
                    rp.SymbolStream = new MemoryStream(pdb);
                }
                rp.ReadingMode = ReadingMode.Immediate;

                this.image = ModuleDefinition.ReadModule(new MemoryStream(assembly), rp);
            }
            catch (BadImageFormatException ex)
            {
                logger.LogWarning($"Failed to read assembly as portable PDB: {ex.Message}");
            }
            catch (ArgumentException)
            {
                // if pdb == null this is expected and we
                // read the assembly without symbols below
                if (pdb != null)
                {
                    throw;
                }
            }

            if (this.image == null)
            {
                ReaderParameters rp = new ReaderParameters(/*ReadingMode.Immediate*/);
                rp.AssemblyResolver = resolver;
                if (pdb != null)
                {
                    rp.ReadSymbols          = true;
                    rp.SymbolReaderProvider = new PdbReaderProvider();
                    rp.SymbolStream         = new MemoryStream(pdb);
                }

                rp.ReadingMode = ReadingMode.Immediate;

                this.image = ModuleDefinition.ReadModule(new MemoryStream(assembly), rp);
            }
            if (this.image != null)
            {
                resolver.RegisterAssembly(this.image.Assembly);
            }
            Populate();
        }
Example #6
0
        private static void ConfigureServices(IKernel kernel, HttpConfiguration configuration)
        {
            var resolver = new CustomResolver(() => GetControllerTypes(kernel));

            configuration.Services.Replace(typeof(IAssembliesResolver), resolver);
            configuration.Services.Replace(typeof(IHttpControllerTypeResolver), resolver);

            configuration.Services.Add(typeof(IExceptionLogger), new ExceptionLogger(kernel.Resolve <ILogger>()));

            configuration.DependencyResolver = new CustomDependencyResolver(kernel, configuration.DependencyResolver);
        }
Example #7
0
    protected override void Awake()
    {
        base.Awake();

        CustomResolver.Register(GeneratedResolver.Instance);

        _client = GetComponent <NetClientP2pBehaviour>();
        _client.SetClientOptionFunc = (clientOption) =>
        {
        };
    }
Example #8
0
        public void Resolves_WithCustom()
        {
            // Arrange
            var resolver = new CustomResolver();
            var type     = typeof(Foo);

            // Act
            var props = resolver.ResolveProperties(type).ToArray();

            // Assert
            Assert.Equal(type.GetProperties().Skip(2).ToArray(), props);
        }
    public static void Main(String[] args)
    {
        if (!SBMLExtensionRegistry.isPackageEnabled("comp"))
        {
          Console.WriteLine("This copy of libSBML does not contain the 'comp' extension");
          Console.WriteLine("Unable to proceed with the resolver example the model.");
          Environment.Exit(2);
        }

        // create custom resolver
        CustomResolver resolver = new CustomResolver();

        // add the resolver and store its index, so we can free it later.
        int index = SBMLResolverRegistry.getInstance().addResolver(resolver);

        // create a new document with comp enabled
        SBMLDocument doc = new SBMLDocument(new CompPkgNamespaces());

        // get a hold of a plugin object
        CompSBMLDocumentPlugin plugin = (CompSBMLDocumentPlugin)doc.getPlugin("comp");

        // create an external model definition
        ExternalModelDefinition external = plugin.createExternalModelDefinition();

        // set the source to the URI
        external.setSource("http://www.ebi.ac.uk/biomodels-main/download?mid=BMID000000063853");

        // resolve the model
        Model model = external.getReferencedModel();

        if (model == null)
        {
          Console.Error.WriteLine("couldn't resolve");
          Environment.Exit(2);
        }

        // model is ready to be used now, however, only as long and the document
        // holding the external model definition is still alive and referenced

        Console.WriteLine("Model id: " + model.getId());
        Console.WriteLine("# species: " + model.getNumSpecies());
        Console.WriteLine("# reactions: " + model.getNumReactions());

        // now that we are done get rid of the resolver
        SBMLResolverRegistry.getInstance().removeResolver(index);
        // also clear the resolver instance, just to be sure that it has
        // no more references to the C# resolver
        SBMLResolverRegistry.deleteResolerRegistryInstance();

        // finally we can get rid of the C# resolver
        resolver = null;
    }
    public static void Main(String[] args)
    {
        if (!SBMLExtensionRegistry.isPackageEnabled("comp"))
        {
            Console.WriteLine("This copy of libSBML does not contain the 'comp' extension");
            Console.WriteLine("Unable to proceed with the resolver example the model.");
            Environment.Exit(2);
        }

        // create custom resolver
        CustomResolver resolver = new CustomResolver();

        // add the resolver and store its index, so we can free it later.
        int index = SBMLResolverRegistry.getInstance().addResolver(resolver);

        // create a new document with comp enabled
        SBMLDocument doc = new SBMLDocument(new CompPkgNamespaces());

        // get a hold of a plugin object
        CompSBMLDocumentPlugin plugin = (CompSBMLDocumentPlugin)doc.getPlugin("comp");

        // create an external model definition
        ExternalModelDefinition external = plugin.createExternalModelDefinition();

        // set the source to the URI
        external.setSource("http://www.ebi.ac.uk/biomodels-main/download?mid=BMID000000063853");

        // resolve the model
        Model model = external.getReferencedModel();

        if (model == null)
        {
            Console.Error.WriteLine("couldn't resolve");
            Environment.Exit(2);
        }

        // model is ready to be used now, however, only as long and the document
        // holding the external model definition is still alive and referenced

        Console.WriteLine("Model id: " + model.getId());
        Console.WriteLine("# species: " + model.getNumSpecies());
        Console.WriteLine("# reactions: " + model.getNumReactions());

        // now that we are done get rid of the resolver
        SBMLResolverRegistry.getInstance().removeResolver(index);
        // also clear the resolver instance, just to be sure that it has
        // no more references to the C# resolver
        SBMLResolverRegistry.deleteResolerRegistryInstance();

        // finally we can get rid of the C# resolver
        resolver = null;
    }
Example #11
0
        public void TestGenericNetDataObject()
        {
            // 생성된 리졸버를 등록시켜줘야 함
            CustomResolver.Register(GeneratedResolver.Instance);

            GenericDataClass <string> data = new GenericDataClass <string>()
            {
                GenericValue = "generic_test"
            };

            var deserializeObject = TestBase <GenericDataClass <string> >(data);

            Assert.AreEqual(data.GenericValue, deserializeObject.GenericValue);
        }
Example #12
0
        public void ExportedTypeFromModule()
        {
            var resolver   = new CustomResolver();
            var parameters = new ReaderParameters {
                AssemblyResolver = resolver
            };
            var mma = GetResourceModule("mma.exe", parameters);

            resolver.Register(mma.Assembly);

            using (var current_module = GetCurrentModule(parameters)) {
                var reference = new TypeReference("Module.A", "Foo", current_module, AssemblyNameReference.Parse(mma.Assembly.FullName), false);

                var definition = reference.Resolve();
                Assert.IsNotNull(definition);
                Assert.AreEqual("Module.A.Foo", definition.FullName);
            }
        }
Example #13
0
    protected override void Awake()
    {
        base.Awake();

        _client = GetComponent <NetClientP2pBehaviour>();

        Client.OnConnected      = OnConnected;
        Client.OnClosed         = OnClosed;
        Client.OnReceived       = OnReceive;
        Client.OnP2pGroupLeaved = OnP2pGroupLeave;

        // 릴레이 테스트를 위한 옵션
        //_client.Client.ClientOption.IsForceRelay = true;

        // 자동으로 생성된 Rpc 서비스를 사용하기 위해 등록함
        Client.AddRpcService(new ActorViewRpcServiceView());
        Client.AddRpcService(new ActorScaleRpcServiceView());

        CustomResolver.Register(GeneratedResolver.Instance);
    }
Example #14
0
        public static IStructureDefinitionSummaryProvider CreateCustomSchemaProvider(params StructureDefinition[] customSds)
        {
            #region Create a SchemaProvider that knows about custom SDs
            var canonicalSdDict = customSds.ToDictionary(sd => sd.Url, sd => sd);
            var customResolver  = new CustomResolver(canonicalSdDict);

            var typeCanonicalDict = customSds.ToDictionary(sd => sd.Type, sd => sd.Url);
            bool mapTypeName(string typename, out string canonical)
            {
                if (!typeCanonicalDict.TryGetValue(typename, out canonical))
                {
                    canonical = VonkConstants.Canonical.FhirCoreCanonicalBase + "/" + typename;
                }
                return(true);
            }

            var provider = new StructureDefinitionSummaryProvider(customResolver, mapTypeName);
            return(provider);

            #endregion
        }
Example #15
0
        public void TypeForwarder()
        {
            var resolver   = new CustomResolver();
            var parameters = new ReaderParameters {
                AssemblyResolver = resolver
            };

            var types = ModuleDefinition.ReadModule(
                CompilationService.CompileResource(GetCSharpResourcePath("CustomAttributes.cs", typeof(ResolveTests).Assembly)),
                parameters);

            resolver.Register(types.Assembly);

            var current_module = GetCurrentModule(parameters);
            var reference      = new TypeReference("System.Diagnostics", "DebuggableAttribute", current_module, AssemblyNameReference.Parse(types.Assembly.FullName), false);

            var definition = reference.Resolve();

            Assert.IsNotNull(definition);
            Assert.AreEqual("System.Diagnostics.DebuggableAttribute", definition.FullName);
            Assert.AreEqual("mscorlib", definition.Module.Assembly.Name.Name);
        }
        public void Resolves_WithCustom()
        {
            // Arrange
            var resolver = new CustomResolver();
            var type     = typeof(Foo);

            // Act
            var props = resolver.ResolveProperties(type).ToArray();

            // Assert
            Assert.Collection(props,
                              x => Assert.Equal(x, type.GetProperty("String")),
                              x => Assert.Equal(x, type.GetProperty("Guid")),
                              x => Assert.Equal(x, type.GetProperty("Decimal")),
                              x => Assert.Equal(x, type.GetProperty("Double")),
                              x => Assert.Equal(x, type.GetProperty("Float")),
                              x => Assert.Equal(x, type.GetProperty("DateTime")),
                              x => Assert.Equal(x, type.GetProperty("DateTimeOffset")),
                              x => Assert.Equal(x, type.GetProperty("Timespan")),
                              x => Assert.Equal(x, type.GetProperty("Bytes"))
                              );
        }
Example #17
0
        public void TestNetDataObject()
        {
            // 생성된 리졸버를 등록시켜줘야 함
            CustomResolver.Register(GeneratedResolver.Instance);

            DataClass data = new DataClass()
            {
                Int            = 123,
                String         = "456",
                Property       = 789,
                IgnoreInt      = 999998,
                IgnoreProperty = 999999
            };

            var deserializeObject = TestBase <DataClass>(data);

            Assert.AreEqual(data.Int, deserializeObject.Int);
            Assert.AreEqual(data.String, deserializeObject.String);
            Assert.AreEqual(data.Property, deserializeObject.Property);

            Assert.AreNotEqual(data.IgnoreInt, deserializeObject.IgnoreInt);
            Assert.AreNotEqual(data.IgnoreProperty, deserializeObject.IgnoreProperty);
        }
Example #18
0
        public void NestedTypeForwarder()
        {
            var resolver   = new CustomResolver();
            var parameters = new ReaderParameters {
                AssemblyResolver = resolver
            };

            var types = ModuleDefinition.ReadModule(
                CompilationService.CompileResource(GetCSharpResourcePath("CustomAttributes.cs")),
                parameters);

            resolver.Register(types.Assembly);

            var current_module = GetCurrentModule(parameters);
            var reference      = new TypeReference("", "DebuggingModes", current_module, null, true);

            reference.DeclaringType = new TypeReference("System.Diagnostics", "DebuggableAttribute", current_module, AssemblyNameReference.Parse(types.Assembly.FullName), false);

            var definition = reference.Resolve();

            Assert.IsNotNull(definition);
            Assert.AreEqual("System.Diagnostics.DebuggableAttribute/DebuggingModes", definition.FullName);
            Assert.AreEqual(Platform.OnCoreClr ? "System.Private.CoreLib" : "mscorlib", definition.Module.Assembly.Name.Name);
        }
Example #19
0
        public override void WriteJson(JsonWriter writer, Entity value, JsonSerializer serializer)
        {
            var obj = new JObject();

            obj.Add("Name", value.name);

            CustomResolver.WriteFields(value, obj, serializer);

            var isDirty = false;

            foreach (var extensions in value.gameObject.GetComponents <Extension>().GroupBy(x => x.GetType()))
            {
                // if (ToExport.Contains(extensions.Key))
                // {
                obj.Add(extensions.Key.Name, JToken.FromObject(extensions, serializer));
                isDirty = true;
                // }
            }

            if (isDirty)
            {
                obj.WriteTo(writer);
            }
        }
 public custom_resolver()
 {
     _customResolver = new CustomResolver();
     _host           = new InMemoryHost(() => {}, _customResolver);
 }
Example #21
0
 public HTTPWebServiceRequest()
 {
     QueryStringParams = new Dictionary <string, string>();
     Headers           = new Dictionary <string, string>();
     Resolver          = new CustomResolver();
 }
Example #22
0
        public async Task Test(
            [Values(1)] int clientCount,
            [Values(2)] int sendCount,
            [Values(false)] bool isServiceUdp)
        {
            CustomResolver.Register(GeneratedResolver.Instance);

            var serverTcs = new TaskCompletionSource <string>();

            NetServer server = new NetServer(
                new ServerOption()
            {
                Name          = "TestServer",
                TcpServerPort = 9000,
                IsServiceUdp  = isServiceUdp,
                UdpServerPort = 9001,
                TcpBackLog    = Math.Max(clientCount, 512),
                MaxSession    = clientCount,
            });

            server.AddRpcService(new GreeterService());

            server.OnSessionErrored += (ISession session, Exception ex) =>
            {
                serverTcs.TrySetException(ex);
                Assert.Fail(ex.ToString());
            };

            await server.StartAsync();

            Assert.AreEqual("Started", server.State.ToString());

            List <Task <NetClient> > taskList = new List <Task <NetClient> >();

            for (int i = 0; i < clientCount; i++)
            {
                taskList.Add(WorkClient(isServiceUdp, sendCount));
            }

            await server.SessionManager.InvokeAllSessionAsync(async (ISession session) =>
            {
                var rpc = new GreeterRpc(session);

                var result = await rpc.Greet("Greet client!");
                Console.WriteLine(result);

                result = await rpc.Greet("Greet client!");
                Console.WriteLine(result);
            });

            await Task.WhenAny(Task.WhenAll(taskList), serverTcs.Task);

            Assert.AreEqual(clientCount, server.SessionCount);

            foreach (var task in taskList)
            {
                task.Result.Close();
            }

            await Task.Delay(1000);

            Assert.AreEqual(0, server.SessionCount);

            await server.StopAsync();

            await Task.Delay(1000);

            Assert.AreEqual("Stopped", server.State.ToString());
            Console.WriteLine(server.Statistic.ToString());

            Console.WriteLine(NetPool.BufferPool.ToString());

            Assert.Pass();
        }
Example #23
0
 public ServiceRequest(string url, CustomResolver resolver) : this(url)
 {
     this.resolver = resolver;
 }
Example #24
0
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            //Getting the id to check if it is an Add or an edit as they are managed within the same form.
            string id = e.ExtraParams["id"];

            string obj  = e.ExtraParams["values"];
            string addr = e.ExtraParams["address"];
            Branch b    = JsonConvert.DeserializeObject <Branch>(obj);

            b.managerId = managerId.Value.ToString();

            b.isInactive   = isInactive.Checked;
            b.activeStatus = isInactive.Checked ? Convert.ToInt16(ActiveStatus.INACTIVE) : Convert.ToInt16(ActiveStatus.ACTIVE);
            b.recordId     = id;
            // Define the object to add or edit as null
            CustomResolver res = new CustomResolver();

            res.AddRule("naId", "countryId");
            res.AddRule("stId", "stateId");
            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.ContractResolver = res;
            b.caName = caId.SelectedItem.Text;
            AddressBook add = JsonConvert.DeserializeObject <AddressBook>(addr, settings);

            if (string.IsNullOrEmpty(add.city) && string.IsNullOrEmpty(add.countryId) && string.IsNullOrEmpty(add.street1) && string.IsNullOrEmpty(add.stateId) && string.IsNullOrEmpty(add.phone))
            {
                b.address = null;
            }
            else
            {
                if (string.IsNullOrEmpty(add.city) || string.IsNullOrEmpty(add.countryId) || string.IsNullOrEmpty(add.street1) || string.IsNullOrEmpty(add.stateId) || string.IsNullOrEmpty(add.phone))
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, GetLocalResourceObject("ErrorAddressMissing")).Show();
                    return;
                }
                b.address          = JsonConvert.DeserializeObject <AddressBook>(addr, settings);
                b.address.recordId = address.Text;
            }

            if (string.IsNullOrEmpty(branchId.Text))
            {
                try
                {
                    //New Mode
                    //Step 1 : Fill The object and insert in the store
                    PostRequest <Branch> request = new PostRequest <Branch>();
                    request.entity = b;
                    PostResponse <Branch> r = _branchService.ChildAddOrUpdate <Branch>(request);
                    b.recordId = r.recordId;

                    //check if the insert failed
                    if (!r.Success)//it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", r.ErrorCode) != null ? GetGlobalResourceObject("Errors", r.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + r.LogId :r.Summary).Show();
                        return;
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(branchId.Text))
                        {
                            //this.Store1.Insert(0, b);


                            this.EditRecordWindow.Close();
                            //RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                            //sm.DeselectAll();
                            //sm.Select(b.recordId.ToString());
                        }

                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });
                        //Add this record to the store
                        managerId.Disabled = false;

                        //Display successful notification
                        branchId.Text = b.recordId;
                        Store1.Reload();
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }
            else
            {
                //Update Mode

                try
                {
                    int index = Convert.ToInt32(branchId.Text);//getting the id of the record
                    PostRequest <Branch> request = new PostRequest <Branch>();
                    b.recordId     = branchId.Text;
                    request.entity = b;
                    PostResponse <Branch> r = _branchService.ChildAddOrUpdate <Branch>(request);                      //Step 1 Selecting the object or building up the object for update purpose

                    //Step 2 : saving to store

                    //Step 3 :  Check if request fails
                    if (!r.Success)//it maybe another check
                    {
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);
                        return;
                    }
                    else
                    {
                        ModelProxy record = this.Store1.GetById(index);
                        record.Set("caName", b.caName);
                        BasicInfoTab.UpdateRecord(record);

                        record.Commit();
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordUpdatedSucc
                        });

                        //    this.EditRecordWindow.Close();
                    }
                }
                catch (Exception ex)
                {
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorUpdatingRecord).Show();
                }
            }
        }
Example #25
0
        public bool ProcessFile(string sourceFile, string targetFile = "")
        {
            bool result = false;

            if (string.IsNullOrEmpty(targetFile))
            {
                targetFile = sourceFile;
            }

            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            try
            {
                using (var module = CustomResolver.LoadMainModule(sourceFile))
                {
                    if (WriteSymbols)
                    {
                        module.ReadSymbols();
                    }

                    Assembly = module.Assembly;

                    var resolver   = module.AssemblyResolver;
                    var trinityRef = module.AssemblyReferences.Where(x => x.Name == "Semiodesk.Trinity").FirstOrDefault();
                    if (trinityRef == null)
                    {
                        Log.LogMessage("Reference to Semiodesk.Trinity not found. Stopping ImplementRdfMapping...");
                        return(true);
                    }
                    var trinity = resolver.Resolve(trinityRef);

                    PropertyMapping = trinity.MainModule.Types.Where(b => b.FullName == "Semiodesk.Trinity.PropertyMapping`1").FirstOrDefault();


                    Log.LogMessage("------ Begin Task: ImplementRdfMapping [{0}]", Assembly.Name);

                    bool assemblyModified = false;

                    // Iterate over all types in the main assembly.
                    foreach (TypeDefinition type in Assembly.MainModule.Types)
                    {
                        // In the following we need to seperate between properties which have the following attribute combinations:
                        //  - PropertyAttribute with PropertyChangedAttribute
                        //  - PropertyAttribute without PropertyChangedAttribute
                        //  - PropertyChangedAttribute only
                        HashSet <PropertyDefinition> mapping   = type.GetPropertiesWithAttribute("RdfPropertyAttribute").ToHashSet();
                        HashSet <PropertyDefinition> notifying = type.GetPropertiesWithAttribute("NotifyPropertyChangedAttribute").ToHashSet();

                        // Implement the GetTypes()-method for the given type.
                        if (mapping.Any() || type.TryGetCustomAttribute("RdfClassAttribute").Any())
                        {
                            ImplementRdfClassTask implementClass = new ImplementRdfClassTask(this, type);
                            if (implementClass.CanExecute())
                            {
                                // RDF types _must_ be implemented for classes with mapped properties.
                                assemblyModified = implementClass.Execute();
                            }
                        }

                        // Properties which do not raise the PropertyChanged-event can be implemented using minimal IL code.
                        if (mapping.Any())
                        {
                            var implementProperty = new ImplementRdfPropertyTask(this, type);

                            foreach (PropertyDefinition p in mapping.Except(notifying).Where(implementProperty.CanExecute))
                            {
                                assemblyModified = implementProperty.Execute(p);
                            }
                        }

                        // Properties which raise the PropertyChanged-event may also have the RdfProperty attribute.
                        if (notifying.Any())
                        {
                            var implementPropertyChanged = new ImplementNotifyPropertyChangedTask(this, type);

                            foreach (PropertyDefinition p in notifying.Where(implementPropertyChanged.CanExecute))
                            {
                                implementPropertyChanged.IsMappedProperty = mapping.Contains(p);

                                assemblyModified = implementPropertyChanged.Execute(p);
                            }
                        }
                    }

                    if (assemblyModified)
                    {
                        var param = new WriterParameters {
                            WriteSymbols = WriteSymbols
                        };

                        FileInfo sourceDll = new FileInfo(sourceFile);
                        FileInfo targetDll = new FileInfo(targetFile);

                        if (sourceDll.FullName != targetDll.FullName)
                        {
                            Assembly.Write(targetDll.FullName, param);
                        }
                        else
                        {
                            Assembly.Write(param);
                        }
                    }

                    result = true;
                }
            }
            catch (Exception ex)
            {
                Log.LogError(ex.ToString());

                result = false;
            }

            stopwatch.Stop();

            Log.LogMessage("------ End Task: ImplementRdfMapping [Total time: {0}s]", stopwatch.Elapsed.TotalSeconds);

            return(result);
        }
Example #26
0
 protected override void SetUp()
 {
     _customResolver = new CustomResolver();
     _host           = new InMemoryHost(null, _customResolver);
 }
 protected override void SetUp()
 {
     _customResolver = new CustomResolver();
     _host = new InMemoryHost(null, _customResolver);
 }
Example #28
0
 public DebugStore(ILogger logger, HttpClient client)
 {
     this.client   = client;
     this.logger   = logger;
     this.resolver = new CustomResolver();
 }
 public CustomResolver(CustomResolver orig)
     : base(orig)
 {
 }
 public CustomResolver(CustomResolver orig)
     : base(orig)
 {
 }
 public AuthenticatedServiceRequest(string url, CustomResolver res) : base(url, res)
 {
 }
Example #32
0
        public SimpleCRUD() : base()
        {
            var resolver = new CustomResolver();

            SimpleCRUD.SetTableNameResolver(resolver);
        }
        protected void SaveNewRecord(object sender, DirectEventArgs e)
        {
            try
            {
                //Getting the id to check if it is an Add or an edit as they are managed within the same form.

                string obj = e.ExtraParams["values"];


                JsonSerializerSettings settings = new JsonSerializerSettings();
                CustomResolver         res      = new CustomResolver();
                //  res.AddRule("leaveRequest1_employeeId", "employeeId");
                //res.AddRule("leaveRequest1_ltId", "ltId");
                // res.AddRule("leaveRequest1_status", "status");
                settings.ContractResolver = res;
                LeaveReplacementApproval b = JsonConvert.DeserializeObject <LeaveReplacementApproval>(obj, settings);
                b.apStatus = Convert.ToInt16(LeaveApprovalStatusControl.GetApprovalStatus());
                //  b.leaveDays = Convert.ToDouble(leaveDaysField.Text);
                //b.status = Convert.ToInt16(status1);
                string id = e.ExtraParams["id"];
                // Define the object to add or edit as null
                if (!b.isPaid.HasValue)
                {
                    b.isPaid = false;
                }

                if (employeeId.SelectedItem != null)
                {
                    b.employeeName = employeeId.SelectedItem.Text;
                }
                if (ltId.SelectedItem != null)
                {
                    b.ltName = ltId.SelectedItem.Text;
                }

                //List<LeaveDay> days = GenerateLeaveDays(e.ExtraParams["days"]);



                try
                {
                    LeaveReturnRecordRequest rec = new LeaveReturnRecordRequest();
                    rec.leaveId = CurrentLeaveId.Text;
                    RecordResponse <LeaveReplacementApproval> recordResponse = _selfServiceService.ChildGetRecord <LeaveReplacementApproval>(rec);


                    if (!recordResponse.Success)
                    {
                        Common.errorMessage(recordResponse);
                        return;
                    }
                    PostRequest <LeaveReplacementApproval> request = new PostRequest <LeaveReplacementApproval>();

                    request.entity = recordResponse.result;
                    request.entity.replApStatus = apStatus.GetApprovalStatus();
                    PostResponse <LeaveReplacementApproval> r = _selfServiceService.ChildAddOrUpdate <LeaveReplacementApproval>(request);


                    //check if the insert failed
                    if (!r.Success)    //it maybe be another condition
                    {
                        //Show an error saving...
                        X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                        Common.errorMessage(r);;
                        return;
                    }
                    else
                    {
                        b.recordId = r.recordId;

                        Store1.Reload();


                        //Display successful notification
                        Notification.Show(new NotificationConfig
                        {
                            Title = Resources.Common.Notification,
                            Icon  = Icon.Information,
                            Html  = Resources.Common.RecordSavingSucc
                        });


                        //RecordRequest rec = new RecordRequest();
                        //rec.RecordID = b.recordId;
                        //RecordResponse<LeaveRequest> recordResponse = _leaveManagementService.ChildGetRecord<LeaveRequest>(rec);
                        //if (!recordResponse.Success)
                        //{
                        //    X.Msg.Alert(Resources.Common.Error, recordResponse.Summary).Show();
                        //    return;
                        //}
                        //leaveRef.Text = recordResponse.result.leaveRef;
                        //this.EditRecordWindow.Close();
                        //SetTabPanelEnabled(true);
                        //////RowSelectionModel sm = this.GridPanel1.GetSelectionModel() as RowSelectionModel;
                        //////sm.DeselectAll();
                        //////sm.Select(b.recordId.ToString());
                    }
                }
                catch (Exception ex)
                {
                    //Error exception displaying a messsage box
                    X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                    X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorSavingRecord).Show();
                }
            }



            catch (Exception exp)
            {
                X.Msg.Alert(Resources.Common.Error, exp.Message).Show();
            }
        }