Ejemplo n.º 1
0
            public void AddBase2(Base2 b2)
            {
                //BCID = b2.BCID;
                //CCID = b2.CCID;
                BSID = b2.STID;
                STID = b2.FSID;

                BSPegID = b2.STPegID;
                STPegID = b2.FSPegID;


                BS  = b2.ST;
                ST  = b2.FS;
                sbs = b2.polar;

                HAFLErr = b2.polar.BearErr;
                HAFRErr = b2.polar.BearErr;
                //CID = b2.CID;
                //EID = b2.EID;
                AUID = GlobalLogon.AUID;
                //BLogID = b2.BLogID;
                LP = b2.LP;
                //CCnt = b2.CCnt;
                Grade       = b2.Grade;
                GradeTypeID = b2.GradeTypeID;
                BSCnt       = 1;
                //ArcCnt = b2.ArcCnt;
                //FSCnt = b2.FSCnt;
                //BaseID = b2.BaseID;
                MTID = b2.MTID;
                Mine = b2.Mine;
                Trav = b2.Trav;
                //C = b2.C;
                //E = b2.E;
            }
Ejemplo n.º 2
0
    private static void PathFind(Base2 scr, FieldInfo pf)
    {
        FindTransform atr = (FindTransform)pf.GetCustomAttributes(true).FirstOrDefault(a => a is FindTransform);

        if (atr != null)
        {
            string name = (atr.name == null) ? pf.Name : atr.name;
            try
            {
                GameObject g = atr.scene ? GameObject.Find(name).gameObject : scr.transform.GetTransforms().FirstOrDefault(a => a.name == name).gameObject;
                if (g == null)
                {
                    throw new Exception();
                }
                if (pf.FieldType == typeof(GameObject))
                {
                    pf.SetValue(scr, g);
                }
                else
                {
                    pf.SetValue(scr, g.GetComponent(pf.FieldType));
                }
            }
            catch { Debug.Log("cound not find path " + scr.name + "+" + name); }
        }
    }
Ejemplo n.º 3
0
 public static void Main()
 {
     UseInstanceMethods(null);
     Foo.PublicStatic();
     Base2.Base2PublicStatic();
     Base.BasePublicStatic();
 }
Ejemplo n.º 4
0
    private static void InitLoadPath(Base2 scr, FieldInfo pf)
    {
        FindAsset ap = (FindAsset)pf.GetCustomAttributes(true).FirstOrDefault(a => a is FindAsset);

        if (ap != null)
        {
            string name  = (ap.name == null) ? pf.Name : ap.name;
            object value = pf.GetValue(scr);
            if (ap.overide || (value == null || value.Equals(null)) || (value is IEnumerable && ((IEnumerable)value).Cast <object>().Count() == 0))
            {
                if (value is Array)
                {
                    Debug.Log("FindAsset " + name);
                    var type = value.GetType().GetElementType();
                    var q    = Base2.GetFiles().Where(a => a.Contains(name)).Select(a => UnityEditor.AssetDatabase.LoadAssetAtPath(a, type)).Where(a => a != null);
                    if (q.Count() == 0)
                    {
                        Debug.Log("could not find folder " + name);
                    }

                    pf.SetValue(scr, Cast(q, type));
                }
                else
                {
                    Debug.Log("FindAsset " + name);
                    pf.SetValue(scr, Base2.FindAsset(name, pf.FieldType));
                }
            }
        }
    }
Ejemplo n.º 5
0
    private static void CreateEnum(string cspath, Base2 g, FieldInfo f)
    {
        GenerateEnums ge = (GenerateEnums)f.GetCustomAttributes(true).FirstOrDefault(a => a is GenerateEnums);

        if (ge != null)
        {
            string cs  = "";
            var    fpa = cspath + ge.name + ".cs";
            if (!File.Exists(fpa) || ge.overide)
            {
                cs += "public enum " + ge.name + ":int{none = -1,";
                var ie = (IEnumerable)f.GetValue(g);
                foreach (Object o in ie)
                {
                    if (o != null)
                    {
                        cs += o.name + ",";
                    }
                }
                cs  = cs.Trim(new[] { ',' });
                cs += "}";
                Debug.Log("geneerated:" + cs);
                File.WriteAllText(fpa, cs);
            }
        }
    }
