public void SendLoginPack(TcpSocketSaeaSession session)
        {
            string RemarkInfomation = AppConfiguartion.RemarkInfomation ?? AppConfiguartion.DefaultRemarkInfo;
            string openScreenWall   = AppConfiguartion.IsOpenScreenView ?? "true"; //默认为打开屏幕墙
            string openScreenRecord = AppConfiguartion.IsScreenRecord ?? "false";  //默认屏幕记录

            var loginPack = new LoginPack();

            loginPack.IPV4              = SystemInfoUtil.GetLocalIPV4();
            loginPack.MachineName       = Environment.MachineName ?? "";
            loginPack.Remark            = RemarkInfomation;
            loginPack.ProcessorCount    = Environment.ProcessorCount;
            loginPack.ProcessorInfo     = SystemInfoUtil.GetMyCpuInfo;
            loginPack.MemorySize        = SystemInfoUtil.GetMyMemorySize;
            loginPack.StartRunTime      = AppConfiguartion.RunTime;
            loginPack.ServiceVison      = AppConfiguartion.Version;
            loginPack.UserName          = Environment.UserName.ToString();
            loginPack.OSVersion         = SystemInfoUtil.GsystemEdition;
            loginPack.OpenScreenWall    = (openScreenWall == "true" ? true : false);
            loginPack.ExistCameraDevice = SystemInfoUtil.ExistCameraDevice();
            loginPack.ExitsRecordDevice = SystemInfoUtil.ExistRecordDevice();
            loginPack.ExitsPlayerDevice = SystemInfoUtil.ExistPlayDevice();
            loginPack.IdentifyId        = AppConfiguartion.IdentifyId;
            loginPack.OpenScreenRecord  = (openScreenRecord == "true" ? true : false);
            loginPack.RecordHeight      = _screen_record_height;
            loginPack.RecordWidth       = _screen_record_width;
            loginPack.RecordSpanTime    = _screen_record_spantime;

            byte[] data = MessageHelper.CopyMessageHeadTo(MessageHead.C_MAIN_LOGIN,
                                                          loginPack);

            SendMessageToServer(data);
        }
Example #2
0
        public UnityWebRequest HeadBundleRequest(DLCBundle bundle)
        {
            string          path = hostPath + SystemInfoUtil.PlatformName() + "/" + bundle.category + "/" + bundle.name;
            UnityWebRequest www  = UnityWebRequest.Head(path);

            return(www);
        }
        private string AndroidLogFilePath()
        {
            string path = Path.Combine(SystemInfoUtil.StoragePath(), Path.Combine("SyncVR", Path.Combine("Logs", SystemInfoUtil.PackageName())));;

            ExistOrCreateDirectory(path);
            return(path);
        }
 public void Start()
 {
     downloadButton.interactable = false;
     deleteButton.interactable   = false;
     Debug.Log("Initial free space: " + SystemInfoUtil.GetAvailableStorage());
     Debug.Log("Device ID: " + SystemInfoUtil.DeviceID());
 }
        private IEnumerator UploadFile(FileInfo file)
        {
            WWWForm form = new WWWForm();

            form.AddField("uploadType", "media");
            form.AddField("name", SystemInfoUtil.PackageName() + "/" + SystemInfoUtil.DeviceID() + "/" + file.Name);

            bool delete = false;

            using (UnityWebRequest request = new UnityWebRequest(uploadUrl + "?" + Encoding.UTF8.GetString(form.data)))
            {
                request.method = UnityWebRequest.kHttpVerbPOST;
                request.SetRequestHeader("Content-Type", "application/json");

                // set uploadHandler
                UploadHandlerFile uploadHandler = new UploadHandlerFile(file.FullName);
                request.uploadHandler = uploadHandler;

                yield return(request.SendWebRequest());

                if (request.isHttpError)
                {
                    LogEvent(EventType.Error, new Dictionary <string, object> {
                        { "msg", "Http error uploading analytics file: " + request.responseCode }
                    });
                }
                else if (request.isNetworkError)
                {
                    continueUpload = false;
                    LogEvent(EventType.Error, new Dictionary <string, object> {
                        { "msg", "Network error uploading analytics file!" }
                    });
                }
                else
                {
                    delete = true;
                    LogEvent("Analytics", new Dictionary <string, object> {
                        { "msg", "Uploaded file: " + file.Name }
                    });
                }
            }

            // wait 1 frame for request to have been cleaned up and released the file
            yield return(null);

            if (delete)
            {
                try
                {
                    file.Delete();
                }
                catch (Exception e)
                {
                    LogEvent(EventType.Error, new Dictionary <string, object> {
                        { "msg", "Deleting analytics file: " + file.Name + " failed: " + e.Message }
                    });
                }
            }
        }
Example #6
0
        public UnityWebRequest DownloadBundleRequest(DLCBundle bundle)
        {
            string          path = hostPath + SystemInfoUtil.PlatformName() + "/" + bundle.category + "/" + bundle.name;
            UnityWebRequest www  = UnityWebRequest.Get(path);

            bundle.path = Path.Combine(DLCLocalService.Instance.GetDLCPath(), Path.Combine(bundle.category, bundle.name));
            DownloadHandlerFile handler = new DownloadHandlerFile(bundle.path);

            handler.removeFileOnAbort = true;
            www.downloadHandler       = handler;

            if (bundle.IsZip())
            {
                requiresUnpacking.Add(www);
            }

            return(www);
        }
Example #7
0
        private IEnumerator RetrieveBundleAllocationsRoutine()
        {
            using (UnityWebRequest www = new UnityWebRequest(hostPath + "devices/" + SystemInfoUtil.DeviceID() + ".json"))
            {
                www.method          = "GET";
                www.downloadHandler = new DownloadHandlerBuffer();

                yield return(www.SendWebRequest());

                if (www.isHttpError)
                {
                    AnalyticsService.Instance.LogEvent(AnalyticsService.EventType.Error, new Dictionary <string, object> {
                        { "msg", "Http error retrieving bundle allocations: " + www.responseCode }
                    });
                }
                else if (www.isNetworkError)
                {
                    AnalyticsService.Instance.LogEvent(AnalyticsService.EventType.Error, new Dictionary <string, object> {
                        { "msg", "Network error retrieving bundle allocations!" }
                    });
                }
                else
                {
                    try
                    {
                        allocatedBundles = JsonConvert.DeserializeObject <List <DLCBundle> >(www.downloadHandler.text);
                    }
                    catch
                    {
                        AnalyticsService.Instance.LogEvent(AnalyticsService.EventType.Error, new Dictionary <string, object> {
                            { "msg", "Error reading json response for bundle allocations!" }
                        });
                    }
                }
            }
            allocationsRetrieved = true;
        }
Example #8
0
 private string AndroidDLCPath()
 {
     return(Path.Combine(SystemInfoUtil.StoragePath(), Path.Combine("SyncVR", "DLC")));
 }