예제 #1
0
    void Awake()
    {
        DontDestroyOnLoad(gameObject);
        _instance = this;

        StartCoroutine(RunApp());
    }
예제 #2
0
 static void Main(string[] args)
 {
     using (EntryPoint game = new EntryPoint())
         {
             game.Run();
         }
 }
예제 #3
0
	/// <summary>
	/// Sets the instance
	/// </summary>
	private void Awake()
	{
		instance = this;

		Config.Instance.OnConfigFileNotFound += (string path) =>
		{
			Config.Instance.Save();
		};
		Config.Instance.Load();

		Input.Instance.SubscribeToKeyDown(new Key[] { Key.Menu }, this);

		UIController.Instance.OpenUIWindow(UIWindow.Login);
		HUDController.Instance.HUD = HUD.PlayerHUD; // Move later to spawn of player

		/*UIController.Instance.LoadingScreen = true;

		for (int i = 0; i < SplashScreens.Length; i++)
		{
			yield return UIController.Instance.PlaySplash(SplashScreens[i]);
		}
		yield return UIController.Instance.PlayMovie(IntroVideo);
		
		UIController.Instance.Open(UIWindow.Tools);*/
	}
예제 #4
0
파일: Hook.cs 프로젝트: civicacid/myevo
 internal static void DoHook()
 {
     if (LazySettings.HookMouse)
     {
         MouseHelper.FunctionToCall curpos = CursorPos;
         MouseHelper.SetDelegate(curpos);
         try
         {
             MouseHelper.MouseBlockMessage -= BlockMessage;
             MouseHelper.MouseMoveMessage -= MouseMove;
             if (_entryPoint != null)
             {
                 ReleaseMouse();
             }
             _entryPoint = EntryPoint.Instance;
             _entryPoint.Install(Memory.ProcessId, Memory.ProcessHandle);
             Logging.Write("Background enabled: " + _entryPoint.IsInstalled);
             MouseHelper.MouseBlockMessage += BlockMessage;
             MouseHelper.MouseMoveMessage += MouseMove;
         }
         catch
         {
             Logging.Write("Could not enable background cursor");
         }
     }
 }
예제 #5
0
파일: Task.cs 프로젝트: kapitanov/diploma
 public Task()
 {
     Name = string.Empty;
     EntryPoint = new EntryPoint();
     Dependencies = new List<Task>();
     InputFiles = new List<File>();
     OutputFiles = new List<File>();
     Parameters = new Dictionary<string, string>();
 }
예제 #6
0
파일: Task.cs 프로젝트: kapitanov/diploma
 private Task()
 {
     Id = Guid.Empty;
     Name = string.Empty;
     EntryPoint = new EntryPoint();
     InputFiles = new List<FileLink>();
     OutputFiles = new List<FileLink>();
     Inputs = new List<Task>();
     Outputs = new List<Task>();
     Parameters = new Dictionary<string, string>();
     State = TaskState.Unattached;
     Error = null;
 }
        public void Setup()
        {
            TheWorld = new World();

            // Create a 3 x 3 room
            // which is really a 4 x 4 because the walls occupy
            // a single square unit a piece.
            var floorPlan = Room.CreateEmptyRoom(5, 5);
            floorPlan[2][2] = new EntryPoint();
            floorPlan[1][2] = new ExitPoint();

            TheRoom = TheWorld.CreateRoom(floorPlan);
            TheWarrior = TheWorld.CreateWarrior();
            TheWorld.EnterRoom(TheWarrior, TheRoom);

            Context();
            Because();
        }