Ejemplo n.º 6
0
        public static void AppendMissing_BaseStringAlreadyEndsWithStringToAppend_ReturnsBaseString()
        {
            // Arrange
            const string Base1 = " ";
            const string Base2 = "     ";
            const string Base3 = "  \r\n ";
            const string Base4 = "here is some\r\nmore text ";
            const string Base5 = "http://www.microsoft.com/";

            // Act
            string actual1  = Base1.AppendMissing(" ");
            string actual2  = Base2.AppendMissing(" ");
            string actual3  = Base3.AppendMissing(" ");
            string actual4a = Base4.AppendMissing(" ");
            string actual4b = Base4.AppendMissing("more text ");
            string actual4c = Base4.AppendMissing("\r\nmore text ");
            string actual4d = Base4.AppendMissing("some\r\nmore text ");
            string actual5  = Base5.AppendMissing("/");

            // Assert
            Assert.Equal(Base1, actual1);
            Assert.Equal(Base2, actual2);
            Assert.Equal(Base3, actual3);
            Assert.Equal(Base4, actual4a);
            Assert.Equal(Base4, actual4b);
            Assert.Equal(Base4, actual4c);
            Assert.Equal(Base4, actual4d);
            Assert.Equal(Base5, actual5);
        }
Ejemplo n.º 7
0
        public static void AppendMissing_BaseStringDoesNotEndWithStringToAppend_ReturnsBaseStringWithEndingStringAppended()
        {
            // Arrange
            const string Base1 = " ";
            const string Base2 = "     ";
            const string Base3 = "  \r\n  ";
            const string Base4 = "here is some\r\nmore text";
            const string Base5 = "http://www.microsoft.com";

            const string Append1  = ".";
            const string Append2  = "%sometext#";
            const string Append3a = "+_+";
            const string Append3b = "\r\n";
            const string Append4a = "y";
            const string Append4b = "/";
            const string Append5  = "/IMissVista-JustKidding";

            // Act
            string actual1  = Base1.AppendMissing(Append1);
            string actual2  = Base2.AppendMissing(Append2);
            string actual3a = Base3.AppendMissing(Append3a);
            string actual3b = Base3.AppendMissing(Append3b);
            string actual4a = Base4.AppendMissing(Append4a);
            string actual4b = Base4.AppendMissing(Append4b);
            string actual5  = Base5.AppendMissing(Append5);

            // Assert
            Assert.Equal(Base1 + Append1, actual1);
            Assert.Equal(Base2 + Append2, actual2);
            Assert.Equal(Base3 + Append3a, actual3a);
            Assert.Equal(Base3 + Append3b, actual3b);
            Assert.Equal(Base4 + Append4a, actual4a);
            Assert.Equal(Base4 + Append4b, actual4b);
            Assert.Equal(Base5 + Append5, actual5);
        }
Ejemplo n.º 8
0
    static void Main(string[] args)
    {
        Base2 b = new Base2();

        b.Execute();
        b = new Derived2();
        b.Execute();
    }
Ejemplo n.º 9
0
        public IEnumerable subcontractLines()
        {
            var extension = PXCache <POOrderFilter> .GetExtension <PoOrderFilterExt>(Base2.orderfilter.Current);

            return(Base2.pOOrderLinesList().Cast <POLineRS>()
                   .Where(line => line.OrderType == POOrderType.RegularSubcontract &&
                          extension.SubcontractNumber.IsIn(null, line.OrderNbr)));
        }
Ejemplo n.º 10
0
 public override void Init()
 {
     base.Init();
     rigidbody.mass = 5;
     networkView.stateSynchronization = NetworkStateSynchronization.Off;
     //if (collider.sharedMaterial == null)
     collider.sharedMaterial = Base2.FindAsset <PhysicMaterial>("box");
 }
Ejemplo n.º 11
0
        private static void AwaitTaskTest()
        {
            Base2 bs2 = new Base2 {
                Acx = 100
            };
            var tt    = Task.Run(() => { return(bs2); });
            var bsGet = GetFromTask(tt).Result;

            bs2.Acx = -1;
            var bsGet1 = GetFromTask(tt).Result;
        }
Ejemplo n.º 12
0
      public static bool TestVirtualMethod03()
      {
          Base2 aa = new Base2();

          if (aa.Value() == 2)
          {
              return(true);
          }

          throw new Exception("error");
      }
