Exemplo n.º 1
0
        public void Save()
        {
            lock (appSettingsLock)
            {
                string json = null;

                try
                {
                    json = JsonConvert.SerializeObject(this);
                }
                catch (Exception ex)
                {
                    LoggerUtil.GetAppWideLogger().Error(ex, "Failed to convert object to JSON.");
                    return;
                }

                try
                {
                    IPathProvider paths = PlatformTypes.New <IPathProvider>();

                    string settingsPath = paths.GetPath(@"app.settings");
                    using (StreamWriter writer = new StreamWriter(File.Open(settingsPath, FileMode.Create)))
                    {
                        writer.Write(json);
                    }
                }
                catch (Exception ex)
                {
                    LoggerUtil.GetAppWideLogger().Error(ex, "Failed to save app settings.");
                }
            }
        }
    private void LeapPlayer(PlatformTypes platformType)
    {
        Vector2 velocityToLeap = Vector2.up * ((int)platformType * JumpBoostMultiplier * Time.deltaTime);

        rig.velocity.Set(velocityToLeap.x, Mathf.Min(rig.velocity.y, 50));
        rig.velocity = velocityToLeap;
    }
Exemplo n.º 3
0
        private void UpdateTranslation(bool scrollNow)
        {
            SceneView      activeView = this.ActiveView;
            SceneViewModel viewModel  = activeView.ViewModel;
            Vector         delta      = this.dragCurrentPosition - this.dragStartPosition;

            if (this.isConstraining)
            {
                delta = this.ConstrainDeltaToAxis(delta);
            }
            if (delta == this.lastMove || this.IsAltDown)
            {
                return;
            }
            this.EnsureEditTransaction();
            Vector       vector1          = delta - this.lastMove;
            SceneElement primarySelection = viewModel.ElementSelectionSet.PrimarySelection;

            if (primarySelection == null)
            {
                return;
            }
            PropertyReference propertyReference = this.GetBrushPropertyReference((SceneNode)primarySelection);

            if (propertyReference == null)
            {
                return;
            }
            object computedValue = primarySelection.GetComputedValue(propertyReference);

            if (computedValue != null && !PlatformTypes.IsInstance(computedValue, PlatformTypes.SolidColorBrush, (ITypeResolver)primarySelection.ProjectContext))
            {
                Vector vector2 = vector1 * activeView.GetComputedTransformFromRoot(primarySelection) * BrushAdorner.GetCompleteInverseBrushTransformMatrix((Base2DElement)primarySelection, computedValue, true);
                if (PlatformTypes.IsInstance(computedValue, PlatformTypes.LinearGradientBrush, (ITypeResolver)primarySelection.ProjectContext) && this.Tool is GradientBrushTool)
                {
                    ReferenceStep referenceStep1 = (ReferenceStep)viewModel.ProjectContext.ResolveProperty(LinearGradientBrushNode.StartPointProperty);
                    ReferenceStep referenceStep2 = (ReferenceStep)viewModel.ProjectContext.ResolveProperty(LinearGradientBrushNode.EndPointProperty);
                    Point         point1         = RoundingHelper.RoundPosition((Point)viewModel.DefaultView.ConvertToWpfValue(referenceStep1.GetCurrentValue(computedValue)) + vector2);
                    Point         point2         = RoundingHelper.RoundPosition((Point)viewModel.DefaultView.ConvertToWpfValue(referenceStep2.GetCurrentValue(computedValue)) + vector2);
                    this.SetBrushValue(LinearGradientBrushNode.StartPointProperty, (object)point1);
                    this.SetBrushValue(LinearGradientBrushNode.EndPointProperty, (object)point2);
                }
                else if (PlatformTypes.IsInstance(computedValue, PlatformTypes.RadialGradientBrush, (ITypeResolver)primarySelection.ProjectContext) && this.Tool is GradientBrushTool)
                {
                    ReferenceStep referenceStep1 = (ReferenceStep)viewModel.ProjectContext.ResolveProperty(RadialGradientBrushNode.CenterProperty);
                    ReferenceStep referenceStep2 = (ReferenceStep)viewModel.ProjectContext.ResolveProperty(RadialGradientBrushNode.GradientOriginProperty);
                    Point         point1         = RoundingHelper.RoundPosition((Point)viewModel.DefaultView.ConvertToWpfValue(referenceStep1.GetCurrentValue(computedValue)) + vector2);
                    Point         point2         = RoundingHelper.RoundPosition((Point)viewModel.DefaultView.ConvertToWpfValue(referenceStep2.GetCurrentValue(computedValue)) + vector2);
                    this.SetBrushValue(RadialGradientBrushNode.CenterProperty, (object)point1);
                    this.SetBrushValue(RadialGradientBrushNode.GradientOriginProperty, (object)point2);
                }
                else
                {
                    this.TranslateBrushPosition(vector1 * activeView.GetComputedTransformFromRoot(primarySelection) * BrushAdorner.GetCompleteInverseBrushTransformMatrix((Base2DElement)primarySelection, computedValue, false), primarySelection);
                }
            }
            activeView.EnsureVisible(this.dragStartPosition + delta, scrollNow);
            this.lastMove = delta;
            this.UpdateEditTransaction();
        }
