Exemplo n.º 1
0
        private bool AssemblyIsValid() => Wrappers.DoSafe(() =>
        {
            var properties = GetAllProperties();

            var apiMethodAnnotatedProperties = properties
                                               .Where(p => p.GetCustomAttributes <ApiRequestProcessorAttribute>().Any())
                                               .ToList();
            if (!apiMethodAnnotatedProperties.Any())
            {
                LogWarning("Assembly does not contain any annotated API members, failed to generate docs");
                return(false);
            }

            var staticRequestProcessorProperties = properties
                                                   .Where(p => p.GetGetMethod().IsStatic &&
                                                          p.ExtendsOrImplements <IRequestProcessor>())
                                                   .ToList();

            var incorrectAnnotatedProperties = apiMethodAnnotatedProperties
                                               .Except(staticRequestProcessorProperties)
                                               .ToList();
            if (incorrectAnnotatedProperties.Any())
            {
                var incorrectAnnotatedPropertiesDescription = string.Join("\n",
                                                                          incorrectAnnotatedProperties.Select(
                                                                              p => $"{p.PropertyType.GetGenericArguments().First().FullName}.{p.Name}"));
                LogWarning(
                    $"The following properties are annotated as API members but do not implement IRequestProcessor:\n{incorrectAnnotatedPropertiesDescription}");
                return(false);
            }

            _apiMemberPropertyInfos = apiMethodAnnotatedProperties;
            return(true);
        });
Exemplo n.º 2
0
        public IGenerationModel ToGenerationModel(IGenerationConfig config)
        {
            if (!Handlers.Any())
            {
                throw new InvalidOperationException("No method handlers configured for message type " + MessageType.FullName);
            }

            var configureMethods = Handlers.Select(x => x.HandlerType).Distinct()
                                   .Select(x => x.GetTypeInfo().GetMethod("Configure",
                                                                          new Type[] { typeof(HandlerChain) }));

            foreach (var method in configureMethods)
            {
                method?.Invoke(null, new object[] { this });
            }

            foreach (var methodCall in Handlers.ToArray())
            {
                methodCall.Method.ForAttribute <ModifyHandlerChainAttribute>(att => att.Modify(this));
            }

            foreach (var handlerType in Handlers.Select(x => x.HandlerType).Distinct().ToArray())
            {
                handlerType.ForAttribute <ModifyHandlerChainAttribute>(att => att.Modify(this));
            }

            var i = 0;
            var cascadingHandlers = Handlers.Where(x => x.ReturnVariable != null)
                                    .Select(x => new CaptureCascadingMessages(x.ReturnVariable, ++i));

            var frames = Wrappers.Concat(Handlers).Concat(cascadingHandlers).ToList();

            return(new MessageHandlerGenerationModel(TypeName, MessageType, config, frames));
        }
Exemplo n.º 3
0
        static void EnterControlLoop()
        {
            custMgr.Login();
            while (true)
            {
                Console.WriteLine("\n\n");
                Console.WriteLine("1:Order Options\n2:Customer Options\n3:Location Options");
                Console.Write("Enter the number for your choice:");
                int choice = Wrappers.ReadInt();
                Console.WriteLine($"{choice}\n\n");
                switch (choice)
                {
                case 1:
                    ordMgr.DisplayOptions();
                    break;

                case 2:
                    custMgr.DisplayOptions();
                    break;

                case 3:
                    locMgr.DisplayOptions();
                    break;

                default:
                    Console.WriteLine("Please enter a valid option");
                    continue;
                }
            }
        }
Exemplo n.º 4
0
        public void DisplayOptions()
        {
            Console.WriteLine("\n\n");
            while (true)
            {
                Console.WriteLine("1: Place Order\n2: Add New Customer\n3: Search Customers");
                Console.WriteLine("Enter the number for your option");
                int choice = Wrappers.ReadInt();
                switch (choice)
                {
                case 1:
                    AddOrder();
                    return;

                case 2:
                    AddCust();
                    return;

                case 3:
                    SearchCust();
                    return;

                default:
                    Console.WriteLine("Please enter a valid option");
                    break;
                }
            }
        }
Exemplo n.º 5
0
        public void Login()
        {
            bool loggingIn = true;

            while (loggingIn)
            {
                Console.WriteLine("1: Login\n2: Add user");
                int input = Wrappers.ReadInt();
                if (input == 1)
                {
                    while (true)
                    {
                        try
                        {
                            VerifyUser();
                            return;
                        }
                        catch (NullReferenceException)
                        {
                            Console.WriteLine("Username/email not found");
                        }
                    }
                }
                else
                {
                    if (AddCust())
                    {
                        return;
                    }
                }
            }
        }
Exemplo n.º 6
0
        protected override void PopulateWrappers( )
        {
            Wrappers.Add(ReferenceOutput.HeightSpeed,
                         CharacteristicWrapper1);

            Wrappers.Add(ReferenceOutput.Two,
                         CharacteristicWrapper2);

            Wrappers.Add(ReferenceOutput.Three,
                         CharacteristicWrapper3);

            Wrappers.Add(ReferenceOutput.Four,
                         CharacteristicWrapper4);

            Wrappers.Add(ReferenceOutput.Five,
                         CharacteristicWrapper5);

            Wrappers.Add(ReferenceOutput.Six,
                         CharacteristicWrapper6);

            Wrappers.Add(ReferenceOutput.Seven,
                         CharacteristicWrapper7);

            Wrappers.Add(ReferenceOutput.Eight,
                         CharacteristicWrapper8);

            Wrappers.Add(ReferenceOutput.Mask,
                         CharacteristicWrapper9);

            Wrappers.Add(ReferenceOutput.DetectMask,
                         CharacteristicWrapper10);
        }
