Example #1
0
 private static void IsHostNameSingleSeat(string serverName, IEnumerable<string> hosts)
 {
   foreach (string name in hosts)
   {                            
     _isSingleSeat = (serverName.Equals(name, StringComparison.CurrentCultureIgnoreCase));              
     Log.Debug("Common.IsSingleSeat:  Checking against {0} - result={1}", name, _isSingleSeat);
     if (_isSingleSeat.GetValueOrDefault(false))
     {
       break;
     }
   }
 }   
        private static bool IsLocal()
        {
            if (isLocal.HasValue)
                return isLocal.GetValueOrDefault();

            var masterNodeName = Configure.Instance.GetMasterNode();
            if (string.IsNullOrWhiteSpace(masterNodeName))
            {
                isLocal = true;
                return true;
            }
            isLocal = ConfigureDistributor.IsLocalIpAddress(masterNodeName);
            return isLocal.GetValueOrDefault();
        }
        static void Main(string[] args)
        {
            var client = new DicomClient();

            client.NegotiateAsyncOps();

            // Find a list of Studies

            var request = CreateStudyRequestByPatientName("Tester^P*");

            var studyUids = new List <string>();

            request.OnResponseReceived += (req, response) =>
            {
                DebugStudyResponse(response);
                studyUids.Add(response.Dataset?.GetSingleValue <string>(DicomTag.StudyInstanceUID));
            };
            client.AddRequest(request);
            client.Send(QRServerHost, QRServerPort, false, AET, QRServerAET);

            // find all series from a study that previous was returned

            var studyUID = studyUids[0];

            request = CreateSeriesRequestByStudyUID(studyUID);
            var serieUids = new List <string>();

            request.OnResponseReceived += (req, response) =>
            {
                DebugSerieResponse(response);
                serieUids.Add(response.Dataset?.GetSingleValue <string>(DicomTag.SeriesInstanceUID));
            };
            client.AddRequest(request);
            client.SendAsync(QRServerHost, QRServerPort, false, AET, QRServerAET).Wait();

            // now get all the images of a serie with cGet in the same association

            client = new DicomClient();
            var cGetRequest = CreateCGetBySeriesUID(studyUID, serieUids.First());

            client.OnCStoreRequest += (DicomCStoreRequest req) =>
            {
                Console.WriteLine(DateTime.Now.ToString() + " recived");
                SaveImage(req.Dataset);
                return(new DicomCStoreResponse(req, DicomStatus.Success));
            };
            // the client has to accept storage of the images. We know that the requested images are of SOP class Secondary capture,
            // so we add the Secondary capture to the additional presentation context
            // a more general approach would be to mace a cfind-request on image level and to read a list of distinct SOP classes of all
            // the images. these SOP classes shall be added here.
            var pcs = DicomPresentationContext.GetScpRolePresentationContextsFromStorageUids(
                DicomStorageCategory.Image,
                DicomTransferSyntax.ExplicitVRLittleEndian,
                DicomTransferSyntax.ImplicitVRLittleEndian,
                DicomTransferSyntax.ImplicitVRBigEndian);

            client.AdditionalPresentationContexts.AddRange(pcs);
            client.AddRequest(cGetRequest);
            client.Send(QRServerHost, QRServerPort, false, AET, QRServerAET);

            // if the images shall be sent to an existing storescp and this storescp is configured on the QR SCP then a CMove could be performed:

            // here we want to see how a error case looks like - because the test QR Server does not know the node FODICOMSCP
            client = new DicomClient();
            var  cMoveRequest     = CreateCMoveByStudyUID("STORESCP", studyUID);
            bool?moveSuccessfully = null;

            cMoveRequest.OnResponseReceived += (DicomCMoveRequest requ, DicomCMoveResponse response) =>
            {
                if (response.Status.State == DicomState.Pending)
                {
                    Console.WriteLine("Sending is in progress. please wait: " + response.Remaining.ToString());
                }
                else if (response.Status.State == DicomState.Success)
                {
                    Console.WriteLine("Sending successfully finished");
                    moveSuccessfully = true;
                }
                else if (response.Status.State == DicomState.Failure)
                {
                    Console.WriteLine("Error sending datasets: " + response.Status.Description);
                    moveSuccessfully = false;
                }
                Console.WriteLine(response.Status);
            };
            client.AddRequest(cMoveRequest);
            client.Send(QRServerHost, QRServerPort, false, AET, QRServerAET);

            if (moveSuccessfully.GetValueOrDefault(false))
            {
                Console.WriteLine("images sent successfully");
                // images sent successfully from QR Server to the store scp
            }
            Console.ReadLine();
        }
Example #4
0
        private async void UiScanButton_Clicked(object sender, EventArgs e)
        {
            bool connected = false;

            if (!_isScanning)
            {
                _isScanning            = true;
                UiScanButton.IsEnabled = !_isScanning;
                App.ShowToast("Scanning for BLE devices...");

                _hasLocationPermission = await CheckLocationPermission(_hasLocationPermission);

                if (_hasLocationPermission.GetValueOrDefault(false))
                {
                    _bleDevice = null;
                    var scanCompletionSource = new TaskCompletionSource <bool>();

                    _adapter.DeviceDiscovered += async(o, eventArgs) =>
                    {
                        if (!String.IsNullOrWhiteSpace(eventArgs.Device.Name) && eventArgs.Device.Name.Contains(DeviceToLookFor))
                        {
                            Debug.WriteLine($"Bluetooth LE device found: {eventArgs.Device.Name}");
                            if (await RegisterBleDevice(eventArgs.Device))
                            {
                                App.ShowToast("Status: Device successfully connected!");
                                await _adapter.StopScanningForDevicesAsync();

                                await Task.Delay(3000);

                                scanCompletionSource.SetResult(true);
                            }
                        }
                    };

                    _adapter.ScanTimeoutElapsed += (o, args) =>
                    {
                        Debug.WriteLine("Scan timed out.");
                        scanCompletionSource.SetResult(false);
                    };

                    _adapter.ScanMode    = ScanMode.Balanced;
                    _adapter.ScanTimeout = 10000; //Should be 10 seconds

                    await _adapter.StartScanningForDevicesAsync();

                    connected = await scanCompletionSource.Task;
                    if (_bleDevice == null)
                    {
                        App.ShowToast("Status: No device found.");
                        await Task.Delay(5000);
                    }
                }
            }
            ;

            _isScanning = false;
            if (connected)
            {
                UiScanButtonContainer.IsVisible = false;
                UiButtonsContainer.IsVisible    = true;
                ResetButtonColors(DefaultButtonColor, true);
            }
            else
            {
                UiScanButton.IsEnabled = !_isScanning;
                App.ShowToast("Done scanning.");
            }
        }
        private static void ImportIntoCurrentDatabase(EcasAction a, EcasContext ctx)
        {
            PwDatabase pd = Program.MainForm.ActiveDatabase;

            if ((pd == null) || !pd.IsOpen)
            {
                return;
            }

            string strPath = EcasUtil.GetParamString(a.Parameters, 0, true);

            if (string.IsNullOrEmpty(strPath))
            {
                return;
            }
            IOConnectionInfo ioc = IOConnectionInfo.FromPath(strPath);

            string strFormat = EcasUtil.GetParamString(a.Parameters, 1, true);

            if (string.IsNullOrEmpty(strFormat))
            {
                return;
            }
            FileFormatProvider ff = Program.FileFormatPool.Find(strFormat);

            if (ff == null)
            {
                throw new Exception(KPRes.Unknown + ": " + strFormat);
            }

            uint          uMethod = EcasUtil.GetParamUInt(a.Parameters, 2);
            Type          tMM     = Enum.GetUnderlyingType(typeof(PwMergeMethod));
            object        oMethod = Convert.ChangeType(uMethod, tMM);
            PwMergeMethod mm      = PwMergeMethod.None;

            if (Enum.IsDefined(typeof(PwMergeMethod), oMethod))
            {
                mm = (PwMergeMethod)oMethod;
            }
            else
            {
                Debug.Assert(false);
            }
            if (mm == PwMergeMethod.None)
            {
                mm = PwMergeMethod.CreateNewUuids;
            }

            CompositeKey cmpKey = KeyFromParams(a, 3, 4, 5);

            if ((cmpKey == null) && ff.RequiresKey)
            {
                KeyPromptForm kpf = new KeyPromptForm();
                kpf.InitEx(ioc, false, true);

                if (UIUtil.ShowDialogNotValue(kpf, DialogResult.OK))
                {
                    return;
                }

                cmpKey = kpf.CompositeKey;
                UIUtil.DestroyForm(kpf);
            }

            bool?b = true;

            try { b = ImportUtil.Import(pd, ff, ioc, mm, cmpKey); }
            finally
            {
                if (b.GetValueOrDefault(false))
                {
                    Program.MainForm.UpdateUI(false, null, true, null, true, null, true);
                }
            }
        }
Example #6
0
        /// <summary>
        /// Parse a message element.  Its data is added to parameter `ddmap`.
        /// </summary>
        /// <param name="node">a message, group, or component node</param>
        /// <param name="ddmap">the still-being-constructed DDMap for this node</param>
        /// <param name="componentRequired">
        /// If non-null, parsing is inside a component that is required (true) or not (false).
        /// If null, parser is not inside a component.
        /// </param>
        private void ParseMsgEl(XmlNode node, DDMap ddmap, bool?componentRequired)
        {
            /*
             * // This code is great for debugging DD parsing issues.
             * string s = "+ " + node.Name;  // node.Name is probably "message"
             * if (node.Attributes["name"] != null)
             *  s += " | " + node.Attributes["name"].Value;
             * Console.WriteLine(s);
             */

            string messageTypeName = (node.Attributes["name"] != null) ? node.Attributes["name"].Value : node.Name;

            if (!node.HasChildNodes)
            {
                return;
            }
            foreach (XmlNode childNode in node.ChildNodes)
            {
                /*
                 * // Continuation of code that's great for debugging DD parsing issues.
                 * s = "    + " + childNode.Name;  // childNode.Name is probably "field"
                 * if (childNode.Attributes["name"] != null)
                 *  s += " | " + childNode.Attributes["name"].Value;
                 * Console.WriteLine(s);
                 */

                VerifyChildNode(childNode, node);

                var nameAttribute = childNode.Attributes["name"].Value;

                switch (childNode.Name)
                {
                case "field":
                case "group":
                    if (FieldsByName.ContainsKey(nameAttribute) == false)
                    {
                        throw new DictionaryParseException(
                                  $"Field '{nameAttribute}' is not defined in <fields> section.");
                    }
                    DDField fld = FieldsByName[nameAttribute];

                    bool required = (childNode.Attributes["required"]?.Value == "Y") && componentRequired.GetValueOrDefault(true);

                    if (required)
                    {
                        ddmap.ReqFields.Add(fld.Tag);
                    }

                    if (ddmap.IsField(fld.Tag) == false)
                    {
                        ddmap.Fields.Add(fld.Tag, fld);
                    }

                    // if this is in a group whose delim is unset, then this must be the delim (i.e. first field)
                    if (ddmap is DDGrp ddGroup && ddGroup.Delim == 0)
                    {
                        ddGroup.Delim = fld.Tag;
                    }

                    if (childNode.Name == "group")
                    {
                        DDGrp grp = new DDGrp();
                        grp.NumFld = fld.Tag;
                        if (required)
                        {
                            grp.Required = true;
                        }

                        ParseMsgEl(childNode, grp);
                        ddmap.Groups.Add(fld.Tag, grp);
                    }
                    break;

                case "component":
                    XmlNode compNode = RootDoc.SelectSingleNode("//components/component[@name='" + nameAttribute + "']");
                    ParseMsgEl(compNode, ddmap, (childNode.Attributes["required"]?.Value == "Y"));
                    break;

                default:
                    throw new DictionaryParseException($"Malformed data dictionary: child node type should be one of {{field,group,component}} but is '{childNode.Name}' within parent '{node.Name}/{messageTypeName}'");
                }
            }
        }
