Esempio n. 1
0
        public void ModifyValue(HeroPropertyType property, AddType addType, float resultValue)
        {
            var value = this[property];

            switch (addType)
            {
            case AddType.Append:
            {
                value.SetAppendValue((int)resultValue);
            }
            break;

            case AddType.Base:
            {
                value.SetBaseValue((int)resultValue);
            }
            break;

            case AddType.Rate:
            {
                value.SetRate((int)resultValue);
            }
            break;
            }

            View.ProtertyChange(property, value.FinalValue);
        }
Esempio n. 2
0
 static async Task AddType(AddType obj)
 {
     var                 json                = JsonConvert.SerializeObject(obj);
     var                 httpContent         = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
     HttpClient          client              = new HttpClient();
     HttpResponseMessage httpResponseMessage = await client.PostAsync("http://localhost:2794/DictionaryConferenceType/AddType", httpContent);
 }
Esempio n. 3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            AddType covert = (value is AddType) ? (AddType)value : AddType.all;

            switch (covert)
            {
            case AddType.all:
                return("ostatnie 30dni");

            case AddType.last14days:
                return("ostatnie 14dni");

            case AddType.last7days:
                return("ostatnie 7dni");

            case AddType.last3days:
                return("ostatnie 3dni");

            case AddType.last24h:
                return("ostatnie 24h");

            default:
                goto case AddType.all;
            }
        }
Esempio n. 4
0
        private static MyLinkedList <int> AddFunction(int[] nums, AddType addType)
        {
            MyLinkedList <int> list = new MyLinkedList <int>();

            switch (addType)
            {
            case AddType.AddLast:
                for (int i = 0; i < nums.Length; i++)
                {
                    list.AddLast(nums[i]);
                }
                break;

            case AddType.AddFirst:
                for (int i = 0; i < nums.Length; i++)
                {
                    list.AddFirst(nums[i]);
                }
                break;

            default:
                throw new Exception("Invalid add type");
            }

            return(list);
        }
Esempio n. 5
0
    // picks random ad from given list for given type
    public static Ad_S1 GetAdd(List <Ad_S1> _ads, AddType _type)
    {
        bool _contains = false;

        // check that list contains type
        foreach (Ad_S1 _ad in _ads)
        {
            if (_ad.Type == _type)
            {
                _contains = true;
                break;
            }
        }

        if (!_contains)
        {
            throw new ArgumentException(string.Format("List of ads does not contain given type \"{0}\"", _type.ToString()));
        }

        // pick a random ad
        while (true)
        {
            Random _rand  = new Random();
            int    _index = _rand.Next(_ads.Count);

            Ad_S1 _ad = _ads[_index];
            if (_ad.Type == _type)
            {
                return(_ad);
            }
        }
    }
Esempio n. 6
0
        public ActionResult EditType(AddType obj)
        {
            if (ModelState.IsValid)
            {
                var user = dobj.Users.Where(x => x.EmailID == User.Identity.Name).FirstOrDefault();
                var type = dobj.NoteTypes.Where(x => x.ID == obj.ID).FirstOrDefault();
                if (type == null)
                {
                    return(HttpNotFound());
                }

                type.Name         = obj.Name.Trim();
                type.Description  = obj.Description.Trim();
                type.ModifiedDate = DateTime.Now;
                type.ModifiedBy   = user.ID;

                dobj.Entry(type).State = EntityState.Modified;
                dobj.SaveChanges();

                return(RedirectToAction("ManageType"));
            }
            else
            {
                return(View(obj));
            }
        }
Esempio n. 7
0
        public void StartLambda()
        {
            // tildeles en metode - som lambda udtryk
            Sum = (x, y) => x + y;

            int res = Sum(5, 8);

            Console.WriteLine(res);

            Sum = EnAndenMetode;

            res = Sum(5, 8);

            Console.WriteLine(res);


            stringMetode = (s) =>
            {
                Console.WriteLine("Dette er en tekst " + s);
            };
            talMetode = (x, y) => x + y;

            stringMetode("Peter");

            int res2 = talMetode(4, 9);

            Console.WriteLine("Talmetode = " + res2);
        }
        public static void AddParagraph(string ident, string text, AddType type = AddType.ActivePage)
        {
            PDFDocument document = documents[ident];
            Section     sect     = document.getSection(type);

            sect.AddParagraph(text);
        }
        private void BtnAddType_Click(object sender, EventArgs e)
        {
            AddType addType = new AddType();

            this.Hide();
            addType.Show();
        }
