public static void AppendText(SaveLocation saveLocation, string relativePath, string content)
        {
            var path = SystemPath.Combine(_saveLocations[saveLocation], relativePath).AbsolutePath;

            Directory.CreateDirectory(Path.GetDirectoryName(path));
            File.AppendAllText(path, content);
        }
Exemple #2
0
        private void btnSetDefault_Click(object sender, RoutedEventArgs e)
        {
            SaveLocation selected = (SaveLocation)lvLocations.SelectedItem;

            SettingsManager.Instance.setDefaultSaveLocation(selected);
            AddSaveLocationsToList();
        }
Exemple #3
0
        public async Task LoadLocations()
        {
            string  fileName            = "settings.xml";
            IFolder folder              = FileSystem.Current.LocalStorage;
            ExistenceCheckResult result = await folder.CheckExistsAsync(fileName);

            if (result == ExistenceCheckResult.FileExists)
            {
                try
                {
                    IFile file = await folder.GetFileAsync(fileName);

                    string text = await file.ReadAllTextAsync();

                    using (var reader = new StringReader(text))
                    {
                        var          serializer = new XmlSerializer(typeof(SaveLocation));
                        SaveLocation settings   = (SaveLocation)serializer.Deserialize(reader);
                        for (int i = 0; i < settings.Savelocation.Count; i++)
                        {
                            listLocations.Add(new ListLocation {
                                Id        = settings.Savelocation[i].Id,
                                Locations = settings.Savelocation[i].Locations, NameList = settings.Savelocation[i].NameList
                            });
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine($"Error reading settings: {ex.Message}");
                }
            }
        }
Exemple #4
0
 private static void TankPrefs_Save()
 {
     lock (fileLock)
     {
         data["lastSaved"] = DateTime.Now.ToString();
         FileStream fileStream = File.Open((nextSaveLocation == SaveLocation.Primary) ? SavePath : SavePathAlt, FileMode.Create);
         if (fileStream != null)
         {
             try
             {
                 byte[] stringData = GetStringData(Encrypt(SerializeDictionary(data, localBuilder)));
                 fileStream.Write(stringData, 0, stringData.Length);
                 nextSaveLocation = ((nextSaveLocation == SaveLocation.Primary) ? SaveLocation.Secondary : SaveLocation.Primary);
             }
             catch (Exception e)
             {
                 int num = Marshal.GetHRForException(e) & 0xFFFF;
                 if (num != 39)
                 {
                 }
             }
         }
         fileStream.Close();
     }
 }
Exemple #5
0
        public void Test_SaveLocation(string src, SaveLocation location)
        {
            var dest = new Request(new[] { src });

            Assert.That(dest.Mode, Is.EqualTo(Mode.Extract));
            Assert.That(dest.Location, Is.EqualTo(location));
        }
Exemple #6
0
 public Value(SaveLocation loc, Cpu cpu)
 {
     this.Buffer  = null;
     this.Index   = 0;
     this.SaveLoc = loc;
     this.Literal = 0;
     this.MyCpu   = cpu;
 }
Exemple #7
0
 public InternalValue(ushort[] buffer, ushort index)
 {
     this.Buffer = buffer;
     this.Index = index;
     this.SaveLoc = SaveLocation.Memory;
     this.Literal = 0;
     this.MyCpu = null;
 }
Exemple #8
0
 public void addSaveLocation(string path)
 {
     if (!this.hasLocation(path))
     {
         SaveLocation location = new SaveLocation(path);
         SaveLocations.Add(location);
     }
 }
Exemple #9
0
        public void SaveLocationSerialization_Test()
        {
            var location = new SaveLocation(Guid.NewGuid(), "sram", new DirectoryInfo(Path.GetTempPath()),
                                            Guid.NewGuid(), DateTimeOffset.Now);
            string        serialized   = JsonConvert.SerializeObject(location.ToManifest());
            ISaveLocation deserialized =
                JsonConvert.DeserializeObject <SaveLocationManifest>(serialized).ToSaveLocation();

            Assert.Equal(location.LocationGuid, deserialized.LocationGuid);
        }
        private void SavePicturesToHost(string pathFolder, SaveLocation saveLocation)
        {
            if (string.IsNullOrWhiteSpace(pathFolder))
            {
                throw new ArgumentException("Cannot be null or white space.", "pathFolder");
            }

            this.CheckDisposed();

            this.ChangePicturesSaveLocation(saveLocation | SaveLocation.Host);
        }
Exemple #11
0
        internal void setDefaultSaveLocation(SaveLocation selected)
        {
            SaveLocation oldDefault = this.getDefaultLocation();

            if (oldDefault != null)
            {
                oldDefault.IsDefaultLocation = false;
            }

            int          newLocationIndex = SaveLocations.IndexOf(selected);
            SaveLocation newDefault       = SaveLocations[newLocationIndex];

            newDefault.IsDefaultLocation = true;
        }
Exemple #12
0
 private static void LoadFromFile(bool setIsInitialized)
 {
     if (data != null)
     {
         return;
     }
     if (File.Exists(SavePath) && File.Exists(SavePathAlt))
     {
         try
         {
             if (File.GetLastWriteTimeUtc(SavePathAlt) > File.GetLastWriteTimeUtc(SavePath))
             {
                 nextSaveLocation = SaveLocation.Primary;
                 data             = LoadDictionaryFromFile(SavePathAlt);
             }
         }
         catch (UnauthorizedAccessException)
         {
         }
     }
     if (data == null)
     {
         nextSaveLocation = SaveLocation.Secondary;
         data             = LoadDictionaryFromFile(SavePath);
     }
     if (data == null)
     {
         nextSaveLocation = SaveLocation.Primary;
         data             = LoadDictionaryFromFile(SavePathAlt);
     }
     if (data == null)
     {
         data = LoadDictionaryFromFile(SavePathBackup);
     }
     if (data == null)
     {
         data = LoadDictionaryFromFile(LegacySavePath);
         if (data != null)
         {
             ConvertOldSaveFile();
         }
     }
     if (data == null)
     {
         data = new Dictionary <string, object>();
     }
     IsInitialized            = setIsInitialized;
     InitializationInProgress = setIsInitialized;
 }
        /// <summary>
        /// Creates the barcode and save the barcode image to the local path provided
        /// Examples:
        /// Save(SaveLocation.Local, "c:\\code128.png", ImageFormat.PNG);
        /// Save(SaveLocation.Server, "test-1234.png", ImageFormat.PNG);
        /// </summary>
        /// <param name="SaveLocation">Location where barcode needs to be saved, local or Saaspose server</param>
        /// <param name="outputPath">Location where barcode is to be saved</param>
        /// <param name="ImageFormat">Image format</param>
        public GenerationResponse Save(SaveLocation saveLocation, string outputPath, ImageFormat imageFormat)
        {
            PerformValidations();

            // If image needs to be saved locally
            if (saveLocation == SaveLocation.Local)
            {
                // Build URL with querystring request parameters
                string uri = UriBuilder("");

                // Send the request to Saaspose server
                Stream responseStream = Utils.ProcessCommand(Utils.Sign(uri), "GET");
                // Read the response, in this case the response is a Stream that contains barcode image
                // So, just save the response stream to a local image file
                using (Stream file = File.OpenWrite(outputPath))
                {
                    CopyStream(responseStream, file);
                }
                responseStream.Close();

                GenerationResponse response = new GenerationResponse();
                response.Status = "OK";
                return(response);
            }
            else if (saveLocation == SaveLocation.Server)
            {
                // Build URL with querystring request parameters
                string uri = UriBuilder(outputPath);

                // Send the request to Saaspose server
                Stream       responseStream = Utils.ProcessCommand(Utils.Sign(uri), "PUT");
                StreamReader reader         = new StreamReader(responseStream);
                // Read the response
                string strJSON = reader.ReadToEnd();


                //Parse the json string to JObject
                JObject parsedJSON = JObject.Parse(strJSON);


                //Deserializes the JSON to a object.
                GenerationResponse barcodeGenerationResponse = JsonConvert.DeserializeObject <GenerationResponse>(parsedJSON.ToString());

                return(barcodeGenerationResponse);
            }

            // Return null, if anything goes wrong
            return(null);
        }
Exemple #14
0
        private void SavePicturesToHost(string pathFolder, SaveLocation saveLocation)
        {
            if (string.IsNullOrWhiteSpace(pathFolder))
            {
                throw new ArgumentException("Cannot be null or white space.", "pathFolder");
            }

            this.CheckDisposed();

            _picturePath = pathFolder;
            if (!Directory.Exists(_picturePath))
            {
                Directory.CreateDirectory(_picturePath);
            }

            this.ChangePicturesSaveLocation(saveLocation | SaveLocation.Host);
        }
        /// <summary>
        /// convert a particular page to image with default size
        /// </summary>
        /// <param name="outputPath"></param>
        /// <param name="pageNumber"></param>
        public void GetImage(string outputPath, int pageNumber, ConvertImageFormat imageFormat, SaveLocation saveLocation)
        {
            //build URI to get page count
            string strURI = Product.BaseProductUri + "/pdf/" + FileName + "/pages/" + pageNumber.ToString();
            strURI += "?format=" + imageFormat;
           

            string signedURI = Utils.Sign(strURI);

            Stream responseStream = Utils.ProcessCommand(signedURI, "GET");

            using (Stream fileStream = System.IO.File.OpenWrite(outputPath))
            {
                Utils.CopyStream(responseStream, fileStream);
            }
            responseStream.Close();

        }
        private IntuneMAMSaveLocation GetSavedLocation(SaveLocation location)
        {
            switch (location)
            {
            case SaveLocation.LocalDrive:
                return(IntuneMAMSaveLocation.LocalDrive);

            case SaveLocation.OneDriveForBusiness:
                return(IntuneMAMSaveLocation.OneDriveForBusiness);

            case SaveLocation.SharePoint:
                return(IntuneMAMSaveLocation.SharePoint);

            case SaveLocation.LocationOther:
            default:
                return(IntuneMAMSaveLocation.Other);
            }
        }
        //TODO: Cache save location string somehow.
        protected virtual string BuildSaveLocation(SaveLocation baseLocation, string suffix)
        {
            switch (baseLocation)
            {
            case SaveLocation.ApplicationData:
                return(Application.dataPath + "/" + suffix + "/");

            case SaveLocation.ApplicationPersistentData:
                return(Application.persistentDataPath + "/" + suffix + "/");

            case SaveLocation.Desktop:
                return(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/" + suffix + "/");

            case SaveLocation.Documents:
                return(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/" + suffix + "/");

            default:
                throw new NotImplementedException(baseLocation + " is not supported.");
            }
        }
Exemple #18
0
        private void ChangePicturesSaveLocation(SaveLocation saveLocation)
        {
            this.CheckDisposed();

            this.EnsureOpenSession();

            Util.Assert(Edsdk.EdsSetPropertyData(this.Handle, Edsdk.PropID_SaveTo, 0, Marshal.SizeOf(typeof(int)),
                                                 (int)saveLocation), "Failed to set SaveTo location.");

            if (!this.IsLegacy)
            {
                this.LockAndExceute(() =>
                {
                    var capacity = new Edsdk.EdsCapacity {
                        NumberOfFreeClusters = 0x7FFFFFFF, BytesPerSector = 0x1000, Reset = 1
                    };
                    Util.Assert(Edsdk.EdsSetCapacity(this.Handle, capacity), "Failed to set capacity.");
                });
            }
        }
        /// <summary>
        /// Creates the barcode and save the barcode image to the supplied stream
        /// Example: Save(SaveLocation.Local, imgStream, ImageFormat.PNG);
        /// </summary>
        /// <param name="imageStream">Stream where image will be saved</param>
        /// <param name="ImageFormat">Image format</param>
        public GenerationResponse Save(SaveLocation saveLocation, Stream imageStream, ImageFormat imageFormat)
        {
            PerformValidations();

            // Build URL with querystring request parameters
            string uri = UriBuilder("");

            // Send the request to Saaspose server
            Stream responseStream = Utils.ProcessCommand(Utils.Sign(uri), "GET");

            // Read the response, in this case the response is a Stream that contains barcode image
            // Just copy the response stream to the image stream that user passed
            CopyStream(responseStream, imageStream);
            // close the response stream
            responseStream.Close();

            GenerationResponse response = new GenerationResponse();

            response.Status = "OK";
            return(response);
        }
Exemple #20
0
        public async Task SaveLocations()
        {
            var    serializer    = new XmlSerializer(typeof(SaveLocation));
            string settingsAsXml = "";

            using (var stringWriter = new StringWriter())
                using (var writer = XmlWriter.Create(stringWriter))
                {
                    SaveLocation = new SaveLocation
                    {
                        Savelocation = listLocations
                    };
                    serializer.Serialize(writer, SaveLocation);
                    settingsAsXml = stringWriter.ToString();
                }

            IFolder folder = FileSystem.Current.LocalStorage;
            IFile   file   = await folder.CreateFileAsync("settings.xml",
                                                          CreationCollisionOption.ReplaceExisting);

            await file.WriteAllTextAsync(settingsAsXml);
        }
 public bool IsSavedToAllowedForLocation(SaveLocation location, string accountName)
 {
     return(IntuneMAMPolicyManager.Instance.Policy.IsSaveToAllowedForLocation(GetSavedLocation(location), accountName));
 }
Exemple #22
0
 public void removeSaveLocation(SaveLocation location)
 {
     SaveLocations.Remove(location);
 }
Exemple #23
0
 public BinaryFile(SaveLocation saveLocation, string relativePath)
 {
     FullPath = Files.GetPath(saveLocation, relativePath);
     Formatter = DefaultFormatter;
 }
        /// <summary>
        /// Creates the barcode and save the barcode image to the local path provided
        /// Examples:
        /// Save(SaveLocation.Local, "c:\\code128.png", ImageFormat.PNG);
        /// Save(SaveLocation.Server, "test-1234.png", ImageFormat.PNG);
        /// </summary>
        /// <param name="SaveLocation">Location where barcode needs to be saved, local or Saaspose server</param>
        /// <param name="outputPath">Location where barcode is to be saved</param>
        /// <param name="ImageFormat">Image format</param>
        public GenerationResponse Save(SaveLocation saveLocation, string outputPath, ImageFormat imageFormat)
        {
            PerformValidations();
            
            // If image needs to be saved locally
            if (saveLocation == SaveLocation.Local)
            {
                // Build URL with querystring request parameters
                string uri = UriBuilder("");
                
                // Send the request to Saaspose server
                Stream responseStream = Utils.ProcessCommand(Utils.Sign(uri), "GET");
                // Read the response, in this case the response is a Stream that contains barcode image
                // So, just save the response stream to a local image file
                using (Stream file = File.OpenWrite(outputPath))
                {
                    CopyStream(responseStream, file);
                }
                responseStream.Close();

                GenerationResponse response = new GenerationResponse();
                response.Status = "OK";
                return response;
            }
            else if (saveLocation == SaveLocation.Server)
            {
                // Build URL with querystring request parameters
                string uri = UriBuilder(outputPath);

                // Send the request to Saaspose server
                Stream responseStream = Utils.ProcessCommand(Utils.Sign(uri), "PUT");
                StreamReader reader = new StreamReader(responseStream);
                // Read the response
                string strJSON = reader.ReadToEnd();


                //Parse the json string to JObject
                JObject parsedJSON = JObject.Parse(strJSON);


                //Deserializes the JSON to a object. 
                GenerationResponse barcodeGenerationResponse = JsonConvert.DeserializeObject<GenerationResponse>(parsedJSON.ToString());

                return barcodeGenerationResponse;
            }

            // Return null, if anything goes wrong
            return null;
        }
 public HttpResponseMessage Post([FromBody] SaveLocation location)
 {
     return(savelocationrequestHandler.CreateGbObject(Request, location));
 }
Exemple #26
0
 public Value(ushort lit)
 {
     this.Buffer = null;
     this.Index = 0;
     this.SaveLoc = SaveLocation.Literal;
     this.Literal = lit;
     this.MyCpu = null;
 }
        /// <summary>
        /// Creates the barcode and save the barcode image to the supplied stream
        /// Example: Save(SaveLocation.Local, imgStream, ImageFormat.PNG);
        /// </summary>
        /// <param name="imageStream">Stream where image will be saved</param>
        /// <param name="ImageFormat">Image format</param>
        public GenerationResponse Save(SaveLocation saveLocation, Stream imageStream, ImageFormat imageFormat)
        {
            PerformValidations();

            // Build URL with querystring request parameters
            string uri = UriBuilder("");

            // Send the request to Saaspose server
            Stream responseStream = Utils.ProcessCommand(Utils.Sign(uri), "GET");
            // Read the response, in this case the response is a Stream that contains barcode image
            // Just copy the response stream to the image stream that user passed
            CopyStream(responseStream, imageStream);
            // close the response stream
            responseStream.Close();

            GenerationResponse response = new GenerationResponse();
            response.Status = "OK";
            return response;
        }
Exemple #28
0
 public XmlFile(SaveLocation saveLocation, string relativePath)
 {
     FullPath = Files.GetPath(saveLocation, relativePath);
 }
Exemple #29
0
        /// <summary>
        /// Get the particular image from the specified page with the default image size
        /// </summary>
        /// <param name="outputPath"></param>
        /// <param name="pageNumber"></param>
        public void GetImage(string outputPath, int pageNumber, int imageIndex, ExtractImageFormat imageFormat, SaveLocation saveLocation)
        {
            //build URI to get page count
            string strURI = Product.BaseProductUri + "/pdf/" + FileName + "/pages/" + pageNumber.ToString() + "/images/" + imageIndex.ToString();

            strURI += "?format=" + imageFormat;


            string signedURI = Utils.Sign(strURI);

            Stream responseStream = Utils.ProcessCommand(signedURI, "GET");

            using (Stream fileStream = System.IO.File.OpenWrite(outputPath))
            {
                Utils.CopyStream(responseStream, fileStream);
            }
            responseStream.Close();
        }
 public bool IsSavedToAllowedForLocation(SaveLocation location, string accountName)
 {
     throw new NotImplementedException();
 }
Exemple #31
0
 public Value(SaveLocation loc, Cpu cpu)
 {
     this.Buffer = null;
     this.Index = 0;
     this.SaveLoc = loc;
     this.Literal = 0;
     this.MyCpu = cpu;
 }
Exemple #32
0
        /// <summary>
        /// Reads a UnitObject from the internal serialised byte array.
        /// </summary>
        private void _ReadUnit()
        {
            //// start of header
            // unit object versions
            _version = _bitBuffer.ReadInt16();
            _context = (ObjectContext)_bitBuffer.ReadByte();
            if (_version != 0x00BF && _version != 0x00CD && _version != 0x00CF) throw new Exceptions.NotSupportedVersionException("0x00BF or 0x00CD or 0x00CF", "0x" + _version.ToString("X4"));
            if (_context != ObjectContext.Save && _context != ObjectContext.CharSelect &&
                _context != ObjectContext.CharStats && _context != ObjectContext.ItemDrop)
            {
                throw new Exceptions.NotSupportedVersionException("0x00 or 0x02 or 0x03 or 0x04", "0x" + _context.ToString("X2"));
            }
            if (_debugOutputLoadingProgress)
            {
                Debug.WriteLine(String.Format("Version = {0} (0x{0:X4}), Context = {1} (0x{2:X2})", _version, _context, (int)_context));
            }

            // content bit fields
            _bitFieldCount = _bitBuffer.ReadBits(8);
            if (_bitFieldCount == 1) _bitField = _bitBuffer.ReadUInt32();
            if (_bitFieldCount == 2) _bitField = _bitBuffer.ReadUInt64();
            if (_debugOutputLoadingProgress)
            {
                Debug.WriteLine(String.Format("BitField = {0} (0x{1:X16})", _DebugBinaryFormat(_bitField), _bitField));
            }

            // total bit count
            if (_TestBit(Bits.Bit1DBitCountEof))
            {
                _bitCount = _bitBuffer.ReadBits(32);
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("Total BitCount = {0}", _bitCount));
                }
            }

            // begin data magic word
            if (_TestBit(Bits.Bit00FlagAlignment))
            {
                _beginFlag = (uint)_bitBuffer.ReadBits(32);
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("BeginFlag = 0x{0}", _beginFlag.ToString("X8")));
                }
                if (_beginFlag != ObjectMagicWord && _beginFlag != ItemMagicWord) throw new Exceptions.UnexpectedTokenException(ObjectMagicWord, _beginFlag);
            }

            // dunno what these are exactly
            if (_TestBit(Bits.Bit1CTimeStamps))
            {
                _timeStamp1 = _bitBuffer.ReadBits(32);
                _timeStamp2 = _bitBuffer.ReadBits(32);
                _timeStamp3 = _bitBuffer.ReadBits(32);
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("TimeStamp1 = {0}, TimeStamp2 = {1}, TimeStamp3 = {2}", _timeStamp1, _timeStamp2, _timeStamp3));
                }
            }

            // last station visited save/respawn location
            if (_TestBit(Bits.Bit1FSaveLocations))
            {
                int saveLocationsCount = _bitBuffer.ReadBitsShift(4);
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("SaveLocationsCount = {0}", saveLocationsCount));
                }

                for (int i = 0; i < saveLocationsCount; i++)
                {
                    ushort levelCode = _bitBuffer.ReadUInt16(); // table 0x6D (LEVEL)
                    ushort difficultyCode = _bitBuffer.ReadUInt16();  // table 0xB2 (DIFFICULTY)

                    SaveLocation saveLocation = new SaveLocation
                    {
                        Level = (LevelRow)FileManager.GetRowFromCode(Xls.TableCodes.LEVEL, (short)levelCode),
                        Difficulty = (DifficultyRow)FileManager.GetRowFromCode(Xls.TableCodes.DIFFICULTY, (short)difficultyCode)
                    };
                    SaveLocations.Add(saveLocation);

                    if ((SaveLocations[i].Level == null && SaveLocations[i].Difficulty != null) || (SaveLocations[i].Level != null && SaveLocations[i].Difficulty == null))
                    {
                        throw new Exceptions.UnitObjectException(String.Format("Invalid SaveLocation encountered. Level = {0:X4}, Difficulty = {1:X4}", levelCode, difficultyCode));
                    }

                    if (!_debugOutputLoadingProgress) continue;
                    if (SaveLocations[i].Level == null || SaveLocations[i].Difficulty == null)
                    {
                        Debug.WriteLine(String.Format("SaveLocations[{0}].LevelCode = {1} (0x{1:X4}), SaveLocations[{0}].DifficultyCode = {2} (0x{2:X4})",
                                                      i, levelCode, difficultyCode));
                    }
                    else
                    {
                        Debug.WriteLine(String.Format("SaveLocations[{0}].Level = {1}, SaveLocations[{0}].Difficulty = {2}",
                                                      i, SaveLocations[i].Level.levelName, SaveLocations[i].Difficulty.name));
                    }
                }
            }

            // character flags
            if (_TestBit(Bits.Bit20States1))
            {
                int statCount = _bitBuffer.ReadBits(8);
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("StateCode1Count = {0}", statCount));
                }

                for (int i = 0; i < statCount; i++)
                {
                    int state = _bitBuffer.ReadInt16();
                    AddState1(state); // table 0x4B (STATES)
                    if (_debugOutputLoadingProgress)
                    {
                        Debug.WriteLine(String.Format("StateCodes1[{0}] = {1}({2:X})", i, StateCodes1[i], (short)(StateCodes1[i])));
                    }
                }
            }
            //// end of header

            // bit offsets to bookmarks (only 1 bookmark though - "hotkeys")
            if (_TestBit(Bits.Bit1BBookmarks))
            {
                BookmarkCount = _bitBuffer.ReadBits(5);
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("BookmarkCount = {0}", BookmarkCount));
                }
                if (BookmarkCount > 1)
                {
                    throw new Exceptions.UnitObjectNotImplementedException("Unexpected BookmarkCount (> 1)!\nNot-Implemented cases. Please report this error and supply the offending file.");
                }

                for (int i = 0; i < BookmarkCount; i++)
                {
                    Bookmark bookmark = new Bookmark
                    {
                        Code = _bitBuffer.ReadUInt16(),
                        Offset = _bitBuffer.ReadInt32()
                    };
                    if (_debugOutputLoadingProgress)
                    {
                        Debug.WriteLine(String.Format("Bookmarks[{0}].Code = {1} (0x{1:X4}), Bookmarks[{0}].Offset = {2}", i, bookmark.Code, bookmark.Offset));
                    }

                    Bookmarks.Add(bookmark);
                }
            }

            // dunno...
            if (_TestBit(Bits.Bit05Unknown))
            {
                UnitObjectId = _bitBuffer.ReadInt32();
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("UnitObjectId = {0} (0x{0:X4})", UnitObjectId));
                }
            }

            // unit type/code
            // if unit type == 1, table = 0x91 (PLAYERS)
            //                 2, table = 0x77 (MONSTERS)
            //                 3? (table = 0x72; MISSILES at a guess. For memory, MISSILES doesn't use code values - probably why not seen in ASM)
            //                 4, table = 0x67 (ITEMS)
            //                 5, table = 0x7B (OBJECTS)
            UnitType = (UnitTypes)_bitBuffer.ReadBits(4);
            if (_debugOutputLoadingProgress)
            {
                Debug.WriteLine(String.Format("UnitType = {0}", UnitType));
            }
            UnitCode = _bitBuffer.ReadUInt16();
            if (_debugOutputLoadingProgress)
            {
                Debug.Write(String.Format("UnitCode = {0} (0x{0:X4}), ", UnitCode));
            }
            Xls.TableCodes tableCode = Xls.TableCodes.Null;
            switch (UnitType)
            {
                case UnitTypes.Player:  tableCode = Xls.TableCodes.PLAYERS;  break;
                case UnitTypes.Monster: tableCode = Xls.TableCodes.MONSTERS; break;
                case UnitTypes.Missile: tableCode = Xls.TableCodes.MISSILES; break;
                case UnitTypes.Item:    tableCode = Xls.TableCodes.ITEMS;    break;
                case UnitTypes.Object:  tableCode = Xls.TableCodes.OBJECTS;  break;
            }
            if (tableCode == Xls.TableCodes.Null) throw new Exceptions.UnitObjectException("The unit object data has an unknown UnitType.");
            UnitData = FileManager.GetUnitDataRowFromCode(tableCode, (short)UnitCode);
            if (UnitData == null) Debug.WriteLine(String.Format("Warning: UnitCode {0} (0x{0:X4}) not found!", UnitCode));
            if (_debugOutputLoadingProgress && UnitData != null)
            {
                ExcelFile unitDataTable = FileManager.GetExcelTableFromCode(tableCode);
                String rowName = unitDataTable.ReadStringTable(UnitData.name);
                Debug.WriteLine(String.Format("UnitDataName = " + rowName));
            }

            // unit object id
            if (_TestBit(Bits.Bit17ObjectId))
            {
                if (_version > 0xB2)
                {
                    ObjectId = _bitBuffer.ReadUInt64();
                    if (_debugOutputLoadingProgress)
                    {
                        Debug.WriteLine(String.Format("ObjectId = {0} (0x{0:X16})", ObjectId));
                    }

                    if (ObjectId == 0)
                    {
                        throw new Exceptions.UnitObjectNotImplementedException("if (ObjectId == 0)");
                    }
                }
            }

            // item positioning stuff
            if (_TestBit(Bits.Bit01Unknown) || _TestBit(Bits.Bit03Unknown))
            {
                IsInventory = _bitBuffer.ReadBool();
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("IsInventory = {0}, Bits.Bit01Unknown = {1}, Bits.Bit03Unknown = {2}", IsInventory, _TestBit(Bits.Bit01Unknown), _TestBit(Bits.Bit03Unknown)));
                }

                if (IsInventory) // item is in inventory
                {
                    if (_TestBit(Bits.Bit02Unknown))
                    {
                        Unknown02 = _bitBuffer.ReadBits(32);
                        if (_debugOutputLoadingProgress)
                        {
                            Debug.WriteLine(String.Format("Unknown02 = {0}", Unknown02));
                        }
                    }

                    InventoryLocationIndex = _bitBuffer.ReadBits(12);
                    InventoryPositionX = _bitBuffer.ReadBits(12);
                    InventoryPositionY = _bitBuffer.ReadBits(12);
                    Unknown04 = _bitBuffer.ReadBits(4);
                    if (_debugOutputLoadingProgress)
                    {
                        Debug.WriteLine(String.Format("InventoryLocationIndex = {0}, InventoryPositionX = {1}, InventoryPositionY = {2}, Unknown04 = {3}",
                            InventoryLocationIndex, InventoryPositionX, InventoryPositionY, Unknown04));
                    }

                    Unknown0103Int64 = _bitBuffer.ReadNonStandardFunc();
                    if (_debugOutputLoadingProgress)
                    {
                        Debug.WriteLine(String.Format("Unknown0103Int64 = {0} (0x{0:X16})", Unknown0103Int64));
                    }
                }
                else // item is a "world drop"
                {
                    RoomId = _bitBuffer.ReadInt32();

                    Position.X = _bitBuffer.ReadFloat();
                    Position.Y = _bitBuffer.ReadFloat();
                    Position.Z = _bitBuffer.ReadFloat();

                    Unknown0103Float21 = _bitBuffer.ReadFloat();
                    Unknown0103Float22 = _bitBuffer.ReadFloat();
                    Unknown0103Float23 = _bitBuffer.ReadFloat();

                    Normal.X = _bitBuffer.ReadFloat();
                    Normal.Y = _bitBuffer.ReadFloat();
                    Normal.Z = _bitBuffer.ReadFloat();

                    Unknown0103Int2 = _bitBuffer.ReadBits(10);

                    Unknown0103Float4 = _bitBuffer.ReadFloat();

                    Unknown0103Float5 = _bitBuffer.ReadFloat();

                    if (_debugOutputLoadingProgress)
                    {
                        Debug.WriteLine(String.Format("RoomId = {0}", RoomId));
                        Debug.WriteLine(String.Format("Position.X = {0}, Position.Y = {1}, Position.Z = {2}", Position.X, Position.Y, Position.Z));
                        Debug.WriteLine(String.Format("Unknown0103Float21 = {0}, Unknown0103Float22 = {1}, Unknown0103Float23 = {2}", Unknown0103Float21, Unknown0103Float22, Unknown0103Float23));
                        Debug.WriteLine(String.Format("NormalX = {0}, NormalY = {1}, NormalZ = {2}", Normal.X, Normal.Y, Normal.Z));
                        Debug.WriteLine(String.Format("Unknown0103Int2 = {0}", Unknown0103Int2));
                        Debug.WriteLine(String.Format("Unknown0103Float4 = {0}", Unknown0103Float4));
                        Debug.WriteLine(String.Format("Unknown0103Float5 = {0}", Unknown0103Float5));
                    }
                }
            }

            // I think this has something to do with the Monsters table +46Ch, bit 0x55 = 4 bits or bit 0x47 = 2 bits. Or Objects table +46Ch, bit 0x55 = 2 bits... Something like that
            if (_TestBit(Bits.Bit06Unknown))
            {
                UnknownBool06 = _bitBuffer.ReadBool();
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("UnknownBool06 = {0}", UnknownBool06));
                }
                if (!UnknownBool06)
                {
                    throw new Exceptions.UnitObjectNotImplementedException("if (UnknownBool06 != 1)");
                }
            }

            if (_TestBit(Bits.Bit09ItemLookGroup))
            {
                ItemLookGroupCode = _bitBuffer.ReadBits(8);
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("ItemLookGroupCode = {0} (0x{0:X2})", ItemLookGroupCode));
                }
            }

            // on character only
            if (_TestBit(Bits.Bit07CharacterShape))
            {
                CharacterHeight = _bitBuffer.ReadByte();
                CharacterBulk = _bitBuffer.ReadByte();
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("CharacterHeight = {0}, CharacterBulk = {1}", CharacterHeight, CharacterBulk));
                }
            }

            // object id for older versions - they moved it?
            if (_TestBit(Bits.Bit17ObjectId))
            {
                if (_version <= 0xB2)
                {
                    throw new Exceptions.UnitObjectNotImplementedException("if (_TestBit(0x17) && Version <= 0xB2)");
                }
            }

            // on character only
            if (_TestBit(Bits.Bit08CharacterName))
            {
                int unicodeCharCount = _bitBuffer.ReadBits(8);
                if (unicodeCharCount > 0)
                {
                    int byteCount = unicodeCharCount * 2; // is Unicode string without \0
                    _charNameBytes = new byte[byteCount];
                    for (int i = 0; i < byteCount; i++)
                    {
                        _charNameBytes[i] = _bitBuffer.ReadByte();
                    }
                    Name = Encoding.Unicode.GetString(_charNameBytes, 0, byteCount);
                    if (_debugOutputLoadingProgress)
                    {
                        Debug.WriteLine(String.Format("Name = {0}", Name));
                    }
                }
            }

            // on both character and items - appears to be always zero for items
            if (_TestBit(Bits.Bit0AStates2))
            {
                int stateCount = _bitBuffer.ReadBits(8);
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("StateCode2Count = {0}", stateCount));
                }

                for (int i = 0; i < stateCount; i++)
                {
                    int state = _bitBuffer.ReadInt16();
                    AddState2(state);
                    if (_debugOutputLoadingProgress)
                    {
                        Debug.WriteLine(String.Format("StateCodes2[{0}] = {1}({2:X})", i, StateCodes2[i], (short)(StateCodes2[i])));
                    }

                    // this section looks like it has more reading if Bit14 is flagged (CharSelectStats)
                }
            }

            if (_context > ObjectContext.CharSelect && (_context <= ObjectContext.Unknown6 || _context != ObjectContext.Unknown7)) // so if == 0, 1, 2, 7, then *don't* do this
            {
                ContextBool = _bitBuffer.ReadBool();
                if (ContextBool)
                {
                    ContextBoolValue = _bitBuffer.ReadBits(4); // invlocidx??
                }

                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("UsageBool = {0}, UsageBoolValue = {1}", ContextBool, ContextBoolValue));
                }
            }

            // <unknown bitfield 0x11th bit> - only seen as false anyways

            IsDead = _bitBuffer.ReadBool();
            if (_debugOutputLoadingProgress)
            {
                Debug.WriteLine(String.Format("IsDead = {0}", IsDead));
            }

            // unit stats
            if (_TestBit(Bits.Bit0DStats))
            {
                Stats.ReadStats(_bitBuffer, true);
            }
            else if (_TestBit(Bits.Bit14CharSelectStats))
            {
                int characterLevel = _bitBuffer.ReadByte(); // stats row 0x000 (level)
                Stats.SetStat("level", characterLevel);

                int characterPvpRankRowIndex = _bitBuffer.ReadByte(); // stats row 0x347 (player_rank)
                Stats.SetStat("player_rank", characterPvpRankRowIndex);

                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("LevelRowIndex = {0}, PlayerRankRowIndex = {1}", characterLevel, characterPvpRankRowIndex));
                }

                if (_TestBit(Bits.Bit1ECharSelectStatsMaxDifficulty))
                {
                    int maxDifficultyRowIndex = _bitBuffer.ReadBits(3); // stats row 0x347 (difficulty_max)
                    Stats.SetStat("difficulty_max", maxDifficultyRowIndex);

                    if (_debugOutputLoadingProgress)
                    {
                        Debug.WriteLine(String.Format("MaxDifficultyRowIndex = {0}, ", maxDifficultyRowIndex));
                    }
                }
            }

            HasAppearanceDetails = _bitBuffer.ReadBool();
            if (_debugOutputLoadingProgress)
            {
                Debug.WriteLine(String.Format("HasAppearanceDetails = {0}", HasAppearanceDetails));
            }
            if (HasAppearanceDetails)
            {
                _ReadAppearance();
            }

            if (_TestBit(Bits.Bit12Items))
            {
                ItemEndBitOffset = _bitBuffer.ReadInt32();
                ItemCount = _bitBuffer.ReadBits(10);
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("ItemEndBitOffset = {0}, ItemCount = {1}", ItemEndBitOffset, ItemCount));
                }

                for (int i = 0; i < ItemCount; i++)
                {
                    UnitObject item = new UnitObject(_bitBuffer, _debugOutputLoadingProgress);
                    item._ReadUnit();
                    Items.Add(item);
                }
            }

            if (_TestBit(Bits.Bit1AHotkeys))
            {
                HotkeyFlag = _bitBuffer.ReadUInt32();
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("HotkeyFlag = {0} (0x{0:X8})", HotkeyFlag));
                }
                if (HotkeyFlag != HotkeysMagicWord)
                {
                    throw new Exceptions.UnexpectedTokenException(HotkeysMagicWord, HotkeyFlag);
                }

                EndFlagBitOffset = _bitBuffer.ReadBits(32);     // to end flag
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("EndFlagBitOffset = {0}", EndFlagBitOffset));
                }

                HotkeyCount = _bitBuffer.ReadBits(6);
                if (_debugOutputLoadingProgress)
                {
                    Debug.WriteLine(String.Format("HotkeyCount = {0}", HotkeyCount));
                }
                for (int i = 0; i < HotkeyCount; i++)
                {
                    Hotkey hotkey = new Hotkey
                    {
                        Code = _bitBuffer.ReadUInt16(), // code from TAG table
                    };
                    Hotkeys.Add(hotkey);
                    if (_debugOutputLoadingProgress)
                    {
                        Debug.WriteLine(String.Format("hotkey.Code = 0x{0:X4}", hotkey.Code));
                    }

                    hotkey.UnknownCount = _bitBuffer.ReadBits(4);
                    if (_debugOutputLoadingProgress)
                    {
                        Debug.WriteLine(String.Format("hotkey.UnknownCount = " + hotkey.UnknownCount));
                    }
                    if (hotkey.UnknownCount > 0x02)
                    {
                        throw new Exceptions.UnitObjectNotImplementedException("if (hotkey.UnknownCount > 0x02)");
                    }

                    hotkey.UnknownExists = new bool[hotkey.UnknownCount];
                    hotkey.UnknownValues = new int[hotkey.UnknownCount];
                    for (int j = 0; j < hotkey.UnknownCount; j++)
                    {
                        hotkey.UnknownExists[j] = _bitBuffer.ReadBool();
                        if (hotkey.UnknownExists[j])
                        {
                            hotkey.UnknownValues[j] = _bitBuffer.ReadBits(32); // under some condition this will be ReadFromOtherFunc thingy
                        }
                        if (_debugOutputLoadingProgress)
                        {
                            Debug.WriteLine(String.Format("hotkey.UnknownExists[{0}] = {1}, hotkey.UnknownValues[{0}] = 0x{2:X8}", j, hotkey.UnknownExists[j], hotkey.UnknownValues[j]));
                        }
                    }

                    hotkey.SkillCount = _bitBuffer.ReadBits(4);
                    hotkey.SkillExists = new bool[hotkey.SkillCount];
                    hotkey.SkillCode = new int[hotkey.SkillCount];
                    for (int j = 0; j < hotkey.SkillCount; j++)
                    {
                        hotkey.SkillExists[j] = _bitBuffer.ReadBool();
                        if (hotkey.SkillExists[j])
                        {
                            hotkey.SkillCode[j] = _bitBuffer.ReadBits(32); // code from SKILLS table
                        }
                        if (_debugOutputLoadingProgress)
                        {
                            Debug.WriteLine(String.Format("hotkey.SkillExists[{0}] = {1}, hotkey.SkillCode[{0}] = 0x{2:X8}", j, hotkey.SkillExists[j], hotkey.SkillCode[j]));
                        }
                    }

                    hotkey.UnitTypeCode = _bitBuffer.ReadBits(32); // code from UNITTYPES table
                    if (_debugOutputLoadingProgress)
                    {
                        Debug.WriteLine(String.Format("hotkey.UnitTypeCode = 0x{0:X8}", hotkey.UnitTypeCode));
                    }
                }
            }

            // end flag
            EndFlag = _bitBuffer.ReadBits(32);
            if (_debugOutputLoadingProgress)
            {
                Debug.WriteLine(String.Format("EndFlag = {0} (0x{0:X8})", EndFlag));
            }

            if (EndFlag != _beginFlag && EndFlag != ItemMagicWord)
            {
                int bitOffset = _bitCount - _bitBuffer.BitOffset;
                int byteOffset = (_bitBuffer.Length - _bitBuffer.Offset) - (_bitBuffer.BytesUsed);
                throw new Exceptions.InvalidFileException("Flags not aligned!\nBit Offset: " + _bitBuffer.BitOffset + "\nExpected: " + _bitCount + " (+" + bitOffset +
                                                          ")\nBytes Used: " + (_bitBuffer.BytesUsed) + "\nExpected: " + (_bitBuffer.Length - _bitBuffer.Offset) + " (+" + byteOffset + ")");
            }

            if (_TestBit(Bits.Bit1DBitCountEof)) // no reading is done in here
            {
                // todo: do check that we're at the EoF bit count etc
            }
        }
 protected virtual string BuildSavePath(SaveLocation baseLocation, string suffix, string levelName, string fileExtension)
 {
     return($"{BuildSaveLocation(baseLocation, suffix)}/{levelName}{ToFileExtension(fileExtension)}");
 }