Example #7
0
 public void ServerToggleClosed(bool?nowClosed = null)
 {
     SoundManager.PlayNetworkedAtPos(soundOnOpenOrClose, registerTile.WorldPositionServer, 1f, sourceObj: gameObject);
     ServerSetIsClosed(nowClosed.GetValueOrDefault(!IsClosed));
 }
Example #8
0
        XElement ExecuteAssembly(object consoleLock,
                                 XunitProjectAssembly assembly,
                                 bool serialize,
                                 bool needsXml,
                                 bool?parallelizeTestCollections,
                                 int?maxThreadCount,
                                 bool diagnosticMessages,
                                 bool noColor,
                                 AppDomainSupport?appDomains,
                                 bool failSkips,
                                 bool stopOnFail,
                                 XunitFilters filters,
                                 bool internalDiagnosticMessages)
        {
            if (cancel)
            {
                return(null);
            }

            var assemblyElement = needsXml ? new XElement("assembly") : null;

            try
            {
                if (!ValidateFileExists(consoleLock, assembly.AssemblyFilename) || !ValidateFileExists(consoleLock, assembly.ConfigFilename))
                {
                    return(null);
                }

                // Turn off pre-enumeration of theories, since there is no theory selection UI in this runner
                assembly.Configuration.PreEnumerateTheories        = false;
                assembly.Configuration.DiagnosticMessages         |= diagnosticMessages;
                assembly.Configuration.InternalDiagnosticMessages |= internalDiagnosticMessages;

                if (appDomains.HasValue)
                {
                    assembly.Configuration.AppDomain = appDomains;
                }

                // Setup discovery and execution options with command-line overrides
                var discoveryOptions = TestFrameworkOptions.ForDiscovery(assembly.Configuration);
                var executionOptions = TestFrameworkOptions.ForExecution(assembly.Configuration);
                executionOptions.SetStopOnTestFail(stopOnFail);
                if (maxThreadCount.HasValue)
                {
                    executionOptions.SetMaxParallelThreads(maxThreadCount);
                }
                if (parallelizeTestCollections.HasValue)
                {
                    executionOptions.SetDisableParallelization(!parallelizeTestCollections.GetValueOrDefault());
                }

                var assemblyDisplayName            = Path.GetFileNameWithoutExtension(assembly.AssemblyFilename);
                var diagnosticMessageSink          = DiagnosticMessageSink.ForDiagnostics(consoleLock, assemblyDisplayName, assembly.Configuration.DiagnosticMessagesOrDefault, noColor);
                var internalDiagnosticsMessageSink = DiagnosticMessageSink.ForInternalDiagnostics(consoleLock, assemblyDisplayName, assembly.Configuration.InternalDiagnosticMessagesOrDefault, noColor);
                var appDomainSupport   = assembly.Configuration.AppDomainOrDefault;
                var shadowCopy         = assembly.Configuration.ShadowCopyOrDefault;
                var longRunningSeconds = assembly.Configuration.LongRunningTestSecondsOrDefault;

                using (AssemblyHelper.SubscribeResolveForAssembly(assembly.AssemblyFilename, internalDiagnosticsMessageSink))
                    using (var controller = new XunitFrontController(appDomainSupport, assembly.AssemblyFilename, assembly.ConfigFilename, shadowCopy, diagnosticMessageSink: diagnosticMessageSink))
                        using (var discoverySink = new TestDiscoverySink(() => cancel))
                        {
                            // Discover & filter the tests
                            reporterMessageHandler.OnMessage(new TestAssemblyDiscoveryStarting(assembly, controller.CanUseAppDomains && appDomainSupport != AppDomainSupport.Denied, shadowCopy, discoveryOptions));

                            controller.Find(false, discoverySink, discoveryOptions);
                            discoverySink.Finished.WaitOne();

                            var testCasesDiscovered = discoverySink.TestCases.Count;
                            var filteredTestCases   = discoverySink.TestCases.Where(filters.Filter).ToList();
                            var testCasesToRun      = filteredTestCases.Count;

                            reporterMessageHandler.OnMessage(new TestAssemblyDiscoveryFinished(assembly, discoveryOptions, testCasesDiscovered, testCasesToRun));

                            // Run the filtered tests
                            if (testCasesToRun == 0)
                            {
                                completionMessages.TryAdd(Path.GetFileName(assembly.AssemblyFilename), new ExecutionSummary());
                            }
                            else
                            {
                                if (serialize)
                                {
                                    filteredTestCases = filteredTestCases.Select(controller.Serialize).Select(controller.Deserialize).ToList();
                                }

                                reporterMessageHandler.OnMessage(new TestAssemblyExecutionStarting(assembly, executionOptions));

                                IExecutionSink resultsSink = new DelegatingExecutionSummarySink(reporterMessageHandler, () => cancel, (path, summary) => completionMessages.TryAdd(path, summary));
                                if (assemblyElement != null)
                                {
                                    resultsSink = new DelegatingXmlCreationSink(resultsSink, assemblyElement);
                                }
                                if (longRunningSeconds > 0)
                                {
                                    resultsSink = new DelegatingLongRunningTestDetectionSink(resultsSink, TimeSpan.FromSeconds(longRunningSeconds), MessageSinkWithTypesAdapter.Wrap(diagnosticMessageSink));
                                }
                                if (failSkips)
                                {
                                    resultsSink = new DelegatingFailSkipSink(resultsSink);
                                }

                                controller.RunTests(filteredTestCases, resultsSink, executionOptions);
                                resultsSink.Finished.WaitOne();

                                reporterMessageHandler.OnMessage(new TestAssemblyExecutionFinished(assembly, executionOptions, resultsSink.ExecutionSummary));
                                if (stopOnFail && resultsSink.ExecutionSummary.Failed != 0)
                                {
                                    Console.WriteLine("Canceling due to test failure...");
                                    cancel = true;
                                }
                            }
                        }
            }
            catch (Exception ex)
            {
                failed = true;

                var e = ex;
                while (e != null)
                {
                    Console.WriteLine($"{e.GetType().FullName}: {e.Message}");

                    if (internalDiagnosticMessages)
                    {
                        Console.WriteLine(e.StackTrace);
                    }

                    e = e.InnerException;
                }
            }

            return(assemblyElement);
        }
Example #9
0
        static int RunProject(string defaultDirectory, XunitProject project, bool teamcity, bool appVeyor, bool showProgress, bool?parallelizeAssemblies, bool?parallelizeTestCollections, int?maxThreadCount)
        {
            XElement assembliesElement = null;
            var      xmlTransformers   = TransformFactory.GetXmlTransformers(project);
            var      needsXml          = xmlTransformers.Count > 0;
            var      consoleLock       = new object();

            if (!parallelizeAssemblies.HasValue)
            {
                parallelizeAssemblies = project.All(assembly => assembly.Configuration.ParallelizeAssembly ?? false);
            }

            if (needsXml)
            {
                assembliesElement = new XElement("assemblies");
            }

            var originalWorkingFolder = Directory.GetCurrentDirectory();

            using (AssemblyHelper.SubscribeResolve())
            {
                var clockTime = Stopwatch.StartNew();

                if (parallelizeAssemblies.GetValueOrDefault())
                {
                    var tasks   = project.Assemblies.Select(assembly => Task.Run(() => ExecuteAssembly(consoleLock, defaultDirectory, assembly, needsXml, teamcity, appVeyor, showProgress, parallelizeTestCollections, maxThreadCount, project.Filters)));
                    var results = Task.WhenAll(tasks).GetAwaiter().GetResult();
                    foreach (var assemblyElement in results.Where(result => result != null))
                    {
                        assembliesElement.Add(assemblyElement);
                    }
                }
                else
                {
                    foreach (var assembly in project.Assemblies)
                    {
                        var assemblyElement = ExecuteAssembly(consoleLock, defaultDirectory, assembly, needsXml, teamcity, appVeyor, showProgress, parallelizeTestCollections, maxThreadCount, project.Filters);
                        if (assemblyElement != null)
                        {
                            assembliesElement.Add(assemblyElement);
                        }
                    }
                }

                clockTime.Stop();

                if (completionMessages.Count > 0)
                {
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.WriteLine();
                    Console.WriteLine("=== TEST EXECUTION SUMMARY ===");
                    Console.ForegroundColor = ConsoleColor.Gray;

                    var totalTestsRun       = completionMessages.Values.Sum(summary => summary.Total);
                    var totalTestsFailed    = completionMessages.Values.Sum(summary => summary.Failed);
                    var totalTestsSkipped   = completionMessages.Values.Sum(summary => summary.Skipped);
                    var totalTime           = completionMessages.Values.Sum(summary => summary.Time).ToString("0.000s");
                    var totalErrors         = completionMessages.Values.Sum(summary => summary.Errors);
                    var longestAssemblyName = completionMessages.Keys.Max(key => key.Length);
                    var longestTotal        = totalTestsRun.ToString().Length;
                    var longestFailed       = totalTestsFailed.ToString().Length;
                    var longestSkipped      = totalTestsSkipped.ToString().Length;
                    var longestTime         = totalTime.Length;
                    var longestErrors       = totalErrors.ToString().Length;

                    foreach (var message in completionMessages.OrderBy(m => m.Key))
                    {
                        Console.WriteLine("   {0}  Total: {1}, Errors: {2}, Failed: {3}, Skipped: {4}, Time: {5}",
                                          message.Key.PadRight(longestAssemblyName),
                                          message.Value.Total.ToString().PadLeft(longestTotal),
                                          message.Value.Errors.ToString().PadLeft(longestErrors),
                                          message.Value.Failed.ToString().PadLeft(longestFailed),
                                          message.Value.Skipped.ToString().PadLeft(longestSkipped),
                                          message.Value.Time.ToString("0.000s").PadLeft(longestTime));
                    }

                    if (completionMessages.Count > 1)
                    {
                        Console.WriteLine("   {0}         {1}          {2}          {3}           {4}        {5}" + Environment.NewLine +
                                          "           {6} {7}          {8}          {9}           {10}        {11} ({12})",
                                          " ".PadRight(longestAssemblyName),
                                          "-".PadRight(longestTotal, '-'),
                                          "-".PadRight(longestErrors, '-'),
                                          "-".PadRight(longestFailed, '-'),
                                          "-".PadRight(longestSkipped, '-'),
                                          "-".PadRight(longestTime, '-'),
                                          "GRAND TOTAL:".PadLeft(longestAssemblyName),
                                          totalTestsRun,
                                          totalErrors,
                                          totalTestsFailed,
                                          totalTestsSkipped,
                                          totalTime,
                                          clockTime.Elapsed.TotalSeconds.ToString("0.000s"));
                    }
                }
            }

            Directory.SetCurrentDirectory(originalWorkingFolder);

            xmlTransformers.ForEach(transformer => transformer(assembliesElement));

            return(failed ? 1 : completionMessages.Values.Sum(summary => summary.Failed));
        }