Exemplo n.º 4
0
        public override void Draw(DrawingContext context, Matrix matrix)
        {
            if (!PlatformTypes.IsInstance(this.PlatformBrush, PlatformTypes.LinearGradientBrush, (ITypeResolver)this.Element.ProjectContext))
            {
                return;
            }
            switch (this.kind)
            {
            case LinearGradientAdornerKind.StartPoint:
                this.DrawArrowTail(context, matrix, this.StartPoint, this.EndPoint);
                break;

            case LinearGradientAdornerKind.EndPoint:
                this.DrawArrowHead(context, matrix, this.StartPoint, this.EndPoint);
                break;

            case LinearGradientAdornerKind.StartRotation:
                context.DrawEllipse((Brush)Brushes.Transparent, (Pen)null, this.GetOffsetStartPoint(matrix, RotateAdornerHelper.Radius), RotateAdornerHelper.Radius, RotateAdornerHelper.Radius);
                break;

            case LinearGradientAdornerKind.EndRotation:
                context.DrawEllipse((Brush)Brushes.Transparent, (Pen)null, this.GetOffsetEndPoint(matrix, RotateAdornerHelper.Radius), RotateAdornerHelper.Radius, RotateAdornerHelper.Radius);
                break;

            default:
                throw new NotImplementedException(ExceptionStringTable.UnknownLinearGradientAdorner);
            }
        }
Exemplo n.º 5
0
        public static void ClassInit(TestContext context)
        {
            var antitampering = new Mock <IAntitampering>();

            PlatformTypes.Register <IPathProvider>((arr) => new Mocks.MockPathProvider());
            PlatformTypes.Register <IAntitampering>((arr) => antitampering.Object);
        }
Exemplo n.º 6
0
        private int GetPlatformCPCost(PlatformTypes type)
        {
            switch (type)
            {
            case PlatformTypes.dronesat:
                return(this.DroneSatCPCost);

            case PlatformTypes.brsat:
                return(this.BRSatCPCost);

            case PlatformTypes.scansat:
                return(this.ScanSatCPCost);

            case PlatformTypes.torpsat:
                return(this.TorpSatCPCost);

            case PlatformTypes.monitorsat:
                return(this.MonitorSatCPCost);

            case PlatformTypes.missilesat:
                return(this.MissileSatCPCost);

            default:
                return(0);
            }
        }
Exemplo n.º 7
0
        public static void Init()
        {
            FingerprintService.InitFingerprint(new WindowsFingerprint());

            // These loosely typed parameter lists are rather gross. Is there a cleaner way to do this?
            // params: channel, autoReconnect
            PlatformTypes.Register <IPipeClient>((arr) => new WindowsPipeClient((string)arr[0], (arr.Length > 1) ? (bool)arr[1] : false));

            // params: channel
            PlatformTypes.Register <IPipeServer>((arr) => new WindowsPipeServer((string)arr[0]));

            PlatformTypes.Register <IGUIChecks>((arr) => new WindowsGUIChecks());

            PlatformTypes.Register <IAntitampering>((arr) => new WindowsAntitampering());

            PlatformTypes.Register <INetworkInfo>((arr) => new NetworkListUtil());

            PlatformTypes.Register <IAuthenticationStorage>((arr) => new RegistryAuthenticationStorage());

            PlatformTypes.Register <IPathProvider>((arr) => new WindowsPathProvider());

            PlatformTypes.Register <IFilterAgent>((arr) => new WindowsFilterAgent());

            PlatformTypes.Register <IFilterUpdater>((arr) => new WindowsFilterUpdater());
        }