Ejemplo n.º 13
0
 public static bool TryParse(string Value, Base2ParseMode ParseMode, bool Round, out Base2 Return)
 {
     try
     {
         Return = Parse(Value, ParseMode, Round);
     }
     catch
     {
         Return = new Base2(0);
         return(false);
     }
     return(true);
 }
Ejemplo n.º 14
0
        public void TestCtorMemberName()
        {
            var b1 = new Base1(null);

            Assert.NotNull(b1, "b1");
            Assert.AreEqual(1, b1.ctor(), "b1.ctor()");
            Assert.AreEqual(2, b1.Ctor(), "b1.Ctor()");

            var b2 = new Base2(null);

            Assert.NotNull(b2, "b2");
            Assert.AreEqual(1, b2.ctor, "b2.ctor");
            Assert.AreEqual(2, b2.Ctor, "b2.Ctor");

            var ctor = 3;

            Assert.AreEqual(3, ctor, "var ctor");
        }
Ejemplo n.º 15
0
    public override void Init()
    {
        networkView.stateSynchronization = NetworkStateSynchronization.Off;
        networkView.observed             = null;
        if (GunPicture == null)
        {
            GunPicture = Base2.FindAsset <Texture2D>(name);
        }
        player = root.GetComponent <Player>();
        //if (transform.Find("cursor") != null && cursor.Count == 0)
        //    cursor.Add(transform.Find("cursor"));
        var t = this.transform.GetTransforms().Skip(1).FirstOrDefault(a => a.name != "cursor");

        if (t != null)
        {
            gunModel = t.gameObject;
        }
        base.Init();
    }
Ejemplo n.º 16
0
        public static void AppendMissing_StringToAppendIsEmpty_AlwaysReturnBaseString()
        {
            // Arrange
            string       base1 = string.Empty;
            const string Base2 = " ";
            const string Base3 = "   \r\n ";
            const string Base4 = "here is some\r\nmore text";

            // Act
            string actual1 = base1.AppendMissing(string.Empty);
            string actual2 = Base2.AppendMissing(string.Empty);
            string actual3 = Base3.AppendMissing(string.Empty);
            string actual4 = Base4.AppendMissing(string.Empty);

            // Assert
            Assert.Equal(base1, actual1);
            Assert.Equal(Base2, actual2);
            Assert.Equal(Base3, actual3);
            Assert.Equal(Base4, actual4);
        }
Ejemplo n.º 17
0
    public static void Main()
    {
        Derived1 d1 = new Derived1();
        d1.Prop = 7;
        Console.WriteLine(d1);
        Base1 b1 = new Base1();
        Console.WriteLine(b1);

        Derived2 d2 = new Derived2();
        Base2 b2 = new Base2();
        d2.SetTheDude(77);
        Console.WriteLine(d2.GetTheDude());
    }
Ejemplo n.º 18
0
 private static string TestMethod2FromSharedCode <T>(Base2 <T> o) => o.Method2();
Ejemplo n.º 19
0
    static void Cap()
    {
        if (Selection.activeGameObject == null)
        {
            return;
        }
        Undo.RegisterSceneUndo("rtools");
        int           size = 256;
        var           sc   = SceneView.lastActiveSceneView.camera;
        GameObject    co   = (GameObject)Instantiate(Base2.FindAsset <GameObject>("SnapShotCamera"), sc.transform.position, sc.transform.rotation);
        Camera        c    = co.GetComponentInChildren <Camera>();
        RenderTexture rt   = RenderTexture.GetTemporary(size, size, 0, RenderTextureFormat.ARGB32);

        c.targetTexture = rt;
        var output = new Texture2D(size, size, TextureFormat.ARGB32, false);

        RenderTexture.active = rt;
        var g  = Selection.activeGameObject;
        var g2 = (GameObject)Instantiate(g, g.transform.position, g.transform.rotation);

        c.cullingMask = 1 << co.layer;
        foreach (var a in g2.GetComponentsInChildren <Transform>())
        {
            a.gameObject.layer = co.layer;
        }
        var r = g2.GetComponentInChildren <Renderer>();

        if (r == null)
        {
            Debug.Log("Render is null " + r.name); return;
        }
        g2.active = true;
        c.Render();
        output.ReadPixels(new Rect(0, 0, size, size), 0, 0);
        output.Apply();
        Color?bk = null;

        for (int x = 0; x < output.width; x++)
        {
            for (int y = 0; y < output.height; y++)
            {
                var px = output.GetPixel(x, y);
                if (bk == null)
                {
                    bk = px;
                }
                px.a = px == bk.Value ? 0 : .6f;
                output.SetPixel(x, y, px);
            }
        }
        var p = AssetDatabase.GetAssetPath(g);


        p = (p == "" ? Application.dataPath + "/materials/Icons/" : Path.GetDirectoryName(p)) + "/" + g.name + ".png";

        File.WriteAllBytes(p, output.EncodeToPNG());
        Debug.Log("Saved: " + p);
        RenderTexture.ReleaseTemporary(rt);
        RenderTexture.active = null;
        c.targetTexture      = null;
        DestroyImmediate(g2);
        DestroyImmediate(co);
    }