Example #10
0
        private static Dictionary <String, PropertyDescriptor> GetPropertyDescriptors(
            Type type, out IDictionaryInitializer[] typeInitializers,
            out IDictionaryMetaInitializer[] metaInitializers, out object[] typeBehaviors)
        {
            var propertyMap        = new Dictionary <String, PropertyDescriptor>();
            var interfaceBehaviors = typeBehaviors = ExpandBehaviors(AttributesUtil.GetTypeAttributes <object>(type)).ToArray();

            typeInitializers = typeBehaviors.OfType <IDictionaryInitializer>().Prioritize().ToArray();
            metaInitializers = typeBehaviors.OfType <IDictionaryMetaInitializer>().Prioritize().ToArray();
            var defaultFetch = typeBehaviors.OfType <FetchAttribute>().Select(b => b.Fetch).FirstOrDefault();

            CollectProperties(type, property =>
            {
                var propertyBehaviors  = ExpandBehaviors(AttributesUtil.GetAttributes <object>(property)).ToArray();
                var propertyDescriptor = new PropertyDescriptor(property, propertyBehaviors);

                var descriptorInitializers = propertyBehaviors.OfType <IPropertyDescriptorInitializer>();
                foreach (var descriptorInitializer in descriptorInitializers.OrderBy(b => b.ExecutionOrder))
                {
                    descriptorInitializer.Initialize(propertyDescriptor, propertyBehaviors);
                }

                propertyDescriptor.AddKeyBuilders(
                    propertyBehaviors.OfType <IDictionaryKeyBuilder>().Prioritize(
                        ExpandBehaviors(AttributesUtil.GetTypeAttributes <object>(property.ReflectedType)).OfType <IDictionaryKeyBuilder>())
                    );

                propertyDescriptor.AddGetters(
                    propertyBehaviors.OfType <IDictionaryPropertyGetter>().Prioritize(
                        interfaceBehaviors.OfType <IDictionaryPropertyGetter>())
                    );
                AddDefaultGetter(propertyDescriptor);

                propertyDescriptor.AddSetters(
                    propertyBehaviors.OfType <IDictionaryPropertySetter>().Prioritize(
                        interfaceBehaviors.OfType <IDictionaryPropertySetter>())
                    );

                bool?propertyFetch          = (from b in propertyBehaviors.OfType <FetchAttribute>() select b.Fetch).FirstOrDefault();
                propertyDescriptor.IfExists = propertyBehaviors.OfType <IfExistsAttribute>().Any();
                propertyDescriptor.Fetch    = propertyFetch.GetValueOrDefault(defaultFetch);

                PropertyDescriptor existingDescriptor;
                if (propertyMap.TryGetValue(property.Name, out existingDescriptor))
                {
                    var existingProperty = existingDescriptor.Property;
                    if (existingProperty.PropertyType == property.PropertyType)
                    {
                        if (property.CanRead && property.CanWrite)
                        {
                            propertyMap[property.Name] = propertyDescriptor;
                        }
                        return;
                    }
                }

                propertyMap.Add(property.Name, propertyDescriptor);
            });

            return(propertyMap);
        }
        private async Task PerformUpdateEntityField(string folder, Guid idReport, string name, string filename, string fieldName, string fieldTitle)
        {
            if (!this.IsControlsEnabled)
            {
                return;
            }

            var service = await GetService();

            if (service == null)
            {
                return;
            }

            ToggleControls(service.ConnectionData, false, Properties.OutputStrings.InConnectionUpdatingFieldFormat2, service.ConnectionData.Name, fieldName);

            try
            {
                var repository = new ReportRepository(service);

                var report = await repository.GetByIdAsync(idReport, new ColumnSet(fieldName));

                string xmlContent = report.GetAttributeValue<string>(fieldName);

                {
                    if (ContentComparerHelper.TryParseXml(xmlContent, out var doc))
                    {
                        xmlContent = doc.ToString();
                    }
                }

                string filePath = await CreateFileAsync(folder, name, idReport, fieldTitle + " BackUp", xmlContent);

                var newText = string.Empty;
                bool? dialogResult = false;

                this.Dispatcher.Invoke(() =>
                {
                    var form = new WindowTextField("Enter " + fieldTitle, fieldTitle, xmlContent);

                    dialogResult = form.ShowDialog();

                    newText = form.FieldText;
                });

                if (dialogResult.GetValueOrDefault() == false)
                {
                    ToggleControls(service.ConnectionData, true, Properties.OutputStrings.InConnectionUpdatingFieldCanceledFormat2, service.ConnectionData.Name, fieldName);
                    return;
                }

                newText = ContentComparerHelper.RemoveInTextAllCustomXmlAttributesAndNamespaces(newText);

                {
                    if (ContentComparerHelper.TryParseXml(newText, out var doc))
                    {
                        newText = doc.ToString(SaveOptions.DisableFormatting);
                    }
                }

                var updateEntity = new Report
                {
                    Id = idReport
                };
                updateEntity.Attributes[fieldName] = newText;

                await service.UpdateAsync(updateEntity);

                ToggleControls(service.ConnectionData, true, Properties.OutputStrings.InConnectionUpdatingFieldCompletedFormat2, service.ConnectionData.Name, fieldName);
            }
            catch (Exception ex)
            {
                _iWriteToOutput.WriteErrorToOutput(service.ConnectionData, ex);

                ToggleControls(service.ConnectionData, true, Properties.OutputStrings.InConnectionUpdatingFieldFailedFormat2, service.ConnectionData.Name, fieldName);
            }
        }
Example #12
0
        private void CheckLogin(User user)
        {
            try
            {
                if (user != null)
                {
                    switch (user.State)
                    {
                    case "0":
                    {
                        string text  = JsonConvert.SerializeObject(user.EnableButtonList);
                        string text2 = (user.UTC == null) ? DateTool.GetCurrentTimeInUnixMillis().ToString() : user.UTC.ToString();
                        long   num   = 0L;
                        try
                        {
                            num = DateTool.GetCurrentTimeInUnixMillis() - long.Parse(text2);
                        }
                        catch (Exception ex)
                        {
                            LogTool.Debug(ex);
                        }
                        string   text3 = "Update NowLogin set UserID=@1,UserName=@2,UserPWD=@3,MeetingListDate=getdate(),HomeUserButtonAryJSON=@4,UserEmail=@5,UTC=@6,DeltaUTC=@7,RemeberLogin=@8";
                        string[] array = new string[8]
                        {
                            user.ID,
                            user.Name,
                            tbUserPWD.Password.Trim(),
                            text,
                            user.Email,
                            text2,
                            num.ToString(),
                            null
                        };
                        bool?isChecked = cbRemeberLogin.IsChecked;
                        array[7] = ((isChecked.GetValueOrDefault() && isChecked.HasValue) ? "true" : "false");
                        int num2 = MSCE.ExecuteNonQuery(text3, array);
                        if (num2 < 1)
                        {
                            LogTool.Debug(new Exception("DB失敗: " + text3));
                            return;
                        }
                        try
                        {
                            DataTable dataTable = MSCE.GetDataTable("select UserID from LoginInfo where UserID =@1", user.ID);
                            if (dataTable.Rows.Count > 0)
                            {
                                MSCE.ExecuteNonQuery("UPDATE [LoginInfo] SET \r\n                                                 [UserID] = @1\r\n\t\t                                        ,[UserPWD] = @2\r\n                                                ,UserJson = @3\r\n\t\t                                         where UserID=@4", user.ID, tbUserPWD.Password.Trim(), JsonConvert.SerializeObject(user), user.ID);
                            }
                            else
                            {
                                MSCE.ExecuteNonQuery("INSERT INTO [LoginInfo] ([UserID],[UserPWD],UserJson)\r\n                                                            VALUES (@1,@2,@3)", user.ID, tbUserPWD.Password.Trim(), JsonConvert.SerializeObject(user));
                            }
                            dataTable = MSCE.GetDataTable("select ListDate from UserData where UserID =@1 and ListDate =@2", user.ID, DateTool.MonthFirstDate(DateTime.Now).ToString("yyyyMMdd"));
                            if (dataTable.Rows.Count > 0)
                            {
                                MSCE.ExecuteNonQuery("UPDATE [UserData] SET \r\n                                                             [ListDate] = @1\r\n\t\t                                                    ,[UserJson] = @2\r\n\t\t                                                     where UserID = @3 and ListDate =@4", DateTool.MonthFirstDate(DateTime.Now).ToString("yyyyMMdd"), JsonConvert.SerializeObject(user), user.ID, DateTool.MonthFirstDate(DateTime.Now).ToString("yyyyMMdd"));
                            }
                            else
                            {
                                MSCE.ExecuteNonQuery("INSERT INTO [UserData] ([UserID],[ListDate],UserJson)\r\n                                                                        VALUES (@1,@2,@3)", user.ID, DateTool.MonthFirstDate(DateTime.Now).ToString("yyyyMMdd"), JsonConvert.SerializeObject(user));
                            }
                        }
                        catch (Exception ex2)
                        {
                            LogTool.Debug(ex2);
                        }
                        Hide();
                        Home home = new Home(user, tbUserPWD.Password.Trim());
                        home.Show();
                        Close();
                        break;
                    }

                    case "1":
                        AutoClosingMessageBox.Show("無此使用者帳號,請重新輸入");
                        break;

                    case "2":
                        AutoClosingMessageBox.Show("帳號密碼錯誤或帳號已被鎖定");
                        break;
                    }
                }
            }
            catch (Exception ex3)
            {
                LogTool.Debug(ex3);
            }
            canLogin = true;
            MouseTool.ShowArrow();
        }
Example #13
0
        private void CallLigon()
        {
            Action <HttpWebResponse> action = null;

            canLogin = false;
            MouseTool.ShowLoading();
            try
            {
                string text  = tbUserID.Text.Trim();
                string text2 = tbUserPWD.Password.Trim();
                string text3 = DateTool.MonthFirstDate(DateTime.Today).ToString("yyyyMMdd");
                string text4 = DateTool.MonthFirstDate(DateTime.Today.AddMonths(1)).ToString("yyyyMMdd");
                if (NetworkTool.CheckNetwork() > 0)
                {
                    string url    = WsTool.GetUrl();
                    string format = "<?xml version=\"1.0\"?><UserInfo><UserID><![CDATA[{0}]]></UserID><UserPW><![CDATA[{1}]]></UserPW><UserDevice>1</UserDevice><UserDateBegin>{2}</UserDateBegin><UserDateEnd>{3}</UserDateEnd></UserInfo>";
                    format = string.Format(format, text, text2, text3, text4);
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    dictionary["XmlDoc"] = format;
                    HttpWebRequest httpWebRequest = HttpTool.GetHttpWebRequest(url + "/UserData", "POST", dictionary);
                    if (action == null)
                    {
                        action = new Action <HttpWebResponse>(_003CCallLigon_003Eb__10);
                    }
                    DoWithResponse(httpWebRequest, action);
                }
                else
                {
                    DataTable dataTable = MSCE.GetDataTable("select UserID from LoginInfo where UserID =@1", text);
                    if (dataTable.Rows.Count > 0)
                    {
                        dataTable = MSCE.GetDataTable("select UserJson from LoginInfo where UserID =@1 and UserPWD=@2", text, text2);
                        if (dataTable.Rows.Count > 0)
                        {
                            User   user  = JsonConvert.DeserializeObject <User>(dataTable.Rows[0]["UserJson"].ToString());
                            string text5 = JsonConvert.SerializeObject(user.EnableButtonList);
                            string s     = user.UTC.ToString();
                            long   num   = 0L;
                            try
                            {
                                num = DateTool.GetCurrentTimeInUnixMillis() - long.Parse(s);
                            }
                            catch (Exception ex)
                            {
                                LogTool.Debug(ex);
                            }
                            string   text6 = "Update NowLogin set UserID=@1,UserName=@2,UserPWD=@3,MeetingListDate=getdate(),HomeUserButtonAryJSON=@4,UserEmail=@5,UTC=@6,DeltaUTC=@7,RemeberLogin=@8";
                            string[] array = new string[8]
                            {
                                user.ID,
                                user.Name,
                                tbUserPWD.Password.Trim(),
                                text5,
                                user.Email,
                                DateTool.GetCurrentTimeInUnixMillis().ToString(),
                                num.ToString(),
                                null
                            };
                            bool?isChecked = cbRemeberLogin.IsChecked;
                            array[7] = ((isChecked.GetValueOrDefault() && isChecked.HasValue) ? "true" : "false");
                            int num2 = MSCE.ExecuteNonQuery(text6, array);
                            if (num2 < 1)
                            {
                                LogTool.Debug(new Exception("DB失敗: " + text6));
                            }
                            else
                            {
                                base.Dispatcher.BeginInvoke(new Action <User>(CheckLogin), user);
                            }
                        }
                        else
                        {
                            MouseTool.ShowArrow();
                            AutoClosingMessageBox.Show("您的密碼錯誤");
                            canLogin = true;
                        }
                    }
                    else
                    {
                        MouseTool.ShowArrow();
                        AutoClosingMessageBox.Show("無此使用者帳號,請重新輸入");
                        canLogin = true;
                    }
                }
            }
            catch (Exception)
            {
                MouseTool.ShowArrow();
                AutoClosingMessageBox.Show("登入失敗");
                canLogin = true;
            }
        }
