예제 #1
0
    /// <summary>
    /// Send a WAAPI call to create a transport in Wwise.
    /// Subscribe to the ak.wwise.core.transport.stateChanged topic of the new transport.
    /// Add the transport info to ItemTransports.
    /// </summary>
    /// <param name="guid">GUID of the Event</param>
    /// <returns></returns>
    static async private Task <TransportInfo> CreateTransport(System.Guid guid)
    {
        var args   = new ArgsObject(guid.ToString("B"));
        var result = await WaapiClient.Call(ak.wwise.core.transport.create, args, null, timeout : 1000);

        int  transportID    = UnityEngine.JsonUtility.FromJson <ReturnTransport>(result).transport;
        var  options        = new TransportOptions(transportID);
        uint subscriptionID = await WaapiClient.Subscribe(ak.wwise.core.transport.stateChanged, options, HandleTransportStateChanged);

        var transport = new TransportInfo(transportID, subscriptionID);

        ItemTransports.Add(guid, transport);
        return(transport);
    }
예제 #2
0
        static void Main(string[] args)
        {
            AO = new ArgsObject(args.ToList());

            #region State Management - Enables a minimized state of the console window
            IntPtr hwnd;
            hwnd = GetConsoleWindow();
            // Enables a minimized & invisible state for the console window
            if (AO.State != StateOptions.Show)
            {
                if (AO.State == StateOptions.Hide)
                {
                    ShowWindow(hwnd, SW_HIDE);
                }
                else
                {
                    ShowWindow(hwnd, SW_SHOWMINIMIZED);
                }
            }

            // Added better visual representation of Arguments for end user troubleshooting
            for (int i = 0; i < args.Length; i++)
            {
                Console.WriteLine(args[i].ToString());
            }

            // Holding the Right-Control key pauses operation so the user can review the arguments.
            if (GetAsyncKeyState(VK_RCONTROL) != 0 && GetAsyncKeyState(VK_RSHIFT) != 0)
            {
                ShowWindow(hwnd, SW_SHOWDEFAULT);
                Console.ReadLine();
            }
            #endregion

            try
            {
                ctx = new ClientContext(AO.URL);
                var passWord = new SecureString();
                foreach (char c in pw.ToCharArray())
                {
                    passWord.AppendChar(c);
                }
                ctx.Credentials = new SharePointOnlineCredentials(usr, passWord);
                Web web = ctx.Web;
                ctx.Load(web);
                ctx.ExecuteQuery();
                ctx.RequestTimeout = 500 * 300;
                switch (AO.Command)
                {
                // This will force the creation of a brand new entry even if it already exists.
                case "ADD":
                    SP_Update(true); break;

                // This will add an entry if it doesn't exist, but will only update if it does exist.
                case "UPDATE":
                    SP_Update(); break;

                // This will delete 1 or MANY entries in the list
                case "DELETE":
                    SP_Delete(); break;

                // Dumps a CSV of requested data - work in progress....
                case "READ":
                    SP_Reader(); break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.Write(" Msg: " + ex.Message + " Soource: " + ex.Source);
                SPL.WriteExceptionToLog(ex);
            }
            SPL.WriteStatusHistoryToLog();
        }//End Main