Exemple #34
0
        public void SaveLocationTest()
        {
            LocationController controller   = new LocationController();
            SaveLocation       savelocation = new SaveLocation();

            savelocation.location              = new Location();
            savelocation.location.ID           = 10;
            savelocation.location.Name         = "New York";
            savelocation.location.LocationType = GBEnums.LocationType.Testing;
            savelocation.location.IsDefault    = false;
            savelocation.location.IsDeleted    = false;
            //Loc.UpdateDate=;
            savelocation.location.UpdateByUserID       = 111;
            savelocation.location.AddressInfo          = new AddressInfo();
            savelocation.location.AddressInfo.ID       = 102;
            savelocation.location.AddressInfo.Name     = "Thane";
            savelocation.location.AddressInfo.Address1 = "abccd";
            savelocation.location.AddressInfo.Address2 = "rftgyhujikol";
            savelocation.location.AddressInfo.City     = "mumbai";
            savelocation.location.AddressInfo.State    = "Maharashtra";
            savelocation.location.AddressInfo.ZipCode  = "400604";
            savelocation.location.AddressInfo.Country  = "India";


            savelocation.location.ContactInfo              = new ContactInfo();
            savelocation.location.ContactInfo.ID           = 103;
            savelocation.location.ContactInfo.Name         = "MK";
            savelocation.location.ContactInfo.CellPhone    = "2345678906";
            savelocation.location.ContactInfo.EmailAddress = "*****@*****.**";
            savelocation.location.ContactInfo.HomePhone    = "1212121";
            savelocation.location.ContactInfo.WorkPhone    = "1233456";
            savelocation.location.ContactInfo.FaxNo        = "123456788";
            savelocation.location.ContactInfo.IsDeleted    = false;

            savelocation.company                  = new Company();
            savelocation.company.Name             = "abc9";
            savelocation.company.ID               = 101;
            savelocation.company.Status           = GBEnums.AccountStatus.Active;
            savelocation.company.CompanyType      = GBEnums.CompanyType.Testing;
            savelocation.company.SubsCriptionType = GBEnums.SubsCriptionType.Pro;
            savelocation.company.TaxID            = "9115998900";
            savelocation.company.IsDeleted        = false;

            savelocation.company.AddressInfo         = new AddressInfo();
            savelocation.company.AddressInfo.ID      = 1111;
            savelocation.company.AddressInfo.City    = "Mumbai";
            savelocation.company.AddressInfo.Country = "India";
            savelocation.company.AddressInfo.ZipCode = "400603";

            savelocation.company.ContactInfo              = new ContactInfo();
            savelocation.company.ContactInfo.ID           = 2222;
            savelocation.company.ContactInfo.CellPhone    = "2345678906";
            savelocation.company.ContactInfo.EmailAddress = "*****@*****.**";
            savelocation.company.ContactInfo.HomePhone    = "451245135";
            savelocation.company.ContactInfo.WorkPhone    = "187546521";
            savelocation.company.ContactInfo.FaxNo        = "9875421545";

            savelocation.addressInfo          = new AddressInfo();
            savelocation.addressInfo.ID       = 102;
            savelocation.addressInfo.Name     = "Thane";
            savelocation.addressInfo.Address1 = "asdfsds";
            savelocation.addressInfo.Address2 = "asdasdas";
            savelocation.addressInfo.City     = "mumbai";
            savelocation.addressInfo.State    = "Maharashtra";
            savelocation.addressInfo.ZipCode  = "400604";
            savelocation.addressInfo.Country  = "India";

            savelocation.contactInfo              = new ContactInfo();
            savelocation.contactInfo.ID           = 103;
            savelocation.contactInfo.Name         = "MK";
            savelocation.contactInfo.CellPhone    = "2345678906";
            savelocation.contactInfo.EmailAddress = "*****@*****.**";
            savelocation.contactInfo.HomePhone    = "1212121";
            savelocation.contactInfo.WorkPhone    = "1233456";
            savelocation.contactInfo.FaxNo        = "123456788";
            savelocation.contactInfo.IsDeleted    = false;

            controller.Post(savelocation);
        }