Example #14
0
        internal override Hashtable ToHashtable()
        {
            Hashtable hashtables = new Hashtable();

            if (this.ClassName != this.ClassName_DefaultValue)
            {
                hashtables.Add("className", this.ClassName);
            }
            if (this.Color != this.Color_DefaultValue)
            {
                hashtables.Add("color", this.Color);
            }
            double?colorIndex             = this.ColorIndex;
            double?colorIndexDefaultValue = this.ColorIndex_DefaultValue;

            if ((colorIndex.GetValueOrDefault() == colorIndexDefaultValue.GetValueOrDefault() ? colorIndex.HasValue != colorIndexDefaultValue.HasValue : true))
            {
                hashtables.Add("colorIndex", this.ColorIndex);
            }
            if (this.DataLabels != this.DataLabels_DefaultValue)
            {
                hashtables.Add("dataLabels", this.DataLabels);
            }
            if (this.Description != this.Description_DefaultValue)
            {
                hashtables.Add("description", this.Description);
            }
            if (this.Drilldown != this.Drilldown_DefaultValue)
            {
                hashtables.Add("drilldown", this.Drilldown);
            }
            if (this.Events.IsDirty())
            {
                hashtables.Add("events", this.Events.ToHashtable());
            }
            if (this.Id != this.Id_DefaultValue)
            {
                hashtables.Add("id", this.Id);
            }
            colorIndexDefaultValue = this.Labelrank;
            colorIndex             = this.Labelrank_DefaultValue;
            if ((colorIndexDefaultValue.GetValueOrDefault() == colorIndex.GetValueOrDefault() ? colorIndexDefaultValue.HasValue != colorIndex.HasValue : true))
            {
                hashtables.Add("labelrank", this.Labelrank);
            }
            if (this.Marker.IsDirty())
            {
                hashtables.Add("marker", this.Marker.ToHashtable());
            }
            if (this.Name != this.Name_DefaultValue)
            {
                hashtables.Add("name", this.Name);
            }
            bool?selected             = this.Selected;
            bool?selectedDefaultValue = this.Selected_DefaultValue;

            if ((selected.GetValueOrDefault() == selectedDefaultValue.GetValueOrDefault() ? selected.HasValue != selectedDefaultValue.HasValue : true))
            {
                hashtables.Add("selected", this.Selected);
            }
            colorIndex             = this.X;
            colorIndexDefaultValue = this.X_DefaultValue;
            if ((colorIndex.GetValueOrDefault() == colorIndexDefaultValue.GetValueOrDefault() ? colorIndex.HasValue != colorIndexDefaultValue.HasValue : true))
            {
                hashtables.Add("x", this.X);
            }
            colorIndexDefaultValue = this.Y;
            colorIndex             = this.Y_DefaultValue;
            if ((colorIndexDefaultValue.GetValueOrDefault() == colorIndex.GetValueOrDefault() ? colorIndexDefaultValue.HasValue != colorIndex.HasValue : true))
            {
                hashtables.Add("y", this.Y);
            }
            return(hashtables);
        }
Example #15
0
        public IActionResult SetPermissionData(int type, string data, bool?lockToGroup)
        {
            if (ClaimsAuthorizationHelper.IsUserDepartmentAdmin())
            {
                var before = _permissionsService.GetPermisionByDepartmentType(DepartmentId, (PermissionTypes)type);
                var result = _permissionsService.SetPermissionForDepartment(DepartmentId, UserId, (PermissionTypes)type, (PermissionActions)before.Action, data, lockToGroup.GetValueOrDefault());

                var auditEvent = new AuditEvent();
                auditEvent.DepartmentId = DepartmentId;
                auditEvent.UserId       = UserId;
                auditEvent.Type         = AuditLogTypes.PermissionsChanged;
                auditEvent.Before       = before.CloneJson();
                auditEvent.After        = result.CloneJson();
                _eventAggregator.SendMessage <AuditEvent>(auditEvent);

                return(new StatusCodeResult((int)HttpStatusCode.OK));
            }

            return(new StatusCodeResult((int)HttpStatusCode.NotModified));
        }
Example #16
0
        internal override Hashtable ToHashtable()
        {
            Hashtable hashtable = new Hashtable();

            if (this.DateTimeLabelFormats != this.DateTimeLabelFormats_DefaultValue)
            {
                hashtable.Add((object)"dateTimeLabelFormats", (object)this.DateTimeLabelFormats);
            }
            bool?nullable1 = this.FollowPointer;
            bool?nullable2 = this.FollowPointer_DefaultValue;

            if (nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ||
                nullable1.HasValue != nullable2.HasValue)
            {
                hashtable.Add((object)"followPointer", (object)this.FollowPointer);
            }
            nullable2 = this.FollowTouchMove;
            nullable1 = this.FollowTouchMove_DefaultValue;
            if (nullable2.GetValueOrDefault() != nullable1.GetValueOrDefault() ||
                nullable2.HasValue != nullable1.HasValue)
            {
                hashtable.Add((object)"followTouchMove", (object)this.FollowTouchMove);
            }
            if (this.FooterFormat != this.FooterFormat_DefaultValue)
            {
                hashtable.Add((object)"footerFormat", (object)this.FooterFormat);
            }
            if (this.HeaderFormat != this.HeaderFormat_DefaultValue)
            {
                hashtable.Add((object)"headerFormat", (object)this.HeaderFormat);
            }
            double?nullable3 = this.HideDelay;
            double?nullable4 = this.HideDelay_DefaultValue;

            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"hideDelay", (object)this.HideDelay);
            }
            nullable4 = this.Padding;
            nullable3 = this.Padding_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
            {
                hashtable.Add((object)"padding", (object)this.Padding);
            }
            if (this.PointFormat != this.PointFormat_DefaultValue)
            {
                hashtable.Add((object)"pointFormat", (object)this.PointFormat);
            }
            if (this.PointFormatter != this.PointFormatter_DefaultValue)
            {
                hashtable.Add((object)"pointFormatter", (object)this.PointFormatter);
                Highcharts.AddFunction("SolidgaugeSeriesTooltipPointFormatter.pointFormatter", this.PointFormatter);
            }
            nullable1 = this.Split;
            nullable2 = this.Split_DefaultValue;
            if (nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ||
                nullable1.HasValue != nullable2.HasValue)
            {
                hashtable.Add((object)"split", (object)this.Split);
            }
            nullable3 = this.ValueDecimals;
            nullable4 = this.ValueDecimals_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"valueDecimals", (object)this.ValueDecimals);
            }
            if (this.ValuePrefix != this.ValuePrefix_DefaultValue)
            {
                hashtable.Add((object)"valuePrefix", (object)this.ValuePrefix);
            }
            if (this.ValueSuffix != this.ValueSuffix_DefaultValue)
            {
                hashtable.Add((object)"valueSuffix", (object)this.ValueSuffix);
            }
            if (this.XDateFormat != this.XDateFormat_DefaultValue)
            {
                hashtable.Add((object)"xDateFormat", (object)this.XDateFormat);
            }
            return(hashtable);
        }
Example #17
0
        int RunProject(XunitProject project,
                       bool serialize,
                       bool?parallelizeAssemblies,
                       bool?parallelizeTestCollections,
                       int?maxThreadCount,
                       bool diagnosticMessages,
                       bool noColor,
                       AppDomainSupport?appDomains,
                       bool failSkips,
                       bool stopOnFail,
                       bool internalDiagnosticMessages)
        {
            XElement assembliesElement = null;
            var      clockTime         = Stopwatch.StartNew();
            var      xmlTransformers   = TransformFactory.GetXmlTransformers(project);
            var      needsXml          = xmlTransformers.Count > 0;

            if (!parallelizeAssemblies.HasValue)
            {
                parallelizeAssemblies = project.All(assembly => assembly.Configuration.ParallelizeAssemblyOrDefault);
            }

            if (needsXml)
            {
                assembliesElement = new XElement("assemblies");
            }

            var originalWorkingFolder = Directory.GetCurrentDirectory();

            if (parallelizeAssemblies.GetValueOrDefault())
            {
                var tasks   = project.Assemblies.Select(assembly => Task.Run(() => ExecuteAssembly(consoleLock, assembly, serialize, needsXml, parallelizeTestCollections, maxThreadCount, diagnosticMessages, noColor, appDomains, failSkips, stopOnFail, project.Filters, internalDiagnosticMessages)));
                var results = Task.WhenAll(tasks).GetAwaiter().GetResult();
                foreach (var assemblyElement in results.Where(result => result != null))
                {
                    assembliesElement.Add(assemblyElement);
                }
            }
            else
            {
                foreach (var assembly in project.Assemblies)
                {
                    var assemblyElement = ExecuteAssembly(consoleLock, assembly, serialize, needsXml, parallelizeTestCollections, maxThreadCount, diagnosticMessages, noColor, appDomains, failSkips, stopOnFail, project.Filters, internalDiagnosticMessages);
                    if (assemblyElement != null)
                    {
                        assembliesElement.Add(assemblyElement);
                    }
                }
            }

            clockTime.Stop();

            if (assembliesElement != null)
            {
                assembliesElement.Add(new XAttribute("timestamp", DateTime.Now.ToString(CultureInfo.InvariantCulture)));
            }

            if (completionMessages.Count > 0)
            {
                reporterMessageHandler.OnMessage(new TestExecutionSummary(clockTime.Elapsed, completionMessages.OrderBy(kvp => kvp.Key).ToList()));
            }

            Directory.SetCurrentDirectory(originalWorkingFolder);

            xmlTransformers.ForEach(transformer => transformer(assembliesElement));

            return(failed ? 1 : completionMessages.Values.Sum(summary => summary.Failed));
        }
Example #18
0
        static XElement ExecuteAssembly(object consoleLock, string defaultDirectory, XunitProjectAssembly assembly, bool needsXml, bool teamCity, bool appVeyor, bool showProgress, bool?parallelizeTestCollections, int?maxThreadCount, XunitFilters filters)
        {
            if (cancel)
            {
                return(null);
            }

            var assemblyElement = needsXml ? new XElement("assembly") : null;

            try
            {
                if (!ValidateFileExists(consoleLock, assembly.AssemblyFilename) || !ValidateFileExists(consoleLock, assembly.ConfigFilename))
                {
                    return(null);
                }

                // Turn off pre-enumeration of theories, since there is no theory selection UI in this runner
                assembly.Configuration.PreEnumerateTheories = false;

                var discoveryOptions = TestFrameworkOptions.ForDiscovery(assembly.Configuration);
                var executionOptions = TestFrameworkOptions.ForExecution(assembly.Configuration);
                if (maxThreadCount.HasValue)
                {
                    executionOptions.SetMaxParallelThreads(maxThreadCount.GetValueOrDefault());
                }
                if (parallelizeTestCollections.HasValue)
                {
                    executionOptions.SetDisableParallelization(!parallelizeTestCollections.GetValueOrDefault());
                }

                lock (consoleLock)
                {
                    if (assembly.Configuration.DiagnosticMessages ?? false)
                    {
                        Console.WriteLine("Discovering: {0} (method display = {1}, parallel test collections = {2}, max threads = {3})",
                                          Path.GetFileNameWithoutExtension(assembly.AssemblyFilename),
                                          discoveryOptions.GetMethodDisplay(),
                                          !executionOptions.GetDisableParallelization(),
                                          executionOptions.GetMaxParallelThreads());
                    }
                    else
                    {
                        Console.WriteLine("Discovering: {0}", Path.GetFileNameWithoutExtension(assembly.AssemblyFilename));
                    }
                }

                using (var controller = new XunitFrontController(AppDomainSupport.Denied, assembly.AssemblyFilename, assembly.ConfigFilename, assembly.Configuration.ShadowCopyOrDefault))
                    using (var discoveryVisitor = new TestDiscoveryVisitor())
                    {
                        controller.Find(includeSourceInformation: false, messageSink: discoveryVisitor, discoveryOptions: discoveryOptions);
                        discoveryVisitor.Finished.WaitOne();

                        lock (consoleLock)
                        {
                            Console.WriteLine("Discovered:  {0}", Path.GetFileNameWithoutExtension(assembly.AssemblyFilename));
                        }

                        var resultsVisitor    = CreateVisitor(consoleLock, defaultDirectory, assemblyElement, teamCity, appVeyor, showProgress);
                        var filteredTestCases = discoveryVisitor.TestCases.Where(filters.Filter).ToList();
                        if (filteredTestCases.Count == 0)
                        {
                            lock (consoleLock)
                            {
                                Console.ForegroundColor = ConsoleColor.DarkYellow;
                                Console.WriteLine("Info:        {0} has no tests to run", Path.GetFileNameWithoutExtension(assembly.AssemblyFilename));
                                Console.ForegroundColor = ConsoleColor.Gray;
                            }
                        }
                        else
                        {
                            controller.RunTests(filteredTestCases, resultsVisitor, executionOptions);
                            resultsVisitor.Finished.WaitOne();
                        }
                    }
            }
            catch (Exception ex)
            {
                Console.WriteLine("{0}: {1}", ex.GetType().FullName, ex.Message);
                failed = true;
            }

            return(assemblyElement);
        }