Esempio n. 10
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            var addForm = new AddType(repository);

            addForm.ShowDialog();
            Reload();
        }
Esempio n. 11
0
        /// <summary>
        /// Adds a generic AddType to a DateTime object
        /// </summary>
        /// <param name="now"><seealso cref="System.DateTime"/></param>
        /// <param name="adder">Type structure that acts as a switcher for what type of add to perform</param>
        /// <param name="much">How much AddType to add to each element for creating list of data</param>
        /// <returns>A DateTime object with the added AddType amounts</returns>
        public static DateTime Add(this DateTime now, AddType adder, double much)
        {
            DateTime ret = now;

            switch (adder)
            {
            case AddType.Years:
            {
                ret = now.AddYears((int)much);
                break;
            }

            case AddType.Months:
            {
                ret = now.AddMonths((int)much);
                break;
            }

            case AddType.Days:
            {
                ret = now.AddDays(much);
                break;
            }

            case AddType.Hours:
            {
                ret = now.AddHours(much);
                break;
            }

            case AddType.Minutes:
            {
                ret = now.AddMinutes(much);
                break;
            }

            case AddType.Seconds:
            {
                ret = now.AddSeconds(much);
                break;
            }

            case AddType.Milliseconds:
            {
                ret = now.AddMilliseconds(much);
                break;
            }

            case AddType.Ticks:
            {
                ret = now.AddTicks((long)much);
                break;
            }
            }
            return(ret);
        }
Esempio n. 12
0
        public override bool Equals(object obj)
        {
            var other = obj as AddNode;

            if (other == null)
            {
                return(false);
            }
            return(AddType.Equals(other.AddType) && ListsAreEqual(FileGlobs, other.FileGlobs));
        }
Esempio n. 13
0
        public override string ToString()
        {
            var properties = new Dictionary <string, string>
            {
                { "AddType", AddType.ToString() },
                { "FileGlobs", StringifyList(FileGlobs) }
            };

            return(StringifyValues(GetType().ToString(), properties));
        }
Esempio n. 14
0
        private void buttonShowTypesEdit_Click(object sender, RoutedEventArgs e)
        {
            ResourceType rt = (ResourceType)TypesTable.SelectedValue;

            if (rt != null)
            {
                AddType window = new AddType(rt);
                showNewWindow(window);
            }
        }
Esempio n. 15
0
        public ActionResult UpdateType(int id)
        {
            var     type  = _context.GetType(id);
            AddType model = new AddType
            {
                Id          = id,
                TypeName    = type.Name,
                Description = type.Description
            };

            return(View("AddType", model));
        }
Esempio n. 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckAccount();

            if (!string.IsNullOrEmpty(Request["id"]))
            {
                _id = Int32.Parse(Request["id"]);
                phAddRecord.Visible  = false;
                phEditRecord.Visible = true;
            }
            App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
            _data = db.GetEnviromentAddresses();
            if (!IsPostBack)
            {
                AddAddress.DataSource = _data;
                AddAddress.DataBind();
                EditAddress.DataSource = _data;
                EditAddress.DataBind();
                if (_data.Count > 0)
                {
                    AddAddress.SelectedIndex  = 0;
                    EditAddress.SelectedIndex = 0;
                }
                List <string> list = db.GetEnviromentType();
                AddType.DataSource = list;
                AddType.DataBind();
                AddType.SelectedIndex = 0;
                EditType.DataSource   = list;
                EditType.DataBind();
                EditType.SelectedIndex = 0;
                if (_id > 0)
                {
                    using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString()))
                    {
                        conn.Open();
                        SqlCommand cmd = new SqlCommand("e.[Name], e.Type, ea.Address, e.[Description] from [Enviroment] e " +
                                                        "join EnviromentAddresses ea on ea.Id=e.AddressId where e.Id=@id", conn);
                        cmd.Parameters.AddWithValue("id", _id);
                        SqlDataAdapter da = new SqlDataAdapter(cmd);
                        DataTable      dt = new DataTable();
                        da.Fill(dt);
                        if (dt.Rows.Count > 0)
                        {
                            EditType.SelectedValue    = dt.Rows[0]["Type"].ToString();
                            EditName.Text             = dt.Rows[0]["Name"].ToString();
                            EditAddress.SelectedValue = dt.Rows[0]["Address"].ToString();
                            EditDescription.Text      = dt.Rows[0]["Description"].ToString();
                        }
                    }
                }
            }
        }