Exemplo n.º 8
0
        public override void Draw(DrawingContext context, Matrix matrix)
        {
            if (!this.ShouldDraw)
            {
                return;
            }
            bool   flag    = this.AdornerSet.Behavior.Tool is BrushTransformTool;
            Matrix matrix1 = this.GetCompleteBrushTransformMatrix(true) * matrix;

            if (flag)
            {
                Rect brushBounds = this.BrushBounds;
                if (brushBounds.Width <= 0.0 || brushBounds.Height <= 0.0)
                {
                    return;
                }
                Pen thinPen = this.ThinPen;
                System.Windows.Media.Geometry rectangleGeometry = Adorner.GetTransformedRectangleGeometry(brushBounds, matrix1, thinPen.Thickness);
                context.DrawGeometry((Brush)Brushes.Transparent, thinPen, rectangleGeometry);
            }
            else
            {
                Pen pen = new Pen((Brush)Brushes.Transparent, 15.0);
                pen.Freeze();
                if (!PlatformTypes.IsInstance(this.PlatformBrush, PlatformTypes.GradientBrush, (ITypeResolver)this.Element.ProjectContext))
                {
                    return;
                }
                Point startPoint;
                Point endPoint;
                this.GetBrushOffsetEndpoints(out startPoint, out endPoint, 13.0, 11.0, matrix);
                context.DrawLine(pen, startPoint, endPoint);
                context.DrawLine(this.ThinPen, startPoint, endPoint);
            }
        }
        /// <summary>
        ///     根据指定编号异步获取Ticker对象的操作
        /// </summary>
        /// <param name="coinType">币种编号</param>
        /// <param name="platformType">平台编号</param>
        /// <returns>返回执行结果</returns>
        public async Task <IExecuteResult> GetTickerAsync(CoinTypes coinType, PlatformTypes platformType)
        {
            MetadataMessageTransaction transaction = SystemWorker.Instance.CreateMetadataTransaction("CoinAPI");
            MetadataContainer          reqMsg      = new MetadataContainer();

            reqMsg.SetAttribute(0x00, new MessageIdentityValueStored(new MessageIdentity
            {
                ProtocolId = 1,
                ServiceId  = 0,
                DetailsId  = 0
            }));
            reqMsg.SetAttribute(0x0F, new ByteValueStored((byte)coinType));
            reqMsg.SetAttribute(0x10, new ByteValueStored((byte)platformType));
            TaskCompletionSource <IExecuteResult> completionSource = new TaskCompletionSource <IExecuteResult>();
            Task <IExecuteResult> task = completionSource.Task;

            transaction.ResponseArrived += delegate(object sender, LightSingleArgEventArgs <MetadataContainer> e)
            {
                MetadataContainer rspMsg = e.Target;
                completionSource.SetResult((!rspMsg.IsAttibuteExsits(0x0A))
                             ? (rspMsg.GetAttribute(0x0F).GetValue <ResourceBlock>() == null
                                 ? ExecuteResult.Succeed(null)
                                 : ExecuteResult.Succeed(ConverterFactory.GetTickerConverter().ConvertToDomainObject(rspMsg.GetAttribute(0x0F).GetValue <ResourceBlock>())))
                             : ExecuteResult.Fail(rspMsg.GetAttribute(0x0A).GetValue <byte>(), rspMsg.GetAttribute(0x0B).GetValue <string>()));
            };
            transaction.Timeout += delegate { completionSource.SetResult(ExecuteResult.Fail(SystemErrors.Timeout, string.Format("[Async Handle] Transaction: {0} execute timeout!", transaction.Identity))); };
            transaction.Failed  += delegate { completionSource.SetResult(ExecuteResult.Fail(SystemErrors.Unknown, string.Format("[Async Handle] Transaction: {0} execute failed!", transaction.Identity))); };
            transaction.SendRequest(reqMsg);
            return(await task);
        }
