Пример #1
0
        public static new string CompileResourcesLoadPath(string assetNameWithoutExtension)
        {
            string roomName = RoomManager.GetAllRoomNames()[0];

            Debug.LogError("Defaulting to room " + roomName);

            return(CompileResourcesLoadPath(roomName, assetNameWithoutExtension));
        }
Пример #2
0
        public static void PackAllRawRoomResourceBundles()
        {
            string originalRoomName = UWB_Texturing.Config.RoomObject.GameObjectName;

            string[] roomNames = RoomManager.GetAllRoomNames();
            foreach (string roomName in roomNames)
            {
                UWB_Texturing.Config.RoomObject.GameObjectName = roomName;
                PackRawRoomResourceBundle(roomName);
            }

            UWB_Texturing.Config.RoomObject.GameObjectName = originalRoomName;
        }
Пример #3
0
        public static void AcceptSocketCallback(IAsyncResult ar)
        {
            Debug.Log("Socket accepted! Attempting to process...");

            // Retrieve the listener
            TcpListener listener = (TcpListener)ar.AsyncState;

            listener.BeginAcceptSocket(new AsyncCallback(AcceptSocketCallback), listener);

            // Accept the socket
            Socket clientSocket = listener.EndAcceptSocket(ar);

            Debug.Log("Socket finalized and accepted!");
            int clientPort = ((IPEndPoint)clientSocket.RemoteEndPoint).Port;

            Debug.Log("client port is " + clientPort);

            if (clientPort == Config.Ports.Bundle)
            {
                //string[] allFilepaths = Directory.GetFiles(Config.AssetBundle.Current.CompileAbsoluteBundleDirectory());
                string[]      allFilepaths = Directory.GetFiles(Config.Current.AssetBundle.CompileAbsoluteAssetDirectory());
                List <string> fileList     = new List <string>();
                foreach (string filepath in allFilepaths)
                {
                    if (!filepath.Contains(".meta"))
                    {
                        fileList.Add(filepath);
                    }
                }


                SendFiles(fileList.ToArray(), clientSocket);
            }
            else if (clientPort == Config.Ports.Bundle_ClientToServer)
            {
                //string bundleDirectory = Config.AssetBundle.Current.CompileAbsoluteBundleDirectory();
                string bundleDirectory = Config.Current.AssetBundle.CompileAbsoluteAssetDirectory();
                ReceiveFiles(clientSocket, bundleDirectory);
            }
            else if (clientPort == Config.Ports.RoomResourceBundle)
            {
                //string filepath = Config.AssetBundle.Current.CompileAbsoluteBundlePath(UWB_Texturing.Config.AssetBundle.RawPackage.CompileFilename());
                string originalRoomName = UWB_Texturing.Config.RoomObject.GameObjectName;

                string[]      roomNames = RoomManager.GetAllRoomNames();
                List <string> filepaths = new List <string>();

                foreach (string roomName in roomNames)
                {
                    UWB_Texturing.Config.RoomObject.GameObjectName = roomName;

                    string filepath = Config.Current.AssetBundle.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RawPackage.CompileFilename());
                    filepaths.Add(filepath);
                }

                //string filepath = Config.Current.AssetBundle.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RawPackage.CompileFilename());
                //SendFile(filepath, clientSocket);

                SendFiles(filepaths.ToArray(), clientSocket);

                UWB_Texturing.Config.RoomObject.GameObjectName = originalRoomName;
            }
            else if (clientPort == Config.Ports.RoomResourceBundle_ClientToServer)
            {
                //string roomResourceBundleDirectory = Config.AssetBundle.Current.CompileAbsoluteBundleDirectory();
                string roomResourceBundleDirectory = Config.Current.AssetBundle.CompileAbsoluteAssetDirectory();
                ReceiveFiles(clientSocket, roomResourceBundleDirectory);
            }
            else if (clientPort == Config.Ports.RoomBundle)
            {
                //string filepath = Config.AssetBundle.Current.CompileAbsoluteBundlePath(UWB_Texturing.Config.AssetBundle.RoomPackage.CompileFilename());
                string originalRoomName = UWB_Texturing.Config.RoomObject.GameObjectName;

                string[]      roomNames = RoomManager.GetAllRoomNames();
                List <string> filepaths = new List <string>();

                foreach (string roomName in roomNames)
                {
                    UWB_Texturing.Config.RoomObject.GameObjectName = roomName;

                    string filepath = Config.Current.AssetBundle.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RoomPackage.CompileFilename());
                    filepaths.Add(filepath);
                    //SendFile(filepath, clientSocket);
                }

                SendFiles(filepaths.ToArray(), clientSocket);

                UWB_Texturing.Config.RoomObject.GameObjectName = originalRoomName;
            }
            else if (clientPort == Config.Ports.RoomBundle_ClientToServer)
            {
                //string roomBundleDirectory = Config.AssetBundle.Current.CompileAbsoluteBundleDirectory();
                string roomBundleDirectory = Config.Current.AssetBundle.CompileAbsoluteAssetDirectory();
                ReceiveFiles(clientSocket, roomBundleDirectory);
            }
            else if (clientPort == Config.Ports.AndroidBundle)
            {
                string[]      allFilepaths = Directory.GetFiles(Config.Android.AssetBundle.CompileAbsoluteAssetDirectory());
                List <string> fileList     = new List <string>();
                foreach (string filepath in allFilepaths)
                {
                    if (!filepath.Contains(".meta"))
                    {
                        fileList.Add(filepath);
                    }
                }

                SendFiles(fileList.ToArray(), clientSocket);
            }
            else if (clientPort == Config.Ports.AndroidBundle_ClientToServer)
            {
                //string bundleDirectory = Config.AssetBundle.Current.CompileAbsoluteBundleDirectory();
                string bundleDirectory = Config.Android.AssetBundle.CompileAbsoluteAssetDirectory();
                ReceiveFiles(clientSocket, bundleDirectory);
            }
            else if (clientPort == Config.Ports.AndroidRoomResourceBundle)
            {
                //string filepath = Config.AssetBundle.Current.CompileAbsoluteBundlePath(UWB_Texturing.Config.AssetBundle.RawPackage.CompileFilename());
                string originalRoomName = UWB_Texturing.Config.RoomObject.GameObjectName;

                string[]      roomNames = RoomManager.GetAllRoomNames();
                List <string> filepaths = new List <string>();

                foreach (string roomName in roomNames)
                {
                    UWB_Texturing.Config.RoomObject.GameObjectName = roomName;

                    string filepath = Config.Android.AssetBundle.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RawPackage.CompileFilename());
                    filepaths.Add(filepath);
                }

                //string filepath = Config.Current.AssetBundle.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RawPackage.CompileFilename());
                //SendFile(filepath, clientSocket);

                SendFiles(filepaths.ToArray(), clientSocket);

                UWB_Texturing.Config.RoomObject.GameObjectName = originalRoomName;
            }
            else if (clientPort == Config.Ports.AndroidRoomResourceBundle_ClientToServer)
            {
                string roomResourceBundleDirectory = Config.Android.AssetBundle.CompileAbsoluteAssetDirectory();
                ReceiveFiles(clientSocket, roomResourceBundleDirectory);
            }
            else if (clientPort == Config.Ports.AndroidRoomBundle)
            {
                string originalRoomName = UWB_Texturing.Config.RoomObject.GameObjectName;

                string[]      roomNames = RoomManager.GetAllRoomNames();
                List <string> filepaths = new List <string>();

                foreach (string roomName in roomNames)
                {
                    UWB_Texturing.Config.RoomObject.GameObjectName = roomName;

                    string filepath = Config.Android.AssetBundle.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RoomPackage.CompileFilename());
                    filepaths.Add(filepath);
                    //SendFile(filepath, clientSocket);
                }

                SendFiles(filepaths.ToArray(), clientSocket);

                UWB_Texturing.Config.RoomObject.GameObjectName = originalRoomName;
            }
            else if (clientPort == Config.Ports.AndroidRoomBundle_ClientToServer)
            {
                string roomBundleDirectory = Config.Android.AssetBundle.CompileAbsoluteAssetDirectory();
                ReceiveFiles(clientSocket, roomBundleDirectory);
            }
            else
            {
                Debug.Log("Port not found");
            }
        }