Example #19
0
 internal bool StrictlyMatchParametersOrDefault(bool strongParameterCheck)
 {
     return(strictlyMatchParameters.GetValueOrDefault(strongParameterCheck));
 }
Example #20
0
 private static bool?NormalizeNullableBool(bool?flag)
 {
     return(flag.GetValueOrDefault() ? true : (bool?)null);
 }
Example #21
0
 public void ServerToggleLocked(bool?nowLocked = null)
 {
     isLocked = nowLocked.GetValueOrDefault(!IsLocked);
 }
Example #22
0
        internal override Hashtable ToHashtable()
        {
            Hashtable hashtable = new Hashtable();
            bool?     nullable1 = this.AlignTicks;
            bool?     nullable2 = this.AlignTicks_DefaultValue;

            if (nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ||
                nullable1.HasValue != nullable2.HasValue)
            {
                hashtable.Add((object)"alignTicks", (object)this.AlignTicks);
            }
            if (this.Animation.IsDirty())
            {
                hashtable.Add((object)"animation", (object)this.Animation.ToJSON());
            }
            if (this.BackgroundColor != this.BackgroundColor_DefaultValue)
            {
                hashtable.Add((object)"backgroundColor", (object)this.BackgroundColor);
            }
            if (this.BorderColor != this.BorderColor_DefaultValue)
            {
                hashtable.Add((object)"borderColor", (object)this.BorderColor);
            }
            double?nullable3 = this.BorderRadius;
            double?nullable4 = this.BorderRadius_DefaultValue;

            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"borderRadius", (object)this.BorderRadius);
            }
            nullable4 = this.BorderWidth;
            nullable3 = this.BorderWidth_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
            {
                hashtable.Add((object)"borderWidth", (object)this.BorderWidth);
            }
            if (this.ClassName != this.ClassName_DefaultValue)
            {
                hashtable.Add((object)"className", (object)this.ClassName);
            }
            nullable3 = this.ColorCount;
            nullable4 = this.ColorCount_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"colorCount", (object)this.ColorCount);
            }
            if (this.Description != this.Description_DefaultValue)
            {
                hashtable.Add((object)"description", (object)this.Description);
            }
            if (this.Events.IsDirty())
            {
                hashtable.Add((object)"events", (object)this.Events.ToHashtable());
            }
            nullable4 = this.Height;
            nullable3 = this.Height_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
            {
                hashtable.Add((object)"height", (object)this.Height);
            }
            nullable2 = this.IgnoreHiddenSeries;
            nullable1 = this.IgnoreHiddenSeries_DefaultValue;
            if (nullable2.GetValueOrDefault() != nullable1.GetValueOrDefault() ||
                nullable2.HasValue != nullable1.HasValue)
            {
                hashtable.Add((object)"ignoreHiddenSeries", (object)this.IgnoreHiddenSeries);
            }
            nullable1 = this.Inverted;
            nullable2 = this.Inverted_DefaultValue;
            if (nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ||
                nullable1.HasValue != nullable2.HasValue)
            {
                hashtable.Add((object)"inverted", (object)this.Inverted);
            }
            if (this.Margin != this.Margin_DefaultValue)
            {
                hashtable.Add((object)"margin", (object)this.Margin);
            }
            nullable3 = this.MarginBottom;
            nullable4 = this.MarginBottom_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"marginBottom", (object)this.MarginBottom);
            }
            nullable4 = this.MarginLeft;
            nullable3 = this.MarginLeft_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
            {
                hashtable.Add((object)"marginLeft", (object)this.MarginLeft);
            }
            nullable3 = this.MarginRight;
            nullable4 = this.MarginRight_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"marginRight", (object)this.MarginRight);
            }
            nullable4 = this.MarginTop;
            nullable3 = this.MarginTop_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
            {
                hashtable.Add((object)"marginTop", (object)this.MarginTop);
            }
            nullable2 = this.Panning;
            nullable1 = this.Panning_DefaultValue;
            if (nullable2.GetValueOrDefault() != nullable1.GetValueOrDefault() ||
                nullable2.HasValue != nullable1.HasValue)
            {
                hashtable.Add((object)"panning", (object)this.Panning);
            }
            if (this.PinchType != this.PinchType_DefaultValue)
            {
                hashtable.Add((object)"pinchType",
                              (object)Highstock.FirstCharacterToLower(this.PinchType.ToString()));
            }
            if (this.PlotBackgroundColor != this.PlotBackgroundColor_DefaultValue)
            {
                hashtable.Add((object)"plotBackgroundColor", (object)this.PlotBackgroundColor);
            }
            if (this.PlotBackgroundImage != this.PlotBackgroundImage_DefaultValue)
            {
                hashtable.Add((object)"plotBackgroundImage", (object)this.PlotBackgroundImage);
            }
            if (this.PlotBorderColor != this.PlotBorderColor_DefaultValue)
            {
                hashtable.Add((object)"plotBorderColor", (object)this.PlotBorderColor);
            }
            nullable3 = this.PlotBorderWidth;
            nullable4 = this.PlotBorderWidth_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"plotBorderWidth", (object)this.PlotBorderWidth);
            }
            if (this.PlotShadow.IsDirty())
            {
                hashtable.Add((object)"plotShadow", (object)this.PlotShadow.ToJSON());
            }
            nullable1 = this.Reflow;
            nullable2 = this.Reflow_DefaultValue;
            if (nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ||
                nullable1.HasValue != nullable2.HasValue)
            {
                hashtable.Add((object)"reflow", (object)this.Reflow);
            }
            if (this.RenderTo != this.RenderTo_DefaultValue)
            {
                hashtable.Add((object)"renderTo", (object)this.RenderTo);
            }
            if (this.ResetZoomButton.IsDirty())
            {
                hashtable.Add((object)"resetZoomButton", (object)this.ResetZoomButton.ToHashtable());
            }
            if (this.SelectionMarkerFill != this.SelectionMarkerFill_DefaultValue)
            {
                hashtable.Add((object)"selectionMarkerFill", (object)this.SelectionMarkerFill);
            }
            if (this.Shadow.IsDirty())
            {
                hashtable.Add((object)"shadow", (object)this.Shadow.ToHashtable());
            }
            nullable4 = this.SpacingBottom;
            nullable3 = this.SpacingBottom_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
            {
                hashtable.Add((object)"spacingBottom", (object)this.SpacingBottom);
            }
            nullable3 = this.SpacingLeft;
            nullable4 = this.SpacingLeft_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"spacingLeft", (object)this.SpacingLeft);
            }
            nullable4 = this.SpacingRight;
            nullable3 = this.SpacingRight_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
            {
                hashtable.Add((object)"spacingRight", (object)this.SpacingRight);
            }
            nullable3 = this.SpacingTop;
            nullable4 = this.SpacingTop_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"spacingTop", (object)this.SpacingTop);
            }
            if (this.Style != this.Style_DefaultValue)
            {
                hashtable.Add((object)"style", (object)this.Style);
            }
            if (this.Type != this.Type_DefaultValue)
            {
                hashtable.Add((object)"type", (object)Highstock.FirstCharacterToLower(this.Type.ToString()));
            }
            if (this.TypeDescription != this.TypeDescription_DefaultValue)
            {
                hashtable.Add((object)"typeDescription", (object)this.TypeDescription);
            }
            nullable4 = this.Width;
            nullable3 = this.Width_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
            {
                hashtable.Add((object)"width", (object)this.Width);
            }
            if (this.ZoomType != this.ZoomType_DefaultValue)
            {
                hashtable.Add((object)"zoomType", (object)Highstock.FirstCharacterToLower(this.ZoomType.ToString()));
            }
            return(hashtable);
        }
Example #23
0
        public static PersistentEvent ToSessionStartEvent(this PersistentEvent source, DateTime?lastActivityUtc = null, bool?isSessionEnd = null, bool hasPremiumFeatures = true)
        {
            var startEvent = new PersistentEvent {
                Date           = source.Date,
                Geo            = source.Geo,
                OrganizationId = source.OrganizationId,
                ProjectId      = source.ProjectId,
                Type           = Event.KnownTypes.Session,
                Value          = 0
            };

            startEvent.SetSessionId(source.GetSessionId());
            startEvent.SetUserIdentity(source.GetUserIdentity());
            startEvent.SetLocation(source.GetLocation());
            startEvent.SetVersion(source.GetVersion());

            var ei = source.GetEnvironmentInfo();

            if (ei != null)
            {
                startEvent.SetEnvironmentInfo(new EnvironmentInfo {
                    Architecture        = ei.Architecture,
                    CommandLine         = ei.CommandLine,
                    Data                = ei.Data,
                    InstallId           = ei.InstallId,
                    IpAddress           = ei.IpAddress,
                    MachineName         = ei.MachineName,
                    OSName              = ei.OSName,
                    OSVersion           = ei.OSVersion,
                    ProcessId           = ei.ProcessId,
                    ProcessName         = ei.ProcessName,
                    ProcessorCount      = ei.ProcessorCount,
                    RuntimeVersion      = ei.RuntimeVersion,
                    TotalPhysicalMemory = ei.TotalPhysicalMemory
                });
            }

            var ri = source.GetRequestInfo();

            if (ri != null)
            {
                startEvent.AddRequestInfo(new RequestInfo {
                    ClientIpAddress = ri.ClientIpAddress,
                    Data            = ri.Data,
                    Host            = ri.Host,
                    HttpMethod      = ri.HttpMethod,
                    IsSecure        = ri.IsSecure,
                    Port            = ri.Port,
                    Path            = ri.Path,
                    Referrer        = ri.Referrer,
                    UserAgent       = ri.UserAgent
                });
            }

            if (lastActivityUtc.HasValue)
            {
                startEvent.UpdateSessionStart(lastActivityUtc.Value, isSessionEnd.GetValueOrDefault());
            }

            if (hasPremiumFeatures)
            {
                startEvent.CopyDataToIndex(Array.Empty <string>());
            }

            return(startEvent);
        }