Exemplo n.º 10
0
        public IPCClient(bool autoReconnect = false)
        {
            logger   = LoggerUtil.GetAppWideLogger();
            ipcQueue = new IPCMessageTracker(this);

            var channel = string.Format("{0}.{1}", nameof(Citadel.IPC), FingerprintService.Default.Value2).ToLower();

            client = PlatformTypes.New <IPipeClient>(channel, autoReconnect); // new NamedPipeClient<BaseMessage>(channel);

            logger.Info("Process {0} creating client", Process.GetCurrentProcess().Id);

            client.Connected     += OnConnected;
            client.Disconnected  += OnDisconnected;
            client.ServerMessage += OnServerMessage;
            client.AutoReconnect  = autoReconnect;

            client.Error += clientError;

            client.Start();

            m_callbacks.Add(typeof(IpcMessage), (msg) =>
            {
                HandleIpcMessage(msg as IpcMessage);
            });
        }
Exemplo n.º 11
0
        public void TranslateBrushPosition(Vector elementDelta, SceneElement element)
        {
            PropertyReference propertyReference = this.GetBrushPropertyReference((SceneNode)element);

            if (propertyReference == null)
            {
                return;
            }
            object computedValue = element.GetComputedValue(propertyReference);

            if (computedValue == null || PlatformTypes.IsInstance(computedValue, PlatformTypes.SolidColorBrush, (ITypeResolver)element.ProjectContext))
            {
                return;
            }
            ReferenceStep      referenceStep      = (ReferenceStep)element.Platform.Metadata.ResolveProperty(BrushNode.RelativeTransformProperty);
            object             obj                = element.ViewModel.DefaultView.ConvertToWpfValue(referenceStep.GetCurrentValue(computedValue));
            CanonicalTransform canonicalTransform = !(obj is Transform) ? new CanonicalTransform(Matrix.Identity) : new CanonicalTransform((Transform)obj);

            elementDelta *= canonicalTransform.TransformGroup.Value;
            double valueToSet1 = RoundingHelper.RoundLength(canonicalTransform.TranslationX + elementDelta.X);
            double valueToSet2 = RoundingHelper.RoundLength(canonicalTransform.TranslationY + elementDelta.Y);

            this.SetBrushTransformValue(element.Platform.Metadata.CommonProperties.BrushTranslationXReference, valueToSet1);
            this.SetBrushTransformValue(element.Platform.Metadata.CommonProperties.BrushTranslationYReference, valueToSet2);
        }
Exemplo n.º 12
0
 public IExecuteResult GetValue(CoinTypes coinType, PlatformTypes platformType)
 {
     try
     {
         KeyParse keyParse = new KeyParse {
             CoinType = coinType, PlatformType = platformType
         };
         string key     = keyParse.ToString();
         string content = m_Cache[key] as string;
         if (content == null)
         {
             CacheItemPolicy policy = new CacheItemPolicy();
             policy.AbsoluteExpiration = DateTime.Now.AddMilliseconds(25000);
             IExecuteResult <Ticker> result = _remoteApiService.GetDataFromDataBase(key);
             if (result.State != ExecuteResults.Succeed)
             {
                 return(ExecuteResult.Fail(SystemErrors.Unknown, null));
             }
             content = result.GetResult().ToString();
             m_Cache.Set(key, content, policy);
         }
         return(ExecuteResult.Succeed(JsonConvert.DeserializeObject <Ticker>(content)));
     }
     catch (Exception ex)
     {
         _tracing.Error(ex, null);
         return(ExecuteResult.Fail(SystemErrors.NotFound, null));
     }
 }
Exemplo n.º 13
0
        public UpdateSystem(IPolicyConfiguration configuration, IPCServer server, string platformId)
        {
            m_platformPaths  = PlatformTypes.New <IPathProvider>();
            m_systemServices = PlatformTypes.New <ISystemServices>();

            m_ipcServer           = server;
            m_policyConfiguration = configuration;

            m_platformId = platformId;

            var bitVersionUri = string.Empty;

            if (Environment.Is64BitProcess)
            {
                bitVersionUri = "/update/cv4w-x64/update.xml";
            }
            else
            {
                bitVersionUri = "/update/cv4w-x86/update.xml";
            }

            var appUpdateInfoUrl = string.Format("{0}{1}", WebServiceUtil.Default.ServiceProviderApiPath, bitVersionUri);

            m_updater = new AppcastUpdater(new Uri(appUpdateInfoUrl));

            m_logger = LoggerUtil.GetAppWideLogger();
        }
 private static void EnsureType(IType type, ReplaceStyleTemplateCommand.ExtraReferences references)
 {
     if (!type.IsResolvable)
     {
         references.AddUndesolvedType(type);
     }
     else
     {
         if (type.RuntimeAssembly.IsLoaded && ((IPlatformTypes)type.PlatformMetadata).IsDesignToolAssembly(type.RuntimeAssembly))
         {
             return;
         }
         if (PlatformTypes.IsPlatformType((ITypeId)type))
         {
             IAssembly targetAssembly = PlatformTypeHelper.GetTargetAssembly(type);
             if (targetAssembly == null)
             {
                 return;
             }
             string name = targetAssembly.Name;
             if (string.IsNullOrEmpty(name))
             {
                 return;
             }
             references.AddPlatformAssembly(name);
         }
         else
         {
             references.AddAssembly(type.RuntimeAssembly);
         }
     }
 }
