Exemplo n.º 1
0
        private DTDEditorModel LoadOldFormat()
        {
            try {
                var resultModel = new DTDEditorModel();
                using (FileStream saveFile = File.Open(OldFileStoragePath, FileMode.Open)) {
                    using (StreamReader streamReader = new StreamReader(saveFile)) {
                        streamReader.ReadLine();
                        resultModel.Credentials.Add(new DTDCredentials(DTDPlatform.iOS, streamReader.ReadLine(), streamReader.ReadLine()));
                        resultModel.Credentials.Add(new DTDCredentials(DTDPlatform.Android, streamReader.ReadLine(), streamReader.ReadLine()));
                        resultModel.Credentials.Add(new DTDCredentials(DTDPlatform.MacOS, streamReader.ReadLine(), streamReader.ReadLine()));
                        resultModel.Credentials.Add(new DTDCredentials(DTDPlatform.Windows, streamReader.ReadLine(), streamReader.ReadLine()));
                        resultModel.Credentials.Add(new DTDCredentials(DTDPlatform.WebGL, streamReader.ReadLine(), streamReader.ReadLine()));
                        resultModel.ActiveWindow                = (DTDEditorWindow)Enum.Parse(typeof(DTDEditorWindow), streamReader.ReadLine());
                        resultModel.ActivePlatform              = (DTDPlatform)Enum.Parse(typeof(DTDPlatform), streamReader.ReadLine());
                        resultModel.IsPushMessagesEnabled       = bool.Parse(streamReader.ReadLine());
                        resultModel.IsLogEnabled                = bool.Parse(streamReader.ReadLine());
                        resultModel.IsAnalyticsEnabled          = bool.Parse(streamReader.ReadLine());
                        resultModel.PushFirebaseSenderId        = string.Empty;
                        resultModel.PushGameObjectName          = streamReader.ReadLine();
                        resultModel.PushReceivedFunctionIndex   = int.Parse(streamReader.ReadLine());
                        resultModel.PushOpenedFunctionIndex     = int.Parse(streamReader.ReadLine());
                        resultModel.PushTokenFunctionIndex      = int.Parse(streamReader.ReadLine());
                        resultModel.PushTokenErrorFunctionIndex = int.Parse(streamReader.ReadLine());
                    }
                }

                return(resultModel);
            } catch (Exception) {
                return(new DTDEditorModel());
            }
        }
Exemplo n.º 2
0
        public DTDEditorViewModel()
        {
            Model = LoadModel();

            PushGameObject = GameObject.Find(Model.PushGameObjectName);

            if (PushGameObject != null)
            {
                DTDGameObject = FindCurrentGameObjectIfExist();
                if (DTDGameObject != null)
                {
                    DTDScriptObject = DTDGameObject.GetComponent <DevToDevSDK>();
                    UpdateGameObject();
                }
            }
        }