Exemplo n.º 7
0
        public static IWrapperLoader GetLoader(string filename)
        {
            var info      = new FileInfo(filename);
            var extension = info.Extension.TrimStart('.');

            return(Wrappers.FirstOrDefault(x => x.Extensions.Any(y => y.Equals(extension, StringComparison.InvariantCultureIgnoreCase))));
        }
Exemplo n.º 8
0
    /* Methods */

    public void LoadForCurrentProcess()
    {
        var application = FindThisApplication();

        Wrappers.ThrowIfNull(application, Errors.UnableToFindApplication);
        LoadForAppConfig(application);
    }
Exemplo n.º 9
0
        public void DisplayOptions()
        {
            Console.WriteLine("1: Search orders by location\n2: Search orders by customer\n3: Get order details\n4: Print all orders\n5: Display order stats");
            Console.WriteLine("Enter the number for your option:");
            while (true)
            {
                int choice = Wrappers.ReadInt();
                switch (choice)
                {
                case 1:
                    PrintOrders(1);
                    return;

                case 2:
                    PrintOrders(2);
                    return;

                case 3:
                    PrintOrders(3);
                    return;

                case 5:
                    DisplayOrderStats();
                    return;

                default:
                    PrintOrders(0);
                    return;
                }
            }
        }
Exemplo n.º 10
0
        public static Transform CreateMenuNestedButton(string text, string tooltip, Color textColor, Color backgroundColor, float x_pos, float y_pos, Transform parent)
        {
            var       quickMenu = Wrappers.GetQuickMenu();
            Transform menu      = InstantiateGameobject("menu");

            menu.name = $"MENU_INDEX_{x_pos}_{y_pos}";

            CreateButton(ButtonType.Default, text, tooltip, textColor, backgroundColor, x_pos, y_pos, parent, new Action(() =>
            {
                ButtonAPI.ShowCustomMenu(menu.name);
            }));

            IEnumerator enumerator = menu.transform.GetEnumerator();

            while (enumerator.MoveNext())
            {
                Il2CppSystem.Object obj     = enumerator.Current;
                Transform           btnEnum = obj.Cast <Transform>();
                if (btnEnum != null)
                {
                    UnityEngine.Object.Destroy(btnEnum.gameObject);
                }
            }

            CreateButton(ButtonType.Default, "Back", "Go Back to the previous menu", Color.cyan, Color.white, 4, 2, menu, new Action(() => { ButtonAPI.ShowCustomMenu($"MENU_INDEX_0_0"); }));

            return(menu);
        }
Exemplo n.º 11
0
 private static Dvtk.Events.ReportLevel _Convert(
     Wrappers.WrappedValidationMessageLevel activityReportLevel)
 {
     switch (activityReportLevel)
     {
         case Wrappers.WrappedValidationMessageLevel.None:
             return Dvtk.Events.ReportLevel.None;
         case Wrappers.WrappedValidationMessageLevel.Error:
             return Dvtk.Events.ReportLevel.Error;
         case Wrappers.WrappedValidationMessageLevel.Debug:
             return Dvtk.Events.ReportLevel.Debug;
         case Wrappers.WrappedValidationMessageLevel.Warning:
             return Dvtk.Events.ReportLevel.Warning;
         case Wrappers.WrappedValidationMessageLevel.Information:
             return Dvtk.Events.ReportLevel.Information;
         case Wrappers.WrappedValidationMessageLevel.Scripting:
             return Dvtk.Events.ReportLevel.Scripting;
         case Wrappers.WrappedValidationMessageLevel.ScriptName:
             return Dvtk.Events.ReportLevel.ScriptName;
         case Wrappers.WrappedValidationMessageLevel.MediaFilename:
             return Dvtk.Events.ReportLevel.MediaFilename;
         case Wrappers.WrappedValidationMessageLevel.DicomObjectRelationship:
             return Dvtk.Events.ReportLevel.DicomObjectRelationship;
         case Wrappers.WrappedValidationMessageLevel.DulpStateMachine:
             return Dvtk.Events.ReportLevel.DulpStateMachine;
         case Wrappers.WrappedValidationMessageLevel.WareHouseLabel:
             return Dvtk.Events.ReportLevel.WareHouseLabel;
         default: throw new System.ArithmeticException();
     }
 }
Exemplo n.º 12
0
        public bool AddCust()
        {
            string first_name = "", last_name = "", user_name = "", email = "", pwd = "", ver_pwd = " ";

            Console.WriteLine("Adding user, enter empty string at any time to quit:");
            //Short circuit to quit if user enters empty string
            if (Wrappers.ReadString("Enter first name", out first_name) ||
                Wrappers.ReadString("Enter last name", out last_name) ||
                Wrappers.ReadString("Enter username", out user_name) ||
                Wrappers.ReadString("Enter email", out email))
            {
                Console.WriteLine("Quiting");
                return(false);
            }
            else
            {
                do
                {
                    Console.WriteLine("Enter password");
                    pwd = EnterPass();
                    Console.WriteLine("\nVerify password");
                    ver_pwd = EnterPass();
                } while (pwd != ver_pwd);
                if (ValidateCustomerInfo(first_name, last_name, user_name, email, pwd))
                {
                    current_id = DAL.AddCust(first_name, last_name, user_name, email, pwd);
                    return(true);
                }
                return(false);
            }
        }