Esempio n. 17
0
 private void buttonAddNewType_Click(object sender, RoutedEventArgs e)
 {
     if (Database.GetManifestation(autoCompleteBoxTypes.Text) == null)
     {
         AddType addType = new AddType(autoCompleteBoxTypes.Text);
         addType.ShowDialog();
     }
     else
     {
         AddType addType = new AddType();
         addType.ShowDialog();
     }
 }
Esempio n. 18
0
 public AddForm(AddType type)
 {
     InitializeComponent();
     if (type == AddType.Group)
     {
         label1.Text = "Group Name";
         Text        = "Add Group";
     }
     else
     {
         label1.Text = "User Name";
         Text        = "Add User";
     }
 }
Esempio n. 19
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="task"></param>
        /// <param name="namesToCheck">List or array of tasks you want to try to process. Returns on first sucess</param>
        /// <param name="type"></param>
        /// <param name="stoponerror"></param>
        /// <returns></returns>
        public static bool AddTask(ITask task, IEnumerable <string> namesToCheck, AddType type, bool stoponerror = true)
        {
            if (namesToCheck.Any(name => AddTask(task, name, type, false)))
            {
                return(true);
            }

            CommunityLib.Log.ErrorFormat($"[Task](Array) Failed to add \"{task.Name}\".");
            if (stoponerror)
            {
                BotManager.Stop();
            }
            return(false);
        }
Esempio n. 20
0
 /// <summary>
 /// Adds a generic AddType to a DateTime object
 /// </summary>
 /// <param name="now"><seealso cref="System.DateTime"/></param>
 /// <param name="adder">Type structure that acts as a switcher for what type of add to perform</param>
 /// <param name="much">How much AddType to add to each element for creating list of data</param>
 /// <returns>A DateTime object with the added AddType amounts</returns>
 public static DateTime Add(this DateTime now, AddType adder, double much)
 {
     DateTime ret = now;
     switch (adder)
     {
         case AddType.Years:
             {
                 ret = now.AddYears((int)much);
                 break;
             }
         case AddType.Months:
             {
                 ret = now.AddMonths((int)much);
                 break;
             }
         case AddType.Days:
             {
                 ret = now.AddDays(much);
                 break;
             }
         case AddType.Hours:
             {
                 ret = now.AddHours(much);
                 break;
             }
         case AddType.Minutes:
             {
                 ret = now.AddMinutes(much);
                 break;
             }
         case AddType.Seconds:
             {
                 ret = now.AddSeconds(much);
                 break;
             }
         case AddType.Milliseconds:
             {
                 ret = now.AddMilliseconds(much);
                 break;
             }
         case AddType.Ticks:
             {
                 ret = now.AddTicks((long)much);
                 break;
             }
     }
     return ret;
 }
Esempio n. 21
0
        public ActionResult EditType(int TypeID)
        {
            var   emailid = User.Identity.Name.ToString();
            Users admin   = dbobj.Users.Where(x => x.EmailID == emailid).FirstOrDefault();

            NoteTypes obj = dbobj.NoteTypes.Where(x => x.ID == TypeID).FirstOrDefault();

            AddType model = new AddType();

            model.TypeID      = obj.ID;
            model.TypeName    = obj.Name;
            model.Description = obj.Description;

            ViewBag.ProfilePicture = dbobj.Admin.Where(x => x.UserID == admin.ID).Select(x => x.ProfilePicture).FirstOrDefault();
            return(View(model));
        }
        public static void AddHeader(string ident, string text, HeaderType htype, AddType type = AddType.ActivePage)
        {
            PDFDocument document = documents[ident];
            Section     sect     = document.getSection(type);
            string      style    = "";

            switch (htype)
            {
            case HeaderType.first: style = "Heading1"; break;

            case HeaderType.second: style = "Heading2"; break;

            case HeaderType.third: style = "Heading3"; break;
            }
            Paragraph par = sect.AddParagraph(text, style);
        }