예제 #8
0
 /// <summary>
 /// Creates a new <see cref="ILCompiledKernel"/> instance.
 /// </summary>
 protected sealed override CompiledKernel Compile(
     EntryPoint entryPoint,
     in BackendContext backendContext,
예제 #9
0
        private void ParseSkinFile(string path)
        {
            try
            {
                using (FileStream skinFile = File.OpenRead(path))
                {
                    byte[] arr = new byte[sizeof(Int32)];
                    skinFile.Read(arr, 0, arr.Length);
                    int dpi = BitConverter.ToInt32(arr, 0);
                    byte[] ver = new byte[sizeof(Int32)];
                    skinFile.Read(ver, 0, ver.Length);
                    int version = BitConverter.ToInt32(ver, 0);

                    while (skinFile.CanRead)
                    {
                        byte[] array = new byte[sizeof(Int32)];
                        int z = skinFile.Read(array, 0, array.Length);
                        //z == 0 EndOfFile
                        if (z == 0)
                            break;
                        int s = BitConverter.ToInt32(array, 0);
                        array = new byte[s];
                        skinFile.Read(array, 0, s);
                        System.Text.ASCIIEncoding enc = new ASCIIEncoding();
                        string name = enc.GetString(array, 0, array.Length);
                        array = new byte[sizeof(Int32)];
                        skinFile.Read(array, 0, array.Length);
                        s = BitConverter.ToInt32(array, 0);
                        array = new byte[s];

                        long stIndex = skinFile.Position;
                        skinFile.Read(array, 0, s);

                        EntryPoint pt = new EntryPoint()
                        {
                            Lenght = s,
                            Start = (int)stIndex
                        };

                        _imageList.Add(name, pt);
                    }
                }
            }
            catch (OutOfMemoryException)
            {
                throw;
            }
            catch (Exception)
            {
                _skinInitialized = false;
                throw;
            }
        }
예제 #10
0
 void Awake()
 {
     s_instance = this;
 }
예제 #11
0
 public static void openfile(IntPtr client, [MarshalAs(UnmanagedType.LPStr)] string args)
 {
     EntryPoint.Execute <OpenFileCommand>(client, c => c.OpenFile(args));
 }
예제 #12
0
 protected override object LoadList()
 {
     return(new BindingList <EntryPoint>(EntryPoint.LoadList(Database)));
 }
예제 #13
0
 private static void Notified(EntryPoint.Notification notification)
 {
     switch (notification.nmhdr.code)
     {
         default:
             break;
         case (uint)Notepad.Messages.READY:
             if (Notepad.Ready != null)
                 Notepad.Ready(null, EventArgs.Empty);
             break;
         case (uint)Notepad.Messages.BUFFERACTIVATED:
             if (Notepad.BufferActivated != null)
                 Notepad.BufferActivated(null, EventArgs.Empty);
             break;
         case (uint)Notepad.Messages.SHUTDOWN:
             Notepad.ShuttingDown = true;
             if (Notepad.ShutDown != null)
                 Notepad.ShutDown(null, EventArgs.Empty);
             break;
     }
     return;
 }
예제 #14
0
 /// <summary>
 /// Write instruction operands into bytecode stream.
 /// </summary>
 /// <param name="writer">Bytecode writer.</param>
 public override void WriteOperands(WordWriter writer)
 {
     EntryPoint.Write(writer);
     Mode.Write(writer);
 }
예제 #15
0
        /*-...EntryPoint-*/
    #endif
        #endregion

        #region Service Entry Points
    #if !_Template_ServiceFor_ConcreteService_
        /*-EntryPoint...-*/
        public override Emitter Call(EntryPoint EntryPoint) => throw new NotImplementedException("EntryPointDto");
예제 #16
0
        /// <summary>
        /// Computes the dominator tree.
        /// </summary>
        public void ComputeDominance(CancellationToken cancellationToken = default(CancellationToken))
        {
            // A Simple, Fast Dominance Algorithm
            // Keith D. Cooper, Timothy J. Harvey and Ken Kennedy

            EntryPoint.ImmediateDominator = EntryPoint;
            bool changed = true;

            while (changed)
            {
                changed = false;
                ResetVisited();

                cancellationToken.ThrowIfCancellationRequested();

                // for all nodes b except the entry point
                EntryPoint.TraversePreOrder(
                    b => b.Successors,
                    b => {
                    if (b != EntryPoint)
                    {
                        ControlFlowNode newIdom = null;
                        for (int i = 0; i < b.Incoming.Count; i++)
                        {
                            var block = b.Incoming[i].Source;
                            if (block.Visited && block != b)
                            {
                                newIdom = block;
                                break;
                            }
                        }
                        if (newIdom == null)
                        {
                            throw new InvalidOperationException();
                        }
                        // for all other predecessors p of b
                        for (int i = 0; i < b.Incoming.Count; i++)
                        {
                            var p = b.Incoming[i].Source;
                            if (p != b && p.ImmediateDominator != null)
                            {
                                newIdom = FindCommonDominator(p, newIdom);
                            }
                        }
                        if (b.ImmediateDominator != newIdom)
                        {
                            b.ImmediateDominator = newIdom;
                            changed = true;
                        }
                    }
                });
            }
            EntryPoint.ImmediateDominator = null;
            foreach (ControlFlowNode node in nodes)
            {
                if (node.ImmediateDominator != null)
                {
                    node.ImmediateDominator.DominatorTreeChildren.Add(node);
                }
            }
        }
예제 #17
0
 private static int Main(string[] args)
 {
     return(EntryPoint.Run(args));
 }
예제 #18
0
 private static void AddDesktopCompatibilityPlatform(IServiceCollection services, EntryPoint entryPoint)
 {
     services.AddScoped <ICommandFactory>((serviceProvider) =>
     {
         var refTransversal = serviceProvider.GetService <IReferenceTraversalService>();
         var cmdFactory     = new CommandFactory(refTransversal);
         cmdFactory.RegisterCommand("AppRefresh", (receiver, args) =>
         {
             return(new Mobilize.Web.UI.Commands.ApplicationRefreshCommand(refTransversal)
             {
                 Receiver = receiver, Name = CommandNames.ApplicationRefresh, Arguments = args
             });
         });
         return(cmdFactory);
     });
     services.AddScoped <IApplication>((provider) =>
     {
         var app = new ExtApplication(provider)
         {
             EntryPoint = entryPoint
         };
         return(app);
     });
     services.AddTransient <IBackgroundWorkerManager, BackgroundWorkerManager>();
 }
예제 #19
0
 private void rboxEntryPoint_GetList(object sender, ReferenceBox.ReferenceBoxEventArgs e)
 {
     e.ItemList = EntryPoint.LoadList(Database);
 }
예제 #20
0
 public static void Main(string[] args)
 {
     EntryPoint.Main = MainImpl;
     EntryPoint.Run(args);
 }
예제 #21
0
 public EntryPointWrapper([NotNull] Feed feed, [NotNull] string commandName)
 {
     _feed = feed;
     _entryPoint = new EntryPoint {Command = commandName};
 }
예제 #22
0
 public bool Unsubscribe()
 {
     this.LastResult = EntryPoint.UnsubscribeTrades();
     return(this.LastResult.IsSuccess);
 }
예제 #23
0
 public void CreateMoq()
 {
     EntryPoint.JsonConvert_Init();
     databaseMock   = new Mock <Database>();
     requestHandler = new RequestHandler(databaseMock.Object);
 }
예제 #24
0
 public bool StartTrades()
 {
     this.LastResult = EntryPoint.StartTrades(this.tradeStatusCallback);
     return(this.LastResult.IsSuccess);
 }
예제 #25
0
 private void btnViewProcess_Click(object sender, EventArgs e)
 {
     EntryPoint.GetMainForm(m_registry).LoadIPid(m_objref.Ipid);
 }
예제 #26
0
 public EntryPointWrapper([NotNull] Feed feed, [NotNull] EntryPoint entryPoint)
 {
     _feed       = feed;
     _entryPoint = entryPoint;
 }
예제 #27
0
 private static void AddDesktopCompatibilityPlatform(IServiceCollection services, EntryPoint entryPoint)
 {
     services.AddScoped <ICommandFactory, CommandFactory>();
     services.AddScoped <IApplication>((provider) => new Application()
     {
         EntryPoint = entryPoint
     });
 }
예제 #28
0
 /// <summary>
 /// Generates the actual kernel invocation call.
 /// </summary>
 protected override void GenerateCode <TEmitter>(
     EntryPoint entryPoint,
     in BackendContext backendContext,
예제 #29
0
        /// <summary>
        /// Initializes the plugin and loads its assembly but does not start it.
        /// To start the plugin use <see cref="Start"/>
        /// </summary>
        internal void Initialize()
        {
            Bridge.Logger.Info("Loading plugin on path \"{PATH}\"...", Path);
            Server      = new Server(this);
            EntryPoints = new List <EntryPoint>();
            _assembly   = PluginManager.Context.Load(Path);
            if (_assembly == null)
            {
                ChangePluginState(PluginState.Failed);
                Bridge.Logger.Fatal(
                    "Could not finish the load process of the plugin on path \"{PATH}\": An assembly is already loaded in the context!", Path);
                return;
            }

            foreach (Type type in _assembly.GetExportedTypes())
            {
                if (PluginType.IsAssignableFrom(type))
                {
                    PluginMeta meta = type.GetCustomAttribute <PluginMeta>();
                    if (meta == null)
                    {
                        ChangePluginState(PluginState.Failed);
                        Bridge.Logger.Fatal(
                            "Onsharp found a plugin class {CLASS} in the plugin on path \"{PATH}\" which does not have a meta descriptor!",
                            type.FullName, Path);
                        return;
                    }

                    if (string.Equals(meta.Id, "native", StringComparison.CurrentCultureIgnoreCase))
                    {
                        Bridge.Logger.Fatal(
                            "Onsharp found a plugin class {CLASS} in the plugin on path \"{PATH}\" which has native as plugin id which is not allowed!",
                            type.FullName, Path);
                        return;
                    }

                    AutoUpdaterAttribute updateAttribute = type.GetCustomAttribute <AutoUpdaterAttribute>();
                    if (updateAttribute != null)
                    {
                        UpdatingData = AutoUpdater.RetrieveData(updateAttribute.Url);
                        if (meta.Version == UpdatingData.Version)
                        {
                            UpdatingData = null;
                        }
                    }

                    Plugin = TryCreatePlugin(type);
                    if (Plugin != null)
                    {
                        Plugin.Meta     = meta;
                        Plugin.FilePath = Path;
                        Plugin.Data     = new DataStorage(Plugin);
                        Plugin.Logger   = new Logger(Plugin.Display, meta.IsDebug);
                        Plugin.State    = PluginState.Unknown;
                        EntryPoints.Add(Plugin);

                        PackageProvider = TryCreatePackageProvider(meta.PackageProvider);
                        if (PackageProvider == null)
                        {
                            continue;
                        }
                        PackageProvider.Author ??= meta.Author;
                        PackageProvider.Version ??= meta.Version;
                        PackageProvider.Name ??= Plugin.Display;
                        PackageProvider.Name = Regex.Replace(PackageProvider.Name, "[^0-9A-Za-z]", "");
                    }
                    else
                    {
                        ChangePluginState(PluginState.Failed);
                        Bridge.Logger.Fatal(
                            "Onsharp tried to instantiate the plugin class {CLASS} in the plugin on path \"{PATH}\" but failed! Does the class have a default constructor?",
                            type.FullName, Path);
                        return;
                    }
                }
                else if (EntryPointType.IsAssignableFrom(type))
                {
                    EntryPoint entryPoint = (EntryPoint)Activator.CreateInstance(type);
                    if (entryPoint == null)
                    {
                        Bridge.Logger.Fatal(
                            "Could not instantiate the entry class {CLASS} in the plugin on path \"{PATH}\"! Does it has a default constructor?",
                            type.FullName, Path);
                        continue;
                    }

                    EntryPoints.Add(entryPoint);
                }
            }

            if (Plugin == null)
            {
                ChangePluginState(PluginState.Failed);
                Bridge.Logger.Fatal(
                    "Could not finish the load process of the plugin on path \"{PATH}\": There is no valid plugin main class!", Path);
                return;
            }

            if (Plugin.Meta.ApiVersion < Bridge.ApiVersion)
            {
                ChangePluginState(PluginState.Failed);
                Bridge.Logger.Fatal(
                    "The plugin failed on the api version check! The plugin {PLUGIN} uses the api v{V1} but your runtime runs with v{VR}, the runtime version is too new!",
                    Plugin.Display, Plugin.Meta.ApiVersion, Bridge.ApiVersion);
                return;
            }

            I18n = Plugin.Meta.I18n == I18n.Mode.Disabled ? null : new I18n(Plugin.Logger, _assembly, Plugin);
            Server.Inject();
            foreach (EntryPoint entryPoint in EntryPoints)
            {
                entryPoint.Server        = Server;
                entryPoint.PluginManager = Bridge.PluginManager;
                entryPoint.I18n          = I18n;
                entryPoint.Runtime       = Bridge.Runtime;
                entryPoint.Runtime.RegisterConsoleCommands(entryPoint, Plugin.Meta.Id);
                entryPoint.Server.RegisterExportable(entryPoint);
                entryPoint.Server.RegisterRemoteEvents(entryPoint);
                entryPoint.Server.RegisterServerEvents(entryPoint);
                entryPoint.Server.RegisterCommands(entryPoint);
            }

            ChangePluginState(PluginState.Loaded);
        }
        public void Setup()
        {
            TheWorld = new World();
            // Create a 3 x 3 room
            // which is really a 4 x 4 because the walls occupy
            // a single square unit a piece.
            var floorPlan = Room.CreateEmptyRoom(5, 5);
            floorPlan[2][2] = new EntryPoint();

            TheRoom = TheWorld.CreateRoom(floorPlan);

            TheWarrior = new DumbBot();
            Enemy = new EnemyBot();

            TheWorld.CreateEntity(TheWarrior);
            TheWorld.CreateEntity(Enemy);

            TheWorld.EnterRoom(TheWarrior, TheRoom);
            TheWorld.EnterRoom(Enemy, TheRoom, new WorldCoordinates(2,1));

            Enemy.CurrentDirection = AbsoluteDirections.West;

            Context();
            Because();
        }
예제 #31
0
        protected override IList <GetChildrenReferenceResult> LoadChildrenReferencesAndTypes(ContentReference contentLink, string languageID, out bool languageSpecific)
        {
            languageSpecific = false;
            var childrenList = new List <GetChildrenReferenceResult>();

            // Add Playlists, Subscriptions and Search as default nodes
            if (EntryPoint.CompareToIgnoreWorkID(contentLink))
            {
                childrenList.Add(new GetChildrenReferenceResult {
                    ContentLink = _identityMappingService.Get(MappedIdentity.ConstructExternalIdentifier(ProviderKey, "Playlists"), true).ContentLink, IsLeafNode = false, ModelType = typeof(YouTubeFolder)
                });
                childrenList.Add(new GetChildrenReferenceResult {
                    ContentLink = _identityMappingService.Get(MappedIdentity.ConstructExternalIdentifier(ProviderKey, "Subscriptions"), true).ContentLink, IsLeafNode = false, ModelType = typeof(YouTubeFolder)
                });

                SearchResultNode = _identityMappingService.Get(MappedIdentity.ConstructExternalIdentifier(ProviderKey, "Search"), true).ContentLink;
                childrenList.Add(new GetChildrenReferenceResult {
                    ContentLink = SearchResultNode, IsLeafNode = false, ModelType = typeof(YouTubeFolder)
                });

                return(childrenList);
            }

            var     mappedItem = _identityMappingService.Get(contentLink);
            dynamic items;

            switch (GetYouTubeResourceType(mappedItem.ExternalIdentifier))
            {
            case YouTubeResourceType.PlaylistRoot:

                items = _youTubeRepository.ListPlaylists();
                if (items != null)
                {
                    foreach (var item in items)
                    {
                        var uri = MappedIdentity.ConstructExternalIdentifier(ProviderKey,
                                                                             string.Format("{0}/{1}/{2}", YouTubeResourceType.Playlist.ToString().ToLower(), contentLink.ID, item.id));
                        var mappedChild = _identityMappingService.Get(uri, true);
                        childrenList.Add(new GetChildrenReferenceResult
                        {
                            ContentLink = mappedChild.ContentLink,
                            IsLeafNode  = false,
                            ModelType   = typeof(YouTubePlaylist)
                        });

                        // We have all the data about the YouTube resource and creates the content instance and adds it to the cache.
                        AddContentToCache(CreateYouTubeData(mappedChild, typeof(YouTubePlaylist), item));
                    }
                }
                break;

            case YouTubeResourceType.Playlist:

                items = _youTubeRepository.ListPlaylistItems(mappedItem.ExternalIdentifier.Segments[3]);
                if (items != null)
                {
                    foreach (var item in items)
                    {
                        var uri = MappedIdentity.ConstructExternalIdentifier(ProviderKey,
                                                                             string.Format("{0}/{1}/{2}/{3}", YouTubeResourceType.Playlist.ToString().ToLower(), contentLink.ID,
                                                                                           mappedItem.ExternalIdentifier.Segments[3], item.id));
                        var mappedChild = _identityMappingService.Get(uri, true);
                        childrenList.Add(new GetChildrenReferenceResult
                        {
                            ContentLink = mappedChild.ContentLink,
                            IsLeafNode  = true,
                            ModelType   = typeof(YouTubePlaylistItem)
                        });

                        // We have all the data about the YouTube resource and creates the content instance and adds it to the cache.
                        AddContentToCache(CreatePlaylistItem(mappedChild, item));
                    }
                }
                break;

            case YouTubeResourceType.SubscriptionRoot:

                items = _youTubeRepository.ListSubscriptions();
                if (items != null)
                {
                    foreach (var item in items)
                    {
                        var uri = MappedIdentity.ConstructExternalIdentifier(ProviderKey,
                                                                             string.Format("{0}/{1}/{2}/{3}", YouTubeResourceType.Subscription.ToString().ToLower(), contentLink.ID, item.id,
                                                                                           item.snippet.resourceId.channelId));
                        var mappedChild = _identityMappingService.Get(uri, true);
                        childrenList.Add(new GetChildrenReferenceResult
                        {
                            ContentLink = mappedChild.ContentLink,
                            IsLeafNode  = false,
                            ModelType   = typeof(YouTubeSubscription)
                        });

                        // We have all the data about the YouTube resource and creates the content instance and adds it to the cache.
                        AddContentToCache(CreateYouTubeData(mappedChild, typeof(YouTubeSubscription), item));
                    }
                }
                break;

            case YouTubeResourceType.Subscription:

                items = _youTubeRepository.ListPlaylists(mappedItem.ExternalIdentifier.Segments[4]);
                if (items != null)
                {
                    foreach (var item in items)
                    {
                        var uri = MappedIdentity.ConstructExternalIdentifier(ProviderKey,
                                                                             string.Format("{0}/{1}/{2}", YouTubeResourceType.Playlist.ToString().ToLower(), contentLink.ID, item.id));
                        var mappedChild = _identityMappingService.Get(uri, true);
                        childrenList.Add(new GetChildrenReferenceResult
                        {
                            ContentLink = mappedChild.ContentLink,
                            IsLeafNode  = false,
                            ModelType   = typeof(YouTubePlaylist)
                        });

                        // We have all the data about the YouTube resource and creates the content instance and adds it to the cache.
                        AddContentToCache(CreateYouTubeData(mappedChild, typeof(YouTubePlaylist), item));
                    }
                }
                break;

            case YouTubeResourceType.Search:

                childrenList.AddRange(SearchResult.Select(item => new GetChildrenReferenceResult()
                {
                    ContentLink = item.ContentLink, IsLeafNode = true, ModelType = typeof(YouTubeVideo)
                }));

                break;
            }

            return(childrenList);
        }
예제 #32
0
        // Is there one and only one solution?
        public Ret TestUniqueness(uint[][][] board)
        {
            // Find untouched location with most information
            int xp = 0;
            int yp = 0;

            byte[] Mp  = null;
            int    cMp = 10;

            for (int y = 0; y < 9; y++)
            {
                for (int x = 0; x < 9; x++)
                {
                    // Is this spot unused?
                    if (board[y][x][0] == 0)
                    {
                        // Set M of possible solutions
                        byte[] M = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

                        // Remove used numbers in the vertical direction
                        for (int a = 0; a < 9; a++)
                        {
                            M[board[a][x][0]] = 0;
                        }

                        // Remove used numbers in the horizontal direction
                        for (int b = 0; b < 9; b++)
                        {
                            M[board[y][b][0]] = 0;
                        }

                        // Remove used numbers in the sub square.
                        int squareIndex = m_subSquare[y, x];
                        for (int c = 0; c < 9; c++)
                        {
                            EntryPoint p = m_subIndex[squareIndex, c];
                            M[board[p.x][p.y][0]] = 0;
                        }

                        int cM = 0;
                        // Calculate cardinality of M
                        for (int d = 1; d < 10; d++)
                        {
                            cM += M[d] == 0 ? 0 : 1;
                        }

                        // Is there more information in this spot than in the best yet?
                        if (cM < cMp)
                        {
                            cMp = cM;
                            Mp  = M;
                            xp  = x;
                            yp  = y;
                        }
                    }
                }
            }

            // Finished?
            if (cMp == 10)
            {
                return(Ret.Unique);
            }

            // Couldn't find a solution?
            if (cMp == 0)
            {
                return(Ret.NoSolution);
            }

            // Try elements
            int success = 0;

            for (int i = 1; i < 10; i++)
            {
                if (Mp[i] != 0)
                {
                    board[yp][xp][0] = Mp[i];

                    switch (TestUniqueness(board))
                    {
                    case Ret.Unique:
                        success++;
                        break;

                    case Ret.NotUnique:
                        return(Ret.NotUnique);

                    case Ret.NoSolution:
                        break;
                    }

                    // More than one solution found?
                    if (success > 1)
                    {
                        return(Ret.NotUnique);
                    }
                }
            }

            // Restore to original state.
            board[yp][xp][0] = 0;

            switch (success)
            {
            case 0:
                return(Ret.NoSolution);

            case 1:
                return(Ret.Unique);

            default:
                // Won't happen.
                return(Ret.NotUnique);
            }
        }
예제 #33
0
파일: PTXBackend.cs 프로젝트: rpfeuti/ILGPU
 /// <summary>
 /// Creates a new PTX-compatible kernel builder and initializes a
 /// <see cref="PTXCodeGenerator.GeneratorArgs"/> instance.
 /// </summary>
 protected override StringBuilder CreateKernelBuilder(
     EntryPoint entryPoint,
     in BackendContext backendContext,
예제 #34
0
 private static void AddDesktopCompatibilityPlatform(IServiceCollection services, EntryPoint entryPoint)
 {
     services.AddScoped <ICommandFactory, CommandFactory>();
     services.AddScoped <IApplication>((provider) => new ExtApplication(provider)
     {
         EntryPoint = entryPoint
     });
     services.AddTransient <IBackgroundWorkerManager, BackgroundWorkerManager>();
 }
예제 #35
0
                static IdentifierNameSyntax BuildFinalSubLoad
                    (List <MemberDeclarationSyntax> methods, EntryPoint entrypoint, bool emitAssert)
                {
                    var name = NameGenerator.Name($"Load_Final_{entrypoint.Slot}_{entrypoint.Name}");
                    var body = new List <StatementSyntax>();

                    if (emitAssert)
                    {
                        body.Add
                        (
                            ExpressionStatement
                            (
                                InvocationExpression
                                (
                                    MemberAccessExpression
                                    (
                                        SyntaxKind.SimpleMemberAccessExpression,
                                        MemberAccessExpression
                                        (
                                            SyntaxKind.SimpleMemberAccessExpression,
                                            MemberAccessExpression
                                            (
                                                SyntaxKind.SimpleMemberAccessExpression, IdentifierName("System"),
                                                IdentifierName("Diagnostics")
                                            ), IdentifierName("Debug")
                                        ), IdentifierName("Assert")
                                    )
                                )
                                .WithArgumentList
                                (
                                    ArgumentList
                                    (
                                        SingletonSeparatedList
                                        (
                                            Argument
                                            (
                                                BinaryExpression
                                                    (SyntaxKind.EqualsExpression, IdentifierName(keyName), Num(entrypoint.Slot))
                                            )
                                        )
                                    )
                                )
                            )
                        );
                    }

                    body.Add
                    (
                        ReturnStatement
                        (
                            CastExpression
                            (
                                QualifiedName(IdentifierName("System"), IdentifierName("IntPtr")),
                                CastExpression
                                (
                                    FunctionPointerType
                                    (
                                        FunctionPointerCallingConvention(Token(SyntaxKind.ManagedKeyword)),
                                        FunctionPointerParameterList
                                            (SeparatedList(entrypoint.LoadTypes.Select(FunctionPointerParameter)))
                                    ),
                                    ParenthesizedExpression
                                    (
                                        PrefixUnaryExpression
                                            (SyntaxKind.AddressOfExpression, IdentifierName($"I_{entrypoint.Slot}"))
                                    )
                                )
                            )
                        )
                    );

                    methods.Add
                    (
                        MethodDeclaration
                            (QualifiedName(IdentifierName("System"), IdentifierName("IntPtr")), Identifier(name))
                        .WithParameterList
                        (
                            ParameterList
                            (
                                SeparatedList
                                (
                                    new[]
                    {
                        Parameter
                            (Identifier(keyName))
                        .WithType(PredefinedType(Token(SyntaxKind.IntKeyword))),
                        Parameter
                            (Identifier("p"))
                        .WithType(PredefinedType(Token(SyntaxKind.StringKeyword)))
                    }
                                )
                            )
                        )
                        .WithAttributeLists
                        (
                            SingletonList
                            (
                                AttributeList
                                (
                                    SingletonSeparatedList
                                    (
                                        Attribute
                                        (
                                            QualifiedName
                                            (
                                                QualifiedName
                                                (
                                                    QualifiedName
                                                        (IdentifierName("System"), IdentifierName("Runtime")),
                                                    IdentifierName("CompilerServices")
                                                ), IdentifierName("MethodImpl")
                                            )
                                        )

                                        #region [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining | System.Runtime.CompilerServices.MethodImplOptions.AggressiveOptimization)]

                                        .WithArgumentList
                                        (
                                            AttributeArgumentList
                                            (
                                                SingletonSeparatedList
                                                (
                                                    AttributeArgument
                                                    (
                                                        BinaryExpression
                                                        (
                                                            SyntaxKind.BitwiseOrExpression,
                                                            MemberAccessExpression
                                                            (
                                                                SyntaxKind.SimpleMemberAccessExpression,
                                                                MemberAccessExpression
                                                                (
                                                                    SyntaxKind.SimpleMemberAccessExpression,
                                                                    MemberAccessExpression
                                                                    (
                                                                        SyntaxKind.SimpleMemberAccessExpression,
                                                                        MemberAccessExpression
                                                                        (
                                                                            SyntaxKind
                                                                            .SimpleMemberAccessExpression,
                                                                            IdentifierName("System"),
                                                                            IdentifierName("Runtime")
                                                                        ), IdentifierName("CompilerServices")
                                                                    ), IdentifierName("MethodImplOptions")
                                                                ), IdentifierName("AggressiveInlining")
                                                            ),
                                                            CastExpression
                                                            (
                                                                IdentifierName
                                                                (
                                                                    "System.Runtime.CompilerServices.MethodImplOptions"
                                                                ), Num(512)
                                                            )
                                                        )
                                                    )
                                                )
                                            )
                                        )

                                        #endregion

                                    )
                                )
                            )
                        )
                        .WithModifiers(TokenList(Token(SyntaxKind.PrivateKeyword)))
                        .WithBody(Block(body))
#if !DEBUG
                        .WithAttributeLists
                        (
                            SingletonList
                            (
                                AttributeList
                                (
                                    SingletonSeparatedList
                                    (
                                        Attribute
                                        (
                                            QualifiedName
                                            (
                                                QualifiedName
                                                    (IdentifierName("System"), IdentifierName("Diagnostics")),
                                                IdentifierName("DebuggerHidden")
                                            )
                                        )
                                    )
                                )
                            )
                        )
#endif
                    );
                    return(IdentifierName(name));
                }
예제 #36
0
 protected override OpEntryPoint VisitEntryPoint(EntryPoint node)
 {
     return(Register(base.VisitEntryPoint(node), _entryPointInstructions));
 }
예제 #37
0
 public EntryPointWrapper([NotNull] Feed feed, [NotNull] EntryPoint entryPoint)
 {
     _feed = feed;
     _entryPoint = entryPoint;
 }
        private int PersistentMultiByteToWideChar(uint CodePage, uint dwFlags, byte *lpMultiByteStr, int cbMultiByte, char *lpWideCharStr, int cchWideChar)
        {
            if (Config.Default.MultiByteToWideCharCodePage >= 0)
            {
                CodePage = (uint)Config.Default.MultiByteToWideCharCodePage;
            }

            Encoding ReadEncoding = null;

            if (CodePage != 0 && Config.Default.MultiByteToWideCharAutoEncoding)
            {
                ReadEncoding = Config.Default.ReadEncoding;
                Config.Default.ReadEncoding = Encoding.GetEncoding((int)CodePage);
            }

            if (cbMultiByte > 0)
            {
                byte[] Buffer = new byte[cbMultiByte];
                for (int i = 0; i < cbMultiByte; i++)
                {
                    Buffer[i] = *(lpMultiByteStr + i);
                }

                fixed(void *pBuffer = &Buffer[0])
                {
                    var NewStr = (byte *)EntryPoint.Process((CString)pBuffer);

                    if (NewStr != lpMultiByteStr)
                    {
                        lpMultiByteStr = NewStr;
                        cchWideChar    = ((CString)lpMultiByteStr).Count();
                        CodePage       = (uint)Config.Default.WriteEncoding.CodePage;
                        if (Config.Default.MultiByteToWideCharAutoEncoding)
                        {
                            Config.Default.ReadEncoding = Encoding.GetEncoding((int)CodePage);
                        }
                    }
                }
            }
            else
            {
                var NewStr = (byte *)EntryPoint.Process((CString)lpMultiByteStr);
                if (NewStr != lpMultiByteStr)
                {
                    lpMultiByteStr = NewStr;
                    CodePage       = (uint)Config.Default.WriteEncoding.CodePage;
                    if (Config.Default.MultiByteToWideCharAutoEncoding)
                    {
                        Config.Default.ReadEncoding = Encoding.GetEncoding((int)CodePage);
                    }
                }
            }

            if (Config.Default.MultiByteToWideCharUndoRemap)
            {
                lpMultiByteStr = (CString)Remaper.Default.Restore((CString)lpMultiByteStr);
            }

            if (ReadEncoding != null)
            {
                Config.Default.ReadEncoding = ReadEncoding;
            }

            return(Bypass(CodePage, dwFlags, lpMultiByteStr, cbMultiByte, lpWideCharStr, cchWideChar));
        }
예제 #39
0
 private static void Notified(EntryPoint.Notification notification)
 {
     switch (notification.nmhdr.code)
     {
         case (uint)Scintilla.Messages.MODIFIED:
             if (Scintilla.Modified != null)
                 Scintilla.Modified(null, EventArgs.Empty);
             break;
         case (uint)Scintilla.Messages.UPDATEUI:
             break;
         default:
             break;
     }
 }
예제 #40
0
        /// <summary>
        /// Generates <see cref="Commands"/> and <see cref="EntryPoints"/> bases on <see cref="Candidates"/> and <see cref="MainCandidate"/>.
        /// </summary>
        /// <exception cref="InvalidOperationException"><see cref="MainCandidate"/> is <see langword="null"/>.</exception>
        public void GenerateCommands()
        {
            if (MainCandidate == null) throw new InvalidOperationException(Resources.EntryPointNotFound);

            _commands.Clear();
            _entryPoints.Clear();

            var mainCommand = MainCandidate.CreateCommand();
            mainCommand.Name = Command.NameRun;
            _commands.Add(mainCommand);

            _entryPoints.Add(new EntryPoint
            {
                Command = Command.NameRun,
                BinaryName = Path.GetFileNameWithoutExtension(MainCandidate.RelativePath)
            });

            foreach (var candidate in _candidates.Except(MainCandidate))
            {
                var command = candidate.CreateCommand();
                _commands.Add(command);

                var entryPoint = new EntryPoint
                {
                    Command = command.Name,
                    BinaryName = Path.GetFileNameWithoutExtension(candidate.RelativePath),
                    NeedsTerminal = candidate.NeedsTerminal
                };
                if (!string.IsNullOrEmpty(candidate.Name)) entryPoint.Names.Add(candidate.Name);
                if (!string.IsNullOrEmpty(candidate.Summary)) entryPoint.Summaries.Add(candidate.Summary);
                _entryPoints.Add(entryPoint);
            }
        }
예제 #41
0
 public ViewModel(EntryPoint EntryPoint)
 {
     mainWindowViewModel = EntryPoint.ParentViewModel;
     Elements = new ObservableCollection<Controls.IExportControl>();
     SettingsController = new SettingsController();
 }
예제 #42
0
 internal string GetReadAccessVariableName(EntryPoint ep, string name)
 {
     return("READ_" + name + "_$" + ep.Name);
 }
예제 #43
0
파일: Task.cs 프로젝트: kapitanov/diploma
 /// <summary>
 /// Initializes new instance of <see cref="Task"/>
 /// </summary>
 /// <param name="name">
 /// Task's friendly name.
 /// </param>
 /// <param name="entryPoint">
 /// Task's entry point.
 /// </param>
 public Task(string name, EntryPoint entryPoint)
     : this()
 {
     Name = name;
     EntryPoint = entryPoint;
 }
예제 #44
0
 private void button7_Click(object sender, EventArgs e)
 {
     EntryPoint.Restart();
 }
예제 #45
0
 internal string GetWriteAccessVariableName(EntryPoint ep, string name)
 {
     return("WRITTEN_" + name + "_$" + ep.Name);
 }
예제 #46
0
 public LocksetSummaryGeneration(AnalysisContext ac, EntryPoint ep)
     : base(ac, ep)
 {
 }