Exemplo n.º 15
0
        /// <summary>
        /// Constructs a new named pipe server for IPC, with a channel name derived from the class
        /// namespace and the current machine's digital fingerprint.
        /// </summary>
        public IPCServer()
        {
            m_logger = LoggerUtil.GetAppWideLogger();

            var channel = string.Format("{0}.{1}", nameof(Citadel.IPC), FingerprintService.Default.Value2).ToLower();

            m_server = PlatformTypes.New <IPipeServer>(channel);

            //m_server = new NamedPipeServer<BaseMessage>(channel, security);

            m_server.ClientConnected    += OnClientConnected;
            m_server.ClientDisconnected += OnClientDisconnected;
            m_server.ClientMessage      += OnClientMessage;

            m_server.Error += M_server_Error;

            // Server is no longer started by constructor. We start the IPCServer after everything else has been set up by the FilterServiceProvider.
            m_ipcQueue = new IPCMessageTracker(this);

            m_callbacks.Add(typeof(AddSelfModerationEntryMessage), (msg) =>
            {
                AddSelfModerationEntry?.Invoke(msg as AddSelfModerationEntryMessage);
            });

            m_callbacks.Add(typeof(IpcMessage), (msg) =>
            {
                // The new IPC message Request/Send API handles
                HandleIpcMessage(msg);
            });
        }
Exemplo n.º 16
0
        /// <summary>
        /// 判断功能是否开启
        /// </summary>
        public static bool IsSpreadOpen()
        {
            // 如果1.8的功能没开放
            if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot8))
            {
                return(false);
            }

            int state = 0;

            PlatformTypes platformType = GameCoreInterface.getinstance().GetPlatformType();

            switch (platformType)
            {
            case PlatformTypes.Android:
                state = (int)GameManager.systemParamsList.GetParamValueIntByName("TuiGuang_Android");
                break;

            case PlatformTypes.APP:
                state = (int)GameManager.systemParamsList.GetParamValueIntByName("TuiGuang_APP");
                break;

            case PlatformTypes.YueYu:
                state = (int)GameManager.systemParamsList.GetParamValueIntByName("TuiGuang_YueYu");
                break;
            }

            return(state > 0);
        }
Exemplo n.º 17
0
        private void AddValidElementProperties(ContextMenu menu, IDataObject data, SceneElement hitElement)
        {
            ResourceEntryItem resourceEntry = this.GetResourceEntry(data);

            if (resourceEntry == null || resourceEntry.Resource == null || hitElement == null)
            {
                return;
            }
            ResourceManager   resourceManager   = this.ActiveSceneViewModel.DesignerContext.ResourceManager;
            DocumentReference documentReference = resourceEntry.Container.DocumentReference;

            if (!PlatformTypes.PlatformsCompatible(hitElement.ProjectContext.PlatformMetadata, resourceEntry.DocumentNode.PlatformMetadata) || !resourceEntry.Resource.IsResourceReachable((SceneNode)hitElement) && (!(documentReference != resourceManager.ActiveRootContainer.DocumentReference) || !(documentReference != resourceManager.TopLevelResourceContainer.DocumentReference)))
            {
                return;
            }
            int count = menu.Items.Count;

            this.AddProperties(hitElement, resourceEntry, menu.Items);
            if (menu.Items.Count <= count)
            {
                return;
            }
            string headerText = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.DragDropResourceExistingControlPopupHeader, new object[1]
            {
                (object)(string.IsNullOrEmpty(hitElement.Name) ? "[" + hitElement.TargetType.Name + "]" : hitElement.Name)
            });

            this.AddHeaderItem(menu, headerText, 1);
        }