Example #24
0
        public override bool Execute()
        {
            RemotingUtility.CleanUpRegisteredChannels();

            XElement assembliesElement = null;
            var      environment       = $"{IntPtr.Size * 8}-bit .NET {Environment.Version}";

            if (NeedsXml)
            {
                assembliesElement = new XElement("assemblies");
            }

            switch (MaxParallelThreads)
            {
            case null:
            case "default":
                break;

            case "unlimited":
                maxThreadCount = -1;
                break;

            default:
                int threadValue;
                if (!int.TryParse(MaxParallelThreads, out threadValue) || threadValue < 1)
                {
                    Log.LogError("MaxParallelThreads value '{0}' is invalid: must be 'default', 'unlimited', or a positive number", MaxParallelThreads);
                    return(false);
                }

                maxThreadCount = threadValue;
                break;
            }

            var originalWorkingFolder = Directory.GetCurrentDirectory();

            using (AssemblyHelper.SubscribeResolve())
            {
                var reporter = GetReporter();
                if (reporter == null)
                {
                    return(false);
                }

                logger = new MSBuildLogger(Log);
                reporterMessageHandler = MessageSinkWithTypesAdapter.Wrap(reporter.CreateMessageHandler(logger));

                if (!NoLogo)
                {
                    Log.LogMessage(MessageImportance.High, "xUnit.net MSBuild Runner ({0})", environment);
                }

                var project = new XunitProject();
                foreach (var assembly in Assemblies)
                {
                    var assemblyFileName = assembly.GetMetadata("FullPath");
                    var configFileName   = assembly.GetMetadata("ConfigFile");
                    if (configFileName != null && configFileName.Length == 0)
                    {
                        configFileName = null;
                    }

                    var projectAssembly = new XunitProjectAssembly {
                        AssemblyFilename = assemblyFileName, ConfigFilename = configFileName
                    };
                    if (shadowCopy.HasValue)
                    {
                        projectAssembly.Configuration.ShadowCopy = shadowCopy;
                    }

                    project.Add(projectAssembly);
                }

                if (WorkingFolder != null)
                {
                    Directory.SetCurrentDirectory(WorkingFolder);
                }

                var clockTime = Stopwatch.StartNew();

                if (!parallelizeAssemblies.HasValue)
                {
                    parallelizeAssemblies = project.All(assembly => assembly.Configuration.ParallelizeAssemblyOrDefault);
                }

                if (parallelizeAssemblies.GetValueOrDefault())
                {
                    var tasks   = project.Assemblies.Select(assembly => Task.Run(() => ExecuteAssembly(assembly)));
                    var results = Task.WhenAll(tasks).GetAwaiter().GetResult();
                    foreach (var assemblyElement in results.Where(result => result != null))
                    {
                        assembliesElement.Add(assemblyElement);
                    }
                }
                else
                {
                    foreach (var assembly in project.Assemblies)
                    {
                        var assemblyElement = ExecuteAssembly(assembly);
                        if (assemblyElement != null)
                        {
                            assembliesElement.Add(assemblyElement);
                        }
                    }
                }

                clockTime.Stop();

                if (assembliesElement != null)
                {
                    assembliesElement.Add(new XAttribute("timestamp", DateTime.Now.ToString(CultureInfo.InvariantCulture)));
                }

                if (completionMessages.Count > 0)
                {
                    reporterMessageHandler.OnMessage(new TestExecutionSummary(clockTime.Elapsed, completionMessages.OrderBy(kvp => kvp.Key).ToList()));
                }
            }

            Directory.SetCurrentDirectory(WorkingFolder ?? originalWorkingFolder);

            if (NeedsXml)
            {
                if (Xml != null)
                {
                    assembliesElement.Save(Xml.GetMetadata("FullPath"));
                }

                if (XmlV1 != null)
                {
                    Transform("xUnit1.xslt", assembliesElement, XmlV1);
                }

                if (Html != null)
                {
                    Transform("HTML.xslt", assembliesElement, Html);
                }

                if (NUnit != null)
                {
                    Transform("NUnitXml.xslt", assembliesElement, NUnit);
                }
            }

            // ExitCode is set to 1 for test failures and -1 for Exceptions.
            return(ExitCode == 0 || (ExitCode == 1 && IgnoreFailures));
        }
Example #25
0
 public static string ToString(this   bool?d) => d.GetValueOrDefault().ToString();
Example #26
0
        protected virtual XElement ExecuteAssembly(XunitProjectAssembly assembly)
        {
            if (cancel)
            {
                return(null);
            }

            var assemblyElement = NeedsXml ? new XElement("assembly") : null;

            try
            {
                // Turn off pre-enumeration of theories, since there is no theory selection UI in this runner
                assembly.Configuration.PreEnumerateTheories = false;
                assembly.Configuration.DiagnosticMessages  |= DiagnosticMessages;

                if (appDomains.HasValue)
                {
                    assembly.Configuration.AppDomain = appDomains.GetValueOrDefault() ? AppDomainSupport.Required : AppDomainSupport.Denied;
                }

                // Setup discovery and execution options with command-line overrides
                var discoveryOptions = TestFrameworkOptions.ForDiscovery(assembly.Configuration);
                var executionOptions = TestFrameworkOptions.ForExecution(assembly.Configuration);
                if (maxThreadCount.HasValue && maxThreadCount.Value > -1)
                {
                    executionOptions.SetMaxParallelThreads(maxThreadCount);
                }
                if (parallelizeTestCollections.HasValue)
                {
                    executionOptions.SetDisableParallelization(!parallelizeTestCollections);
                }

                var assemblyDisplayName   = Path.GetFileNameWithoutExtension(assembly.AssemblyFilename);
                var diagnosticMessageSink = new DiagnosticMessageSink(Log, assemblyDisplayName, assembly.Configuration.DiagnosticMessagesOrDefault);
                var appDomainSupport      = assembly.Configuration.AppDomainOrDefault;
                var shadowCopy            = assembly.Configuration.ShadowCopyOrDefault;
                var longRunningSeconds    = assembly.Configuration.LongRunningTestSecondsOrDefault;

                using (var controller = new XunitFrontController(appDomainSupport, assembly.AssemblyFilename, assembly.ConfigFilename, shadowCopy, diagnosticMessageSink: diagnosticMessageSink))
                    using (var discoverySink = new TestDiscoverySink(() => cancel))
                    {
                        // Discover & filter the tests
                        reporterMessageHandler.OnMessage(new TestAssemblyDiscoveryStarting(assembly, controller.CanUseAppDomains && appDomainSupport != AppDomainSupport.Denied, shadowCopy, discoveryOptions));

                        controller.Find(false, discoverySink, discoveryOptions);
                        discoverySink.Finished.WaitOne();

                        var testCasesDiscovered = discoverySink.TestCases.Count;
                        var filteredTestCases   = discoverySink.TestCases.Where(Filters.Filter).ToList();
                        var testCasesToRun      = filteredTestCases.Count;

                        reporterMessageHandler.OnMessage(new TestAssemblyDiscoveryFinished(assembly, discoveryOptions, testCasesDiscovered, testCasesToRun));

                        // Run the filtered tests
                        if (testCasesToRun == 0)
                        {
                            completionMessages.TryAdd(Path.GetFileName(assembly.AssemblyFilename), new ExecutionSummary());
                        }
                        else
                        {
                            if (SerializeTestCases)
                            {
                                filteredTestCases = filteredTestCases.Select(controller.Serialize).Select(controller.Deserialize).ToList();
                            }

                            IExecutionSink resultsSink = new DelegatingExecutionSummarySink(reporterMessageHandler, () => cancel, (path, summary) => completionMessages.TryAdd(path, summary));
                            if (assemblyElement != null)
                            {
                                resultsSink = new DelegatingXmlCreationSink(resultsSink, assemblyElement);
                            }
                            if (longRunningSeconds > 0)
                            {
                                resultsSink = new DelegatingLongRunningTestDetectionSink(resultsSink, TimeSpan.FromSeconds(longRunningSeconds), diagnosticMessageSink);
                            }
                            if (FailSkips)
                            {
                                resultsSink = new DelegatingFailSkipSink(resultsSink);
                            }

                            reporterMessageHandler.OnMessage(new TestAssemblyExecutionStarting(assembly, executionOptions));

                            controller.RunTests(filteredTestCases, resultsSink, executionOptions);
                            resultsSink.Finished.WaitOne();

                            reporterMessageHandler.OnMessage(new TestAssemblyExecutionFinished(assembly, executionOptions, resultsSink.ExecutionSummary));

                            if (resultsSink.ExecutionSummary.Failed != 0)
                            {
                                ExitCode = 1;
                            }
                        }
                    }
            }
            catch (Exception ex)
            {
                var e = ex;

                while (e != null)
                {
                    Log.LogError("{0}: {1}", e.GetType().FullName, e.Message);

                    foreach (var stackLine in e.StackTrace.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        Log.LogError(stackLine);
                    }

                    e = e.InnerException;
                }

                ExitCode = -1;
            }

            return(assemblyElement);
        }
Example #27
0
        /// <summary>
        /// Ensures the default DICOM dictionaries are loaded
        /// Safe to call multiple times but will throw an exception if inconsistent values for loadPrivateDictionary are provided over multiple calls
        /// </summary>
        /// <param name="loadPrivateDictionary">Leave null (default value) if unconcerned.  Set true to search for resource streams named "Dicom.Dictionaries.Private Dictionary.xml.gz" in referenced assemblies</param>
        /// <returns></returns>
        public static DicomDictionary EnsureDefaultDictionariesLoaded(bool?loadPrivateDictionary = null)
        {
            // short-circuit if already initialised (#151).
            if (_default != null)
            {
                if (loadPrivateDictionary.HasValue && _defaultIncludesPrivate != loadPrivateDictionary.Value)
                {
                    throw new DicomDataException("Default DICOM dictionary already loaded " +
                                                 (_defaultIncludesPrivate ? "with" : "without") +
                                                 "private dictionary and the current request to ensure the default dictionary is loaded requests that private dictionary " +
                                                 (loadPrivateDictionary.Value ? "is" : "is not") + " loaded");
                }
                return(_default);
            }

            lock (_lock)
            {
                if (_default == null)
                {
                    var dict = new DicomDictionary
                    {
                        new DicomDictionaryEntry(
                            DicomMaskedTag.Parse("xxxx", "0000"),
                            "Group Length",
                            "GroupLength",
                            DicomVM.VM_1,
                            false,
                            DicomVR.UL)
                    };
                    try
                    {
#if NET35 || HOLOLENS
                        using (
                            var stream =
                                new MemoryStream(
                                    UnityEngine.Resources.Load <UnityEngine.TextAsset>("DICOM Dictionary").bytes))
                        {
                            var reader = new DicomDictionaryReader(dict, DicomDictionaryFormat.XML, stream);
                            reader.Process();
                        }
#else
                        var assembly = typeof(DicomDictionary).GetTypeInfo().Assembly;
                        using (
                            var stream = assembly.GetManifestResourceStream(
                                "Dicom.Dictionaries.DICOMDictionary.xml.gz"))
                        {
                            var gzip   = new GZipStream(stream, CompressionMode.Decompress);
                            var reader = new DicomDictionaryReader(dict, DicomDictionaryFormat.XML, gzip);
                            reader.Process();
                        }
#endif
                    }
                    catch (Exception e)
                    {
                        throw new DicomDataException(
                                  "Unable to load DICOM dictionary from resources.\n\n" + e.Message,
                                  e);
                    }
                    if (loadPrivateDictionary.GetValueOrDefault(true))
                    {
                        try
                        {
#if NET35 || HOLOLENS
                            using (
                                var stream =
                                    new MemoryStream(
                                        UnityEngine.Resources.Load <UnityEngine.TextAsset>("Private Dictionary").bytes))
                            {
                                var reader = new DicomDictionaryReader(dict, DicomDictionaryFormat.XML, stream);
                                reader.Process();
                            }
#else
                            var assembly = typeof(DicomDictionary).GetTypeInfo().Assembly;
                            using (
                                var stream =
                                    assembly.GetManifestResourceStream("Dicom.Dictionaries.PrivateDictionary.xml.gz"))
                            {
                                var gzip   = new GZipStream(stream, CompressionMode.Decompress);
                                var reader = new DicomDictionaryReader(dict, DicomDictionaryFormat.XML, gzip);
                                reader.Process();
                            }
#endif
                        }
                        catch (Exception e)
                        {
                            throw new DicomDataException(
                                      "Unable to load private dictionary from resources.\n\n" + e.Message,
                                      e);
                        }
                    }

                    _defaultIncludesPrivate = loadPrivateDictionary.GetValueOrDefault(true);
                    _default = dict;
                }
                else
                {
                    //ensure the race wasn't for two different "load private dictionary" states
                    if (loadPrivateDictionary.HasValue && _defaultIncludesPrivate != loadPrivateDictionary)
                    {
                        throw new DicomDataException("Default DICOM dictionary already loaded " +
                                                     (_defaultIncludesPrivate ? "with" : "without") +
                                                     "private dictionary and the current request to ensure the default dictionary is loaded requests that private dictionary " +
                                                     (loadPrivateDictionary.Value ? "is" : "is not") + " loaded");
                    }
                    return(_default);
                }

                //race is complete
                return(_default);
            }
        }