Ejemplo n.º 20
0
        static void Main(string[] args)
        {
            Base2 b = new Base2();
            b.Execute();
            b = new Derived2();
            b.Execute();

            // Running this code will output Base2.Execute twice.
            // If you change the base execute method to be virtual and
            // the derived class to override instead of hide the Execute method,
            // the code will display Base2.Execute and Derived2.Execute.
            // You should try to avoid hiding methods with the new keyword.

            Derived2 d = new Derived2();
            d.Execute();
            b = d;
            b.Execute();

            Console.ReadLine();
        }
Ejemplo n.º 21
0
        public static Base2 Parse(string Value, Base2ParseMode ParseMode, bool Round)
        {
            var ret = new Base2();
            var r   = new System.Text.RegularExpressions.Regex(@"[A-Za-z]*$");

            if (Value.EndsWith("bit", StringComparison.CurrentCultureIgnoreCase))
            {
                ret.Bits = Convert.ToUInt64(r.Replace(Value, ""));
            }
            if (Value.EndsWith("B", StringComparison.CurrentCultureIgnoreCase))
            {
                try { ret.Bytes = Convert.ToInt64(r.Replace(Value, "")); }
                catch { Value += "B"; }
            }

            if (ParseMode == Base2ParseMode.Binary)
            {
                if (Value.EndsWith("KBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Kibibits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Kibibits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("KB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Kibibytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Kibibytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("MBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Mebibits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Mebibits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("MB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Mebibytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Mebibytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("GBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Gibibits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Gibibits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("GB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Gibibytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Gibibytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("TBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Tebibits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Tebibits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("TB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Tebibytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Tebibytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("PBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Pebibits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Pebibits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("PB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Pebibytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Pebibytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
            }

            if (ParseMode == Base2ParseMode.Scientific)
            {
                if (Value.EndsWith("KIBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Kibibits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Kibibits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("KIB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Kibibytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Kibibytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("MIBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Mebibits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Mebibits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("MIB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Mebibytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Mebibytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("GIBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Gibibits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Gibibits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("GIB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Gibibytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Gibibytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("TIBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Tebibits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Tebibits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("TIB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Tebibytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Tebibytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("PIBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Pebibits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Pebibits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("PIB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Pebibytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Pebibytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("KBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Kilobits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Kilobits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("KB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Kilobytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Kilobytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("MBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Megabits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Megabits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("MB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Megabytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Megabytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("GBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Gigabits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Gigabits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("GB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Gigabytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Gigabytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("TBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Terabits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Terabits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("TB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Terabytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Terabytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("PBIT", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Petabits = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Petabits = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
                if (Value.EndsWith("PB", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (Round)
                    {
                        ret.Petabytes = Decimal.Round(Convert.ToDecimal(r.Replace(Value, "")));
                    }
                    else
                    {
                        ret.Petabytes = Convert.ToDecimal(r.Replace(Value, ""));
                    }
                }
            }

            ret.parseMode = ParseMode;
            return(ret);
        }
Ejemplo n.º 22
0
		public static Base2 Parse(string Value, Base2ParseMode ParseMode, bool Round)
		{
			var ret = new Base2();
			var r = new System.Text.RegularExpressions.Regex(@"[A-Za-z]*$");

			if (Value.EndsWith("bit", StringComparison.CurrentCultureIgnoreCase))
			{
				ret.Bits = Convert.ToUInt64(r.Replace(Value, ""));
			}
			if (Value.EndsWith("B", StringComparison.CurrentCultureIgnoreCase))
			{
				try { ret.Bytes = Convert.ToInt64(r.Replace(Value, "")); }
				catch { Value += "B"; }
			}

			if (ParseMode == Base2ParseMode.Binary)
			{
				if (Value.EndsWith("KBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Kibibits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Kibibits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("KB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Kibibytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Kibibytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("MBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Mebibits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Mebibits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("MB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Mebibytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Mebibytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("GBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Gibibits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Gibibits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("GB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Gibibytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Gibibytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("TBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Tebibits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Tebibits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("TB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Tebibytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Tebibytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("PBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Pebibits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Pebibits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("PB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Pebibytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Pebibytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
			}

			if (ParseMode == Base2ParseMode.Scientific)
			{
				if (Value.EndsWith("KIBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Kibibits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Kibibits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("KIB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Kibibytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Kibibytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("MIBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Mebibits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Mebibits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("MIB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Mebibytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Mebibytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("GIBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Gibibits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Gibibits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("GIB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Gibibytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Gibibytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("TIBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Tebibits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Tebibits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("TIB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Tebibytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Tebibytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("PIBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Pebibits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Pebibits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("PIB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Pebibytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Pebibytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("KBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Kilobits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Kilobits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("KB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Kilobytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Kilobytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("MBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Megabits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Megabits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("MB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Megabytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Megabytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("GBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Gigabits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Gigabits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("GB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Gigabytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Gigabytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("TBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Terabits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Terabits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("TB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Terabytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Terabytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("PBIT", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Petabits = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Petabits = Convert.ToDecimal(r.Replace(Value, ""));
				}
				if (Value.EndsWith("PB", StringComparison.CurrentCultureIgnoreCase))
				{
					if (Round)
						ret.Petabytes = Math.Round(Convert.ToDecimal(r.Replace(Value, "")), 0);
					else
						ret.Petabytes = Convert.ToDecimal(r.Replace(Value, ""));
				}
			}

			ret.parseMode = ParseMode;
			return ret;
		}
Ejemplo n.º 23
0
		public static bool TryParse(string Value, Base2ParseMode ParseMode, bool Round, out Base2 Return)
		{
			try
			{
				Return = Parse(Value, ParseMode, Round);
			}
			catch
			{
				Return = new Base2(0);
				return false;
			}
			return true;
		}
Ejemplo n.º 24
0
 public IEnumerable poOrderLinesList()
 {
     return(Base2.pOOrderLinesList().Cast <POLineRS>()
            .Where(line => line.OrderType != POOrderType.RegularSubcontract));
 }
Ejemplo n.º 25
0
 public override void Init()
 {
     base.Init();
     audio.clip = Base2.FindAsset <AudioClip>("PowerGun");
 }
Ejemplo n.º 26
0
    public override void InitValues()
    {
        checkOutSound = opendoor;
        if (buttons.Length == 0)
        {
            buttons = new Transform[] { this.transform }
        }
        ;
        if (itemType == MapItemType.shop)
        {
            text    = "" + gunType;
            endless = true;
            hide    = true;
            switch (gunType.Parse <GunType>())
            {
            case GunType.gravitygranate:     //gravgun
                score     = 150;
                bullets   = 5;
                RespawnTm = 60 * 3;
                break;

            case GunType.minigun:
                score = 220;
                break;

            case GunType.railgun:
                score = 150;
                break;

            case GunType.bazoka:
                score = 150;
                break;

            case GunType.ak:
                score = 100;
                break;

            case GunType.granate:
                score = 80;
                break;

            case GunType.physxgun:
                score   = 80;
                bullets = 50;
                break;

            case GunType.uzi:
                score = 70;
                break;

            case GunType.shotgun:
                score = 50;
                break;

            case GunType.pistol:
                score = 20;
                break;

            default:
                score = 100;
                break;
            }
            //playerPrefab.guns[(int)gunType.Parse<GunType>()].score = Score;
        }

        if (itemType == MapItemType.timewarp)
        {
            text    = "Time Warp, Press T to use";
            endless = true;
            hide    = true;
            score   = 70;
        }
        if (itemType == MapItemType.spotlight)
        {
            endless = true; score = 20; text = "Take SpotLight";
        }
        if (itemType == MapItemType.laser)
        {
            endless = true; score = 50; text = "Take Laser aim";
        }
        if (itemType == MapItemType.antigravitation)
        {
            endless = true;
            score   = 50;
            text    = "Take Zero Gravitation";
        }
        if (itemType == MapItemType.timewarp)
        {
            endless = true;
            score   = 50;
            text    = "Take TimeBomb";
        }
        if (itemType == MapItemType.life)
        {
            endless   = true;
            score     = 50;
            RespawnTm = 10000;
            bullets   = 45;
            text      = "Take Life";
        }
        if (itemType == MapItemType.energy)
        {
            endless = true;
            score   = 200;
            bullets = 10;
            text    = "Take Energy";
        }
        if (itemType == MapItemType.speedupgrate)
        {
            endless = true;
            score   = 300;
            text    = "Upgrate speed";
        }
        if (itemType == MapItemType.lifeupgrate)
        {
            endless = true;
            score   = 350;
            text    = "Upgrate life";
        }

        if (itemType == MapItemType.trap)
        {
            lookat  = true;
            bullets = 1000;
            endless = true;
            score   = 20;
            hide    = false;
            text    = "Trap";
        }
        if (itemType == MapItemType.lift)
        {
            hide     = false;
            text     = "elevator";
            payonce  = true;
            Distance = 0;
        }
        if (itemType == MapItemType.teleport)
        {
            checkOutSound = Base2.FindAsset <AudioClip>("teleport");
            endless       = true;
            text          = "Teleport";
            score         = 40;
        }
        if (itemType == MapItemType.door)
        {
            endless = false;
            text    = "Door";
        }
        if (itemType == MapItemType.speed)
        {
            checkOutSound = Base2.FindAsset <AudioClip>("speed");
            Distance      = 0;
            autoTake      = false;
            endless       = true;
            text          = "Speed up";
        }

        if (itemType == MapItemType.money)
        {
            hide      = true;
            RespawnTm = 30000;
            if (Score == 0)
            {
                score = -20;
            }
            text = "Take money";
        }

        if (itemType == MapItemType.jumper)
        {
            text     = "Jumper";
            endless  = true;
            Distance = 0;
        }

        base.InitValues();
    }
Ejemplo n.º 27
0
        //Buttons

        private void buttonConvert_Click(object sender, EventArgs e)
        {
            int count = 0;

            if (!String.IsNullOrWhiteSpace(textBoxBinary.Text))
            {
                count++;
            }

            if (!String.IsNullOrWhiteSpace(textBoxDecimal.Text))
            {
                count++;
            }

            if (!String.IsNullOrWhiteSpace(textBoxOctal.Text))
            {
                count++;
            }

            if (!String.IsNullOrWhiteSpace(textBoxHexadecimal.Text))
            {
                count++;
            }

            if (count == 0)
            {
                MessageBox.Show("Please insert an input!", "Warning!");
            }

            else if (radioButtonComplement2.Checked)
            {
                Base2 = textBoxBinary.Text;

                //Binary to Decimal
                Base10 = Convert.ToInt32(Base2, 2).ToString();

                int Aux = Convert.ToInt32(Base10) * (-1);


                if (radioButtonBits8.Checked)
                {
                    Base2 = Convert.ToString(Aux, 2);
                    Base2 = Base2.Substring(Math.Max(Base2.Length - 8, 0)).PadLeft(8, '0');
                }
                else if (radioButtonBits16.Checked)
                {
                    Base2 = Convert.ToString((short)Aux, 2).PadLeft(16, '0');
                }

                else if (radioButtonBits32.Checked)
                {
                    Base2 = Convert.ToString(Aux, 2);
                }

                else
                {
                    Base2 = Convert.ToString(Aux, 2);
                    Base2 = Base2.Substring(Math.Max(Base2.Length - 8, 0)).PadLeft(8, '0');
                }

                textBoxOctal.Text      = Base2;
                buttonConvert.Enabled  = false;
                textBoxBinary.ReadOnly = true;
            }

            else
            {
                ReadOnlyState();

                //Decimal Input
                if (!String.IsNullOrWhiteSpace(textBoxDecimal.Text))
                {
                    int dec;
                    dec = Convert.ToInt32(textBoxDecimal.Text);
                    //Decimal to binary

                    if (radioButtonBits8.Checked)
                    {
                        Base2 = Convert.ToString(dec, 2).PadLeft(8, '0');
                    }

                    else if (radioButtonBits16.Checked)
                    {
                        Base2 = Convert.ToString(dec, 2).PadLeft(16, '0');
                    }

                    else if (radioButtonBits32.Checked)
                    {
                        Base2 = Convert.ToString(dec, 2).PadLeft(32, '0');
                    }
                    else
                    {
                        Base2 = Convert.ToString(dec, 2).PadLeft(8, '0');
                    }

                    textBoxBinary.Text = Base2;

                    //Decimal to Octal

                    Base8             = Convert.ToString(dec, 8);
                    textBoxOctal.Text = Base8;

                    //Decimal to Hexadecimal
                    Base16 = dec.ToString("X");
                    textBoxHexadecimal.Text = Base16;

                    //Emphasis base
                    EmphasisBase(textBoxDecimal);
                }

                // Binary Input

                else if (!String.IsNullOrWhiteSpace(textBoxBinary.Text))
                {
                    Base2 = textBoxBinary.Text;

                    //Binary to Decimal
                    Base10 = Convert.ToInt32(Base2, 2).ToString();
                    textBoxDecimal.Text = Base10;


                    //Binary to Octal

                    Base8             = Convert.ToString(Convert.ToInt32(Base10), 8);
                    textBoxOctal.Text = Base8;

                    //Binary to Hexadecimal

                    Base16 = Convert.ToInt32(Base10).ToString("X");
                    textBoxHexadecimal.Text = Base16;

                    //Emphasis base
                    EmphasisBase(textBoxBinary);
                }

                //Octal Input

                else if (!String.IsNullOrWhiteSpace(textBoxOctal.Text))
                {
                    Base8 = textBoxOctal.Text;

                    //Octal to Decimal

                    Base10 = Convert.ToInt32(Base8, 8).ToString();
                    textBoxDecimal.Text = Base10;

                    //Octal to Binary

                    if (radioButtonBits8.Checked)
                    {
                        Base2 = Convert.ToString(Convert.ToInt32(Base10), 2).PadLeft(8, '0');
                    }
                    else if (radioButtonBits16.Checked)
                    {
                        Base2 = Convert.ToString(Convert.ToInt32(Base10), 2).PadLeft(16, '0');
                    }

                    else if (radioButtonBits32.Checked)
                    {
                        Base2 = Convert.ToString(Convert.ToInt32(Base10), 2).PadLeft(16, '0');
                    }
                    else
                    {
                        Base2 = Convert.ToString(Convert.ToInt32(Base10), 2);
                    }

                    textBoxBinary.Text = Base2;

                    //Octal to Hexadecimal

                    Base16 = Convert.ToInt32(Base10).ToString("X");
                    textBoxHexadecimal.Text = Base16;

                    //Emphasis base
                    EmphasisBase(textBoxOctal);
                }

                //Hexadecimal Input

                else if (!String.IsNullOrWhiteSpace(textBoxHexadecimal.Text))
                {
                    Base16 = textBoxHexadecimal.Text;

                    //Hexadecimal to Decimal

                    Base10 = Convert.ToInt32(Base16, 16).ToString();
                    textBoxDecimal.Text = Base10;

                    //Hexadecimal to Binary

                    if (radioButtonBits8.Checked)
                    {
                        Base2 = Convert.ToString(Convert.ToInt32(Base10), 2).PadLeft(8, '0');
                    }
                    else if (radioButtonBits16.Checked)
                    {
                        Base2 = Convert.ToString(Convert.ToInt32(Base10), 2).PadLeft(16, '0');
                    }

                    else if (radioButtonBits32.Checked)
                    {
                        Base2 = Convert.ToString(Convert.ToInt32(Base10), 2).PadLeft(16, '0');
                    }
                    else
                    {
                        Base2 = Convert.ToString(Convert.ToInt32(Base10), 2);
                    }

                    textBoxBinary.Text = Base2;

                    //Hexadecimal to Octal

                    Base8             = Convert.ToString(Convert.ToInt32(Base10), 8);
                    textBoxOctal.Text = Base8;

                    //Emphasis base
                    EmphasisBase(textBoxHexadecimal);
                }
            }
        }
Ejemplo n.º 28
0
 public sealed override decimal?GetValue(TScanLine row) => Base2.GetCartQty(row);