コード例 #1
0
ファイル: AppSettings.cs プロジェクト: fedor4uk/DronProtect
        public AppSettings()
        {
            // Create default application settings.
            fileName    = StartupPath + "\\AppSettings#@@#.dat";
            mapProvider = "GoogleMap";
            language    = "ru-RU";
            bMap        = 50.198838912108;
            lMap        = 28.5602688789368;
            sizeMap     = 5;

            curMainTab   = 1;
            mapTabVState = 0;
            mapTabHState = 1;

            satZoneMode   = SatZoneMode.ShowActiveSatZone;
            radioZoneMode = RadioZoneMode.ShowActiveRadioZone;
            cacheType     = CacheType.DB;
            cacheLang     = CacheLang.EN;
            cacheMode     = CacheMode.ServerAndCache;

            dbCachePath   = "";
            fileCachePath = "";
            sasCachePath  = "";

            LineWidthActiveSat     = 2;
            LineStyleActiveSat     = 0;
            HatchStyleActiveSat    = 20;
            LineColorActiveSat     = Color.Green.Name;
            TranspLineActiveSat    = 150;
            IsFillActiveSat        = true;
            BrushStyleActiveSat    = 0;
            ForeColorActiveSat     = Color.Green.Name;
            BackColorActiveSat     = Color.White.Name;
            TransForeActiveSat     = 30;
            TransBackActiveSat     = 50;
            ShowImgActiveSat       = true;
            FontActiveSat          = 15;
            ShowShadowActiveSat    = true;
            FontForeColorActiveSat = Color.Black.Name;
            FontBackColorActiveSat = Color.Gainsboro.Name;


            LineWidthOtherSat     = 1;
            LineStyleOtherSat     = 0;
            LineColorOtherSat     = Color.Gray.Name;
            TransLineOtherSat     = 150;
            ShowImgOtherSat       = true;
            FontOtherSat          = 13;
            ShowShadowOtherSat    = true;
            FontForeColorOtherSat = Color.Black.Name;
            FontBackColorOtherSat = Color.Gainsboro.Name;
            IsFillOtherSat        = false;
            BrushStyleOtherSat    = 1;
            HatchStyleOtherSat    = 20;
            ForeColorOtherSat     = Color.LightGray.Name;
            BackColorOtherSat     = Color.White.Name;
            TransForeOtherSat     = 10;
            TransBackOtherSat     = 50;

            LineWidthRadio     = 2;
            LineStyleRadio     = 0;
            LineColorRadio     = Color.Red.Name;
            TransLineRadio     = 150;
            ShowImgRadio       = true;
            FontRadio          = 15;
            ShowShadowRadio    = true;
            FontForeColorRadio = Color.Black.Name;
            FontBackColorRadio = Color.Gainsboro.Name;
            IsFillRadio        = true;
            BrushStyleRadio    = 0;
            HatchStyleRadio    = 20;
            ForeColorRadio     = Color.Red.Name;
            BackColorRadio     = Color.White.Name;
            TransForeRadio     = 30;
            TransBackRadio     = 50;

            WidthTrack     = 2;
            LineStyleTrack = 0;
            PrevColorTrack = Color.Gray.Name;
            CurColorTrack  = Color.Green.Name;
            NextColorTrack = Color.Yellow.Name;
            TransTrack     = 150;

            if (File.Exists(fileName))
            {
                BinaryReader binReader =
                    new BinaryReader(File.Open(fileName, FileMode.Open));
                try
                {
                    mapProvider = binReader.ReadString();
                    language    = binReader.ReadString();
                    lMap        = binReader.ReadDouble();
                    bMap        = binReader.ReadDouble();
                    sizeMap     = binReader.ReadInt32();

                    curMainTab   = binReader.ReadInt32();
                    mapTabVState = binReader.ReadInt32();
                    mapTabHState = binReader.ReadInt32();


                    satZoneMode   = (SatZoneMode)binReader.ReadInt32();
                    radioZoneMode = (RadioZoneMode)binReader.ReadInt32();
                    cacheType     = (CacheType)binReader.ReadInt32();;
                    cacheLang     = (CacheLang)binReader.ReadInt32();
                    cacheMode     = (CacheMode)binReader.ReadInt32();

                    dbCachePath   = binReader.ReadString();
                    fileCachePath = binReader.ReadString();
                    sasCachePath  = binReader.ReadString();

                    LineWidthActiveSat     = binReader.ReadInt32();
                    LineStyleActiveSat     = binReader.ReadInt32();
                    HatchStyleActiveSat    = binReader.ReadInt32();
                    LineColorActiveSat     = binReader.ReadString();
                    TranspLineActiveSat    = binReader.ReadInt32();
                    IsFillActiveSat        = binReader.ReadBoolean();
                    BrushStyleActiveSat    = binReader.ReadInt32();
                    ForeColorActiveSat     = binReader.ReadString();
                    BackColorActiveSat     = binReader.ReadString();
                    TransForeActiveSat     = binReader.ReadInt32();
                    TransBackActiveSat     = binReader.ReadInt32();
                    ShowImgActiveSat       = binReader.ReadBoolean();
                    FontActiveSat          = binReader.ReadInt32();
                    ShowShadowActiveSat    = binReader.ReadBoolean();
                    FontForeColorActiveSat = binReader.ReadString();
                    FontBackColorActiveSat = binReader.ReadString();


                    LineWidthOtherSat     = binReader.ReadInt32();
                    LineStyleOtherSat     = binReader.ReadInt32();
                    LineColorOtherSat     = binReader.ReadString();
                    TransLineOtherSat     = binReader.ReadInt32();
                    ShowImgOtherSat       = binReader.ReadBoolean();
                    FontOtherSat          = binReader.ReadInt32();
                    ShowShadowOtherSat    = binReader.ReadBoolean();
                    FontForeColorOtherSat = binReader.ReadString();
                    FontBackColorOtherSat = binReader.ReadString();
                    IsFillOtherSat        = binReader.ReadBoolean();
                    BrushStyleOtherSat    = binReader.ReadInt32();
                    HatchStyleOtherSat    = binReader.ReadInt32();
                    ForeColorOtherSat     = binReader.ReadString();
                    BackColorOtherSat     = binReader.ReadString();
                    TransForeOtherSat     = binReader.ReadInt32();
                    TransBackOtherSat     = binReader.ReadInt32();

                    LineWidthRadio     = binReader.ReadInt32();
                    LineStyleRadio     = binReader.ReadInt32();
                    LineColorRadio     = binReader.ReadString();
                    TransLineRadio     = binReader.ReadInt32();
                    ShowImgRadio       = binReader.ReadBoolean();
                    FontRadio          = binReader.ReadInt32();
                    ShowShadowRadio    = binReader.ReadBoolean();
                    FontForeColorRadio = binReader.ReadString();
                    FontBackColorRadio = binReader.ReadString();
                    IsFillRadio        = binReader.ReadBoolean();
                    BrushStyleRadio    = binReader.ReadInt32();
                    HatchStyleRadio    = binReader.ReadInt32();
                    ForeColorRadio     = binReader.ReadString();
                    BackColorRadio     = binReader.ReadString();
                    TransForeRadio     = binReader.ReadInt32();
                    TransBackRadio     = binReader.ReadInt32();

                    WidthTrack     = binReader.ReadInt32();
                    LineStyleTrack = binReader.ReadInt32();
                    PrevColorTrack = binReader.ReadString();
                    CurColorTrack  = binReader.ReadString();
                    NextColorTrack = binReader.ReadString();
                    TransTrack     = binReader.ReadInt32();
                }

                // If the end of the stream is reached before reading
                // the four data values, ignore the error and use the
                // default settings for the remaining values.
                catch (EndOfStreamException e)
                {
                    Console.WriteLine("{0} caught and ignored. " +
                                      "Using default values.", e.GetType().Name);
                }
                finally
                {
                    binReader.Close();
                }
            }
        }