Exemplo n.º 18
0
 /// <summary>
 ///     从数据库中获取Ticker数据
 /// </summary>
 public IExecuteResult <Ticker> GetDataFromDataBase(string key)
 {
     try
     {
         KeyParse keyParse;
         KeyParse.TryParse(key, out keyParse);
         CoinTypes     coinType     = keyParse.CoinType;
         PlatformTypes platformType = keyParse.PlatformType;
         string        sqlStr       = string.Format("SELECT * FROM `coin`.`trades` WHERE `CoinId` ={0} AND `PlatformId` = {1} ORDER BY `NowTime` DESC LIMIT 1"
                                                    , (int)coinType, (int)platformType);
         DataTable dt = QueryData(sqlStr);
         if (dt == null || dt.Rows.Count == 0)
         {
             return(ExecuteResult <Ticker> .Fail(SystemErrors.Unknown, "没有获取到数据"));
         }
         Ticker ticker = new Ticker
         {
             BuyPrice  = double.Parse(dt.Rows[0]["BuyPrice"].ToString()),
             SellPrice = double.Parse(dt.Rows[0]["SellPrice"].ToString()),
             HignPrice = double.Parse(dt.Rows[0]["HighPrice"].ToString()),
             LowPrice  = double.Parse(dt.Rows[0]["LowPrice"].ToString()),
             LastPrice = double.Parse(dt.Rows[0]["LastPrice"].ToString()),
             Vol       = double.Parse(dt.Rows[0]["TradeVol"].ToString())
         };
         //Tradescs tradesc = new Tradescs(coinType, ticker, platformType, ((MySqlDateTime)dt.Rows[0]["NowTime"]).GetDateTime());
         return(ExecuteResult <Ticker> .Succeed(ticker));
     }
     catch (Exception ex)
     {
         _tracing.Error(ex, null);
         return(ExecuteResult <Ticker> .Fail(SystemErrors.Unknown, ex.Message));
     }
 }
        private static int GetFigureCount(PathElement pathElement)
        {
            if (pathElement == null || !pathElement.IsViewObjectValid)
            {
                return(0);
            }
            IPlatformTypes metadata = pathElement.Platform.Metadata;

            if (!PlatformTypes.IsInstance(pathElement.GetLocalValue(PathElement.DataProperty), PlatformTypes.PathGeometry, metadata.DefaultTypeResolver))
            {
                return(pathElement.PathGeometry.Figures.Count);
            }
            object obj = new PropertyReference(new List <ReferenceStep>()
            {
                metadata.ResolveProperty(PathElement.DataProperty) as ReferenceStep,
                metadata.ResolveProperty(PathElement.FiguresProperty) as ReferenceStep,
                metadata.ResolveProperty(PathElement.PathFigureCollectionCountProperty) as ReferenceStep
            }).GetValue(pathElement.ViewObject.PlatformSpecificObject);

            if (obj is int)
            {
                return((int)obj);
            }
            return(0);
        }
Exemplo n.º 20
0
        public override IDropAction CreateInstance(DragDropContext context)
        {
            this.CheckNullArgument((object)context, "context");
            TypeAsset result1 = (TypeAsset)null;

            if (DragSourceHelper.FirstDataOfType <TypeAsset>(context.Data, ref result1) && PlatformTypes.IsEffectType((ITypeId)result1.Type))
            {
                ISceneInsertionPoint insertionPoint = this.GetInsertionPoint((object)result1, context);
                if (insertionPoint != null)
                {
                    return((IDropAction) new DropEffectAssetAction(result1, insertionPoint));
                }
            }
            DocumentNodeMarkerSortedList result2 = (DocumentNodeMarkerSortedList)null;

            if (DragSourceHelper.FirstDataOfType <DocumentNodeMarkerSortedList>(context.Data, ref result2) && result2.Count == 1)
            {
                DocumentNodeMarker marker = result2.MarkerAt(0);
                if (marker != null && marker.Node != null && PlatformTypes.IsEffectType((ITypeId)marker.Node.Type))
                {
                    SceneViewModel viewModel = context.Target.TimelineItemManager.ViewModel;
                    SceneNode      sceneNode = SceneNode.FromMarker <SceneNode>(marker, viewModel);
                    if (sceneNode != null)
                    {
                        ISceneInsertionPoint insertionPoint = this.GetInsertionPoint((object)sceneNode, context);
                        if (insertionPoint != null)
                        {
                            return((IDropAction) new DropEffectSceneNodeAction(sceneNode, insertionPoint));
                        }
                    }
                }
            }
            return((IDropAction)null);
        }