Exemplo n.º 13
0
        async Task ExecuteLoadItemsCommand()
        {
            try
            {
                Stores.Clear();
                var palletMaster = await DataStore.GetPalletMaterDataAsync();

                foreach (var item in palletMaster.Stores)
                {
                    Stores.Add(item);
                }

                Status.Clear();
                foreach (var item in palletMaster.Status)
                {
                    Status.Add(item);
                }

                Categories.Clear();
                foreach (var item in palletMaster.Categories)
                {
                    Categories.Add(item);
                }

                Wrappers.Clear();
                foreach (var item in palletMaster.Wrappers)
                {
                    Wrappers.Add(item);
                }

                Shippers.Clear();
                foreach (var item in palletMaster.Shippers)
                {
                    Shippers.Add(item);
                }

                Suppliers.Clear();
                foreach (var item in palletMaster.Suppliers)
                {
                    Suppliers.Add(item);
                }

                Builders.Clear();
                foreach (var item in palletMaster.Builders)
                {
                    Builders.Add(item);
                }

                PalletTypes.Clear();
                foreach (var item in palletMaster.PalletTypes)
                {
                    PalletTypes.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
Exemplo n.º 14
0
 public void ReportActivity(
     Wrappers.WrappedValidationMessageLevel activityReportLevel,
     System.String message)
 {
     ActivityReportEventArgs e =
         new ActivityReportEventArgs(_Convert(activityReportLevel), message);
     this.m_parentSession._OnActivityReport(e);
 }
        public static string ToJsonInventory <T>(T[] array, bool prettyPrint)
        {
            Wrappers <T> wrapper = new Wrappers <T> {
                inventoryItems = array
            };

            return(JsonUtility.ToJson(wrapper, prettyPrint));
        }
        public static string ToJsonPlanetItems <T>(T[] array, bool prettyPrint)
        {
            Wrappers <T> wrapper = new Wrappers <T> {
                planetObjects = array
            };

            return(JsonUtility.ToJson(wrapper, prettyPrint));
        }
        public static string ToJson <T>(T[] array)
        {
            Wrappers <T> wrapper = new Wrappers <T> {
                planetObjects = array
            };

            return(JsonUtility.ToJson(wrapper));
        }
Exemplo n.º 18
0
 internal SocketService(Session parentSession, Wrappers.ISockets iSocketsDelegate)
     : base(parentSession)
 {
     m_delegate = iSocketsDelegate;
     m_sutSocketService      = new CSutSocketService(parentSession, m_delegate);
     m_dvtSocketService      = new CDvtSocketService(parentSession, m_delegate);
     m_secureSocketService   = new CSecureSocketService(parentSession, m_delegate);
 }
Exemplo n.º 19
0
        protected override void PopulateWrappers( )
        {
            Wrappers.Add(Control.Control2Key,
                         CharacteristicWrapper1);

            Wrappers.Add(Control.Control3Key,
                         CharacteristicWrapper1);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Wraps this instance with a new wrapper.
        /// </summary>
        /// <param name="wrapper">The new modifier.</param>
        public void WrapExpression(MetaGraphTypes wrapper)
        {
            var newArray = new MetaGraphTypes[Wrappers.Length + 1];

            Wrappers.CopyTo(newArray, 1);
            newArray[0] = wrapper;
            Wrappers    = newArray;
        }
Exemplo n.º 21
0
        private void OnItemLoad(object item)
        {
            IItem wrapped = Wrappers.Wrap <IItem>(item, false);

            // TODO: only register for desired types
            if (wrapped != null)
            {
                new MailEventHooker(wrapped, this);
            }
        }
Exemplo n.º 22
0
        private void WriteRequestProcessorRemarks(MemberInfo info)
        {
            var processorAttribute = GetApiRequestProcessorAttributeUnsafe(info);

            if (string.IsNullOrWhiteSpace(processorAttribute.Remarks))
            {
                return;
            }

            Wrappers.AppendPaddedLines(_builder, RemarksHeaderPattern, processorAttribute.Remarks);
        }
Exemplo n.º 23
0
        public override object Clone()
        {
            var result = new UrgentPlan();

            result.EstimatedExecutionTime = EstimatedExecutionTime;
            result.NodesTimings           = NodesTimings == null ? null : NodesTimings.Select(nt => nt.Clone() as TaskScheduler.NodeAvailabilityTime).ToList();
            result.Plan        = Plan == null ? null : Plan.Select(t => t.Clone() as ActiveEstimatedTask).ToList();
            result.Wrappers    = Wrappers == null ? null : Wrappers.Select(w => w.Clone() as TaskScheduler.NodeAvailabilityTime).ToArray();
            result.Estimations = Estimations;
            return(result);
        }
Exemplo n.º 24
0
 protected override void PopulateWrappers( )
 {
     Wrappers.Add(GenericAccess.CharacteristicDeviceName,
                  CharacteristicWrapper1);
     Wrappers.Add(GenericAccess.CharacteristicAppearance,
                  CharacteristicWrapper2);
     Wrappers.Add(GenericAccess.CharacteristicParameters,
                  CharacteristicWrapper3);
     Wrappers.Add(GenericAccess.CharacteristicResolution,
                  CharacteristicWrapper4);
 }
Exemplo n.º 25
0
        private bool WriteAllSections() => Wrappers.DoSafe(() =>
        {
            var sections = SplitSections(_apiMemberPropertyInfos);

            foreach (var section in sections)
            {
                WriteOneSection(section);
                _builder.AppendLine(SectionSeparatorPattern);
            }

            return(true);
        });
Exemplo n.º 26
0
 public static void Update()
 {
     if (!Initialised)
     {
         if (Wrappers.GetQuickMenu() != null)
         {
             CleanupUI();
             //SetColorTheme(Color.green, Color.white, 0.5f);
             Initialised = true;
         }
     }
 }
Exemplo n.º 27
0
        public static void RayTeleport()
        {
            Ray ray = new Ray(Wrappers.GetPlayerCamera().transform.position, Wrappers.GetPlayerCamera().transform.forward);

            RaycastHit[] hits = Physics.RaycastAll(ray);
            if (hits.Length > 0)
            {
                RaycastHit raycastHit = hits[0];
                var        thisPlayer = PlayerWrappers.GetCurrentPlayer();
                thisPlayer.transform.position = raycastHit.point;
            }
        }
Exemplo n.º 28
0
        private Task <bool> TryWriteResultAsync() => Wrappers.DoSafeAsync(async() =>
        {
            var result = _builder.ToString();
            LogDebug($"Total symbols: {_builder.Length} (Capacity used: {_builder.Capacity})");
            _builder.Clear();
            using (var writer = new StreamWriter(_outputStream))
            {
                await writer.WriteAsync(result);
                await writer.FlushAsync();
            }

            return(true);
        });
Exemplo n.º 29
0
        private void WriteRequestProcessorHeader(MemberInfo info)
        {
            var processorAttribute = GetApiRequestProcessorAttributeUnsafe(info);

            var uriInfo = $"{processorAttribute.Method.ToString().ToUpperInvariant()} {processorAttribute.SubUri}";

            _builder.AppendLine($"{MethodHeaderPrefixPattern}{uriInfo}");
            Wrappers.AppendPaddedLines(_builder, processorAttribute.Description);
            WriteRequestProcessorState(info);
            var authWord = processorAttribute.AuthRequired ? YesWordPattern : NoWordPattern;

            _builder.AppendLine($"{AuthDescriptionPattern}{authWord}");
            _builder.AppendLine();
        }
Exemplo n.º 30
0
    /// <summary>
    /// Loads all mods directly into the process.
    /// </summary>
    public void LoadForAppConfig(IApplicationConfig applicationConfig)
    {
        Wrappers.ThrowIfENotEqual(IsLoaded, false, Errors.ModLoaderAlreadyInitialized);
        Application = applicationConfig;

        // Get all mods and their paths.
        var allModsForApplication = ApplicationConfig.GetAllMods(Application, out var allMods, LoaderConfig.GetModConfigDirectory());

        // Get list of mods to load and load them.
        var modsToLoad = allModsForApplication.Where(x => x.Enabled).Select(x => x.Generic.Config);

        LoadModsWithDependencies(modsToLoad, allMods);
        Manager.LoaderApi.OnModLoaderInitialized();
        IsLoaded = true;
    }
Exemplo n.º 31
0
        public async Task Refresh_ForCharacteristicsHeightSpeedNotFound_DoesNotNotify( )
        {
            var sut = CreateSut( );

            ServiceWrapper.Uuid
            .Returns(sut.GattServiceUuid);

            sut.Initialize <ReferenceOutput> ( );

            Wrappers.Remove(ReferenceOutput.HeightSpeed);

            await sut.Refresh( );

            _subjectHeightSpeed.DidNotReceive( )
            .OnNext(Arg.Any <RawValueChangedDetails> ( ));
        }
Exemplo n.º 32
0
        protected override void GetData()
        {
            UnitOfWork = Container.Resolve <IUnitOfWork>();

            //шеф-монтажи (сохраненные)
            var supervisions = UnitOfWork.Repository <Model.POCOs.Supervision>().Find(x => x.SalesUnit.Project.Manager.IsAppCurrentUser());

            Wrappers = supervisions.Select(supervision => new SupervisionWr(supervision)).ToList();

            //выигранное оборудование со включенным шеф-монтажом
            var salesUnits = UnitOfWork.Repository <SalesUnit>()
                             .Find(x => !x.IsRemoved && x.IsWon && x.Project.Manager.IsAppCurrentUser())       //только выигранное оборудование
                             .Except(supervisions.Select(x => x.SalesUnit))                                    //еще не сохраненное
                             .Where(x => x.ProductsIncluded.Any(pi => pi.Product.ProductBlock.IsSupervision)); //в которое включен шеф-монтаж

            Wrappers.AddRange(salesUnits.Select(x => new SupervisionWr(x)));
        }
Exemplo n.º 33
0
    /* Public Interface */

    public void LoadMod(string modId)
    {
        Wrappers.ThrowIfENotEqual(IsLoaded, true, Errors.ModLoaderNotInitialized);

        // Check for duplicate.
        if (Manager.IsModLoaded(modId))
        {
            throw new ReloadedException(Errors.ModAlreadyLoaded(modId));
        }

        // Note: Code below already ensures no duplicates but it would be nice to
        // throw for the end users of the loader servers so they can see the error.
        var mod      = FindMod(modId, out var allMods);
        var modArray = new[] { (ModConfig)mod.Config };

        LoadModsWithDependencies(modArray, allMods);
    }
Exemplo n.º 34
0
        public TaskPaneManager(dynamic application, Wrappers.Interfaces.IOfficeApplication wsApplication)
        {
            _application = wsApplication;
            _host = CTPTargetHost.Create(application);

            _host.NewTarget += _host_NewTarget;
            _host.TargetRemove += _host_TargetRemove;
            _host.TargetActivated += _host_TargetActivated;

            WorkshareOnline.Instance.Events.GetEvent<CompareWithCurrentDocumentEvent>().Subscribe(CompareRequest);
            WorkshareOnline.Instance.Events.GetEvent<SaveCurrentDocumentEvent>().Subscribe(SaveRequest);
            Events.Events.Stream.GetEvent<TogglePanaleEvent>().Subscribe(OnTogglePanel);
            Events.Events.Stream.GetEvent<DocumentSavedOnlineEvent>().Subscribe(OnDocumentSavedToWs,ThreadOption.PublisherThread);
            Events.Events.Stream.GetEvent<DocumentSavingOnlineEvent>().Subscribe(OnDocumentSavingToWs, ThreadOption.PublisherThread);
            Events.Events.Stream.GetEvent<DocumentNewVersionSavingOnlineEvent>().Subscribe(OnDocumentNewVersionSavingToWs, ThreadOption.PublisherThread);
            Events.Events.Stream.GetEvent<DocumentNewVersionSavedOnlineEvent>().Subscribe(OnDocumentNewVersionSavedToWs, ThreadOption.PublisherThread);
            Events.Events.Stream.GetEvent<DocumentSharingOnlineEvent>().Subscribe(OnDocumentSharingToWs, ThreadOption.PublisherThread);
            Events.Events.Stream.GetEvent<DocumentSharedOnlineEvent>().Subscribe(OnDocumentSharedToWs, ThreadOption.PublisherThread);

            AddForAlreadyActive();
        }
Exemplo n.º 35
0
        public void SerializeValidationReport(
			Wrappers.WrappedValidationMessageLevel activityReportLevel,
			System.String message)
        {
            if (this.m_parentSession.ResultsGatheringPaused) return;
            if (this.m_serializationWriter == null) return;
            DvtkData.Validation.ValidationMessage validationMessage = new DvtkData.Validation.ValidationMessage();
            switch(activityReportLevel)
            {
                case Wrappers.WrappedValidationMessageLevel.Error:
                    validationMessage.Type = DvtkData.Validation.MessageType.Error;
                    break;
                case Wrappers.WrappedValidationMessageLevel.Warning:
                    validationMessage.Type = DvtkData.Validation.MessageType.Warning;
                    break;
                case Wrappers.WrappedValidationMessageLevel.Information:
                    validationMessage.Type = DvtkData.Validation.MessageType.Info;
                    break;
                case Wrappers.WrappedValidationMessageLevel.ConditionText:
                    validationMessage.Type = DvtkData.Validation.MessageType.ConditionText;
                    break;
                default:
                    validationMessage.Type = DvtkData.Validation.MessageType.Info;
                    break;
            }
            validationMessage.Message = DvtToXml.ConvertString(message,false);

            // stream validation message to detailed output
            validationMessage.DvtDetailToXml(m_serializationWriter.DetailStreamWriter, 0);

            // stream validation message to summary output
            validationMessage.DvtDetailToXml(m_serializationWriter.SummaryStreamWriter, 0);
        }
Exemplo n.º 36
0
 public void Increment(Wrappers.CountGroup group, Wrappers.CountType type)
 {
     this._CountMatrix[(int)group, (int)type] += 1;
 }
Exemplo n.º 37
0
 private static DvtkData.Activities.ActivityReportLevel _Convert(
     Wrappers.WrappedValidationMessageLevel level)
 {
     switch (level)
     {
         case Wrappers.WrappedValidationMessageLevel.Debug:
             return DvtkData.Activities.ActivityReportLevel.Debug;
         case Wrappers.WrappedValidationMessageLevel.DicomObjectRelationship:
             return DvtkData.Activities.ActivityReportLevel.DicomObjectRelationship;
         case Wrappers.WrappedValidationMessageLevel.DulpStateMachine:
             return DvtkData.Activities.ActivityReportLevel.DulpMachineState;
         case Wrappers.WrappedValidationMessageLevel.Error:
             return DvtkData.Activities.ActivityReportLevel.Error;
         case Wrappers.WrappedValidationMessageLevel.Information:
             return DvtkData.Activities.ActivityReportLevel.Information;
         case Wrappers.WrappedValidationMessageLevel.ConditionText:
             return DvtkData.Activities.ActivityReportLevel.ConditionText;
         case Wrappers.WrappedValidationMessageLevel.None:
             return DvtkData.Activities.ActivityReportLevel.None;
         case Wrappers.WrappedValidationMessageLevel.Scripting:
             return DvtkData.Activities.ActivityReportLevel.Scripting;
         case Wrappers.WrappedValidationMessageLevel.ScriptName:
             return DvtkData.Activities.ActivityReportLevel.ScriptName;
         case Wrappers.WrappedValidationMessageLevel.MediaFilename:
             return DvtkData.Activities.ActivityReportLevel.MediaFilename;
         case Wrappers.WrappedValidationMessageLevel.WareHouseLabel:
             return DvtkData.Activities.ActivityReportLevel.WareHouseLabel;
         case Wrappers.WrappedValidationMessageLevel.Warning:
             return DvtkData.Activities.ActivityReportLevel.Warning;
         default:
             System.Diagnostics.Trace.Assert(false);
             return DvtkData.Activities.ActivityReportLevel.Error;
     }
 }
Exemplo n.º 38
0
        internal SupportedTransferSyntaxSettings(Wrappers.MEmulatorSession adaptee)
        {
            if (adaptee == null) throw new System.ArgumentNullException("adaptee");
            this.m_adaptee = adaptee;

            // load the supported list from the values in the session
            System.UInt16 nrOfSupportedTransferSyntaxes = this.m_adaptee.NrOfSupportedTransferSyntaxes;
            for (System.UInt16 index = 0; index < nrOfSupportedTransferSyntaxes; index++)
            {
                this._TransferSyntaxList.Add(
                    new DvtkData.Dul.TransferSyntax(this.m_adaptee.get_SupportedTransferSyntax(index))
                    );
            }
            // subscribe to contents changes to call underlying MBaseSession methods.
            this._TransferSyntaxList.ListChanged +=
                new System.ComponentModel.ListChangedEventHandler(_TransferSyntaxList_ListChanged);
        }
Exemplo n.º 39
0
        public static Image makePatternThumb(patternDetails pattern, Wrappers.Database db)
        {
            Image temp = null;

                if (pattern.type == "HSV")
                {
                    DdsFileTypePlugin.DdsFile ddsP = new DdsFileTypePlugin.DdsFile();

                    Colours.HSVColor channel1Color = new Colours.HSVColor();
                    Colours.HSVColor channel2Color = new Colours.HSVColor();
                    Colours.HSVColor channel3Color = new Colours.HSVColor();

                    Colours.HSVColor backColor = new Colours.HSVColor(Convert.ToDouble(pattern.HBg, CultureInfo.InvariantCulture) * 360, Convert.ToDouble(pattern.SBg, CultureInfo.InvariantCulture), Convert.ToDouble(pattern.VBg, CultureInfo.InvariantCulture));
                    bool[] channelsEnabled = new bool[3];

                    if (pattern.ChannelEnabled[0] != null && pattern.ChannelEnabled[0].ToLower() == "true")
                    {
                        channel1Color = new Colours.HSVColor(Convert.ToDouble(pattern.H[0], CultureInfo.InvariantCulture) * 360, Convert.ToDouble(pattern.S[0], CultureInfo.InvariantCulture), Convert.ToDouble(pattern.V[0], CultureInfo.InvariantCulture));
                        channelsEnabled[0] = true;
                    }
                    if (pattern.ChannelEnabled[1] != null && pattern.ChannelEnabled[1].ToLower() == "true")
                    {
                        channel2Color = new Colours.HSVColor(Convert.ToDouble(pattern.H[1], CultureInfo.InvariantCulture) * 360, Convert.ToDouble(pattern.S[1], CultureInfo.InvariantCulture), Convert.ToDouble(pattern.V[1], CultureInfo.InvariantCulture));
                        channelsEnabled[1] = true;
                    }
                    if (pattern.ChannelEnabled[2] != null && pattern.ChannelEnabled[2].ToLower() == "true")
                    {
                        channel3Color = new Colours.HSVColor(Convert.ToDouble(pattern.H[2], CultureInfo.InvariantCulture) * 360, Convert.ToDouble(pattern.S[2], CultureInfo.InvariantCulture), Convert.ToDouble(pattern.V[2], CultureInfo.InvariantCulture));
                        channelsEnabled[2] = true;
                    }
                    if (isEmptyMask(pattern.rgbmask))
                    {
                        if (db != null)
                        {
                            temp = Patterns.createHSVPattern(KeyUtils.findKey(new Wrappers.ResourceKey(pattern.BackgroundImage), 2, db), backColor);
                        }
                        else
                        {
                            temp = Patterns.createHSVPattern(KeyUtils.findKey(pattern.BackgroundImage), backColor);
                        }
                    }
                    else
                    {
                        if (db != null)
                        {
                            temp = Patterns.createHSVPattern(KeyUtils.findKey(new Wrappers.ResourceKey(pattern.BackgroundImage), 2, db), KeyUtils.findKey(new Wrappers.ResourceKey(pattern.rgbmask), 2, db), backColor, KeyUtils.findKey(new MadScience.Wrappers.ResourceKey(makeKey(pattern.Channel[0])), 0, db), KeyUtils.findKey(new Wrappers.ResourceKey(makeKey(pattern.Channel[1])), 0, db), KeyUtils.findKey(new Wrappers.ResourceKey(makeKey(pattern.Channel[2])), 0, db), channel1Color, channel2Color, channel3Color, channelsEnabled);
                        }
                        else
                        {
                            temp = Patterns.createHSVPattern(KeyUtils.findKey(pattern.BackgroundImage), KeyUtils.findKey(pattern.rgbmask), backColor, KeyUtils.findKey(makeKey(pattern.Channel[0])), KeyUtils.findKey(makeKey(pattern.Channel[1])), KeyUtils.findKey(makeKey(pattern.Channel[2])), channel1Color, channel2Color, channel3Color, channelsEnabled);
                        }
                    }
                }
                else if (pattern.type == "Coloured")
                {
                    DdsFileTypePlugin.DdsFile ddsP = new DdsFileTypePlugin.DdsFile();
                    Color bgColor = Colours.convertColour(pattern.ColorP[0], true);
                    if (bgColor == Color.Empty)
                    {
                        bgColor = Color.Black;
                    }
                    if (pattern.isCustom)
                    {
                        // We need this in here becuase findKey only searches the game files and any local DDS files - it
                        // doesn't search custom packages
                        if (File.Exists(pattern.customFilename))
                        {
                            Stream patternThumb = KeyUtils.searchForKey(pattern.rgbmask, pattern.customFilename);
                            if (!StreamHelpers.isValidStream(patternThumb))
                            {
                                patternThumb = KeyUtils.searchForKey(pattern.BackgroundImage, pattern.customFilename);
                            }
                            if (StreamHelpers.isValidStream(patternThumb))
                            {
                                ddsP.Load(patternThumb);
                            }
                            patternThumb.Close();
                        }
                    }
                    else
                    {
                        if (db != null)
                        {
                            ddsP.Load(KeyUtils.findKey(new Wrappers.ResourceKey(pattern.rgbmask), 2, db));
                        }
                        else
                        {
                            ddsP.Load(KeyUtils.findKey(pattern.rgbmask));
                        }
                    }
                    temp = ddsP.Image(bgColor, Colours.convertColour(pattern.ColorP[1], true), Colours.convertColour(pattern.ColorP[2], true), Colours.convertColour(pattern.ColorP[3], true), Colours.convertColour(pattern.ColorP[4], true));

                }
                else if (pattern.type == "solidColor")
                {
                    temp = new Bitmap(256,256);
                    using (Graphics g = Graphics.FromImage(temp))
                    {
                        g.FillRectangle(new SolidBrush(Colours.convertColour(pattern.Color)),0,0,256,256);
                    }

                }

            return temp;
        }
Exemplo n.º 40
0
        internal SecuritySettings(Wrappers.MBaseSession adaptee)
        {
            if (adaptee == null) throw new System.ArgumentNullException();

            m_adaptee = adaptee;
        }
Exemplo n.º 41
0
 internal DefinitionManagement(Wrappers.MBaseSession adaptee)
 {
     if (adaptee == null) throw new System.ArgumentNullException("adaptee");
     m_adaptee = adaptee;
     //
     // load list from the values in the session
     //
     System.UInt16 nrOfDefinitionFileDirectories = this.m_adaptee.NrOfDefinitionFileDirectories;
     for (System.UInt16 index = 0; index < nrOfDefinitionFileDirectories; index++)
     {
         this._DefinitionFileDirectoryList.Add(this.m_adaptee.get_DefinitionFileDirectory(index));
     }
     //
     // subscribe to contents changes to call underlying MBaseSession methods.
     //
     this._DefinitionFileDirectoryList.ListChanged +=
         new System.ComponentModel.ListChangedEventHandler(_DefinitionFileDirectoryList_ListChanged);
 }
Exemplo n.º 42
0
 private void Init(
     int indexOfChildInParentCollection,
     Wrappers.WrappedSerializerNodeType reason)
 {
     //
     // Use same settings for detailed and summary validation as in the parent serializer.
     //
     bool detailedValidationResultsEnabled = this.m_parentSession.DetailedValidationResults;
     bool detailedSummaryValidationResultsEnabled = this.m_parentSession.SummaryValidationResults;
     //
     // Create a output writer based on the same targetname as the parent serializer.
     //
     this.m_serializationWriter =
         new SerializationWriter(
         this.m_targetFileName,
         this.m_bIsTopSerializer,
         (uint)indexOfChildInParentCollection,
         detailedValidationResultsEnabled,
         detailedSummaryValidationResultsEnabled);
     //
     // TODO: Determine specific processing tasks for Thread and DirectoryRecord child-nodes.
     //
     switch (reason)
     {
         case Wrappers.WrappedSerializerNodeType.Thread:
             break;
         case Wrappers.WrappedSerializerNodeType.DirectoryRecord:
             break;
         case Wrappers.WrappedSerializerNodeType.TopParent:
             break;
         default:
             // Unknown WrappedSerializerNodeType
             throw new System.NotImplementedException();
     }
     //
     // Start the serializer
     //
     this.m_serializationWriter.WriteStartDocument();
     this.m_serializationWriter.WriteStartElement();
     this.m_SerializationStatus = SerializationStatus.Running;
 }
Exemplo n.º 43
0
 private static DicomValidationToolKit.Sessions.StorageMode WrapperToDvtk(Wrappers.StorageMode value)
 {
     switch (value)
     {
         case Wrappers.StorageMode.StorageModeAsDataSet:
             return DicomValidationToolKit.Sessions.StorageMode.AsDataSet;
         case Wrappers.StorageMode.StorageModeAsMedia:
             return DicomValidationToolKit.Sessions.StorageMode.AsMedia;
         case Wrappers.StorageMode.StorageModeNoStorage:
             return DicomValidationToolKit.Sessions.StorageMode.NoStorage;
         case Wrappers.StorageMode.StorageModeTemporaryPixelOnly:
             return DicomValidationToolKit.Sessions.StorageMode.TemporaryPixelOnly;
         default:
             throw new ApplicationException();
     }
 }
Exemplo n.º 44
0
 internal NetworkSession(Wrappers.MBaseSession sessionDelegate, Key key)
     : base(key)
 {
     // Check type
     m_delegate          = (Wrappers.MScriptSession)sessionDelegate;
     base.m_delegate     = m_delegate;
     _Initialize(key);
 }
Exemplo n.º 45
0
 internal MediaSession(Wrappers.MBaseSession sessionDelegate, Key key)
     : base(key)
 {
     // Check type
     m_delegate          = (Wrappers.MMediaSession)sessionDelegate;
     base.m_delegate     = m_delegate;
     _Initialize(key);
 }
Exemplo n.º 46
0
 public CSutProperties(Wrappers.MBaseSession theDelegate)
 {
     m_delegate = theDelegate;
 }
Exemplo n.º 47
0
 public NewBaseSession(Wrappers.MBaseSession theDelegate)
 {
     this.m_delegate = theDelegate;
     CSutProperties _SutProperties = new CSutProperties(theDelegate);
 }
Exemplo n.º 48
0
 protected override void OnClicked(Wrappers.Interfaces.IOfficeApplication application)
 {
     Events.Events.Stream.GetEvent<TogglePanaleEvent>().Publish(this);
 }
Exemplo n.º 49
0
 internal Dvt1MediaSessionService(Session parentSession, Wrappers.MBaseSession baseSessionDelegate)
     : base(parentSession)
 {
     m_delegate = baseSessionDelegate;
 }
Exemplo n.º 50
0
 /// <summary>
 /// Conversion Wrappers type => Dvtk type
 /// </summary>
 /// <param name="sendReturnCode">in</param>
 /// <returns>out</returns>
 private static SendReturnCode _Convert(Wrappers.SendReturnCode sendReturnCode)
 {
     switch (sendReturnCode)
     {
         case Wrappers.SendReturnCode.Success:                return SendReturnCode.Success;
         case Wrappers.SendReturnCode.Failure:                return SendReturnCode.Failure;
         case Wrappers.SendReturnCode.AssociationRejected:    return SendReturnCode.AssociationRejected;
         case Wrappers.SendReturnCode.AssociationReleased:    return SendReturnCode.AssociationReleased;
         case Wrappers.SendReturnCode.AssociationAborted:     return SendReturnCode.AssociationAborted;
         case Wrappers.SendReturnCode.SocketClosed:           return SendReturnCode.SocketClosed;
         case Wrappers.SendReturnCode.NoSocketConnection:     return SendReturnCode.NoSocketConnection;
         default:
             // Unknown Wrappers.SendReturnCode
             throw new System.NotImplementedException();
     }
 }
Exemplo n.º 51
0
 /// <summary>
 /// Conversion Wrappers type => Dvtk type
 /// </summary>
 /// <param name="value">in</param>
 /// <returns>out</returns>
 private static Dvtk.Sessions.StorageMode _Convert(Wrappers.StorageMode value)
 {
     switch (value)
     {
         case Wrappers.StorageMode.StorageModeAsDataSet:
             return Dvtk.Sessions.StorageMode.AsDataSet;
         case Wrappers.StorageMode.StorageModeAsMedia:
             return Dvtk.Sessions.StorageMode.AsMedia;
         case Wrappers.StorageMode.StorageModeNoStorage:
             return Dvtk.Sessions.StorageMode.NoStorage;
         case Wrappers.StorageMode.StorageModeTemporaryPixelOnly:
             return Dvtk.Sessions.StorageMode.TemporaryPixelOnly;
         default:
             // Unknown Dvtk.Sessions.StorageMode
             throw new System.NotImplementedException();
     }
 }
Exemplo n.º 52
0
 // ctor
 internal Certificate(Wrappers.MCertificate certificate)
 {
     _certificate = certificate;
 }
Exemplo n.º 53
0
 internal CSutSocketService(Session parentSession, Wrappers.ISockets iSocketsDelegate)
     : base(parentSession)
 {
     m_delegate = iSocketsDelegate;
 }
Exemplo n.º 54
0
 // ctor
 internal Credential(Wrappers.MCertificate credential)
 {
     _credential = credential;
 }
Exemplo n.º 55
0
 internal Serializer(
     Serializer parentSerializer,
     Session session, 
     bool isTopSerializer,
     Wrappers.WrappedSerializerNodeType reason)
 {
     this.m_serializerNodeType = reason;
     this.m_parentSerializer = parentSerializer;
     this.m_parentSession = session;
     this.m_bIsTopSerializer = isTopSerializer;
     if (this.m_bIsTopSerializer)
     {
         this.topDirectoryRecordErrorCountTable = new System.Collections.Hashtable();
         this.topDirectoryRecordWarningCountTable = new System.Collections.Hashtable();
     }
     else
     {
         this.topDirectoryRecordErrorCountTable = null;
         this.topDirectoryRecordWarningCountTable = null;
     }
 }
Exemplo n.º 56
0
        public void SerializeUserReport(
            Wrappers.WrappedValidationMessageLevel activityReportLevel,
            System.String message)
        {
            if (this.m_parentSession.ResultsGatheringPaused) return;
            if (this.m_serializationWriter == null) return;
            DvtkData.Activities.UserActivityReport userActivityReport =
                new DvtkData.Activities.UserActivityReport();
            userActivityReport.Message = DvtToXml.ConvertString(message,false);
            userActivityReport.Level = _Convert(activityReportLevel);

            UInt32 messageIndex = 0;
            switch(userActivityReport.Level)
            {
                case DvtkData.Activities.ActivityReportLevel.Error:
                case DvtkData.Activities.ActivityReportLevel.Warning:
                    messageIndex = GetNextMessageIndex();
                    break;
                default:
                    break;
            }

            // stream user activity to detailed output
            userActivityReport.DvtDetailToXml(m_serializationWriter.DetailStreamWriter, messageIndex, 0);

            // stream user activity to summary output
            userActivityReport.DvtSummaryToXml(m_serializationWriter.SummaryStreamWriter, messageIndex, 0);
        }
Exemplo n.º 57
0
 internal Printer(Wrappers.MEmulatorSession adaptee)
 {
     if (adaptee == null) throw new System.ArgumentNullException("adaptee");
     this.m_adaptee = adaptee;
 }
Exemplo n.º 58
0
 /// <summary>
 /// Factory method to create child-node for this parent-node.
 /// </summary>
 /// <param name="reason"></param>
 /// <returns>child-node</returns>
 public Wrappers.ISerializationTarget CreateChildSerializationTarget(
     Wrappers.WrappedSerializerNodeType reason)
 {
     if (!this.m_bIsTopSerializer)
     {
         throw new System.ApplicationException(
             string.Concat(
             "Is is not possible to create child-documents nested deeper than one-level, ",
             "due to limitations in the target file naming-scheme."));
     }
     //
     // Create child-serializer for the same (parent)-session.
     //
     Serializer childSerializer =
         new Serializer(this, this.m_parentSession, false, reason);
     childSerializer.m_targetFileName = this.m_targetFileName;
     //
     // Register child-serializer in child-collection of this parent-serializer.
     //
     this.m_childSerializers.Add(childSerializer);
     childSerializer.Init(
         this.m_childSerializers.IndexOf(childSerializer),
         reason);
     return childSerializer;
 }
Exemplo n.º 59
0
 internal EmulatorSession(Wrappers.MBaseSession adaptee)
 {
     if (adaptee == null) throw new System.ArgumentNullException("adaptee");
     // Check type
     m_adaptee = (Wrappers.MEmulatorSession)adaptee;
     Wrappers.MDisposableResources.AddDisposable(m_adaptee);
     _Initialize();
 }
Exemplo n.º 60
0
        public void SerializeHtmlUserReport(
			Wrappers.WrappedValidationMessageLevel activityReportLevel,
			System.String message,
            bool writeToSummary, 
            bool writeToDetail)
        {
            if (this.m_parentSession.ResultsGatheringPaused) return;
            if (this.m_serializationWriter == null) return;

            DvtkData.Activities.UserActivityReport userActivityReport =
                new DvtkData.Activities.UserActivityReport();
            userActivityReport.IsHtml = true;

            // All '[' and ']' will be filtered out.
            // After this, all '<' will be replaced by '[' and all '>' will be replaced by ']'.
            message = message.Replace("[", "");
            message = message.Replace("]", "");
            message = message.Replace("<", "[");
            message = message.Replace(">", "]");

            userActivityReport.Message = DvtToXml.ConvertString(message,false);
            userActivityReport.Level = _Convert(activityReportLevel);

            if (writeToDetail)
            {
                // stream user activity to detailed output
                userActivityReport.DvtDetailToXml(m_serializationWriter.DetailStreamWriter, 0, 0);
            }

            if (writeToSummary)
            {
                // stream user activity to summary output
                userActivityReport.DvtSummaryToXml(m_serializationWriter.SummaryStreamWriter, 0, 0);
            }
        }