Esempio n. 23
0
        public void AddCommands_SetsAddItem(AddType?parameter, AddType expected)
        {
            var mocker = new AutoMocker()
                         .WithDefaults();

            using var scope = mocker.WithDbScope();
            using var _     = mocker.WithAutoDIResolver();

            var vm = mocker.CreateInstance <MainWindowViewModel>();

            Assert.IsTrue(vm.ShowAddCommand.CanExecute(parameter));
            vm.ShowAddCommand.Execute(parameter);

            Assert.IsNotNull(vm.AddItem);
            Assert.AreEqual(expected, vm.AddItem?.SelectedType);
        }
Esempio n. 24
0
        public override Resources GetById(int id)
        {
            string    str = string.Format("select * from AddType where Id=" + id);
            DataTable dt  = helper.GetData(str);

            if (dt != null && dt.Rows.Count > 0)
            {
                DataRow row     = dt.Rows[0];
                AddType addType = new AddType();
                addType.Id   = int.Parse(row[0].ToString());
                addType.Name = row[1].ToString();
                return(addType);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 25
0
        public ActionResult EditType(int id)
        {
            var type = dobj.NoteTypes.Where(x => x.ID == id).FirstOrDefault();

            if (type == null)
            {
                return(HttpNotFound());
            }

            AddType editType = new AddType
            {
                ID          = type.ID,
                Name        = type.Name,
                Description = type.Description
            };

            return(View(editType));
        }
Esempio n. 26
0
    public void AddPercAll(int figure, AddType type)
    {
        switch (type)
        {
        case AddType.common:
            AddPerc(figure, AttributeData.Hp);
            AddPerc(figure, AttributeData.Mp);
            AddPerc(figure, AttributeData.AT);
            AddPerc(figure, AttributeData.AD);
            AddPerc(figure, AttributeData.MT);
            AddPerc(figure, AttributeData.MD);
            break;

        case AddType.barChart:
            AddPerc(figure, AttributeData.Hp);
            AddPerc(figure, AttributeData.Mp);
            break;

        case AddType.phy:
            AddPerc(figure, AttributeData.AT);
            AddPerc(figure, AttributeData.AD);
            break;

        case AddType.mage:
            AddPerc(figure, AttributeData.MT);
            AddPerc(figure, AttributeData.MD);
            break;

        case AddType.allA:
            for (int i = 0; i < (int)AttributeData.End; i++)
            {
                AddPerc(figure, (AttributeData)i);
            }
            break;

        case AddType.resist:
            for (int i = 0; i < (int)StateTag.End; i++)
            {
                AddPerc(figure, (StateTag)i);
            }
            break;
        }
    }
Esempio n. 27
0
        public static double GetCurrentAndAdd(AddType Type, int Valor)
        {
            DateTime Test;

            switch (Type)
            {
            case AddType.Milisegundos:
                Test = DateTime.Now.AddMilliseconds(Valor);
                break;

            case AddType.Segundos:
                Test = DateTime.Now.AddSeconds(Valor);
                break;

            case AddType.Minutos:
                Test = DateTime.Now.AddMinutes(Valor);
                break;

            case AddType.Horas:
                Test = DateTime.Now.AddHours(Valor);
                break;

            case AddType.Dias:
                Test = DateTime.Now.AddDays(Valor);
                break;

            case AddType.Meses:
                Test = DateTime.Now.AddMonths(Valor);
                break;

            case AddType.Años:
                Test = DateTime.Now.AddYears(Valor);
                break;

            default:
                Test = DateTime.Now.AddSeconds(Valor);
                break;
            }
            TimeSpan span = (TimeSpan)(Test - new DateTime(0x7b2, 1, 1, 0, 0, 0));

            return(span.TotalSeconds);
        }
Esempio n. 28
0
        private void OnGUI()
        {
            targetObject = EditorGUILayout.ObjectField(
                "ParentObject",
                targetObject,
                typeof(GameObject),
                true
                ) as GameObject;

            addType = (AddType)EditorGUILayout.EnumPopup("Add Type", addType);

            guiRigidbody();

            guiObjectSync();

            guiPickup();

            guiBoxCollider();

            guiAction();
        }
Esempio n. 29
0
        public ActionResult AddType(AddType model)
        {
            var   emailid = User.Identity.Name.ToString();
            Users admin   = dbobj.Users.Where(x => x.EmailID == emailid).FirstOrDefault();

            if (ModelState.IsValid)
            {
                NoteTypes obj = new NoteTypes();
                obj.Name        = model.TypeName;
                obj.Description = model.Description;
                obj.CreatedDate = DateTime.Now;
                obj.CreaedBy    = admin.ID;
                obj.IsActive    = true;

                dbobj.NoteTypes.Add(obj);
                dbobj.SaveChanges();

                return(RedirectToAction("ManageTypes"));
            }
            return(View());
        }
Esempio n. 30
0
    public Ad_S1(SqlDataReader _reader)
    {
        int    _id      = (int)_reader["AdID"];
        string _typeStr = ((string)_reader["Type"]).ToLower();
        string _link    = ((string)_reader["Link"]).Trim();

        AddType _type = AddType.Invalid;

        if (_typeStr.Equals("h"))
        {
            _type = AddType.Horizontal;
        }
        else if (_typeStr.Equals("v"))
        {
            _type = AddType.Vertical;
        }

        ID   = _id;
        Type = _type;
        Link = _link;
    }
Esempio n. 31
0
        protected string TypeName(object value, AddType addType)
        {
            Type   t        = value.GetType();
            string fullName = t.AssemblyQualifiedName;

            switch (addType)
            {
            case AddType.Short:
                return(fullName.Substring(0, fullName.IndexOf(',')) + ", " + t.Assembly.GetName().Name);

            case AddType.ShortForCurrentAssembly:
                return((!t.Assembly.Equals(Assembly.GetExecutingAssembly())) ?
                       fullName :
                       fullName.Substring(0, fullName.IndexOf(',')) + ", " + t.Assembly.GetName().Name);

            default:
            case AddType.Default:
            case AddType.Full:
                return(fullName);
            }
        }
 /// <summary>
 /// Adds a file under a Folder ID
 /// </summary>
 /// <param name="Name"></param>
 /// <param name="xIOIn"></param>
 /// <param name="FolderID"></param>
 /// <param name="xType"></param>
 /// <returns></returns>
 public bool MakeFile(string Name, DJsIO xIOIn, ushort FolderID, AddType xType)
 {
     if (!ActiveCheck())
         return false;
     foreach (FileEntry x in xFileDirectory)
     {
         if (x.FolderPointer == FolderID && x.Name.ToLower() == Name.ToLower())
         {
             if (xType == AddType.NoOverWrite)
                 return (xActive = false);
             return x.Replace(xIOIn);
         }
     }
     try { return xAddFile(xIOIn, Name, FolderID); }
     catch { return (xActive = false); }
 }
Esempio n. 33
0
 /// <summary>
 /// Calculates average time between two dates
 /// </summary>
 /// <param name="now"><seealso cref="System.DateTime"/></param>
 /// <param name="span"><seealso cref="System.DateTime"/>, end of span time</param>
 /// <param name="adder">Type structure that acts as a switcher for what type of add to perform</param>
 /// <param name="much">How much AddType to add to each element for creating list of data</param>
 /// <returns>Average DateTime object</returns>
 public static DateTime Average(this DateTime now, DateTime span, AddType adder, double much)
 {
     return GetDateRange(now, span, adder, much).Average();
 }
Esempio n. 34
0
 /// <summary>
 /// Adds a file
 /// </summary>
 /// <param name="FileName"></param>
 /// <param name="FileLocation"></param>
 /// <param name="xType"></param>
 /// <returns></returns>
 public bool AddFile(string FileName, string FileLocation, AddType xType)
 {
     FileName.IsValidXboxName();
     if (xDrive.ActiveCheck())
         return false;
     DJsIO xIOIn = null;
     try { xIOIn = new DJsIO(FileLocation, DJFileMode.Open, true); }
     catch { return (xDrive.xActive = false); }
     try
     {
         FATXReadContents xconts = xRead();
         foreach (FATXFileEntry x in xconts.xfiles)
         {
             if (x.Name == FileName)
             {
                 bool xreturn = false;
                 if (xType == AddType.NoOverWrite)
                      return (xDrive.xActive = false);
                 else if (xType == AddType.Inject)
                     xreturn = x.xInject(xIOIn);
                 else xreturn = x.xReplace(xIOIn);
                 return (xreturn & !(xDrive.xActive = false));
             }
         }
         uint xnew = 0;
         long xpos = GetNewEntryPos(out xnew);
         if (xpos == -1)
             return (xDrive.xActive = false);
         uint[] blocks = Partition.xTable.GetNewBlockChain(xIOIn.BlockCountFATX(Partition), xnew + 1);
         if (blocks.Length == 0)
             return (xDrive.xActive = false);
         if (!Partition.WriteFile(blocks, ref xIOIn))
             return (xDrive.xActive = false);
         FATXEntry y = new FATXEntry(FileName, blocks[0], (int)xIOIn.Length, xpos, false, ref xDrive);
         if (!y.xWriteEntry())
             return (xDrive.xActive = false);
         if (xnew > 0)
         {
             List<uint> fileblocks = new List<uint>(Partition.xTable.GetBlocks(xStartBlock));
             fileblocks.Add(xnew);
             uint[] xtemp = fileblocks.ToArray();
             if (!Partition.xTable.WriteChain(ref xtemp))
                 return (xDrive.xActive = false);
         }
         if (!Partition.xTable.WriteChain(ref blocks))
             return (xDrive.xActive = false);
         if (Partition.WriteAllocTable())
             return !(xDrive.xActive = false);
         return (xDrive.xActive = false);
     }
     catch { xIOIn.Close(); return (xDrive.xActive = false); }
 }
        public bool AddFile(string FileName, byte[] fileData, AddType xType)
        {
            if (!VariousFunctions.IsValidXboxName(FileName))
                return false;

            if (xDrive.ActiveCheck())
                return false;

            DJsIO xIOIn = null;
            byte[] b = fileData;
            xIOIn = new DJsIO(b, true);

            try
            {
                FATXReadContents xconts = xRead();
                foreach (FATXFileEntry x in xconts.xfiles)
                {
                    if (string.Compare(x.Name, FileName, true) == 0)
                    {
                        bool xreturn = false;
                        if (xType == AddType.NoOverWrite)
                        {
                            xIOIn.Close();
                            return (xDrive.xActive = false);
                        }
                        else if (xType == AddType.Inject)
                        {
                            xreturn = x.xInject(xIOIn);
                        }
                        else
                        {
                            xreturn = x.xReplace(xIOIn);
                        }
                        xIOIn.Close();
                        return (xreturn & !(xDrive.xActive = false));
                    }
                }
                uint xnew = 0;
                long xpos = GetNewEntryPos(out xnew);
                if (xpos == -1)
                    return (xDrive.xActive = false);

                var count = xIOIn.BlockCountFATX(Partition);

                uint[] blocks = Partition.xTable.GetNewBlockChain(count, xnew + 1);

                if (blocks.Length == 0)
                    return (xDrive.xActive = false);

                if (!Partition.WriteFile(blocks, ref xIOIn))
                    return (xDrive.xActive = false);

                FATXEntry y = new FATXEntry(this,
                    FileName,
                    blocks[0], (int)xIOIn.Length,
                    xpos, false, ref xDrive);

                if (!y.xWriteEntry())
                    return (xDrive.xActive = false);

                if (xnew > 0)
                {
                    var filebx = Partition.xTable.GetBlocks(xStartBlock);
                    List<uint> fileblocks = new List<uint>(filebx);

                    fileblocks.Add(xnew);

                    uint[] xtemp = fileblocks.ToArray();

                    if (!Partition.xTable.WriteChain(ref xtemp))
                        return (xDrive.xActive = false);
                }

                if (!Partition.xTable.WriteChain(ref blocks))
                    return (xDrive.xActive = false);

                if (Partition.WriteAllocTable())
                    return !(xDrive.xActive = false);

                return (xDrive.xActive = false);
            }
            catch { xIOIn.Close(); return (xDrive.xActive = false); }
        }
        /// <summary>
        /// Adds a file
        /// </summary>
        /// <param name="FileName"></param>
        /// <param name="FileLocation"></param>
        /// <param name="xType"></param>
        /// <returns></returns>
        /// 
        public bool AddFile(string FileName, string FileLocation, AddType xType)
        {
            try
            {
                byte[] b = File.ReadAllBytes(FileLocation);

                if (b != null)
                {
                    return AddFile(FileName, b, xType);
                }
                else
                {
                    return false;
                }
            }
            catch { return false; }
        }
Esempio n. 37
0
 /// <summary>
 /// Gets a range of DateTimes
 /// </summary>
 /// <param name="StartingDate">Starting DateTime</param>
 /// <param name="EndingDate">Ending DateTime</param>
 /// <param name="add">Type structure that acts as a switcher for what type of add to perform</param>
 /// <param name="much">How much AddType to add to each element for creating list of data</param>
 /// <returns>A list of DateTime objects that corresponds in the interval between StartingDate and EndingDate</returns>
 public static List<DateTime> GetDateRange(this DateTime StartingDate, DateTime EndingDate, AddType add, double much)
 {
     if (StartingDate > EndingDate)
     {
         return null;
     }
     List<DateTime> rv = new List<DateTime>();
     DateTime tmpDate = StartingDate;
     do
     {
         rv.Add(tmpDate);
         tmpDate = tmpDate.Add(AddType.Minutes, much);
     } while (tmpDate <= EndingDate);
     return rv;
 }
Esempio n. 38
0
        private void ImportWorker(IncludeStatus statusToImport, AddAssembly addAssembly, AddType addType, AddTypeForwarder addTypeForwarder, AddMember addMember)
        {
            foreach (ThinAssembly assembly in _thinModel.Assemblies.Values)
            {
                if (assembly.IncludeStatus == statusToImport)
                    addAssembly(assembly);

                foreach (ThinTypeForwarder typeForwarder in assembly.TypeForwarders.Values)
                {
                    if (typeForwarder.IncludeStatus == statusToImport)
                    {
                        // Assembly may not have already been added because they might not have the correct IncludedStatus.
                        addAssembly(assembly);
                        addTypeForwarder(typeForwarder);
                    }
                }

                foreach (ThinType type in assembly.Types.Values)
                {
                    if (type.IncludeStatus == statusToImport)
                    {
                        // Assembly may not have already been added because they might not have the correct IncludedStatus.
                        addAssembly(assembly);
                        addType(type);
                    }

                    foreach (ThinMember member in type.Members.Values)
                    {
                        if (member.IncludeStatus == statusToImport)
                        {
                            // Assembly and Type may not have already been added because they might not have the correct IncludedStatus.
                            addAssembly(assembly);
                            addType(type);
                            addMember(member);
                        }
                    }
                }
            }
        }
 /// <summary>
 /// Adds a file
 /// </summary>
 /// <param name="Path"></param>
 /// <param name="xIOIn"></param>
 /// <param name="xType"></param>
 /// <returns></returns>
 public bool MakeFile(string Path, DJsIO xIOIn, AddType xType)
 {
     if (!ActiveCheck())
         return false;
     if (Path == null || Path == "")
         return (xActive = false);
     Path = Path.Replace("\\", "/");
     if (Path[0] == '/')
         Path = Path.Substring(1, Path.Length - 1);
     if (Path[Path.Length - 1] == '/')
         Path = Path.Substring(0, Path.Length - 1);
     FolderEntry parent = xGetParentFolder(Path);
     if (parent == null)
         return (xActive = false);
     string file = Path.Split(new char[] { '/' }).LastValue();
     if (file == null || file == "")
         return (xActive = false);
     FileEntry z = xGetFile(file, parent.FolderPointer);
     if (z != null && xType == AddType.NoOverWrite)
         return (xActive = false);
     if (z == null)
     {
         if (xFileDirectory.Count + xFolderDirectory.Count + 1 >= 65535)
             return (xActive = false);
         return xAddFile(xIOIn, file, parent.FolderPointer);
     }
     else if (xType == AddType.Inject)
         return z.xInject(xIOIn);
     else return z.xReplace(xIOIn);
 }