Example #28
0
        /// <summary>
        /// Gets a full name
        /// </summary>
        /// <param name="firstName">Use this first name.</param>
        /// <param name="lastName">use this last name.</param>
        /// <param name="withPrefix">Add a prefix?</param>
        /// <param name="withSuffix">Add a suffix?</param>
        public string FindName(string firstName = "", string lastName = "", bool?withPrefix = null, bool?withSuffix = null, Gender?gender = null)
        {
            gender = gender ?? this.Random.Enum <Gender>();
            if (string.IsNullOrWhiteSpace(firstName))
            {
                firstName = FirstName(gender);
            }
            if (string.IsNullOrWhiteSpace(lastName))
            {
                lastName = LastName(gender);
            }

            if (!withPrefix.HasValue && !withSuffix.HasValue)
            {
                withPrefix = Random.Bool();
                withSuffix = !withPrefix;
            }

            return(string.Format("{0} {1} {2} {3}",
                                 withPrefix.GetValueOrDefault() ? Prefix(gender) : "", firstName, lastName, withSuffix.GetValueOrDefault() ? Suffix() : "")
                   .Trim());
        }
Example #29
0
        public PageModel <GiftModel> GetGifts(GiftQuery query)
        {
            PageModel <GiftModel> pageModel = new PageModel <GiftModel>()
            {
                Total = 0
            };
            IQueryable <GiftModel> salesStatus = (
                from d in context.GiftInfo
                join b in context.MemberGrade on d.NeedGrade equals b.Id into j1
                from jd in j1.DefaultIfEmpty <MemberGrade>()
                select new GiftModel()
            {
                Id = d.Id,
                GiftName = d.GiftName,
                NeedIntegral = d.NeedIntegral,
                LimtQuantity = d.LimtQuantity,
                StockQuantity = d.StockQuantity,
                EndDate = d.EndDate,
                NeedGrade = d.NeedGrade,
                VirtualSales = d.VirtualSales,
                RealSales = d.RealSales,
                SalesStatus = d.SalesStatus,
                ImagePath = d.ImagePath,
                Sequence = d.Sequence,
                GiftValue = d.GiftValue,
                AddDate = d.AddDate,
                GradeIntegral = (jd == null ? 0 : jd.Integral),
                NeedGradeName = (jd == null ? "不限等级" : jd.GradeName)
            }).AsQueryable <GiftModel>();

            if (!string.IsNullOrWhiteSpace(query.skey))
            {
                salesStatus =
                    from d in salesStatus
                    where d.GiftName.Contains(query.skey)
                    select d;
            }
            if (query.status.HasValue)
            {
                DateTime now  = DateTime.Now;
                DateTime date = now.AddDays(1).Date;
                GiftInfo.GiftSalesStatus?nullable       = query.status;
                GiftInfo.GiftSalesStatus valueOrDefault = nullable.GetValueOrDefault();
                if (nullable.HasValue)
                {
                    switch (valueOrDefault)
                    {
                    case GiftInfo.GiftSalesStatus.Normal:
                    {
                        salesStatus =
                            from d in salesStatus
                            where (int)d.SalesStatus == 1 && (d.EndDate >= now)
                            select d;
                    }
                    break;

                    case GiftInfo.GiftSalesStatus.HasExpired:
                    {
                        salesStatus =
                            from d in salesStatus
                            where (int)d.SalesStatus == 1 && (d.EndDate < now)
                            select d;
                    }
                    break;
                    }
                }
                else
                {
                    salesStatus =
                        from d in salesStatus
                        where (int?)d.SalesStatus == (int?)query.status
                        select d;
                }
            }
            bool?nullable1 = query.isShowAll;

            if ((!nullable1.GetValueOrDefault() ? true : !nullable1.HasValue))
            {
                salesStatus =
                    from d in salesStatus
                    where (int)d.SalesStatus != -1
                    select d;
            }
            Func <IQueryable <GiftModel>, IOrderedQueryable <GiftModel> > orderBy = salesStatus.GetOrderBy <GiftModel>((IQueryable <GiftModel> d) =>
                                                                                                                       from o in d
                                                                                                                       orderby o.Sequence, o.Id descending
                                                                                                                       select o);

            switch (query.Sort)
            {
            case GiftQuery.GiftSortEnum.SalesNumber:
            {
                if (!query.IsAsc)
                {
                    orderBy = salesStatus.GetOrderBy <GiftModel>((IQueryable <GiftModel> o) =>
                                                                 from d in o
                                                                 orderby d.RealSales descending, d.Id descending
                                                                 select d);
                    break;
                }
                else
                {
                    orderBy = salesStatus.GetOrderBy <GiftModel>((IQueryable <GiftModel> o) =>
                                                                 from d in o
                                                                 orderby d.RealSales, d.Id descending
                                                                 select d);
                    break;
                }
            }

            case GiftQuery.GiftSortEnum.RealSalesNumber:
            {
                if (!query.IsAsc)
                {
                    orderBy = salesStatus.GetOrderBy <GiftModel>((IQueryable <GiftModel> o) =>
                                                                 from d in o
                                                                 orderby d.RealSales descending, d.Id descending
                                                                 select d);
                    break;
                }
                else
                {
                    orderBy = salesStatus.GetOrderBy <GiftModel>((IQueryable <GiftModel> o) =>
                                                                 from d in o
                                                                 orderby d.RealSales, d.Id descending
                                                                 select d);
                    break;
                }
            }

            default:
            {
                orderBy = salesStatus.GetOrderBy <GiftModel>((IQueryable <GiftModel> o) =>
                                                             from d in o
                                                             orderby d.Sequence, d.Id descending
                                                             select d);
                break;
            }
            }
            int num = 0;

            salesStatus      = salesStatus.GetPage(out num, query.PageNo, query.PageSize, orderBy);
            pageModel.Models = salesStatus;
            pageModel.Total  = num;
            return(pageModel);
        }
        public async Task <IActionResult> OneDeploy(
            [FromQuery] string type      = null,
            [FromQuery] bool async       = false,
            [FromQuery] string path      = null,
            [FromQuery] bool?restart     = true,
            [FromQuery] bool?clean       = null,
            [FromQuery] bool ignoreStack = false
            )
        {
            string remoteArtifactUrl = null;

            using (_tracer.Step(Constants.OneDeploy))
            {
                string deploymentId = GetExternalDeploymentId(Request);

                try
                {
                    if (Request.MediaTypeContains("application/json"))
                    {
                        string jsonString;
                        using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
                        {
                            jsonString = await reader.ReadToEndAsync();
                        }

                        var requestJson = JObject.Parse(jsonString);

                        if (ArmUtils.IsArmRequest(Request))
                        {
                            requestJson = requestJson.Value <JObject>("properties");

                            type        = requestJson.Value <string>("type");
                            async       = requestJson.Value <bool>("async");
                            path        = requestJson.Value <string>("path");
                            restart     = requestJson.Value <bool?>("restart");
                            clean       = requestJson.Value <bool?>("clean");
                            ignoreStack = requestJson.Value <bool>("ignorestack");
                        }

                        remoteArtifactUrl = GetArtifactURLFromJSON(requestJson);
                    }
                }
                catch (Exception ex)
                {
                    return(StatusCode400(ex.ToString()));
                }

                //
                // 'async' is not a CSharp-ish variable name. And although it is a valid variable name, some
                // IDEs confuse it to be the 'async' keyword in C#.
                // On the other hand, isAsync is not a good name for the query-parameter.
                // So we use 'async' as the query parameter, and then assign it to the C# variable 'isAsync'
                // at the earliest. Hereon, we use just 'isAsync'.
                //
                bool isAsync = async;

                ArtifactType artifactType = ArtifactType.Unknown;
                try
                {
                    artifactType = (ArtifactType)Enum.Parse(typeof(ArtifactType), type, ignoreCase: true);
                }
                catch
                {
                    return(StatusCode400($"type='{type}' not recognized"));
                }

                var deploymentInfo = new ArtifactDeploymentInfo(_environment, _traceFactory)
                {
                    ArtifactType = artifactType,
                    AllowDeploymentWhileScmDisabled = true,
                    Deployer                = Constants.OneDeploy,
                    IsContinuous            = false,
                    AllowDeferredDeployment = false,
                    IsReusable              = false,
                    TargetRootPath          = _environment.WebRootPath,
                    TargetChangeset         = DeploymentManager.CreateTemporaryChangeSet(message: Constants.OneDeploy),
                    CommitId                = null,
                    ExternalDeploymentId    = deploymentId,
                    RepositoryType          = RepositoryType.None,
                    RemoteURL               = remoteArtifactUrl,
                    Fetch = OneDeployFetch,
                    DoFullBuildByDefault = false,
                    Message                = Constants.OneDeploy,
                    WatchedFileEnabled     = false,
                    CleanupTargetDirectory = clean.GetValueOrDefault(false),
                    RestartAllowed         = restart.GetValueOrDefault(true),
                };

                string error;
                switch (artifactType)
                {
                case ArtifactType.War:
                    if (!OneDeployHelper.EnsureValidStack(artifactType, new List <string> {
                        OneDeployHelper.Tomcat, OneDeployHelper.JBossEap
                    }, ignoreStack, out error))
                    {
                        return(StatusCode400(error));
                    }

                    // If path is non-null, we assume this is a legacy war deployment, i.e. equivalent of wardeploy
                    if (!string.IsNullOrWhiteSpace(path))
                    {
                        //
                        // For legacy war deployments, the only path allowed is webapps/<directory-name>
                        //

                        if (!OneDeployHelper.EnsureValidPath(artifactType, OneDeployHelper.WwwrootDirectoryRelativePath, ref path, out error))
                        {
                            return(StatusCode400(error));
                        }

                        if (!OneDeployHelper.IsLegacyWarPathValid(path))
                        {
                            return(StatusCode400($"path='{path}' is invalid. When type={artifactType}, the only allowed paths are webapps/<directory-name> or /home/site/wwwroot/webapps/<directory-name>. " +
                                                 $"Example: path=webapps/ROOT or path=/home/site/wwwroot/webapps/ROOT"));
                        }

                        deploymentInfo.TargetRootPath = Path.Combine(_environment.WebRootPath, path);
                        deploymentInfo.Fetch          = LocalZipHandler;

                        // Legacy war deployment is equivalent to wardeploy
                        // So always do clean deploy.
                        deploymentInfo.CleanupTargetDirectory = true;
                        artifactType = ArtifactType.Zip;
                    }
                    else
                    {
                        // For type=war, if no path is specified, the target file is app.war
                        deploymentInfo.TargetFileName = "app.war";
                    }

                    break;

                case ArtifactType.Jar:
                    if (!OneDeployHelper.EnsureValidStack(artifactType, new List <string> {
                        OneDeployHelper.JavaSE
                    }, ignoreStack, out error))
                    {
                        return(StatusCode400(error));
                    }

                    deploymentInfo.TargetFileName = "app.jar";
                    break;

                case ArtifactType.Ear:
                    if (!OneDeployHelper.EnsureValidStack(artifactType, new List <string> {
                        OneDeployHelper.JBossEap
                    }, ignoreStack, out error))
                    {
                        return(StatusCode400(error));
                    }

                    deploymentInfo.TargetFileName = "app.ear";
                    break;

                case ArtifactType.Lib:
                    if (!OneDeployHelper.EnsureValidPath(artifactType, OneDeployHelper.LibsDirectoryRelativePath, ref path, out error))
                    {
                        return(StatusCode400(error));
                    }

                    deploymentInfo.TargetRootPath = OneDeployHelper.GetAbsolutePath(_environment, OneDeployHelper.LibsDirectoryRelativePath);
                    OneDeployHelper.SetTargetSubDirectoyAndFileNameFromRelativePath(deploymentInfo, path);
                    break;

                case ArtifactType.Startup:
                    deploymentInfo.TargetRootPath = OneDeployHelper.GetAbsolutePath(_environment, OneDeployHelper.ScriptsDirectoryRelativePath);
                    OneDeployHelper.SetTargetSubDirectoyAndFileNameFromRelativePath(deploymentInfo, OneDeployHelper.GetStartupFileName());
                    break;

                case ArtifactType.Script:
                    if (!OneDeployHelper.EnsureValidPath(artifactType, OneDeployHelper.ScriptsDirectoryRelativePath, ref path, out error))
                    {
                        return(StatusCode400(error));
                    }

                    deploymentInfo.TargetRootPath = OneDeployHelper.GetAbsolutePath(_environment, OneDeployHelper.ScriptsDirectoryRelativePath);
                    OneDeployHelper.SetTargetSubDirectoyAndFileNameFromRelativePath(deploymentInfo, path);

                    break;

                case ArtifactType.Static:
                    if (!OneDeployHelper.EnsureValidPath(artifactType, OneDeployHelper.WwwrootDirectoryRelativePath, ref path, out error))
                    {
                        return(StatusCode400(error));
                    }

                    OneDeployHelper.SetTargetSubDirectoyAndFileNameFromRelativePath(deploymentInfo, path);

                    break;

                case ArtifactType.Zip:
                    deploymentInfo.Fetch = LocalZipHandler;
                    deploymentInfo.TargetSubDirectoryRelativePath = path;

                    // Deployments for type=zip default to clean=true
                    deploymentInfo.CleanupTargetDirectory = clean.GetValueOrDefault(true);

                    break;

                default:
                    return(StatusCode400($"Artifact type '{artifactType}' not supported"));
                }

                return(await PushDeployAsync(deploymentInfo, isAsync, HttpContext));
            }
        }
