Пример #1
0
        internal static void Limits_Clear()
        {
            object HC = null;

            LimitArray = ArraysHelper.InitializeArray <LIMIT>(1);
            Limits_BuildLimitDef();
            // remove reference to limits file
            //UPGRADE_TODO: (1067) Member oPersist is not defined in type Variant. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1067
            HC.oPersist.WriteIniValue("LIMIT_FILE", "");
        }
Пример #2
0
        internal static void SaveRpgwoMap(string filename)
        {
            object mapElements = null;
            int    f           = FileSystem.FreeFile();

            mSurfaceArray = 0;

            if (modGlobals.FileExists(filename))
            {
                File.Delete(filename);
            }

            FileSystem.FileOpen(f, filename, OpenMode.Binary, OpenAccess.Write, OpenShare.LockWrite, -1);
            FileSystem.FilePut(f, mMapWidth);
            FileSystem.FilePut(f, mMapHeight);
            FileSystem.FilePut(f, mMapVersion);
            FileSystem.FilePut(f, mSurfaceArray);
            FileSystem.FilePut(f, mMapExtra);
            mNumberOfMonsters--;
            mNumberOfItems--;

            mv2NumberOfItems--;
            mv2NumberOfMonsters--;
            //Get Tile Id
            //ReDim mMap(1 To mMapWidth, 1 To mMapHeight)
            //Put #f, , mMap


            int countSurfaceItems = 1;


            tempmMapData = ArraysHelper.InitializeArray <mMapDataType>(countSurfaceItems);
            int MapSizeTotalCount = 0;
            int tempForEndVar     = mMapWidth;

            for (int x = 1; x <= tempForEndVar; x++)
            {
                int tempForEndVar2 = mMapHeight;
                for (int y = 1; y <= tempForEndVar2; y++)
                {
                    if (mMap[x - 1, y - 1] != 0)
                    {
                        tempmMapData[tempmMapData.GetUpperBound(0)].Xpos    = (short)x;
                        tempmMapData[tempmMapData.GetUpperBound(0)].Ypos    = (short)y;
                        tempmMapData[tempmMapData.GetUpperBound(0)].Surface = (short)mMap[x - 1, y - 1];
                        MapSizeTotalCount++;
                        tempmMapData = ArraysHelper.RedimPreserve(tempmMapData, new int[] { tempmMapData.GetUpperBound(0) + 2 });
                    }
                }
            }
            tempmMapData = ArraysHelper.RedimPreserve(tempmMapData, new int[] { tempmMapData.GetUpperBound(0) });

            if (mSurfaceArray == 1)
            {
                FileSystem.FilePut(f, mapElements);
                FileSystem.FilePut(f, tempmMapData);
            }
            else
            {
                FileSystem.FilePut(f, mMap);
            }


            if (v2Map)
            {
                FileSystem.FilePut(f, mv2NumberOfItems);
                // MsgBox mNumberOfItems
                //ReDim mItems(1 To mNumberOfItems)
                if (mv2NumberOfItems > 0)
                {
                    mItems = ArraysHelper.RedimPreserve(mItems, new int[] { modRpgwoMapFormat.mv2NumberOfItems });
                    FileSystem.FilePut(f, mItems);
                }
                //MsgBox Loc(1)
                FileSystem.FilePut(f, mv2NumberOfMonsters);
                //MsgBox mNumberOfMonsters
                //ReDim mMonsters(1 To mNumberOfMonsters)
                if (mv2NumberOfMonsters > 0)
                {
                    mMonsters = ArraysHelper.RedimPreserve(mMonsters, new int[] { modRpgwoMapFormat.mv2NumberOfMonsters });
                    FileSystem.FilePut(f, mMonsters);
                }
            }
            else
            {
                FileSystem.FilePut(f, mNumberOfItems);
                // MsgBox mNumberOfItems
                //ReDim mItems(1 To mNumberOfItems)
                if (mNumberOfItems > 0)
                {
                    mItems = ArraysHelper.RedimPreserve(mItems, new int[] { modRpgwoMapFormat.mNumberOfItems });
                    FileSystem.FilePut(f, mItems);
                }



                FileSystem.FilePut(f, mNumberOfMonsters);

                //MsgBox mNumberOfMonsters
                //ReDim mMonsters(1 To mNumberOfMonsters)
                if (mNumberOfMonsters > 0)
                {
                    mMonsters = ArraysHelper.RedimPreserve(mMonsters, new int[] { modRpgwoMapFormat.mNumberOfMonsters });
                    FileSystem.FilePut(f, mMonsters);
                }
            }
            // MsgBox "notes start:" & Loc(f)
            short k = 5000;

            FileSystem.FilePut(f, k);
            string notes = new string('\0', 5000);

            notes = StringsHelper.GetFixedLengthString(new String(' ', k), 5000);
            FileSystem.FilePut(f, notes);
            //Get Notes
            FileSystem.FileClose(f);
        }