Exemplo n.º 21
0
        internal static IPropertyId RefineDataContextProperty(SceneNode target, IPropertyId targetProperty, DocumentNode dataNode)
        {
            if (targetProperty.MemberType == MemberType.DesignTimeProperty || !DataContextHelper.IsDataContextProperty(target.DocumentNode, targetProperty))
            {
                return(targetProperty);
            }
            SampleNonBasicType sampleNonBasicType = dataNode.Type as SampleNonBasicType;

            if (sampleNonBasicType != null)
            {
                if (!sampleNonBasicType.DeclaringDataSet.IsEnabledAtRuntime)
                {
                    return(DesignTimeProperties.DesignDataContextProperty);
                }
                if (((DocumentCompositeNode)target.DocumentNode).Properties[targetProperty] != null)
                {
                    DataContextInfo dataContextInfo = new DataContextEvaluator().Evaluate(target, targetProperty, true);
                    if (dataContextInfo.DataSource != null && !(dataContextInfo.DataSource.DataSourceType is SampleNonBasicType))
                    {
                        return(DesignTimeProperties.DesignDataContextProperty);
                    }
                }
                return(targetProperty);
            }
            if (PlatformTypes.IsExpressionInteractiveType(dataNode.Type.RuntimeType))
            {
                return(DesignTimeProperties.DesignDataContextProperty);
            }
            return(targetProperty);
        }
Exemplo n.º 22
0
        private DocumentNode GetResolvedDocumentRootForSourceUri(IDocumentRootResolver documentRootResolver, DocumentCompositeNode resourceDictionaryNode, ICollection <string> warnings)
        {
            DocumentNode          documentNode;
            DocumentCompositeNode rootNode;
            DocumentCompositeNode documentCompositeNode = null;
            IDocumentRoot         documentRoot          = null;
            Uri uriValue = resourceDictionaryNode.GetUriValue(KnownProperties.ResourceDictionarySourceProperty);
            Uri uri      = uriValue;

            if (uri != null)
            {
                uri = this.documentContext.MakeDesignTimeUri(uri);
            }
            if (uri != null)
            {
                try
                {
                    documentRoot = documentRootResolver.GetDocumentRoot(uri.OriginalString);
                    if (documentRoot != null)
                    {
                        if (PlatformTypes.PlatformsCompatible(documentRoot.TypeResolver.PlatformMetadata, resourceDictionaryNode.TypeResolver.PlatformMetadata))
                        {
                            if (documentRoot.IsEditable)
                            {
                                rootNode = documentRoot.RootNode as DocumentCompositeNode;
                            }
                            else
                            {
                                rootNode = null;
                            }
                            documentCompositeNode = rootNode;
                        }
                        else
                        {
                            if (warnings != null)
                            {
                                CultureInfo currentCulture = CultureInfo.CurrentCulture;
                                string      resourceDictionaryTargetFrameworkNotMatching = StringTable.ResourceDictionaryTargetFrameworkNotMatching;
                                object[]    fullName = new object[] { uriValue, documentRoot.TypeResolver.PlatformMetadata.TargetFramework.FullName, resourceDictionaryNode.TypeResolver.PlatformMetadata.TargetFramework.FullName };
                                warnings.Add(string.Format(currentCulture, resourceDictionaryTargetFrameworkNotMatching, fullName));
                            }
                            documentNode = null;
                            return(documentNode);
                        }
                    }
                    return(documentCompositeNode);
                }
                catch (IOException oException)
                {
                    return(documentCompositeNode);
                }
                catch (NotSupportedException notSupportedException)
                {
                    return(documentCompositeNode);
                }
                return(documentNode);
            }
            return(documentCompositeNode);
        }
 private static bool ShouldUseDocumentForPreview(IInstanceBuilderContext context, XamlDocument xamlDocument)
 {
     if (!PlatformTypes.PlatformsCompatible(context.Platform.Metadata, xamlDocument.TypeResolver.PlatformMetadata))
     {
         return(false);
     }
     return(context.ShouldInstantiatePreviewControl(xamlDocument));
 }
Exemplo n.º 24
0
        public SocketPipeServer()
        {
            paths     = PlatformTypes.New <IPathProvider>();
            logger    = LoggerUtil.GetAppWideLogger();
            isStopped = false;

            connectedClients = new List <ClientRepresentation>();
        }