Example #31
0
        public static bool?ImpRefConv(object value, Type from, Type to)
        {
            bool?success = null;

            if (@from == to)
            {
                // identity
                success = true;
            }

            else if (to == typeof(object))
            {
                // ref -> object
                success = true;
            }

            else if (value == null)
            {
                // null literal -> Ref-type
                success = !to.IsValueType;
            }

            else if (false)
            {
                // ref -> dynamic (6.1.8)
                // figure out how to do this
                ;
            }

            else if (@from.IsArray && to.IsArray)
            {
                // Array-type -> Array-type
                bool sameRank = (@from.GetArrayRank() == to.GetArrayRank());
                bool bothRef  = ([email protected]().IsValueType&& !to.GetElementType().IsValueType);
                bool?impConv  = ImpRefConv(value, @from.GetElementType(), to.GetElementType());
                success = (sameRank && bothRef && impConv.GetValueOrDefault(false));
            }

            // Conversion involving type parameters (6.1.10)
            else if (to.IsGenericParameter)
            {
                //if ( fromArg.GetType().Name.Equals(to.Name)) {
                if (to.GenericParameterAttributes != GenericParameterAttributes.None)
                {
                    if ((int)(to.GenericParameterAttributes & GenericParameterAttributes.ReferenceTypeConstraint) != 0)
                    {
                        ;
                    }
                }
                else
                {
                }


                /*genArg.GetGenericParameterConstraints();
                 * genArg.GenericParameterAttributes;*/
                //if( mi.GetGenericArguments()[?]
                //var t = a.GetType().GetMethod("Foo", BindingFlags.Public | BindingFlags.Instance).GetGenericArguments()[0].GetGenericParameterConstraints();//.GenericParameterAttributes;
            }

            // Boxing Conversions (6.1.7)
            else if (@from.IsValueType && !to.IsValueType)
            {
                return(IsBoxingConversion(@from, to));
            }

            else if ((@from.IsClass && to.IsClass) || (@from.IsClass && to.IsInterface) || (@from.IsInterface && to.IsInterface))
            {
                // class -> class  OR  class -> interface  OR  interface -> interface
                success = CrawlThatShit(to.GetHashCode(), @from, new List <int>());
            }

            else if (@from.IsArray && CrawlThatShit(to.GetHashCode(), typeof(Array), new List <int>()))
            {
                // Array-type -> System.array
                return(true);
            }

            else if (@from.IsArray && @from.GetArrayRank() == 1 && to.IsGenericType && CrawlThatShit(to.GetHashCode(), typeof(IList <>), new List <int>()))
            {
                // Single dim array -> IList<>
                success = ImpRefConv(value, @from.GetElementType(), to.GetGenericTypeDefinition());
            }



            return(success);
        }
Example #32
0
        internal override Hashtable ToHashtable()
        {
            Hashtable hashtable = new Hashtable();
            bool?     nullable1 = this.AllowPointSelect;
            bool?     nullable2 = this.AllowPointSelect_DefaultValue;

            if (nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ||
                nullable1.HasValue != nullable2.HasValue)
            {
                hashtable.Add((object)"allowPointSelect", (object)this.AllowPointSelect);
            }
            if (this.Animation.IsDirty())
            {
                hashtable.Add((object)"animation", (object)this.Animation.ToJSON());
            }
            double?nullable3 = this.AnimationLimit;
            double?nullable4 = this.AnimationLimit_DefaultValue;

            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"animationLimit", (object)this.AnimationLimit);
            }
            if (this.BorderColor != this.BorderColor_DefaultValue)
            {
                hashtable.Add((object)"borderColor", (object)this.BorderColor);
            }
            nullable4 = this.BorderWidth;
            nullable3 = this.BorderWidth_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
            {
                hashtable.Add((object)"borderWidth", (object)this.BorderWidth);
            }
            if (this.Center != this.Center_DefaultValue)
            {
                hashtable.Add((object)"center", (object)this.Center);
            }
            if (this.ClassName != this.ClassName_DefaultValue)
            {
                hashtable.Add((object)"className", (object)this.ClassName);
            }
            nullable3 = this.ColorIndex;
            nullable4 = this.ColorIndex_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"colorIndex", (object)this.ColorIndex);
            }
            if (this.Colors != this.Colors_DefaultValue)
            {
                hashtable.Add((object)"colors", (object)this.Colors);
            }
            if (this.Cursor != this.Cursor_DefaultValue)
            {
                hashtable.Add((object)"cursor", (object)Highcharts.FirstCharacterToLower(this.Cursor.ToString()));
            }
            if (this.Data.Any <PieSeriesData>())
            {
                hashtable.Add((object)"data", (object)this.HashifyList((IEnumerable)this.Data));
            }
            if (this.DataLabels.IsDirty())
            {
                hashtable.Add((object)"dataLabels", (object)this.DataLabels.ToHashtable());
            }
            nullable4 = this.Depth;
            nullable3 = this.Depth_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
            {
                hashtable.Add((object)"depth", (object)this.Depth);
            }
            if (this.Description != this.Description_DefaultValue)
            {
                hashtable.Add((object)"description", (object)this.Description);
            }
            nullable2 = this.EnableMouseTracking;
            nullable1 = this.EnableMouseTracking_DefaultValue;
            if (nullable2.GetValueOrDefault() != nullable1.GetValueOrDefault() ||
                nullable2.HasValue != nullable1.HasValue)
            {
                hashtable.Add((object)"enableMouseTracking", (object)this.EnableMouseTracking);
            }
            nullable3 = this.EndAngle;
            nullable4 = this.EndAngle_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"endAngle", (object)this.EndAngle);
            }
            if (this.Events.IsDirty())
            {
                hashtable.Add((object)"events", (object)this.Events.ToHashtable());
            }
            nullable1 = this.GetExtremesFromAll;
            nullable2 = this.GetExtremesFromAll_DefaultValue;
            if (nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ||
                nullable1.HasValue != nullable2.HasValue)
            {
                hashtable.Add((object)"getExtremesFromAll", (object)this.GetExtremesFromAll);
            }
            if (this.Id != this.Id_DefaultValue)
            {
                hashtable.Add((object)"id", (object)this.Id);
            }
            nullable2 = this.IgnoreHiddenPoint;
            nullable1 = this.IgnoreHiddenPoint_DefaultValue;
            if (nullable2.GetValueOrDefault() != nullable1.GetValueOrDefault() ||
                nullable2.HasValue != nullable1.HasValue)
            {
                hashtable.Add((object)"ignoreHiddenPoint", (object)this.IgnoreHiddenPoint);
            }
            nullable4 = this.Index;
            nullable3 = this.Index_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
            {
                hashtable.Add((object)"index", (object)this.Index);
            }
            if (this.InnerSize != this.InnerSize_DefaultValue)
            {
                hashtable.Add((object)"innerSize", (object)this.InnerSize);
            }
            if (this.Keys != this.Keys_DefaultValue)
            {
                hashtable.Add((object)"keys", (object)this.Keys);
            }
            nullable3 = this.LegendIndex;
            nullable4 = this.LegendIndex_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"legendIndex", (object)this.LegendIndex);
            }
            if (this.LinkedTo != this.LinkedTo_DefaultValue)
            {
                hashtable.Add((object)"linkedTo", (object)this.LinkedTo);
            }
            nullable4 = this.MinSize;
            nullable3 = this.MinSize_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
            {
                hashtable.Add((object)"minSize", (object)this.MinSize);
            }
            if (this.Name != this.Name_DefaultValue)
            {
                hashtable.Add((object)"name", (object)this.Name);
            }
            if (this.Point.IsDirty())
            {
                hashtable.Add((object)"point", (object)this.Point.ToHashtable());
            }
            nullable1 = this.Selected;
            nullable2 = this.Selected_DefaultValue;
            if (nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ||
                nullable1.HasValue != nullable2.HasValue)
            {
                hashtable.Add((object)"selected", (object)this.Selected);
            }
            if (this.Shadow.IsDirty())
            {
                hashtable.Add((object)"shadow", (object)this.Shadow.ToHashtable());
            }
            nullable2 = this.ShowInLegend;
            nullable1 = this.ShowInLegend_DefaultValue;
            if (nullable2.GetValueOrDefault() != nullable1.GetValueOrDefault() ||
                nullable2.HasValue != nullable1.HasValue)
            {
                hashtable.Add((object)"showInLegend", (object)this.ShowInLegend);
            }
            if (this.Size != this.Size_DefaultValue)
            {
                hashtable.Add((object)"size", (object)this.Size);
            }
            nullable3 = this.SlicedOffset;
            nullable4 = this.SlicedOffset_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"slicedOffset", (object)this.SlicedOffset);
            }
            nullable4 = this.StartAngle;
            nullable3 = this.StartAngle_DefaultValue;
            if (nullable4.GetValueOrDefault() != nullable3.GetValueOrDefault() ||
                nullable4.HasValue != nullable3.HasValue)
            {
                hashtable.Add((object)"startAngle", (object)this.StartAngle);
            }
            if (this.States.IsDirty())
            {
                hashtable.Add((object)"states", (object)this.States.ToHashtable());
            }
            nullable1 = this.StickyTracking;
            nullable2 = this.StickyTracking_DefaultValue;
            if (nullable1.GetValueOrDefault() != nullable2.GetValueOrDefault() ||
                nullable1.HasValue != nullable2.HasValue)
            {
                hashtable.Add((object)"stickyTracking", (object)this.StickyTracking);
            }
            if (this.Tooltip.IsDirty())
            {
                hashtable.Add((object)"tooltip", (object)this.Tooltip.ToHashtable());
            }
            if (this.Type != this.Type_DefaultValue)
            {
                hashtable.Add((object)"type", (object)Highcharts.FirstCharacterToLower(this.Type.ToString()));
            }
            nullable2 = this.Visible;
            nullable1 = this.Visible_DefaultValue;
            if (nullable2.GetValueOrDefault() != nullable1.GetValueOrDefault() ||
                nullable2.HasValue != nullable1.HasValue)
            {
                hashtable.Add((object)"visible", (object)this.Visible);
            }
            nullable3 = this.ZIndex;
            nullable4 = this.ZIndex_DefaultValue;
            if (nullable3.GetValueOrDefault() != nullable4.GetValueOrDefault() ||
                nullable3.HasValue != nullable4.HasValue)
            {
                hashtable.Add((object)"zIndex", (object)this.ZIndex);
            }
            if (this.ZoneAxis != this.ZoneAxis_DefaultValue)
            {
                hashtable.Add((object)"zoneAxis", (object)this.ZoneAxis);
            }
            if (this.Zones != this.Zones_DefaultValue)
            {
                hashtable.Add((object)"zones", (object)this.HashifyList((IEnumerable)this.Zones));
            }
            return(hashtable);
        }