Пример #4
0
        // ERROR TESTING - Have to revisit after updating sendfiles, sendfile, and receivefiles for Hololens
        public static void OnConnection(StreamSocketListener sender, StreamSocketListenerConnectionReceivedEventArgs args)
        {
            new Task(() =>
            {
                // Determine which logic to follow based off of client port
                StreamSocket clientSocket = args.Socket;
                string clientIP           = args.Socket.Information.RemoteAddress.ToString();
                int clientPort            = Int32.Parse(args.Socket.Information.RemotePort);

                if (clientPort == Config.Ports.Bundle)
                {
                    string[] allFilepaths  = Directory.GetFiles(Config.AssetBundle.Current.CompileAbsoluteBundleDirectory());
                    List <string> fileList = new List <string>();
                    foreach (string filepath in allFilepaths)
                    {
                        if (!filepath.Contains(".meta"))
                        {
                            fileList.Add(filepath);
                        }
                    }

                    SendFilesAsync(fileList.ToArray(), clientSocket);
                }
                else if (clientPort == Config.Ports.Bundle_ClientToServer)
                {
                    string bundleDirectory = Config.AssetBundle.Current.CompileAbsoluteBundleDirectory();
                    ReceiveFilesAsync(clientSocket, bundleDirectory);
                }
                else if (clientPort == Config.Ports.RoomResourceBundle)
                {
                    string filepath = Config.AssetBundle.Current.CompileAbsoluteBundlePath(UWB_Texturing.Config.AssetBundle.RawPackage.CompileFilename());
                    SendFileAsync(filepath, clientSocket);
                }
                else if (clientPort == Config.Ports.RoomResourceBundle_ClientToServer)
                {
                    string roomResourceBundleDirectory = Config.AssetBundle.Current.CompileAbsoluteBundleDirectory();
                    ReceiveFilesAsync(clientSocket, roomResourceBundleDirectory);
                }
                else if (clientPort == Config.Ports.RoomBundle)
                {
                    string filepath = Config.AssetBundle.Current.CompileAbsoluteBundlePath(UWB_Texturing.Config.AssetBundle.RoomPackage.CompileFilename());
                    SendFileAsync(filepath, clientSocket);
                }
                else if (clientPort == Config.Ports.RoomBundle_ClientToServer)
                {
                    string roomBundleDirectory = Config.AssetBundle.Current.CompileAbsoluteBundleDirectory();
                    ReceiveFilesAsync(clientSocket, roomBundleDirectory);
                }
                else if (clientPort == Config.Ports.AndroidBundle)
                {
                    string[] allFilepaths  = Directory.GetFiles(Config.Android.AssetBundle.CompileAbsoluteAssetDirectory());
                    List <string> fileList = new List <string>();
                    foreach (string filepath in allFilepaths)
                    {
                        if (!filepath.Contains(".meta"))
                        {
                            fileList.Add(filepath);
                        }
                    }

                    SendFiles(fileList.ToArray(), clientSocket);
                }
                else if (clientPort == Config.Ports.AndroidBundle_ClientToServer)
                {
                    //string bundleDirectory = Config.AssetBundle.Current.CompileAbsoluteBundleDirectory();
                    string bundleDirectory = Config.Android.AssetBundle.CompileAbsoluteAssetDirectory();
                    ReceiveFiles(clientSocket, bundleDirectory);
                }
                else if (clientPort == Config.Ports.AndroidRoomResourceBundle)
                {
                    //string filepath = Config.AssetBundle.Current.CompileAbsoluteBundlePath(UWB_Texturing.Config.AssetBundle.RawPackage.CompileFilename());
                    string originalRoomName = UWB_Texturing.Config.RoomObject.GameObjectName;

                    string[] roomNames      = RoomManager.GetAllRoomNames();
                    List <string> filepaths = new List <string>();

                    foreach (string roomName in roomNames)
                    {
                        UWB_Texturing.Config.RoomObject.GameObjectName = roomName;

                        string filepath = Config.Android.AssetBundle.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RawPackage.CompileFilename());
                        filepaths.Add(filepath);
                    }

                    //string filepath = Config.Current.AssetBundle.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RawPackage.CompileFilename());
                    //SendFile(filepath, clientSocket);

                    SendFiles(filepaths.ToArray(), clientSocket);

                    UWB_Texturing.Config.RoomObject.GameObjectName = originalRoomName;
                }
                else if (clientPort == Config.Ports.AndroidRoomResourceBundle_ClientToServer)
                {
                    string roomResourceBundleDirectory = Config.Android.AssetBundle.CompileAbsoluteAssetDirectory();
                    ReceiveFiles(clientSocket, roomResourceBundleDirectory);
                }
                else if (clientPort == Config.Ports.AndroidRoomBundle)
                {
                    string originalRoomName = UWB_Texturing.Config.RoomObject.GameObjectName;

                    string[] roomNames      = RoomManager.GetAllRoomNames();
                    List <string> filepaths = new List <string>();

                    foreach (string roomName in roomNames)
                    {
                        UWB_Texturing.Config.RoomObject.GameObjectName = roomName;

                        string filepath = Config.Android.AssetBundle.CompileAbsoluteAssetPath(UWB_Texturing.Config.AssetBundle.RoomPackage.CompileFilename());
                        filepaths.Add(filepath);
                        //SendFile(filepath, clientSocket);
                    }

                    SendFiles(filepaths.ToArray(), clientSocket);

                    UWB_Texturing.Config.RoomObject.GameObjectName = originalRoomName;
                }
                else if (clientPort == Config.Ports.AndroidRoomBundle_ClientToServer)
                {
                    string roomBundleDirectory = Config.Android.AssetBundle.CompileAbsoluteAssetDirectory();
                    ReceiveFiles(clientSocket, roomBundleDirectory);
                }
                else
                {
                    Debug.Log("Port not found");
                }
            }).Start();
        }