Пример #3
0
        internal static void Limits_Init()
        {
            object HC = null;

            LimitStatus.Horizon       = false;
            LimitStatus.RA            = false;
            LimitStatus.LimitDetected = false;

            gSupressHorizonLimits = false;

            LimitArray = ArraysHelper.InitializeArray <LIMIT>(1);
            Limits_BuildLimitDef();

            //UPGRADE_TODO: (1067) Member oPersist is not defined in type Variant. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1067
            string str = Convert.ToString(HC.oPersist.ReadIniValue("LIMIT_ENABLE"));

            if (str != "")
            {
                //UPGRADE_TODO: (1067) Member ChkEnableLimits is not defined in type Variant. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1067
                HC.ChkEnableLimits.Value = Conversion.Val(str);
            }
            else
            {
                //UPGRADE_TODO: (1067) Member ChkEnableLimits is not defined in type Variant. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1067
                HC.ChkEnableLimits.Value = 1;
            }

            //UPGRADE_TODO: (1067) Member oPersist is not defined in type Variant. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1067
            str = Convert.ToString(HC.oPersist.ReadIniValue("LIMIT_FILE"));
            if (str != "")
            {
                // got a file to load
                Limits_ReadFile(str);
            }
            else
            {
                // no file assined - set defaults?
            }

            //UPGRADE_TODO: (1067) Member oPersist is not defined in type Variant. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1067
            str = Convert.ToString(HC.oPersist.ReadIniValue("LIMIT_HORIZON_ALGORITHM"));
            if (str != "")
            {
                gHorizonAlgorithm = Convert.ToInt32(Conversion.Val(str));
            }
            else
            {
                // default to interpolated
                gHorizonAlgorithm = 0;
                //UPGRADE_TODO: (1067) Member oPersist is not defined in type Variant. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1067
                HC.oPersist.WriteIniValue("LIMIT_HORIZON_ALGORITHM", "0");
            }

            //UPGRADE_TODO: (1067) Member oPersist is not defined in type Variant. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1067
            str = Convert.ToString(HC.oPersist.ReadIniValue("LIMIT_PARK"));
            if (str != "")
            {
                gLimitPark = Convert.ToInt32(Conversion.Val(str));
            }
            else
            {
                // default to interpolated
                gLimitPark = 0;
                //UPGRADE_TODO: (1067) Member oPersist is not defined in type Variant. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1067
                HC.oPersist.WriteIniValue("LIMIT_PARK", "0");
            }

            //UPGRADE_TODO: (1067) Member oPersist is not defined in type Variant. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1067
            str = Convert.ToString(HC.oPersist.ReadIniValue("LIMIT_SLEWS"));
            if (str != "")
            {
                gLimitSlews = Convert.ToInt32(Conversion.Val(str));
            }
            else
            {
                // default to interpolated
                gLimitSlews = 1;
                //UPGRADE_TODO: (1067) Member oPersist is not defined in type Variant. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1067
                HC.oPersist.WriteIniValue("LIMIT_SLEWS", "1");
            }

            Common.readAutoFlipData();
            AutoFlipState = 0;
        }
Пример #4
0
        internal static void Limits_ReadFile(string FileName)
        {
            object[, , , , ] aa_hadec = null;
            object HC         = null;
            int    pos        = 0;
            int    size       = 0;
            int    redimcount = 0;
            string temp1      = "";
            string temp2      = "";
            double ha         = 0;
            double DEC        = 0;

            LimitArray = ArraysHelper.InitializeArray <LIMIT>(1);
            try
            {
                if (FileName != "")
                {
                    FileSystem.FileClose(1);
                    FileSystem.FileOpen(1, FileName, OpenMode.Input, OpenAccess.Default, OpenShare.Default, -1);
                    LimitArray = ArraysHelper.InitializeArray <LIMIT>(101);
                    size       = 0;
                    redimcount = 0;
                    while (!FileSystem.EOF(1))
                    {
                        temp1 = FileSystem.LineInput(1);
                        temp2 = temp1.Substring(0, Math.Min(1, temp1.Length));
                        if (temp2 != "#" && temp2 != " ")
                        {
                            pos = (temp1.IndexOf(' ') + 1);
                            if (pos != 0)
                            {
                                temp2 = temp1.Substring(0, Math.Min(pos - 1, temp1.Length));
                                temp1 = temp1.Substring(Math.Max(temp1.Length - (Strings.Len(temp1) - pos), 0));
                                LimitArray[size].Az  = Double.Parse(temp2);
                                LimitArray[size].Alt = Double.Parse(temp1);
                                object tempAuxVar = aa_hadec[Convert.ToInt32(EQMath.gLatitude * EQMath.DEG_RAD), Convert.ToInt32(LimitArray[size].Alt * EQMath.DEG_RAD), Convert.ToInt32(LimitArray[size].Az * EQMath.DEG_RAD), Convert.ToInt32(ha), Convert.ToInt32(DEC)];
                                LimitArray[size].ha  = EQMath.Range24(ha * EQMath.RAD_HRS);
                                LimitArray[size].DEC = DEC * EQMath.RAD_DEG;
                                size++;
                                redimcount++;
                                if (redimcount > 90)
                                {
                                    redimcount = 0;
                                    LimitArray = ArraysHelper.RedimPreserve(LimitArray, new int[] { size + 101 });
                                }
                            }
                        }
                    }
                    LimitArray = ArraysHelper.RedimPreserve(LimitArray, new int[] { size + 1 });
                }
                Limits_BuildLimitDef();
            }
            catch
            {
                //UPGRADE_TODO: (1067) Member Add_Message is not defined in type Variant. More Information: https://www.mobilize.net/vbtonet/ewis/ewi1067
                HC.Add_Message("Error reading limits file");
            }
            finally
            {
                FileSystem.FileClose(1);
            }
        }