Exemple #35
0
        internal void OpenFile()
        {
            MessageBox = new MessageBox
            {
                Title  = Utilities.GetInterfaceString("menu", "file", "open"),
                Icon   = BaseDialog.DialogIcon.Question,
                Button = BaseDialog.DialogButton.YesNoCancel,
                Text   = Utilities.GetInterfaceString("menu", "message", "open"),
                IsOpen = true
            };

            if (MessageBox.DialogResult == null)
            {
                return;
            }

            if (MessageBox.DialogResult == true)
            {
                SaveFile();
            }

            Interface.LogMessages.Clear();

            OpenFileDialog = new OpenFileDialog
            {
                Filter          = @"Intermediate files (*.te)|*.te|All files (*.*)|*",
                CheckFileExists = true,
                IsOpen          = true
            };

            if (OpenFileDialog.DialogResult != true)
            {
                return;
            }

            SaveLocation = OpenFileDialog.FileName;

            try
            {
                IntermediateFile.Parse(SaveLocation, out train, out panel, out sound);

                OnPropertyChanged(new PropertyChangedEventArgs(nameof(Train)));
                OnPropertyChanged(new PropertyChangedEventArgs(nameof(Panel)));
                OnPropertyChanged(new PropertyChangedEventArgs(nameof(Sound)));

                CreateItem();
            }
            catch (Exception e)
            {
                if (e is XmlException && SaveLocation.ToLowerInvariant().EndsWith(".dat") || e is InvalidDataException)
                {
                    /* At the minute, we need to use the import function to get existing trains into TrainEditor2
                     * Detect this is actually an existing train format and show a more useful error message
                     */
                    MessageBox = new MessageBox
                    {
                        Title  = Utilities.GetInterfaceString("menu", "file", "open"),
                        Icon   = BaseDialog.DialogIcon.Error,
                        Button = BaseDialog.DialogButton.Ok,
                        Text   = Utilities.GetInterfaceString("menu", "file", "wrongtype"),
                        IsOpen = true
                    };
                }
                else
                {
                    /* Generic error message-
                     * This isn't a file we recognise
                     */
                    MessageBox = new MessageBox
                    {
                        Title  = Utilities.GetInterfaceString("menu", "file", "open"),
                        Icon   = BaseDialog.DialogIcon.Error,
                        Button = BaseDialog.DialogButton.Ok,
                        Text   = e.Message,
                        IsOpen = true
                    };
                }


                SaveLocation = string.Empty;

                train = null;
                panel = null;
                sound = null;

                CreateNewFile();
            }
        }
Exemple #36
0
 public static string GetPath(SaveLocation saveLocation, string relativePath)
 {
     return(saveLocation != SaveLocation.Absolute
         ? SystemPath.Combine(_saveLocations[saveLocation], relativePath).AbsolutePath
         : SystemPath.Create(relativePath).AbsolutePath);
 }
Exemple #37
0
        public SaveLocation getDefaultLocation()
        {
            SaveLocation oldDefault = SaveLocations.Find(location => location.IsDefaultLocation);

            return(oldDefault);
        }