Exemplo n.º 25
0
 public RoomOptions(Vector2 dimensions, EnemySpawnDistributions enemySpawnDistributions, PlatformTypes platformTypes, bool platformsHaveGaps, int platformLayers = -1)
 {
     this.dimensions = dimensions;
     this.enemySpawnDistributions = enemySpawnDistributions;
     this.platformTypes           = platformTypes;
     this.platformsHaveGaps       = platformsHaveGaps;
     this.platformLayers          = platformLayers >= 0 ? platformLayers : getDefaultPlatformLayers();
 }
Exemplo n.º 26
0
 public PropertyReference ConvertToWpfPropertyReference(PropertyReference propertyReference, IPlatformMetadata destinationWpfPlatform)
 {
     if (propertyReference != null)
     {
         return(PlatformTypes.ConvertToPlatformPropertyReference(propertyReference, destinationWpfPlatform));
     }
     return((PropertyReference)null);
 }
Exemplo n.º 27
0
 public override void Draw(DrawingContext ctx, Matrix matrix)
 {
     if (!PlatformTypes.IsInstance(this.PlatformBrush, PlatformTypes.RadialGradientBrush, (ITypeResolver)this.Element.ProjectContext) || !(this.AdornerSet.Behavior.Tool is GradientBrushTool))
     {
         return;
     }
     base.Draw(ctx, matrix);
 }
Exemplo n.º 28
0
 private static bool IsTypeSerializable(ITypeResolver typeResolver, IType type)
 {
     if (type.IsInProject(typeResolver) || PlatformTypes.IsDesignTimeType(type.NearestResolvedType.RuntimeType))
     {
         return(true);
     }
     return(!PlatformTypes.IsExpressionInteractiveType(type.NearestResolvedType.RuntimeType));
 }
 public ProxyClrPropertyImplementation(PlatformTypes platformTypes, Type declaringType, string name, Type targetType, Type valueType, object defaultValue, string constructorArgument) : base(platformTypes)
 {
     this.declaringType       = declaringType;
     this.name                = name;
     this.targetType          = targetType;
     this.valueType           = valueType;
     this.defaultValue        = defaultValue;
     this.constructorArgument = constructorArgument;
 }
Exemplo n.º 30
0
        protected override void OnStartup(StartupEventArgs e)
        {
            Citadel.Core.Windows.Platform.Init();
            PlatformTypes.Register <IFilterStarter>((arr) => new WindowsFilterStarter());
            PlatformTypes.Register <IGuiServices>((arr) => new WindowsGuiServices());
            PlatformTypes.Register <ITrayIconController>((arr) => new WindowsTrayIconController());

            base.OnStartup(e);
        }
		// Check platformTypes variable if the platform type is available.
		public bool PlatformTypeIs(PlatformTypes platformType) {
			bool isAvailable = false;
			for (int i=0; i<platformTypes.Length; i++) {
				if (platformTypes[i] == platformType) {
					isAvailable = true;
					break;
				}
			}
			return isAvailable;
		}
Exemplo n.º 32
0
 // --- functions ---
 /// <summary>Initializes information about the current platform.</summary>
 internal static void Initialize()
 {
     // platform
     try {
         int platform = (int)Environment.OSVersion.Platform;
         /*
          * 0	Win32S
          * 1	Win32Windows
          * 2	Win32NT
          * 3	WinCE
          * 4	Unix
          * 5	Xbox
          * 6	MacOSX
          * 128	Unix
          * */
         if (platform >= 0 & platform <= 3) {
             PlatformType = PlatformTypes.Windows;
         } else if (platform == 4 | platform == 128) {
             PlatformType = PlatformTypes.Unix;
         } else if (platform == 6) {
             PlatformType = PlatformTypes.MacOsX;
         } else {
             PlatformType = PlatformTypes.Unknown;
         }
     } catch {
         PlatformType = PlatformTypes.Unknown;
     }
     // cli
     try {
         if (Type.GetType("Mono.Runtime") != null) {
             CliType = CliTypes.Mono;
         } else {
             CliType = CliTypes.Unknown;
         }
     } catch {
         CliType = CliTypes.Unknown;
     }
     // others
     Processors = Environment.ProcessorCount;
     NewLine = Environment.NewLine;
     CaseSensitiveFileSystem = PlatformType != PlatformTypes.Windows;
 }