コード例 #2
0
ファイル: AppSettings.cs プロジェクト: fedor4uk/DronProtect
        public void LoadDefaultsStyle()
        {
            satZoneMode   = SatZoneMode.ShowActiveSatZone;
            radioZoneMode = RadioZoneMode.ShowActiveRadioZone;

            cacheType = CacheType.DB;
            cacheLang = CacheLang.EN;
            cacheMode = CacheMode.ServerAndCache;

            language = "ru-RU";

            dbCachePath   = "";
            fileCachePath = "";
            sasCachePath  = "";

            LineWidthActiveSat     = 2;
            LineStyleActiveSat     = 0;
            HatchStyleActiveSat    = 20;
            LineColorActiveSat     = Color.Green.Name;
            TranspLineActiveSat    = 150;
            IsFillActiveSat        = true;
            BrushStyleActiveSat    = 0;
            ForeColorActiveSat     = Color.Green.Name;
            BackColorActiveSat     = Color.White.Name;
            TransForeActiveSat     = 30;
            TransBackActiveSat     = 50;
            ShowImgActiveSat       = true;
            FontActiveSat          = 15;
            ShowShadowActiveSat    = true;
            FontForeColorActiveSat = Color.Black.Name;
            FontBackColorActiveSat = Color.Gainsboro.Name;


            LineWidthOtherSat     = 1;
            LineStyleOtherSat     = 0;
            LineColorOtherSat     = Color.Gray.Name;
            TransLineOtherSat     = 150;
            ShowImgOtherSat       = true;
            FontOtherSat          = 13;
            ShowShadowOtherSat    = true;
            FontForeColorOtherSat = Color.Black.Name;
            FontBackColorOtherSat = Color.Gainsboro.Name;
            IsFillOtherSat        = false;
            BrushStyleOtherSat    = 1;
            HatchStyleOtherSat    = 20;
            ForeColorOtherSat     = Color.LightGray.Name;
            BackColorOtherSat     = Color.White.Name;
            TransForeOtherSat     = 10;
            TransBackOtherSat     = 50;

            LineWidthRadio     = 2;
            LineStyleRadio     = 0;
            LineColorRadio     = Color.Red.Name;
            TransLineRadio     = 150;
            ShowImgRadio       = true;
            FontRadio          = 15;
            ShowShadowRadio    = true;
            FontForeColorRadio = Color.Black.Name;
            FontBackColorRadio = Color.Gainsboro.Name;
            IsFillRadio        = true;
            BrushStyleRadio    = 0;
            HatchStyleRadio    = 20;
            ForeColorRadio     = Color.Red.Name;
            BackColorRadio     = Color.White.Name;
            TransForeRadio     = 30;
            TransBackRadio     = 50;

            WidthTrack     = 2;
            LineStyleTrack = 0;
            PrevColorTrack = Color.Gray.Name;
            CurColorTrack  = Color.Green.Name;
            NextColorTrack = Color.Yellow.Name;
            TransTrack     = 150;
        }